Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/UFO/UFO_Plasma.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: UFO_Plasma Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectUFO_Plasma *UFO_Plasma;
11
12
void UFO_Plasma_Update(void) {}
13
14
void UFO_Plasma_LateUpdate(void) {}
15
16
void UFO_Plasma_StaticUpdate(void) {}
17
18
void UFO_Plasma_Draw(void)
19
{
20
int32 y = (UFO_Setup->timer + 2 * ScreenInfo->position.y) << 14;
21
uint8 scanlineID = ((ScreenInfo->position.y >> 1) + 2 * UFO_Setup->timer);
22
23
ScanlineInfo *scanline = UFO_Plasma->scanlines;
24
for (int32 i = 0; i < ScreenInfo->size.y; ++i) {
25
scanline->position.x = TO_FIXED(ScreenInfo->position.x) + UFO_Plasma->scanlineList[scanlineID].position.x;
26
scanline->position.y = y;
27
scanline->deform.x = UFO_Plasma->scanlineList[scanlineID].deform.x;
28
scanline->deform.y = 0;
29
30
y += UFO_Plasma->scanlineList[(scanlineID + 1) & 0xFF].deform.y;
31
scanline++;
32
scanlineID++;
33
}
34
35
RSDK.DrawDeformedSprite(UFO_Plasma->aniFrames, INK_MASKED, 0x100);
36
RSDK.SetClipBounds(0, 0, 0, ScreenInfo->size.x, ScreenInfo->size.y);
37
RSDK.SetActivePalette(0, 0, ScreenInfo->size.y);
38
}
39
40
void UFO_Plasma_Create(void *data)
41
{
42
RSDK_THIS(UFO_Plasma);
43
44
if (!SceneInfo->inEditor) {
45
self->active = ACTIVE_NORMAL;
46
self->visible = true;
47
self->drawGroup = 3;
48
}
49
}
50
51
void UFO_Plasma_StageLoad(void)
52
{
53
UFO_Plasma->aniFrames = RSDK.LoadSpriteSheet("SpecialUFO/Plasma.gif", SCOPE_STAGE);
54
UFO_Plasma->scanlines = RSDK.GetScanlines();
55
56
int32 angle = 0;
57
ScanlineInfo *scanline = (ScanlineInfo *)UFO_Plasma->scanlineList;
58
for (int32 i = 0; i < 0x100; ++i) {
59
scanline[i].deform.x = (RSDK.Sin256(angle >> 1) << 6) + 0x10000;
60
scanline[i].deform.y = (RSDK.Sin256(angle >> 1) << 5) + 0x10000;
61
scanline[i].position.x = (RSDK.Sin256(angle) << 10) - scanline[i].deform.x * ScreenInfo->center.x;
62
scanline[i].position.y = 0;
63
64
angle += 2;
65
}
66
67
for (int32 b = 0; b < 8; ++b) RSDK.SetPaletteEntry(b, 0xDB, 0x00F000);
68
69
RSDK.SetPaletteMask(0x00F000);
70
RSDK.ResetEntitySlot(SLOT_UFO_PLASMA, UFO_Plasma->classID, NULL);
71
RSDK.SetDrawGroupProperties(3, false, StateMachine_None);
72
}
73
74
#if GAME_INCLUDE_EDITOR
75
void UFO_Plasma_EditorDraw(void) {}
76
77
void UFO_Plasma_EditorLoad(void) {}
78
#endif
79
80
void UFO_Plasma_Serialize(void) {}
81
82