# HG changeset patch # User Adam Kaminski # Date 1604448586 18000 # Tue Nov 03 19:09:46 2020 -0500 # Node ID fde699de8300ac3bb04b67e02e61057cc5975623 # Parent 5fd19a2b17a7eb58224b076db9d6a45a4638540c Added ACS functions: SetPlayerChasecam(int player, bool enable) and GetPlayerChasecam(int player) to enable or disable the built-in chasecam for the player. diff -r 5fd19a2b17a7 -r fde699de8300 docs/zandronum-history.txt --- a/docs/zandronum-history.txt Tue Nov 03 00:48:43 2020 -0500 +++ b/docs/zandronum-history.txt Tue Nov 03 19:09:46 2020 -0500 @@ -26,6 +26,7 @@ + - Added new SBARINFO command: IfSpectator [not] [dead], that executes a sub block if the local player is (not) a (dead) spectator. [Kaminsky] + - Added a new scoreboard icon that displays if a player is lagging to the server. [Kaminsky] + - Added new compatibility flag "compat_resetglobalvarsonmapreset" to reset all global ACS variables upon resetting the map like in survival. [Kaminsky] ++ - Added ACS functions: SetPlayerChasecam(int player, bool enable) and GetPlayerChasecam(int player) to enable or disable the built-in chasecam for the player. [Kaminsky] - - 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 5fd19a2b17a7 -r fde699de8300 src/p_acs.cpp --- a/src/p_acs.cpp Tue Nov 03 00:48:43 2020 -0500 +++ b/src/p_acs.cpp Tue Nov 03 19:09:46 2020 -0500 @@ -5126,6 +5126,8 @@ ACSF_GetCurrentGamemode, ACSF_SetGamemodeLimit, ACSF_SetPlayerClass, + ACSF_SetPlayerChasecam, + ACSF_GetPlayerChasecam, // ZDaemon ACSF_GetTeamScore = 19620, // (int team) @@ -7178,6 +7180,38 @@ return 1; } + case ACSF_SetPlayerChasecam: + { + const ULONG ulPlayer = static_cast ( args[0] ); + const bool bEnableChasecam = !!args[1]; + + if ( PLAYER_IsValidPlayer( ulPlayer ) ) + { + // [AK] Keep the old value of the player's cheats for comparison later. + int oldvalue = players[ulPlayer].cheats; + if ( bEnableChasecam ) + players[ulPlayer].cheats |= CF_CHASECAM; + else + players[ulPlayer].cheats &= ~CF_CHASECAM; + + // [AK] If we're the server, only notify the client if their cheats was actually changed. + if ( NETWORK_GetState() == NETSTATE_SERVER && players[ulPlayer].cheats != oldvalue ) + SERVERCOMMANDS_SetPlayerCheats( ulPlayer, ulPlayer, SVCF_ONLYTHISCLIENT ); + return 1; + } + else + return 0; + } + + case ACSF_GetPlayerChasecam: + { + const ULONG ulPlayer = static_cast ( args[0] ); + if ( PLAYER_IsValidPlayer( ulPlayer ) ) + return !!( players[ulPlayer].cheats & CF_CHASECAM ); + else + return 0; + } + case ACSF_GetActorFloorTexture: { auto a = SingleActorFromTID(args[0], activator);