From 9db2da65a6e752cee1d2b3856e99b17127da4380 Mon Sep 17 00:00:00 2001 From: eebrozgi Date: Thu, 12 Jun 2025 02:19:16 +0300 Subject: [PATCH] 2p splitscreen camera height fix When 2p splitscreen is active, only use 75% of map-specific camera heights. --- src/p_spec.c | 9 ++++++++- src/p_user.c | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index eb30cc265..9cdacae6b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -9650,9 +9650,16 @@ void P_DoQuakeOffset(UINT8 view, mappoint_t *viewPos, mappoint_t *offset) fixed_t maxShake = FixedMul(cv_cam_height[view].value, mapobjectscale) * 3 / 4; + // Map-specific camera height if (mapheaderinfo[gamemap-1]->cameraHeight >= 0) { - maxShake = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, mapobjectscale) * 3 / 4; + if (r_splitscreen != 1) + maxShake = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, mapobjectscale) * 3 / 4; + + // For 2p SPLITSCREEN SPECIFICALLY: + // The view is pretty narrow, so move it back 1/4th of the way towards default camera height. + else + maxShake = FixedMul((mapheaderinfo[gamemap-1]->cameraHeight*3 + cv_cam_height[view].value)/4, mapobjectscale) * 3 / 4; } if (battle) diff --git a/src/p_user.c b/src/p_user.c index 5859aa916..eca144775 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3376,9 +3376,18 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camdist = FixedMul(cv_cam_dist[num].value, cameraScale); camheight = FixedMul(cv_cam_height[num].value, cameraScale); + // Map-specific camera height if (mapheaderinfo[gamemap-1]->cameraHeight >= 0) { - camheight = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, cameraScale); + if (r_splitscreen != 1) + camheight = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, cameraScale); + + // For 2p SPLITSCREEN SPECIFICALLY: + // The view is pretty narrow, so move it back 1/4th of the way towards default camera height. + else { + // CONS_Printf( "Camera values: %f / %f / %f \n", FixedToFloat(mapheaderinfo[gamemap-1]->cameraHeight), FixedToFloat(cv_cam_height[num].value), FixedToFloat(cameraScale) ); + camheight = FixedMul((mapheaderinfo[gamemap-1]->cameraHeight*3 + cv_cam_height[num].value)/4, cameraScale); + } } if (loop_in < loop->zoom_in_speed)