From fcdccb96aa5ac0131d50b9fcac08d1c169790fd7 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 17 May 2025 14:52:59 +0200 Subject: [PATCH] move camera to spawn if you press freecam toggle when spectating since we dont use the toggle in spectatormode might be useful to return to the mapstart fast or smth this is mostly just copy pasted from P_ResetCamera, which should be fine hopefully since we dont move our spectators anymore --- src/p_user.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 5d69dc381..1cd747927 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1282,9 +1282,6 @@ void P_DoPlayerExit(player_t *player) if (player == &players[consoleplayer]) demo.savebutton = leveltime; - - /*if (playeringame[player-players] && netgame && !circuitmap) - CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]);*/ } #define SPACESPECIAL 12 @@ -2285,7 +2282,9 @@ static void P_MovePlayer(player_t *player) { player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1; player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1; - } else { + } + else + { player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0; } @@ -3746,6 +3745,33 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam, } #endif +static void P_MoveCameraToSpawn(UINT8 playernum) +{ + camera_t *thiscam = &camera[playernum]; + player_t *player = playernum == 0 ? &players[consoleplayer] : &players[displayplayers[playernum]]; + + if (!thiscam || !player->mo) + return; + + thiscam->x = player->mo->x - P_ReturnThrustX(player->mo, thiscam->angle, player->mo->radius); + thiscam->y = player->mo->y - P_ReturnThrustY(player->mo, thiscam->angle, player->mo->radius); + if (player->mo->eflags & MFE_VERTICALFLIP) + thiscam->z = player->mo->z + player->mo->height - (32<z = player->mo->z + (32<reset = true; + + thiscam->angle = player->mo->angle; + thiscam->aiming = 0; + + thiscam->subsector = R_PointInSubsector(thiscam->x,thiscam->y); + + thiscam->reset_aiming = true; + + R_ResetViewInterpolation(playernum); +} + boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled) { static boolean lookbackactive[MAXSPLITSCREENPLAYERS]; @@ -3779,6 +3805,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (thiscam->freecam || player->spectator) { + // idk if this is the best place? + if (player->spectator && InputDown(gc_freecam, num+1)) + { + P_MoveCameraToSpawn(num); + return true; // dont move while you hold this + } + P_DemoCameraMovement(thiscam, num); P_CalcChasePostImg(player, thiscam); return true;