ScummVM API documentation
files.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ACCESS_FILES_H
23 #define ACCESS_FILES_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/file.h"
28 #include "graphics/managed_surface.h"
29 #include "access/decompress.h"
30 
31 namespace Access {
32 
33 class AccessEngine;
34 
35 struct FileIdent {
36  int _fileNum;
37  int _subfile;
38 
39  FileIdent();
40  FileIdent(int fileNum, int subfile) { _fileNum = fileNum; _subfile = subfile; }
41 
42  void load(Common::SeekableReadStream &s);
43 };
44 
45 struct CellIdent : FileIdent {
46  byte _cell;
47 
48  CellIdent();
49  CellIdent(int cell, int fileNum, int subfile);
50 };
51 
52 class FileManager;
53 
54 class Resource {
55  friend class FileManager;
56 private:
57  Common::File _file;
58  byte *_data;
59 public:
61  int _size;
62 
63  Resource();
64  Resource(byte *data, int size);
65  ~Resource();
66  byte *data();
67 };
68 
69 class FileManager {
70 private:
71  AccessEngine *_vm;
72 
73  void openFile(Resource *res, const Common::Path &filename);
74 
78  void handleFile(Resource *res);
79 
83  void handleScreen(Graphics::ManagedSurface *dest, Resource *res);
84 
88  void setAppended(Resource *file, int fileNum);
89 
93  void gotoAppended(Resource *file, int subfile);
94 public:
95  int _fileNumber;
96  Common::Array<uint32> _fileIndex;
97  bool _setPaletteFlag;
98 public:
100  ~FileManager();
101 
105  bool existFile(const Common::Path &filename);
106 
110  Resource *loadFile(int fileNum, int subfile);
111 
115  Resource *loadFile(const FileIdent &fileIdent);
116 
120  Resource *loadFile(const Common::Path &filename);
121 
125  void loadScreen(int fileNum, int subfile);
126 
130  void loadScreen(const Common::Path &filename);
131 
135  void loadScreen(Graphics::ManagedSurface *dest, int fileNum, int subfile);
136 };
137 
138 } // End of namespace Access
139 
140 #endif /* ACCESS_FILES_H */
Definition: managed_surface.h:51
Definition: files.h:35
Definition: access.h:84
Definition: path.h:52
Definition: stream.h:745
Definition: files.h:54
Definition: file.h:47
Definition: files.h:69
Definition: files.h:45
Definition: access.h:62