ScummVM API documentation
resmanager.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 TWP_RESMANAGER_H
23 #define TWP_RESMANAGER_H
24 
25 #include "common/str.h"
26 #include "common/hashmap.h"
27 #include "twp/gfx.h"
28 #include "twp/spritesheet.h"
29 
30 namespace Twp {
31 
32 class Font;
33 
34 class ResManager {
35 private:
36  enum {
37  START_ACTORID = 1000,
38  END_ACTORID = 2000,
39  START_ROOMID = 2000,
40  END_ROOMID = 3000,
41  START_OBJECTID = 3000,
42  END_OBJECTID = 100000,
43  START_LIGHTID = 100000,
44  END_LIGHTID = 200000,
45  START_SOUNDDEFID = 200000,
46  END_SOUNDDEFID = 250000,
47  START_SOUNDID = 250000,
48  END_SOUNDID = 300000,
49  START_THREADID = 300000,
50  END_THREADID = 8000000,
51  START_CALLBACKID = 8000000,
52  END_CALLBACKID = 10000000,
53  };
54 
55 public:
56  static Common::String getKey(const Common::String &path);
57  Texture *texture(const Common::String &name);
58  SpriteSheet *spriteSheet(const Common::String &name);
59  Common::SharedPtr<Font> font(const Common::String &name);
60  void resetSaylineFont();
61 
62  bool isThread(int id) const;
63  bool isRoom(int id) const;
64  bool isActor(int id) const;
65  bool isObject(int id) const;
66  bool isSound(int id) const;
67  bool isLight(int id) const;
68  bool isCallback(int id) const;
69  int getCallbackId() const;
70 
71  int newRoomId();
72  int newObjId();
73  int newActorId();
74  int newSoundDefId();
75  int newSoundId();
76  int newThreadId();
77  int newCallbackId();
78  int newLightId();
79 
80  void resetIds(int callbackId);
81 
82 private:
83  void loadTexture(const Common::String &name);
84  void loadSpriteSheet(const Common::String &name);
85  void loadFont(const Common::String &name);
86 
87 public:
91  Common::SharedPtr<Object> _allObjects[100000];
92 
93 private:
94  int _roomId = START_ROOMID;
95  int _actorId = START_ACTORID;
96  int _objId = START_OBJECTID;
97  int _soundDefId = START_SOUNDDEFID;
98  int _soundId = START_SOUNDID;
99  int _threadId = START_THREADID;
100  int _callbackId = START_CALLBACKID;
101  int _lightId = START_LIGHTID;
102 };
103 } // namespace Twp
104 
105 #endif
Definition: str.h:59
Definition: spritesheet.h:44
Definition: hashmap.h:85
Definition: ptr.h:159
Definition: gfx.h:101
Definition: achievements_tables.h:27
Definition: resmanager.h:34