ScummVM API documentation
shared.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_SHARED_H
23 #define TWINE_SHARED_H
24 
25 #include "common/scummsys.h"
26 
27 // lba1 255 - lba2 256
28 #define NUM_GAME_FLAGS 256
29 #define NUM_GAME_FLAGS_LBA1 255
30 
32 #define NUMOFCOLORS 256
33 
34 #define MAX_HOLO_POS 150 /* lba1 */
35 #define MAX_HOLO_POS_2 334 /* lba2 */
36 
37 #define NUM_INVENTORY_ITEMS 28
38 
41 #define GAMEFLAG_INVENTORY_DISABLED 70 // Any prison FLAG_CONSIGNE
42 // Hit
43 #define GAMEFLAG_VIDEO_BAFFE 200
44 // Hit, band-aid
45 #define GAMEFLAG_VIDEO_BAFFE2 201
46 // Hit, black eye
47 #define GAMEFLAG_VIDEO_BAFFE3 202
48 // Ferry #1 Citadel Island <-> Principal Island
49 #define GAMEFLAG_VIDEO_BATEAU 203
50 // White Leaf Desert, Temple of Bu
51 #define GAMEFLAG_VIDEO_TEMPLE 204
52 // White Leaf Desert, flute
53 #define GAMEFLAG_VIDEO_FLUTE2 205
54 // Hamalayi Mountains, chuttle
55 #define GAMEFLAG_VIDEO_NAVETTE 206
56 // Hamalayi Mountains, storm
57 #define GAMEFLAG_VIDEO_NEIGE2 207
58 // Hamalayi Mountains, ski lift
59 #define GAMEFLAG_VIDEO_SURF 208
60 // Twinsen is no longer sick after he bought the catamaran
61 // you get this video if you take the ferry after you've
62 // bought the catamaran
63 // Ferry #2 Citadel Island <-> Principal Island
64 #define GAMEFLAG_VIDEO_BATEAU2 209
65 // Fortress, Zoe Clone
66 #define GAMEFLAG_VIDEO_CAPTURE 210
67 // Fortress, Rune stone (cut from the game)
68 #define GAMEFLAG_VIDEO_VERSER 211
69 // Fortress, Rune stone
70 #define GAMEFLAG_VIDEO_VERSER2 212
71 // Fortress, explosion
72 #define GAMEFLAG_VIDEO_FORTRESS 213
73 // Sendel give powers to Twinsen and Zoe.
74 #define GAMEFLAG_VIDEO_SENDEL2 214
75 // Hit, reject
76 #define GAMEFLAG_VIDEO_BAFFE5 215
77 // Twinsun explosion (on top of the well)
78 #define GAMEFLAG_VIDEO_EXPLODE 216
79 // Clear water lake
80 #define GAMEFLAG_VIDEO_GLASS2 217
81 // Twinsen in Well of Sendell
82 #define GAMEFLAG_VIDEO_SENDEL 218
83 // Twinsun explosion
84 #define GAMEFLAG_VIDEO_EXPLODE2 219
85 
86 #define GAMEFLAG_ESC 249
87 
88 // lba2 Kashes or Zlitos
89 #define GAMEFLAG_MONEY 8
90 // FLAG_ARDOISE
91 #define GAMEFLAG_ARDOISE 28
92 
93 // NUM_PERSO
94 #define OWN_ACTOR_SCENE_INDEX 0
95 #define IS_HERO(x) ((x) == OWN_ACTOR_SCENE_INDEX)
96 
97 namespace TwinE {
98 
99 #include "common/pack-start.h"
100 struct I16Vec3 {
101  int16 x = 0;
102  int16 y = 0;
103  int16 z = 0;
104 };
105 #include "common/pack-end.h"
106 static_assert(sizeof(I16Vec3) == 6, "Unexpected pointTab size");
107 
108 struct IVec2 {
109  constexpr IVec2() : x(0), y(0) {}
110  constexpr IVec2(int32 _x, int32 _y) : x(_x), y(_y) {}
111  int32 x;
112  int32 y;
113 
114  inline IVec2 &operator+=(const IVec2 &other) {
115  x += other.x;
116  y += other.y;
117  return *this;
118  }
119 
120  inline IVec2 &operator-=(const IVec2 &other) {
121  x -= other.x;
122  y -= other.y;
123  return *this;
124  }
125 };
126 
127 struct IVec3 {
128  constexpr IVec3() : x(0), y(0), z(0) {}
129  constexpr IVec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
130  int32 x;
131  int32 y;
132  int32 z;
133 
134  inline IVec3 &operator=(const I16Vec3 &other) {
135  x = other.x;
136  y = other.y;
137  z = other.z;
138  return *this;
139  }
140 
141  inline IVec3 &operator+=(const IVec3 &other) {
142  x += other.x;
143  y += other.y;
144  z += other.z;
145  return *this;
146  }
147 
148  inline IVec3 &operator-=(const IVec3 &other) {
149  x -= other.x;
150  y -= other.y;
151  z -= other.z;
152  return *this;
153  }
154 };
155 
156 inline constexpr IVec3 operator+(const IVec3 &lhs, const IVec3 &rhs) {
157  return IVec3{lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z};
158 }
159 
160 inline constexpr IVec3 operator-(const IVec3 &lhs, const IVec3 &rhs) {
161  return IVec3{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z};
162 }
163 
164 inline constexpr IVec3 operator-(const IVec3 &v) {
165  return IVec3{-v.x, -v.y, -v.z};
166 }
167 
175 int32 getDistance2D(int32 x1, int32 z1, int32 x2, int32 z2);
176 int32 getDistance2D(const IVec3 &v1, const IVec3 &v2);
177 
187 int32 getDistance3D(int32 x1, int32 y1, int32 z1, int32 x2, int32 y2, int32 z2);
188 int32 getDistance3D(const IVec3 &v1, const IVec3 &v2);
189 
193 struct BoundingBox {
194  IVec3 mins;
195  IVec3 maxs;
196 
197  bool isValid() const {
198  return mins.x <= maxs.x && mins.y <= maxs.y && mins.z <= maxs.z;
199  }
200 };
201 
203  BoundingBox bbox;
204  bool hasBoundingBox = false;
205 };
206 
207 enum class ActionType : uint8 {
208  ACTION_NOP = 0,
209  ACTION_BODY = 1,
210  ACTION_BODP = 2,
211  ACTION_ANIM = 3,
212  ACTION_ANIP = 4,
213  ACTION_HITTING = 5,
214  ACTION_SAMPLE = 6,
215  ACTION_SAMPLE_FREQ = 7,
216  ACTION_THROW_EXTRA_BONUS = 8,
217  ACTION_THROW_MAGIC_BALL = 9,
218  ACTION_SAMPLE_REPEAT = 10,
219  ACTION_THROW_SEARCH = 11,
220  ACTION_THROW_ALPHA = 12,
221  ACTION_SAMPLE_STOP = 13,
222  ACTION_ZV = 14,
223  ACTION_LEFT_STEP = 15,
224  ACTION_RIGHT_STEP = 16,
225  ACTION_HERO_HITTING = 17,
226  ACTION_THROW_3D = 18,
227  ACTION_THROW_3D_ALPHA = 19,
228  ACTION_THROW_3D_SEARCH = 20,
229  ACTION_THROW_3D_MAGIC = 21,
230  // lba2
231  ACTION_SUPER_HIT = 22,
232  ACTION_THROW_OBJ_3D = 23,
233  ACTION_PATH = 24,
234  ACTION_FLOW = 25,
235  ACTION_FLOW_3D = 26,
236  ACTION_THROW_DART = 27,
237  ACTION_SHIELD = 28,
238  ACTION_SAMPLE_MAGIC = 29,
239  ACTION_THROW_3D_CONQUE = 30,
240  ACTION_ZV_ANIMIT = 31,
241  ACTION_IMPACT = 32,
242  ACTION_RENVOIE = 33,
243  ACTION_RENVOYABLE = 34,
244  ACTION_TRANSPARENT = 35,
245  ACTION_SCALE = 36,
246  ACTION_LEFT_JUMP = 37,
247  ACTION_RIGHT_JUMP = 38,
248  ACTION_NEW_SAMPLE = 39,
249  ACTION_IMPACT_3D = 40,
250  ACTION_THROW_MAGIC_EXTRA = 41,
251  ACTION_THROW_FOUDRE = 42
252 };
253 
254 enum class ShapeType {
255  kNone = 0,
256  kSolid = 1,
257  kStairsTopLeft = 2,
258  kStairsTopRight = 3,
259  kStairsBottomLeft = 4,
260  kStairsBottomRight = 5,
261  kDoubleSideStairsTop1 = 6,
262  kDoubleSideStairsBottom1 = 7,
263  kDoubleSideStairsLeft1 = 8,
264  kDoubleSideStairsRight1 = 9,
265  kDoubleSideStairsTop2 = 10,
266  kDoubleSideStairsBottom2 = 11,
267  kDoubleSideStairsLeft2 = 12,
268  kDoubleSideStairsRight2 = 13,
269  kFlatBottom1 = 14,
270  kFlatBottom2 = 15
271 };
272 
274 enum class ControlMode {
275  kNoMove = 0, // NO_MOVE
276  kManual = 1, // MOVE_MANUAL
277  kFollow = 2, // MOVE_FOLLOW
278  kTrack = 3, // MOVE_TRACK
279  kFollow2 = 4, // MOVE_FOLLOW_2
280  kTrackAttack = 5, // MOVE_TRACK_ATTACK
281  kSameXZ = 6, // MOVE_SAME_XZ
282  kRandom = 7, //
283  kPinguin = 7, // MOVE_PINGOUIN kRandom doesn't exist in lba2 ()
284  // lba2
285  kWagon = 8, // MOVE_WAGON
286  kCircle = 9, // MOVE_CIRCLE Beta = Tangent lines to circles
287  kCircle2 = 10, // MOVE_CIRCLE2 Beta = Facing the flag
288  kSameXYBeta = 11, // MOVE_SAME_XZ_BETA
289  kBuggy = 12, // MOVE_BUGGY
290  kBuggyManual = 13 // MOVE_BUGGY_MANUAL
291 };
292 
293 enum class AnimationTypes {
294  kAnimNone = -1,
295  kStanding = 0, // GEN_ANIM_RIEN
296  kForward = 1, // GEN_ANIM_MARCHE
297  kBackward = 2, // GEN_ANIM_RECULE
298  kTurnLeft = 3, // GEN_ANIM_GAUCHE
299  kTurnRight = 4, // GEN_ANIM_DROITE
300  kHit = 5, // GEN_ANIM_ENCAISSE
301  kBigHit = 6, // GEN_ANIM_CHOC
302  kFall = 7, // GEN_ANIM_TOMBE
303  kLanding = 8, // GEN_ANIM_RECEPTION
304  kLandingHit = 9, // GEN_ANIM_RECEPTION_2
305  kLandDeath = 10, // GEN_ANIM_MORT
306  kAction = 11, // GEN_ANIM_ACTION
307  kClimbLadder = 12, // GEN_ANIM_MONTE
308  kTopLadder = 13, // GEN_ANIM_ECHELLE
309  kJump = 14, // GEN_ANIM_SAUTE
310  kThrowBall = 15, // GEN_ANIM_LANCE
311  kHide = 16, // GEN_ANIM_CACHE
312  kKick = 17, // GEN_ANIM_COUP_1
313  kRightPunch = 18, // GEN_ANIM_COUP_2
314  kLeftPunch = 19, // GEN_ANIM_COUP_3
315  kFoundItem = 20, // GEN_ANIM_TROUVE
316  kDrawn = 21, // GEN_ANIM_NOYADE
317  kHit2 = 22, // GEN_ANIM_CHOC2
318  kSabreAttack = 23, // GEN_ANIM_SABRE
319  kSabreUnknown = 24, // GEN_ANIM_DEGAINE
320  kPush = 27, // GEN_ANIM_POUSSE
321  kCarStarting = 303,
322  kCarDriving = 304,
323  kCarDrivingBackwards = 305,
324  kCarStopping = 306,
325  kCarFrozen = 307,
326  kNoAnim = 255 // NO_ANIM
327 };
328 
329 enum class AnimType {
330  kAnimationTypeRepeat = 0, // ANIM_REPEAT
331  kAnimationThen = 1, // ANIM_THEN
332  // play animation and let animExtra follow as next animation
333  // if there is already a next animation set - replace the value
334  kAnimationAllThen = 2, // ANIM_ALL_THEN
335  // replace animation and let the current animation follow
336  kAnimationInsert = 3, // ANIM_TEMPO
337  // play animation and let animExtra follow as next animation
338  // but don't take the current state in account
339  kAnimationSet = 4 // ANIM_FINAL
340 };
341 
354 enum class HeroBehaviourType {
355  kNormal = 0, // C_NORMAL
356  kAthletic = 1, // C_SPORTIF
357  kAggressive = 2, // C_AGRESSIF
358  kDiscrete = 3, // C_DISCRET
359  kProtoPack = 4, // C_PROTOPACK
360 #if 0
361  kDOUBLE = 5, // C_DOUBLE Twinsen + ZoĆ©
362  kCONQUE = 6, // C_CONQUE Conque
363  kSCAPH_INT_NORM = 7, // C_SCAPH_INT_NORM Scaphandre Interieur Normal
364  kJETPACK = 8, // C_JETPACK SuperJetPack
365  kSCAPH_INT_SPOR = 9, // C_SCAPH_INT_SPOR Scaphandre Interieur Sportif
366  kSCAPH_EXT_NORM = 10, // C_SCAPH_EXT_NORM Scaphandre Exterieur Normal
367  kSCAPH_EXT_SPOR = 11, // C_SCAPH_EXT_SPOR Scaphandre Exterieur Sportif
368  kBUGGY = 12, // C_BUGGY Conduite du buggy
369  kSKELETON = 13, // C_SKELETON Squelette Electrique
370 #endif
371  kMax
372 };
373 
374 // lba2
375 #define CUBE_INTERIEUR 0
376 #define CUBE_EXTERIEUR 1
377 
387 enum class BodyType {
388  btNone = -1, // Lba1/Lba2 NO_BODY (255)
389  btNormal = 0, // Lba1/Lba2 GEN_BODY_NORMAL
390  btTunic = 1, // Lba1/Lba2 GEN_BODY_TUNIQUE
391  btSabre = 2, // Lba1/Lba2 GEN_BODY_SABRE
392 
393  btPrisonSuit = 3, // Lba1
394  btNurseSuit = 4, // Lba1
395  btHorn = 5, // Lba1
396  btSnowboard = 6, // Lba1
397 
398  btBlowTube = 3, // Lba2 GEN_BODY_SARBACANE
399  btSarbatron = 4, // Lba2 GEN_BODY_SARBATRON
400  btGlove = 5, // Lba2 GEN_BODY_GANT
401 
402  btLaserPistole = 6, // Lba2 GEN_BODY_PISTOLASER
403  btMage = 7, // Lba2 GEN_BODY_MAGE
404  btMageBlowtube = 8, // Lba2 GEN_BODY_MAGE_SARBACANE
405  btBodyFire = 9, // Lba2 GEN_BODY_FEU
406  btTunicTir = 10, // Lba2 GEN_BODY_TUNIQUE_TIR
407  btMageTir = 11, // Lba2 GEN_BODY_MAGE_TIR
408  btLabyrinth = 12 // Lba2 GEN_BODY_LABYRINTHE
409 };
410 
411 enum class ExtraSpecialType {
412  kHitStars = 0,
413  kExplodeCloud = 1,
414  kFountain = 2
415 };
416 
417 enum class ZoneType {
418  kCube = 0, // Change to another scene
419  kCamera = 1, // Binds camera view
420  kSceneric = 2, // For use in Life Script
421  kGrid = 3, // Set disappearing Grid fragment
422  kObject = 4, // Give bonus
423  kText = 5, // Displays text message
424  kLadder = 6, // Hero can climb on it
425  // lba2
426  kEscalator = 7,
427  kHit = 8,
428  kRail = 9,
429  kFunFrockFix = 50
430 };
431 
432 #define SCENE_CEILING_GRID_FADE_1 (-1)
433 #define SCENE_CEILING_GRID_FADE_2 (-2)
434 
435 enum LBA1SceneId {
436  Citadel_Island_Prison = 0,
437  Citadel_Island_outside_the_citadel = 1,
438  Citadel_Island_near_the_tavern = 2,
439  Citadel_Island_near_the_pharmacy = 3,
440  Citadel_Island_near_twinsens_house = 4,
441  Citadel_Island_inside_Twinsens_house = 5,
442  Citadel_Island_Harbor = 6,
443  Citadel_Island_Pharmacy = 7,
444  White_Leaf_Desert_Temple_of_Bu_1st_scene = 8,
445  Hamalayi_Mountains_landing_place = 9,
446  Principal_Island_Library = 10,
447  Principal_Island_Harbor = 11,
448  Principal_Island_outside_the_fortress = 12,
449  Principal_Island_Old_Burg = 13,
450  Citadel_Island_Tavern = 14,
451  Hamalayi_Mountains_Rabbibunny_village = 15,
452  Citadel_Island_inside_a_Rabbibunny_house = 16,
453  Principal_Island_Ruins = 17,
454  Principal_Island_outside_the_library = 18,
455  Principal_Island_Militairy_camp = 19,
456  Citadel_Island_Architects_house = 20,
457  Citadel_Island_secret_chamber_in_the_house = 21,
458  Principal_Island_Ticket_office = 22,
459  Principal_Island_Prison = 23,
460  Principal_Island_Port_Belooga = 24,
461  Principal_Island_Peg_Leg_Street = 25,
462  Principal_Island_Shop = 26,
463  Principal_Island_Locksmith = 27,
464  Principal_Island_inside_a_Rabbibunny_house = 28,
465  Principal_Island_Astronimers_House = 29,
466  Principal_Island_Tavern = 30,
467  Principal_Island_Basement_of_the_Astronomer = 31,
468  Principal_Island_Stables = 32,
469  Citadel_Island_Cellar_of_the_Tavern = 33,
470  Citadel_Island_Sewer_of_the_1st_scene = 34,
471  Citadel_Island_Warehouse = 35,
472  White_Leaf_Desert_outside_the_Temple_of_Bu = 36,
473  Principal_Island_outside_the_water_tower = 37,
474  Principal_Island_inside_the_water_tower = 38,
475  White_Leaf_Desert_Militairy_camp = 39,
476  White_Leaf_Desert_Temple_of_Bu_2nd_scene = 40,
477  White_Leaf_Desert_Temple_of_Bu_3rd_scene = 41,
478  Proxima_Island_Proxim_City = 42,
479  Proxima_Island_Museum = 43,
480  Proxima_Island_near_the_Inventors_house = 44,
481  Proxima_Island_upper_rune_stone = 45,
482  Proxima_Island_lower_rune_stone = 46,
483  Proxima_Island_befor_the_upper_rune_stone = 47,
484  Proxima_Island_Forgers_house = 48,
485  Proxima_Island_Prison = 49,
486  Proxima_Island_Shop = 50,
487  Proxima_Island_Sewer = 51,
488  Principal_Island_house_at_Peg_Leg_Street = 52,
489  Proxima_Island_Grobo_house = 53,
490  Proxima_Island_Inventors_house = 54,
491  Citadel_Island_Sewer_secret = 55,
492  Principal_Island_Sewer_secret = 56,
493  White_Leaf_Desert_Maze = 57,
494  Principal_Island_House_with_the_TV = 58,
495  Rebelion_Island_Harbor = 59,
496  Rebelion_Island_Rebel_camp = 60,
497  Some_room_cut_out = 61,
498  Hamalayi_Mountains_1st_fighting_scene = 62,
499  Hamalayi_Mountains_2nd_fighting_scene = 63,
500  Hamalayi_Mountains_Prison = 64,
501  Hamalayi_Mountains_outside_the_transporter = 65,
502  Hamalayi_Mountains_inside_the_transporter = 66,
503  Hamalayi_Mountains_Mutation_centre_1st_scene = 67,
504  Hamalayi_Mountains_Mutation_centre_2nd_scene = 68,
505  Hamalayi_Mountains_3rd_fighting_scene = 69,
506  Hamalayi_Mountains_Entrance_to_the_prison = 70,
507  Hamalayi_Mountains_outside_the_prison = 71,
508  Hamalayi_Mountains_Catamaran_dock = 72,
509  Hamalayi_Mountains_Bunker_near_clear_water = 73,
510  Tippet_Island_Village = 74,
511  Tippet_Island_Secret_passage_scene_2 = 75,
512  Tippet_Island_near_the_bar = 76,
513  Tippet_Island_Secret_passage_scene_1 = 77,
514  Tippet_Island_near_the_Dino_Fly = 78,
515  Tippet_Island_Secret_passage_scene_3 = 79,
516  Tippet_Island_Twinsun_Cafe = 80,
517  Hamalayi_Mountains_Sacret_Carrot = 81,
518  Hamalayi_Mountains_Backdoor_of_the_prison = 82,
519  Fortress_Island_inside_the_fortress = 83,
520  Fortress_Island_outside_the_forstress = 84,
521  Fortress_Island_Secret_passage_scene_1 = 85,
522  Fortress_Island_Secret_in_the_fortress = 86,
523  Fortress_Island_near_Zoes_cell = 87,
524  Fortress_Island_Swimming_pool = 88,
525  Fortress_Island_Cloning_centre = 89,
526  Fortress_Island_Rune_stone = 90,
527  Hamalayi_Mountains_Behind_the_sacret_carrot = 91,
528  Hamalayi_Mountains_Clear_water_lake = 92,
529  Fortress_Island_outside_fortress_destroyed = 93,
530  Brundle_Island_outside_the_teleportation = 94,
531  Brundle_Island_inside_the_teleportation = 95,
532  Hamalayi_Mountains_Ski_resort = 96,
533  Brundle_Island_Docks = 97,
534  Brundle_Island_Secret_room = 98,
535  Brundle_Island_near_the_telepods = 99,
536  Fortress_Island_Docks = 100,
537  Tippet_Island_Shop = 101,
538  Principal_Island_house_in_port_Belooga = 102,
539  Brundle_Island_Painters_house = 103,
540  Citadel_Island_Ticket_Office = 104,
541  Principal_Island_inside_the_fortress = 105,
542  Polar_Island_2nd_scene = 106,
543  Polar_Island_3rd_scene = 107,
544  Polar_Island_Before_the_rocky_peak = 108,
545  Polar_Island_4th_scene = 109,
546  Polar_Island_The_rocky_peak = 110,
547  Polar_Island_on_the_rocky_peak = 111,
548  Polar_Island_Before_the_end_room = 112,
549  Polar_Island_Final_Battle = 113,
550  Polar_Island_end_scene = 114,
551  Polar_Island_1st_scene = 115,
552  Citadel_Island_end_sequence_1 = 116,
553  Citadel_Island_end_sequence_2 = 117,
554  Citadel_Island_Twinsens_house_destroyed = 118,
555  Credits_List_Sequence = 119,
556 
557  SceneIdMax = 120
558 };
559 
560 // lba
561 enum class TextBankId : int16 {
562  None = -1,
563  Options_and_menus = 0,
564  Credits = 1,
565  Inventory_Intro_and_Holomap = 2,
566  Citadel_Island = 3,
567  Principal_Island = 4,
568  White_Leaf_Desert = 5,
569  Proxima_Island = 6,
570  Rebellion_Island = 7,
571  Hamalayi_mountains_southern_range = 8,
572  Hamalayi_mountains_northern_range = 9,
573  Tippet_Island = 10,
574  Brundle_Island = 11,
575  Fortress_Island = 12,
576  Polar_Island = 13
577 };
578 
580 enum class TextId : int16 {
581  kNone = -1,
582  kBehaviourNormal = 0,
583  kBehaviourSporty = 1,
584  kBehaviourAggressiveManual = 2,
585  kBehaviourHiding = 3,
586  kBehaviourAggressiveAuto = 4,
587  kUseProtopack = 5,
588  kSendell = 6,
589  kMusicVolume = 10,
590  kSoundVolume = 11,
591  kCDVolume = 12,
592  kSpeechVolume = 13,
593  kMasterVolume = 14,
594  kReturnGame = 15,
595  kSaveSettings = 16,
596  kNewGame = 20,
597  kNewGamePlus = 255,
598  kContinueGame = 21,
599  kQuit = 22,
600  kOptions = 23,
601  kDelete = 24,
602  kReturnMenu = 26,
603  kGiveUp = 27,
604  kContinue = 28,
605  kVolumeSettings = 30,
606  kDetailsPolygonsHigh = 31,
607  kDetailsShadowHigh = 32,
608  // kSceneryZoomOn = 33, // duplicate with 133 - TODO check if this is the same in all languages
609  kCreateNewPlayer = 40,
610  kCreateSaveGame = 41,
611  kEnterYourName = 42,
612  kPlayerAlreadyExists = 43,
613  kEnterYourNewName = 44,
614  kDeleteSaveGame = 45,
615  kSaveManage = 46,
616  kAdvanced = 47,
617  kDelete2 = 48, // difference between 24 and 48?
618  kTransferVoices = 49,
619  kPleaseWaitWhileVoicesAreSaved = 50,
620  kRemoveProtoPack = 105,
621  kDetailsPolygonsMiddle = 131,
622  kShadowsFigures = 132,
623  kSceneryZoomOn = 133,
624  kIntroText1 = 150,
625  kIntroText2 = 151,
626  kIntroText3 = 152,
627  kBookOfBu = 161,
628  kBonusList = 162,
629  kStarWarsFanBoy = 226,
630  kDetailsPolygonsLow = 231,
631  kShadowsDisabled = 232,
632  kNoSceneryZoom = 233,
633 
634  // custom strings (not originally included in the game)
635  kCustomHighResOptionOn = -2,
636  kCustomHighResOptionOff = -3,
637  kCustomWallCollisionOn = -4,
638  kCustomWallCollisionOff = -5,
639  kCustomLanguageOption = -6,
640  kCustomVoicesNone = -7,
641  kCustomVoicesEnglish = -8,
642  kCustomVoicesFrench = -9,
643  kCustomVoicesGerman = -10,
644 
645  // ------ lba2
646 
647  toContinueGame = 70,
648  toNewGame = 71,
649  toLoadGame = 72,
650  toSauver = 73,
651  toOptions = 74,
652  toQuit = 75
653 };
654 
655 enum InventoryItems {
656  kiHolomap = 0, // lba1/lba2
657  kiMagicBall = 1, // lba1/lba2 FLAG_BALLE_MAGIQUE
658  kiUseSabre = 2, // lba1
659  kiDart = 2, // lba2
660  kiGawleysHorn = 3, // lba1
661  kiTunic = 4, // lba1/lba2
662  kiBookOfBu = 5, // lba1
663  kSendellsMedallion = 6, // lba1
664  kFlaskOfClearWater = 7, // lba1
665  kRedCard = 8, // lba1
666  kBlueCard = 9, // lba1
667  kIDCard = 10, // lba1
668  kMrMiesPass = 11, // lba1
669  kiProtoPack = 12, // lba1/lba2
670  kSnowboard = 13, // lba1
671  kiPenguin = 14, // lba1/lba2
672  kGasItem = 15, // lba1/lba2 (GazoGem)
673  kPirateFlag = 16, // lba1
674  kMagicFlute = 17, // lba1
675  kSpaceGuitar = 18, // lba1
676  kHairDryer = 19, // lba1
677  kAncesteralKey = 20, // lba1
678  kBottleOfSyrup = 21, // lba1
679  kEmptyBottle = 22, // lba1
680  kFerryTicket = 23, // lba1
681  kKeypad = 24, // lba1
682  kCoffeeCan = 25, // lba1
683  kiBonusList = 26, // lba1
684  kiCloverLeaf = 27, // lba1
685  MaxInventoryItems = 28, // lba1
686  MaxInventoryItemsLba2 = 40 // lba2
687 };
688 
690  const char *hqr;
691  int32 index;
692 
693  constexpr TwineResource(const char *_hqr, int32 _index) : hqr(_hqr), index(_index) {
694  }
695 };
696 
697 struct TwineImage {
698  TwineResource image;
699  TwineResource palette;
700 
701  constexpr TwineImage(const char *hqr, int32 index, int32 paletteIndex = -1) : image(hqr, index), palette(hqr, paletteIndex) {
702  }
703 };
704 
705 struct LBAAngles {
706  static int32 ANGLE_360;
707  static int32 ANGLE_351;
708  static int32 ANGLE_334;
709  static int32 ANGLE_315;
710  static int32 ANGLE_270;
711  static int32 ANGLE_225;
712  static int32 ANGLE_210;
713  static int32 ANGLE_180;
714  static int32 ANGLE_157_5;
715  static int32 ANGLE_140;
716  static int32 ANGLE_135;
717  static int32 ANGLE_90;
718  static int32 ANGLE_70;
719  static int32 ANGLE_63;
720  static int32 ANGLE_45;
721  static int32 ANGLE_22_5;
722  static int32 ANGLE_17;
723  static int32 ANGLE_11_25;
724  static int32 ANGLE_2;
725  static int32 ANGLE_1;
726  static int32 ANGLE_0;
727 
728  static void init(int factor);
729 
730  static void lba1();
731  static void lba2();
732 };
733 
734 #define VIEW_X0 (-50)
735 #define VIEW_Y0 (-30)
736 #define VIEW_X1(engine) ((engine)->width() + 40)
737 #define VIEW_Y1(engine) ((engine)->height() + 100)
738 
739 inline int32 NormalizeAngle(int32 angle) {
740  if (angle < -LBAAngles::ANGLE_180) {
741  angle += LBAAngles::ANGLE_360;
742  } else if (angle > LBAAngles::ANGLE_180) {
743  angle -= LBAAngles::ANGLE_360;
744  }
745  return angle;
746 }
747 
752 inline constexpr int32 ToAngle(int32 angle) {
753  // TODO: lba2 handling of factor 4
754  return angle;
755 }
756 
761 inline constexpr int32 FromAngle(int32 angle) {
762  return angle;
763 }
764 
765 inline double AngleToDegree(int32 angle) {
766  return (double)angle / (double)LBAAngles::ANGLE_360 * 360.0;
767 }
768 
769 inline int DegreeToAngle(double degree) {
770  return (int)(degree * (double)LBAAngles::ANGLE_360) / 360.0;
771 }
772 
773 inline int32 ClampAngle(int32 angle) {
774  return angle & (LBAAngles::ANGLE_360 - 1);
775 }
776 
777 template<typename T>
778 inline constexpr T bits(T value, uint8 offset, uint8 bits) {
779  return (((1 << bits) - 1) & (value >> offset));
780 }
781 
782 #define COLOR_BLACK 0
783 #define COLOR_BRIGHT_BLUE 4
784 #define COLOR_9 9
785 #define COLOR_14 14
786 // color 1 = yellow
787 // color 2 - 15 = white
788 // color 16 - 19 = brown
789 // color 20 - 24 = orange to yellow
790 // color 25 orange
791 // color 26 - 30 = bright gray or white
792 #define COlOR_31 31 // green dark
793 #define COlOR_47 47 // green bright
794 #define COLOR_48 48 // brown dark
795 #define COLOR_63 63 // brown bright
796 #define COLOR_64 64 // blue dark
797 #define COLOR_SELECT_MENU 68 // blue
798 // TODO #define COLOR_SELECT_MENU 166 // blue lba2
799 #define COLOR_73 73 // blue
800 #define COLOR_75 75
801 #define COLOR_79 79 // blue bright
802 #define COLOR_80 80
803 #define COLOR_91 91
804 #define COLOR_BRIGHT_BLUE2 69
805 #define COLOR_WHITE 15
806 #define COLOR_GOLD 155
807 #define COLOR_158 158
808 
809 enum kDebugLevels {
810  kDebugScriptsMove = 1,
811  kDebugScriptsLife,
812  kDebugTimers,
813  kDebugResources,
814  kDebugImGui,
815  kDebugInput,
816  kDebugMovies,
817  kDebugPalette,
818  kDebugCollision,
819  kDebugAnimation,
820  kDebugHolomap,
821 };
822 
823 } // namespace TwinE
824 
825 #endif
Definition: shared.h:108
Definition: shared.h:127
Definition: shared.h:697
Definition: shared.h:689
Definition: shared.h:100
Definition: achievements_tables.h:27
Axis aligned bounding box.
Definition: shared.h:193
Definition: shared.h:202
Definition: shared.h:705