Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Puyo/PuyoIndicator.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: PuyoIndicator Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectPuyoIndicator *PuyoIndicator;
11
12
void PuyoIndicator_Update(void)
13
{
14
RSDK_THIS(PuyoIndicator);
15
16
self->visible = false;
17
18
if (self->state) {
19
StateMachine_Run(self->state);
20
21
RSDK.ProcessAnimation(&self->animator);
22
}
23
}
24
25
void PuyoIndicator_LateUpdate(void) {}
26
27
void PuyoIndicator_StaticUpdate(void) {}
28
29
void PuyoIndicator_Draw(void)
30
{
31
RSDK_THIS(PuyoIndicator);
32
33
RSDK.DrawSprite(&self->animator, NULL, false);
34
}
35
36
void PuyoIndicator_Create(void *data)
37
{
38
RSDK_THIS(PuyoIndicator);
39
40
self->active = ACTIVE_NORMAL;
41
self->drawGroup = Zone->objectDrawGroup[1];
42
self->startPos = self->position;
43
self->visible = true;
44
self->drawFX = FX_SCALE | FX_FLIP;
45
self->scale.x = 0x200;
46
self->scale.y = 0x200;
47
}
48
49
void PuyoIndicator_StageLoad(void) { PuyoIndicator->aniFrames = RSDK.LoadSpriteAnimation("Puyo/PuyoIndicator.bin", SCOPE_STAGE); }
50
51
void PuyoIndicator_ShowWinner(void)
52
{
53
RSDK_THIS(PuyoIndicator);
54
55
self->scale.x = 0x200;
56
self->scale.y = 0x200;
57
self->visible = true;
58
59
RSDK.SetSpriteAnimation(PuyoIndicator->aniFrames, 0, &self->animator, false, 0);
60
61
self->position = self->startPos;
62
self->scale.x = 0x200;
63
self->scale.y = 0x200;
64
self->scale.x += (RSDK.Sin512(8 * Zone->timer) >> 3) + 0x20;
65
self->scale.y += (RSDK.Sin512(8 * Zone->timer) >> 3) + 0x20;
66
}
67
68
void PuyoIndicator_ShowLoser(void)
69
{
70
RSDK_THIS(PuyoIndicator);
71
72
self->scale.x = 0x200;
73
self->scale.y = 0x200;
74
self->visible = true;
75
76
RSDK.SetSpriteAnimation(PuyoIndicator->aniFrames, 1, &self->animator, false, 0);
77
78
self->position.x = self->startPos.x;
79
self->position.y = self->startPos.y + 0x20000;
80
self->position.y += RSDK.Sin256(4 * Zone->timer) << 10;
81
}
82
83
void PuyoIndicator_ShowReady(void)
84
{
85
RSDK_THIS(PuyoIndicator);
86
87
self->scale.x = 0x200;
88
self->scale.y = 0x200;
89
self->visible = true;
90
91
RSDK.SetSpriteAnimation(PuyoIndicator->aniFrames, 2, &self->animator, false, 0);
92
93
self->position.x = self->startPos.x;
94
self->position.y = self->startPos.y;
95
}
96
97
#if GAME_INCLUDE_EDITOR
98
void PuyoIndicator_EditorDraw(void)
99
{
100
RSDK_THIS(PuyoIndicator);
101
102
self->drawFX = FX_FLIP;
103
self->startPos = self->position;
104
self->playerID ? PuyoIndicator_ShowLoser() : PuyoIndicator_ShowWinner();
105
self->scale.x = 0x200;
106
self->scale.y = 0x200;
107
108
PuyoIndicator_Draw();
109
110
self->position = self->startPos;
111
}
112
113
void PuyoIndicator_EditorLoad(void)
114
{
115
PuyoIndicator->aniFrames = RSDK.LoadSpriteAnimation("Puyo/PuyoIndicator.bin", SCOPE_STAGE);
116
117
RSDK_ACTIVE_VAR(PuyoIndicator, playerID);
118
RSDK_ENUM_VAR("Player 1", PUYOGAME_PLAYER1);
119
RSDK_ENUM_VAR("Player 2", PUYOGAME_PLAYER2);
120
}
121
#endif
122
123
void PuyoIndicator_Serialize(void) { RSDK_EDITABLE_VAR(PuyoIndicator, VAR_UINT8, playerID); }
124
125