Skip to content

Commit c7db083

Browse files
author
Niko
committed
move sps lower to collision function
1 parent 326e84a commit c7db083

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

decompile/General/Vehicle/VehBirth_0_TeleportSelf.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnPosY)
44
{
5-
char boolSpawnAtBossDoor;
6-
char numInstances;
7-
short *warppadRot=0;
85
short posTop[3];
96
short posBottom[3];
107
short warppadPos[3];
11-
u_int gameMode2;
128

139
struct PosRot
1410
{
@@ -28,7 +24,6 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
2824
#endif
2925

3026
// cheat flags
31-
gameMode2 = gGT->gameMode2;
3227
gGT->gameMode2 &= ~(SPAWN_AT_BOSS | 2);
3328

3429
#if 0
@@ -39,17 +34,6 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
3934
}
4035
#endif
4136

42-
// ground and wall quadblock flags
43-
sps->Union.QuadBlockColl.qbFlagsWanted = 0x3000;
44-
45-
sps->Union.QuadBlockColl.qbFlagsIgnored = 0;
46-
47-
// collision triangles, 2 (low-LOD) & 8 (hi-LOD)
48-
sps->Union.QuadBlockColl.searchFlags =
49-
(gGT->numPlyrCurrGame > 3) ? 2 : 0;
50-
51-
sps->ptr_mesh_info = level1->ptr_mesh_info;
52-
5337
gGT->gameMode2 &= ~(VEH_FREEZE_DOOR);
5438

5539
struct PosRot* posRot;
@@ -93,7 +77,7 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
9377
// After leaving a boss race
9478
(
9579
// Set in 222 EndRace function
96-
((gameMode2 & SPAWN_AT_BOSS) != 0)
80+
((gGT->gameMode2 & SPAWN_AT_BOSS) != 0)
9781
) ||
9882

9983
// Before starting a boss cutscene
@@ -112,7 +96,7 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
11296
rotDeltaY = 0x400;
11397

11498
// if just beat boss
115-
if ((gameMode2 & SPAWN_AT_BOSS) != 0)
99+
if ((gGT->gameMode2 & SPAWN_AT_BOSS) != 0)
116100
{
117101
// just finished pinstripe boss,
118102
if (gGT->prevLEV == HOT_AIR_SKYWAY)
@@ -162,7 +146,8 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
162146
{
163147
// get position where driver should spawn on map,
164148
// outside warppad they previously entered
165-
warppadRot = DECOMP_AH_WarpPad_GetSpawnPosRot(&warppadPos);
149+
short* warppadRot =
150+
DECOMP_AH_WarpPad_GetSpawnPosRot(&warppadPos);
166151

167152
posRot = warppadPos;
168153
rotArr = warppadRot;
@@ -234,6 +219,14 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
234219

235220
#else
236221

222+
// search for ground and wall flags,
223+
// exclude no flags (take 'any' ground/wall)
224+
// collision triangles, 2 (low-LOD), 8 (hi-LOD)
225+
sps->Union.QuadBlockColl.qbFlagsWanted = 0x3000;
226+
sps->Union.QuadBlockColl.qbFlagsIgnored = 0;
227+
sps->Union.QuadBlockColl.searchFlags = (gGT->numPlyrCurrGame > 3) ? 2 : 0;
228+
sps->ptr_mesh_info = level1->ptr_mesh_info;
229+
237230
COLL_SearchTree_FindQuadblock_Touching(&posTop[0], &posBottom[0], sps, 0);
238231

239232
// if collision was not found
@@ -370,7 +363,9 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP
370363
d->numHeldItems = 0;
371364
d->PickupLetterHUD.numCollected = 0;
372365

373-
char weaponId = 0xf; // no item
366+
// no item
367+
char weaponId = 0xf;
368+
u_int gameMode2 = gGT->gameMode2;
374369
if ((gameMode2 & CHEAT_MASK) != 0) weaponId = 7;
375370
if ((gameMode2 & CHEAT_TURBO) != 0) weaponId = 0;
376371
if ((gameMode2 & CHEAT_BOMBS) != 0) weaponId = 1;

0 commit comments

Comments
 (0)