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