Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/CPZ/CPZShutter.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: CPZShutter Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectCPZShutter *CPZShutter;
11
12
void CPZShutter_Update(void)
13
{
14
RSDK_THIS(CPZShutter);
15
16
StateMachine_Run(self->state);
17
}
18
19
void CPZShutter_LateUpdate(void) {}
20
21
void CPZShutter_StaticUpdate(void) {}
22
23
void CPZShutter_Draw(void)
24
{
25
RSDK_THIS(CPZShutter);
26
27
RSDK.DrawSprite(&self->animator, NULL, false);
28
}
29
30
void CPZShutter_Create(void *data)
31
{
32
RSDK_THIS(CPZShutter);
33
34
if (!SceneInfo->inEditor) {
35
self->visible = true;
36
self->active = ACTIVE_BOUNDS;
37
self->drawGroup = Zone->objectDrawGroup[1] - 2;
38
self->updateRange.x = 0x800000;
39
self->updateRange.y = 0x800000;
40
RSDK.SetSpriteAnimation(CPZShutter->aniFrames, 0, &self->animator, true, 0);
41
}
42
}
43
44
void CPZShutter_StageLoad(void) { CPZShutter->aniFrames = RSDK.LoadSpriteAnimation("CPZ/Shutter.bin", SCOPE_STAGE); }
45
46
void CPZShutter_State_Open(void)
47
{
48
RSDK_THIS(CPZShutter);
49
50
self->position.y -= 0x20000;
51
if (++self->timer == 24) {
52
self->timer = 0;
53
self->state = StateMachine_None;
54
}
55
}
56
57
void CPZShutter_State_Close(void)
58
{
59
RSDK_THIS(CPZShutter);
60
61
self->position.y += 0x20000;
62
if (++self->timer == 24) {
63
self->timer = 0;
64
self->active = ACTIVE_BOUNDS;
65
self->state = StateMachine_None;
66
}
67
}
68
69
#if GAME_INCLUDE_EDITOR
70
void CPZShutter_EditorDraw(void)
71
{
72
RSDK_THIS(CPZShutter);
73
74
RSDK.SetSpriteAnimation(CPZShutter->aniFrames, 0, &self->animator, true, 0);
75
76
CPZShutter_Draw();
77
}
78
79
void CPZShutter_EditorLoad(void) { CPZShutter->aniFrames = RSDK.LoadSpriteAnimation("CPZ/Shutter.bin", SCOPE_STAGE); }
80
#endif
81
82
void CPZShutter_Serialize(void) {}
83
84