Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • zandronum/zandronum-stable
1 result
Show changes
Commits on Source (16)
Showing with 624 additions and 138 deletions
......@@ -17,7 +17,7 @@
*+ - Added the new AUTHINFO lump, allowing modders to define their own list of lumps to be authenticated. [AKMDM]
*+ - Revamped the scoreboard, and added the new SCORINFO lump that allows full customization of the scoreboard. [AKMDM]
*+ - Added support for custom vote types using the new VOTEINFO lump. [Dusk]
*+ - Added support for custom vote types using the new VOTEINFO lump. [Dusk, Trillster]
*+ - Added support for voice chat. Audio is encoded and decoded using Opus, allowing it to be transmitted over the network with minimal bandwidth usage and decent quality. Any unwanted noise in the audio is also removed with RNNoise before it's sent to the server. [AKMDM]
*+ - Generalized the medal system and added the new MEDALDEF lump to define custom medals. Players can be awarded medals using the ACS and DECORATE functions: "GivePlayerMedal" and "A_GivePlayerMedal". [AKMDM]
*+ - Added support for loading multiple banlists (and exemption lists). Server hosts can load extra files by separating the filenames with semi-colons. [AKMDM]
......@@ -81,6 +81,10 @@
+ - Added event GAMEEVENT_DOMINATION_PRECONTROL, which executes just before a domination point is captured, allowing the capture to be denied. [Trillster]
+ - Added event GAMEEVENT_DOMINATION_CONTEST, which executes whenever a player is contesting a domination point. Note that for performance reasons, this event is disabled by default so modders have to enable it by themselves. [Trillster]
+ - Added ACS function: "GetSkinProperty", to allow retrieving properties of any loaded skins. [Trillster]
+ - Added the ability to automatically load PK3 and WAD files at the end of the load order via a "postload" folder. [Trillster]
+ - Added ACS function: "IsPlayerContestingControlPoint", to determine if a player is currently contesting a given control point. [Trillster]
+ - Added the CVar flagset "sv_forbidvoteflags" which combines all native vote forbidding CVars. [Trillster]
+ - Added the CCMD "listvotetypes" to list all native and custom vote types. [Trillster]
- - Fixed: clients didn't initialize a sector's friction properly in some cases due to a superfluous check that wasn't removed earlier. [AKMDM]
- - Fixed: the server wouldn't initialize compatflags and compatflags2 properly if entered as command line parameters. [AKMDM]
- - Fixed: serverinfo CVars entered on the command line were restored in reverse order. [AKMDM]
......
......@@ -90,4 +90,5 @@
ExtendedCommand
Byte point
Bool disabled
Byte[] contesters
EndCommand
This diff is collapsed.
......@@ -68,6 +68,24 @@
//*****************************************************************************
enum
{
FORBIDVOTE_KICK = 1 << 0,
FORBIDVOTE_FORCESPEC = 1 << 1,
FORBIDVOTE_MAP = 1 << 2,
FORBIDVOTE_CHANGEMAP = 1 << 3,
FORBIDVOTE_FRAGLIMIT = 1 << 4,
FORBIDVOTE_TIMELIMIT = 1 << 5,
FORBIDVOTE_WINLIMIT = 1 << 6,
FORBIDVOTE_DUELLIMIT = 1 << 7,
FORBIDVOTE_POINTLIMIT = 1 << 8,
FORBIDVOTE_FLAG = 1 << 9,
FORBIDVOTE_NEXTMAP = 1 << 10,
FORBIDVOTE_NEXTSECRET = 1 << 11,
FORBIDVOTE_RESETMAP = 1 << 12,
};
//*****************************************************************************
enum
{
VOTECMD_KICK,
VOTECMD_FORCETOSPECTATE,
VOTECMD_MAP,
......@@ -102,4 +120,5 @@
{
NONE,
INT,
FLOAT,
STRING,
......@@ -105,3 +124,5 @@
STRING,
PLAYER,
MAP
};
FString name;
......@@ -106,3 +127,6 @@
};
FString name;
FString displayName;
FString menu;
FString menuName;
FString scriptName;
......@@ -108,4 +132,5 @@
FString scriptName;
FString preflightScript;
FString forbidCvarName;
parametertype_e parameterType = parametertype_e::NONE;
};
......@@ -141,6 +166,7 @@
void CALLVOTE_Construct( void );
void CALLVOTE_ReadVoteInfo( void );
const TArray<VOTETYPE_s> &CALLVOTE_GetCustomVotes( void );
void CALLVOTE_Tick( void );
void CALLVOTE_Render( void );
void CALLVOTE_RenderClassic( void );
......@@ -165,8 +191,9 @@
bool CALLVOTE_ShouldShowVoteScreen( void );
ULONG CALLVOTE_GetPlayerVoteChoice( ULONG ulPlayer );
const VOTETYPE_s *CALLVOTE_GetCustomVoteTypeDefinition( ULONG ulVoteType );
void CALLVOTE_ConvertCustomVoteParameter( const VOTETYPE_s *customVoteType, FString &Parameters );
//*****************************************************************************
// EXTERNAL CONSOLE VARIABLES
EXTERN_CVAR( Int, sv_minvoters );
......@@ -168,6 +195,7 @@
//*****************************************************************************
// EXTERNAL CONSOLE VARIABLES
EXTERN_CVAR( Int, sv_minvoters );
EXTERN_CVAR( Int, sv_forbidvoteflags );
EXTERN_CVAR( Int, sv_nocallvote )
......@@ -173,17 +201,4 @@
EXTERN_CVAR( Int, sv_nocallvote )
EXTERN_CVAR( Bool, sv_nokickvote );
EXTERN_CVAR( Bool, sv_noforcespecvote );
EXTERN_CVAR( Bool, sv_nomapvote );
EXTERN_CVAR( Bool, sv_nochangemapvote );
EXTERN_CVAR( Bool, sv_nofraglimitvote );
EXTERN_CVAR( Bool, sv_notimelimitvote );
EXTERN_CVAR( Bool, sv_nowinlimitvote );
EXTERN_CVAR( Bool, sv_noduellimitvote );
EXTERN_CVAR( Bool, sv_nopointlimitvote );
EXTERN_CVAR( Bool, sv_noflagvote );
EXTERN_CVAR( Bool, sv_nonextmapvote );
EXTERN_CVAR( Bool, sv_nonextsecretvote );
EXTERN_CVAR( Bool, sv_noresetmapvote );
EXTERN_CVAR( Int, sv_votecooldown );
EXTERN_CVAR( Int, sv_voteconnectwait );
EXTERN_CVAR( Bool, cl_showfullscreenvote )
......
......@@ -6020,6 +6020,10 @@
// [BB] ... and zadmflags.
Value.Int = pByteStream->ReadLong();
zadmflags.ForceSet( Value, CVAR_Int );
// [TRSR] ... and sv_forbidvoteflags.
Value.Int = pByteStream->ReadLong();
sv_forbidvoteflags.ForceSet( Value, CVAR_Int );
}
//*****************************************************************************
......@@ -6127,6 +6131,10 @@
// [AK] Read in, and set the value for sv_respawndelaytime.
Value.Float = pByteStream->ReadFloat();
sv_respawndelaytime.ForceSet( Value, CVAR_Float );
// [TRSR] Read in, and set the value for sv_nocallvote.
Value.Int = pByteStream->ReadByte();
sv_nocallvote.ForceSet( Value, CVAR_Int );
}
//*****************************************************************************
......@@ -9556,6 +9564,13 @@
// [TRSR]
void ServerCommands::SetDominationPointState::Execute()
{
std::set<int> contesting;
for ( unsigned int i = 0; i < contesters.Size(); i++ )
{
contesting.insert( contesters[i] );
}
DOMINATION_SetContesting( point, contesting );
DOMINATION_SetDisabled( point, disabled );
}
......
......@@ -2513,6 +2513,23 @@
//==========================================================================
//
// [TRSR] AddPostloadFiles
//
//==========================================================================
static void AddPostloadFiles()
{
if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-nopostload"))
{
// [TRSR] Add any .wad or .pk3 files in the postload directory
// Under Unix looks into SHARE_DIR, progdir and HOME/.zdoom dir.
// Under Windows looks into progdir and HOME/.zdoom dir.
D_AddSubdirectory ( "postload" );
}
}
//==========================================================================
//
// CheckCmdLine
//
//==========================================================================
......@@ -2823,6 +2840,9 @@
exec->AddPullins(allwads);
}
// [TRSR] Add any files in postload directory
AddPostloadFiles();
// Since this function will never leave we must delete this array here manually.
pwads.Clear();
pwads.ShrinkToFit();
......
......@@ -87,7 +87,5 @@
//CREATE_GAMEMODE(domination, DOMINATION, "Domination", "DOM", "F1_DOM", GMF_TEAMGAME|GMF_PLAYERSEARNPOINTS|GMF_PLAYERSONTEAMS)
bool finished;
void DOMINATION_Init(void)
{
......@@ -92,5 +90,5 @@
void DOMINATION_Init(void)
{
if(!domination)
if ( !domination )
return;
......@@ -95,7 +93,5 @@
return;
finished = false;
for(unsigned int i = 0;i < level.info->SectorInfo.Points.Size();i++)
for ( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
{
level.info->SectorInfo.Points[i].disabled = false;
......@@ -100,5 +96,6 @@
{
level.info->SectorInfo.Points[i].disabled = false;
level.info->SectorInfo.Points[i].contesting.clear();
level.info->SectorInfo.Points[i].owner = TEAM_None;
domination_SetControlPointColor( i );
}
......@@ -106,5 +103,5 @@
void DOMINATION_Clear(void)
{
for( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
for ( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
{
......@@ -110,7 +107,8 @@
{
level.info->SectorInfo.Points[i].contesting.clear();
DOMINATION_SetOwnership( i, TEAM_None );
}
}
void DOMINATION_Tick(void)
{
......@@ -111,9 +109,9 @@
DOMINATION_SetOwnership( i, TEAM_None );
}
}
void DOMINATION_Tick(void)
{
if(!domination)
if ( !domination )
return;
......@@ -118,6 +116,6 @@
return;
if(finished)
if ( GAMEMODE_IsGameInResultSequence() )
return;
// [BB] Scoring is server-side.
......@@ -125,5 +123,5 @@
if ( NETWORK_InClientMode() )
return;
for( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
for ( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
{
......@@ -129,7 +127,5 @@
{
if( level.info->SectorInfo.Points[i].disabled )
continue;
std::set<int> newContesting;
unsigned int teamPlayers[MAX_TEAMS] = { 0 };
// [TRSR] Count number of players per team on the point.
......@@ -142,5 +138,5 @@
// [TRSR] Call event script to allow modders to say whether this player's contesting status counts.
// For example, if player is too high up or above 3D floor, a modder may not want them to be able to contest.
if (( !gameinfo.bAllowDominationContestScripts ) || ( GAMEMODE_HandleEvent( GAMEEVENT_DOMINATION_CONTEST, players[p].mo, i, 0, true ) != 0 ))
if (( !gameinfo.bAllowDominationContestScripts ) || ( GAMEMODE_HandleEvent( GAMEEVENT_DOMINATION_CONTEST, players[p].mo, i, 0, true ) != 0 )) {
teamPlayers[players[p].Team]++;
......@@ -146,3 +142,5 @@
teamPlayers[players[p].Team]++;
newContesting.insert( p );
}
}
......@@ -147,3 +145,11 @@
}
DOMINATION_SetContesting( i, newContesting );
if ( level.info->SectorInfo.Points[i].disabled )
continue;
if ( level.info->SectorInfo.Points[i].contesting.empty() )
continue;
// [TRSR] If the point is owned and one of that team's players is contesting, don't let the point swap.
......@@ -149,5 +155,5 @@
// [TRSR] If the point is owned and one of that team's players is contesting, don't let the point swap.
if( level.info->SectorInfo.Points[i].owner != TEAM_None && teamPlayers[level.info->SectorInfo.Points[i].owner] > 0 )
if ( level.info->SectorInfo.Points[i].owner != TEAM_None && teamPlayers[level.info->SectorInfo.Points[i].owner] > 0 )
continue;
// [TRSR] Figure out which team has the most contesters. Point will swap to them.
......@@ -155,7 +161,7 @@
unsigned int max = 0;
for ( int team = 0; team < MAX_TEAMS; team++ )
{
if( teamPlayers[team] > max )
if ( teamPlayers[team] > max )
{
max = teamPlayers[team];
winner = team;
......@@ -168,7 +174,7 @@
}
}
if( winner == TEAM_None )
if ( winner == TEAM_None )
continue;
// [TRSR] Trigger an event to allow denying of the capture.
......@@ -178,5 +184,5 @@
DOMINATION_SetOwnership( i, winner );
}
if(!(level.maptime % (sv_dominationscorerate * TICRATE)))
if ( level.maptime % ( sv_dominationscorerate * TICRATE ) == 0 )
{
......@@ -182,3 +188,3 @@
{
for(unsigned int i = 0;i < level.info->SectorInfo.Points.Size();i++)
for ( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
{
......@@ -184,4 +190,4 @@
{
if( level.info->SectorInfo.Points[i].disabled )
if ( level.info->SectorInfo.Points[i].disabled )
continue;
......@@ -186,8 +192,8 @@
continue;
if(level.info->SectorInfo.Points[i].owner != TEAM_None)
if ( level.info->SectorInfo.Points[i].owner != TEAM_None )
{
// [AK] Trigger an event script when this team gets a point from a point sector.
// The first argument is the team that owns the sector and the second argument is the name
// of the sector. Don't let event scripts change the result value to anything less than zero.
LONG lResult = MAX<LONG>( GAMEMODE_HandleEvent( GAMEEVENT_DOMINATION_POINT, NULL, level.info->SectorInfo.Points[i].owner, i, true ), 0 );
......@@ -189,11 +195,11 @@
{
// [AK] Trigger an event script when this team gets a point from a point sector.
// The first argument is the team that owns the sector and the second argument is the name
// of the sector. Don't let event scripts change the result value to anything less than zero.
LONG lResult = MAX<LONG>( GAMEMODE_HandleEvent( GAMEEVENT_DOMINATION_POINT, NULL, level.info->SectorInfo.Points[i].owner, i, true ), 0 );
if ( lResult != 0 )
if (( lResult != 0 ) && (( TEAM_GetPointCount( level.info->SectorInfo.Points[i].owner ) < pointlimit ) || ( pointlimit == 0 )))
TEAM_SetPointCount( level.info->SectorInfo.Points[i].owner, TEAM_GetPointCount( level.info->SectorInfo.Points[i].owner ) + lResult, false );
}
}
}
......@@ -196,19 +202,6 @@
TEAM_SetPointCount( level.info->SectorInfo.Points[i].owner, TEAM_GetPointCount( level.info->SectorInfo.Points[i].owner ) + lResult, false );
}
}
}
// [TRSR] Check this every tick in case a modder gives score via non-control point means.
if( pointlimit )
{
for( int team = 0; team < MAX_TEAMS; team++ )
{
if( TEAM_GetPointCount( team ) >= pointlimit )
{
DOMINATION_WinSequence(0);
break;
}
}
}
}
......@@ -213,4 +206,4 @@
}
void DOMINATION_WinSequence(unsigned int winner)
void DOMINATION_SetContesting(unsigned int point, std::set<int> contesting)
{
......@@ -216,4 +209,7 @@
{
if(!domination)
if ( !domination )
return;
if ( point >= level.info->SectorInfo.Points.Size() )
return;
......@@ -218,7 +214,13 @@
return;
finished = true;
if ( contesting == level.info->SectorInfo.Points[point].contesting )
return;
level.info->SectorInfo.Points[point].contesting = contesting;
if ( NETWORK_GetState() == NETSTATE_SERVER )
SERVERCOMMANDS_SetDominationPointState( point, level.info->SectorInfo.Points[point] );
}
void DOMINATION_SetDisabled(unsigned int point, bool disabled)
{
......@@ -221,7 +223,7 @@
}
void DOMINATION_SetDisabled(unsigned int point, bool disabled)
{
if( !domination )
if ( !domination )
return;
......@@ -226,5 +228,5 @@
return;
if( point >= level.info->SectorInfo.Points.Size() )
if ( point >= level.info->SectorInfo.Points.Size() )
return;
......@@ -229,9 +231,9 @@
return;
if( level.info->SectorInfo.Points[point].disabled == disabled )
if ( level.info->SectorInfo.Points[point].disabled == disabled )
return;
level.info->SectorInfo.Points[point].disabled = disabled;
domination_SetControlPointColor( point );
if( NETWORK_GetState() == NETSTATE_SERVER )
......@@ -232,11 +234,11 @@
return;
level.info->SectorInfo.Points[point].disabled = disabled;
domination_SetControlPointColor( point );
if( NETWORK_GetState() == NETSTATE_SERVER )
SERVERCOMMANDS_SetDominationPointState ( point, level.info->SectorInfo.Points[point] );
SERVERCOMMANDS_SetDominationPointState( point, level.info->SectorInfo.Points[point] );
}
void DOMINATION_SetOwnership(unsigned int point, unsigned int team, bool broadcast)
{
......@@ -239,7 +241,7 @@
}
void DOMINATION_SetOwnership(unsigned int point, unsigned int team, bool broadcast)
{
if(!domination)
if ( !domination )
return;
......@@ -244,9 +246,9 @@
return;
if(point >= level.info->SectorInfo.Points.Size())
if ( point >= level.info->SectorInfo.Points.Size() )
return;
if ( !TEAM_CheckIfValid( team ) && team != TEAM_None )
return;
// [TRSR] Need to save previous team for event script below.
......@@ -247,11 +249,11 @@
return;
if ( !TEAM_CheckIfValid( team ) && team != TEAM_None )
return;
// [TRSR] Need to save previous team for event script below.
int prevTeam = level.info->SectorInfo.Points[point].owner;
if( team == prevTeam )
unsigned int prevTeam = level.info->SectorInfo.Points[point].owner;
if ( team == prevTeam )
return;
if (( broadcast ) && ( !level.info->SectorInfo.Points[point].disabled )) {
......@@ -255,7 +257,7 @@
return;
if (( broadcast ) && ( !level.info->SectorInfo.Points[point].disabled )) {
if( team != TEAM_None ) {
if ( team != TEAM_None ) {
Printf( "\034%s%s" TEXTCOLOR_NORMAL " has taken control of %s.\n", TEAM_GetTextColorName( team ), TEAM_GetName( team ), level.info->SectorInfo.Points[point].name.GetChars() );
} else {
Printf( "\034%s%s" TEXTCOLOR_NORMAL " has lost control of %s.\n", TEAM_GetTextColorName( prevTeam ), TEAM_GetName( prevTeam ), level.info->SectorInfo.Points[point].name.GetChars() );
......@@ -270,7 +272,7 @@
// [TRSR] Let clients know about the change in management too.
if ( NETWORK_GetState() == NETSTATE_SERVER )
SERVERCOMMANDS_SetDominationPointOwner ( point, team, broadcast );
SERVERCOMMANDS_SetDominationPointOwner( point, team, broadcast );
}
static void domination_SetControlPointColor( unsigned int point )
......
......@@ -67,6 +67,5 @@
#include "team.h"
#include "sectinfo.h"
void DOMINATION_WinSequence(unsigned int winner);
void DOMINATION_Tick(void);
void DOMINATION_SetOwnership(unsigned int point, unsigned int team, bool broadcast = true);
......@@ -71,5 +70,6 @@
void DOMINATION_Tick(void);
void DOMINATION_SetOwnership(unsigned int point, unsigned int team, bool broadcast = true);
void DOMINATION_SetContesting(unsigned int point, std::set<int> contesting);
void DOMINATION_SetDisabled(unsigned int point, bool disabled);
void DOMINATION_Init(void);
void DOMINATION_Clear(void);
......
......@@ -1009,7 +1009,7 @@
int numPoints = 0;
int longestPointWidth = -1;
for ( int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
for ( unsigned int i = 0; i < level.info->SectorInfo.Points.Size(); i++ )
{
if ( level.info->SectorInfo.Points[i].disabled )
continue;
......
......@@ -754,6 +754,66 @@
// =================================================================================================
//
// [TRSR/AK] DCallVoteMenu
//
// The call vote menu, which automatically adds the list of eligible custom vote menus.
//
// =================================================================================================
class DCallVoteMenu : public DOptionMenu
{
DECLARE_CLASS( DCallVoteMenu, DOptionMenu )
public:
void Init( DMenu *parent, FOptionMenuDescriptor *desc )
{
const TArray<VOTETYPE_s> &votes = CALLVOTE_GetCustomVotes( );
for ( unsigned int i = 0; i < votes.Size( ); i++ )
{
if ( votes[i].menu.IsNotEmpty( ))
{
FOptionMenuItem *it = new FOptionMenuItemSubmenu( votes[i].menuName.GetChars( ), votes[i].menu.GetChars( ));
mCustomVoteItems.Push( it );
desc->mItems.Push( it );
}
}
Super::Init( parent, desc );
}
virtual void Close( void )
{
// [AK] When this menu closes, any custom vote menus that were added when it was opened must
// be removed from its descriptor and deleted now. Otherwise, the custom vote menus will be
// duplicated when this menu is opened again.
for ( unsigned int i = 0; i < mCustomVoteItems.Size( ); i++ )
{
for ( unsigned int j = 0; j < mDesc->mItems.Size( ); j++ )
{
if ( mDesc->mItems[j] == mCustomVoteItems[i] )
{
mDesc->mItems.Delete( j );
break;
}
}
delete mCustomVoteItems[i];
mCustomVoteItems[i] = nullptr;
}
mCustomVoteItems.Clear( );
Super::Close( );
}
private:
TDeletingArray<FOptionMenuItem *> mCustomVoteItems;
};
IMPLEMENT_CLASS( DCallVoteMenu )
// =================================================================================================
//
//
//
//
......
......@@ -820,6 +820,23 @@
return ( true );
}
//*****************************************************************************
//
std::string IPADDRESSBAN_s::GetExpirationAsString( void ) const
{
if (( tExpirationDate != 0 ) && ( tExpirationDate != -1 ))
{
struct tm *timeInfo = localtime( &tExpirationDate );
char tempBuffer[32];
strftime( tempBuffer, sizeof( tempBuffer ), "%m/%d/%Y %H:%M", timeInfo );
return tempBuffer;
}
// [AK] Return an empty string for permanent bans.
return "";
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
//-- CLASSES ---------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
......@@ -1240,14 +1257,7 @@
// Expiration date.
if ( bIncludeExpiration && _ipVector[ulIdx].tExpirationDate != 0 && _ipVector[ulIdx].tExpirationDate != -1 )
{
struct tm *pTimeInfo;
char szDate[32];
pTimeInfo = localtime( &(_ipVector[ulIdx].tExpirationDate) );
strftime( szDate, 32, "%m/%d/%Y %H:%M", pTimeInfo );
entryStream << "<" << szDate << ">";
}
entryStream << "<" << _ipVector[ulIdx].GetExpirationAsString( ) << ">";
// Comment.
if ( bIncludeComment && _ipVector[ulIdx].szComment[0] )
......
......@@ -195,10 +195,6 @@
private:
char szAddress[4][4];
const char* operator[] ( int i ) const
{
return szAddress[i];
}
public:
void Clear()
......@@ -258,6 +254,14 @@
return os << szAddress[0] << "." << szAddress[1] << "." << szAddress[2] << "." << szAddress[3];
}
const char* operator[] ( int i ) const
{
if (( i < 0 ) || ( i >= 4 ))
return nullptr;
return szAddress[i];
}
operator std::string () const
{
std::string stringRepresentation;
......@@ -313,6 +317,8 @@
// [RC] Time that the ban expires, or NULL for an infinite ban.
time_t tExpirationDate;
// [AK] Returns the expiration date and time as a string.
std::string GetExpirationAsString( void ) const;
};
//*****************************************************************************
......
......@@ -5532,6 +5532,7 @@
ASCF_GetControlPointInfo, // [TRSR] Added Domination functions.
ASCF_SetControlPointInfo,
ASCF_GetSkinProperty, // [TRSR]
ACSF_IsPlayerContestingControlPoint,
// ZDaemon
ACSF_GetTeamScore = 19620, // (int team)
......@@ -8012,7 +8013,7 @@
DOMINATION_SetOwnership( point, value );
break;
case POINTINFO_DISABLED:
DOMINATION_SetDisabled( point, static_cast<bool>(value) );
DOMINATION_SetDisabled( point, !!value );
break;
default:
return false;
......@@ -8021,6 +8022,19 @@
return true;
}
case ACSF_IsPlayerContestingControlPoint:
{
const int pln = args[0];
if ( !PLAYER_IsValidPlayerWithMo( pln ) )
return false;
const unsigned int point = args[1];
if ( point >= level.info->SectorInfo.Points.Size() )
return false;
return level.info->SectorInfo.Points[point].contesting.count( pln ) != 0;
}
case ACSF_ChangeTeamScore:
{
const ULONG ulTeam = static_cast<ULONG>( args[0] );
......
......@@ -68,7 +68,7 @@
for ( unsigned int i = 0; i < sectors.Size(); i++ )
{
if ( sectors[i] == players[ulPlayer].mo->Sector->sectornum )
if ( sectors[i] == static_cast<unsigned>( players[ulPlayer].mo->Sector->sectornum ))
return true;
}
......
......@@ -52,6 +52,7 @@
#include <memory>
#include "doomtype.h"
#include <set>
void SECTINFO_Load();
void SECTINFO_Parse(int lump);
......@@ -62,6 +63,7 @@
FString name;
TArray<unsigned int> sectors;
int owner;
std::set<int> contesting;
bool disabled;
bool PlayerInsidePoint( const ULONG ulPlayer );
......
......@@ -65,6 +65,9 @@
static TArray<IPList> g_ServerBans;
static TArray<IPList> g_ServerBanExemptions;
// [AK] Pending changes to the ban lists from the server console window.
static TArray<IPList> g_ServerConsoleBanUpdates;
static IPList g_MasterServerBans;
static IPList g_MasterServerBanExemptions;
......@@ -148,6 +151,46 @@
// Parse again periodically.
g_ulReParseTicker = sv_banfilereparsetime * TICRATE;
}
// [AK] Any pending changes to the ban lists that were made from the server
// console window should be applied now.
if ( g_ServerConsoleBanUpdates.Size( ) > 0 )
{
FString listString;
UCVarValue val;
for ( unsigned int i = 0; i < g_ServerConsoleBanUpdates.Size( ); i++ )
{
if ( i > 0 )
listString += ';';
listString += g_ServerConsoleBanUpdates[i].getFilename( );
}
val.String = listString.GetChars( );
// [AK] Update sv_banfile so that the ban files are loaded.
sv_banfile.SetGenericRep( val, CVAR_String );
// [AK] Refresh all of the ban lists that are loaded now.
for ( unsigned int i = 0; i < g_ServerConsoleBanUpdates.Size( ); i++ )
{
// Clear out the ban list, and then add all the bans in the ban list.
SERVERBAN_ClearBans( i );
for ( unsigned int j = 0; j < g_ServerConsoleBanUpdates[i].size( ); j++ )
{
const IPADDRESSBAN_s &entry = g_ServerConsoleBanUpdates[i].getVector( )[j];
std::string message;
SERVERBAN_GetBanList( )[i].addEntry( entry.szIP, "", entry.szComment, message, entry.tExpirationDate );
}
}
// [AK] Kick any players that might be banned now.
serverban_KickBannedPlayers( );
g_ServerConsoleBanUpdates.Clear( );
}
}
//*****************************************************************************
......@@ -519,6 +562,13 @@
//*****************************************************************************
//
void SERVERBAN_UpdateBansFromServerConsole( const TArray<IPList> &lists )
{
g_ServerConsoleBanUpdates = lists;
}
//*****************************************************************************
//
static void serverban_LoadFilesFromCVar( TArray<IPList> &lists, FStringCVar &cvar )
{
FString cvarValue = cvar.GetGenericRep( CVAR_String ).String;
......
......@@ -71,6 +71,7 @@
TArray<IPList> &SERVERBAN_GetBanList( void );
void SERVERBAN_BanPlayer( unsigned int player, const char *length, const char *reason, unsigned int fileIndex );
void SERVERBAN_BanAddress( const char *address, const char *length, const char *reason, unsigned int fileIndex );
void SERVERBAN_UpdateBansFromServerConsole( const TArray<IPList> &lists );
//--------------------------------------------------------------------------------------------------------------------------------------------------
//-- EXTERNAL CONSOLE VARIABLES --------------------------------------------------------------------------------------------------------------------
......
......@@ -85,6 +85,7 @@
#include "maprotation.h"
#include "voicechat.h"
#include "d_netinf.h"
#include "callvote.h"
#include <memory>
CVAR (Bool, sv_showwarnings, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
......@@ -2541,6 +2542,7 @@
command.addLong ( compatflags2 );
command.addLong ( zacompatflags );
command.addLong ( zadmflags );
command.addLong ( sv_forbidvoteflags );
command.sendCommandToClients( ulPlayerExtra, flags );
}
......@@ -2589,6 +2591,8 @@
command.addFloat( sv_maxproximityrolloffdist );
// [AK] Send sv_respawndelaytime.
command.addFloat( sv_respawndelaytime );
// [TRSR] Send sv_nocallvote.
command.addByte( sv_nocallvote );
command.sendCommandToClients( ulPlayerExtra, flags );
}
......@@ -2732,6 +2736,15 @@
ServerCommands::SetDominationPointState command;
command.SetPoint( ulPoint );
command.SetDisabled( state.disabled );
// [TRSR] This serves to initialize the contesters even with an empty list.
command.PushToContesters( 0 );
command.ClearContesters();
for ( std::set<int>::iterator it = state.contesting.begin(); it != state.contesting.end(); ++it )
{
command.PushToContesters( *it );
}
command.sendCommandToClients( ulPlayerExtra, flags );
}
......
......@@ -7442,9 +7442,9 @@
{
case VOTECMD_KICK:
bVoteAllowed = !sv_nokickvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_KICK );
sprintf( szCommand, "kick" );
break;
case VOTECMD_FORCETOSPECTATE:
......@@ -7446,11 +7446,11 @@
sprintf( szCommand, "kick" );
break;
case VOTECMD_FORCETOSPECTATE:
bVoteAllowed = !sv_noforcespecvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_FORCESPEC );
sprintf( szCommand, "forcespec" );
break;
case VOTECMD_MAP:
......@@ -7452,10 +7452,10 @@
sprintf( szCommand, "forcespec" );
break;
case VOTECMD_MAP:
bVoteAllowed = !sv_nomapvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_MAP );
sprintf( szCommand, "map" );
break;
case VOTECMD_CHANGEMAP:
......@@ -7458,9 +7458,9 @@
sprintf( szCommand, "map" );
break;
case VOTECMD_CHANGEMAP:
bVoteAllowed = !sv_nochangemapvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_CHANGEMAP );
sprintf( szCommand, "changemap" );
break;
case VOTECMD_FRAGLIMIT:
......@@ -7463,9 +7463,9 @@
sprintf( szCommand, "changemap" );
break;
case VOTECMD_FRAGLIMIT:
bVoteAllowed = !sv_nofraglimitvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_FRAGLIMIT );
sprintf( szCommand, "fraglimit" );
break;
case VOTECMD_TIMELIMIT:
......@@ -7468,9 +7468,9 @@
sprintf( szCommand, "fraglimit" );
break;
case VOTECMD_TIMELIMIT:
bVoteAllowed = !sv_notimelimitvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_TIMELIMIT );
sprintf( szCommand, "timelimit" );
break;
case VOTECMD_WINLIMIT:
......@@ -7473,9 +7473,9 @@
sprintf( szCommand, "timelimit" );
break;
case VOTECMD_WINLIMIT:
bVoteAllowed = !sv_nowinlimitvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_WINLIMIT );
sprintf( szCommand, "winlimit" );
break;
case VOTECMD_DUELLIMIT:
......@@ -7478,9 +7478,9 @@
sprintf( szCommand, "winlimit" );
break;
case VOTECMD_DUELLIMIT:
bVoteAllowed = !sv_noduellimitvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_DUELLIMIT );
sprintf( szCommand, "duellimit" );
break;
case VOTECMD_POINTLIMIT:
......@@ -7483,9 +7483,9 @@
sprintf( szCommand, "duellimit" );
break;
case VOTECMD_POINTLIMIT:
bVoteAllowed = !sv_nopointlimitvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_POINTLIMIT );
sprintf( szCommand, "pointlimit" );
break;
case VOTECMD_FLAG:
......@@ -7488,9 +7488,9 @@
sprintf( szCommand, "pointlimit" );
break;
case VOTECMD_FLAG:
bVoteAllowed = !sv_noflagvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_FLAG );
sprintf( szCommand, "flag" );
break;
case VOTECMD_NEXTMAP:
......@@ -7493,9 +7493,9 @@
sprintf( szCommand, "flag" );
break;
case VOTECMD_NEXTMAP:
bVoteAllowed = !sv_nonextmapvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_NEXTMAP );
sprintf( szCommand, "nextmap" );
break;
case VOTECMD_NEXTSECRET:
......@@ -7498,9 +7498,9 @@
sprintf( szCommand, "nextmap" );
break;
case VOTECMD_NEXTSECRET:
bVoteAllowed = !sv_nonextsecretvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_NEXTSECRET );
sprintf( szCommand, "nextsecret" );
break;
case VOTECMD_RESETMAP:
......@@ -7503,10 +7503,10 @@
sprintf( szCommand, "nextsecret" );
break;
case VOTECMD_RESETMAP:
bVoteAllowed = !sv_noresetmapvote;
bVoteAllowed = !( sv_forbidvoteflags & FORBIDVOTE_RESETMAP );
sprintf( szCommand, "resetmap" );
break;
default:
{
......@@ -7508,10 +7508,10 @@
sprintf( szCommand, "resetmap" );
break;
default:
{
const VOTETYPE_s* pVoteType = CALLVOTE_GetCustomVoteTypeDefinition( ulVoteCmd );
if ( pVoteType == nullptr )
const VOTETYPE_s *customVoteType = CALLVOTE_GetCustomVoteTypeDefinition( ulVoteCmd );
if ( customVoteType == nullptr )
{
return ( false );
}
......@@ -7515,9 +7515,9 @@
{
return ( false );
}
else if ( pVoteType->forbidCvarName.IsEmpty() )
else if ( customVoteType->forbidCvarName.IsEmpty() )
{
bVoteAllowed = true;
}
else
{
......@@ -7519,8 +7519,8 @@
{
bVoteAllowed = true;
}
else
{
FBaseCVar* cvar = FindCVar( pVoteType->forbidCvarName, nullptr );
FBaseCVar* cvar = FindCVar( customVoteType->forbidCvarName, nullptr );
bVoteAllowed = cvar && ( cvar->GetGenericRep( CVAR_Bool ).Bool == false );
}
......@@ -7525,5 +7525,9 @@
bVoteAllowed = cvar && ( cvar->GetGenericRep( CVAR_Bool ).Bool == false );
}
// [TRSR] Perform any necessary pre-vote conversions.
CALLVOTE_ConvertCustomVoteParameter( customVoteType, Parameters );
// [TP] Put the name of the vote type into the command for the vote module to work with this
// (we won't actually execute it as a command but run the script instead if and when the vote
// does pass)
......@@ -7527,7 +7531,8 @@
// [TP] Put the name of the vote type into the command for the vote module to work with this
// (we won't actually execute it as a command but run the script instead if and when the vote
// does pass)
snprintf( szCommand, sizeof szCommand, "%s", pVoteType->name.GetChars() );
// [TRSR] If the vote isn't allowed, we should use the display name for the error.
snprintf( szCommand, sizeof szCommand, "%s", bVoteAllowed ? customVoteType->name.GetChars() : customVoteType->displayName.GetChars() );
}
}
......
......@@ -38,7 +38,6 @@
#define IDD_BANLIST 155
#define IDD_KICKBAN 156
#define IDD_CHANGEMAP 157
#define IDD_EDITBAN 159
#define IDD_GENERALSETTINGS 160
// 161 was the old kick dialog, which
......@@ -95,7 +94,6 @@
#define IDC_BANFILE 1049
#define IDC_REASON 1049
#define IDC_MAPNAME 1049
#define IDC_BANBOX 1049
#define IDC_INPUTBOX 1049
#define IDC_LOGFILE 1049
#define IDC_PASSWORD 1049
......