From 91ce3617ef995560b92c943190c6410258f28642 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 18 Feb 2019 14:00:36 +0100 Subject: [PATCH] Fix respawning in reverse gravity --- src/d_player.h | 1 + src/g_game.c | 3 +++ src/p_inter.c | 1 + src/p_mobj.c | 13 ++++++++++--- src/p_spec.c | 3 ++- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index b430f20a..73279ef0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -275,6 +275,7 @@ typedef enum k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd") k_waypoint, // Waypoints. 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_dropdash, // Charge up for respawn Drop Dash diff --git a/src/g_game.c b/src/g_game.c index f0d221ff..02682b27 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2371,6 +2371,7 @@ void G_PlayerReborn(INT32 player) INT32 bumper; INT32 comebackpoints; INT32 wanted; + INT32 respawnflip; boolean songcredit = false; score = players[player].score; @@ -2411,6 +2412,7 @@ void G_PlayerReborn(INT32 player) starposty = players[player].starposty; starpostz = players[player].starpostz; starpostnum = players[player].starpostnum; + respawnflip = players[player].kartstuff[k_starpostflip]; //SRB2KART starpostangle = players[player].starpostangle; jumpfactor = players[player].jumpfactor; thokitem = players[player].thokitem; @@ -2530,6 +2532,7 @@ void G_PlayerReborn(INT32 player) p->kartstuff[k_comebacktimer] = comebacktime; p->kartstuff[k_wanted] = wanted; p->kartstuff[k_eggmanblame] = -1; + p->kartstuff[k_starpostflip] = respawnflip; // Don't do anything immediately p->pflags |= PF_USEDOWN; diff --git a/src/p_inter.c b/src/p_inter.c index dd27858f..adb7e863 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1468,6 +1468,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->starpostz = special->z>>FRACBITS; player->starpostangle = special->angle; player->starpostnum = special->health; + player->kartstuff[k_starpostflip] = special->spawnpoint->options & MTF_OBJECTFLIP; // store flipping //S_StartSound(toucher, special->info->painsound); return; diff --git a/src/p_mobj.c b/src/p_mobj.c index 8626e2df..0f5f5de3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11137,7 +11137,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); if (p->kartstuff[k_respawn]) - z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; + z -= 128*mapobjectscale; } else { @@ -11145,7 +11145,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); 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! @@ -11206,7 +11206,14 @@ void P_MovePlayerToStarpost(INT32 playernum) #endif sector->ceilingheight; - z = (p->starpostz + 128) << FRACBITS; // Respawn off the ground + if (mobj->player->kartstuff[k_starpostflip]) + z = (p->starpostz<height; + else + z = (p->starpostz<starpostz + 128) << FRACBITS; // reverse gravity exists, pls + mobj->player->kartstuff[k_starpostflip] = 0; + if (z < floor) z = floor; else if (z > ceiling - mobjinfo[MT_PLAYER].height) diff --git a/src/p_spec.c b/src/p_spec.c index 24f56c43..2088d857 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4247,13 +4247,14 @@ DoneSection2: player->starpostx = player->mo->x>>FRACBITS; player->starposty = player->mo->y>>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... } else { // SRB2kart 200117 // 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))