From 0ceb9e5ea5287fe75dd346ba9e960c54c0ae488c Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 30 Mar 2024 03:34:38 +0100 Subject: [PATCH 1/4] fix this for splitscreen and move to own function --- src/p_local.h | 1 + src/p_user.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index e93d4b411..dc473b648 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -156,6 +156,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam); void P_SlideCameraMove(camera_t *thiscam); void P_DemoCameraMovement(camera_t *cam); boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled); +void P_ResetLocalCamAiming(player_t *player); void P_InitCameraCmd(void); boolean P_PlayerInPain(player_t *player); void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor); diff --git a/src/p_user.c b/src/p_user.c index 04c86aa37..5d97e9ac6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3968,6 +3968,18 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming); } +void P_ResetLocalCamAiming(player_t *player) +{ + for (int i = 0; i <= splitscreen; i++) + { + UINT8 id = (i == 0) ? consoleplayer : displayplayers[i]; + if (player - players == id) + { + localaiming[i] = 0; + } + } +} + boolean P_SpectatorJoinGame(player_t *player) { // Team changing isn't allowed. @@ -4017,10 +4029,9 @@ boolean P_SpectatorJoinGame(player_t *player) player->kartstuff[k_spectatewait] = 0; player->ctfteam = changeto; player->playerstate = PST_REBORN; - - //center camera if its not already - if ((P_IsLocalPlayer(player)) && localaiming[0] != 0) - localaiming[0] = 0; + + //center camera + P_ResetLocalCamAiming(player); //Reset away view if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer) @@ -4046,9 +4057,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->kartstuff[k_spectatewait] = 0; player->playerstate = PST_REBORN; - //center camera if its not already - if ((P_IsLocalPlayer(player)) && localaiming[0] != 0) - localaiming[0] = 0; + //center camera + P_ResetLocalCamAiming(player); //Reset away view if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer) From 9435fa8d6bb9edba2e1341908287b4e5a9a7539d Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 30 Mar 2024 22:03:10 +0300 Subject: [PATCH 2/4] If command is not found via 'help', tell user about 'find' command --- src/command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index af5d936ca..1dff6211d 100644 --- a/src/command.c +++ b/src/command.c @@ -872,7 +872,8 @@ static void COM_Help_f(void) return; } - CONS_Printf("No variable or command named %s", help); + CONS_Printf("No variable or command named %s\n", help); + CONS_Printf("If you don't know exact name, try \"find %s\" command", help); CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing help without arguments\n"); } From d3f6b983f4f06f3d3cae5a6c287b8862239efe79 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 30 Mar 2024 22:18:51 +0300 Subject: [PATCH 3/4] Use 'find' directly in help --- src/command.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/command.c b/src/command.c index 1dff6211d..37e120d52 100644 --- a/src/command.c +++ b/src/command.c @@ -872,9 +872,8 @@ static void COM_Help_f(void) return; } - CONS_Printf("No variable or command named %s\n", help); - CONS_Printf("If you don't know exact name, try \"find %s\" command", help); - CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing help without arguments\n"); + CONS_Printf("Variable or command not found, trying \"find %s\"...\n", help); + COM_ImmedExecute(va("find %s", help)); } return; From ffb72f5fe36779ccf86bafec0c4fc97a1b05c63b Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 31 Mar 2024 23:27:30 +0200 Subject: [PATCH 4/4] Fix vertical aim being off when using lack of perspective --- src/hardware/r_opengl/r_opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index a1e642d22..a19bdd4ea 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2726,7 +2726,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) // https://zdoom.org/wiki/Y-shearing if (shearing) { - float dy = FIXED_TO_FLOAT(AIMINGTODY(stransform->viewaiming)) * 2; //screen_width/BASEVIDWIDTH; + float dy = FIXED_TO_FLOAT(AIMINGTODY((stransform->viewaiming)) * 2)* ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT); //screen_width/BASEVIDWIDTH; if (stransform->flip) dy *= -1.0f; pglTranslatef(0.0f, -dy/BASEVIDHEIGHT, 0.0f);