summaryrefslogtreecommitdiff
path: root/src/mods/bosskiller.c
blob: 58762d23e50fe6e3b9bcc1d72e4d81051857f59f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#include "global.h"

extern void SectorY_80198F5C(SyShogun* this);

/* Prevent execution before gameplay */
bool PreventExecution(void) {
    if ((gGameState != GSTATE_PLAY) || (gPlayState <= PLAY_INIT)) {
        // Not in gameplay, execution should be prevented to avoid crashes.
        return true;
    } else {
        // In gameplay, fine to proceed.
        return false;
    }
}

void KillBoss(void) {
    static int bossMercyTimer = 0;
    static int eventState = 0;

    Actor* actor = &gActors[0];
    Player* player = &gPlayer[0];
    Boss* boss = &gBosses[0];

    u16 killButton = L_TRIG;
    s32 i;

    if (PreventExecution())
        return;

    RCP_SetupDL(&gMasterDisp, SETUPDL_83);
    gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
    Graphics_DisplaySmallNumber(20, 220, bossMercyTimer);

    // gRingPassCount = 7; // for LEVEL_CORNERIA
    player->mercyTimer = 1000;
    gLaserStrength[0] = 2;

    if (gControllerPress[0].button & U_JPAD) {
        // player->state_1C8 = PLAYERSTATE_1C8_START_360;
        player->baseSpeed += 50;
    }
    if (gControllerPress[0].button & D_JPAD) {
        player->baseSpeed -= 50;
    }

    if (bossMercyTimer != 0) {
        bossMercyTimer--;
    }

    if (gControllerPress[0].button & START_BUTTON)
        bossMercyTimer = 0;

    if (gControllerPress[0].button & killButton) {
        switch (gCurrentLevel) {
            case LEVEL_CORNERIA:
                if (boss[0].obj.status != OBJ_ACTIVE)
                    break;

                // Granga
                if (gLevelMode == LEVELMODE_ALL_RANGE) {
                    boss[0].dmgType = DMG_BEAM;
                    boss[0].dmgPart == 0;
                    boss[0].swork[29] = -1;
                    gShowBossHealth = false;
                }

                // Carrier
                if (gLevelMode == LEVELMODE_ON_RAILS) {
                    boss[0].dmgType = DMG_BEAM;
                    boss[1].dmgType = DMG_BEAM;
                    boss[2].dmgType = DMG_BEAM;
                    boss[3].dmgType = DMG_BEAM;
                    boss[0].health = 0;
                    boss[1].health = 0;
                    boss[2].health = 0;
                    boss[3].health = 0;
                    boss[0].state = 7;
                    boss[1].state = 1;
                    boss[2].state = 1;
                    boss[3].state = 1;
                    gShowBossHealth = false;
                }
                break;

            case LEVEL_METEO:
                boss[0].dmgType = DMG_BEAM;
                boss[0].dmgPart = 5;
                boss[0].dmgPart = 7;
                boss[0].swork[7] = 0;
                boss[0].swork[8] = 0;
                boss[0].health = 0;
                boss[0].state = 9;
                break;

            case LEVEL_SECTOR_X:
                if (boss[0].obj.status != OBJ_ACTIVE)
                    break;

                // Spyborg's fake death
                if ((eventState == 0) && (bossMercyTimer == 0)) {
                    boss[0].dmgType = DMG_BEAM;
                    boss[0].dmgPart = 0;
                    boss[0].swork[0] = 1;
                    boss[0].swork[3] = 0;
                    eventState++;
                    bossMercyTimer = (60 * 2) / gVIsPerFrame;
                    break;
                }

                // Spyborg's actual death
                if ((eventState == 1) && (bossMercyTimer == 0)) {
                    boss[0].dmgType = DMG_BEAM;
                    boss[0].dmgPart = 0;
                    boss[0].swork[0] = 2;
                    boss[0].health = 0;
                    eventState = 0;
                    bossMercyTimer = (1700 * 2) / gVIsPerFrame;
                    break;
                }
                break;

            case LEVEL_SECTOR_Y:
                if (bossMercyTimer != 0) {
                    break;
                }

                if (boss[1].obj.status == OBJ_ACTIVE) {
                    bossMercyTimer = (100 * 2) / gVIsPerFrame;
                    boss[1].dmgType = DMG_BEAM;
                    boss[1].swork[25] = 1;
                    boss[1].health = 0;
                    SectorY_80198F5C(&boss[1]);
                } else if (boss[2].obj.status == OBJ_ACTIVE) {
                    bossMercyTimer = (350 * 2) / gVIsPerFrame;
                    boss[2].dmgType = DMG_BEAM;
                    boss[1].swork[25] = 1;
                    boss[2].health = 0;
                    SectorY_80198F5C(&boss[2]);
                } else if (boss[0].obj.status == OBJ_ACTIVE) {
                    bossMercyTimer = (350 * 2) / gVIsPerFrame;
                    boss[0].dmgType = DMG_BEAM;
                    boss[1].swork[25] = 1;
                    boss[0].health = 0;
                    SectorY_80198F5C(&boss[0]);
                }
                break;

            case LEVEL_SECTOR_Z:

                break;

            case LEVEL_AQUAS:

                break;

            case LEVEL_AREA_6:

                break;

            case LEVEL_BOLSE:

                break;

            case LEVEL_FORTUNA:
                // Call Starwolf
                if ((eventState == 0) && (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (bossMercyTimer == 0)) {
                    gAllRangeSpawnEvent = gAllRangeEventTimer + 2;
                    for (i = 0; i < 6; i++) {
                        gSavedStarWolfTeamAlive[i] = true;
                        gStarWolfTeamAlive[i] = true;
                    }
                    bossMercyTimer = (500 * 2) / gVIsPerFrame;
                    eventState++;
                    break;
                }

#if 0
                // Good Ending
                if ((eventState != 0) && (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (bossMercyTimer == 0)) {
                    eventState = 0;
                    gAllRangeEventTimer = (10090 * 2) / gVIsPerFrame;
                    for (i = 0; i < 4; i++) {
                        gStarWolfTeamAlive[i] = 0;
                    }
                    bossMercyTimer = (1700 * 2) / gVIsPerFrame;
                    break;
                }
#else
                // Bad Ending
                if ((eventState != 0) && (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (bossMercyTimer == 0)) {
                    eventState = 0;
                    gAllRangeCountdownScale = 1.0f;
                    gShowAllRangeCountdown = 1;
                    gAllRangeCountdown[0] = 1;
                    gAllRangeCountdown[1] = 4;
                    gAllRangeCountdown[2] = 99;
                    gAllRangeEventTimer = 9200;
                    bossMercyTimer = (3000 * 2) / gVIsPerFrame;
                }
#endif
                break;

            case LEVEL_KATINA:
                // Press the killButton to call the Saucerer
                if (gAllRangeEventTimer < ((3830 * 2) / gVIsPerFrame)) {
                    gAllRangeEventTimer = (3830 * 2) / gVIsPerFrame;
                }

                // Press the killButton to get the Saucerer in position
                if (boss[1].state == 1) {
                    boss[1].obj.pos.z = 4499;
                }

                // Boss in position
                if (boss[1].state >= 6) {
#if 0
                    // Good ending
                    boss[1].state = 20;
                    boss[1].timer_050 = 10;
#else
                    // bad ending
                    boss[1].state = 12;
                    boss[1].timer_050 = 10;
#endif
                }
                break;

            case LEVEL_MACBETH:

                break;

            case LEVEL_SOLAR:

                break;
        }
    }
}