Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/GHZ/BurningLog.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: BurningLog Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectBurningLog *BurningLog;
11
12
void BurningLog_Update(void)
13
{
14
RSDK_THIS(BurningLog);
15
16
RSDK.ProcessAnimation(&self->animator);
17
18
if (RSDK.CheckOnScreen(self, &self->updateRange)) {
19
self->position.y += self->velocity.y;
20
self->velocity.y += 0x3800;
21
foreach_active(Player, player)
22
{
23
if (self->velocity.y < 0x380000)
24
Player_CheckCollisionPlatform(player, self, &BurningLog->hitboxPlatform);
25
26
if (Player_CheckCollisionTouch(player, self, &BurningLog->hitboxFlame)) {
27
Player_ElementHurt(player, self, SHIELD_FIRE);
28
}
29
}
30
}
31
else {
32
destroyEntity(self);
33
}
34
}
35
36
void BurningLog_LateUpdate(void) {}
37
38
void BurningLog_StaticUpdate(void) {}
39
40
void BurningLog_Draw(void)
41
{
42
RSDK_THIS(BurningLog);
43
RSDK.DrawSprite(&self->animator, NULL, false);
44
}
45
46
void BurningLog_Create(void *data)
47
{
48
RSDK_THIS(BurningLog);
49
self->active = ACTIVE_NORMAL;
50
self->visible = true;
51
self->updateRange.x = 0x800000;
52
self->updateRange.y = 0x10000000;
53
self->drawGroup = Zone->objectDrawGroup[0];
54
55
if (data)
56
self->timer = VOID_TO_INT(data);
57
58
RSDK.SetSpriteAnimation(BurningLog->aniFrames, 0, &self->animator, true, 0);
59
}
60
61
void BurningLog_StageLoad(void)
62
{
63
if (RSDK.CheckSceneFolder("GHZ"))
64
BurningLog->aniFrames = RSDK.LoadSpriteAnimation("GHZ/Fireball.bin", SCOPE_STAGE);
65
66
BurningLog->hitboxPlatform.left = -8;
67
BurningLog->hitboxPlatform.top = -8;
68
BurningLog->hitboxPlatform.right = 8;
69
BurningLog->hitboxPlatform.bottom = 8;
70
71
BurningLog->hitboxFlame.left = -8;
72
BurningLog->hitboxFlame.top = -16;
73
BurningLog->hitboxFlame.right = 8;
74
BurningLog->hitboxFlame.bottom = 8;
75
}
76
77
#if GAME_INCLUDE_EDITOR
78
void BurningLog_EditorDraw(void) { BurningLog_Draw(); }
79
80
void BurningLog_EditorLoad(void) { BurningLog->aniFrames = RSDK.LoadSpriteAnimation("GHZ/Fireball.bin", SCOPE_STAGE); }
81
#endif
82
83
void BurningLog_Serialize(void) { RSDK_EDITABLE_VAR(BurningLog, VAR_ENUM, timer); }
84
85