-
Notifications
You must be signed in to change notification settings - Fork 3
/
SonicMania.h
4591 lines (4310 loc) · 156 KB
/
SonicMania.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
#define _USE_MATH_DEFINES
#include <MemAccess.h>
#include <cmath>
#include <cstdio>
#pragma region PreprocessorDefines
#define BitFlag(type, enumType) inline type operator|(type a, type b) { return (type)((enumType)a | (enumType)b); }
#define ALIGN(x) __declspec(align(x))
#pragma endregion
typedef unsigned char byte;
typedef unsigned short ushort;
namespace SonicMania
{
#pragma region TypesDefs
typedef void(__cdecl* Ability)();
typedef void(__cdecl* PlayerStatus)();
typedef void(__cdecl* InputStatus)();
#pragma endregion
#pragma region Declares
// Entities
struct Entity;
struct EntityBase;
struct EntityPlayer;
struct EntityCamera;
struct EntityItemBox;
struct EntityRing;
struct EntityUIText;
//Objects
struct Object;
struct Obj_Player;
struct Obj_Camera;
struct Obj_Ring;
struct Obj_Platform;
struct Obj_SpecialRing;
struct Obj_ItemBox;
struct Obj_Shield;
struct Obj_Spring;
struct Obj_Animals;
struct Obj_ScoreBonus;
struct Obj_Explosion;
struct Obj_Spikes;
struct Obj_Door;
struct Obj_Water;
struct Obj_Button;
struct Obj_StarPost;
struct Obj_GameOver;
struct Obj_BreakableWall;
struct Obj_LRZBreakableWall;
struct Obj_CollapsingPlatform;
struct Obj_ForceSpin;
struct Obj_PlaneSwitch;
struct Obj_GHZSetup;
struct Obj_SPZ1Setup;
struct Obj_SPZ2Setup;
struct Obj_FBZSetup;
struct Obj_PSZ1Setup;
struct Obj_PSZ2Setup;
struct Obj_HCZSetup;
struct Obj_MSZSetup;
struct Obj_OOZSetup;
struct Obj_LRZ1Setup;
struct Obj_LRZ2Setup;
struct Obj_LRZ3Setup;
struct Obj_MMZSetup;
struct Obj_TMZ1Setup;
struct Obj_TMZ2Setup;
struct Obj_TMZ3Setup;
struct Obj_ZONE;
struct Obj_Clapperboard;
struct Obj_Lovetester;
struct Obj_PauseMenu;
struct Obj_FXRuby;
struct Obj_DebugMode;
struct ActiveEntityInfo;
struct GameOptions;
//Misc
struct TextInfo;
struct Hitbox;
struct FileInfo;
struct ObjectInfo;
#pragma endregion
#pragma region Enums
// Enum
enum Scene : short
{
Scene_NONE = -1,
// Presentation
Scene_Logo,
Scene_Title,
Scene_MainMenu,
Scene_ThanksForPlaying,
Scene_LevelSelect,
Scene_Credits,
Scene_Continue,
Scene_Summary,
Scene_Summary_e,
// Mania Mode
Scene_GHZ1,
Scene_GHZ2,
Scene_CPZ1,
Scene_CPZ2,
Scene_SPZ1,
Scene_SPZ2,
Scene_FBZ1,
Scene_FBZ2,
Scene_PSZ1,
Scene_PSZ2,
Scene_SSZ1,
Scene_SSZ2,
Scene_SSZ2M,
Scene_HCZ1,
Scene_HCZ2,
Scene_MSZ1,
Scene_MSZ1K,
Scene_MSZ2,
Scene_OOZ1,
Scene_OOZ2,
Scene_LRZ1,
Scene_LRZ2,
Scene_LRZ3,
Scene_MMZ1,
Scene_MMZ2,
Scene_TMZ1,
Scene_TMZ2,
Scene_TMZ3,
Scene_ERZ,
// Encore Mode
Scene_GHZ1_e,
Scene_GHZ2_e,
Scene_CPZ1_e,
Scene_CPZ2_e,
Scene_SPZ1_e,
Scene_SPZ2_e,
Scene_FBZ1_e,
Scene_FBZ2_e,
Scene_PSZ1_e,
Scene_PSZ2_e,
Scene_SSZ1_e,
Scene_SSZ2_e,
Scene_SSZ2M_e,
Scene_HCZ1_e,
Scene_HCZ2_e,
Scene_MSZ1_e,
Scene_MSZ2_e,
Scene_OOZ1_e,
Scene_OOZ2_e,
Scene_LRZ1_e,
Scene_LRZ2_e,
Scene_LRZ3_e,
Scene_MMZ1_e,
Scene_MMZ2_e,
Scene_TMZ1_e,
Scene_TMZ2_e,
Scene_TMZ3_e,
// Special Stage
Scene_SpecialStage1,
Scene_SpecialStage2,
Scene_SpecialStage3,
Scene_SpecialStage4,
Scene_SpecialStage5,
Scene_SpecialStage6,
Scene_SpecialStage7,
Scene_SpecialStage1_e,
Scene_SpecialStage2_e,
Scene_SpecialStage3_e,
Scene_SpecialStage4_e,
Scene_SpecialStage5_e,
Scene_SpecialStage6_e,
Scene_SpecialStage7_e,
// Blue Sphere (+0 - +31)
Scene_BlueSphere,
Scene_BlueSphere_Random = Scene_BlueSphere + 32,
Scene_BlueSphere_Random2,
// Pinball
Scene_Pinball,
// Extras
Scene_PuyoPuyo,
Scene_DAGarden,
Scene_DAGarden_e,
// Cutscene
Scene_Cutscene_AngelIsland,
Scene_Cutscene_AngelIsland_e,
Scene_Cutscene_GreenHillZone,
Scene_Cutscene_GreenHillZone2,
Scene_Cutscene_MirageSaloonKnucklesIntro,
Scene_Cutscene_StardustSpeedwayTimeTravel,
Scene_TryAgain,
Scene_Cutscene_MirageSaloonEnd_e,
Scene_TryAgain_e,
// Video
Scene_BadEnd_Sonic,
Scene_BadEnd_Sonic2,
Scene_BadEnd_Tails,
Scene_BadEnd_Knux,
Scene_BadEnd_Mighty,
Scene_BadEnd_Ray,
Scene_GoodEnd,
Scene_TrueEnd
};
enum Category : byte
{
Presentation,
ManiaMode,
EncoreMode,
SpecialStage,
BlueSpheres,
Pinball,
Extras,
Cutscenes,
Videos
};
enum ShieldType
{
ShieldType_None,
ShieldType_Normal,
ShieldType_Water,
ShieldType_Flame,
ShieldType_Lightning
};
enum Character : int
{
Character_None = 0b00000,
Character_Sonic = 0b00001, // 1 << 0 ( 1)
Character_Tails = 0b00010, // 1 << 1 ( 2)
Character_Knux = 0b00100, // 1 << 2 ( 4)
Character_Mighty = 0b01000, // 1 << 3 ( 8)
Character_Ray = 0b10000 // 1 << 4 (16)
};
enum GameMode : int
{
GameMode_ManiaMode,
GameMode_EncoreMode,
GameMode_TimeAttack,
GameMode_Competition
};
enum Filter : byte
{
Filter_None = 0b0000, // 0
Filter_Common = 0b0001, // 1
Filter_Mania = 0b0010, // 2
Filter_Encore = 0b0100 // 4
};
BitFlag(Filter, byte)
enum GameStates : byte
{
GameState_NotRunning = 0b0000, // 0
GameState_Running = 0b0001, // 1
GameState_SoftPause = 0b0010, // 2
GameState_HardPause = 0b0100, // 4
GameState_DevMenu = 0b1000 // 8
};
BitFlag(GameStates, byte)
enum DrawingFX : BYTE
{
DrawingFX_None = 0,
DrawingFX_Flip = 1,
DrawingFX_Rotate_NoFlip = 2,
DrawingFX_Rotate = 3,
DrawingFX_Scale_NoFlip = 4,
DrawingFX_Scale = 5,
DrawingFX_RotoZoom_NoFlip = 6,
DrawingFX_RotoZoom = 7,
};
BitFlag(DrawingFX, byte)
enum InkEffect : byte
{
Ink_None,
Ink_Blend,
Ink_Alpha,
Ink_Add,
Ink_Subtract,
Ink_Distort,
Ink_Masked,
Ink_Unmasked
};
enum ActiveStates : byte
{
ACTIVE_NEVER,
ACTIVE_ALWAYS,
ACTIVE_NORMAL,
ACTIVE_PAUSED,
ACTIVE_BOUNDS,
ACTIVE_XBOUNDS,
ACTIVE_YBOUNDS,
ACTIVE_BOUNDS2,
ACTIVE_NEVER3 = 255,
};
enum FlipFlags : byte
{
FLIP_NONE, // 0b00
FLIP_X, // 0b01
FLIP_Y, // 0b10
FLIP_XY, // 0b11
};
enum Scope : byte
{
Scope_None,
Scope_Global,
Scope_Stage
};
enum GameModes : int
{
GAMEMODE_MANIA,
GAMEMODE_ENCORE,
GAMEMODE_TATTACK,
GAMEMODE_COMPETITION,
};
enum PlayerIDs : int
{
PLAYER_NONE = 0,
PLAYER_SONIC = 1,
PLAYER_TAILS = 2,
PLAYER_KNUX = 4,
PLAYER_MIGHTY = 8,
PLAYER_RAY = 0x10,
PLAYER_P2TAILS = 0x200,
PLAYER_DEFAULT = 0x201,
};
enum ItemBoxItem : byte
{
ItemBoxItem_Ring,
ItemBoxItem_ShieldNormal,
ItemBoxItem_ShieldWater,
ItemBoxItem_ShieldFlame,
ItemBoxItem_ShieldLightning,
ItemBoxItem_Invincibility,
ItemBoxItem_SpeedShoes,
ItemBoxItem_LifeSonic,
ItemBoxItem_LifeTails,
ItemBoxItem_LifeKnuckles,
ItemBoxItem_Eggman,
ItemBoxItem_CombineRing,
ItemBoxItem_TeamSwap,
ItemBoxItem_Random,
ItemBoxItem_Super,
ItemBoxItem_LifeMighty,
ItemBoxItem_LifeRay
};
enum CollisionModes : byte
{
CollisionMode_Floor,
CollisionMode_LeftWall,
CollisionMode_Roof,
CollisionMode_RightWall
};
enum CollisionPlanes : byte {
CollisionPlane_A,
CollisionPlane_B,
};
// TODO: needs updating
enum ObjectType
{
//ObjectType_SmogHandle = 0x00E48CE8,
//ObjectType_OctusB = 0x00E48E1C,
//ObjectType_MechaBu = 0x00E48FDC,
//ObjectType_Iwamodoki = 0x00EBB5D0,
//ObjectType_Grabber = 0x00EBB5E0,
//ObjectType_Woodrow = 0x00EBB60C,
//ObjectType_BallHog = 0x00EBB610,
//ObjectType_Jugglesaw = 0x00EBB620,
//ObjectType_Bumpalo = 0x00EBB63C,
//ObjectType_Blastoid = 0x00EBB68C,
//ObjectType_Spiny = 0x00EBB69C,
//ObjectType_FlasherMkII = 0x00EBB6A4,
//ObjectType_Bulb = 0x00EBB6B0, // TODO: Find proper name
//ObjectType_Buggernaut = 0x00EBB6C0,
//ObjectType_CheckPoint = 0x00EBB6C4,
//ObjectType_Rattlekiller = 0x00EBB6E0,
//ObjectType_MonkeyDude = 0x00EBB71C,
//ObjectType_CatakillerJR = 0x00EBB730,
//ObjectType_Sol = 0x00EBB744,
//ObjectType_Vultron = 0x00EBB764,
//ObjectType_Ring = 0x00EBB778,
//ObjectType_DDWrecker = 0x00EBB788,
//ObjectType_TurboTurtle = 0x00EBB7D4,
//ObjectType_SSRing = 0x00EBB804,
//ObjectType_Sweep = 0x00EBB808,
//ObjectType_Turtloid = 0x00EBB83C,
//ObjectType_FlameThrower = 0x00EBB840,
//ObjectType_DoorSwitch = 0x00EBB854,
//ObjectType_Splats = 0x00EBB898,
//ObjectType_Dragonfly = 0x00EBB8C0,
//ObjectType_PohBee = 0x00EBB8E8,
//ObjectType_Roller = 0x00EBB938,
//ObjectType_Scarab = 0x00EBB940,
//ObjectType_LightBulb = 0x00EBB94C,
//ObjectType_Rhinobot = 0x00EBB954,
//ObjectType_RockDrill = 0x00EBB960,
//ObjectType_TechnoSqueek = 0x00EBB994,
//ObjectType_Pointdexter = 0x00EBB9C4,
//ObjectType_Fireworm = 0x00EBB9D8,
//ObjectType_Blaster = 0x00EBBA04,
//ObjectType_Chopper = 0x00EBBA24,
//ObjectType_Kabasira = 0x00EBBA30,
//ObjectType_Tubinaut = 0x00EBBA68,
//ObjectType_WallCrawl = 0x00EBBAAC,
//ObjectType_Motobug = 0x00EBBAF8,
//ObjectType_Jellygnite = 0x00EBBB34,
//ObjectType_Act1SkyBoss = 0x00EBBB44, // TODO: Find proper name
//ObjectType_Spring = 0x00EBBB70,
//ObjectType_Effect = 0x00EBBB8C,
//ObjectType_MatryoshkaBom = 0x00EBBBC8,
//ObjectType_DrillerDroidB = 0x00EBBBD4,
//ObjectType_MeterDroidB = 0x00EBBBF0,
//ObjectType_Clucker = 0x00EBBC20,
//ObjectType_Pinata = 0x00EBBC94,
//ObjectType_Jawz = 0x00EBBCA8,
//ObjectType_Hotaru = 0x00EBBCC0,
//ObjectType_DERobot = 0x00EBBD08,
//ObjectType_Animal = 0x00EBBD10,
//ObjectType_ScoreOnHitNumber = 0x00EBBD18,
//ObjectType_Explosion = 0x00EBBD1C,
//ObjectType_MicDrop = 0x00EBBD40,
//ObjectType_MegaChopper = 0x00EBBD50,
//ObjectType_Octus = 0x00EBBD5C,
//ObjectType_Kanabun = 0x00EBBD64,
//ObjectType_Rexon = 0x00EBBD6C,
//ObjectType_TurboSpiker = 0x00EBBD88,
//ObjectType_ShutterBug = 0x00EBBDF0,
//ObjectType_IceBomba = 0x00EBBDF4,
//ObjectType_SentryBug = 0x00EBBE08,
//ObjectType_Cactula = 0x00EBBE5C,
//ObjectType_Aquis = 0x00EBBE7C,
//ObjectType_ItemBox = 0x00EBBE98,
//ObjectType_BuzzBomber = 0x00EBBEC4,
//ObjectType_Dango = 0x00EBBECC,
//ObjectType_Bloominator = 0x00EBBEE0,
//ObjectType_NewTron = 0x00EBBF1C,
//ObjectType_CaveBat = 0x00EBBF28,
//ObjectType_CrabMeat = 0x00EBBF34,
//ObjectType_Toxomister = 0x00EBBF38
//General
ObjectType_Player = 0x00AC6838,
ObjectType_Ring = 0x00AC67E0,
ObjectType_Platform = 0x00AC6CB4,
ObjectType_SSRing = 0x00AC686C,
ObjectType_ItemBox = 0x00AC6F00,
ObjectType_Spring = 0x00AC6BD8,
ObjectType_Spikes = 0x00AC67BC,
ObjectType_Button = 0x00AC68BC,
ObjectType_Door = 0x00AC68B0,
ObjectType_LRZBreakableWall = 0x00AC6C80,
ObjectType_BreakableWall = 0x00AC6A34,
ObjectType_CollapsingPlatform = 0x00AC66EC,
ObjectType_ForcedSpin = 0x00AC6CB4,
ObjectType_StarPost = 0x00AC672C,
ObjectType_Animals = 0x00AC6D78,
ObjectType_ScoreBonus = 0x00AC6D80,
ObjectType_Explosion = 0x00AC6D84,
ObjectType_PlathSwapper = 0x00AC6C0C,
ObjectType_Decoration = 0x00AC6A90,
// Green Hill Zone
ObjectType_Motobug = 0x00AC6B60,
ObjectType_CrabMeat = 0x00AC6F9C,
ObjectType_Chopper = 0x00AC6A8C,
ObjectType_BuzzBomber = 0x00AC6F2C,
ObjectType_NewTron = 0x00AC6F84,
ObjectType_BatBrain = 0x00AC6F90,
ObjectType_Splats = 0x00AC6900,
ObjectType_DDWrecker = 0x00AC67F0, //Boss Act 1
ObjectType_DERobot = 0x00AC6D70, //Boss Act 2
// Chemical Plant Zone
ObjectType_Grabber = 0x00AC6648,
ObjectType_Spiny = 0x00AC6704,
ObjectType_AmoebaDroid = 0x00AC6880, //Boss Act 1
ObjectType_Sweep = 0x00AC6870,
ObjectType_CatakillerJR = 0x00AC6798,
// Studiopolis Zone
ObjectType_MicDrop = 0x00AC6DA8,
ObjectType_ShutterBug = 0x00AC6E58,
ObjectType_Tubinaut = 0x00AC6AD0,
ObjectType_WallCrawl = 0x00AC6B14,
ObjectType_HeavyGunner = 0x00AC6C2C, //Boss Act 1
ObjectType_WeatherMobile = 0x00AC6A80, //Boss Act 2
ObjectType_CircleBumper = 0x00AC6904,
// Flying Battery
ObjectType_TechnoSqueek = 0x00AC69FC,
ObjectType_Blaster = 0x00AC6A6C,
ObjectType_Clucker = 0x00AC6C88,
ObjectType_FBZStorm = 0x00AC6DDC, //May be wrong?
// Press Garden Zone
ObjectType_Dragonfly = 0x00AC6928,
ObjectType_Jugglesaw = 0x00AC6688,
ObjectType_SplatsJar = 0x004ACF50,
ObjectType_Woodrow = 0x00AC6674,
ObjectType_IceBomba = 0x00AC6E5C,
ObjectType_HeavyShinobi = 0x00AC6B08,
// StarDust Speed Way
ObjectType_Hotaru = 0x00AC6808,
ObjectType_Dango = 0x00AC6F34,
ObjectType_Kanabun = 0x00AC67FC,
ObjectType_Kabasira = 0x004ACF50,
ObjectType_SilverSonic = 0x00AC679C,
ObjectType_MetalSonic = 0x00AC6B34, //Boss Act2 M
// HydroCity Zone
ObjectType_Jellygnite = 0x00AC6B9C,
ObjectType_Pointdexter = 0x00AC6A2C,
ObjectType_Blastoid = 0x00AC66F4,
ObjectType_Jawz = 0x00AC6D10,
ObjectType_MovingDust = 0x00AC6D18, // Mighty - Ground Pound
ObjectType_MegaChopper = 0x00AC6DB8,
ObjectType_TurboSpiker = 0x00AC6DF0,
ObjectType_Buggernaut = 0x00AC6728,
//MirageSaloonZone
ObjectType_Vultron = 0x00AC67CC,
ObjectType_Cactula = 0x00AC6EC4,
ObjectType_Bumpalo = 0x00AC66A4,
ObjectType_Rattlekiller = 0x00AC6748,
ObjectType_BallHog = 0x00AC69A0,
ObjectType_Armadiloid = 0x00AC68A4,
//Oil Ocean Zone
ObjectType_Aquis = 0x00AC6EE4,
ObjectType_Octus = 0x00AC6DC4,
ObjectType_Sol = 0x00AC6778,
// Lave Reef Zone
ObjectType_Toxomister = 0x00AC6FA0,
ObjectType_Fireworm = 0x00AC6A40,
ObjectType_Iwamodoki = 0x00AC6638,
ObjectType_Rexon = 0x00AC6DD4,
// Metallic Madness Zone
ObjectType_MechaBu = 0x00AC6888,
ObjectType_MatryoshkaBom = 0x00AC6C30,
ObjectType_Scarab = 0x00AC69A8,
ObjectType_PohBee = 0x00AC6950,
ObjectType_RPlaneShifter = 0x00AC6AD8,
ObjectType_SizeLazer = 0x00AC6758,
// Titanic Monarch Zone
ObjectType_SentryBug = 0x00AC6E70,
ObjectType_TurboTurtle = 0x00AC683C,
ObjectType_FlasherMkII = 0x00AC670C,
ObjectType_BallHog2 = 0x00AC6678,
// Angel Island Zone
ObjectType_MonkeyDude = 0x00AC6784,
ObjectType_Rhinobot = 0x00AC6C24,
ObjectType_Bloominator = 0x00AC6F48,
//Unused - Other
ObjectType_S1Orbinaught = 0x00AC6A00,
ObjectType_S1Catakiller = 0x00AC6B78,
//Service Objects
ObjectType_FXFade = 0x00AC6810,
//UFO - SpecialStage
ObjectType_UFO_Dust = 0x00AC6DB0,
ObjectType_UFO_Itembox = 0x00AC66B4,
ObjectType_SpecialClear = 0x00AC6CC8,
ObjectType_UFO_Decoration = 0x00AC6DB0,
ObjectType_UFO_Springboard = 0x00AC67D4,
ObjectType_UFO_Message = 0x00AC6EBC,
ObjectType_UFO_Sphere = 0x00AC667C,
ObjectType_UFO_Ring = 0x00AC6700,
ObjectType_UFO_Player = 0x00AC6F8C,
//UI -
ObjectType_UIWaitSpinner = 0x00AC6DA0,
ObjectType_PauseMenu = 0x00AC6EF0,
ObjectType_FXRuby = 0x00AC6E90,
ObjectType_UIInfoLabel = 0x00AC6ECC,
//System
ObjectType_DebugMode = 0x00AC6930
};
enum TransparencyFlag : byte
{
TransparencyFlag_Opaque,
TransparencyFlag_HalfTransparent,
TransparencyFlag_Transparent
};
enum SuperState : int
{
SuperState_NotActive,
SuperState_Activate,
SuperState_Active,
SuperState_Deactivate
};
enum CreationType : int
{
//0-0x3FF are just valid slot ids, >= 0x400 or <= -3 are invalid
CreateSlot_New = -1,
CreateSlot_Replace = -2,
};
enum AttributeTypes : int {
ATTRIBUTE_UINT8 = 0,
ATTRIBUTE_UINT16 = 1,
ATTRIBUTE_UINT32 = 2,
ATTRIBUTE_INT8 = 3,
ATTRIBUTE_INT16 = 4,
ATTRIBUTE_INT32 = 5,
ATTRIBUTE_VAR = 6,
ATTRIBUTE_BOOL = 7,
ATTRIBUTE_STRING = 8,
ATTRIBUTE_VECTOR2 = 9,
ATTRIBUTE_VECTOR3 = 0xA,
ATTRIBUTE_COLOUR = 0xB,
ATTRIBUTE_UNKNOWN = 0xC
};
enum PlayerHurtflags : int { PLAYER_NORMAL = 0, PLAYER_HURT = 1, PLAYER_DIE = 2, PLAYER_DROWN = 3 };
#pragma endregion
// TODO: needs updating
#pragma region Constents
// Player Status
#define CONTROL_NONE (SonicMania::PlayerStatus)(0x00000000)
#define CONTROL_NORMAL (SonicMania::PlayerStatus)(baseAddress + 0x000C3E00)
#define CONTROL_P2 (SonicMania::PlayerStatus)(baseAddress + 0x000C4340)
// Player Status
#define PLAYERSTATE_NONE (SonicMania::PlayerStatus)(0x00000000)
#define PLAYERSTATE_GROUND (SonicMania::PlayerStatus)(baseAddress + 0x000CAD80)
#define PLAYERSTATE_AIR (SonicMania::PlayerStatus)(baseAddress + 0x000CB6C0)
#define PLAYERSTATE_JUMP (SonicMania::PlayerStatus)(baseAddress + 0x000CB6C0)
#define PLAYERSTATE_LOOKDOWN (SonicMania::PlayerStatus)(baseAddress + 0x000CBBD0)
#define PLAYERSTATE_LOOKUP (SonicMania::PlayerStatus)(baseAddress + 0x000CBAA0)
#define PLAYERSTATE_SPINDASH (SonicMania::PlayerStatus)(baseAddress + 0x000CBD80)
#define PLAYERSTATE_Roll (SonicMania::PlayerStatus)(baseAddress + 0x000CB850)
#define PLAYERSTATE_HURT (SonicMania::PlayerStatus)(baseAddress + 0x000CCA00)
#define PLAYERSTATE_DIE (SonicMania::PlayerStatus)(baseAddress + 0x000CCAC0)
#define PLAYERSTATE_OUTTAHERE (SonicMania::PlayerStatus)(baseAddress + 0x000CCE90)
#define PLAYERSTATE_Gimmick (SonicMania::PlayerStatus)(baseAddress + 0x000CAD70)
#define PLAYERSTATE_Gimmick2 (SonicMania::PlayerStatus)(baseAddress + 0x000CBA90) // TODO: needs updating
#define PLAYERSTATE_Hanging (SonicMania::PlayerStatus)(baseAddress + 0x000CAD70) // TODO: needs updating
#define PLAYERSTATE_SpiningTube_PGZ (SonicMania::PlayerStatus)(baseAddress + 0x0001F7F0) // TODO: needs updating
#define PLAYERSTATE_Frozen_PGZ (SonicMania::PlayerStatus)(baseAddress + 0x000A3410) // TODO: needs updating
#define PLAYERSTATE_Sliding_OOZ (SonicMania::PlayerStatus)(baseAddress + 0x0002EB10) // TODO: needs updating
#define PLAYERSTATE_SwitchingToBG_MMZ (SonicMania::PlayerStatus)(baseAddress + 0x000304A0) // TODO: needs updating
#define PLAYERSTATE_SwitchingToFG_MMZ (SonicMania::PlayerStatus)(baseAddress + 0x000305B0) // TODO: needs updating
#define PLAYERSTATE_TurningSmall_MMZ (SonicMania::PlayerStatus)(baseAddress + 0x00031560) // TODO: needs updating
#define PLAYERSTATE_TurningBig_MMZ (SonicMania::PlayerStatus)(baseAddress + 0x00031690) // TODO: needs updating
#define PLAYERSTATE_P2FLYIN (SonicMania::PlayerStatus)(baseAddress + 0x000CD150)
#define PLAYERSTATE_P2JUMPIN (SonicMania::PlayerStatus)(baseAddress + 0x000CD560)
#define PLAYERSTATE_SpringBasic (SonicMania::PlayerStatus)(baseAddress + 0x000CB6C0)
#define PLAYERSTATE_ScoreCard (SonicMania::PlayerStatus)(baseAddress + 0x000CCD30)
#define PLAYERSTATE_TransportTube_CPZ (SonicMania::PlayerStatus)(baseAddress + 0x000CBA90)
#define PLAYERSTATE_HCZSlide (SonicMania::PlayerStatus)(baseAddress + 0x000B9970); //Added from LHPZ Mod
// Sonic
#define PLAYERSTATE_DROPDASH (SonicMania::PlayerStatus)(baseAddress + 0x000CC1F0)
#define PLAYERSTATE_PEELOUT (SonicMania::PlayerStatus)(baseAddress + 0x000CBF70)
// Tails
#define PLAYERSTATE_FLYING (SonicMania::PlayerStatus)(baseAddress + 0x000CCF30)
#define PLAYERSTATE_FLYCARRIED (SonicMania::PlayerStatus)(baseAddress + 0x000CDA60)
// Knuckles
#define PLAYERSTATE_GLIDELEFT (SonicMania::PlayerStatus)(baseAddress + 0x000CDB10)
#define PLAYERSTATE_GLIDERIGHT (SonicMania::PlayerStatus)(baseAddress + 0x000CDE10)
#define PLAYERSTATE_GLIDESLIDE (SonicMania::PlayerStatus)(baseAddress + 0x000CE230)
#define PLAYERSTATE_CLIMB (SonicMania::PlayerStatus)(baseAddress + 0x000CE380)
#define PLAYERSTATE_LEDGEPULLUP (SonicMania::PlayerStatus)(baseAddress + 0x000CE6F0)
#define PLAYERSTATE_GLIDEDROP (SonicMania::PlayerStatus)(baseAddress + 0x000CE110)
// Mighty
#define PLAYERSTATE_HAMMERDROP (SonicMania::PlayerStatus)(baseAddress + 0x000CC580)
#define PLAYERSTATE_UNSPIN (SonicMania::PlayerStatus)(baseAddress + 0x000CC990) //Unspin after bouncing on hazard
// Ray
#define PLAYERSTATE_RAYGLIDE (SonicMania::PlayerStatus)(baseAddress + 0x000CD660)
// Move Sets
#define MOVESET_NONE (SonicMania::Ability)(0x00000000)
#define MOVESET_SONIC (SonicMania::Ability)(baseAddress + 0x000C8630)
#define MOVESET_TAILS (SonicMania::Ability)(baseAddress + 0x000C8990)
#define MOVESET_KNUX (SonicMania::Ability)(baseAddress + 0x000C8A70)
#define MOVESET_MIGHTY (SonicMania::Ability)(baseAddress + 0x000C8B70)
#define MOVESET_RAY (SonicMania::Ability)(baseAddress + 0x000C8DF0)
#define MOVESET_ERSS (SonicMania::Ability)(baseAddress + 0x000C2340) // Egg Reverie Super Sonic
#define UpAbility_Peelout (SonicMania::Ability)(baseAddress + 0x000C8FF0)
#define PLAYERID1 0
#define PLAYERID2 1
#define PLAYERID3 2
#define PLAYERID4 3
//not a state but calling this will hit a player, it has no checks, not even for invincible frames
ThiscallFunctionPointer(int, Player_Hit, (EntityPlayer* Player), 0x000C5970);
#pragma endregion
#pragma region Structs
struct Vector2
{
Vector2()
{
}
Vector2(int x, int y) : Vector2()
{
X = x;
Y = y;
}
Vector2(float x, float y) : Vector2()
{
X = (short)x;
Y = (short)y;
SubX = (ushort)((x - (ushort)(x)) * 0x10000);
SubX = (ushort)((y - (ushort)(y)) * 0x10000);
}
Vector2(int x) : Vector2()
{
X = x;
Y = x;
}
Vector2* Add(Vector2& vec)
{
X += vec.X;
Y += vec.Y;
return this;
}
Vector2* Sub(Vector2& vec)
{
X -= vec.X;
Y -= vec.Y;
return this;
}
Vector2* Mul(Vector2& vec)
{
X *= vec.X;
Y *= vec.Y;
return this;
}
Vector2* Div(Vector2& vec)
{
X /= vec.X;
Y /= vec.Y;
return this;
}
Vector2* Abs()
{
if (X < 0)
X *= -1;
if (Y < 0)
Y *= -1;
}
Vector2 operator+(const Vector2& vec2)
{
Vector2 vec;
vec.Add(*this);
vec.Add(*(Vector2*)&vec2);
return vec;
}
Vector2 operator+=(const Vector2& vec2)
{
Add(*(Vector2*)&vec2);
return *this;
}
Vector2 operator-(const Vector2& vec2)
{
Vector2 vec;
vec.Add(*this);
vec.Sub(*(Vector2*)&vec2);
return vec;
}
Vector2 operator-=(const Vector2& vec2)
{
Sub(*(Vector2*)&vec2);
return *this;
}
Vector2 operator*(const Vector2& vec2)
{
Vector2 vec;
vec.Add(*this);
vec.Mul(*(Vector2*)&vec2);
return vec;
}
Vector2 operator*=(const Vector2& vec2)
{
Mul(*(Vector2*)&vec2);
return *this;
}
Vector2 operator/(const Vector2& vec2)
{
Vector2 vec;
vec.Add(*this);
vec.Div(*(Vector2*)&vec2);
return vec;
}
Vector2 operator/=(const Vector2& vec2)
{
Div(*(Vector2*)&vec2);
return *this;
}
/** Calculates the Angle to the target vector
Vector2 target: Location to the target.
double Return: Angle between the main and target in Radians.
**/
double CalculateAngle(Vector2 target)
{
double theta = atan2(target.X - X, Y - target.Y);
if (theta < 0.0)
theta += 6.2831853071795865;
return theta;
}
/** Calculates the Distance between to the target vector and the main vector
Vector2 target: Location to the target.
double Return: The Distance between the main and target.
**/
double inline CalculateDistance(Vector2 target)
{
return sqrt(pow(X - target.X, 2) + pow(Y - target.Y, 2));
}
int GetFullX()
{
return (X << 16) + SubX;
}
int GetFullY()
{
return (Y << 16) + SubY;
}
float GetFullX_F()
{
return (float)X + (float)(SubX / 0x10000);
}
float GetFullY_F()
{
return (float)Y + (float)(SubY / 0x10000);
}
void SetFullX(int x)
{
SubX = (short)x;
X = x >> 16;
}
void SetFullY(int y)
{
SubY = (short)y;
Y = y >> 16;
}
void SetFullX(float x)
{
X = (short)x;
SubX = (ushort)((x - (ushort)(x)) * 0x10000);
}
void SetFullY(float y)
{
Y = (short)y;
SubY = (ushort)((y - (ushort)(y)) * 0x10000);
}
bool inline IsNull()
{
return X == 0 && Y == 0;
}
int inline ToTileX(int offsetX = 0)
{
return (X != 0 ? X / 16 : 0) + offsetX;
}
int inline ToTileY(int offsetY = 0)
{
return (Y != 0 ? Y / 16 : 0) + offsetY;
}
Vector2 inline ToTile(int offsetX = 0, int offsetY = 0)
{
return Vector2(ToTileX(offsetX), ToTileY(offsetY));
}
public:
ushort SubX = 0;
short X = 0;
ushort SubY = 0;
short Y = 0;
};
struct Color
{
byte Red = 0;
byte Green = 0;
byte Blue = 0;
Color()
{
}
Color(byte r, byte g, byte b)
{
Red = r;
Green = g;
Blue = b;
}
Color(int rgb)
{
Red = (rgb >> 16) & 0xFF;
Green = (rgb >> 8) & 0xFF;
Blue = rgb & 0xFF;
}
inline SHORT ToRGB565()
{
//return ((Red & 0b11111000) << 8) | ((Green & 0b11111100) << 3) | (Blue >> 3);
return (Blue >> 3) | 32 * (Green >> 2) | ((Red >> 3) << 11);
}
inline int ToRGB888()
{
return (Red & 0xFF) << 16 | (Green & 0xFF) << 8 | Blue & 0xFF;
}
inline void FromRGB565(SHORT RGB565)
{
Red = (RGB565 & 0b1111100000000000) >> 8;
Green = (RGB565 & 0b0000011111100000) >> 3;
Blue = (RGB565 & 0b0000000000011111) << 3;
}
inline void FromINT(int rgb)
{
Red = (rgb >> 16) & 0xFF;
Green = (rgb >> 8) & 0xFF;
Blue = rgb & 0xFF;
}
inline void Tint(float tint)
{
Red = (byte)(Red * tint);
Green = (byte)(Green * tint);
Blue = (byte)(Blue * tint);
}
inline void Blend(byte r, byte g, byte b, float a)
{
Red = (byte)(a * r + (1 - a) * Red);
Green = (byte)(a * g + (1 - a) * Green);
Blue = (byte)(a * b + (1 - a) * Blue);
}
inline void Blend(Color color, float a)
{