29 #include "../idlib/precompiled.h"
35 #define LASTMAN_NOLIVES -20
42 "sound/feedback/voc_youwin.wav",
43 "sound/feedback/voc_youlose.wav",
44 "sound/feedback/fight.wav",
45 "sound/feedback/vote_now.wav",
46 "sound/feedback/vote_passed.wav",
47 "sound/feedback/vote_failed.wav",
48 "sound/feedback/three.wav",
49 "sound/feedback/two.wav",
50 "sound/feedback/one.wav",
51 "sound/feedback/sudden_death.wav",
53 "sound/ctf/flag_capped_yours.wav",
54 "sound/ctf/flag_capped_theirs.wav",
55 "sound/ctf/flag_return.wav",
56 "sound/ctf/flag_taken_yours.wav",
57 "sound/ctf/flag_taken_theirs.wav",
58 "sound/ctf/flag_dropped_yours.wav",
59 "sound/ctf/flag_dropped_theirs.wav"
125 player_blue_flag = -1;
126 player_red_flag = -1;
154 int n = str.
Find(
";" );
156 skin = str.
Left( n );
162 if ( skin.
Icmp( uiSkin ) == 0 ) {
307 if ( !player || !player->
hud ) {
329 void idMultiplayerGame::ClearHUDStatus(
void ) {
335 if ( !player || !player->
hud ) {
359 int idMultiplayerGame::GetFlagPoints(
int team )
363 return teamPoints[ team ];
378 memset( players, 0,
sizeof( players ) );
383 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
386 player =
static_cast< idPlayer *
>( ent );
402 if ( player->
team != players[ j ]->
team ) {
418 for ( k = numRankedPlayers; k >
j; k-- ) {
419 players[ k ] = players[ k-1 ];
421 players[
j ] = player;
425 if ( j == numRankedPlayers ) {
441 for (
int j = 1;
j < 4;
j++ ) {
473 scoreBoard->
SetStateInt(
va(
"player%i_tdm_score", iline ), value );
475 scoreBoard->
SetStateString(
va(
"player%i_tdm_tscore", iline ),
va(
"/ %i", value ) );
479 scoreBoard->
SetStateInt(
va(
"player%i_score", iline ), value );
485 scoreBoard->
SetStateInt(
va(
"player%i_wins", iline ), value );
503 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
506 if ( gameState !=
WARMUP ) {
513 if ( j != numRankedPlayers ) {
517 p =
static_cast< idPlayer *
>( ent );
518 if ( gameState ==
WARMUP ) {
535 if ( gameState ==
WARMUP ) {
573 while ( iline < MAX_CLIENTS ) {
575 while ( iline < 5 ) {
626 int ilines[2] = {0,0};
629 char redTeam[] =
"red";
630 char blueTeam[] =
"blue";
631 char *curTeam =
NULL;
637 if ( this->player_blue_flag == -1 )
640 if ( this->player_red_flag == -1 )
643 if ( gameState !=
WARMUP ) {
649 if ( player->
team == 0 )
656 ilines[ player->
team ]++;
674 scoreBoard->
SetStateInt(
va(
"player%i_%s_score", ilines[ player->
team ], curTeam ), value );
683 scoreBoard->
SetStateInt(
va(
"player%i_%s_wins", ilines[ player->
team ], curTeam ), value );
693 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
697 if ( gameState !=
WARMUP ) {
705 if ( j != numRankedPlayers ) {
710 player =
static_cast< idPlayer *
>( ent );
715 if ( player->
team == 0 )
720 ilines[ player->
team ]++;
741 if ( gameState ==
WARMUP ) {
760 for ( i = 0; i < 2; i++ )
767 for ( j = ilines[ i ]+1; j <= 8; j++ )
784 if ( captureLimit > MP_CTF_MAXPOINTS )
785 captureLimit = MP_CTF_MAXPOINTS;
805 scoreBoard->
SetStateInt(
"red_team_score", GetFlagPoints( 0 ) );
806 scoreBoard->
SetStateInt(
"blue_team_score", GetFlagPoints( 1 ) );
826 static char buff[16];
833 strcpy( buff,
"WMP --" );
854 sprintf( buff,
"%i:%i%i", m, t, s );
869 teamcounts[ 0 ] = teamcounts[ 1 ] = 0;
873 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
876 p =
static_cast< idPlayer *
>( ent );
877 if ( countSpectators ||
CanPlay( p ) ) {
880 if ( teamcounts &&
CanPlay( p ) ) {
881 teamcounts[ p->
team ]++;
896 return clients >= 2 && team[ 0 ] && team[ 1 ];
918 if ( !team[ 0 ] || !team[ 1 ] ) {
932 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
935 p =
static_cast< idPlayer *
>( ent );
967 if ( fragLimit <= 0 ) {
973 assert( !static_cast< idPlayer * >( leader )->lastManOver );
976 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
979 if ( !
CanPlay( static_cast< idPlayer * >( ent ) ) ) {
982 if ( ent == leader ) {
1028 int idMultiplayerGame::WinningTeam(
void ) {
1029 if ( teamPoints[0] > teamPoints[1] )
1031 if ( teamPoints[0] < teamPoints[1] )
1041 bool idMultiplayerGame::PointLimitHit(
void ) {
1045 if ( pointLimit > MP_CTF_MAXPOINTS )
1046 pointLimit = MP_CTF_MAXPOINTS;
1047 else if ( pointLimit <= 0 )
1048 pointLimit = MP_CTF_MAXPOINTS;
1050 if ( teamPoints[0] == teamPoints[1] )
1053 if ( teamPoints[0] >= pointLimit ||
1054 teamPoints[1] >= pointLimit )
1076 bool teamLead[ 2 ] = {
false,
false };
1080 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1083 if ( !
CanPlay( static_cast< idPlayer * >( ent ) ) ) {
1089 if ( static_cast< idPlayer * >( ent )->lastManOver ) {
1094 if ( fragc > high ) {
1103 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1106 p =
static_cast< idPlayer *
>( ent );
1122 if ( frags[ i ] >= high ) {
1127 teamLead[ p->
team ] =
true;
1140 if ( teamLead[ 0 ] && teamLead[ 1 ] ) {
1158 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1163 if ( player == winner || ( player != winner && player->
team == winner->
team ) ) {
1170 if ( player == winner ) {
1177 if ( player == winner ) {
1184 if ( player == winner ) {
1195 int winteam = WinningTeam();
1197 if ( winteam != -1 )
1200 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1205 if ( player->
team == winteam ) {
1227 void idMultiplayerGame::TeamScoreCTF(
int team,
int delta ) {
1228 if ( team < 0 || team > 1 )
1231 teamPoints[team] += delta;
1242 void idMultiplayerGame::PlayerScoreCTF(
int playerIdx,
int delta ) {
1243 if ( playerIdx < 0 || playerIdx >= MAX_CLIENTS )
1254 int idMultiplayerGame::GetFlagCarrier(
int team ) {
1255 int iFlagCarrier = -1;
1259 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1264 if ( player->
team != team )
1267 if ( player->carryingFlag ) {
1268 if ( iFlagCarrier != -1 )
1269 gameLocal.
Warning(
"BUG: more than one flag carrier on %s team", team == 0 ?
"red" :
"blue" );
1274 return iFlagCarrier;
1290 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1294 if ( player->
team == team ) {
1315 if ( killer == dead || killer->
team == dead->
team ) {
1326 if ( killer && killer == dead ) {
1328 }
else if ( killer ) {
1361 if ( ent && ent->
IsType( idPlayer::Type ) ) {
1362 team =
static_cast< idPlayer *
>(ent)->team;
1406 assert( news != gameState );
1412 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
1429 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1442 if ( !static_cast<idPlayer *>(ent)->wantSpectate ) {
1443 static_cast<idPlayer *
>(ent)->ServerSpectate(
false );
1462 SetFlagMsg(
false );
1468 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1471 static_cast< idPlayer *
>( ent )->forcedReady =
false;
1472 static_cast<idPlayer *
>(ent)->ServerSpectate(
true );
1491 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
1507 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1529 int i,
j, rankmax, rankmaxindex;
1534 for ( i = 0; i < 2; i++ ) {
1542 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1548 p =
static_cast< idPlayer *
>( ent );
1555 assert( rankmaxindex >= 0 );
1560 rankmax =
static_cast< idPlayer *
>( ent )->tourneyRank;
1577 int i,
j, imax,
max, globalmax = -1;
1586 max = -1; imax = -1;
1606 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
1630 if ( ent && ent->
IsType( idPlayer::Type ) ) {
1642 if ( ent && ent->
IsType( idPlayer::Type ) ) {
1669 if ( needRestart ) {
1679 if ( needRestart ) {
1700 if ( needRestart ) {
1737 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
1768 return ( gameState ==
WARMUP );
1779 int gameReviewPause;
1810 switch( gameState ) {
1830 flag = GetTeamFlag( 0 );
1834 flag = GetTeamFlag( 1 );
1847 if ( ent && ent->
IsType( idPlayer::Type ) ) {
1848 if ( !static_cast< idPlayer * >( ent )->wantSpectate ) {
1862 warmupText =
"Warming up.. waiting for players to get ready";
1868 if ( timeLeft == 3 && !
three ) {
1871 }
else if ( timeLeft == 2 && !
two ) {
1874 }
else if ( timeLeft == 1 && !
one ) {
1885 if ( PointLimitHit() ) {
1886 int team = WinningTeam();
1892 int team = WinningTeam();
1938 int team = WinningTeam();
1978 if ( strReady.
Icmp(
"ready") == 0 ){
2006 #if defined( __linux__ )
2049 bool callvote_ok =
false;
2067 if ( kickList.
Length() ) {
2082 for ( i = 0; i <
num; i++ ) {
2092 if ( gametypeList.
Length() ) {
2093 gametypeList +=
";";
2146 if ( mapNum >= 0 ) {
2165 if ( !_menuCommand[ 0 ] ) {
2166 common->
Printf(
"idMultiplayerGame::HandleGuiCommands: empty command\n" );
2178 for( icmd = 0; icmd < args.
Argc(); ) {
2179 const char *cmd = args.
Argv( icmd++ );
2185 if ( args.
Argc() - icmd >= 1 ) {
2186 vcmd = args.
Argv( icmd++ );
2193 }
else if (
idStr::Icmp( vcmd,
"medium" ) == 0 ) {
2199 }
else if (
idStr::Icmp( vcmd,
"recommended" ) == 0 ) {
2215 if ( args.
Argc() - icmd >= 1 ) {
2218 if ( snd.
Length() == 1 ) {
2219 channel = atoi( snd );
2220 snd = args.
Argv( icmd++ );
2227 if ( args.
Argc() - icmd >= 1 ) {
2228 skin = args.
Argv( icmd++ );
2246 }
else if ( !
idStr::Icmp( cmd,
"chatmessage" ) ) {
2260 }
else if ( !
idStr::Icmp( cmd,
"readytoggle" ) ) {
2272 if ( mapNum >= 0 ) {
2281 vote_clientNum =
kickVoteMap[ atoi( voteValue ) ];
2309 if ( args.
Argc() - icmd >= 2 ) {
2317 if ( args.
Argc() - icmd >= 1 ) {
2325 if ( gametype ==
NULL || *gametype == 0 ||
idStr::Icmp( gametype,
"singleplayer" ) == 0 ) {
2326 gametype =
"Deathmatch";
2336 for ( i = 0; i <
num; i++ ) {
2350 const char *mapName = dict->
GetString(
"name" );
2351 if ( mapName[0] ==
'\0' ) {
2365 }
else if ( !
idStr::Icmp( cmd,
"click_maplist" ) ) {
2368 }
else if ( strstr( cmd,
"sound" ) == cmd ) {
2370 return _menuCommand;
2372 common->
Printf(
"idMultiplayerGame::HandleGuiCommands: '%s' unknown\n", cmd );
2398 if ( player ==
NULL ) {
2404 if ( viewPlayer ==
NULL ) {
2421 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
2448 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
2457 idStr spectatetext[ 2 ];
2486 }
else if ( !ispecline ) {
2519 if ( gameState ==
WARMUP ) {
2535 if ( gameState ==
GAMEON ) {
2552 for ( i = ( gameState ==
GAMEON ? numRankedPlayers : 0 ) ; i < 5; i++ ) {
2582 UpdateCTFScoreboard( scoreBoard, player );
2615 va_start( argptr, fmt );
2696 msg.
WriteBits( value, ASYNC_PLAYER_FRAG_BITS );
2698 msg.
WriteBits( value, ASYNC_PLAYER_FRAG_BITS );
2700 msg.
WriteBits( value, ASYNC_PLAYER_WINS_BITS );
2702 msg.
WriteBits( value, ASYNC_PLAYER_PING_BITS );
2724 if ( newState != gameState ) {
2726 gameState = newState;
2728 if ( gameState ==
GAMEON ) {
2779 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
2783 if ( !shaderDecl ) {
2803 void idMultiplayerGame::PlayTeamSound(
int toTeam,
snd_evt_t evt,
const char *shader ) {
2806 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
2810 if ( player->
team != toTeam )
2829 assert( parm1 >= 0 && parm2 >= 0 );
2833 assert( parm1 >= 0 && parm2 >= 0 );
2837 assert( parm1 >= 0 && parm2 >= 0 );
2878 case MSG_POINTLIMIT:
2882 case MSG_FLAGTAKEN :
2886 if ( parm2 < 0 || parm2 >= MAX_CLIENTS )
2907 case MSG_FLAGRETURN :
2911 if ( parm2 >= 0 && parm2 < MAX_CLIENTS ) {
2922 case MSG_FLAGCAPTURE :
2926 if ( parm2 < 0 || parm2 >= MAX_CLIENTS )
2938 case MSG_SCOREUPDATE:
2949 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
2994 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
3030 }
else if ( gameState ==
WARMUP ) {
3053 common->
DPrintf(
"client %d has lost all last man lives\n", i );
3106 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
3124 common->
Printf(
"forceReady: multiplayer server only\n" );
3138 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
3151 common->
Printf(
"clientDropWeapon: only valid in multiplayer\n" );
3156 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
3180 common->
Printf(
"clientMessageMode: only valid in multiplayer\n" );
3187 mode = args.
Argv( 1 );
3191 imode = atoi( mode );
3252 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
3285 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
3340 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
3361 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
3371 common->
DPrintf(
"client %d: cast vote while no vote in progress\n", clientNum );
3398 int vote_timeLimit, vote_fragLimit, vote_clientNum, vote_gameTypeIndex;
3401 assert( clientNum != -1 );
3410 common->
DPrintf(
"client %d: called vote while voting already in progress - ignored\n", clientNum );
3413 switch ( voteIndex ) {
3423 vote_timeLimit = strtol( value,
NULL, 10 );
3426 common->
DPrintf(
"client %d: already at the voted Time Limit\n", clientNum );
3431 common->
DPrintf(
"client %d: timelimit value out of range for vote: %s\n", clientNum, value );
3438 vote_fragLimit = strtol( value,
NULL, 10 );
3441 common->
DPrintf(
"client %d: already at the voted Frag Limit\n", clientNum );
3446 common->
DPrintf(
"client %d: fraglimit value out of range for vote: %s\n", clientNum, value );
3453 vote_gameTypeIndex = strtol( value,
NULL, 10 );
3455 assert( vote_gameTypeIndex > 0 && vote_gameTypeIndex < GAME_COUNT );
3485 common->
DPrintf(
"client %d: already at the voted Game Type\n", clientNum );
3492 vote_clientNum = strtol( value,
NULL, 10 );
3495 common->
DPrintf(
"client %d: called kick for the server host\n", clientNum );
3504 common->
DPrintf(
"client %d: already running the voted map: %s\n", clientNum, value );
3510 bool haveMap =
false;
3511 for ( i = 0; i <
num; i++ ) {
3520 common->
Printf(
"client %d: map not found: %s\n", clientNum, value );
3538 common->
DPrintf(
"client %d: unknown vote index %d\n", clientNum, voteIndex );
3564 for ( i = 0; i < 2; i++ ) {
3576 for ( i = 0; i < 2; i++ ) {
3598 if ( ent && ent->
IsType( idPlayer::Type ) ) {
3599 static_cast<idPlayer *
>( ent )->Kill(
false,
false );
3612 if ( gameState !=
WARMUP ) {
3633 if ( static_cast< idPlayer* >(
gameLocal.
entities[ clientNum ] )->BalanceTDM() ) {
3654 assert( oldteam != newteam );
3662 if ( i == clientNum ) {
3666 if ( ent && ent->
IsType( idPlayer::Type ) &&
static_cast< idPlayer *
>(ent)->team == newteam ) {
3679 if ( gameState ==
GAMEON && oldteam != -1 ) {
3687 p->
Kill(
true,
true );
3710 const char *prefix =
NULL;
3715 idStr prefixed_name;
3719 if ( clientNum >= 0 ) {
3721 if ( !( p && p->
IsType( idPlayer::Type ) ) ) {
3726 prefix =
"spectating";
3734 }
else if ( team ) {
3747 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
3750 prefixed_name =
va(
"(%s) %s", prefix, name );
3752 prefixed_name =
name;
3765 if ( !ent || !ent->
IsType( idPlayer::Type ) ) {
3768 if ( send_to == 1 && static_cast< idPlayer * >( ent )->spectating ) {
3777 }
else if ( send_to == 2 && static_cast< idPlayer * >( ent )->team == p->
team ) {
3809 int n = str.
Find(
";" );
3811 skin = str.
Left( n );
3985 common->
Printf(
"clientVoiceChat: only valid in multiplayer\n" );
3988 if ( args.
Argc() != 2 ) {
3997 voc = args.
Argv( 1 );
4005 keyval = spawnArgs->
MatchPrefix(
"snd_voc_", keyval );
4009 common->
Printf(
"Voice command not found: %s\n", voc );
4014 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
4035 if ( !( p && p->
IsType( idPlayer::Type ) ) ) {
4046 while ( index > 0 && keyval ) {
4047 keyval = spawnArgs->
MatchPrefix(
"snd_voc_", keyval );
4051 common->
DPrintf(
"ProcessVoiceChat: unknown chat index %d\n", index );
4054 snd_key = keyval->
GetKey();
4076 outMsg.
Init( msgBuf,
sizeof( msgBuf ) );
4086 if ( i != clientNum && ent && ent->
IsType( idPlayer::Type ) ) {
4088 outMsg.
WriteShort( static_cast< idPlayer * >( ent )->inventory.powerups );
4089 outMsg.
WriteBits( static_cast< idPlayer * >( ent )->spectating, 1 );
4116 int i, client, powerup;
4122 while ( ( client = msg.
ReadShort() ) != MAX_CLIENTS ) {
4126 if ( powerup & ( 1 << i ) ) {
4130 bool spectate = ( msg.
ReadBits( 1 ) != 0 );
4175 assert( !
"Add support for your new gametype here." );
4202 assert( !
"Add support for your new gametype here." );
4215 idItemTeam * idMultiplayerGame::GetTeamFlag(
int team ) {
4216 assert( team == 0 || team == 1 );
4224 return teamFlags[team];
4232 void idMultiplayerGame::FindTeamFlags(
void ) {
4233 const char * flagDefs[2] =
4239 for (
int i = 0; i < 2; i++)
4244 if ( entity ==
NULL )
4247 idItemTeam * flag =
static_cast<idItemTeam *
>(entity);
4249 if ( flag->team == i )
4251 teamFlags[
i] = flag;
4265 flagStatus_t idMultiplayerGame::GetFlagStatus(
int team ) {
4268 idItemTeam *teamFlag = GetTeamFlag( team );
4271 if ( teamFlag !=
NULL ) {
4272 if ( teamFlag->carried ==
false && teamFlag->dropped ==
false )
4273 return FLAGSTATUS_INBASE;
4275 if ( teamFlag->carried ==
true )
4276 return FLAGSTATUS_TAKEN;
4278 if ( teamFlag->carried ==
false && teamFlag->dropped ==
true )
4279 return FLAGSTATUS_STRAY;
4283 return FLAGSTATUS_NONE;
4291 void idMultiplayerGame::SetFlagMsg(
bool b ) {
4300 bool idMultiplayerGame::IsFlagMsgOn(
void ) {
4310 void idMultiplayerGame::SetBestGametype(
const char * map ) {
4316 for ( i = 0; i <
num; i++ ) {
4343 void idMultiplayerGame::ReloadScoreboard() {
4346 scoreBoard =
uiManager->
FindGui(
"guis/ctfscoreboard.gui",
true,
false,
true );
4348 scoreBoard =
uiManager->
FindGui(
"guis/scoreboard.gui",
true,
false,
true );
4357 idStr idMultiplayerGame::GetBestGametype(
const char* map,
const char* gametype ) {
4362 for ( i = 0; i <
num; i++ ) {
4378 return "deathmatch";
idPlayer * GetLocalPlayer() const
void DrawScoreBoard(idPlayer *player)
void VoiceChat(const idCmdArgs &args, bool team)
void LocalMapRestart(void)
virtual void SetCVarInteger(const char *name, const int value, int flags=0)=0
virtual idFile * OpenFileRead(const char *relativePath, bool allowCopyFiles=true, const char *gamedir=NULL)=0
static int snPrintf(char *dest, int size, const char *fmt,...) id_attribute((format(printf
bool IsGametypeTeamBased(void)
GLsizei const GLfloat * value
int ReadShort(void) const
virtual void Add(int id, const idStr &s)=0
void ClientReadWarmupTime(const idBitMsg &msg)
int GetInt(const char *key, const char *defaultString="0") const
void ProcessVoiceChat(int clientNum, bool team, int index)
assert(prefInfo.fullscreenBtn)
virtual const idSoundShader * FindSound(const char *name, bool makeDefault=true)=0
virtual void StateChanged(int time, bool redraw=false)=0
const idDict * FindEntityDefDict(const char *name, bool makeDefault=true) const
idUserInterface * scoreBoard
idCVarSystem * cvarSystem
idUserInterface * mainGui
const char * HandleGuiCommands(const char *menuCommand)
idNetworkSystem * networkSystem
idPlayer * FragLimitHit(void)
void PlayerStats(int clientNum, char *data, const int len)
void Printf(const char *fmt,...) const id_attribute((format(printf
virtual void SetStateString(const char *varName, const char *value)=0
void SetLeader(bool lead)
virtual void virtual void virtual const idLangDict * GetLanguageDict(void)=0
static void MessageMode_f(const idCmdArgs &args)
const idStr & GetKey(void) const
const int MP_PLAYER_MINFRAGS
void UpdateScoreboard(idUserInterface *scoreBoard, idPlayer *player)
void PlayGlobalSound(int to, snd_evt_t evt, const char *shader=NULL)
const int NUM_CHAT_NOTIFY
void ClientCallVote(vote_flags_t voteIndex, const char *voteValue)
void UpdateRankColor(idUserInterface *gui, const char *mask, int i, const idVec3 &vec)
void SwitchToTeam(int clientNum, int oldteam, int newteam)
bool IsType(const idTypeInfo &c) const
void EnterGame(int clientNum)
void SpawnPlayer(int clientNum)
virtual int GetNumMaps()=0
void RenderPlayerView(idUserInterface *hud)
void CheckAbortGame(void)
virtual int GetCVarInteger(const char *name) const =0
virtual void PlayShaderDirectly(const char *name, int channel=-1)=0
void WantKilled(int clientNum)
const idKeyValue * MatchPrefix(const char *prefix, const idKeyValue *lastMatch=NULL) const
const int ASYNC_PLAYER_PING_BITS
static const char * MPGuis[]
idCVar g_spectatorChat("g_spectatorChat","0", CVAR_GAME|CVAR_ARCHIVE|CVAR_BOOL,"let spectators talk to everyone during game")
idFileSystem * fileSystem
void WriteBits(int value, int numBits)
void PrintMessageEvent(int to, msg_evt_t evt, int parm1=-1, int parm2=-1)
static const char * GameStateStrings[STATE_COUNT]
const char * GetName(void) const
idCVar si_gameType("si_gameType", si_gameTypeArgs[0], CVAR_GAME|CVAR_SERVERINFO|CVAR_ARCHIVE,"game type - singleplayer, deathmatch, Tourney, Team DM or Last Man", si_gameTypeArgs, idCmdSystem::ArgCompletion_String< si_gameTypeArgs >)
bool EnoughClientsToPlay(void)
void CheckRespawns(idPlayer *spectator=NULL)
virtual void HandleNamedEvent(const char *eventName)=0
virtual void FindMapScreenshot(const char *path, char *buf, int len)=0
const char * Left(int len, idStr &result) const
const int MP_PLAYER_MAXPING
virtual void SetCVarString(const char *name, const char *value, int flags=0)=0
virtual void SetKeyBindingNames(void)=0
int ReadString(char *buffer, int bufferSize) const
virtual void SetStateInt(const char *varName, const int value)=0
void WriteString(const char *s, int maxLength=-1, bool make7Bit=true)
int ReadBits(int numBits) const
void ClientUpdateVote(vote_result_t result, int yesCount, int noCount)
void ServerStartVote(int clientNum, vote_flags_t voteIndex, const char *voteValue)
static int ClampInt(int min, int max, int value)
void ThrottleUserInfo(void)
idUserInterfaceManager * uiManager
idMultiplayerGame::gameState_t GetGameState(void) const
int currentTourneyPlayer[2]
int Icmp(const char *text) const
idSoundWorld * gameSoundWorld
void PlayerDeath(idPlayer *dead, idPlayer *killer, bool telefrag)
virtual void SetStateBool(const char *varName, const bool value)=0
void Init(byte *data, int length)
virtual idUserInterface * FindGui(const char *qpath, bool autoLoad=false, bool needUnique=false, bool forceUnique=false)=0
virtual void HidePlayerIcons(void)
void UpdateTourneyLine(void)
void DumpTourneyLine(void)
virtual void SetStateFloat(const char *varName, const float value)=0
void void void Warning(const char *fmt,...) const id_attribute((format(printf
virtual void SetSelection(int sel)=0
virtual void BufferCommandText(cmdExecution_t exec, const char *text)=0
class idPlayerView playerView
int ServerRemapDecl(int clientNum, declType_t type, int index)
void NewState(gameState_t news, idPlayer *player=NULL)
void ClientReadStartState(const idBitMsg &msg)
GLuint GLuint GLsizei count
idPlayer * FragLeader(void)
void SetString(const char *value)
static const char * ThrottleVarsInEnglish[]
mpPlayerState_t playerState[MAX_CLIENTS]
bool IsInGame(int clientNum)
void FillTourneySlots(void)
const char * GetString(const char *key, const char *defaultString="") const
void AddChatLine(const char *fmt,...) id_attribute((format(printf
static void CallVote_f(const idCmdArgs &args)
bool StartSound(const char *soundName, const s_channelType channel, int soundShaderFlags, bool broadcast, int *length)
void CastVote(int clientNum, bool vote)
const char * ui_skinArgs[]
mpChatLine_t chatHistory[NUM_CHAT_NOTIFY]
bool GetBool(const char *key, const char *defaultString="0") const
virtual idListGUI * AllocListGUI(void) const =0
virtual const char * GetCVarString(const char *name) const =0
void void DPrintf(const char *fmt,...) const id_attribute((format(printf
void ServerSendChatMessage(int to, const char *name, const char *text)
void SetInteger(const int value)
GLsizei GLsizei GLenum GLenum const GLvoid * data
void void UpdateMainGui(void)
virtual void SetCVarBool(const char *name, const bool value, int flags=0)=0
int GetInteger(void) const
virtual int GetSelection(char *s, int size, int sel=0) const =0
virtual void Redraw(int time)=0
void ServerSendEvent(int eventId, const idBitMsg *msg, bool saveEvent, int excludeClient) const
idCVar si_fragLimit("si_fragLimit","10", CVAR_GAME|CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_INTEGER,"frag limit", 1, MP_PLAYER_MAXFRAGS)
static int FindText(const char *str, const char *text, bool casesensitive=true, int start=0, int end=-1)
static void VoiceChatTeam_f(const idCmdArgs &args)
const char * GetString(const char *str) const
virtual void FreeListGUI(idListGUI *listgui)=0
bool CanPlay(idPlayer *p)
idUserInterface * StartMenu(void)
virtual const char * Activate(bool activate, int time)=0
const idStr & GetValue(void) const
idPlayer * rankedPlayers[MAX_CLIENTS]
const char * si_gameTypeArgs[]
const char * Right(int len, idStr &result) const
int Find(const char c, int start=0, int end=-1) const
void PlayerVote(int clientNum, playerVote_t vote)
virtual void ServerSendReliableMessage(int clientNum, const idBitMsg &msg)
idUserInterface * guiChat
void TeamScore(int entityNumber, int team, int delta)
virtual void Printf(const char *fmt,...) id_attribute((format(printf
static const int ThrottleDelay[]
void ServerWriteInitialReliableMessages(int clientNum)
virtual const idDict & State() const =0
bool WantRespawn(idPlayer *p)
static int BitsForInteger(int i)
void ClientStartVote(int clientNum, const char *voteString)
const int MP_PLAYER_MAXFRAGS
void MessageMode(const idCmdArgs &args)
idUserInterface * msgmodeGui
idCVar si_timeLimit("si_timeLimit","10", CVAR_GAME|CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_INTEGER,"time limit in minutes", 0, 60)
virtual void Config(idUserInterface *pGUI, const char *name)=0
idDeclManager * declManager
void WriteToSnapshot(idBitMsgDelta &msg) const
idEntity * entities[MAX_GENTITIES]
idDict userInfo[MAX_CLIENTS]
virtual int GetNumDecls(declType_t type)=0
idPlayer * GetClientByNum(int current) const
static const char * ThrottleVars[]
void TokenizeString(const char *text, bool keepAsStrings)
virtual int ServerGetClientPing(int clientNum)
LPCSTR GetString(LPCSTR psPrompt)
const char * GameTime(void)
virtual void Clear(void)=0
void ToggleSpectate(void)
virtual const idDecl * DeclByIndex(declType_t type, int index, bool forceParse=true)=0
void ProcessChatMessage(int clientNum, bool team, const char *name, const char *text, const char *sound)
static const char * GlobalSoundStrings[SND_COUNT]
idUserInterface * spectateGui
bool IsGametypeFlagBased(void)
bool WriteDeltaDict(const idDict &dict, const idDict *base)
static void Vote_f(const idCmdArgs &args)
idDict * GetUserInfo(void)
idCVar g_voteFlags("g_voteFlags","0", CVAR_GAME|CVAR_NETWORKSYNC|CVAR_INTEGER|CVAR_ARCHIVE,"vote flags. bit mask of votes not allowed on this server\n""bit 0 (+1) restart now\n""bit 1 (+2) time limit\n""bit 2 (+4) frag limit\n""bit 3 (+8) game type\n""bit 4 (+16) kick player\n""bit 5 (+32) change map\n""bit 6 (+64) spectators\n""bit 7 (+128) next map")
const int MP_PLAYER_MAXWINS
static void ForceReady_f(const idCmdArgs &args)
idCVar si_map("si_map","game/mp/d3dm1", CVAR_GAME|CVAR_SERVERINFO|CVAR_ARCHIVE,"map to be played next on server", idCmdSystem::ArgCompletion_MapName)
static void DropWeapon_f(const idCmdArgs &args)
bool AllPlayersReady(void)
int vsprintf(idStr &string, const char *fmt, va_list argptr)
const char * c_str(void) const
void DropWeapon(int clientNum)
const int MAX_GAME_MESSAGE_SIZE
void ReadFromSnapshot(const idBitMsgDelta &msg)
void ServerSpectate(bool spectate)
const idKeyValue * GetKeyVal(int index) const
void SetBool(const bool value)
const char * Argv(int arg) const
virtual const idDeclSkin * FindSkin(const char *name, bool makeDefault=true)=0
void UpdateWinsLosses(idPlayer *winner)
int NumActualClients(bool countSpectators, int *teamcount=NULL)
void SetPrivateCameraView(idCamera *camView)
float GetMinValue(void) const
char * va(const char *fmt,...)
void WriteBits(int value, int numBits)
virtual void CloseFile(idFile *f)=0
virtual void DPrintf(const char *fmt,...) id_attribute((format(printf
virtual const idDict * GetMapDecl(int i)=0
idCVar g_balanceTDM("g_balanceTDM","1", CVAR_GAME|CVAR_BOOL,"maintain even teams")
void Kill(bool delayRespawn, bool nodamage)
idCVar si_spectators("si_spectators","1", CVAR_GAME|CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_BOOL,"allow spectators or require all clients to play")
int GetNumKeyVals(void) const
ID_INLINE T Min(T x, T y)
void ServerClientConnect(int clientNum)
int ReadBits(int numBits) const
int sprintf(idStr &string, const char *fmt,...)
void ServerCallVote(int clientNum, const idBitMsg &msg)
void CycleTourneyPlayers(void)
const int FRAGLIMIT_DELAY
const int ASYNC_PLAYER_WINS_BITS
void UpdateHud(idPlayer *player, idUserInterface *hud)
virtual void ClientSendReliableMessage(const idBitMsg &msg)
void DisconnectClient(int clientNum)
static void VoiceChat_f(const idCmdArgs &args)
float GetMaxValue(void) const
int kickVoteMap[MAX_CLIENTS]
int ReadShort(void) const
const int ASYNC_PLAYER_FRAG_BITS
idEntity * FindEntityUsingDef(idEntity *from, const char *match) const