# HG changeset patch # User Adam Kaminski # Date 1610855425 18000 # Sat Jan 16 22:50:25 2021 -0500 # Node ID a1c397f53a1cf9299e99abaab1a2a3a73e09ba0e # Parent e6e5b5a6991be7c27a874c38e0f0e95f8936b701 Backported the "InMenu" FloatyIcon from Q-Zandronum, created by DoomJoshuaBoy and geNia. diff -r e6e5b5a6991b -r a1c397f53a1c docs/zandronum-history.txt --- a/docs/zandronum-history.txt Sat Jan 16 10:49:10 2021 -0500 +++ b/docs/zandronum-history.txt Sat Jan 16 22:50:25 2021 -0500 @@ -33,6 +33,7 @@ + - Added ACS functions: ExecuteClientScript and NamedExecuteClientScript which let the server execute clientside scripts for only one client as opposed to everyone. This allows net traffic to be greatly optimized, such that the server only sends out commands to the client(s) that matter. [Kaminsky] + - Added ACS functions: SendNetworkString and NamedSendNetworkString, allowing strings to be sent from the server to the client(s) and vice versa, which are passed as the first argument of script to also be executed. Note that sending strings from client to server works just like puking scripts and there's no guarantee they are sent to the server successfully. [Kaminsky] + - Added a new EVENT script type: GAMEEVENT_CHAT that triggers when a non-private chat message is sent. Use this in conjunction with the ACS function: GetChatMessage(int player) to get the last chat message received by the player (or the server if -1 is passed). [Kaminsky] ++ - Added a new floating icon that shows if a player is in the menu. [DoomJoshuaBoy/geNia] - - Fixed: Bots tries to jump to reach item when sv_nojump is true. [sleep] - - Fixed: ACS function SetSkyScrollSpeed didn't work online. [Edward-san] - - Fixed: color codes in callvote reasons weren't terminated properly. [Dusk] diff -r e6e5b5a6991b -r a1c397f53a1c protocolspec/spec.players.txt --- a/protocolspec/spec.players.txt Sat Jan 16 10:49:10 2021 -0500 +++ b/protocolspec/spec.players.txt Sat Jan 16 22:50:25 2021 -0500 @@ -121,6 +121,11 @@ Bool inConsole EndCommand +Command SetPlayerMenuStatus + Player player + Bool inMenu +EndCommand + Command SetPlayerLaggingStatus Player player Bool lagging diff -r e6e5b5a6991b -r a1c397f53a1c src/cl_commands.cpp --- a/src/cl_commands.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/cl_commands.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -269,6 +269,21 @@ //***************************************************************************** // +void CLIENTCOMMANDS_EnterMenu(void) +{ + CLIENT_GetLocalBuffer( )->ByteStream.WriteByte( CLC_ENTERMENU ); +} + +//***************************************************************************** +// +void CLIENTCOMMANDS_ExitMenu(void) +{ + CLIENT_GetLocalBuffer( )->ByteStream.WriteByte( CLC_EXITMENU ); +} + + +//***************************************************************************** +// void CLIENTCOMMANDS_Say( ULONG ulMode, const char *pszString, ULONG ulPlayer ) { // [TP] Limit messages to certain length. diff -r e6e5b5a6991b -r a1c397f53a1c src/cl_commands.h --- a/src/cl_commands.h Sat Jan 16 10:49:10 2021 -0500 +++ b/src/cl_commands.h Sat Jan 16 22:50:25 2021 -0500 @@ -105,7 +105,9 @@ void CLIENTCOMMANDS_RequestInventoryUse( AInventory *item ); void CLIENTCOMMANDS_RequestInventoryDrop( AInventory *pItem ); void CLIENTCOMMANDS_EnterConsole( void ); +void CLIENTCOMMANDS_EnterMenu( void ); void CLIENTCOMMANDS_ExitConsole( void ); +void CLIENTCOMMANDS_ExitMenu( void ); void CLIENTCOMMANDS_Puke ( int script, int args[4], bool always ); void CLIENTCOMMANDS_ACSSendString( int script, const char* pszString ); void CLIENTCOMMANDS_MorphCheat ( const char *pszMorphClass ); diff -r e6e5b5a6991b -r a1c397f53a1c src/cl_main.cpp --- a/src/cl_main.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/cl_main.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -2985,6 +2985,7 @@ pPlayer->bChatting = 0; pPlayer->ChatMessages.Clear(); pPlayer->bInConsole = 0; + pPlayer->bInMenu = 0; pPlayer->bSpectating = 0; pPlayer->bIgnoreChat = 0; pPlayer->lIgnoreChatTicks = -1; @@ -4118,6 +4119,11 @@ player->bInConsole = inConsole; } +void ServerCommands::SetPlayerMenuStatus::Execute() +{ + player->bInMenu = inMenu; +} + //***************************************************************************** // void ServerCommands::SetPlayerLaggingStatus::Execute() diff -r e6e5b5a6991b -r a1c397f53a1c src/d_player.h --- a/src/d_player.h Sat Jan 16 10:49:10 2021 -0500 +++ b/src/d_player.h Sat Jan 16 22:50:25 2021 -0500 @@ -639,9 +639,12 @@ // [AK] The last few chat messages we received from this player. TArray ChatMessages; - // [RC] This player is in the console or menu. + // [RC] This player is in the console. bool bInConsole; + // [RC] This player is in the menu. + bool bInMenu; + // This player is currently spectating. bool bSpectating; diff -r e6e5b5a6991b -r a1c397f53a1c src/g_game.cpp --- a/src/g_game.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/g_game.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -198,6 +198,7 @@ player_t players[MAXPLAYERS + 1]; // [EP] Add 1 slot for the DummyPlayer bool playeringame[MAXPLAYERS + 1]; // [EP] Add 1 slot for the DummyPlayer +int menuplayer; // player taking events int consoleplayer; // player taking events int gametic; @@ -2123,6 +2124,7 @@ const bool bChatting = p->bChatting; ChatMessages = p->ChatMessages; const bool bInConsole = p->bInConsole; + const bool bInMenu = p->bInMenu; bSpectating = p->bSpectating; bDeadSpectator = p->bDeadSpectator; ulLivesLeft = p->ulLivesLeft; @@ -2173,6 +2175,7 @@ p->bChatting = bChatting; p->ChatMessages = ChatMessages; p->bInConsole = bInConsole; + p->bInMenu = bInMenu; p->bSpectating = bSpectating; p->bDeadSpectator = bDeadSpectator; p->ulLivesLeft = ulLivesLeft; diff -r e6e5b5a6991b -r a1c397f53a1c src/medal.cpp --- a/src/medal.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/medal.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -112,6 +112,7 @@ { SPRITE_CHAT, SPRITE_INCONSOLE, + SPRITE_INMENU, SPRITE_ALLY, SPRITE_LAG, SPRITE_WHITEFLAG, @@ -1049,6 +1050,10 @@ if ( pPlayer->bInConsole ) ulDesiredSprite = SPRITE_INCONSOLE; + // Draw a menu icon over the player if they're in the Menu. + if ( pPlayer->bInMenu ) + ulDesiredSprite = SPRITE_INMENU; + // Draw a lag icon over their head if they're lagging. if ( pPlayer->bLagging ) ulDesiredSprite = SPRITE_LAG; @@ -1146,6 +1151,21 @@ else ulActualSprite = SPRITE_INCONSOLE; break; + // In menu icon . Delete it if the player is no longer in the menu. + case S_INMENU: + case ( S_INMENU + 1 ): + case ( S_INMENU + 2 ): + case ( S_INMENU + 3 ): + case ( S_INMENU + 4 ): + + if ( pPlayer->bInMenu == false ) + { + pPlayer->pIcon->Destroy(); + pPlayer->pIcon = NULL; + } + else + ulActualSprite = SPRITE_INMENU; + break; // Ally icon. Delete it if the player is now our enemy or if we're spectating. // [BB] Dead spectators shall keep the icon for their teammates. @@ -1270,6 +1290,10 @@ case SPRITE_INCONSOLE: ulFrame = S_INCONSOLE; break; + + case SPRITE_INMENU: + ulFrame = S_INMENU; + break; case SPRITE_LAG: ulFrame = S_LAG; @@ -1471,7 +1495,7 @@ void medal_CheckForLlama( ULONG ulDeadPlayer, ULONG ulPlayer ) { // Award a "llama" medal if the victim had been typing, lagging, or in the console. - if ( players[ulDeadPlayer].bChatting || players[ulDeadPlayer].bLagging || players[ulDeadPlayer].bInConsole ) + if ( players[ulDeadPlayer].bChatting || players[ulDeadPlayer].bLagging || players[ulDeadPlayer].bInConsole || players[ulDeadPlayer].bInMenu ) medal_GiveMedal( ulPlayer, MEDAL_LLAMA ); } diff -r e6e5b5a6991b -r a1c397f53a1c src/medal.h --- a/src/medal.h Sat Jan 16 10:49:10 2021 -0500 +++ b/src/medal.h Sat Jan 16 22:50:25 2021 -0500 @@ -65,7 +65,8 @@ S_TERMINATORARTIFACT = 0, S_CHAT = ( S_TERMINATORARTIFACT + 4 ), S_INCONSOLE = ( S_CHAT + 1 ), - S_ALLY = ( S_INCONSOLE + 2 ), + S_INMENU = ( S_INCONSOLE + 2 ), + S_ALLY = ( S_INMENU + 5 ), S_WHITEFLAG = ( S_ALLY + 1 ), S_EXCELLENT = ( S_WHITEFLAG + 6 ), S_INCREDIBLE = ( S_EXCELLENT + 1 ), diff -r e6e5b5a6991b -r a1c397f53a1c src/menu/menu.cpp --- a/src/menu/menu.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/menu/menu.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -63,6 +63,8 @@ #include "cooperative.h" #include "deathmatch.h" #include "cl_main.h" +#include "cl_demo.h" +#include "cl_commands.h" // // Todo: Move these elsewhere @@ -191,6 +193,19 @@ else { M_ClearMenus (); + + // [BB] We are not in menu anymore, so set bInMenu if necessary. + if ( players[consoleplayer].bInMenu ) + { + + // [BB] Don't change the displayed menu status when a demo is played. + if ( CLIENTDEMO_IsPlaying() == false ) + players[consoleplayer].bInMenu = false; + + // [RC] Tell the server so our "in Menu" icon is removed. + if ( NETWORK_GetState() == NETSTATE_CLIENT ) + CLIENTCOMMANDS_ExitMenu(); + } } } @@ -327,6 +342,14 @@ } BackbuttonTime = 0; BackbuttonAlpha = 0; + + // [BB] Don't change the displayed menu status when a demo is played. + if ( CLIENTDEMO_IsPlaying() == false ) + players[consoleplayer].bInMenu = true; + + // [RC] Tell the server so we get an "in menu" icon. + if ( NETWORK_GetState() == NETSTATE_CLIENT ) + CLIENTCOMMANDS_EnterMenu(); } //============================================================================= diff -r e6e5b5a6991b -r a1c397f53a1c src/menu/multiplayermenu.cpp --- a/src/menu/multiplayermenu.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/menu/multiplayermenu.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -74,6 +74,7 @@ #include "duel.h" #include "invasion.h" #include "lastmanstanding.h" +#include "cl_commands.h" static void M_StartSkirmishGame(); static void M_ClearBotSlots(); @@ -778,6 +779,19 @@ if ( static_cast( menu_jointeamidx ) == teams.Size() ) { C_DoCommand( "team random" ); + + // [BB] We are not in menu anymore, so set bInMenu if necessary. + if ( players[consoleplayer].bInMenu ) + { + + // [BB] Don't change the displayed menu status when a demo is played. + if ( CLIENTDEMO_IsPlaying() == false ) + players[consoleplayer].bInMenu = false; + + // [RC] Tell the server so our "in Menu" icon is removed. + if ( NETWORK_GetState() == NETSTATE_CLIENT ) + CLIENTCOMMANDS_ExitMenu(); + } } else { @@ -785,11 +799,37 @@ mysnprintf( command, sizeof command, "team \"%s\"", teams[menu_jointeamidx].Name.GetChars() ); AddCommandString( command ); + + // [BB] We are not in menu anymore, so set bInMenu if necessary. + if ( players[consoleplayer].bInMenu ) + { + + // [BB] Don't change the displayed menu status when a demo is played. + if ( CLIENTDEMO_IsPlaying() == false ) + players[consoleplayer].bInMenu = false; + + // [RC] Tell the server so our "in Menu" icon is removed. + if ( NETWORK_GetState() == NETSTATE_CLIENT ) + CLIENTCOMMANDS_ExitMenu(); + } } } else { C_DoCommand( "join" ); + + // [BB] We are not in menu anymore, so set bInMenu if necessary. + if ( players[consoleplayer].bInMenu ) + { + + // [BB] Don't change the displayed menu status when a demo is played. + if ( CLIENTDEMO_IsPlaying() == false ) + players[consoleplayer].bInMenu = false; + + // [RC] Tell the server so our "in Menu" icon is removed. + if ( NETWORK_GetState() == NETSTATE_CLIENT ) + CLIENTCOMMANDS_ExitMenu(); + } } } @@ -805,6 +845,18 @@ { M_ClearMenus(); C_DoCommand( "team autoselect" ); + // [BB] We are not in menu anymore, so set bInMenu if necessary. + if ( players[consoleplayer].bInMenu ) + { + + // [BB] Don't change the displayed menu status when a demo is played. + if ( CLIENTDEMO_IsPlaying() == false ) + players[consoleplayer].bInMenu = false; + + // [RC] Tell the server so our "in Menu" icon is removed. + if ( NETWORK_GetState() == NETSTATE_CLIENT ) + CLIENTCOMMANDS_ExitMenu(); + } } // ================================================================================================= diff -r e6e5b5a6991b -r a1c397f53a1c src/network_enums.h --- a/src/network_enums.h Sat Jan 16 10:49:10 2021 -0500 +++ b/src/network_enums.h Sat Jan 16 22:50:25 2021 -0500 @@ -100,6 +100,7 @@ ENUM_ELEMENT ( SVC_SETPLAYERKILLCOUNT ), ENUM_ELEMENT ( SVC_SETPLAYERCHATSTATUS ), ENUM_ELEMENT ( SVC_SETPLAYERCONSOLESTATUS ), + ENUM_ELEMENT ( SVC_SETPLAYERMENUSTATUS ), ENUM_ELEMENT ( SVC_SETPLAYERLAGGINGSTATUS ), ENUM_ELEMENT ( SVC_SETPLAYERREADYTOGOONSTATUS ), ENUM_ELEMENT ( SVC_SETPLAYERTEAM ), @@ -434,6 +435,8 @@ ENUM_ELEMENT( CLC_SUMMONFOECHEAT ), ENUM_ELEMENT( CLC_ENTERCONSOLE ), ENUM_ELEMENT( CLC_EXITCONSOLE ), + ENUM_ELEMENT( CLC_ENTERMENU ), + ENUM_ELEMENT( CLC_EXITMENU ), ENUM_ELEMENT( CLC_IGNORE ), ENUM_ELEMENT( CLC_PUKE ), ENUM_ELEMENT( CLC_ACSSENDSTRING ), diff -r e6e5b5a6991b -r a1c397f53a1c src/p_user.cpp --- a/src/p_user.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/p_user.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -330,6 +330,7 @@ ulUnrewardedDamageDealt( 0 ), bChatting( 0 ), bInConsole( 0 ), + bInMenu( 0 ), bSpectating( 0 ), bDeadSpectator( 0 ), ulLivesLeft( 0 ), @@ -497,6 +498,7 @@ bChatting = p.bChatting; ChatMessages = p.ChatMessages; bInConsole = p.bInConsole; + bInMenu = p.bInMenu; bSpectating = p.bSpectating; bDeadSpectator = p.bDeadSpectator; ulLivesLeft = p.ulLivesLeft; @@ -4163,6 +4165,7 @@ << ulTeam << bChatting << bInConsole + << bInMenu << ulRailgunShots << lMaxHealthBonus << cheats2 diff -r e6e5b5a6991b -r a1c397f53a1c src/sv_commands.cpp --- a/src/sv_commands.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/sv_commands.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -661,6 +661,16 @@ //***************************************************************************** // +void SERVERCOMMANDS_SetPlayerMenuStatus( ULONG ulPlayer, ULONG ulPlayerExtra, ServerCommandFlags flags ) +{ + ServerCommands::SetPlayerMenuStatus command; + command.SetPlayer( &players[ulPlayer] ); + command.SetInMenu( players[ulPlayer].bInMenu ); + command.sendCommandToClients( ulPlayerExtra, flags ); +} + +//***************************************************************************** +// void SERVERCOMMANDS_SetPlayerReadyToGoOnStatus( ULONG ulPlayer ) { ServerCommands::SetPlayerReadyToGoOnStatus command; diff -r e6e5b5a6991b -r a1c397f53a1c src/sv_commands.h --- a/src/sv_commands.h Sat Jan 16 10:49:10 2021 -0500 +++ b/src/sv_commands.h Sat Jan 16 22:50:25 2021 -0500 @@ -126,6 +126,7 @@ void SERVERCOMMANDS_SetPlayerKillCount( ULONG ulPlayer, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SetPlayerChatStatus( ULONG ulPlayer, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SetPlayerConsoleStatus( ULONG ulPlayer, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); +void SERVERCOMMANDS_SetPlayerMenuStatus( ULONG ulPlayer, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SetPlayerLaggingStatus( ULONG ulPlayer ); void SERVERCOMMANDS_SetPlayerReadyToGoOnStatus( ULONG ulPlayer ); void SERVERCOMMANDS_SetPlayerTeam( ULONG ulPlayer, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); diff -r e6e5b5a6991b -r a1c397f53a1c src/sv_main.cpp --- a/src/sv_main.cpp Sat Jan 16 10:49:10 2021 -0500 +++ b/src/sv_main.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -2411,6 +2411,7 @@ // [BB] Also tell this player's chat / console status to the new client. SERVERCOMMANDS_SetPlayerChatStatus( ulIdx, ulClient, SVCF_ONLYTHISCLIENT ); SERVERCOMMANDS_SetPlayerConsoleStatus( ulIdx, ulClient, SVCF_ONLYTHISCLIENT ); + SERVERCOMMANDS_SetPlayerMenuStatus( ulIdx, ulClient, SVCF_ONLYTHISCLIENT ); // [BB] If this player has any cheats, also inform the new client. if( players[ulIdx].cheats ) @@ -4554,6 +4555,8 @@ case CLC_ENDCHAT: case CLC_ENTERCONSOLE: case CLC_EXITCONSOLE: + case CLC_ENTERMENU: + case CLC_EXITMENU: // [BB] If the client is flooding the server with commands, the client is // kicked and we don't need to handle the command. @@ -4589,7 +4592,19 @@ players[g_lCurrentClient].bInConsole = false; SERVERCOMMANDS_SetPlayerConsoleStatus( g_lCurrentClient ); } - + else if ( lCommand == CLC_ENTERMENU ) + { + + // Player has entered the console - give him an icon. + players[g_lCurrentClient].bInMenu = true; + SERVERCOMMANDS_SetPlayerMenuStatus( g_lCurrentClient ); + } + else if ( lCommand == CLC_EXITMENU ) + { + // Player has left the console - remove his icon. + players[g_lCurrentClient].bInMenu = false; + SERVERCOMMANDS_SetPlayerMenuStatus( g_lCurrentClient ); + } return false; case CLC_IGNORE: @@ -5489,6 +5504,12 @@ pPlayer->bInConsole = false; SERVERCOMMANDS_SetPlayerConsoleStatus( ulClient ); } + + if ( pPlayer->bInMenu ) + { + pPlayer->bInMenu = false; + SERVERCOMMANDS_SetPlayerMenuStatus( ulClient ); + } } return ( false ); diff -r e6e5b5a6991b -r a1c397f53a1c wadsrc/static/actors/Skulltag/skulltagmisc.txt --- a/wadsrc/static/actors/Skulltag/skulltagmisc.txt Sat Jan 16 10:49:10 2021 -0500 +++ b/wadsrc/static/actors/Skulltag/skulltagmisc.txt Sat Jan 16 22:50:25 2021 -0500 @@ -21,6 +21,9 @@ INCONSOLE: CNSL AB 9 bright loop + INMENU: + MENU ABCBA 10 bright + loop ALLY: ALLY A -1 loop diff -r e6e5b5a6991b -r a1c397f53a1c wadsrc/static/sprites/MENUA0.png Binary file wadsrc/static/sprites/MENUA0.png has changed diff -r e6e5b5a6991b -r a1c397f53a1c wadsrc/static/sprites/MENUB0.png Binary file wadsrc/static/sprites/MENUB0.png has changed diff -r e6e5b5a6991b -r a1c397f53a1c wadsrc/static/sprites/MENUC0.png Binary file wadsrc/static/sprites/MENUC0.png has changed