Skip to content

Commit 0de8ca3

Browse files
author
Niko
committed
boss spawn fix
1 parent 2b30a68 commit 0de8ca3

File tree

2 files changed

+41
-56
lines changed

2 files changed

+41
-56
lines changed

decompile/General/222/222_Full.c

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,17 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
7373
// if not in Token mode, these won't be used until later;
7474
lerpStartY = 0;
7575
lerpEndY = 0;
76+
77+
// For trophy race, check 1st place
78+
int boolWin = (driver->driverRank == 0);
7679

77-
// If you're in Adventure Mode
78-
if ((gGT->gameMode1 & ADVENTURE_MODE) != 0)
80+
// If C-T-R token race
81+
if ((gGT->gameMode2 & TOKEN_RACE) != 0)
7982
{
80-
// If you won the race, and you have all 3 letters (C, T, and R)
81-
if ((driver->driverRank == 0) && (driver->PickupLetterHUD.numCollected == 3))
83+
// add requirement of C-T-R letters
84+
boolWin = (boolWin) && (driver->PickupLetterHUD.numCollected == 3);
85+
86+
if (boolWin)
8287
{
8388
// lerp C-T-R letters closer to center by 16 pixels
8489
// default (unlocking and frames < 140) or (already unlocked and frames < 300)
@@ -401,43 +406,38 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
401406
// If you have not pressed X
402407
if ((sdata->AnyPlayerTap & 0x50) == 0)
403408
return;
404-
405-
// clear gamepad input
409+
410+
// === If Pressed X ===
411+
406412
RECTMENU_ClearInput();
413+
414+
sdata->Loading.OnBegin.AddBitsConfig0 |= ADVENTURE_ARENA;
415+
sdata->Loading.OnBegin.RemBitsConfig0 |= (ADVENTURE_BOSS | TOKEN_RACE);
407416

408-
// if event was not won
409-
if (driver->driverRank > 0)
417+
// If you are in boss mode
418+
if (gGT->gameMode1 < 0)
410419
{
411-
// pass pointer to menu buffer that shows Retry / Exit To Map,
412-
// identical to buffer in 221 dll, except this one in EXE space
413-
RECTMENU_Show(&data.menuRetryExit);
420+
sdata->Loading.OnBegin.AddBitsConfig8 |= SPAWN_AT_BOSS;
421+
}
414422

415-
// record that the menu is now showing
423+
if (!boolWin)
424+
{
425+
RECTMENU_Show(&data.menuRetryExit);
416426
sdata->menuReadyToPass |= 1;
417427
return;
418428
}
419429

420-
// If you won the race
421-
// If you have pressed X to continue...
430+
// === If you won the race ===
422431

423432
sdata->framesSinceRaceEnded = 0;
424433
sdata->numIconsEOR = 1;
425434

426-
// when loading is done, add flag for "In Adventure Arena"
427-
sdata->Loading.OnBegin.AddBitsConfig0 |= ADVENTURE_ARENA;
428-
429435
// Load the levelID for Adventure Hub that you came from
430436
levSpawn = gGT->prevLEV;
431437

432438
// If you are in boss mode
433439
if (gGT->gameMode1 < 0)
434440
{
435-
// when loading is done, add flag for "spawn near boss door"
436-
sdata->Loading.OnBegin.AddBitsConfig8 |= SPAWN_AT_BOSS;
437-
438-
// when loading is done, remove flag for Boss Mode
439-
sdata->Loading.OnBegin.RemBitsConfig0 |= ADVENTURE_BOSS;
440-
441441
// bitIndex of keys unlocked, and boss beaten
442442
bitIndex = gGT->bossID + 0x5e;
443443

@@ -478,18 +478,6 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
478478
}
479479
}
480480
}
481-
// if you are in token race
482-
else if ((gGT->gameMode2 & 0x8) != 0)
483-
{
484-
// If you have collected 3 letters (C, T, and R)
485-
if (driver->PickupLetterHUD.numCollected == 3)
486-
{
487-
// set bit to tokens
488-
bitIndex = gGT->levelID + 0x4c;
489-
// when loading is done, remove flag for CTR Challenge
490-
sdata->Loading.OnBegin.RemBitsConfig8 |= TOKEN_RACE;
491-
}
492-
}
493481

494482
// if something needs unlocking
495483
if(bitIndex > 0)

decompile/General/Vehicle/VehBirth_0_TeleportSelf.c

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
2323
struct ScratchpadStruct* sps = (struct ScratchpadStruct*)&scratchpad[0];
2424
#endif
2525

26+
int spawnAtBoss =
27+
gGT->gameMode2 & SPAWN_AT_BOSS;
28+
2629
// cheat flags
2730
gGT->gameMode2 &= ~(SPAWN_AT_BOSS | 2);
2831

@@ -79,10 +82,8 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
7982
// if you want to spawn outside boss door
8083
else if (
8184
// After leaving a boss race
82-
(
83-
// Set in 222 EndRace function
84-
((gGT->gameMode2 & SPAWN_AT_BOSS) != 0)
85-
) ||
85+
(spawnAtBoss)
86+
||
8687

8788
// Before starting a boss cutscene
8889
(
@@ -95,29 +96,25 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
9596
// position outside boss door
9697
posRot = &level1->ptrSpawnType2_PosRot[1].posCoords[6];
9798

98-
// spawn facing boss door
99+
// spawn facing TOWARDS boss door,
100+
// after winning last trophy on hub
99101
rotArr = &posRot->rot[0];
100102
rotDeltaY = 0x400;
101103

102-
// if just beat boss
103-
if ((gGT->gameMode2 & SPAWN_AT_BOSS) != 0)
104+
// After leaving a boss race
105+
if (spawnAtBoss)
104106
{
105-
// just finished pinstripe boss,
106-
if (gGT->prevLEV == HOT_AIR_SKYWAY)
107-
{
108-
// if spawn by pinstripe, dont face wall
109-
if(gGT->levelID == CITADEL_CITY)
110-
rotDeltaY = 0x800;
111-
112-
// else if spawn by oxide,
113-
// do nothing, rotation already faces the door
114-
}
107+
// spawn facing AWAY from door
108+
rotDeltaY = 0xC00;
115109

116-
// if just beat ANY other boss
117-
else
110+
if (
111+
// Pinstripe -> Citadel (not gemstone)
112+
(gGT->prevLEV == HOT_AIR_SKYWAY) &&
113+
(gGT->levelID == CITADEL_CITY)
114+
)
118115
{
119-
// spawn facing AWAY from door
120-
rotDeltaY = 0xC00;
116+
// face to the RIGHT from door
117+
rotDeltaY = 0x800;
121118
}
122119
}
123120
}

0 commit comments

Comments
 (0)