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
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (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, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #ifndef TWINE_SHARED_H
24 #define TWINE_SHARED_H
25
26 #include "common/scummsys.h"
27
28 #define NUM_GAME_FLAGS 255
29
30 /** Number of colors used in the game */
31 #define NUMOFCOLORS 256
32
33 #define NUM_LOCATIONS 150
34
35 #define NUM_INVENTORY_ITEMS 28
36 /**
37 * This gameflag indicates that the inventory items are taken from Twinson because he went to jail
38 */
39 #define GAMEFLAG_INVENTORY_DISABLED 70
40 // Hit
41 #define GAMEFLAG_VIDEO_BAFFE 200
42 // Hit, band-aid
43 #define GAMEFLAG_VIDEO_BAFFE2 201
44 // Hit, black eye
45 #define GAMEFLAG_VIDEO_BAFFE3 202
46 // Ferry #1
47 #define GAMEFLAG_VIDEO_BATEAU 203
48 // Temple of Bu
49 #define GAMEFLAG_VIDEO_TEMPLE 204
50 // White Leaf Desert, flute
51 #define GAMEFLAG_VIDEO_FLUTE2 205
52 // Hamalayi Mountains, chuttle
53 #define GAMEFLAG_VIDEO_NAVETTE 206
54 // Hamalayi Mountains, storm
55 #define GAMEFLAG_VIDEO_NEIGE2 207
56 // Hamalayi Mountains, ski lift
57 #define GAMEFLAG_VIDEO_SURF 208
58 // Ferry #2
59 #define GAMEFLAG_VIDEO_BATEAU2 209
60 // Fortress, Zoe Clone
61 #define GAMEFLAG_VIDEO_CAPTURE 210
62 // Fortress, Rune stone (cut from the game)
63 #define GAMEFLAG_VIDEO_VERSER 211
64 // Fortress, Rune stone
65 #define GAMEFLAG_VIDEO_VERSER2 212
66 // Fortress, explosion
67 #define GAMEFLAG_VIDEO_FORTRESS 213
68 // Sendel give powers to Twinsen and Zoe.
69 #define GAMEFLAG_VIDEO_SENDEL2 214
70 // Hit, reject
71 #define GAMEFLAG_VIDEO_BAFFE5 215
72 // Twinsun explosion (on top of the well)
73 #define GAMEFLAG_VIDEO_EXPLODE 216
74 // Clear water lake
75 #define GAMEFLAG_VIDEO_GLASS2 217
76 // Twinsen in Well of Sendell
77 #define GAMEFLAG_VIDEO_SENDEL 218
78 // Twinsun explosion
79 #define GAMEFLAG_VIDEO_EXPLODE2 219
80
81 #define OWN_ACTOR_SCENE_INDEX 0
82 #define IS_HERO(x) (x) == OWN_ACTOR_SCENE_INDEX
83
84 namespace TwinE {
85
86 #include "common/pack-start.h"
87 struct I16Vec3 {
88 int16 x = 0;
89 int16 y = 0;
90 int16 z = 0;
91 };
92 #include "common/pack-end.h"
93 STATIC_ASSERT(sizeof(I16Vec3) == 6, "Unexpected pointTab size");
94
95 struct IVec3 {
IVec3IVec396 constexpr IVec3() : x(0), y(0), z(0) {}
IVec3IVec397 constexpr IVec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
98 int32 x;
99 int32 y;
100 int32 z;
101
102 inline IVec3 &operator=(const I16Vec3& other) {
103 x = other.x;
104 y = other.y;
105 z = other.z;
106 return *this;
107 }
108
109 inline IVec3& operator+=(const IVec3 &other) {
110 x += other.x;
111 y += other.y;
112 z += other.z;
113 return *this;
114 }
115
116 inline IVec3& operator-=(const IVec3 &other) {
117 x -= other.x;
118 y -= other.y;
119 z -= other.z;
120 return *this;
121 }
122 };
123
124 inline constexpr IVec3 operator+(const IVec3 &lhs, const IVec3 &rhs) {
125 return IVec3{lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z};
126 }
127
128 inline constexpr IVec3 operator-(const IVec3 &lhs, const IVec3 &rhs) {
129 return IVec3{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z};
130 }
131
132 inline constexpr IVec3 operator-(const IVec3 &v) {
133 return IVec3{-v.x, -v.y, -v.z};
134 }
135
136 /**
137 * Get distance value in 2D
138 * @param x1 Actor 1 X coordinate
139 * @param z1 Actor 1 Z coordinate
140 * @param x2 Actor 2 X coordinate
141 * @param z2 Actor 2 Z coordinate
142 */
143 int32 getDistance2D(int32 x1, int32 z1, int32 x2, int32 z2);
144 int32 getDistance2D(const IVec3 &v1, const IVec3 &v2);
145
146 /**
147 * Get distance value in 3D
148 * @param x1 Actor 1 X coordinate
149 * @param y1 Actor 1 Y coordinate
150 * @param z1 Actor 1 Z coordinate
151 * @param x2 Actor 2 X coordinate
152 * @param y2 Actor 2 Y coordinate
153 * @param z2 Actor 2 Z coordinate
154 */
155 int32 getDistance3D(int32 x1, int32 y1, int32 z1, int32 x2, int32 y2, int32 z2);
156 int32 getDistance3D(const IVec3 &v1, const IVec3 &v2);
157
158 /**
159 * @brief Axis aligned bounding box
160 */
161 struct BoundingBox {
162 IVec3 mins;
163 IVec3 maxs;
164 };
165
166 struct ActorBoundingBox {
167 BoundingBox bbox;
168 bool hasBoundingBox = false;
169 };
170
171 enum class ActionType : uint8 {
172 ACTION_NOP = 0,
173 ACTION_BODY = 1,
174 ACTION_BODP = 2,
175 ACTION_ANIM = 3,
176 ACTION_ANIP = 4,
177 ACTION_HITTING = 5,
178 ACTION_SAMPLE = 6,
179 ACTION_SAMPLE_FREQ = 7,
180 ACTION_THROW_EXTRA_BONUS = 8,
181 ACTION_THROW_MAGIC_BALL = 9,
182 ACTION_SAMPLE_REPEAT = 10,
183 ACTION_THROW_SEARCH = 11,
184 ACTION_THROW_ALPHA = 12,
185 ACTION_SAMPLE_STOP = 13,
186 ACTION_ZV = 14,
187 ACTION_LEFT_STEP = 15,
188 ACTION_RIGHT_STEP = 16,
189 ACTION_HERO_HITTING = 17,
190 ACTION_THROW_3D = 18,
191 ACTION_THROW_3D_ALPHA = 19,
192 ACTION_THROW_3D_SEARCH = 20,
193 ACTION_THROW_3D_MAGIC = 21,
194 ACTION_LAST
195 };
196
197 enum class ShapeType {
198 kNone = 0,
199 kSolid = 1,
200 kStairsTopLeft = 2,
201 kStairsTopRight = 3,
202 kStairsBottomLeft = 4,
203 kStairsBottomRight = 5,
204 kDoubleSideStairsTop1 = 6,
205 kDoubleSideStairsBottom1 = 7,
206 kDoubleSideStairsLeft1 = 8,
207 kDoubleSideStairsRight1 = 9,
208 kDoubleSideStairsTop2 = 10,
209 kDoubleSideStairsBottom2 = 11,
210 kDoubleSideStairsLeft2 = 12,
211 kDoubleSideStairsRight2 = 13,
212 kFlatBottom1 = 14,
213 kFlatBottom2 = 15
214 };
215
216 /** Control mode types */
217 enum class ControlMode {
218 kNoMove = 0,
219 kManual = 1,
220 kFollow = 2,
221 kTrack = 3,
222 kFollow2 = 4,
223 kTrackAttack = 5,
224 kSameXZ = 6,
225 kRandom = 7
226 };
227
228 enum class AnimationTypes {
229 kAnimNone = -1,
230 kStanding = 0,
231 kForward = 1,
232 kBackward = 2,
233 kTurnLeft = 3,
234 kTurnRight = 4,
235 kHit = 5,
236 kBigHit = 6,
237 kFall = 7,
238 kLanding = 8,
239 kLandingHit = 9,
240 kLandDeath = 10,
241 kAction = 11,
242 kClimbLadder = 12,
243 kTopLadder = 13,
244 kJump = 14,
245 kThrowBall = 15,
246 kHide = 16,
247 kKick = 17,
248 kRightPunch = 18,
249 kLeftPunch = 19,
250 kFoundItem = 20,
251 kDrawn = 21,
252 kHit2 = 22,
253 kSabreAttack = 23,
254 kSabreUnknown = 24,
255 kCarStarting = 303,
256 kCarDriving = 304,
257 kCarDrivingBackwards = 305,
258 kCarStopping = 306,
259 kCarFrozen = 307,
260 kAnimInvalid = 255
261 };
262
263 enum class AnimType {
264 kAnimationTypeLoop = 0,
265 kAnimationThen = 1,
266 // play animation and let animExtra follow as next animation
267 // if there is already a next animation set - replace the value
268 kAnimationAllThen = 2,
269 // replace animation and let the current animation follow
270 kAnimationInsert = 3,
271 // play animation and let animExtra follow as next animation
272 // but don't take the current state in account
273 kAnimationSet = 4
274 };
275
276 /** Hero behaviour
277 * <li> NORMAL: Talk / Read / Search / Use
278 * <li> ATHLETIC: Jump
279 * <li> AGGRESSIVE:
280 * Auto mode : Fight
281 * Manual mode : While holding the spacebar down
282 * UP / RIGHT / LEFT will manually select
283 * different punch/kick options
284 * <li> DISCREET: Kneel down to hide
285 *
286 * @note The values must match the @c TextId indices
287 */
288 enum class HeroBehaviourType {
289 kNormal = 0,
290 kAthletic = 1,
291 kAggressive = 2,
292 kDiscrete = 3,
293 kProtoPack = 4
294 };
295
296 /**
297 * 0: tunic + medallion
298 * 1: tunic
299 * 2: tunic + medallion + sword
300 * 3: prison suit
301 * 4: nurse outfit
302 * 5: tunic + medallion + horn
303 * 6: snowboard (WARNING, this can crash the game when you change behavior)
304 */
305 enum class BodyType {
306 btNone = -1,
307 btNormal = 0,
308 btTunic = 1,
309 btSabre = 2,
310 btPrisonSuit = 3,
311 btNurseSuit = 4,
312 btHorn = 5,
313 btSnowboard = 6
314 };
315
316 enum class ExtraSpecialType {
317 kHitStars = 0,
318 kExplodeCloud = 1
319 };
320
321 enum class ZoneType {
322 kCube = 0, // Change to another scene
323 kCamera = 1, // Binds camera view
324 kSceneric = 2, // For use in Life Script
325 kGrid = 3, // Set disappearing Grid fragment
326 kObject = 4, // Give bonus
327 kText = 5, // Displays text message
328 kLadder = 6 // Hero can climb on it
329 };
330
331 #define SCENE_CEILING_GRID_FADE_1 (-1)
332 #define SCENE_CEILING_GRID_FADE_2 (-2)
333
334 enum LBA1SceneId {
335 Citadel_Island_Prison = 0,
336 Citadel_Island_outside_the_citadel = 1,
337 Citadel_Island_near_the_tavern = 2,
338 Citadel_Island_near_the_pharmacy = 3,
339 Citadel_Island_near_twinsens_house = 4,
340 Citadel_Island_inside_Twinsens_house = 5,
341 Citadel_Island_Harbor = 6,
342 Citadel_Island_Pharmacy = 7,
343 White_Leaf_Desert_Temple_of_Bu_1st_scene = 8,
344 Hamalayi_Mountains_landing_place = 9,
345 Principal_Island_Library = 10,
346 Principal_Island_Harbor = 11,
347 Principal_Island_outside_the_fortress = 12,
348 Principal_Island_Old_Burg = 13,
349 Citadel_Island_Tavern = 14,
350 Hamalayi_Mountains_Rabbibunny_village = 15,
351 Citadel_Island_inside_a_Rabbibunny_house = 16,
352 Principal_Island_Ruins = 17,
353 Principal_Island_outside_the_library = 18,
354 Principal_Island_Militairy_camp = 19,
355 Citadel_Island_Architects_house = 20,
356 Citadel_Island_secret_chamber_in_the_house = 21,
357 Principal_Island_Ticket_office = 22,
358 Principal_Island_Prison = 23,
359 Principal_Island_Port_Belooga = 24,
360 Principal_Island_Peg_Leg_Street = 25,
361 Principal_Island_Shop = 26,
362 Principal_Island_Locksmith = 27,
363 Principal_Island_inside_a_Rabbibunny_house = 28,
364 Principal_Island_Astronimers_House = 29,
365 Principal_Island_Tavern = 30,
366 Principal_Island_Basement_of_the_Astronomer = 31,
367 Principal_Island_Stables = 32,
368 Citadel_Island_Cellar_of_the_Tavern = 33,
369 Citadel_Island_Sewer_of_the_1st_scene = 34,
370 Citadel_Island_Warehouse = 35,
371 White_Leaf_Desert_outside_the_Temple_of_Bu = 36,
372 Principal_Island_outside_the_water_tower = 37,
373 Principal_Island_inside_the_water_tower = 38,
374 White_Leaf_Desert_Militairy_camp = 39,
375 White_Leaf_Desert_Temple_of_Bu_2nd_scene = 40,
376 White_Leaf_Desert_Temple_of_Bu_3rd_scene = 41,
377 Proxima_Island_Proxim_City = 42,
378 Proxima_Island_Museum = 43,
379 Proxima_Island_near_the_Inventors_house = 44,
380 Proxima_Island_upper_rune_stone = 45,
381 Proxima_Island_lower_rune_stone = 46,
382 Proxima_Island_befor_the_upper_rune_stone = 47,
383 Proxima_Island_Forgers_house = 48,
384 Proxima_Island_Prison = 49,
385 Proxima_Island_Shop = 50,
386 Proxima_Island_Sewer = 51,
387 Principal_Island_house_at_Peg_Leg_Street = 52,
388 Proxima_Island_Grobo_house = 53,
389 Proxima_Island_Inventors_house = 54,
390 Citadel_Island_Sewer_secret = 55,
391 Principal_Island_Sewer_secret = 56,
392 White_Leaf_Desert_Maze = 57,
393 Principal_Island_House_with_the_TV = 58,
394 Rebelion_Island_Harbor = 59,
395 Rebelion_Island_Rebel_camp = 60,
396 Some_room_cut_out = 61,
397 Hamalayi_Mountains_1st_fighting_scene = 62,
398 Hamalayi_Mountains_2nd_fighting_scene = 63,
399 Hamalayi_Mountains_Prison = 64,
400 Hamalayi_Mountains_outside_the_transporter = 65,
401 Hamalayi_Mountains_inside_the_transporter = 66,
402 Hamalayi_Mountains_Mutation_centre_1st_scene = 67,
403 Hamalayi_Mountains_Mutation_centre_2nd_scene = 68,
404 Hamalayi_Mountains_3rd_fighting_scene = 69,
405 Hamalayi_Mountains_Entrance_to_the_prison = 70,
406 Hamalayi_Mountains_outside_the_prison = 71,
407 Hamalayi_Mountains_Catamaran_dock = 72,
408 Hamalayi_Mountains_Bunker_near_clear_water = 73,
409 Tippet_Island_Village = 74,
410 Tippet_Island_Secret_passage_scene_2 = 75,
411 Tippet_Island_near_the_bar = 76,
412 Tippet_Island_Secret_passage_scene_1 = 77,
413 Tippet_Island_near_the_Dino_Fly = 78,
414 Tippet_Island_Secret_passage_scene_3 = 79,
415 Tippet_Island_Twinsun_Cafe = 80,
416 Hamalayi_Mountains_Sacret_Carrot = 81,
417 Hamalayi_Mountains_Backdoor_of_the_prison = 82,
418 Fortress_Island_inside_the_fortress = 83,
419 Fortress_Island_outside_the_forstress = 84,
420 Fortress_Island_Secret_passage_scene_1 = 85,
421 Fortress_Island_Secret_in_the_fortress = 86,
422 Fortress_Island_near_Zoes_cell = 87,
423 Fortress_Island_Swimming_pool = 88,
424 Fortress_Island_Cloning_centre = 89,
425 Fortress_Island_Rune_stone = 90,
426 Hamalayi_Mountains_Behind_the_sacret_carrot = 91,
427 Hamalayi_Mountains_Clear_water_lake = 92,
428 Fortress_Island_outside_fortress_destroyed = 93,
429 Brundle_Island_outside_the_teleportation = 94,
430 Brundle_Island_inside_the_teleportation = 95,
431 Hamalayi_Mountains_Ski_resort = 96,
432 Brundle_Island_Docks = 97,
433 Brundle_Island_Secret_room = 98,
434 Brundle_Island_near_the_telepods = 99,
435 Fortress_Island_Docks = 100,
436 Tippet_Island_Shop = 101,
437 Principal_Island_house_in_port_Belooga = 102,
438 Brundle_Island_Painters_house = 103,
439 Citadel_Island_Ticket_Office = 104,
440 Principal_Island_inside_the_fortress = 105,
441 Polar_Island_2nd_scene = 106,
442 Polar_Island_3rd_scene = 107,
443 Polar_Island_Before_the_rocky_peak = 108,
444 Polar_Island_4th_scene = 109,
445 Polar_Island_The_rocky_peak = 110,
446 Polar_Island_on_the_rocky_peak = 111,
447 Polar_Island_Before_the_end_room = 112,
448 Polar_Island_Final_Battle = 113,
449 Polar_Island_end_scene = 114,
450 Polar_Island_1st_scene = 115,
451 Citadel_Island_end_sequence_1 = 116,
452 Citadel_Island_end_sequence_2 = 117,
453 Citadel_Island_Twinsens_house_destroyed = 118,
454 Credits_List_Sequence = 119,
455
456 SceneIdMax = 120
457 };
458
459 // lba
460 enum class TextBankId : int16 {
461 None = -1,
462 Options_and_menus = 0,
463 Credits = 1,
464 Inventory_Intro_and_Holomap = 2,
465 Citadel_Island = 3,
466 Principal_Island = 4,
467 White_Leaf_Desert = 5,
468 Proxima_Island = 6,
469 Rebellion_Island = 7,
470 Hamalayi_mountains_southern_range = 8,
471 Hamalayi_mountains_northern_range = 9,
472 Tippet_Island = 10,
473 Brundle_Island = 11,
474 Fortress_Island = 12,
475 Polar_Island = 13
476 };
477
478 /** menu text ids */
479 enum class TextId : int16 {
480 kNone = -1,
481 kBehaviourNormal = 0,
482 kBehaviourSporty = 1,
483 kBehaviourAggressiveManual = 2,
484 kBehaviourHiding = 3,
485 kBehaviourAggressiveAuto = 4,
486 kUseProtopack = 5,
487 kSendell = 6,
488 kMusicVolume = 10,
489 kSoundVolume = 11,
490 kCDVolume = 12,
491 kSpeechVolume = 13,
492 kMasterVolume = 14,
493 kReturnGame = 15,
494 kSaveSettings = 16,
495 kNewGame = 20,
496 kContinueGame = 21,
497 kQuit = 22,
498 kOptions = 23,
499 kDelete = 24,
500 kReturnMenu = 26,
501 kGiveUp = 27,
502 kContinue = 28,
503 kVolumeSettings = 30,
504 kDetailsPolygonsHigh = 31,
505 kDetailsShadowHigh = 32,
506 //kSceneryZoomOn = 33, // duplicate with 133 - TODO check if this is the same in all languages
507 kCreateNewPlayer = 40,
508 kCreateSaveGame = 41,
509 kEnterYourName = 42,
510 kPlayerAlreadyExists = 43,
511 kEnterYourNewName = 44,
512 kDeleteSaveGame = 45,
513 kSaveManage = 46,
514 kAdvanced = 47,
515 kDelete2 = 48, // difference between 24 and 48?
516 kTransferVoices = 49,
517 kPleaseWaitWhileVoicesAreSaved = 50,
518 kRemoveProtoPack = 105,
519 kDetailsPolygonsMiddle = 131,
520 kShadowsFigures = 132,
521 kSceneryZoomOn = 133,
522 kIntroText1 = 150,
523 kIntroText2 = 151,
524 kIntroText3 = 152,
525 kBookOfBu = 161,
526 kBonusList = 162,
527 kStarWarsFanBoy = 226,
528 kDetailsPolygonsLow = 231,
529 kShadowsDisabled = 232,
530 kNoSceneryZoom = 233,
531
532 // custom strings (not originally included in the game)
533 kCustomHighResOptionOn = -2,
534 kCustomHighResOptionOff = -3,
535 kCustomWallCollisionOn = -4,
536 kCustomWallCollisionOff = -5
537 };
538
539 enum InventoryItems {
540 kiHolomap = 0,
541 kiMagicBall = 1,
542 kiUseSabre = 2,
543 kiGawleysHorn = 3,
544 kiTunic = 4,
545 kiBookOfBu = 5,
546 kSendellsMedallion = 6,
547 kFlaskOfClearWater = 7,
548 kRedCard = 8,
549 kBlueCard = 9,
550 kIDCard = 10,
551 kMrMiesPass = 11,
552 kiProtoPack = 12,
553 kSnowboard = 13,
554 kiPenguin = 14,
555 kGasItem = 15,
556 kPirateFlag = 16,
557 kMagicFlute = 17,
558 kSpaceGuitar = 18,
559 kHairDryer = 19,
560 kAncesteralKey = 20,
561 kBottleOfSyrup = 21,
562 kEmptyBottle = 22,
563 kFerryTicket = 23,
564 kKeypad = 24,
565 kCoffeeCan = 25,
566 kiBonusList = 26,
567 kiCloverLeaf = 27,
568 MaxInventoryItems = 28
569 };
570
571 struct TwineResource {
572 const char *hqr;
573 const int32 index;
574
TwineResourceTwineResource575 constexpr TwineResource(const char *_hqr, int32 _index) : hqr(_hqr), index(_index) {
576 }
577 };
578
579 struct TwineImage {
580 TwineResource image;
581 TwineResource palette;
582
imageTwineImage583 constexpr TwineImage(const char *hqr, int32 index, int32 paletteIndex = -1) : image(hqr, index), palette(hqr, paletteIndex) {
584 }
585 };
586
587 // lba2 does from 0 to 0x1000
588 // lba1 angles
589 // TODO: wrap in a class to be able to handle lba1 and lba2
590 #define ANGLE_360 1024
591 #define ANGLE_351 1000
592 #define ANGLE_334 950
593 #define ANGLE_315 896
594 #define ANGLE_270 768
595 #define ANGLE_225 640
596 #define ANGLE_210 600
597 #define ANGLE_180 512
598 #define ANGLE_140 400
599 #define ANGLE_135 384
600 #define ANGLE_90 256
601 #define ANGLE_70 200
602 #define ANGLE_63 180
603 #define ANGLE_45 128
604 #define ANGLE_22_5 64
605 #define ANGLE_17 50
606 #define ANGLE_11_25 32
607 #define ANGLE_2 8 // 1.67
608 #define ANGLE_1 5 // 1.75
609 #define ANGLE_0 0
610
NormalizeAngle(int32 angle)611 inline int32 NormalizeAngle(int32 angle) {
612 if (angle < -ANGLE_180) {
613 angle += ANGLE_360;
614 } else if (angle > ANGLE_180) {
615 angle -= ANGLE_360;
616 }
617 return angle;
618 }
619
620 /**
621 * @param[in] angle The angle as input from game data
622 * @return The value as it is used at runtime
623 */
ToAngle(int32 angle)624 inline constexpr int32 ToAngle(int32 angle) {
625 return angle;
626 }
627
628 /**
629 * @param[in] angle The angle as used at runtime
630 * @return The value as it should be used for storing in game data
631 */
FromAngle(int32 angle)632 inline constexpr int32 FromAngle(int32 angle) {
633 return angle;
634 }
635
AngleToRadians(int32 angle)636 inline constexpr double AngleToRadians(int32 angle) {
637 return 2.0 * M_PI * angle / (double)ANGLE_360;
638 }
639
ClampAngle(int32 angle)640 inline constexpr int32 ClampAngle(int32 angle) {
641 return angle & (ANGLE_360 - 1);
642 }
643
644 template<typename T>
bits(T value,uint8 offset,uint8 bits)645 inline constexpr T bits(T value, uint8 offset, uint8 bits) {
646 return (((1 << bits) - 1) & (value >> offset));
647 }
648
649 #define COLOR_BLACK 0
650 #define COLOR_BRIGHT_BLUE 4
651 #define COLOR_9 9
652 #define COLOR_14 14
653 // color 1 = yellow
654 // color 2 - 15 = white
655 // color 16 - 19 = brown
656 // color 20 - 24 = orange to yellow
657 // color 25 orange
658 // color 26 - 30 = bright gray or white
659 #define COlOR_31 31 // green dark
660 #define COlOR_47 47 // green bright
661 #define COLOR_48 48 // brown dark
662 #define COLOR_63 63 // brown bright
663 #define COLOR_64 64 // blue dark
664 #define COLOR_68 68 // blue
665 #define COLOR_73 73 // blue
666 #define COLOR_75 75
667 #define COLOR_79 79 // blue bright
668 #define COLOR_80 80
669 #define COLOR_91 91
670 #define COLOR_BRIGHT_BLUE2 69
671 #define COLOR_WHITE 15
672 #define COLOR_GOLD 155
673 #define COLOR_158 158
674
675 }
676
677 #endif
678