Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Common/BreakableWall.h
338 views
1
#ifndef OBJ_BREAKABLEWALL_H
2
#define OBJ_BREAKABLEWALL_H
3
4
#include "Game.h"
5
6
typedef enum {
7
BREAKWALL_TYPE_WALL,
8
BREAKWALL_TYPE_FLOOR,
9
BREAKWALL_TYPE_BURROWFLOOR,
10
BREAKWALL_TYPE_BURROWFLOOR_B,
11
BREAKWALL_TYPE_BURROWFLOORUP,
12
BREAKWALL_TYPE_CEILING
13
} BreakableWallTypes;
14
15
typedef enum {
16
BREAKWALL_PRIO_HIGH,
17
BREAKWALL_PRIO_LOW,
18
} BreakableWallPriorities;
19
20
typedef enum {
21
BREAKWALL_TILE_FIXED = 1,
22
BREAKWALL_TILE_DYNAMIC,
23
} BreakableWallTileTypes;
24
25
// Object Class
26
struct ObjectBreakableWall {
27
RSDK_OBJECT
28
Animator animator;
29
uint16 aniFrames;
30
// possibly used before math (and in v4); these are reportedly velocity tables
31
TABLE(int32 unused1[16], { -0x80000, -0x180000, 0x80000, -0x180000, -0x80000, -0x80000, 0x80000, -0x80000, -0x80000, 0x80000, 0x80000, 0x80000,
32
-0x80000, 0x180000, 0x80000, 0x180000 });
33
TABLE(int32 unused2[16], { -0x60000, -0x60000, -0x40000, -0x50000, -0x120000, -0x20000, -0x60000, -0x10000, -0x80000, 0x20000, -0x60000, 0x10000,
34
-0x60000, 0x60000, -0x40000, 0x50000 });
35
TABLE(int32 breakOffsets[16], { 0x40000, -0x50000, 0x60000, -0x60000, 0x60000, -0x10000, 0x80000, -0x20000, 0x60000, 0x10000, 0x80000, 0x20000,
36
0x40000, 0x50000, 0x60000, 0x60000 });
37
TABLE(int32 breakVelocitiesL[8], { -0x80000, -0x80000, 0x80000, -0x80000, -0x80000, 0x80000, 0x80000, 0x80000 });
38
TABLE(int32 breakVelocitiesR[8], { -0x20000, -0x20000, 0x20000, -0x20000, -0x10000, -0x10000, 0x10000, -0x10000 });
39
uint16 sfxBreak;
40
uint16 farPlaneLayer;
41
};
42
43
// Entity Class
44
struct EntityBreakableWall {
45
RSDK_ENTITY
46
StateMachine(state);
47
StateMachine(stateDraw);
48
uint8 type;
49
bool32 onlyKnux;
50
bool32 onlyMighty;
51
BreakableWallPriorities priority;
52
Vector2 size;
53
uint16 tileInfo;
54
uint16 targetLayer;
55
int32 timer;
56
Vector2 tilePos;
57
int32 tileRotation;
58
int32 gravityStrength;
59
Hitbox hitbox;
60
};
61
62
// Object Struct
63
extern ObjectBreakableWall *BreakableWall;
64
65
// Standard Entity Events
66
void BreakableWall_Update(void);
67
void BreakableWall_LateUpdate(void);
68
void BreakableWall_StaticUpdate(void);
69
void BreakableWall_Draw(void);
70
void BreakableWall_Create(void *data);
71
void BreakableWall_StageLoad(void);
72
#if GAME_INCLUDE_EDITOR
73
void BreakableWall_EditorDraw(void);
74
void BreakableWall_EditorLoad(void);
75
#endif
76
void BreakableWall_Serialize(void);
77
78
// Extra Entity Functions
79
80
// States
81
void BreakableWall_State_FallingTile(void);
82
void BreakableWall_State_Tile(void);
83
void BreakableWall_State_Wall(void);
84
void BreakableWall_State_Floor(void);
85
void BreakableWall_State_BurrowFloor(void);
86
void BreakableWall_State_BurrowFloorUp(void);
87
void BreakableWall_State_Ceiling(void);
88
89
// Draw States
90
void BreakableWall_Draw_Wall(void);
91
void BreakableWall_Draw_Floor(void);
92
void BreakableWall_Draw_Tile(void);
93
94
// Breaking
95
void BreakableWall_CheckBreak_Wall(void);
96
void BreakableWall_CheckBreak_Floor(void);
97
void BreakableWall_CheckBreak_BurrowFloor(void);
98
void BreakableWall_CheckBreak_BurrowFloorUp(void);
99
void BreakableWall_CheckBreak_Ceiling(void);
100
101
void BreakableWall_Break(EntityBreakableWall *self, uint8 direction);
102
103
// Misc
104
void BreakableWall_GiveScoreBonus(EntityPlayer *player);
105
106
#endif //! OBJ_BREAKABLEWALL_H
107
108