Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/ERZ/PhantomEgg.h
338 views
1
#ifndef OBJ_PHANTOMEGG_H
2
#define OBJ_PHANTOMEGG_H
3
4
#include "Game.h"
5
6
typedef enum {
7
PHANTOMEGG_EGGMAN,
8
} PhantomEggTypes;
9
10
// Names for the values in the attack tables
11
// Tables can only have int constants so we cant put these in there directly
12
typedef enum {
13
PHANTOMEGG_ATTACK_NONE,
14
PHANTOMEGG_ATTACK_JUMP,
15
PHANTOMEGG_ATTACK_SHOCK,
16
PHANTOMEGG_ATTACK_MISSILES,
17
PHANTOMEGG_ATTACK_WARP,
18
} PhantomEggAttackIDs;
19
20
// Object Class
21
struct ObjectPhantomEgg {
22
RSDK_OBJECT
23
TABLE(int32 debrisInfo[29], { 4, 0, 0, -0x20000, -0x28000, 1, 0, -0x20000, -0x28000, 2, 0, 0x20000, -0x20000, 3, 0, 0x28000,
24
-0x20000, 4, 0, -0x10000, -0x10000, 5, 0, 0x10000, -0x10000, 6, 0, -0x8000, -0x10000 });
25
TABLE(int32 attackStateTable1[32], { 0, 0, 0, 0, 1, 0, 0, 2, 0, 1, 3, 0, 2, 0, 0, 4, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 1, 0, 0, 2, 0, 4 });
26
TABLE(int32 attackStateTable2[32], { 0, 0, 2, 0, 1, 3, 0, 2, 0, 0, 3, 0, 2, 0, 0, 3, 0, 0, 0, 1, 2, 0, 0, 3, 0, 0, 1, 0, 0, 2, 0, 4 });
27
TABLE(int32 attackStateTable3[32], { 0, 0, 2, 0, 1, 3, 3, 2, 0, 3, 3, 0, 2, 0, 0, 3, 0, 0, 0, 1, 2, 0, 0, 3, 0, 0, 1, 0, 0, 2, 0, 4 });
28
int32 boundsL;
29
int32 boundsR;
30
int32 boundsM;
31
int32 boundsT;
32
int32 boundsB;
33
int32 boundsStoreL1;
34
int32 boundsStoreR1;
35
int32 boundsStoreT1;
36
int32 boundsStoreB1;
37
int32 startScanline;
38
int32 endScanline;
39
bool32 setupPalette;
40
bool32 savedGameProgress;
41
uint16 sfxHit;
42
uint16 sfxExplosion2;
43
uint16 sfxRocketJet;
44
uint16 sfxExplosion3;
45
uint16 sfxJump;
46
uint16 sfxLand;
47
uint16 sfxRepel;
48
uint16 sfxShield;
49
uint16 sfxShock;
50
uint16 sfxSummon;
51
uint16 sfxMissile;
52
uint16 aniFrames;
53
bool32 disableSuperForm;
54
};
55
56
// Entity Class
57
struct EntityPhantomEgg {
58
RSDK_ENTITY
59
StateMachine(state);
60
StateMachine(stateDraw);
61
int32 type;
62
int32 timer;
63
int32 invincibilityTimer;
64
int32 health;
65
int32 remainingJumps;
66
int32 attackTimer;
67
int32 phantomID;
68
int32 palBlendPercent;
69
Vector2 targetPos;
70
Vector2 targetVelocity;
71
int32 *attackStateTable;
72
int32 unused;
73
Animator crackAnimator;
74
Animator coreAnimator;
75
Animator legAnimator;
76
Animator armLAnimator;
77
Animator armRAnimator;
78
Animator eggmanAnimator;
79
Animator rubyAnimator;
80
Hitbox hitbox;
81
};
82
83
// Object Struct
84
extern ObjectPhantomEgg *PhantomEgg;
85
86
// Standard Entity Events
87
void PhantomEgg_Update(void);
88
void PhantomEgg_LateUpdate(void);
89
void PhantomEgg_StaticUpdate(void);
90
void PhantomEgg_Draw(void);
91
void PhantomEgg_Create(void *data);
92
void PhantomEgg_StageLoad(void);
93
#if GAME_INCLUDE_EDITOR
94
void PhantomEgg_EditorDraw(void);
95
void PhantomEgg_EditorLoad(void);
96
#endif
97
void PhantomEgg_Serialize(void);
98
99
// Extra Entity Functions
100
void PhantomEgg_HandleAnimations(void);
101
void PhantomEgg_CheckPlayerCollisions(void);
102
void PhantomEgg_Hit(void);
103
void PhantomEgg_Explode(Hitbox *hitbox);
104
void PhantomEgg_HandleNextAttack(void);
105
void PhantomEgg_SetupWarpFX(void);
106
void PhantomEgg_HandlePhantomWarp(uint8 phantomID);
107
void PhantomEgg_HandleReturnWarp(void);
108
void PhantomEgg_Scanline_WarpFX(ScanlineInfo *scanlines);
109
110
void PhantomEgg_Draw_Normal(void);
111
void PhantomEgg_Draw_Cracked(void);
112
113
void PhantomEgg_State_SetupArena(void);
114
void PhantomEgg_State_DimArena(void);
115
void PhantomEgg_State_EnterEggman(void);
116
void PhantomEgg_State_AdjustStartingPos(void);
117
void PhantomEgg_State_IntroHover(void);
118
void PhantomEgg_State_BeginFight(void);
119
void PhantomEgg_State_MoveAround(void);
120
void PhantomEgg_State_Attack_Jumped(void);
121
void PhantomEgg_State_Attack_JumpLand(void);
122
void PhantomEgg_State_Attack_JumpAttack(void);
123
void PhantomEgg_State_Attack_CableShock(void);
124
void PhantomEgg_State_Attack_PrepareWarp(void);
125
void PhantomEgg_State_Attack_GrabPlayers(void);
126
void PhantomEgg_State_Attack_HandleWarp(void);
127
void PhantomEgg_State_Attack_WarpAway(void);
128
void PhantomEgg_State_Attack_WarpReturn(void);
129
void PhantomEgg_State_Destroyed(void);
130
void PhantomEgg_State_Exploding(void);
131
void PhantomEgg_State_StartBadEnd(void);
132
void PhantomEgg_State_CrackOpen(void);
133
void PhantomEgg_State_CrackedExploding(void);
134
void PhantomEgg_State_StartGoodEnd(void);
135
136
#if MANIA_USE_PLUS
137
void PhantomEgg_SaveGameCB(bool32 success);
138
#else
139
void PhantomEgg_SaveGameCB(void);
140
#endif
141
142
#endif //! OBJ_PHANTOMEGG_H
143
144