Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Common/Water.h
338 views
1
#ifndef OBJ_WATER_H
2
#define OBJ_WATER_H
3
4
#include "Game.h"
5
6
typedef enum {
7
WATER_WATERLEVEL,
8
WATER_POOL,
9
WATER_BUBBLER,
10
WATER_HEIGHT_TRIGGER,
11
WATER_BIG_BUBBLER,
12
WATER_BTN_BIG_BUBBLE,
13
WATER_SPLASH,
14
WATER_BUBBLE,
15
WATER_COUNTDOWN,
16
} WaterTypes;
17
18
typedef enum {
19
WATER_PRIORITY_LOWEST,
20
WATER_PRIORITY_LOW,
21
WATER_PRIORITY_HIGH,
22
WATER_PRIORITY_HIGHEST,
23
} WaterPriorities;
24
25
// Object Class
26
struct ObjectWater {
27
RSDK_OBJECT
28
int32 waterLevel;
29
int32 newWaterLevel;
30
int32 targetWaterLevel;
31
int32 waterMoveSpeed;
32
int32 constBubbleTimer[PLAYER_COUNT];
33
int32 randBubbleTimer[PLAYER_COUNT];
34
int32 unused1[PLAYER_COUNT]; // unused but set to 0 on bubble timer sets. maybe an old bubble/drowning timer?
35
TABLE(int32 bubbleSizes[18], { 2, 4, 2, 2, 2, 2, 4, 2, 4, 2, 2, 4, 2, 4, 2, 2, 4, 2 });
36
uint16 aniFrames;
37
uint16 bigBubbleFrames;
38
uint16 wakeFrames;
39
Hitbox hitboxPlayerBubble;
40
Hitbox hitboxPoint;
41
uint16 sfxSplash;
42
uint16 sfxBreathe;
43
uint16 sfxWarning;
44
uint16 sfxDrownAlert;
45
uint16 sfxDrown;
46
uint16 sfxSkim;
47
uint16 sfxDNAGrab;
48
uint16 sfxDNABurst;
49
uint16 sfxWaterLevelL;
50
uint16 sfxWaterLevelR;
51
int32 waterLevelChannelL;
52
int32 waterLevelChannelR;
53
int32 unused2;
54
bool32 playingWaterLevelSfx;
55
bool32 moveWaterLevel;
56
int32 waterLevelVolume;
57
int32 waterPalette;
58
bool32 disableWaterSplash; // this is never set except for once and it's used in if ! statements to link the player or not
59
int32 wakePosX[PLAYER_COUNT];
60
uint8 wakeDir[PLAYER_COUNT];
61
Animator wakeAnimator;
62
int32 unused3;
63
bool32 playingSkimSfx;
64
};
65
66
// Entity Class
67
struct EntityWater {
68
RSDK_ENTITY
69
StateMachine(state);
70
StateMachine(stateDraw);
71
int32 type;
72
void *childPtr;
73
int32 bubbleX;
74
int8 bubbleType1;
75
uint8 dudsRemaining;
76
uint8 bubbleFlags;
77
int8 bubbleType2;
78
int32 numDuds;
79
int32 countdownID;
80
bool32 playerInBubble;
81
Vector2 size;
82
Vector2 height;
83
int32 speed;
84
int32 buttonTag;
85
uint8 r;
86
uint8 g;
87
uint8 b;
88
uint8 priority;
89
bool32 destroyOnTrigger;
90
Hitbox hitbox;
91
bool32 isBigBubble;
92
int32 bigBubbleTimer;
93
int32 timer;
94
uint8 activePlayers;
95
uint8 releasedPlayers;
96
Vector2 bubbleOffset;
97
Vector2 bubbleVelocity;
98
EntityButton *taggedButton;
99
Animator animator;
100
};
101
102
// Object Struct
103
extern ObjectWater *Water;
104
105
// Standard Entity Events
106
void Water_Update(void);
107
void Water_LateUpdate(void);
108
void Water_StaticUpdate(void);
109
void Water_Draw(void);
110
void Water_Create(void *data);
111
void Water_StageLoad(void);
112
#if GAME_INCLUDE_EDITOR
113
void Water_EditorDraw(void);
114
void Water_EditorLoad(void);
115
#endif
116
void Water_Serialize(void);
117
118
// Extra Entity Functions
119
120
// Palette stuff
121
void Water_DrawHook_ApplyWaterPalette(void);
122
void Water_DrawHook_RemoveWaterPalette(void);
123
124
// Utils
125
void Water_SetupTagLink(void);
126
void Water_SpawnBubble(EntityPlayer *player, int32 id);
127
void Water_SpawnCountDownBubble(EntityPlayer *player, int32 id, uint8 bubbleID);
128
EntityWater *Water_GetPlayerBubble(EntityPlayer *entityPtr);
129
void Water_HandleBubbleMovement(void);
130
void Water_PopBigBubble(EntityWater *self, bool32 jumpedOut);
131
132
void Water_State_Water(void);
133
void Water_State_Pool(void);
134
void Water_State_Splash(void);
135
void Water_State_Bubble(void);
136
void Water_State_BubbleBreathed(void);
137
void Water_State_BigBubble(void);
138
void Water_State_BtnBigBubble(void);
139
void Water_State_Bubbler(void);
140
void Water_State_Countdown(void);
141
void Water_State_CountdownFollow(void);
142
void Water_State_HeightTrigger(void);
143
144
// Draw States
145
void Water_Draw_Water(void);
146
void Water_Draw_Pool(void);
147
void Water_Draw_Splash(void);
148
void Water_Draw_Countdown(void);
149
void Water_Draw_Bubbler(void);
150
void Water_Draw_Bubble(void);
151
152
#endif //! OBJ_WATER_H
153
154