Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/MMZ/Piston.h
338 views
1
#ifndef OBJ_PISTON_H
2
#define OBJ_PISTON_H
3
4
#include "Game.h"
5
6
typedef enum {
7
PISTON_MOVE_VERTICAL,
8
PISTON_UP,
9
PISTON_MOVE_DOWN,
10
PISTON_MOVE_DOWN_REVERSE,
11
PISTON_MOVE_RIGHT,
12
PISTON_MOVE_LEFT,
13
PISTON_MOVE_HORIZONTAL,
14
} PistonTypes;
15
16
typedef enum {
17
PISTON_SIZE_1,
18
PISTON_SIZE_2,
19
PISTON_SIZE_3,
20
} PistonSizes;
21
22
// Object Class
23
struct ObjectPiston {
24
RSDK_OBJECT
25
uint16 sfxLand;
26
uint16 sfxLaunch;
27
};
28
29
// Entity Class
30
struct EntityPiston {
31
RSDK_ENTITY
32
StateMachine(state);
33
StateMachine(stateCollide);
34
int32 type;
35
Vector2 amplitude;
36
int32 speed;
37
bool32 reverse;
38
int8 size;
39
uint8 collision;
40
Vector2 tileOrigin;
41
Vector2 centerPos;
42
Vector2 drawPos;
43
Vector2 collisionOffset;
44
int32 stood;
45
int32 timer;
46
int32 stoodAngle;
47
uint8 stoodPlayers;
48
uint8 pushPlayersL;
49
uint8 pushPlayersR;
50
Hitbox hitbox;
51
Animator animator;
52
int32 childCount;
53
54
uint16 interval;
55
uint16 intervalOffset;
56
int32 distance;
57
int32 pistonType;
58
};
59
60
// Object Struct
61
extern ObjectPiston *Piston;
62
63
// Standard Entity Events
64
void Piston_Update(void);
65
void Piston_LateUpdate(void);
66
void Piston_StaticUpdate(void);
67
void Piston_Draw(void);
68
void Piston_Create(void *data);
69
void Piston_StageLoad(void);
70
#if GAME_INCLUDE_EDITOR
71
void Piston_EditorDraw(void);
72
void Piston_EditorLoad(void);
73
#endif
74
void Piston_Serialize(void);
75
76
// Extra Entity Functions
77
78
void Piston_Collide_Solid(void);
79
80
void Piston_State_WaitForInterval(void);
81
82
void Piston_StateMove_Down(void);
83
void Piston_StateMove_Down_Reverse(void);
84
void Piston_StateMove_Vertical(void);
85
void Piston_StateMove_Vertical_Reverse(void);
86
void Piston_StateMove_Up(void);
87
void Piston_StateMove_Up_Reverse(void);
88
void Piston_StateMove_Right(void);
89
void Piston_StateMove_Left(void);
90
void Piston_StateMove_Horizontal(void);
91
void Piston_StateMove_Horizontal_Reverse(void);
92
93
void Piston_StateActive_WaitForStood(void);
94
void Piston_StateActive_PreparingLaunch(void);
95
void Piston_StateActive_LaunchPlayers(void);
96
void Piston_StateActive_ReturnToStartPos(void);
97
98
#endif //! OBJ_PISTON_H
99
100