Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Global/ItemBox.h
338 views
1
#ifndef OBJ_ITEMBOX_H
2
#define OBJ_ITEMBOX_H
3
4
#include "Game.h"
5
6
typedef enum {
7
ITEMBOX_RING,
8
ITEMBOX_BLUESHIELD,
9
ITEMBOX_BUBBLESHIELD,
10
ITEMBOX_FIRESHIELD,
11
ITEMBOX_LIGHTNINGSHIELD,
12
ITEMBOX_INVINCIBLE,
13
ITEMBOX_SNEAKERS,
14
ITEMBOX_1UP_SONIC,
15
ITEMBOX_1UP_TAILS,
16
ITEMBOX_1UP_KNUX,
17
ITEMBOX_EGGMAN,
18
ITEMBOX_HYPERRING,
19
ITEMBOX_SWAP,
20
ITEMBOX_RANDOM,
21
ITEMBOX_SUPER,
22
#if MANIA_USE_PLUS
23
ITEMBOX_1UP_MIGHTY,
24
ITEMBOX_1UP_RAY,
25
ITEMBOX_STOCK,
26
#endif
27
ITEMBOX_COUNT
28
} ItemBoxTypes;
29
30
// Object Class
31
struct ObjectItemBox {
32
RSDK_OBJECT
33
Hitbox hitboxItemBox;
34
Hitbox hitboxHidden;
35
int32 brokenFrame;
36
uint16 aniFrames;
37
uint16 sfxDestroy;
38
uint16 sfxTeleport;
39
uint16 sfxHyperRing;
40
#if MANIA_USE_PLUS
41
uint16 sfxPowerDown;
42
uint16 sfxRecovery;
43
#endif
44
};
45
46
// Entity Class
47
struct EntityItemBox {
48
RSDK_ENTITY
49
StateMachine(state);
50
ItemBoxTypes type;
51
Vector2 contentsPos;
52
Vector2 moveOffset;
53
int32 contentsSpeed;
54
Entity *storedEntity;
55
int32 timer;
56
bool32 isFalling;
57
bool32 isContents;
58
bool32 hidden;
59
PlaneFilterTypes planeFilter;
60
bool32 lrzConvPhys;
61
Animator boxAnimator;
62
Animator contentsAnimator;
63
Animator overlayAnimator;
64
Animator debrisAnimator;
65
#if MANIA_USE_PLUS
66
Entity *parent;
67
#endif
68
};
69
70
// Object Struct
71
extern ObjectItemBox *ItemBox;
72
73
// Standard Entity Events
74
void ItemBox_Update(void);
75
void ItemBox_LateUpdate(void);
76
void ItemBox_StaticUpdate(void);
77
void ItemBox_Draw(void);
78
void ItemBox_Create(void *data);
79
void ItemBox_StageLoad(void);
80
#if GAME_INCLUDE_EDITOR
81
void ItemBox_EditorDraw(void);
82
void ItemBox_EditorLoad(void);
83
#endif
84
void ItemBox_Serialize(void);
85
86
// Extra Entity Functions
87
void ItemBox_DebugDraw(void);
88
void ItemBox_DebugSpawn(void);
89
void ItemBox_CheckHit(void);
90
void ItemBox_GivePowerup(void);
91
void ItemBox_Break(EntityItemBox *itemBox, EntityPlayer *player);
92
bool32 ItemBox_HandleFallingCollision(void);
93
bool32 ItemBox_HandlePlatformCollision(void *platform);
94
void ItemBox_HandleObjectCollisions(void);
95
96
// Entity States
97
void ItemBox_State_Broken(void);
98
void ItemBox_State_Break(void);
99
void ItemBox_State_IconFinish(void);
100
void ItemBox_State_Idle(void);
101
void ItemBox_State_Falling(void);
102
void ItemBox_State_Conveyor(void);
103
104
#endif //! OBJ_ITEMBOX_H
105
106