Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/BSS/BSS_Palette.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: BSS_Palette Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectBSS_Palette *BSS_Palette;
11
12
void BSS_Palette_Update(void) {}
13
14
void BSS_Palette_LateUpdate(void) {}
15
16
void BSS_Palette_StaticUpdate(void) {}
17
18
void BSS_Palette_Draw(void) {}
19
20
void BSS_Palette_Create(void *data)
21
{
22
RSDK_THIS(BSS_Palette);
23
24
if (!SceneInfo->inEditor)
25
destroyEntity(self);
26
}
27
28
void BSS_Palette_StageLoad(void)
29
{
30
BSS_Palette->skyAlpha = 0x100;
31
BSS_Palette->globeAlpha = 0x80;
32
33
foreach_all(BSS_Palette, palette)
34
{
35
if (palette->useStageConfig) {
36
// Used for Randomized modes
37
BSS_Palette->startColorID = 16 * palette->paletteID;
38
}
39
else {
40
// Used for the 32 Bonus Stages
41
RSDK.SetPaletteEntry(1, 0, palette->playfieldA);
42
RSDK.SetPaletteEntry(1, 1, palette->playfieldB);
43
RSDK.SetPaletteEntry(1, 2, palette->bgColor1);
44
RSDK.SetPaletteEntry(1, 3, palette->bgColor2);
45
RSDK.SetPaletteEntry(1, 4, palette->bgColor3);
46
}
47
48
BSS_Palette->skyAlpha = palette->skyAlpha;
49
BSS_Palette->globeAlpha = palette->globeAlpha;
50
}
51
}
52
53
#if GAME_INCLUDE_EDITOR
54
void BSS_Palette_EditorDraw(void)
55
{
56
RSDK_THIS(BSS_Palette);
57
58
RSDK.DrawRect(self->position.x - TO_FIXED(16), self->position.y - TO_FIXED(8), TO_FIXED(16), TO_FIXED(16), self->playfieldA, 0xFF, INK_NONE,
59
false);
60
RSDK.DrawRect(self->position.x + TO_FIXED(0), self->position.y - TO_FIXED(8), TO_FIXED(16), TO_FIXED(16), self->playfieldB, 0xFF, INK_NONE,
61
false);
62
63
RSDK.DrawRect(self->position.x - TO_FIXED(18), self->position.y + TO_FIXED(12), TO_FIXED(12), TO_FIXED(12), self->bgColor1, 0xFF, INK_NONE,
64
false);
65
RSDK.DrawRect(self->position.x - TO_FIXED(6), self->position.y + TO_FIXED(12), TO_FIXED(12), TO_FIXED(12), self->bgColor2, 0xFF, INK_NONE, false);
66
RSDK.DrawRect(self->position.x + TO_FIXED(6), self->position.y + TO_FIXED(12), TO_FIXED(12), TO_FIXED(12), self->bgColor3, 0xFF, INK_NONE, false);
67
}
68
69
void BSS_Palette_EditorLoad(void) {}
70
#endif
71
72
void BSS_Palette_Serialize(void)
73
{
74
RSDK_EDITABLE_VAR(BSS_Palette, VAR_BOOL, useStageConfig);
75
RSDK_EDITABLE_VAR(BSS_Palette, VAR_ENUM, paletteID);
76
RSDK_EDITABLE_VAR(BSS_Palette, VAR_UINT8, skyAlpha);
77
RSDK_EDITABLE_VAR(BSS_Palette, VAR_UINT8, globeAlpha);
78
RSDK_EDITABLE_VAR(BSS_Palette, VAR_COLOR, playfieldA);
79
RSDK_EDITABLE_VAR(BSS_Palette, VAR_COLOR, playfieldB);
80
RSDK_EDITABLE_VAR(BSS_Palette, VAR_COLOR, bgColor1);
81
RSDK_EDITABLE_VAR(BSS_Palette, VAR_COLOR, bgColor2);
82
RSDK_EDITABLE_VAR(BSS_Palette, VAR_COLOR, bgColor3);
83
}
84
85