Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/TMZ/TMZFlames.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: TMZFlames Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectTMZFlames *TMZFlames;
11
12
void TMZFlames_Update(void)
13
{
14
RSDK_THIS(TMZFlames);
15
16
self->active = ACTIVE_NORMAL;
17
18
RSDK.ProcessAnimation(&self->animator);
19
20
StateMachine_Run(self->state);
21
}
22
23
void TMZFlames_LateUpdate(void) {}
24
25
void TMZFlames_StaticUpdate(void) {}
26
27
void TMZFlames_Draw(void)
28
{
29
RSDK_THIS(TMZFlames);
30
31
Vector2 drawPos;
32
drawPos.y = (ScreenInfo[SceneInfo->currentScreenID].center.y - 112) << 16;
33
for (int32 i = 0; i < 0x80; i += 0x10) {
34
drawPos.x = (RSDK.Sin256(4 * (i + Zone->timer)) << 11) + self->offset;
35
RSDK.DrawSprite(&self->animator, &drawPos, true);
36
37
drawPos.y += 0x200000;
38
}
39
}
40
41
void TMZFlames_Create(void *data)
42
{
43
RSDK_THIS(TMZFlames);
44
45
if (!SceneInfo->inEditor) {
46
self->visible = true;
47
self->drawGroup = Zone->objectDrawGroup[1];
48
self->active = ACTIVE_BOUNDS;
49
self->updateRange.x = 0x800000;
50
self->updateRange.y = 0x800000;
51
self->drawFX = FX_SCALE;
52
self->inkEffect = INK_ADD;
53
self->alpha = 0x100;
54
self->scale.x = 0x400;
55
self->scale.y = 0x200;
56
self->offset = -0x800000;
57
58
self->state = TMZFlames_State_Delay;
59
RSDK.SetSpriteAnimation(TMZFlames->aniFrames, 0, &self->animator, true, 0);
60
}
61
}
62
63
void TMZFlames_StageLoad(void) { TMZFlames->aniFrames = RSDK.LoadSpriteAnimation("Phantom/Flames.bin", SCOPE_STAGE); }
64
65
void TMZFlames_State_Delay(void)
66
{
67
RSDK_THIS(TMZFlames);
68
69
if (++self->timer == 240) {
70
self->timer = 0;
71
self->state = TMZFlames_State_EnterFlames;
72
}
73
}
74
75
void TMZFlames_State_EnterFlames(void)
76
{
77
RSDK_THIS(TMZFlames);
78
79
if (self->offset < 0)
80
self->offset += 0x40000;
81
82
if (++self->timer == 260) {
83
self->timer = 0;
84
self->state = TMZFlames_State_FlamesEnlarge;
85
}
86
}
87
88
void TMZFlames_State_FlamesEnlarge(void)
89
{
90
RSDK_THIS(TMZFlames);
91
92
if (self->scale.x < 0x1000)
93
self->scale.x += 16;
94
}
95
96
#if GAME_INCLUDE_EDITOR
97
void TMZFlames_EditorDraw(void) {}
98
99
void TMZFlames_EditorLoad(void) {}
100
#endif
101
102
void TMZFlames_Serialize(void) {}
103
104