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 
52  // Change the search priority of an already loaded ciftree. Nancy15+ ships one
53  // copy of the popup UI resources per player character, so the tree belonging
54  // to the active character has to win name lookups against all the others.
55  void setCifTreePriority(const Common::String &name, int priority);
56  PatchTree *readPatchTree(Common::SeekableReadStream *stream, const Common::String &name, int priority);
57 
58  // Debug functions
59 
60  // Return a human-readable description of a single CIF file.
61  Common::String getCifDescription(const Common::String &treeName, const Common::Path &name) const;
62 
63  // Return a list of all resources of a certain type (does not list external files)
64  void list(const Common::String &treeName, Common::Array<Common::Path> &outList, CifInfo::ResType type) const;
65 
66  // Exports a single resource as a standalone .cif file
67  bool exportCif(const Common::Path &name);
68 
69  // Exports a collection of resources as a ciftree
70  bool exportCifTree(const Common::String &treeName, const Common::Array<Common::Path> &names);
71 
72 private:
73  Common::Array<Common::String> _cifTreeNames;
74 };
75 
76 } // End of namespace Nancy
77 
78 #endif // NANCY_RESOURCE_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: rect.h:536
Definition: path.h:52
Definition: cif.h:126
Definition: stream.h:745
Definition: formatinfo.h:28
Definition: resource.h:36
Definition: iff.h:34
Definition: actionmanager.h:32