Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/OOZ/OOZFlames.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: OOZFlames Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectOOZFlames *OOZFlames;
11
12
void OOZFlames_Update(void)
13
{
14
RSDK_THIS(OOZFlames);
15
16
RSDK.ProcessAnimation(&self->animator);
17
18
StateMachine_Run(self->state);
19
}
20
21
void OOZFlames_LateUpdate(void) {}
22
23
void OOZFlames_StaticUpdate(void) {}
24
25
void OOZFlames_Draw(void)
26
{
27
RSDK_THIS(OOZFlames);
28
29
Vector2 drawPos;
30
drawPos.x = (ScreenInfo[SceneInfo->currentScreenID].center.x - 240) << 16;
31
32
for (int32 angle = 0; angle < 0x100; angle += 0x10) {
33
drawPos.y = (RSDK.Sin256(4 * (angle + Zone->timer)) << 11) + self->flamePos;
34
RSDK.DrawSprite(&self->animator, &drawPos, true);
35
36
drawPos.x += 0x200000;
37
}
38
}
39
40
void OOZFlames_Create(void *data)
41
{
42
RSDK_THIS(OOZFlames);
43
44
if (!SceneInfo->inEditor) {
45
self->visible = true;
46
self->drawGroup = Zone->objectDrawGroup[1];
47
self->active = ACTIVE_NORMAL;
48
self->drawFX = FX_SCALE;
49
self->inkEffect = INK_ADD;
50
self->alpha = 0x100;
51
self->scale.x = 0x200;
52
self->scale.y = 0x200;
53
self->flamePos = 0x1400000;
54
self->state = OOZFlames_State_Appear;
55
RSDK.SetSpriteAnimation(OOZFlames->aniFrames, 0, &self->animator, true, 0);
56
}
57
}
58
59
void OOZFlames_StageLoad(void) { OOZFlames->aniFrames = RSDK.LoadSpriteAnimation("OOZ/Flames.bin", SCOPE_STAGE); }
60
61
void OOZFlames_State_Appear(void)
62
{
63
RSDK_THIS(OOZFlames);
64
65
if (self->flamePos > 0xE00000)
66
self->flamePos -= 0x20000;
67
68
if (++self->timer == 120) {
69
self->timer = 0;
70
self->state = OOZFlames_State_Rise;
71
}
72
}
73
74
void OOZFlames_State_Rise(void)
75
{
76
RSDK_THIS(OOZFlames);
77
78
if (self->scale.y < 0x1000)
79
self->scale.y += 0x10;
80
}
81
82
#if GAME_INCLUDE_EDITOR
83
void OOZFlames_EditorDraw(void) {}
84
85
void OOZFlames_EditorLoad(void) {}
86
#endif
87
88
void OOZFlames_Serialize(void) {}
89
90