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