From 3332c22801e85c1c4400ad7a7b90f77f3c31ae63 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 5 Aug 2020 05:06:02 -0700 Subject: [PATCH 1/2] Fault again if you spectate then respawn during a fault --- src/d_player.h | 2 +- src/dehacked.c | 2 +- src/g_game.c | 11 +++-------- src/k_respawn.c | 7 +++++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index b9c44ed0e..d51f23601 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -57,7 +57,7 @@ typedef enum typedef enum { // Flip camera angle with gravity flip prefrence. - PF_FLIPCAM = 1, + PF_FAULT = 1, // Cheats PF_GODMODE = 1<<1, diff --git a/src/dehacked.c b/src/dehacked.c index 0443d7ef3..7a97920cd 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8513,7 +8513,7 @@ static const char *const MAPTHINGFLAG_LIST[4] = { static const char *const PLAYERFLAG_LIST[] = { // Flip camera angle with gravity flip prefrence. - "FLIPCAM", + "FAULT", // Cheats "GODMODE", diff --git a/src/g_game.c b/src/g_game.c index 4f52cf317..1dcb8c7cb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2599,7 +2599,7 @@ void G_PlayerReborn(INT32 player) jointime = players[player].jointime; splitscreenindex = players[player].splitscreenindex; spectator = players[player].spectator; - pflags = (players[player].pflags & (PF_TIMEOVER|PF_TAGIT|PF_TAGGED|PF_WANTSTOJOIN)); + pflags = (players[player].pflags & (PF_TIMEOVER|PF_TAGIT|PF_TAGGED|PF_WANTSTOJOIN|PF_FAULT)); // As long as we're not in multiplayer, carry over cheatcodes from map to map if (!(netgame || multiplayer)) @@ -2771,11 +2771,6 @@ void G_PlayerReborn(INT32 player) if (songcredit) S_ShowMusicCredit(); - if (leveltime > (starttime + (TICRATE/2)) && !p->spectator) - { - K_DoIngameRespawn(p); - } - if (gametype == GT_COOP) P_FindEmerald(); // scan for emeralds to hunt for @@ -2874,7 +2869,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) P_SpawnPlayer(playernum); - if (starpost) //Don't even bother with looking for a place to spawn. + if (starpost || ( players[playernum].pflags & PF_FAULT )) //Don't even bother with looking for a place to spawn. { P_MovePlayerToStarpost(playernum); #ifdef HAVE_BLUA @@ -4625,7 +4620,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool memset(&players[i].respawn, 0, sizeof (players[i].respawn)); // The latter two should clear by themselves, but just in case - players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS); + players[i].pflags &= ~(PF_FAULT|PF_TAGIT|PF_TAGGED|PF_FULLSTASIS); // Clear cheatcodes too, just in case. players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS); diff --git a/src/k_respawn.c b/src/k_respawn.c index be55e2389..fc2093c83 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -97,7 +97,8 @@ void K_DoIngameRespawn(player_t *player) return; } - if (player->respawn.state != RESPAWNST_NONE) + if (player->respawn.state != RESPAWNST_NONE && + ( player->pflags & PF_FAULT ) == 0) { return; } @@ -110,7 +111,7 @@ void K_DoIngameRespawn(player_t *player) if (leveltime < starttime) // FAULT { player->powers[pw_nocontrol] = (starttime - leveltime) + 50; - player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse + player->pflags |= PF_SKIDDOWN|PF_FAULT; // cheeky pflag reuse S_StartSound(player->mo, sfx_s3k83); player->karthud[khud_fault] = 1; } @@ -192,6 +193,8 @@ void K_DoIngameRespawn(player_t *player) player->respawn.pointx = beststart->x << FRACBITS; player->respawn.pointy = beststart->y << FRACBITS; + player->mo->angle = ( beststart->angle * ANG1 ); + s = R_PointInSubsector(beststart->x << FRACBITS, beststart->y << FRACBITS)->sector; player->respawn.flip = (beststart->options & MTF_OBJECTFLIP); From 11a4ca28d79dc3e63c1ef90beaee8c6f930a3889 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 6 Aug 2020 17:59:09 -0700 Subject: [PATCH 2/2] Remove PF_SKIDDOWN, just use PF_FAULT --- src/d_player.h | 3 ++- src/dehacked.c | 3 ++- src/k_kart.c | 4 ++-- src/k_respawn.c | 2 +- src/p_user.c | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index d51f23601..3d17350c2 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -113,7 +113,8 @@ typedef enum // Spill rings after falling PF_NIGHTSFALL = 1<<24, PF_DRILLING = 1<<25, - PF_SKIDDOWN = 1<<26, + + // free: 1<<26 /*** TAG STUFF ***/ PF_TAGGED = 1<<27, // Player has been tagged and awaits the next round in hide and seek. diff --git a/src/dehacked.c b/src/dehacked.c index 7a97920cd..ffe234c51 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8569,7 +8569,8 @@ static const char *const PLAYERFLAG_LIST[] = { // Spill rings after falling "NIGHTSFALL", "DRILLING", - "SKIDDOWN", + + "\x01", // free: 1<<26 (name un-matchable) /*** TAG STUFF ***/ "TAGGED", // Player has been tagged and awaits the next round in hide and seek. diff --git a/src/k_kart.c b/src/k_kart.c index eac90b665..493ffc035 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3605,7 +3605,7 @@ void K_DriftDustHandling(mobj_t *spawner) if (spawner->player) { - if (spawner->player->pflags & PF_SKIDDOWN) + if (spawner->player->pflags & PF_FAULT) { anglediff = abs((signed)(spawner->angle - spawner->player->frameangle)); if (leveltime % 6 == 0) @@ -5316,7 +5316,7 @@ void K_KartPlayerHUDUpdate(player_t *player) if (player->karthud[khud_tauntvoices]) player->karthud[khud_tauntvoices]--; - if (!(player->pflags & PF_SKIDDOWN)) + if (!(player->pflags & PF_FAULT)) player->karthud[khud_fault] = 0; else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] < 2*TICRATE) player->karthud[khud_fault]++; diff --git a/src/k_respawn.c b/src/k_respawn.c index fc2093c83..a6543d425 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -111,7 +111,7 @@ void K_DoIngameRespawn(player_t *player) if (leveltime < starttime) // FAULT { player->powers[pw_nocontrol] = (starttime - leveltime) + 50; - player->pflags |= PF_SKIDDOWN|PF_FAULT; // cheeky pflag reuse + player->pflags |= PF_FAULT; S_StartSound(player->mo, sfx_s3k83); player->karthud[khud_fault] = 1; } diff --git a/src/p_user.c b/src/p_user.c index 8d6014926..b7f12fb53 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5859,7 +5859,7 @@ static void P_MovePlayer(player_t *player) else player->frameangle -= (ANGLE_11hh * speed); } - else if (player->powers[pw_nocontrol] && player->pflags & PF_SKIDDOWN) + else if (player->powers[pw_nocontrol] && player->pflags & PF_FAULT) { if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); @@ -9047,7 +9047,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_nocontrol] & ((1<<15)-1) && player->powers[pw_nocontrol] < UINT16_MAX) { if (!(--player->powers[pw_nocontrol])) - player->pflags &= ~PF_SKIDDOWN; + player->pflags &= ~PF_FAULT; } else player->powers[pw_nocontrol] = 0;