Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Global/Explosion.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: Explosion Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectExplosion *Explosion;
11
12
void Explosion_Update(void)
13
{
14
RSDK_THIS(Explosion);
15
16
RSDK.ProcessAnimation(&self->animator);
17
18
self->position.x += self->velocity.x;
19
self->position.y += self->velocity.y;
20
21
if (self->animator.frameID == self->animator.frameCount - 1)
22
destroyEntity(self);
23
}
24
25
void Explosion_LateUpdate(void) {}
26
27
void Explosion_StaticUpdate(void) {}
28
29
void Explosion_Draw(void)
30
{
31
RSDK_THIS(Explosion);
32
33
RSDK.DrawSprite(&self->animator, NULL, false);
34
}
35
36
void Explosion_Create(void *data)
37
{
38
RSDK_THIS(Explosion);
39
40
self->active = ACTIVE_NORMAL;
41
self->visible = true;
42
if (self->planeFilter > 0 && ((uint8)self->planeFilter - 1) & 2)
43
self->drawGroup = Zone->objectDrawGroup[1];
44
else
45
self->drawGroup = Zone->objectDrawGroup[0];
46
47
RSDK.SetSpriteAnimation(Explosion->aniFrames, VOID_TO_INT(data), &self->animator, true, 0);
48
}
49
50
void Explosion_StageLoad(void)
51
{
52
Explosion->aniFrames = RSDK.LoadSpriteAnimation("Global/Explosions.bin", SCOPE_STAGE);
53
54
Explosion->sfxDestroy = RSDK.GetSfx("Global/Destroy.wav");
55
}
56
57
#if GAME_INCLUDE_EDITOR
58
void Explosion_EditorDraw(void)
59
{
60
RSDK_THIS(Explosion);
61
RSDK.SetSpriteAnimation(Explosion->aniFrames, EXPLOSION_ENEMY, &self->animator, true, 2);
62
63
Explosion_Draw();
64
}
65
66
void Explosion_EditorLoad(void) { Explosion->aniFrames = RSDK.LoadSpriteAnimation("Global/Explosions.bin", SCOPE_STAGE); }
67
#endif
68
69
void Explosion_Serialize(void) {}
70
71