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