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 GRIM_RESOURCE_H
23#define GRIM_RESOURCE_H
24
25#include "common/archive.h"
26#include "common/array.h"
27
28#include "engines/grim/object.h"
29
30namespace Grim {
31
32class AnimationEmi;
33class CMap;
34class Costume;
35class Font;
36class KeyframeAnim;
37class Material;
38class Model;
39class EMIModel;
40class LipSync;
41class TrackedObject;
42class SaveGame;
43class Skeleton;
44class Sprite;
45class EMICostume;
46class Lab;
47class Actor;
48class Overlay;
49
50typedef ObjectPtr<Material> MaterialPtr;
51typedef ObjectPtr<Model> ModelPtr;
52typedef ObjectPtr<CMap> CMapPtr;
53typedef ObjectPtr<KeyframeAnim> KeyframeAnimPtr;
54typedef ObjectPtr<Font> FontPtr;
55typedef ObjectPtr<LipSync> LipSyncPtr;
56typedef ObjectPtr<AnimationEmi> AnimationEmiPtr;
57
59public:
62
63 CMap *loadColormap(const Common::String &fname);
64 Costume *loadCostume(const Common::String &fname, Actor *owner, Costume *prevCost);
65 Font *loadFont(const Common::String &fname);
66 KeyframeAnim *loadKeyframe(const Common::String &fname);
67 Material *loadMaterial(const Common::String &fname, CMap *c, bool clamp);
68 Model *loadModel(const Common::String &fname, CMap *c, Model *parent = NULL);
69 EMIModel *loadModelEMI(const Common::String &fname, EMICostume *costume);
70 LipSync *loadLipSync(const Common::String &fname);
71 Skeleton *loadSkeleton(const Common::String &fname);
72 Sprite *loadSprite(const Common::String &fname, EMICostume *costume);
73 AnimationEmi *loadAnimationEmi(const Common::String &filename);
74 Overlay *loadOverlay(const Common::String &filename);
75 Common::SeekableReadStream *openNewStreamFile(const Common::String &fname, bool cache = false) const;
76
77 ModelPtr getModel(const Common::String &fname, CMap *c);
78 CMapPtr getColormap(const Common::String &fname);
79 KeyframeAnimPtr getKeyframe(const Common::String &fname);
80 LipSyncPtr getLipSync(const Common::String &fname);
81 AnimationEmiPtr getAnimationEmi(const Common::String &fname);
82 void uncacheModel(Model *m);
83 void uncacheColormap(CMap *c);
84 void uncacheKeyframe(KeyframeAnim *kf);
85 void uncacheLipSync(LipSync *l);
86 void uncacheAnimationEmi(AnimationEmi *a);
87
89 char *fname;
90 byte *resPtr;
91 uint32 len;
92 };
93
94 static Common::String fixFilename(const Common::String &filename, bool append = true);
95
96private:
97 Common::SeekableReadStream *loadFile(const Common::Path &filename) const;
98 Common::SeekableReadStream *getFileFromCache(const Common::Path &filename) const;
99 ResourceLoader::ResourceCache *getEntryFromCache(const Common::Path &filename) const;
100 void putIntoCache(const Common::Path &fname, byte *res, uint32 len) const;
101 void uncache(const Common::Path &fname) const;
102
103 mutable Common::Array<ResourceCache> _cache;
104 mutable bool _cacheDirty;
105 mutable int32 _cacheMemorySize;
106
107 Common::List<EMIModel *> _emiModels;
108 Common::List<Model *> _models;
109 Common::List<CMap *> _colormaps;
110 Common::List<KeyframeAnim *> _keyframeAnims;
111 Common::List<LipSync *> _lipsyncs;
113};
114
115extern ResourceLoader *g_resourceloader;
116
117} // end of namespace Grim
118
119#endif
Definition: array.h:52
Definition: list.h:44
Definition: path.h:52
Definition: stream.h:745
Definition: str.h:59
Actor represents a 3D character on screen.
Definition: actor.h:72
Definition: animationemi.h:60
Definition: colormap.h:35
Definition: costume.h:45
Definition: costumeemi.h:40
Definition: modelemi.h:82
Definition: font.h:38
Definition: keyframe.h:38
Definition: lipsync.h:35
Definition: material.h:63
Definition: model.h:43
Definition: object.h:69
Definition: overlay.h:33
Definition: resource.h:58
Definition: skeleton.h:68
Definition: sprite.h:38
Definition: default_display_client.h:68
Definition: resource.h:88