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