Fix respawning in reverse gravity

This commit is contained in:
Latapostrophe 2019-02-18 14:00:36 +01:00
parent b9264821a2
commit 91ce3617ef
5 changed files with 17 additions and 4 deletions

View file

@ -275,6 +275,7 @@ typedef enum
k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd") k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd")
k_waypoint, // Waypoints. k_waypoint, // Waypoints.
k_starpostwp, // Temporarily stores player waypoint for... some reason. Used when respawning and finishing. k_starpostwp, // Temporarily stores player waypoint for... some reason. Used when respawning and finishing.
k_starpostflip, // the last starpost we hit requires flipping?
k_respawn, // Timer for the DEZ laser respawn effect k_respawn, // Timer for the DEZ laser respawn effect
k_dropdash, // Charge up for respawn Drop Dash k_dropdash, // Charge up for respawn Drop Dash

View file

@ -2371,6 +2371,7 @@ void G_PlayerReborn(INT32 player)
INT32 bumper; INT32 bumper;
INT32 comebackpoints; INT32 comebackpoints;
INT32 wanted; INT32 wanted;
INT32 respawnflip;
boolean songcredit = false; boolean songcredit = false;
score = players[player].score; score = players[player].score;
@ -2411,6 +2412,7 @@ void G_PlayerReborn(INT32 player)
starposty = players[player].starposty; starposty = players[player].starposty;
starpostz = players[player].starpostz; starpostz = players[player].starpostz;
starpostnum = players[player].starpostnum; starpostnum = players[player].starpostnum;
respawnflip = players[player].kartstuff[k_starpostflip]; //SRB2KART
starpostangle = players[player].starpostangle; starpostangle = players[player].starpostangle;
jumpfactor = players[player].jumpfactor; jumpfactor = players[player].jumpfactor;
thokitem = players[player].thokitem; thokitem = players[player].thokitem;
@ -2530,6 +2532,7 @@ void G_PlayerReborn(INT32 player)
p->kartstuff[k_comebacktimer] = comebacktime; p->kartstuff[k_comebacktimer] = comebacktime;
p->kartstuff[k_wanted] = wanted; p->kartstuff[k_wanted] = wanted;
p->kartstuff[k_eggmanblame] = -1; p->kartstuff[k_eggmanblame] = -1;
p->kartstuff[k_starpostflip] = respawnflip;
// Don't do anything immediately // Don't do anything immediately
p->pflags |= PF_USEDOWN; p->pflags |= PF_USEDOWN;

View file

@ -1468,6 +1468,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->starpostz = special->z>>FRACBITS; player->starpostz = special->z>>FRACBITS;
player->starpostangle = special->angle; player->starpostangle = special->angle;
player->starpostnum = special->health; player->starpostnum = special->health;
player->kartstuff[k_starpostflip] = special->spawnpoint->options & MTF_OBJECTFLIP; // store flipping
//S_StartSound(toucher, special->info->painsound); //S_StartSound(toucher, special->info->painsound);
return; return;

View file

@ -11137,7 +11137,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
if (mthing->options >> ZSHIFT) if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS); z -= ((mthing->options >> ZSHIFT) << FRACBITS);
if (p->kartstuff[k_respawn]) if (p->kartstuff[k_respawn])
z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; z -= 128*mapobjectscale;
} }
else else
{ {
@ -11145,7 +11145,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
if (mthing->options >> ZSHIFT) if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS); z += ((mthing->options >> ZSHIFT) << FRACBITS);
if (p->kartstuff[k_respawn]) if (p->kartstuff[k_respawn])
z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; z += 128*mapobjectscale;
} }
if (mthing->options & MTF_OBJECTFLIP) // flip the player! if (mthing->options & MTF_OBJECTFLIP) // flip the player!
@ -11206,7 +11206,14 @@ void P_MovePlayerToStarpost(INT32 playernum)
#endif #endif
sector->ceilingheight; sector->ceilingheight;
z = (p->starpostz + 128) << FRACBITS; // Respawn off the ground if (mobj->player->kartstuff[k_starpostflip])
z = (p->starpostz<<FRACBITS) - FixedMul(128<<FRACBITS, mapobjectscale) - mobj->height;
else
z = (p->starpostz<<FRACBITS) + FixedMul(128<<FRACBITS, mapobjectscale);
//z = (p->starpostz + 128) << FRACBITS; // reverse gravity exists, pls
mobj->player->kartstuff[k_starpostflip] = 0;
if (z < floor) if (z < floor)
z = floor; z = floor;
else if (z > ceiling - mobjinfo[MT_PLAYER].height) else if (z > ceiling - mobjinfo[MT_PLAYER].height)

View file

@ -4247,13 +4247,14 @@ DoneSection2:
player->starpostx = player->mo->x>>FRACBITS; player->starpostx = player->mo->x>>FRACBITS;
player->starposty = player->mo->y>>FRACBITS; player->starposty = player->mo->y>>FRACBITS;
player->starpostz = player->mo->floorz>>FRACBITS; player->starpostz = player->mo->floorz>>FRACBITS;
player->kartstuff[k_starpostflip] = player->mo->flags2 = MF2_OBJECTFLIP; // store flipping
player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely... player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely...
} }
else else
{ {
// SRB2kart 200117 // SRB2kart 200117
// Reset starposts (checkpoints) info // Reset starposts (checkpoints) info
player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0; player->starpostangle = player->starpostx = player->starposty = player->starpostz = player->kartstuff[k_starpostflip] = 0;
} }
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))