Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/BSS/BSS_Setup.h
338 views
1
#ifndef OBJ_BSS_SETUP_H
2
#define OBJ_BSS_SETUP_H
3
4
#include "Game.h"
5
6
#define BSS_PLAYFIELD_W (0x20)
7
#define BSS_PLAYFIELD_H (0x20)
8
9
// Object Class
10
struct ObjectBSS_Setup {
11
RSDK_OBJECT
12
uint8 randomNumbers[4]; // used to calculate the map (& colours) for Random BSS mode
13
int32 sphereCount;
14
int32 pinkSphereCount;
15
int32 rings;
16
int32 ringPan;
17
int32 ringCount;
18
int32 ringID; // updated in BSS_Collected, but aside from that it goes pretty much unused it seems
19
uint16 bgLayer;
20
uint16 globeLayer;
21
uint16 frustum1Layer;
22
uint16 frustum2Layer;
23
uint16 playFieldLayer;
24
uint16 ringCountLayer;
25
uint16 globeFrames;
26
TABLE(int32 globeFrameTable[0xF], { 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0 });
27
TABLE(int32 globeDirTableL[0xF], { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 });
28
TABLE(int32 globeDirTableR[0xF], { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 });
29
TABLE(int32 screenYTable[0x70],
30
{ 280, 270, 260, 251, 243, 235, 228, 221, 215, 208, 202, 197, 191, 185, 180, 175, 170, 165, 160, 155, 151, 147, 143,
31
139, 135, 131, 127, 124, 121, 117, 114, 111, 108, 105, 103, 100, 97, 95, 92, 90, 88, 86, 83, 81, 79, 77,
32
76, 74, 72, 70, 69, 67, 66, 64, 63, 62, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48,
33
47, 47, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39,
34
39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38 });
35
TABLE(int32 divisorTable[0x70],
36
{ 4096, 4032, 3968, 3904, 3840, 3776, 3712, 3648, 3584, 3520, 3456, 3392, 3328, 3264, 3200, 3136, 3072, 2995, 2920, 2847, 2775, 2706, 2639,
37
2572, 2508, 2446, 2384, 2324, 2266, 2210, 2154, 2100, 2048, 2012, 1976, 1940, 1906, 1872, 1838, 1806, 1774, 1742, 1711, 1680, 1650, 1621,
38
1592, 1564, 1536, 1509, 1482, 1455, 1429, 1404, 1379, 1354, 1330, 1307, 1283, 1260, 1238, 1216, 1194, 1173, 1152, 1134, 1116, 1099, 1082,
39
1065, 1048, 1032, 1016, 1000, 985, 969, 954, 939, 925, 910, 896, 892, 888, 884, 880, 875, 871, 867, 863, 859, 855, 851,
40
848, 844, 840, 836, 832, 830, 828, 826, 824, 822, 820, 818, 816, 814, 812, 810, 808, 806, 804, 802 });
41
TABLE(int32 xMultiplierTable[0x70],
42
{ 134, 131, 128, 125, 123, 121, 119, 117, 115, 114, 112, 111, 109, 108, 106, 104, 104, 102, 100, 98, 97, 96, 94, 93, 92, 90, 89, 88,
43
86, 84, 83, 82, 80, 80, 79, 78, 77, 76, 74, 73, 72, 71, 70, 70, 68, 68, 67, 66, 65, 64, 63, 62, 61, 60, 60, 59,
44
58, 57, 57, 56, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43,
45
42, 42, 42, 41, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 36, 36 });
46
TABLE(int32 frameTable[0x80],
47
{ 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25,
48
24, 24, 24, 24, 23, 23, 23, 23, 22, 22, 22, 22, 21, 21, 21, 21, 20, 20, 20, 20, 19, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17, 17,
49
16, 16, 16, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7,
50
6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
51
Vector2 offsetTable[0x100];
52
int32 offsetRadiusTable[0x100];
53
int32 frustumCount[2];
54
int32 frustumOffset[2];
55
int32 unused1;
56
uint16 playField[0x400]; // Active Spheres & Collectables (0x400 == 0x20 * 0x20 == BSS_PLAYFIELD_W * BSS_PLAYFIELD_H)
57
uint16 sphereChainTable[0x400]; // Currently chained spheres (0x400 == 0x20 * 0x20 == BSS_PLAYFIELD_W * BSS_PLAYFIELD_H)
58
uint16 sphereCollectedTable[0x400]; // Spheres to turn into rings (0x400 == 0x20 * 0x20 == BSS_PLAYFIELD_W * BSS_PLAYFIELD_H)
59
uint16 sfxBlueSphere;
60
uint16 sfxSSExit;
61
uint16 sfxBumper;
62
uint16 sfxSpring;
63
uint16 sfxRing;
64
uint16 sfxLoseRings;
65
uint16 sfxSSJettison;
66
uint16 sfxEmerald;
67
uint16 sfxEvent;
68
uint16 sfxMedal;
69
uint16 sfxMedalCaught;
70
uint16 sfxTeleport;
71
};
72
73
// Entity Class
74
struct EntityBSS_Setup {
75
RSDK_ENTITY
76
StateMachine(state);
77
int32 spinTimer;
78
int32 speedupTimer;
79
int32 speedupInterval;
80
int32 timer;
81
int32 spinState;
82
int32 palettePage;
83
int32 unused1;
84
int32 xMultiplier;
85
int32 divisor;
86
int32 speedupLevel;
87
int32 globeSpeed;
88
bool32 playerWasBumped;
89
int32 globeSpeedInc;
90
bool32 disableBumpers;
91
int32 globeTimer;
92
int32 paletteLine;
93
int32 offsetDir;
94
int32 unused2;
95
Vector2 offset;
96
Vector2 playerPos;
97
Vector2 lastSpherePos;
98
int32 unused3;
99
bool32 completedRingLoop;
100
int32 paletteID;
101
int32 stopMovement;
102
Animator globeSpinAnimator;
103
Animator shadowAnimator;
104
};
105
106
// Object Struct
107
extern ObjectBSS_Setup *BSS_Setup;
108
109
// Standard Entity Events
110
void BSS_Setup_Update(void);
111
void BSS_Setup_LateUpdate(void);
112
void BSS_Setup_StaticUpdate(void);
113
void BSS_Setup_Draw(void);
114
void BSS_Setup_Create(void *data);
115
void BSS_Setup_StageLoad(void);
116
#if GAME_INCLUDE_EDITOR
117
void BSS_Setup_EditorDraw(void);
118
void BSS_Setup_EditorLoad(void);
119
#endif
120
void BSS_Setup_Serialize(void);
121
122
// Extra Entity Functions
123
int32 BSS_Setup_GetStageID(void);
124
void BSS_Setup_SetupPalette(void);
125
void BSS_Setup_SetupFrustum(void);
126
void BSS_Setup_CollectRing(void);
127
void BSS_Setup_GetStartupInfo(void);
128
void BSS_Setup_State_GlobeJettison(void);
129
void BSS_Setup_HandleSteppedObjects(void);
130
void BSS_Setup_HandleCollectableMovement(void);
131
void BSS_Setup_State_GlobeEmerald(void);
132
void BSS_Setup_State_StartGlobeTeleport(void);
133
void BSS_Setup_State_GlobeExit(void);
134
void BSS_Setup_State_GlobeMoveZ(void);
135
void BSS_Setup_State_GlobeTurnLeft(void);
136
void BSS_Setup_State_GlobeTurnRight(void);
137
void BSS_Setup_State_FinishGlobeTeleport(void);
138
bool32 BSS_Setup_CheckSphereValid(int32 x, int32 y);
139
void BSS_Setup_LaunchSpheres(void);
140
void BSS_Setup_SetupFinishSequence(void);
141
bool32 BSS_Setup_ScanSphereChain_Up(uint8 x, uint8 y);
142
bool32 BSS_Setup_ScanSphereChain_Down(uint8 x, uint8 y);
143
bool32 BSS_Setup_ScanSphereChain_Left(uint8 x, uint8 y);
144
bool32 BSS_Setup_ScanSphereChain_Right(uint8 x, uint8 y);
145
bool32 BSS_Setup_GetChainedSphereCount(uint8 x, uint8 y);
146
void BSS_Setup_ProcessChain(void);
147
148
#endif //! OBJ_BSS_SETUP_H
149
150