# HG changeset patch # User Adam Kaminski # Date 1610855425 18000 # Sat Jan 16 22:50:25 2021 -0500 # Node ID b97727c7cb15c72306d7fb0934a79245c9edcbb8 # Parent 933666ed36674f22a1e6e43ca62f01c01c4299e7 Backported the "InMenu" FloatyIcon from Q-Zandronum, created by DoomJoshuaBoy and geNia. diff -r 933666ed3667 -r b97727c7cb15 docs/zandronum-history.txt --- a/docs/zandronum-history.txt Sun Jan 24 15:28:58 2021 -0500 +++ b/docs/zandronum-history.txt Sat Jan 16 22:50:25 2021 -0500 @@ -31,6 +31,7 @@ + - Added new SBARINFO commands: IfSpectator [not] [dead] and IfSpying [not] that execute a sub block if the local player is (not) a (dead) spectator, or (not) spying on another player respectively. [Kaminsky] + - 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 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 933666ed3667 -r b97727c7cb15 protocolspec/spec.players.txt --- a/protocolspec/spec.players.txt Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 src/cl_commands.cpp --- a/src/cl_commands.cpp Sun Jan 24 15:28:58 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 ) { // [TP] Limit messages to certain length. diff -r 933666ed3667 -r b97727c7cb15 src/cl_commands.h --- a/src/cl_commands.h Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 src/cl_main.cpp --- a/src/cl_main.cpp Sun Jan 24 15:28:58 2021 -0500 +++ b/src/cl_main.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -2984,6 +2984,7 @@ PLAYER_ResetSpecialCounters ( pPlayer ); pPlayer->bChatting = 0; pPlayer->bInConsole = 0; + pPlayer->bInMenu = 0; pPlayer->bSpectating = 0; pPlayer->bIgnoreChat = 0; pPlayer->lIgnoreChatTicks = -1; @@ -4119,6 +4120,13 @@ //***************************************************************************** // +void ServerCommands::SetPlayerMenuStatus::Execute() +{ + player->bInMenu = inMenu; +} + +//***************************************************************************** +// void ServerCommands::SetPlayerLaggingStatus::Execute() { player->bLagging = lagging; diff -r 933666ed3667 -r b97727c7cb15 src/d_player.h --- a/src/d_player.h Sun Jan 24 15:28:58 2021 -0500 +++ b/src/d_player.h Sat Jan 16 22:50:25 2021 -0500 @@ -636,9 +636,12 @@ // This player is chatting. bool bChatting; - // [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 933666ed3667 -r b97727c7cb15 src/g_game.cpp --- a/src/g_game.cpp Sun Jan 24 15:28:58 2021 -0500 +++ b/src/g_game.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -2120,6 +2120,7 @@ bOnTeam = p->bOnTeam; const bool bChatting = p->bChatting; const bool bInConsole = p->bInConsole; + const bool bInMenu = p->bInMenu; bSpectating = p->bSpectating; bDeadSpectator = p->bDeadSpectator; ulLivesLeft = p->ulLivesLeft; @@ -2169,6 +2170,7 @@ p->bOnTeam = bOnTeam; p->bChatting = bChatting; p->bInConsole = bInConsole; + p->bInMenu = bInMenu; p->bSpectating = bSpectating; p->bDeadSpectator = bDeadSpectator; p->ulLivesLeft = ulLivesLeft; diff -r 933666ed3667 -r b97727c7cb15 src/medal.cpp --- a/src/medal.cpp Sun Jan 24 15:28:58 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. @@ -1271,6 +1291,10 @@ ulFrame = S_INCONSOLE; break; + case SPRITE_INMENU: + ulFrame = S_INMENU; + break; + case SPRITE_LAG: ulFrame = S_LAG; break; @@ -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 933666ed3667 -r b97727c7cb15 src/medal.h --- a/src/medal.h Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 src/menu/menu.cpp --- a/src/menu/menu.cpp Sun Jan 24 15:28:58 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,18 @@ 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 +341,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 933666ed3667 -r b97727c7cb15 src/menu/multiplayermenu.cpp --- a/src/menu/multiplayermenu.cpp Sun Jan 24 15:28:58 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(); @@ -791,6 +792,18 @@ { 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 +818,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 933666ed3667 -r b97727c7cb15 src/network_enums.h --- a/src/network_enums.h Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 src/p_user.cpp --- a/src/p_user.cpp Sun Jan 24 15:28:58 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 ), @@ -496,6 +497,7 @@ ulUnrewardedDamageDealt = p.ulUnrewardedDamageDealt; bChatting = p.bChatting; bInConsole = p.bInConsole; + bInMenu = p.bInMenu; bSpectating = p.bSpectating; bDeadSpectator = p.bDeadSpectator; ulLivesLeft = p.ulLivesLeft; @@ -4162,6 +4164,7 @@ << ulTeam << bChatting << bInConsole + << bInMenu << ulRailgunShots << lMaxHealthBonus << cheats2 diff -r 933666ed3667 -r b97727c7cb15 src/sv_commands.cpp --- a/src/sv_commands.cpp Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 src/sv_commands.h --- a/src/sv_commands.h Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 src/sv_main.cpp --- a/src/sv_main.cpp Sun Jan 24 15:28:58 2021 -0500 +++ b/src/sv_main.cpp Sat Jan 16 22:50:25 2021 -0500 @@ -2353,6 +2353,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 ) @@ -4472,6 +4473,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. @@ -4507,7 +4510,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: @@ -5402,6 +5417,12 @@ pPlayer->bInConsole = false; SERVERCOMMANDS_SetPlayerConsoleStatus( ulClient ); } + + if ( pPlayer->bInMenu ) + { + pPlayer->bInMenu = false; + SERVERCOMMANDS_SetPlayerMenuStatus( ulClient ); + } } return ( false ); diff -r 933666ed3667 -r b97727c7cb15 wadsrc/static/actors/Skulltag/skulltagmisc.txt --- a/wadsrc/static/actors/Skulltag/skulltagmisc.txt Sun Jan 24 15:28:58 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 933666ed3667 -r b97727c7cb15 wadsrc/static/sprites/MENUA0.png Binary file wadsrc/static/sprites/MENUA0.png has changed diff -r 933666ed3667 -r b97727c7cb15 wadsrc/static/sprites/MENUB0.png Binary file wadsrc/static/sprites/MENUB0.png has changed diff -r 933666ed3667 -r b97727c7cb15 wadsrc/static/sprites/MENUC0.png Binary file wadsrc/static/sprites/MENUC0.png has changed