# HG changeset patch # User Adam Kaminski # Date 1612716539 18000 # Sun Feb 07 11:48:59 2021 -0500 # Node ID af6fcab118bde0cc1812dead615fac0575424cc9 # Parent 20e0a1923295494d52c1481ab690e61fe6afd007 Backported the "InMenu" FloatyIcon from Q-Zandronum, created by DoomJoshuaBoy and geNia. diff -r 20e0a1923295 -r af6fcab118bd docs/zandronum-history.txt --- a/docs/zandronum-history.txt Wed May 06 22:10:04 2020 +0200 +++ b/docs/zandronum-history.txt Sun Feb 07 11:48:59 2021 -0500 @@ -32,6 +32,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 20e0a1923295 -r af6fcab118bd protocolspec/spec.players.txt --- a/protocolspec/spec.players.txt Wed May 06 22:10:04 2020 +0200 +++ b/protocolspec/spec.players.txt Sun Feb 07 11:48:59 2021 -0500 @@ -121,6 +121,11 @@ Bool inConsole EndCommand +Command SetPlayerMenuStatus + Player player + Bool inMenu +EndCommand + Command SetPlayerLaggingStatus Player player Bool lagging diff -r 20e0a1923295 -r af6fcab118bd src/cl_commands.cpp --- a/src/cl_commands.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/cl_commands.cpp Sun Feb 07 11:48:59 2021 -0500 @@ -269,6 +269,20 @@ //***************************************************************************** // +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 20e0a1923295 -r af6fcab118bd src/cl_commands.h --- a/src/cl_commands.h Wed May 06 22:10:04 2020 +0200 +++ b/src/cl_commands.h Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/cl_main.cpp --- a/src/cl_main.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/cl_main.cpp Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/d_player.h --- a/src/d_player.h Wed May 06 22:10:04 2020 +0200 +++ b/src/d_player.h Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/g_game.cpp --- a/src/g_game.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/g_game.cpp Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/medal.cpp --- a/src/medal.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/medal.cpp Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/medal.h --- a/src/medal.h Wed May 06 22:10:04 2020 +0200 +++ b/src/medal.h Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/menu/menu.cpp --- a/src/menu/menu.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/menu/menu.cpp Sun Feb 07 11:48:59 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 @@ -327,6 +329,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(); } //============================================================================= @@ -826,6 +836,18 @@ D_SendPendingUserinfoChanges(); // [TP] V_SetBorderNeedRefresh(); menuactive = MENU_Off; + + // [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 20e0a1923295 -r af6fcab118bd src/network_enums.h --- a/src/network_enums.h Wed May 06 22:10:04 2020 +0200 +++ b/src/network_enums.h Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/p_user.cpp --- a/src/p_user.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/p_user.cpp Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/sv_commands.cpp --- a/src/sv_commands.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/sv_commands.cpp Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/sv_commands.h --- a/src/sv_commands.h Wed May 06 22:10:04 2020 +0200 +++ b/src/sv_commands.h Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd src/sv_main.cpp --- a/src/sv_main.cpp Wed May 06 22:10:04 2020 +0200 +++ b/src/sv_main.cpp Sun Feb 07 11:48:59 2021 -0500 @@ -2385,6 +2385,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 ) @@ -4504,6 +4505,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. @@ -4539,7 +4542,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: @@ -5439,6 +5454,12 @@ pPlayer->bInConsole = false; SERVERCOMMANDS_SetPlayerConsoleStatus( ulClient ); } + + if ( pPlayer->bInMenu ) + { + pPlayer->bInMenu = false; + SERVERCOMMANDS_SetPlayerMenuStatus( ulClient ); + } } return ( false ); diff -r 20e0a1923295 -r af6fcab118bd wadsrc/static/actors/Skulltag/skulltagmisc.txt --- a/wadsrc/static/actors/Skulltag/skulltagmisc.txt Wed May 06 22:10:04 2020 +0200 +++ b/wadsrc/static/actors/Skulltag/skulltagmisc.txt Sun Feb 07 11:48:59 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 20e0a1923295 -r af6fcab118bd wadsrc/static/sprites/MENUA0.png Binary file wadsrc/static/sprites/MENUA0.png has changed diff -r 20e0a1923295 -r af6fcab118bd wadsrc/static/sprites/MENUB0.png Binary file wadsrc/static/sprites/MENUB0.png has changed diff -r 20e0a1923295 -r af6fcab118bd wadsrc/static/sprites/MENUC0.png Binary file wadsrc/static/sprites/MENUC0.png has changed