Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Cutscene/FXExpandRing.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: FXExpandRing Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectFXExpandRing *FXExpandRing;
11
12
void FXExpandRing_Update(void)
13
{
14
RSDK_THIS(FXExpandRing);
15
16
StateMachine_Run(self->state);
17
18
Entity *parent = self->parent;
19
if (parent) {
20
if (self->drawFX == FX_FLIP && parent->direction) {
21
self->position.x = parent->position.x - self->posOffset.x;
22
self->position.y = parent->position.y + self->posOffset.y;
23
}
24
else {
25
self->position.x = parent->position.x + self->posOffset.x;
26
self->position.y = parent->position.y + self->posOffset.y;
27
}
28
}
29
}
30
31
void FXExpandRing_LateUpdate(void) {}
32
33
void FXExpandRing_StaticUpdate(void) {}
34
35
void FXExpandRing_Draw(void)
36
{
37
RSDK_THIS(FXExpandRing);
38
39
RSDK.DrawCircleOutline(self->position.x, self->position.y, self->innerRadius, self->outerRadius, self->color, self->alpha, INK_ADD, false);
40
}
41
42
void FXExpandRing_Create(void *data)
43
{
44
RSDK_THIS(FXExpandRing);
45
46
if (!SceneInfo->inEditor) {
47
self->visible = true;
48
self->active = ACTIVE_NORMAL;
49
self->drawGroup = Zone->objectDrawGroup[1];
50
self->expandMax = 64;
51
self->expandSpeed = 8;
52
self->state = FXExpandRing_State_FadeIn;
53
self->color = 0xF0F0F0;
54
}
55
}
56
57
void FXExpandRing_StageLoad(void) {}
58
59
void FXExpandRing_State_FadeIn(void)
60
{
61
RSDK_THIS(FXExpandRing);
62
63
if (self->alpha < 0xC0)
64
self->alpha += 0x10;
65
66
self->outerRadius += self->expandSpeed;
67
68
if (self->outerRadius > self->expandMax - (self->expandMax >> 2))
69
self->state = FXExpandRing_State_Expand;
70
}
71
void FXExpandRing_State_Expand(void)
72
{
73
RSDK_THIS(FXExpandRing);
74
75
if (self->alpha < 0xC0)
76
self->alpha += 0x10;
77
78
if (self->outerRadius < self->expandMax)
79
self->outerRadius += self->expandSpeed;
80
81
if (self->innerRadius >= self->expandMax - (self->expandMax >> 3))
82
self->state = FXExpandRing_State_FadeOut;
83
else
84
self->innerRadius += (self->expandSpeed >> 1);
85
}
86
void FXExpandRing_State_FadeOut(void)
87
{
88
RSDK_THIS(FXExpandRing);
89
90
if (self->alpha <= 0)
91
destroyEntity(self);
92
else
93
self->alpha -= 0x10;
94
}
95
96
#if GAME_INCLUDE_EDITOR
97
void FXExpandRing_EditorDraw(void) {}
98
99
void FXExpandRing_EditorLoad(void) {}
100
#endif
101
102
void FXExpandRing_Serialize(void) {}
103
104