# HG changeset patch # User Adam Kaminski # Date 1611516952 18000 # Sun Jan 24 14:35:52 2021 -0500 # Node ID 0af8e01641ef5153b1c4afb954c2e90d8de49a16 # Parent 9dcd6ea0f322c49113a69ee7e1076cb9ae12eb7e Fixed the ChangeCamera line special not reverting the HUD to match the player that the client is looking through. diff -r 9dcd6ea0f322 -r 0af8e01641ef docs/zandronum-history.txt --- a/docs/zandronum-history.txt Fri Jan 22 19:10:15 2021 -0500 +++ b/docs/zandronum-history.txt Sun Jan 24 14:35:52 2021 -0500 @@ -54,6 +54,7 @@ - - Fixed Line_SetTextureOffset and Line_SetTextureScale not working in online games. [Kaminsky] - - Fixed ACS HudMessage alpha, visibility, and layer flags not working online. Also fixed SetHudClipRect and SetHudWrapWidth not working online. [Kaminsky] - - Unified the "PrintHUDMessage" server commands into one single command and optimized the bandwidth consumption of sending HudMessages to the clients. [Kaminsky] +- - Fixed the ChangeCamera line special not reverting the HUD to match the player that the client is looking through. [Kaminsky] ! - sv_forcegldefaults renamed to sv_forcevideodefaults. The old name still exists for compatibility. [Dusk] ! - r_3dfloors is now forced to be true when sv_forcevideodefaults is true. [Dusk] ! - When the wad authentication fails for a connecting client, the client only reports the missing and incompatible PWADS instead of all of them. [Pol Marcet] diff -r 9dcd6ea0f322 -r 0af8e01641ef src/cl_main.cpp --- a/src/cl_main.cpp Fri Jan 22 19:10:15 2021 -0500 +++ b/src/cl_main.cpp Sun Jan 24 14:35:52 2021 -0500 @@ -4150,6 +4150,9 @@ players[consoleplayer].cheats &= ~CF_REVERTPLEASE; if (oldcamera != players[consoleplayer].camera) R_ClearPastViewer (players[consoleplayer].camera); + + // [AK] Change to our HUD if we've switched back to our view. + G_FinishChangeSpy( consoleplayer ); return; } @@ -4162,6 +4165,10 @@ if (oldcamera != players[consoleplayer].camera) R_ClearPastViewer (players[consoleplayer].camera); + + // [AK] Change the HUD to match the player that we're looking through. + if ( players[consoleplayer].camera->player ) + G_FinishChangeSpy( ULONG( players[consoleplayer].camera->player - players )); } //***************************************************************************** diff -r 9dcd6ea0f322 -r 0af8e01641ef src/g_game.cpp --- a/src/g_game.cpp Fri Jan 22 19:10:15 2021 -0500 +++ b/src/g_game.cpp Sun Jan 24 14:35:52 2021 -0500 @@ -981,8 +981,6 @@ // [RH] Spy mode has been separated into two console commands. // One goes forward; the other goes backward. -// [BC] Prototype for new function. -static void FinishChangeSpy( int pnum ); static void ChangeSpy (int changespy) { // If you're not in a level, then you can't spy. @@ -1049,7 +1047,7 @@ if ( PLAYER_IsTrueSpectator( &players[consoleplayer] )) { players[consoleplayer].camera = players[consoleplayer].mo; - FinishChangeSpy( consoleplayer ); + G_FinishChangeSpy( consoleplayer ); return; } @@ -1057,7 +1055,7 @@ if ( players[consoleplayer].bOnTeam == false ) { players[consoleplayer].camera = players[consoleplayer].mo; - FinishChangeSpy( consoleplayer ); + G_FinishChangeSpy( consoleplayer ); return; } @@ -1083,14 +1081,14 @@ } while ( pnum != consoleplayer ); players[consoleplayer].camera = players[pnum].mo; - FinishChangeSpy( pnum ); + G_FinishChangeSpy( pnum ); return; } // [BC] Don't allow spynext in LMS when the spectator settings forbid it. if (( lastmanstanding ) && (( lmsspectatorsettings & LMS_SPF_VIEW ) == false )) { players[consoleplayer].camera = players[consoleplayer].mo; - FinishChangeSpy( consoleplayer ); + G_FinishChangeSpy( consoleplayer ); return; } } @@ -1114,7 +1112,7 @@ break; } while ( pnum != consoleplayer ); - FinishChangeSpy( pnum ); + G_FinishChangeSpy( pnum ); return; } @@ -1166,15 +1164,16 @@ } // [BC] When we're all done, put the camera in the display player's body, etc. - FinishChangeSpy( pnum ); + G_FinishChangeSpy( pnum ); } // [BC] Split this out of ChangeSpy() so it can be called from within that function. -static void FinishChangeSpy( int pnum ) +// [AK] Made this function accessible outside of g_game.cpp for LS_ChangeCamera. +void G_FinishChangeSpy( ULONG ulPlayer ) { - players[consoleplayer].camera = players[pnum].mo; + players[consoleplayer].camera = players[ulPlayer].mo; S_UpdateSounds(players[consoleplayer].camera); - StatusBar->AttachToPlayer (&players[pnum]); + StatusBar->AttachToPlayer (&players[ulPlayer]); // [TP] Rebuild translations if we're overriding player colors, they // may very likely have changed by now. @@ -1192,7 +1191,7 @@ // [BC] If we're a client, tell the server that we're switching our displayplayer. if ( NETWORK_GetState( ) == NETSTATE_CLIENT ) - CLIENTCOMMANDS_ChangeDisplayPlayer( pnum ); + CLIENTCOMMANDS_ChangeDisplayPlayer( ulPlayer ); // [BC] Also, refresh the HUD since the display player is changing. SCOREBOARD_RefreshHUD( ); diff -r 9dcd6ea0f322 -r 0af8e01641ef src/g_game.h --- a/src/g_game.h Fri Jan 22 19:10:15 2021 -0500 +++ b/src/g_game.h Sun Jan 24 14:35:52 2021 -0500 @@ -133,6 +133,9 @@ // Adds to consoleplayer's viewangle if allowed void G_AddViewAngle (int yaw, bool mouse = false); +// [AK] Finishing changing the consoleplayer's view to another player. +void G_FinishChangeSpy ( ULONG ulPlayer ); + #define BODYQUESIZE 32 class AActor; extern AActor *bodyque[BODYQUESIZE]; diff -r 9dcd6ea0f322 -r 0af8e01641ef src/p_lnspec.cpp --- a/src/p_lnspec.cpp Fri Jan 22 19:10:15 2021 -0500 +++ b/src/p_lnspec.cpp Sun Jan 24 14:35:52 2021 -0500 @@ -67,6 +67,7 @@ #include "invasion.h" #include "cl_demo.h" #include "p_acs.h" +#include "g_game.h" #define FUNC(a) static int a (line_t *ln, AActor *it, bool backSide, \ int arg0, int arg1, int arg2, int arg3, int arg4) @@ -2946,6 +2947,10 @@ } } + // [AK] Reset the local player's HUD if we change to another player's view. + if (( NETWORK_GetState( ) != NETSTATE_SERVER ) && ( players[consoleplayer].camera->player )) + G_FinishChangeSpy( ULONG( players[consoleplayer].camera->player - players )); + return true; }