Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/TMZ/TMZ2Setup.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: TMZ2Setup Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectTMZ2Setup *TMZ2Setup;
11
12
void TMZ2Setup_Update(void) {}
13
14
void TMZ2Setup_LateUpdate(void) {}
15
16
void TMZ2Setup_StaticUpdate(void)
17
{
18
if (!(Zone->timer & 1))
19
RSDK.RotatePalette(0, 204, 207, false);
20
21
if (!(Zone->timer & 7))
22
RSDK.RotatePalette(0, 250, 252, true);
23
24
RSDK.SetLimitedFade(0, 1, 2, (RSDK.Sin256(2 * Zone->timer) >> 1) + 0x80, 192, 197);
25
RSDK.SetLimitedFade(0, 1, 2, (RSDK.Sin256(2 * Zone->timer + 0x80) >> 1) + 0x80, 198, 203);
26
RSDK.SetLimitedFade(4, 1, 2, (RSDK.Sin256(2 * Zone->timer) >> 1) + 0x80, 192, 197);
27
RSDK.SetLimitedFade(4, 1, 2, (RSDK.Sin256(2 * Zone->timer + 0x80) >> 1) + 0x80, 198, 203);
28
29
if (TMZ2Setup->palDuration <= 0) {
30
TMZ2Setup->palTimer += 32;
31
TMZ2Setup->palTimer = TMZ2Setup->palTimer & 0xFF;
32
33
RSDK.SetLimitedFade(0, 1, 2, (RSDK.Sin256(TMZ2Setup->palTimer) >> 1) + 0x80, 184, 190);
34
35
if (TMZ2Setup->palTimer == 160)
36
TMZ2Setup->palDuration = RSDK.Rand(2, 60);
37
}
38
else {
39
TMZ2Setup->palDuration--;
40
}
41
}
42
43
void TMZ2Setup_Draw(void) {}
44
45
void TMZ2Setup_Create(void *data) {}
46
47
void TMZ2Setup_StageLoad(void)
48
{
49
TMZ2Setup->aniTiles = RSDK.LoadSpriteSheet("TMZ1/AniTiles.gif", SCOPE_STAGE);
50
TMZ2Setup->dynTiles = RSDK.LoadSpriteSheet("TMZ1/DynTiles.gif", SCOPE_STAGE);
51
52
TMZ2Setup->palDuration = RSDK.Rand(2, 60);
53
TMZ2Setup->palTimer = 192;
54
55
if (!TMZ2Setup->paletteInit) {
56
#if MANIA_USE_PLUS
57
if ((SceneInfo->filter & FILTER_ENCORE))
58
RSDK.LoadPalette(0, "EncoreTMZ2.act", 0b0000000011111111);
59
#endif
60
61
for (int32 i = 0; i < 256; ++i) RSDK.SetPaletteEntry(5, i, 0);
62
63
RSDK.CopyPalette(0, 128, 4, 128, 128);
64
65
TMZ2Setup->paletteInit = true;
66
}
67
68
Animals->animalTypes[0] = ANIMAL_TOCKY;
69
Animals->animalTypes[1] = ANIMAL_PICKY;
70
71
RSDK.SetDrawGroupProperties(0, false, TMZ2Setup_DrawHook_ApplyDynTilesPalette);
72
RSDK.SetDrawGroupProperties(1, false, TMZ2Setup_DrawHook_RemoveDynTilesPalette);
73
74
if (isMainGameMode()) {
75
if (globals->atlEnabled && !CutsceneRules_CheckStageReload()) {
76
Zone_ReloadStoredEntities(480 << 16, 7920 << 16, true);
77
CREATE_ENTITY(TMZ1Outro, NULL, 0, 0);
78
}
79
}
80
}
81
82
void TMZ2Setup_DrawHook_ApplyDynTilesPalette(void) { RSDK.SetActivePalette(4, 0, ScreenInfo->size.y); }
83
void TMZ2Setup_DrawHook_RemoveDynTilesPalette(void) { RSDK.SetActivePalette(0, 0, ScreenInfo->size.y); }
84
85
void TMZ2Setup_DrawDynTiles_Eggman(void)
86
{
87
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 604, 64, 0, 96, 128);
88
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 983, 16, 0, 48, 16);
89
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 986, 0, 16, 64, 96);
90
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 1010, 16, 112, 48, 16);
91
}
92
void TMZ2Setup_DrawDynTiles_Ruby(void)
93
{
94
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 604, 64, 128, 96, 128);
95
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 983, 16, 128, 48, 16);
96
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 986, 0, 144, 64, 96);
97
RSDK.DrawAniTiles(TMZ2Setup->dynTiles, 1010, 16, 240, 48, 16);
98
}
99
100
#if GAME_INCLUDE_EDITOR
101
void TMZ2Setup_EditorDraw(void) {}
102
103
void TMZ2Setup_EditorLoad(void)
104
{
105
RSDK_ACTIVE_VAR(WarpDoor, effect);
106
RSDK_ENUM_VAR("None", WARPDOOR_EFFECT_NONE);
107
RSDK_ENUM_VAR("Ruby Mist", TMZ2_WARPDOOR_EFFECT_MIST);
108
}
109
#endif
110
111
void TMZ2Setup_Serialize(void) {}
112
113