Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/SSZ/MetalSonic.h
338 views
1
#ifndef OBJ_METALSONIC_H
2
#define OBJ_METALSONIC_H
3
4
#include "Game.h"
5
6
typedef enum {
7
MS_ANI_IDLE,
8
MS_ANI_TAUNT,
9
MS_ANI_READY,
10
MS_ANI_HOVER,
11
MS_ANI_HOVERTURN,
12
MS_ANI_FLY,
13
MS_ANI_DASHATTACK,
14
MS_ANI_ELECTRICATTACK,
15
MS_ANI_BALLATTACK,
16
MS_ANI_ENTERPANEL,
17
MS_ANI_DEFEATED,
18
MS_ANI_BOOSTER_WEAK,
19
MS_ANI_BOOSTER_STRONG,
20
MS_ANI_BOOSTER_INTRO,
21
} MetalSonicAniIDs;
22
23
typedef enum {
24
MS_ATTACK_DASH,
25
MS_ATTACK_ELECTRIC,
26
MS_ATTACK_BALL,
27
} MetalSonicAttackIDs;
28
29
// Object Class
30
struct ObjectMetalSonic {
31
RSDK_OBJECT
32
int32 unused;
33
int32 invincibilityTimerPanel;
34
uint16 finishedAttacks;
35
uint16 sfxHit;
36
uint16 sfxExplosion2;
37
uint16 sfxExplosion3;
38
uint16 sfxRumble;
39
uint16 sfxJump2;
40
uint16 sfxSpecialRing;
41
uint16 sfxMSElecPulse;
42
uint16 sfxMSBall;
43
uint16 sfxMSFireball;
44
uint16 sfxBeep3;
45
uint16 sfxBeep4;
46
uint16 sfxRockemSockem;
47
uint16 sfxMSShoot;
48
uint16 sfxMSChargeFire;
49
#if MANIA_USE_PLUS
50
uint16 sfxMSTransform;
51
uint16 sfxTransform2;
52
#endif
53
Hitbox hitboxHover;
54
Hitbox hitboxDash;
55
uint16 aniFrames;
56
};
57
58
// Entity Class
59
struct EntityMetalSonic {
60
RSDK_ENTITY
61
StateMachine(state);
62
Vector2 targetPos;
63
int32 timer;
64
int32 unused1;
65
int32 unused2;
66
int32 health;
67
int32 unused3;
68
Vector2 hoverVelocity;
69
Vector2 targetVelocity;
70
int32 attackTimer;
71
uint8 attackType;
72
int32 unused4;
73
int32 invincibilityTimer;
74
EntityMSPanel *panel;
75
Vector2 unusedVec1;
76
Vector2 unusedVec2;
77
Vector2 unusedVec3;
78
Hitbox *outerBox;
79
Hitbox *innerBox;
80
Animator metalSonicAnimator;
81
Animator boosterAnimator;
82
};
83
84
// Object Struct
85
extern ObjectMetalSonic *MetalSonic;
86
87
// Standard Entity Events
88
void MetalSonic_Update(void);
89
void MetalSonic_LateUpdate(void);
90
void MetalSonic_StaticUpdate(void);
91
void MetalSonic_Draw(void);
92
void MetalSonic_Create(void *data);
93
void MetalSonic_StageLoad(void);
94
#if GAME_INCLUDE_EDITOR
95
void MetalSonic_EditorDraw(void);
96
void MetalSonic_EditorLoad(void);
97
#endif
98
void MetalSonic_Serialize(void);
99
100
// Extra Entity Functions
101
void MetalSonic_HandleStageWrap(void);
102
void MetalSonic_ProcessBGParallax(int32 mult);
103
void MetalSonic_HandleVelocity(void);
104
void MetalSonic_HandleAnimDir(void);
105
#if !MANIA_USE_PLUS
106
void MetalSonic_CheckPlayerCollisions(void);
107
void MetalSonic_Hit(void);
108
void MetalSonic_Explode(void);
109
#endif
110
111
// Phase 1
112
void MetalSonic_State_SetupArena(void);
113
void MetalSonic_State_AwaitPlayer(void);
114
void MetalSonic_State_WaitForHologram(void);
115
void MetalSonic_State_Appear(void);
116
void MetalSonic_State_Land(void);
117
void MetalSonic_State_Taunt(void);
118
void MetalSonic_State_GetReady(void);
119
void MetalSonic_State_Ready(void);
120
void MetalSonic_State_Start(void);
121
void MetalSonic_State_EnterHoverMode(void);
122
void MetalSonic_State_Hovering(void);
123
void MetalSonic_State_PrepareAttack(void);
124
void MetalSonic_State_StartAttack(void);
125
void MetalSonic_State_SetupBallAttack_Phase1(void);
126
void MetalSonic_State_BallAttack_Phase1(void);
127
void MetalSonic_State_SetupElectricAttack_Phase1(void);
128
void MetalSonic_State_ElectricAttack_Phase1(void);
129
void MetalSonic_State_SetupDashAttack_Phase1(void);
130
void MetalSonic_State_DashAttack_Phase1(void);
131
132
// Phase 2
133
void MetalSonic_State_EnterPanel(void);
134
void MetalSonic_State_StartPanelSequence(void);
135
void MetalSonic_HandlePanelAttack(void);
136
void MetalSonic_State_OpenFactoryDoor(void);
137
void MetalSonic_State_HandleSilverSonics(void);
138
void MetalSonic_State_PanelExplosion(void);
139
void MetalSonic_State_ExitFactory(void);
140
void MetalSonic_State_PrepareFinalChase(void);
141
142
#if MANIA_USE_PLUS // Phase 3 (VS GigaMetal)
143
void MetalSonic_State_WaitForRuby(void);
144
void MetalSonic_State_ObtainRuby(void);
145
void MetalSonic_State_Transform(void);
146
void MetalSonic_State_Defeated(void);
147
#else // Phase 3 (VS Metal Sonic)
148
void MetalSonic_State_SetupSpikeWall(void);
149
void MetalSonic_State_FlyToSpikeWall(void);
150
void MetalSonic_State_LandNearSpikeWall(void);
151
void MetalSonic_State_Taunt_Phase2(void);
152
void MetalSonic_State_Ready_Phase2(void);
153
void MetalSonic_State_StartSpikeWallMovement(void);
154
void MetalSonic_State_AccelerateSpikeWall(void);
155
void MetalSonic_State_Hover_Phase2(void);
156
void MetalSonic_State_SetupBallAttack_Phase2(void);
157
void MetalSonic_State_BallAttack_Phase2(void);
158
void MetalSonic_State_FinishAttack_Phase2(void);
159
void MetalSonic_State_SetupElectricAttack_Phase2(void);
160
void MetalSonic_State_StartElectricAttack_Phase2(void);
161
void MetalSonic_State_ElectricAttack_Phase2(void);
162
void MetalSonic_State_DashAttack_Phase2(void);
163
void MetalSonic_State_Explode(void);
164
void MetalSonic_State_Defeated(void);
165
void MetalSonic_State_Finish(void);
166
void MetalSonic_State_None(void);
167
168
void MetalSonic_StateWall_Fall(void);
169
void MetalSonic_StateWall_Move(void);
170
#endif
171
172
#endif //! OBJ_METALSONIC_H
173
174