From 15edab5e85cd655ac7e8c2aec88e11a23b2a8247 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Mar 2023 20:59:12 -0700 Subject: [PATCH 1/2] Delay spawning level sign posts, do not use youfuckedup face for tied sign posts - Sign post spawning is delayed until after thinkers have run. This lets ties be tallied. - Spawn normal (non error) sign for ties. --- src/p_spec.c | 19 +++++++++++++------ src/p_spec.h | 2 +- src/p_tick.c | 34 +++++++++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index b0586f2da..4cc3bad6c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2054,9 +2054,6 @@ static void K_HandleLapIncrement(player_t *player) } P_DoPlayerExit(player); - - if (!(player->pflags & PF_NOCONTEST)) - P_SetupSignExit(player); } else { @@ -4617,7 +4614,7 @@ static void P_SetupSignObject(mobj_t *sign, mobj_t *pmo, boolean error) // Finds the exit sign in the current sector and // sets its target to the player who passed the map. // -void P_SetupSignExit(player_t *player) +void P_SetupSignExit(player_t *player, boolean tie) { mobj_t *thing; msecnode_t *node = player->mo->subsector->sector->touching_thinglist; // things touching this sector @@ -4633,6 +4630,11 @@ void P_SetupSignExit(player_t *player) if (thing->type != MT_SIGN) continue; + if (tie) + { + break; + } + if (thing->state != &states[thing->info->spawnstate]) continue; @@ -4654,6 +4656,11 @@ void P_SetupSignExit(player_t *player) if (thing->type != MT_SIGN) continue; + if (tie) + { + break; + } + if (thing->state != &states[thing->info->spawnstate]) continue; @@ -4669,7 +4676,7 @@ void P_SetupSignExit(player_t *player) { thing = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->floorz, MT_SIGN); thing->angle = player->mo->angle; - P_SetupSignObject(thing, player->mo, true); // Use :youfuckedup: sign face + P_SetupSignObject(thing, player->mo, (tie == false)); // Use :youfuckedup: sign face, except during ties } } @@ -5166,7 +5173,7 @@ static void P_ProcessExitSector(player_t *player, mtag_t sectag) // Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c) P_DoPlayerExit(player); - P_SetupSignExit(player); + P_SetupSignExit(player, false); #if 0 if (!G_CoopGametype()) diff --git a/src/p_spec.h b/src/p_spec.h index d33cdeb3f..1ec766f09 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -600,7 +600,7 @@ struct activator_t boolean P_CanActivateSpecial(INT16 special); boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, char **stringargs); -void P_SetupSignExit(player_t *player); +void P_SetupSignExit(player_t *player, boolean tie); boolean P_IsMobjTouchingSectorPlane(mobj_t *mo, sector_t *sec); boolean P_IsMobjTouching3DFloor(mobj_t *mo, ffloor_t *ffloor, sector_t *sec); diff --git a/src/p_tick.c b/src/p_tick.c index 4ed8fd83a..b7911571c 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -629,9 +629,37 @@ void P_Ticker(boolean run) ps_thinkertime = I_GetPreciseTime() - ps_thinkertime; // Run any "after all the other thinkers" stuff - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) - P_PlayerAfterThink(&players[i]); + { + player_t *finishingPlayers[MAXPLAYERS]; + UINT8 numFinishingPlayers = 0; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) + { + P_PlayerAfterThink(&players[i]); + + // Check for the number of ties for first place after every player has thunk run for this tic + if (players[i].exiting == 1 && players[i].position == 1 && + (players[i].pflags & (PF_HITFINISHLINE|PF_NOCONTEST)) == PF_HITFINISHLINE) + { + finishingPlayers[numFinishingPlayers++] = &players[i]; + } + } + } + + if (numFinishingPlayers > 1) + { + for (i = 0; i < numFinishingPlayers; i++) + { + P_SetupSignExit(finishingPlayers[i], true); + } + } + else if (numFinishingPlayers == 1) + { + P_SetupSignExit(finishingPlayers[0], false); + } + } if (K_CheckBossIntro() == true) { From 4b993a3de0aaed27f5f62965157358b3f2a53cbf Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Mar 2023 21:01:42 -0700 Subject: [PATCH 2/2] Signs: always use map thing's angle if it exists, else face direction player is moving from If no map thing exists, should face toward the camera, not away from it. --- src/p_spec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 4cc3bad6c..c321c80b8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4621,6 +4621,8 @@ void P_SetupSignExit(player_t *player, boolean tie) thinker_t *think; INT32 numfound = 0; + angle_t bestAngle = K_MomentumAngle(player->mo) + ANGLE_180; + if (player->position != 1) return; @@ -4630,6 +4632,8 @@ void P_SetupSignExit(player_t *player, boolean tie) if (thing->type != MT_SIGN) continue; + bestAngle = thing->angle; + if (tie) { break; @@ -4656,6 +4660,8 @@ void P_SetupSignExit(player_t *player, boolean tie) if (thing->type != MT_SIGN) continue; + bestAngle = thing->angle; + if (tie) { break; @@ -4675,7 +4681,7 @@ void P_SetupSignExit(player_t *player, boolean tie) if (player->mo && !P_MobjWasRemoved(player->mo)) { thing = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->floorz, MT_SIGN); - thing->angle = player->mo->angle; + thing->angle = bestAngle; P_SetupSignObject(thing, player->mo, (tie == false)); // Use :youfuckedup: sign face, except during ties } }