From 3bbafe8fc1330d85387ba2fd4e587784ce766270 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 14 Oct 2024 19:20:19 +0200 Subject: [PATCH] god pls just work --- src/p_user.c | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 69ac24e50..194eb208f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3275,7 +3275,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { static boolean lookbackactive[MAXSPLITSCREENPLAYERS]; static UINT8 lookbackdelay[MAXSPLITSCREENPLAYERS]; - UINT8 num; + UINT8 num, plyrnum; angle_t angle = 0, focusangle = 0, focusaiming = 0; fixed_t x, y, z, dist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; fixed_t pan, xpan, ypan; @@ -3299,6 +3299,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL) return true; + if (demo.freecam) + { + P_DemoCameraMovement(thiscam); + return true; + } + if (thiscam == &camera[1]) // Camera 2 { num = 1; @@ -3316,10 +3322,25 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall num = 0; } - if (demo.freecam) + if (player == &players[consoleplayer]) { - P_DemoCameraMovement(thiscam); - return true; + plyrnum = 0; + } + else if (player == &players[displayplayers[1]]) + { + plyrnum = 1; + } + else if (player == &players[displayplayers[2]]) + { + plyrnum = 2; + } + else if (player == &players[displayplayers[3]]) + { + plyrnum = 3; + } + else + { + plyrnum = 255; } mo = player->mo; @@ -3346,7 +3367,15 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (!thiscam->chase && !resetcalled) { - focusangle = localangle[num]; + if (plyrnum != 255) + { + focusangle = localangle[plyrnum]; + } + else + { + focusangle = mo->angle; + } + camrotate = cv_cam_rotate[num].value; if (leveltime < introtime) // Whoooshy camera! @@ -3368,10 +3397,15 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall focusangle = mo->angle; focusaiming = 0; } + else if (plyrnum != 255) + { + focusangle = localangle[plyrnum]; + focusaiming = localaiming[plyrnum]; + } else { - focusangle = localangle[num]; - focusaiming = localaiming[num]; + focusangle = mo->angle; + focusaiming = player->aiming; } if (P_CameraThinker(player, thiscam, resetcalled))