Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/OOZ/BallCannon.h
338 views
1
#ifndef OBJ_BALLCANNON_H
2
#define OBJ_BALLCANNON_H
3
4
#include "Game.h"
5
6
typedef enum {
7
BALLCANNON_CANNON,
8
BALLCANNON_CORKV,
9
BALLCANNON_CORKH,
10
} BallCannonTypes;
11
12
typedef enum {
13
// Clockwise by default
14
BALLCANNON_DIR_RIGHT_CW,
15
BALLCANNON_DIR_DOWN_CW,
16
BALLCANNON_DIR_LEFT_CW,
17
BALLCANNON_DIR_UP_CW,
18
BALLCANNON_DIR_DOWN_CCW,
19
BALLCANNON_DIR_LEFT_CCW,
20
BALLCANNON_DIR_UP_CCW,
21
BALLCANNON_DIR_RIGHT_CCW,
22
} BallCannonAngles;
23
24
// Object Class
25
struct ObjectBallCannon {
26
RSDK_OBJECT
27
Hitbox hitboxCannon;
28
Hitbox hitboxCorkBlock;
29
Hitbox hitboxCorkEntry;
30
uint16 aniFrames;
31
TABLE(int32 corkDebrisOffset[32], { -0xC0000, -0xC0000, -0x40000, -0xC0000, 0x40000, -0xC0000, 0xC0000, -0xC0000, -0xC0000, -0x40000, -0x40000,
32
-0x40000, 0x40000, -0x40000, 0xC0000, -0x40000, -0xC0000, 0x40000, -0x40000, 0x40000, 0x40000, 0x40000,
33
0xC0000, 0x40000, -0xC0000, 0xC0000, -0x40000, 0xC0000, 0x40000, 0xC0000, 0xC0000, 0xC0000 });
34
TABLE(int32 corkDebrisVelocity[32], { -0x40000, -0x40000, -0x20000, -0x40000, 0x20000, -0x40000, 0x40000, -0x40000, -0x3C000, -0x20000, -0x1C000,
35
-0x20000, 0x1C000, -0x20000, 0x3C000, -0x20000, -0x38000, 0x20000, -0x18000, 0x20000, 0x18000, 0x20000,
36
0x38000, 0x20000, -0x34000, 0x40000, -0x14000, 0x40000, 0x14000, 0x40000, 0x34000, 0x40000 });
37
uint16 sfxLedgeBreak;
38
uint16 sfxFire;
39
};
40
41
// Entity Class
42
struct EntityBallCannon {
43
RSDK_ENTITY
44
StateMachine(state);
45
uint8 type;
46
bool32 exit;
47
uint8 unused1;
48
uint8 activePlayers;
49
uint8 playerTimers[PLAYER_COUNT];
50
int32 unused2;
51
int32 rotationSpeed;
52
Animator animator;
53
};
54
55
// Object Struct
56
extern ObjectBallCannon *BallCannon;
57
58
// Standard Entity Events
59
void BallCannon_Update(void);
60
void BallCannon_LateUpdate(void);
61
void BallCannon_StaticUpdate(void);
62
void BallCannon_Draw(void);
63
void BallCannon_Create(void *data);
64
void BallCannon_StageLoad(void);
65
#if GAME_INCLUDE_EDITOR
66
void BallCannon_EditorDraw(void);
67
void BallCannon_EditorLoad(void);
68
#endif
69
void BallCannon_Serialize(void);
70
71
// Extra Entity Functions
72
void BallCannon_CheckPlayerEntry(void);
73
void BallCannon_State_Idle(void);
74
void BallCannon_State_Inserted(void);
75
void BallCannon_State_Turning(void);
76
void BallCannon_State_EjectPlayer(void);
77
void BallCannon_State_CorkBlocked(void);
78
void BallCannon_State_CorkOpened(void);
79
void BallCannon_State_CorkDebris(void);
80
81
#endif //! OBJ_BALLCANNON_H
82
83