ScummVM API documentation
resource.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 NANCY_RESOURCE_H
23 #define NANCY_RESOURCE_H
24 
25 #include "engines/nancy/cif.h"
26 
27 namespace Graphics {
28 struct Surface;
29 class ManagedSurface;
30 }
31 
32 namespace Nancy {
33 
34 class IFF;
35 
37 public:
38  ResourceManager() = default;
39  ~ResourceManager() = default;
40 
41  // Load an image resource. Can be either external .bmp file, or raw image data embedded inside a ciftree
42  // Ciftree images may have additional data dictating how they need to be blitted on screen (see ConversationCel).
43  // This is accessed via the outSrc/outDest parameters.
44  bool loadImage(const Common::Path &name, Graphics::ManagedSurface &surf, const Common::String &treeName = Common::String(), Common::Rect *outSrc = nullptr, Common::Rect *outDest = nullptr);
45 
46  // Loads a single IFF file. These can either be inside standalone .cif files, or embedded inside a ciftree
47  IFF *loadIFF(const Common::Path &name);
48 
49  // Load a new ciftree
50  bool readCifTree(const Common::String &name, const Common::String &ext, int priority);
51  PatchTree *readPatchTree(Common::SeekableReadStream *stream, const Common::String &name, int priority);
52 
53  // Debug functions
54 
55  // Return a human-readable description of a single CIF file.
56  Common::String getCifDescription(const Common::String &treeName, const Common::Path &name) const;
57 
58  // Return a list of all resources of a certain type (does not list external files)
59  void list(const Common::String &treeName, Common::Array<Common::Path> &outList, CifInfo::ResType type) const;
60 
61  // Exports a single resource as a standalone .cif file
62  bool exportCif(const Common::String &treeName, const Common::Path &name);
63 
64  // Exports a collection of resources as a ciftree
65  bool exportCifTree(const Common::String &treeName, const Common::Array<Common::Path> &names);
66 
67 private:
68  Common::Array<Common::String> _cifTreeNames;
69 };
70 
71 } // End of namespace Nancy
72 
73 #endif // NANCY_RESOURCE_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: rect.h:524
Definition: path.h:52
Definition: cif.h:117
Definition: stream.h:745
Definition: formatinfo.h:28
Definition: resource.h:36
Definition: iff.h:34
Definition: actionmanager.h:32