ScummVM API documentation
resources.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 TWINE_RESOURCES_RESOURCES_H
23 #define TWINE_RESOURCES_RESOURCES_H
24 
25 #include "common/hashmap.h"
26 #include "common/scummsys.h"
27 #include "twine/parser/body.h"
28 #include "twine/parser/holomap.h"
29 #include "twine/parser/sprite.h"
30 #include "twine/parser/text.h"
31 #include "twine/resources/hqr.h"
32 #include "twine/scene/gamestate.h"
33 #include "twine/scene/scene.h"
34 
35 namespace TwinE {
36 
38 #define RESSHQR_MAINPAL 0
39 #define RESSHQR_LBAFONT 1
40 #define RESSHQR_BLANK 2
41 #define RESSHQR_SPRITEBOXDATA 3
42 #define RESSHQR_SPRITESHADOW 4
43 #define RESSHQR_HOLOPAL 5 // lba1
44 #define RESSHQR_HOLOSURFACE 6 // lba1
45 #define RESSHQR_HOLOIMG 7 // lba1
46 #define RESSHQR_HOLOARROWINFO 8 // lba1
47 #define RESSHQR_HOLOTWINMDL 9 // lba1
48 #define RESSHQR_HOLOARROWMDL 10 // lba1
49 #define RESSHQR_HOLOTWINARROWMDL 11 // lba1
50 
51 #define RESSHQR_BLACKPAL 9 // lba2
52 #define RESSHQR_ECLAIRPAL 10 // lba2
53 #define SAMPLE_RAIN 13
54 
55 #define RESSHQR_GAMEOVERMDL 21
56 
57 #define RESSHQR_ALARMREDPAL 22
58 #define RESSHQR_FLAINFO 23
59 #define RESSHQR_DARKPAL 24
60 
61 #define RESSHQR_HOLOPOINTMDL 29
62 #define RESSHQR_HOLOPOINTANIM 30
63 
64 #define RESSHQR_PLASMAEFFECT 51
65 
66 #define FLA_DRAGON3 "dragon3"
67 #define FLA_INTROD "introd"
68 #define FLA_THEEND "the_end"
69 #define FLA_BATEAU "bateau"
70 
71 #define ACF_INTRO "INTRO"
72 
73 #define FILE3DHQR_HERONORMAL 0
74 #define FILE3DHQR_HEROATHLETIC 1
75 #define FILE3DHQR_HEROAGGRESSIVE 2
76 #define FILE3DHQR_HERODISCRETE 3
77 #define FILE3DHQR_HEROPROTOPACK 4
78 
80 #define SPRITEHQR_KASHES 3
81 #define SPRITEHQR_LIFEPOINTS 4
82 #define SPRITEHQR_MAGICPOINTS 5
83 #define SPRITEHQR_KEY 6
84 #define SPRITEHQR_CLOVERLEAF 7
85 #define SPRITEHQR_CLOVERLEAFBOX 41
86 
87 #define SPRITEHQR_MAGICBALL_YELLOW 1
88 #define SPRITEHQR_MAGICBALL_FIRE 13
89 #define SPRITEHQR_MAGICBALL_GREEN 42
90 #define SPRITEHQR_MAGICBALL_RED 43
91 #define SPRITEHQR_MAGICBALL_YELLOW_TRANS 44
92 #define SPRITEHQR_EXPLOSION_FIRST_FRAME 97 // 7 frames
93 #define SPRITEHQR_FENCE_1 18
94 #define SPRITEHQR_FENCE_2 19
95 #define SPRITEHQR_FENCE_3 22
96 #define SPRITEHQR_FENCE_4 23
97 #define SPRITEHQR_FENCE_METAL 35
98 #define SPRITEHQR_FENCE_METAL_2 54
99 #define SPRITEHQR_FENCE_METAL_3 83
100 #define SPRITEHQR_MUSHROOM 92
101 #define SPRITEHQR_DOOR_WODDEN_1 31
102 #define SPRITEHQR_DOOR_WODDEN_2 32
103 #define SPRITEHQR_DOOR_PRISON_WODDEN 37
104 #define SPRITEHQR_DOOR_PADLOCK 58
105 #define SPRITEHQR_DOOR_BRICKED_UP 76
106 #define SPRITEHQR_DOOR_1 104
107 #define SPRITEHQR_DOOR_2 107
108 #define SPRITEHQR_DOOR_3 24
109 #define SPRITEHQR_DOOR_4 11
110 #define SPRITEHQR_DOOR_5 12
111 #define SPRITEHQR_DOOR_PRISON_GRID 15
112 #define SPRITEHQR_DOOR_PRISON_HARMED 16
113 #define SPRITEHQR_DOOR_PRISON_WITH_F_LETTER 17
114 #define SPRITEHQR_MAGICBALL_GREEN_TRANS 109
115 #define SPRITEHQR_MAGICBALL_RED_TRANS 110
116 
117 #define SPRITEHQR_DIAG_BUBBLE_RIGHT 90
118 #define SPRITEHQR_DIAG_BUBBLE_LEFT 91
119 
121 #define NUM_ANIMS 2083 // 600 for lba1
122 
124 #define NUM_SAMPLES 895 // 243 for lba1
125 
126 class TwinEEngine;
127 
128 class Resources {
129 private:
130  TwinEEngine *_engine;
131 
132  void preloadInventoryItems();
134  void initPalettes();
136  void preloadSprites();
138  void preloadAnimations();
139  void preloadSamples();
140  void loadMovieInfo();
141 
143  MovieInfoMap _movieInfo;
144 
145  TrajectoryData _trajectories;
146 
147  TextData _textData;
148 
149 public:
150  Resources(TwinEEngine *engine) : _engine(engine) {}
151  ~Resources();
152 
157  const Common::Array<int32> &getMovieInfo(const Common::String &name) const;
158 
160  BodyData _inventoryTable[NUM_INVENTORY_ITEMS];
161 
163  uint8 *_spriteTable[NUM_SPRITES]{nullptr};
165  uint32 _spriteSizeTable[NUM_SPRITES]{0};
166  SpriteData _spriteData[NUM_SPRITES];
167 
168  AnimData _animData[NUM_ANIMS];
169 
171  BodyData _bodyData[NUM_BODIES];
172 
174  uint8 *_samplesTable[NUM_SAMPLES]{nullptr};
176  uint32 _samplesSizeTable[NUM_SAMPLES]{0};
177 
179  int32 _fontBufSize = 0;
180  uint8 *_fontPtr = nullptr;
181  uint8 *_sjisFontPtr = nullptr;
182 
183  SpriteData _spriteShadowPtr;
184  SpriteBoundingBoxData _spriteBoundingBox;
185 
186  BodyData _holomapPointModelPtr;
187  BodyData _holomapTwinsenModelPtr;
188  BodyData _holomapTwinsenArrowPtr;
189  BodyData _holomapArrowPtr;
190 
192  void initResources();
193 
194  const Trajectory *getTrajectory(int index) const;
195 
196  const TextEntry *getText(TextBankId textBankId, TextId index) const;
197 
198  int findSmkMovieIndex(const char *name) const;
199 
200  // main palette
201  static constexpr const char *HQR_RESS_FILE = "ress.hqr";
202  // dialoges
203  static constexpr const char *HQR_TEXT_FILE = "text.hqr";
204  // samples
205  static constexpr const char *HQR_SAMPLES_FILE = "samples.hqr";
211  static constexpr const char *HQR_LBA_GRI_FILE = "lba_gri.hqr";
212  // isometric libraries for use in grids.
213  static constexpr const char *HQR_LBA_BLL_FILE = "lba_bll.hqr";
220  static constexpr const char *HQR_LBA_BRK_FILE = "lba_brk.hqr";
221  // scenes (active area content (actors, scripts, etc.))
222  static constexpr const char *HQR_SCENE_FILE = "scene.hqr";
223  // full screen images (lba2)
224  static constexpr const char *HQR_SCREEN_FILE = "screen.hqr";
225  // sprites
226  static constexpr const char *HQR_SPRITES_FILE = "sprites.hqr";
231  static constexpr const char *HQR_FILE3D_FILE = "file3d.hqr";
232  // 3d model data
233  static constexpr const char *HQR_BODY_FILE = "body.hqr";
234  // animations
235  static constexpr const char *HQR_ANIM_FILE = "anim.hqr";
236  // inventory objects
237  static constexpr const char *HQR_INVOBJ_FILE = "invobj.hqr";
238 
242  static constexpr const char *HQR_FLAGIF_FILE = "fla_gif.hqr";
243  static constexpr const char *HQR_FLASAMP_FILE = "flasamp.hqr";
244  static constexpr const char *HQR_MIDI_MI_DOS_FILE = "midi_mi.hqr";
245  static constexpr const char *HQR_MIDI_MI_WIN_FILE = "midi_mi_win.hqr";
246 
247  static constexpr const char *HQR_VIDEO_FILE = "video.hqr"; // lba2 - smk files
248 
249  TwineImage adelineLogo() const {
250  if (_engine->isLBA1()) {
251  return TwineImage(Resources::HQR_RESS_FILE, 27, 28);
252  }
253  return TwineImage(Resources::HQR_SCREEN_FILE, 0, 1);
254  }
255 
256  TwineImage lbaLogo() const {
257  if (_engine->isLBA1()) {
258  return TwineImage(Resources::HQR_RESS_FILE, 49, 50);
259  }
260  return TwineImage(Resources::HQR_SCREEN_FILE, 60, 61);
261  }
262 
263  TwineImage eaLogo() const {
264  if (_engine->isLBA1()) {
265  return TwineImage(Resources::HQR_RESS_FILE, 52, 53);
266  }
267  return TwineImage(Resources::HQR_SCREEN_FILE, 74, 75);
268  }
269 
270  TwineImage activisionLogo() const {
271  assert(_engine->isLBA2());
272  return TwineImage(Resources::HQR_SCREEN_FILE, 72, 73);
273  }
274 
275  TwineImage virginLogo() const {
276  assert(_engine->isLBA2());
277  return TwineImage(Resources::HQR_SCREEN_FILE, 76, 77);
278  }
279 
280  TwineImage relentLogo() const {
281  assert(_engine->isLBA1());
282  return TwineImage(Resources::HQR_RESS_FILE, 12, 13);
283  }
284 
285  TwineImage menuBackground() const {
286  if (_engine->isLBA1()) {
287  return TwineImage(Resources::HQR_RESS_FILE, 14, -1);
288  }
289  return TwineImage(Resources::HQR_SCREEN_FILE, 4, 5);
290  }
291 };
292 
293 } // namespace TwinE
294 
295 #endif
BodyData _bodyData[NUM_BODIES]
Definition: resources.h:171
static constexpr const char * HQR_FLAGIF_FILE
Floppy version of the game uses gifs for replacing the videos.
Definition: resources.h:242
Definition: text.h:33
Definition: sprite.h:41
Definition: str.h:59
Definition: holomap.h:47
static constexpr const char * HQR_FILE3D_FILE
Definition: resources.h:231
BodyData _inventoryTable[NUM_INVENTORY_ITEMS]
Definition: resources.h:160
static constexpr const char * HQR_LBA_BRK_FILE
Definition: resources.h:220
uint8 * _spriteTable[NUM_SPRITES]
Definition: resources.h:163
Definition: shared.h:645
uint32 _spriteSizeTable[NUM_SPRITES]
Definition: resources.h:165
Definition: holomap.h:72
Definition: sprite.h:67
int32 _fontBufSize
Definition: resources.h:179
uint8 * _samplesTable[895]
Definition: resources.h:174
Definition: text.h:40
Definition: anim.h:57
Definition: twine.h:200
Definition: achievements_tables.h:27
Definition: resources.h:128
const Common::Array< int32 > & getMovieInfo(const Common::String &name) const
static constexpr const char * HQR_LBA_GRI_FILE
Definition: resources.h:211
uint32 _samplesSizeTable[895]
Definition: resources.h:176
Definition: body.h:35