Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Menu/DAControl.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: DAControl Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectDAControl *DAControl;
11
12
void DAControl_Update(void)
13
{
14
RSDK_THIS(DAControl);
15
StateMachine_Run(self->state);
16
}
17
18
void DAControl_LateUpdate(void) {}
19
20
void DAControl_StaticUpdate(void) {}
21
22
void DAControl_Draw(void)
23
{
24
RSDK_THIS(DAControl);
25
Vector2 drawPos;
26
27
self->direction = FLIP_NONE;
28
for (int32 i = 0; i < 2; ++i) {
29
drawPos = self->position;
30
self->backPlateAnimator.frameID = 0;
31
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
32
33
self->backPlateAnimator.frameID = 1;
34
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
35
36
drawPos.y += 0x80000;
37
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
38
39
drawPos.y += 0x80000;
40
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
41
42
drawPos.y += 0x80000;
43
self->backPlateAnimator.frameID = 2;
44
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
45
46
drawPos.y -= 0x170000;
47
self->backPlateAnimator.frameID = 3;
48
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
49
++self->direction;
50
}
51
52
self->direction = FLIP_NONE;
53
drawPos.y -= 0x130000;
54
self->backPlateAnimator.frameID = 4;
55
RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);
56
57
drawPos.x = self->position.x - 0x700000;
58
drawPos.y = self->position.y + 0x1E0000;
59
for (int32 i = 0; i < 5; ++i) {
60
RSDK.DrawSprite(&self->buttonAnimator, &drawPos, false);
61
RSDK.DrawSprite(&self->optionsAnimator[i], &drawPos, false);
62
drawPos.x += 0x380000;
63
}
64
65
drawPos.x = self->position.x - 0x800000;
66
drawPos.y = self->position.y;
67
if (!SceneInfo->inEditor)
68
RSDK.DrawText(&self->textAnimator, &drawPos, &self->text, 0, self->text.length, ALIGN_LEFT, 0, 0, 0, false);
69
}
70
71
void DAControl_Create(void *data)
72
{
73
RSDK_THIS(DAControl);
74
75
self->drawFX = FX_FLIP;
76
if (!SceneInfo->inEditor) {
77
self->visible = true;
78
self->drawGroup = 2;
79
self->active = ACTIVE_BOUNDS;
80
self->updateRange.x = 0x800000;
81
self->updateRange.y = 0x800000;
82
RSDK.SetSpriteAnimation(DAControl->aniFrames, 0, &self->backPlateAnimator, true, 0);
83
RSDK.SetSpriteAnimation(DAControl->aniFrames, 1, &self->buttonAnimator, true, 0);
84
RSDK.SetSpriteAnimation(DAControl->aniFrames, 4, &self->textAnimator, true, 0);
85
for (int32 i = 0; i < 5; ++i) RSDK.SetSpriteAnimation(DAControl->aniFrames, 2, &self->optionsAnimator[i], true, i);
86
87
RSDK.InitString(&self->text, "SELECT A TRACK...", 0);
88
RSDK.SetSpriteAnimation(DAControl->aniFrames, 4, &self->textAnimator, true, 0);
89
RSDK.SetSpriteString(DAControl->aniFrames, 4, &self->text);
90
}
91
}
92
93
void DAControl_StageLoad(void) { DAControl->aniFrames = RSDK.LoadSpriteAnimation("UI/DAGarden.bin", SCOPE_STAGE); }
94
95
#if GAME_INCLUDE_EDITOR
96
void DAControl_EditorDraw(void)
97
{
98
RSDK_THIS(DAControl);
99
100
self->visible = true;
101
self->drawGroup = 2;
102
self->active = ACTIVE_BOUNDS;
103
self->updateRange.x = 0x800000;
104
self->updateRange.y = 0x800000;
105
RSDK.SetSpriteAnimation(DAControl->aniFrames, 0, &self->backPlateAnimator, true, 0);
106
RSDK.SetSpriteAnimation(DAControl->aniFrames, 1, &self->buttonAnimator, true, 0);
107
RSDK.SetSpriteAnimation(DAControl->aniFrames, 4, &self->textAnimator, true, 0);
108
for (int32 i = 0; i < 5; ++i) RSDK.SetSpriteAnimation(DAControl->aniFrames, 2, &self->optionsAnimator[i], true, i);
109
110
DAControl_Draw();
111
}
112
113
void DAControl_EditorLoad(void) { DAControl->aniFrames = RSDK.LoadSpriteAnimation("UI/DAGarden.bin", SCOPE_STAGE); }
114
#endif
115
116
void DAControl_Serialize(void) {}
117
118