Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/CPZ/CPZ2Outro.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: CPZ2Outro Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectCPZ2Outro *CPZ2Outro;
11
12
void CPZ2Outro_Update(void)
13
{
14
RSDK_THIS(CPZ2Outro);
15
16
if (!self->activated) {
17
CPZ2Outro_SetupCutscene();
18
self->activated = true;
19
}
20
}
21
22
void CPZ2Outro_LateUpdate(void) {}
23
24
void CPZ2Outro_StaticUpdate(void) {}
25
26
void CPZ2Outro_Draw(void) {}
27
28
void CPZ2Outro_Create(void *data)
29
{
30
RSDK_THIS(CPZ2Outro);
31
32
INIT_ENTITY(self);
33
CutsceneRules_SetupEntity(self, &self->size, &self->hitbox);
34
self->active = ACTIVE_NEVER;
35
}
36
37
void CPZ2Outro_StageLoad(void)
38
{
39
CPZ2Outro->eggPrison = NULL;
40
foreach_all(EggPrison, prison)
41
{
42
CPZ2Outro->eggPrison = prison;
43
foreach_break;
44
}
45
}
46
47
void CPZ2Outro_SetupCutscene(void)
48
{
49
RSDK_THIS(CPZ2Outro);
50
51
CutsceneSeq_StartSequence(self, CPZ2Outro_Cutscene_Outro, StateMachine_None);
52
53
#if MANIA_USE_PLUS
54
CutsceneSeq_SetSkipType(SKIPTYPE_RELOADSCN);
55
#endif
56
57
HUD_MoveOut();
58
}
59
60
bool32 CPZ2Outro_Cutscene_Outro(EntityCutsceneSeq *host)
61
{
62
MANIA_GET_PLAYER(player1, player2, camera);
63
UNUSED(camera);
64
65
Vector2 size;
66
RSDK.GetLayerSize(Zone->fgLayer[0], &size, true);
67
68
if (!host->timer) {
69
CPZ2Outro->eggPrison->notSolid = true;
70
Zone->cameraBoundsT[0] = 0;
71
Zone->cameraBoundsT[1] = 0;
72
Zone->cameraBoundsR[0] = size.x;
73
Zone->cameraBoundsR[1] = size.x;
74
Zone->playerBoundActiveR[0] = 0;
75
Zone->playerBoundActiveR[1] = 0;
76
CutsceneSeq_LockAllPlayerControl();
77
player1->stateInput = StateMachine_None;
78
player1->state = Player_State_Ground;
79
player1->groundVel = 0;
80
player1->right = true;
81
82
if (player2->classID == Player->classID) {
83
player2->state = Player_State_Ground;
84
player2->stateInput = Player_Input_P2_AI;
85
player2->groundVel = 0;
86
}
87
}
88
89
if (player1->jumpPress)
90
player1->jumpPress = false;
91
92
if (player1->onGround && player1->position.x >= host->activeEntity->position.x && !host->values[0]) {
93
player1->jumpPress = true;
94
host->values[0] = true;
95
}
96
97
if (player1->position.x > size.x << 16) {
98
Zone_StartFadeOut(10, 0x000000);
99
return true;
100
}
101
return false;
102
}
103
104
#if GAME_INCLUDE_EDITOR
105
void CPZ2Outro_EditorDraw(void)
106
{
107
RSDK_THIS(CPZ2Outro);
108
CutsceneRules_DrawCutsceneBounds(self, &self->size);
109
}
110
111
void CPZ2Outro_EditorLoad(void) {}
112
#endif
113
114
void CPZ2Outro_Serialize(void) { RSDK_EDITABLE_VAR(CPZ2Outro, VAR_VECTOR2, size); }
115
116