Replace old dated _menus code
Replace old iw4x code in _menus to better detect if players are allowed to change teams and pick classes based on gamemodes. Back port changes from IW5 to _playerlogic to support new _menus changes.pull/4/head
parent
299e5ed625
commit
ad2611183b
|
@ -153,10 +153,9 @@ onMenuResponse()
|
|||
{
|
||||
self closepopupMenu();
|
||||
self closeInGameMenu();
|
||||
if ( getDvar( "g_gametype" ) != "oitc" && getDvar( "g_gametype" ) != "gg" && getDvar( "g_gametype" ) != "ss" && !isDefined(level.customClassCB) )
|
||||
{
|
||||
if ( allowClassChoice() )
|
||||
self openpopupMenu( game["menu_changeclass_allies"] );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -164,10 +163,10 @@ onMenuResponse()
|
|||
{
|
||||
self closepopupMenu();
|
||||
self closeInGameMenu();
|
||||
if ( getDvar( "g_gametype" ) != "oitc" && getDvar( "g_gametype" ) != "gg" && getDvar( "g_gametype" ) != "ss" && !isDefined(level.customClassCB) )
|
||||
{
|
||||
|
||||
if ( allowClassChoice() )
|
||||
self openpopupMenu( game["menu_changeclass_axis"] );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -177,6 +176,21 @@ onMenuResponse()
|
|||
if(response == "changeclass_opfor_splitscreen" )
|
||||
self openpopupMenu( "changeclass_opfor_splitscreen" );
|
||||
|
||||
if(response == "endgame")
|
||||
{
|
||||
if(level.splitscreen)
|
||||
{
|
||||
endparty();
|
||||
|
||||
if ( !level.gameEnded )
|
||||
{
|
||||
level thread maps\mp\gametypes\_gamelogic::forceEnd();
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( response == "endround" )
|
||||
{
|
||||
if ( !self isHost() )
|
||||
|
@ -186,7 +200,7 @@ onMenuResponse()
|
|||
|
||||
if ( !level.gameEnded )
|
||||
{
|
||||
setDvar( "sv_dontRotate", 1 );
|
||||
setDvar("sv_dontrotate", 1);
|
||||
level thread maps\mp\gametypes\_gamelogic::forceEnd();
|
||||
}
|
||||
else
|
||||
|
@ -321,28 +335,29 @@ beginClassChoice( forceNewChoice )
|
|||
{
|
||||
assert( self.pers["team"] == "axis" || self.pers["team"] == "allies" );
|
||||
|
||||
if ( getDvar( "g_gametype" ) == "oitc" || getDvar( "g_gametype" ) == "gg" || getDvar( "g_gametype" ) == "ss" || isDefined(level.customClassCB) )
|
||||
{
|
||||
if ( !isAlive( self ) )
|
||||
self thread maps\mp\gametypes\_playerlogic::predictAboutToSpawnPlayerOverTime( 0.1 );
|
||||
|
||||
self.selectedClass = true;
|
||||
self menuClass( "assault_mp,0" );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
team = self.pers["team"];
|
||||
|
||||
// menu_changeclass_team is the one where you choose one of the n classes to play as.
|
||||
// menu_class_team is where you can choose to change your team, class, controls, or leave game.
|
||||
|
||||
// if game mode allows class choice
|
||||
if ( allowClassChoice() )
|
||||
self openpopupMenu( game[ "menu_changeclass_" + team ] );
|
||||
else
|
||||
self thread bypassClassChoice();
|
||||
|
||||
if ( !isAlive( self ) )
|
||||
self thread maps\mp\gametypes\_playerlogic::predictAboutToSpawnPlayerOverTime( 0.1 );
|
||||
}
|
||||
|
||||
|
||||
bypassClassChoice()
|
||||
{
|
||||
self.selectedClass = true;
|
||||
self [[level.class]]("class0");
|
||||
}
|
||||
|
||||
|
||||
beginTeamChoice()
|
||||
{
|
||||
if ( getDvarInt( "scr_player_forceautoassign" ) != 0 )
|
||||
|
@ -538,7 +553,7 @@ addToTeam( team, firstConnect )
|
|||
self.team = team;
|
||||
|
||||
// session team is readonly in ranked matches on console
|
||||
if ( !matchMakingGame() || isDefined( self.pers["isBot"] ) )
|
||||
if ( !matchMakingGame() || isDefined( self.pers["isBot"] ) || !allowTeamChoice() )
|
||||
{
|
||||
if ( level.teamBased )
|
||||
{
|
||||
|
|
|
@ -116,6 +116,12 @@ maySpawn()
|
|||
|
||||
spawnClient()
|
||||
{
|
||||
if ( isDefined( self.addtoteam ) )
|
||||
{
|
||||
maps\mp\gametypes\_menus::addToTeam( self.addtoteam );
|
||||
self.addtoteam = undefined;
|
||||
}
|
||||
|
||||
assert( isDefined( self.team ) );
|
||||
assert( isValidClass( self.class ) );
|
||||
|
||||
|
@ -684,7 +690,7 @@ spawnPlayer()
|
|||
|
||||
prof_end( "spawnPlayer_postUTS" );
|
||||
|
||||
self logstring( "S " + self.origin[0] + " " + self.origin[1] + " " + self.origin[2] );
|
||||
//self logstring( "S " + self.origin[0] + " " + self.origin[1] + " " + self.origin[2] );
|
||||
|
||||
// give "connected" handlers a chance to start
|
||||
// many of these start onPlayerSpawned handlers which rely on the "spawned_player"
|
||||
|
@ -1122,7 +1128,7 @@ Callback_PlayerConnect()
|
|||
|
||||
logPrint("J;" + self.guid + ";" + self getEntityNumber() + ";" + self.name + "\n");
|
||||
|
||||
if ( matchMakingGame() && game["clientid"] <= 24 && game["clientid"] != getMatchData( "playerCount" ) )
|
||||
if ( game["clientid"] <= 24 && game["clientid"] != getMatchData( "playerCount" ) )
|
||||
{
|
||||
setMatchData( "playerCount", game["clientid"] );
|
||||
setMatchData( "players", self.clientid, "xuid", self getXuid() );
|
||||
|
@ -1132,6 +1138,8 @@ Callback_PlayerConnect()
|
|||
#/
|
||||
assert( getdvarint( "scr_runlevelandquit" ) == 1 || (level.teamBased && (self.sessionteam == "allies" || self.sessionteam == "axis")) || (!level.teamBased && self.sessionteam == "none" ) );
|
||||
//assert( (level.teamBased && self.sessionteam == self.team) || (!level.teamBased && self.sessionteam == "none") );
|
||||
|
||||
if ( matchMakingGame() && allowTeamChoice() )
|
||||
setMatchData( "players", self.clientid, "team", self.sessionteam );
|
||||
}
|
||||
|
||||
|
@ -1236,11 +1244,18 @@ Callback_PlayerConnect()
|
|||
self thread kickIfDontSpawn();
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( allowTeamChoice() )
|
||||
{
|
||||
self [[level.spectator]]();
|
||||
self maps\mp\gametypes\_menus::beginTeamChoice();
|
||||
}
|
||||
else
|
||||
{
|
||||
self [[ level.spectator ]]();
|
||||
self [[level.autoassign]]();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self maps\mp\gametypes\_menus::addToTeam( self.pers["team"], true );
|
||||
|
||||
|
@ -1253,8 +1268,17 @@ Callback_PlayerConnect()
|
|||
self thread spawnSpectator();
|
||||
|
||||
if ( self.pers["team"] == "spectator" )
|
||||
{
|
||||
if ( allowTeamChoice() )
|
||||
{
|
||||
self maps\mp\gametypes\_menus::beginTeamChoice();
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
self [[ level.autoassign ]]();
|
||||
return;
|
||||
}
|
||||
|
||||
self maps\mp\gametypes\_menus::beginClassChoice();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue