Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Menu/UIBackground.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: UIBackground Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectUIBackground *UIBackground;
11
12
void UIBackground_Update(void)
13
{
14
RSDK_THIS(UIBackground);
15
16
++self->timer;
17
}
18
19
void UIBackground_LateUpdate(void) {}
20
21
void UIBackground_StaticUpdate(void) {}
22
23
void UIBackground_Draw(void)
24
{
25
RSDK_THIS(UIBackground);
26
27
StateMachine_Run(self->stateDraw);
28
}
29
30
void UIBackground_Create(void *data)
31
{
32
RSDK_THIS(UIBackground);
33
34
if (!SceneInfo->inEditor) {
35
self->active = ACTIVE_NORMAL;
36
self->visible = true;
37
self->drawGroup = 0;
38
self->stateDraw = UIBackground_DrawNormal;
39
}
40
}
41
42
void UIBackground_StageLoad(void) { UIBackground->activeColors = UIBackground->bgColors; }
43
44
void UIBackground_DrawNormal(void)
45
{
46
RSDK_THIS(UIBackground);
47
48
color *colorPtrs = UIBackground->activeColors;
49
50
Vector2 drawPos;
51
RSDK.FillScreen(colorPtrs[0], 0xFF, 0xFF, 0xFF);
52
53
drawPos.x = ((RSDK.Sin512(self->timer) >> 3) + 112) * RSDK.Sin256(self->timer) >> 8;
54
drawPos.y = ((RSDK.Sin512(self->timer) >> 3) + 112) * RSDK.Cos256(self->timer) >> 8;
55
RSDK.DrawCircleOutline(ScreenInfo->center.x, ScreenInfo->center.y, (RSDK.Sin512(self->timer) >> 3) + 108, (RSDK.Sin512(self->timer) >> 3) + 116,
56
colorPtrs[1], 0xFF, INK_NONE, true);
57
58
RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 32, colorPtrs[1], 0xFF, INK_NONE, true);
59
RSDK.DrawCircle(ScreenInfo->center.x - drawPos.x, ScreenInfo->center.y - drawPos.y, 16, colorPtrs[1], 0xFF, INK_NONE, true);
60
RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 26, colorPtrs[1], 0xFF, INK_NONE, true);
61
62
drawPos.x = ((RSDK.Cos512(self->timer) >> 3) + 144) * RSDK.Cos256(self->timer) >> 8;
63
drawPos.y = ((RSDK.Cos512(self->timer) >> 3) + 144) * RSDK.Sin256(self->timer) >> 8;
64
RSDK.DrawCircleOutline(ScreenInfo->center.x, ScreenInfo->center.y, (RSDK.Cos512(self->timer) >> 3) + 140, (RSDK.Cos512(self->timer) >> 3) + 148,
65
colorPtrs[2], 0xFF, INK_NONE, true);
66
67
RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 32, colorPtrs[2], 0xFF, INK_NONE, true);
68
RSDK.DrawCircle(ScreenInfo->center.x - drawPos.x, ScreenInfo->center.y - drawPos.y, 16, colorPtrs[2], 0xFF, INK_NONE, true);
69
RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 26, colorPtrs[0], 0xFF, INK_NONE, true);
70
}
71
72
#if GAME_INCLUDE_EDITOR
73
void UIBackground_EditorDraw(void)
74
{
75
RSDK_THIS(UIBackground);
76
77
RSDK.SetSpriteAnimation(UIBackground->aniFrames, 0, &self->animator, true, 0);
78
79
RSDK.DrawSprite(&self->animator, NULL, false);
80
}
81
82
void UIBackground_EditorLoad(void)
83
{
84
UIBackground->aniFrames = RSDK.LoadSpriteAnimation("Editor/EditorIcons.bin", SCOPE_STAGE);
85
86
RSDK_ACTIVE_VAR(UIBackground, type);
87
RSDK_ENUM_VAR("(Unused)", UIBACKGROUND_UNUSED);
88
}
89
#endif
90
91
void UIBackground_Serialize(void) { RSDK_EDITABLE_VAR(UIBackground, VAR_ENUM, type); }
92
93