22 #ifndef TWINE_SHARED_H 23 #define TWINE_SHARED_H 25 #include "common/scummsys.h" 28 #define NUM_GAME_FLAGS 256 29 #define NUM_GAME_FLAGS_LBA1 255 32 #define NUMOFCOLORS 256 34 #define MAX_HOLO_POS 150 35 #define MAX_HOLO_POS_2 334 37 #define NUM_INVENTORY_ITEMS 28 41 #define GAMEFLAG_INVENTORY_DISABLED 70 // Any prison FLAG_CONSIGNE 43 #define GAMEFLAG_VIDEO_BAFFE 200 45 #define GAMEFLAG_VIDEO_BAFFE2 201 47 #define GAMEFLAG_VIDEO_BAFFE3 202 49 #define GAMEFLAG_VIDEO_BATEAU 203 51 #define GAMEFLAG_VIDEO_TEMPLE 204 53 #define GAMEFLAG_VIDEO_FLUTE2 205 55 #define GAMEFLAG_VIDEO_NAVETTE 206 57 #define GAMEFLAG_VIDEO_NEIGE2 207 59 #define GAMEFLAG_VIDEO_SURF 208 64 #define GAMEFLAG_VIDEO_BATEAU2 209 66 #define GAMEFLAG_VIDEO_CAPTURE 210 68 #define GAMEFLAG_VIDEO_VERSER 211 70 #define GAMEFLAG_VIDEO_VERSER2 212 72 #define GAMEFLAG_VIDEO_FORTRESS 213 74 #define GAMEFLAG_VIDEO_SENDEL2 214 76 #define GAMEFLAG_VIDEO_BAFFE5 215 78 #define GAMEFLAG_VIDEO_EXPLODE 216 80 #define GAMEFLAG_VIDEO_GLASS2 217 82 #define GAMEFLAG_VIDEO_SENDEL 218 84 #define GAMEFLAG_VIDEO_EXPLODE2 219 87 #define GAMEFLAG_MONEY 8 89 #define GAMEFLAG_ARDOISE 28 92 #define OWN_ACTOR_SCENE_INDEX 0 93 #define IS_HERO(x) ((x) == OWN_ACTOR_SCENE_INDEX) 97 #include "common/pack-start.h" 103 #include "common/pack-end.h" 104 STATIC_ASSERT(
sizeof(
I16Vec3) == 6,
"Unexpected pointTab size");
107 constexpr
IVec2() : x(0), y(0) {}
108 constexpr IVec2(int32 _x, int32 _y) : x(_x), y(_y) {}
112 inline IVec2 &operator+=(
const IVec2 &other) {
118 inline IVec2 &operator-=(
const IVec2 &other) {
126 constexpr
IVec3() : x(0), y(0), z(0) {}
127 constexpr IVec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
132 inline IVec3 &operator=(
const I16Vec3 &other) {
139 inline IVec3 &operator+=(
const IVec3 &other) {
146 inline IVec3 &operator-=(
const IVec3 &other) {
155 return IVec3{lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z};
159 return IVec3{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z};
162 inline constexpr
IVec3 operator-(
const IVec3 &v) {
163 return IVec3{-v.x, -v.y, -v.z};
173 int32 getDistance2D(int32 x1, int32 z1, int32 x2, int32 z2);
174 int32 getDistance2D(
const IVec3 &v1,
const IVec3 &v2);
185 int32 getDistance3D(int32 x1, int32 y1, int32 z1, int32 x2, int32 y2, int32 z2);
186 int32 getDistance3D(
const IVec3 &v1,
const IVec3 &v2);
195 bool isValid()
const {
196 return mins.x <= maxs.x && mins.y <= maxs.y && mins.z <= maxs.z;
202 bool hasBoundingBox =
false;
205 enum class ActionType : uint8 {
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,
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,
229 ACTION_SUPER_HIT = 22,
230 ACTION_THROW_OBJ_3D = 23,
234 ACTION_THROW_DART = 27,
236 ACTION_SAMPLE_MAGIC = 29,
237 ACTION_THROW_3D_CONQUE = 30,
238 ACTION_ZV_ANIMIT = 31,
241 ACTION_RENVOYABLE = 34,
242 ACTION_TRANSPARENT = 35,
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
252 enum class ShapeType {
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,
272 enum class ControlMode {
291 enum class AnimationTypes {
321 kCarDrivingBackwards = 305,
327 enum class AnimType {
328 kAnimationTypeRepeat = 0,
332 kAnimationAllThen = 2,
334 kAnimationInsert = 3,
352 enum class HeroBehaviourType {
364 kSCAPH_EXT_NORM = 10,
365 kSCAPH_EXT_SPOR = 11,
373 #define CUBE_INTERIEUR 0 374 #define CUBE_EXTERIEUR 1 385 enum class BodyType {
409 enum class ExtraSpecialType {
415 enum class ZoneType {
430 #define SCENE_CEILING_GRID_FADE_1 (-1) 431 #define SCENE_CEILING_GRID_FADE_2 (-2) 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,
559 enum class TextBankId : int16 {
561 Options_and_menus = 0,
563 Inventory_Intro_and_Holomap = 2,
565 Principal_Island = 4,
566 White_Leaf_Desert = 5,
568 Rebellion_Island = 7,
569 Hamalayi_mountains_southern_range = 8,
570 Hamalayi_mountains_northern_range = 9,
573 Fortress_Island = 12,
578 enum class TextId : int16 {
580 kBehaviourNormal = 0,
581 kBehaviourSporty = 1,
582 kBehaviourAggressiveManual = 2,
583 kBehaviourHiding = 3,
584 kBehaviourAggressiveAuto = 4,
603 kVolumeSettings = 30,
604 kDetailsPolygonsHigh = 31,
605 kDetailsShadowHigh = 32,
607 kCreateNewPlayer = 40,
608 kCreateSaveGame = 41,
610 kPlayerAlreadyExists = 43,
611 kEnterYourNewName = 44,
612 kDeleteSaveGame = 45,
616 kTransferVoices = 49,
617 kPleaseWaitWhileVoicesAreSaved = 50,
618 kRemoveProtoPack = 105,
619 kDetailsPolygonsMiddle = 131,
620 kShadowsFigures = 132,
621 kSceneryZoomOn = 133,
627 kStarWarsFanBoy = 226,
628 kDetailsPolygonsLow = 231,
629 kShadowsDisabled = 232,
630 kNoSceneryZoom = 233,
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,
653 enum InventoryItems {
661 kSendellsMedallion = 6,
662 kFlaskOfClearWater = 7,
683 MaxInventoryItems = 28,
684 MaxInventoryItemsLba2 = 40
691 constexpr
TwineResource(
const char *_hqr, int32 _index) : hqr(_hqr), index(_index) {
699 constexpr
TwineImage(
const char *hqr, int32 index, int32 paletteIndex = -1) : image(hqr, index), palette(hqr, paletteIndex) {
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;
726 static void init(
int factor);
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) 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;
750 inline constexpr int32 ToAngle(int32 angle) {
759 inline constexpr int32 FromAngle(int32 angle) {
763 inline double AngleToDegree(int32 angle) {
764 return (
double)angle / (double)LBAAngles::ANGLE_360 * 360.0;
767 inline int DegreeToAngle(
double degree) {
768 return (
int)(degree * (double)LBAAngles::ANGLE_360) / 360.0;
771 inline int32 ClampAngle(int32 angle) {
772 return angle & (LBAAngles::ANGLE_360 - 1);
776 inline constexpr T bits(T value, uint8 offset, uint8 bits) {
777 return (((1 << bits) - 1) & (value >> offset));
780 #define COLOR_BLACK 0 781 #define COLOR_BRIGHT_BLUE 4 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 797 #define COLOR_73 73 // blue 799 #define COLOR_79 79 // blue bright 802 #define COLOR_BRIGHT_BLUE2 69 803 #define COLOR_WHITE 15 804 #define COLOR_GOLD 155 805 #define COLOR_158 158 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
Definition: achievements_tables.h:27
Axis aligned bounding box.
Definition: shared.h:191