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
27namespace Graphics {
28struct Surface;
29class ManagedSurface;
30}
31
32namespace Nancy {
33
34class IFF;
35
37public:
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 // Loads a Lua script, which is what Nancy19 and up have in place of IFFs. These
50 // can be loose text files, standalone .cif files, or embedded inside a ciftree.
51 // The caller owns the stream.
52 Common::SeekableReadStream *loadScript(const Common::Path &name);
53
54 // Load a new ciftree
55 bool readCifTree(const Common::String &name, const Common::String &ext, int priority);
56
57 // Whether a ciftree of that name has been loaded. Nancy15 conversations use it
58 // to tell a cel archive apart from a movie of the same name (see ConversationCel).
59 bool hasCifTree(const Common::String &name) const;
60
61 // Change the search priority of an already loaded ciftree. Nancy15+ ships one
62 // copy of the popup UI resources per player character, so the tree belonging
63 // to the active character has to win name lookups against all the others.
64 void setCifTreePriority(const Common::String &name, int priority);
65 PatchTree *readPatchTree(Common::SeekableReadStream *stream, const Common::String &name, int priority);
66
67 // Debug functions
68
69 // Return a human-readable description of a single CIF file.
70 Common::String getCifDescription(const Common::String &treeName, const Common::Path &name) const;
71
72 // Return a list of all resources of a certain type (does not list external files)
73 void list(const Common::String &treeName, Common::Array<Common::Path> &outList, CifInfo::ResType type) const;
74
75 // Exports a single resource as a standalone .cif file
76 bool exportCif(const Common::Path &name);
77
78 // Exports a collection of resources as a ciftree
79 bool exportCifTree(const Common::String &treeName, const Common::Array<Common::Path> &names);
80
81private:
83};
84
85} // End of namespace Nancy
86
87#endif // NANCY_RESOURCE_H
Definition: path.h:52
Definition: stream.h:745
Definition: str.h:59
Definition: managed_surface.h:51
Definition: iff.h:35
Definition: cif.h:134
Definition: resource.h:36
Definition: formatinfo.h:28
Definition: actionmanager.h:32
Definition: rect.h:536