From 62dfea421503d05e5bd17bf8661883f5c48946c6 Mon Sep 17 00:00:00 2001 From: JezuzLizard Date: Tue, 12 May 2020 21:20:07 -0700 Subject: [PATCH] checked 3 more scripts _battlechatter_mp, _persistence, and _pregame have been checked. --- .../maps/mp/gametypes/_battlechatter_mp.gsc | 428 ++++++++---------- patch_mp/maps/mp/gametypes/_persistence.gsc | 316 ++++++------- patch_mp/maps/mp/gametypes/_pregame.gsc | 114 ++--- patch_mp/readme.md | 8 +- 4 files changed, 387 insertions(+), 479 deletions(-) diff --git a/patch_mp/maps/mp/gametypes/_battlechatter_mp.gsc b/patch_mp/maps/mp/gametypes/_battlechatter_mp.gsc index 77acc4e..7a2d281 100644 --- a/patch_mp/maps/mp/gametypes/_battlechatter_mp.gsc +++ b/patch_mp/maps/mp/gametypes/_battlechatter_mp.gsc @@ -1,29 +1,28 @@ +//checked includes match cerberus output #include maps/mp/killstreaks/_killstreaks; #include maps/mp/gametypes/_globallogic; #include maps/mp/gametypes/_hud_util; #include maps/mp/_utility; #include common_scripts/utility; -init() +init() //checked changed to match cerberus output { if ( level.createfx_enabled ) { return; } - _a10 = level.teams; - _k10 = getFirstArrayKey( _a10 ); - while ( isDefined( _k10 ) ) + foreach ( team in level.teams ) { - team = _a10[ _k10 ]; + /* /# assert( isDefined( level.teamprefix[ team ] ) ); #/ /# assert( isDefined( level.teamprefix[ team ] ) ); #/ + */ level.isteamspeaking[ team ] = 0; level.speakers[ team ] = []; - _k10 = getNextArrayKey( _a10, _k10 ); } level.bcsounds = []; level.bcsounds[ "inform_attack" ] = "attack"; @@ -113,7 +112,7 @@ init() level.battlechatter_init = 1; } -onplayerconnect() +onplayerconnect() //checked matches cerberus output { for ( ;; ) { @@ -123,7 +122,7 @@ onplayerconnect() } } -updatebcdvars() +updatebcdvars() //checked matches cerberus output { level endon( "game_ended" ); for ( ;; ) @@ -137,7 +136,7 @@ updatebcdvars() } } -onjoinedteam() +onjoinedteam() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -148,7 +147,7 @@ onjoinedteam() } } -onjoinedspectators() +onjoinedspectators() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -157,7 +156,7 @@ onjoinedspectators() } } -onplayerspawned() +onplayerspawned() //checked changed to match cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -172,24 +171,21 @@ onplayerspawned() { continue; } - else - { - self thread reloadtracking(); - self thread grenadetracking(); - self thread enemythreat(); - self thread stickygrenadetracking(); - self thread painvox(); - self thread allyrevive(); - self thread onfirescream(); - self thread deathvox(); - self thread watchmissileusage(); - } + self thread reloadtracking(); + self thread grenadetracking(); + self thread enemythreat(); + self thread stickygrenadetracking(); + self thread painvox(); + self thread allyrevive(); + self thread onfirescream(); + self thread deathvox(); + self thread watchmissileusage(); } } enemycontactleveldelay() { - while ( 1 ) + while ( 1 ) //checked matches cerberus output { level waittill( "level_enemy_spotted" ); level.enemyspotteddialog = 0; @@ -198,7 +194,7 @@ enemycontactleveldelay() } } -breathinghurtvox() +breathinghurtvox() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -208,7 +204,7 @@ breathinghurtvox() self waittill( "snd_breathing_hurt" ); if ( randomintrange( 0, 100 ) >= level.bcmp_breathing_probability ) { - wait 0,5; + wait 0.5; if ( isalive( self ) ) { level thread mpsaylocalsound( self, "breathing", "hurt", 0, 1 ); @@ -218,7 +214,7 @@ breathinghurtvox() } } -onfirescream() +onfirescream() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -227,7 +223,7 @@ onfirescream() self waittill( "snd_burn_scream" ); if ( randomintrange( 0, 100 ) >= level.bcmp_breathing_probability ) { - wait 0,5; + wait 0.5; if ( isalive( self ) ) { level thread mpsaylocalsound( self, "fire", "scream" ); @@ -237,7 +233,7 @@ onfirescream() } } -breathingbettervox() +breathingbettervox() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -252,7 +248,7 @@ breathingbettervox() } } -laststandvox() +laststandvox() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -268,7 +264,7 @@ laststandvox() } } -allyrevive() +allyrevive() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -283,7 +279,7 @@ allyrevive() } } -painvox() +painvox() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -302,7 +298,7 @@ painvox() } } -deathvox() +deathvox() //checked matches cerberus output { self endon( "disconnect" ); self waittill( "death" ); @@ -313,7 +309,7 @@ deathvox() } } -stickygrenadetracking() +stickygrenadetracking() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -333,7 +329,7 @@ stickygrenadetracking() } } -onplayersuicideorteamkill( player, type ) +onplayersuicideorteamkill( player, type ) //checked matches cerberus output { self endon( "disconnect" ); waittillframeend; @@ -363,22 +359,22 @@ onplayersuicideorteamkill( player, type ) } } -onplayerkillstreak( player ) +onplayerkillstreak( player ) //checked matches cerberus output { player endon( "disconnect" ); } -onkillstreakused( killstreak, team ) +onkillstreakused( killstreak, team ) //checked matches cerberus output { } -onplayernearexplodable( object, type ) +onplayernearexplodable( object, type ) //checked matches cerberus output { self endon( "disconnect" ); self endon( "explosion_started" ); } -shoeboxtracking() +shoeboxtracking() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -393,7 +389,7 @@ shoeboxtracking() } } -checkweaponreload( weapon ) +checkweaponreload( weapon ) //checked matches cerberus output { switch( weapon ) { @@ -408,7 +404,7 @@ checkweaponreload( weapon ) } } -reloadtracking() +reloadtracking() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -427,14 +423,14 @@ reloadtracking() } } -perkspecificbattlechatter( type, checkdistance ) +perkspecificbattlechatter( type, checkdistance ) //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); self endon( "perk_done" ); } -enemythreat() +enemythreat() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -466,45 +462,37 @@ enemythreat() } } -weaponfired() +weaponfired() //checked changed to match cerberus output { self endon( "death" ); self endon( "disconnect" ); for ( ;; ) { self waittill( "weapon_fired" ); - while ( ( getTime() - self.lastbcattempttime ) > level.bcweapondelay ) + if ( ( getTime() - self.lastbcattempttime ) > level.bcweapondelay ) { self.lastbcattempttime = getTime(); - while ( randomintrange( 0, 100 ) >= level.bcweaponfireprobability ) + if ( randomintrange( 0, 100 ) >= level.bcweaponfireprobability ) { self.landmarkent = self getlandmark(); - while ( isDefined( self.landmarkent ) ) + if ( isDefined( self.landmarkent ) ) { myteam = self.team; - _a646 = level.teams; - _k646 = getFirstArrayKey( _a646 ); - while ( isDefined( _k646 ) ) + foreach ( team in level.teams ) { - team = _a646[ _k646 ]; if ( team == myteam ) { + break; } - else + keys = getarraykeys( level.squads[ team ] ); + for ( i = 0; i < keys.size; i++ ) { - keys = getarraykeys( level.squads[ team ] ); - i = 0; - while ( i < keys.size ) + if ( level.squads[ team ][ keys[ i ] ].size ) { - if ( level.squads[ team ][ keys[ i ] ].size ) - { - index = randomintrange( 0, level.squads[ team ][ keys[ i ] ].size ); - level thread mpsaylocalsound( level.squads[ team ][ keys[ i ] ][ index ], "enemy", "infantry" ); - } - i++; + index = randomintrange( 0, level.squads[ team ][ keys[ i ] ].size ); + level thread mpsaylocalsound( level.squads[ team ][ keys[ i ] ][ index ], "enemy", "infantry" ); } } - _k646 = getNextArrayKey( _a646, _k646 ); } } } @@ -512,7 +500,7 @@ weaponfired() } } -killedbysniper( sniper ) +killedbysniper( sniper ) //checked matches cerberus output { self endon( "disconnect" ); sniper endon( "disconnect" ); @@ -539,7 +527,7 @@ killedbysniper( sniper ) } } -playerkilled( attacker ) +playerkilled( attacker ) //checked matches cerberus output { self endon( "disconnect" ); if ( !isplayer( attacker ) ) @@ -572,7 +560,7 @@ playerkilled( attacker ) } } -grenadetracking() +grenadetracking() //checked changed to match cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -588,7 +576,7 @@ grenadetracking() level thread incominggrenadetracking( self, grenade, "grenade" ); continue; } - else if ( weaponname == "satchel_charge_mp" ) + if ( weaponname == "satchel_charge_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -596,7 +584,7 @@ grenadetracking() } continue; } - else if ( weaponname == "emp_grenade_mp" ) + if ( weaponname == "emp_grenade_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -604,7 +592,7 @@ grenadetracking() } continue; } - else if ( weaponname == "claymore_mp" ) + if ( weaponname == "claymore_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -612,7 +600,7 @@ grenadetracking() } continue; } - else if ( weaponname == "flash_grenade_mp" ) + if ( weaponname == "flash_grenade_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -620,7 +608,7 @@ grenadetracking() } continue; } - else if ( weaponname == "sticky_grenade_mp" ) + if ( weaponname == "sticky_grenade_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -628,7 +616,7 @@ grenadetracking() } continue; } - else if ( weaponname == "tabun_gas_mp" ) + if ( weaponname == "tabun_gas_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -636,7 +624,7 @@ grenadetracking() } continue; } - else if ( weaponname == "willy_pete_mp" ) + if ( weaponname == "willy_pete_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -644,7 +632,7 @@ grenadetracking() } continue; } - else if ( weaponname == "hatchet_mp" || weaponname == "proximity_grenade_mp" ) + if ( weaponname == "hatchet_mp" || weaponname == "proximity_grenade_mp" ) { if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { @@ -652,63 +640,57 @@ grenadetracking() } continue; } - else + if ( weaponname == "concussion_grenade_mp" ) { - if ( weaponname == "concussion_grenade_mp" ) + if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { - if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) - { - level thread mpsaylocalsound( self, "inform_attack", "concussion" ); - } - break; + level thread mpsaylocalsound( self, "inform_attack", "concussion" ); } - else if ( weaponname == "scrambler_mp" ) + continue; + } + if ( weaponname == "scrambler_mp" ) + { + if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { - if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) - { - level thread mpsaylocalsound( self, "inform_attack", "scrambler" ); - } - break; + level thread mpsaylocalsound( self, "inform_attack", "scrambler" ); } - else if ( weaponname == "tactical_insertion_mp" ) + continue; + } + if ( weaponname == "tactical_insertion_mp" ) + { + if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { - if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) - { - level thread mpsaylocalsound( self, "inform_attack", "tactical" ); - } - break; + level thread mpsaylocalsound( self, "inform_attack", "tactical" ); } - else if ( weaponname == "bouncingbetty_mp" ) + continue; + } + if ( weaponname == "bouncingbetty_mp" ) + { + if ( randomintrange( 0, 100 ) >= level.bctosstrophyprobability ) { - if ( randomintrange( 0, 100 ) >= level.bctosstrophyprobability ) - { - level thread mpsaylocalsound( self, "inform_attack", "c4" ); - } - break; + level thread mpsaylocalsound( self, "inform_attack", "c4" ); } - else if ( weaponname == "sensor_grenade_mp" ) + continue; + } + if ( weaponname == "sensor_grenade_mp" ) + { + if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) { - if ( randomintrange( 0, 100 ) >= level.bctossgrenadeprobability ) - { - level thread mpsaylocalsound( self, "inform_attack", "hatchet" ); - } - break; + level thread mpsaylocalsound( self, "inform_attack", "hatchet" ); } - else + continue; + } + if ( weaponname == "trophy_system_mp" ) + { + if ( randomintrange( 0, 100 ) >= level.bctosstrophyprobability ) { - if ( weaponname == "trophy_system_mp" ) - { - if ( randomintrange( 0, 100 ) >= level.bctosstrophyprobability ) - { - level thread mpsaylocalsound( self, "inform_attack", "scrambler" ); - } - } + level thread mpsaylocalsound( self, "inform_attack", "scrambler" ); } } } } -watchmissileusage() +watchmissileusage() //checked changed to match cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -718,17 +700,13 @@ watchmissileusage() self waittill( "missile_fire", missile, weapon_name ); if ( weapon_name == "usrpg_mp" ) { - level thread incominggrenadetracking( self, missile, "rpg", 0,2 ); - continue; - } - else - { - return; + level thread incominggrenadetracking( self, missile, "rpg", 0.2 ); } + return; } } -incominggrenadetracking( thrower, grenade, type, waittime ) +incominggrenadetracking( thrower, grenade, type, waittime ) //checked matches cerberus output { if ( randomintrange( 0, 100 ) >= level.bcincominggrenadeprobability ) { @@ -757,7 +735,7 @@ incominggrenadetracking( thrower, grenade, type, waittime ) } } -incomingspecialgrenadetracking( type ) +incomingspecialgrenadetracking( type ) //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -776,7 +754,7 @@ incomingspecialgrenadetracking( type ) } } -gametypespecificbattlechatter( event, team ) +gametypespecificbattlechatter( event, team ) //checked changed to match the beta dump _battlechatter_mp.gsc { self endon( "death" ); self endon( "disconnect" ); @@ -785,30 +763,27 @@ gametypespecificbattlechatter( event, team ) { if ( isDefined( team ) ) { - index = checkdistancetoevent( self, 90000 ); + + index = CheckDistanceToEvent( self, 300 * 300 ); if ( isDefined( index ) ) { - level thread mpsaylocalsound( level.aliveplayers[ team ][ index ], "gametype", event ); + level thread mpSayLocalSound( level.alivePlayers[ team ][ index ], "gametype", event ); self notify( "event_ended" ); } } else { - _a939 = level.teams; - _k939 = getFirstArrayKey( _a939 ); - while ( isDefined( _k939 ) ) + foreach ( team in level.teams ) { - team = _a939[ _k939 ]; - index = randomintrange( 0, level.aliveplayers[ team ].size ); - level thread mpsaylocalsound( level.aliveplayers[ team ][ index ], "gametype", event ); - _k939 = getNextArrayKey( _a939, _k939 ); + index = randomIntRange( 0, level.alivePlayers[ team ].size ); + level thread mpSayLocalSound( level.alivePlayers[ team ][ index ], "gametype", event ); } } wait 1; } } -checkweaponkill( weapon ) +checkweaponkill( weapon ) //checked matches cerberus output { switch( weapon ) { @@ -820,7 +795,7 @@ checkweaponkill( weapon ) } } -saykillbattlechatter( attacker, sweapon, victim ) +saykillbattlechatter( attacker, sweapon, victim ) //checked changed to match cerberus output { if ( checkweaponkill( sweapon ) ) { @@ -828,22 +803,19 @@ saykillbattlechatter( attacker, sweapon, victim ) } if ( isDefined( victim.issniperspotted ) && victim.issniperspotted && randomintrange( 0, 100 ) >= level.bckillinformprobability ) { - level thread saylocalsounddelayed( attacker, "kill", "sniper", 0,75 ); + level thread saylocalsounddelayed( attacker, "kill", "sniper", 0.75 ); victim.issniperspotted = 0; } - else + else if ( isDefined( level.bckillinformprobability ) && randomintrange( 0, 100 ) >= level.bckillinformprobability ) { - if ( isDefined( level.bckillinformprobability ) && randomintrange( 0, 100 ) >= level.bckillinformprobability ) + if ( !maps/mp/killstreaks/_killstreaks::iskillstreakweapon( sweapon ) ) { - if ( !maps/mp/killstreaks/_killstreaks::iskillstreakweapon( sweapon ) ) - { - level thread saylocalsounddelayed( attacker, "kill", "infantry", 0,75 ); - } + level thread saylocalsounddelayed( attacker, "kill", "infantry", 0.75 ); } } } -saylocalsounddelayed( player, soundtype1, soundtype2, delay ) +saylocalsounddelayed( player, soundtype1, soundtype2, delay ) //checked matches cerberus output { player endon( "death" ); player endon( "disconnect" ); @@ -855,7 +827,7 @@ saylocalsounddelayed( player, soundtype1, soundtype2, delay ) mpsaylocalsound( player, soundtype1, soundtype2 ); } -saylocalsound( player, soundtype ) +saylocalsound( player, soundtype ) //checked matches cerberus output { player endon( "death" ); player endon( "disconnect" ); @@ -869,7 +841,7 @@ saylocalsound( player, soundtype ) } } -mpsaylocalsound( player, partone, parttwo, checkspeakers, is2d ) +mpsaylocalsound( player, partone, parttwo, checkspeakers, is2d ) //checked changed to match cerberus output { player endon( "death" ); player endon( "disconnect" ); @@ -894,7 +866,6 @@ mpsaylocalsound( player, partone, parttwo, checkspeakers, is2d ) if ( isDefined( is2d ) ) { player thread dosound( soundalias, is2d ); - return; } else { @@ -903,7 +874,7 @@ mpsaylocalsound( player, partone, parttwo, checkspeakers, is2d ) } } -mpsaylocationallocalsound( player, prefix, partone, parttwo ) +mpsaylocationallocalsound( player, prefix, partone, parttwo ) //checked matches cerberus output { player endon( "death" ); player endon( "disconnect" ); @@ -923,7 +894,7 @@ mpsaylocationallocalsound( player, prefix, partone, parttwo ) } } -dosound( soundalias, is2d ) +dosound( soundalias, is2d ) //checked changed to match cerberus output { team = self.team; level addspeaker( self, team ); @@ -931,19 +902,16 @@ dosound( soundalias, is2d ) { self playlocalsound( soundalias ); } - else + else if ( level.allowbattlechatter && level.teambased ) { - if ( level.allowbattlechatter && level.teambased ) - { - self playsoundontag( soundalias, "J_Head" ); - } + self playsoundontag( soundalias, "J_Head" ); } self thread waitplaybacktime( soundalias ); self waittill_any( soundalias, "death", "disconnect" ); level removespeaker( self, team ); } -dolocationalsound( soundalias1, soundalias2 ) +dolocationalsound( soundalias1, soundalias2 ) //checked matches cerberus output { team = self.team; level addspeaker( self, team ); @@ -956,7 +924,7 @@ dolocationalsound( soundalias1, soundalias2 ) level removespeaker( self, team ); } -waitplaybacktime( soundalias ) +waitplaybacktime( soundalias ) //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -973,15 +941,14 @@ waitplaybacktime( soundalias ) self notify( soundalias ); } -isspeakerinrange( player ) +isspeakerinrange( player ) //checked changed to match cerberus output { player endon( "death" ); player endon( "disconnect" ); distsq = 1000000; - while ( isDefined( player ) && isDefined( player.team ) && player.team != "spectator" ) + if ( isDefined( player ) && isDefined( player.team ) && player.team != "spectator" ) { - index = 0; - while ( index < level.speakers[ player.team ].size ) + for ( index = 0; index < level.speakers[player.team].size; index++ ) { teammate = level.speakers[ player.team ][ index ]; if ( teammate == player ) @@ -992,18 +959,17 @@ isspeakerinrange( player ) { return 1; } - index++; } } return 0; } -addspeaker( player, team ) +addspeaker( player, team ) //checked matches cerberus output { level.speakers[ team ][ level.speakers[ team ].size ] = player; } -removespeaker( player, team ) +removespeaker( player, team ) //checked partially changed to match cerberus output did not change while loop to for loop see github for more info { newspeakers = []; index = 0; @@ -1014,31 +980,26 @@ removespeaker( player, team ) index++; continue; } - else - { - newspeakers[ newspeakers.size ] = level.speakers[ team ][ index ]; - } + newspeakers[ newspeakers.size ] = level.speakers[ team ][ index ]; index++; } level.speakers[ team ] = newspeakers; } -getlandmark() +getlandmark() //checked changed to match cerberus output { landmarks = level.landmarks; - i = 0; - while ( i < landmarks.size ) + for ( i = 0; i < landmarks.size; i++ ) { if ( self istouching( landmarks[ i ] ) && isDefined( landmarks[ i ].script_landmark ) ) { return landmarks[ i ]; } - i++; } return undefined; } -checkdistancetoevent( player, area ) +checkdistancetoevent( player, area ) //checked partially changed to match cerberus output did not change while loop to for loop see github for more info { if ( !isDefined( player ) ) { @@ -1053,33 +1014,12 @@ checkdistancetoevent( player, area ) index++; continue; } - else if ( teammate == player ) + if ( teammate == player ) { index++; continue; } - else - { - if ( distancesquared( teammate.origin, player.origin ) < area ) - { - return index; - } - } - index++; - } -} - -checkdistancetoenemy( enemy, area, team ) -{ - if ( !isDefined( enemy ) ) - { - return undefined; - } - index = 0; - while ( index < level.aliveplayers[ team ].size ) - { - player = level.aliveplayers[ team ][ index ]; - if ( distancesquared( enemy.origin, player.origin ) < area ) + if ( distancesquared( teammate.origin, player.origin ) < area ) { return index; } @@ -1087,15 +1027,28 @@ checkdistancetoenemy( enemy, area, team ) } } -checkdistancetoobject( area, object, ignoreteam, ignoreent ) +checkdistancetoenemy( enemy, area, team ) //checked changed to match cerberus output +{ + if ( !isDefined( enemy ) ) + { + return undefined; + } + for ( index = 0; index < level.aliveplayers[team].size; index++ ) + { + player = level.aliveplayers[ team ][ index ]; + if ( distancesquared( enemy.origin, player.origin ) < area ) + { + return index; + } + } +} + +checkdistancetoobject( area, object, ignoreteam, ignoreent ) //checked partially changed to match cerberus output did not change while loops to for loops see github for more info { if ( isDefined( ignoreteam ) ) { - _a1232 = level.teams; - _k1232 = getFirstArrayKey( _a1232 ); - while ( isDefined( _k1232 ) ) + foreach ( team in level.teams ) { - team = _a1232[ _k1232 ]; i = 0; while ( i < level.aliveplayers[ team ].size ) { @@ -1105,19 +1058,15 @@ checkdistancetoobject( area, object, ignoreteam, ignoreent ) i++; continue; } - else + if ( isDefined( object ) && distancesquared( player.origin, object.origin ) < area ) { - if ( isDefined( object ) && distancesquared( player.origin, object.origin ) < area ) - { - return player; - } + return player; } i++; } - _k1232 = getNextArrayKey( _a1232, _k1232 ); } } - else i = 0; + i = 0; while ( i < level.players.size ) { player = level.players[ i ]; @@ -1126,57 +1075,44 @@ checkdistancetoobject( area, object, ignoreteam, ignoreent ) i++; continue; } - else + if ( isalive( player ) ) { - if ( isalive( player ) ) + if ( isDefined( object ) && distancesquared( player.origin, object.origin ) < area ) { - if ( isDefined( object ) && distancesquared( player.origin, object.origin ) < area ) - { - return player; - } + return player; } } i++; } } -get_closest_player_enemy() +get_closest_player_enemy() //checked partially changed to match cerberus output did not use continue in foreach see github for more info { players = getplayers(); players = arraysort( players, self.origin ); - _a1269 = players; - _k1269 = getFirstArrayKey( _a1269 ); - while ( isDefined( _k1269 ) ) + foreach ( player in players ) { - player = _a1269[ _k1269 ]; if ( !isDefined( player ) || !isalive( player ) ) { } + else if ( player.sessionstate != "playing" ) + { + } + else if ( player == self ) + { + } + else if ( level.teambased && self.team == player.team ) + { + } else { - if ( player.sessionstate != "playing" ) - { - break; - } - else if ( player == self ) - { - break; - } - else if ( level.teambased && self.team == player.team ) - { - break; - } - else - { - return player; - } + return player; } - _k1269 = getNextArrayKey( _a1269, _k1269 ); } return undefined; } -get_closest_player_ally() +get_closest_player_ally() //checked partially changed to match cerberus output did not use continue in foreach see github for more info { if ( !level.teambased ) { @@ -1184,30 +1120,22 @@ get_closest_player_ally() } players = getplayers( self.team ); players = arraysort( players, self.origin ); - _a1307 = players; - _k1307 = getFirstArrayKey( _a1307 ); - while ( isDefined( _k1307 ) ) + foreach ( player in players ) { - player = _a1307[ _k1307 ]; if ( !isDefined( player ) || !isalive( player ) ) { } + else if ( player.sessionstate != "playing" ) + { + } + else if ( player == self ) + { + } else { - if ( player.sessionstate != "playing" ) - { - break; - } - else if ( player == self ) - { - break; - } - else - { - return player; - } + return player; } - _k1307 = getNextArrayKey( _a1307, _k1307 ); } return undefined; } + diff --git a/patch_mp/maps/mp/gametypes/_persistence.gsc b/patch_mp/maps/mp/gametypes/_persistence.gsc index a7dbbb4..a605b28 100644 --- a/patch_mp/maps/mp/gametypes/_persistence.gsc +++ b/patch_mp/maps/mp/gametypes/_persistence.gsc @@ -1,9 +1,16 @@ +//checked includes changed to match cerberus output #include maps/mp/gametypes/_persistence; #include maps/mp/gametypes/_globallogic; #include maps/mp/bots/_bot; +#include maps/mp/_popups; +#include maps/mp/_scoreevents; +#include maps/mp/_medals; +#include maps/mp/_challenges; +#include maps/mp/gametypes/_rank; +#include maps/mp/gametypes/_class; #include maps/mp/_utility; -init() +init() //checked matches cerberus output { level.persistentdatainfo = []; level.maxrecentstats = 10; @@ -19,7 +26,7 @@ init() level thread uploadglobalstatcounters(); } -onplayerconnect() +onplayerconnect() //checked matches cerberus output { for ( ;; ) { @@ -28,7 +35,7 @@ onplayerconnect() } } -initializestattracking() +initializestattracking() //checked changed to match cerberus output { level.globalexecutions = 0; level.globalchallenges = 0; @@ -61,17 +68,13 @@ initializestattracking() level.globalcarsdestroyed = 0; level.globalbarrelsdestroyed = 0; level.globalbombsdestroyedbyteam = []; - _a67 = level.teams; - _k67 = getFirstArrayKey( _a67 ); - while ( isDefined( _k67 ) ) + foreach ( team in level.teams ) { - team = _a67[ _k67 ]; level.globalbombsdestroyedbyteam[ team ] = 0; - _k67 = getNextArrayKey( _a67, _k67 ); } } -uploadglobalstatcounters() +uploadglobalstatcounters() //checked partially changed to match cerberus output did not change while loop to for loop see github for more info { level waittill( "game_ended" ); if ( !level.rankedmatch && !level.wagermatch ) @@ -92,13 +95,9 @@ uploadglobalstatcounters() totalsdplants = 0; totalhumiliations = 0; totalsabdestroyedbyteam = []; - _a95 = level.teams; - _k95 = getFirstArrayKey( _a95 ); - while ( isDefined( _k95 ) ) + foreach ( team in level.teams ) { - team = _a95[ _k95 ]; totalsabdestroyedbyteam[ team ] = 0; - _k95 = getNextArrayKey( _a95, _k95 ); } switch( level.gametype ) { @@ -113,135 +112,114 @@ uploadglobalstatcounters() index++; continue; } - else - { - level.globaldembombsdestroyed++; - } + level.globaldembombsdestroyed++; index++; } - case "sab": - _a117 = level.teams; - _k117 = getFirstArrayKey( _a117 ); - while ( isDefined( _k117 ) ) - { - team = _a117[ _k117 ]; + case "sab": + foreach(team in level.teams) + { totalsabdestroyedbyteam[ team ] = level.globalbombsdestroyedbyteam[ team ]; - _k117 = getNextArrayKey( _a117, _k117 ); - } } - players = get_players(); - i = 0; - while ( i < players.size ) - { - player = players[ i ]; - totaltimeplayed += min( player.timeplayed[ "total" ], level.timeplayedcap ); - i++; - } - incrementcounter( "global_executions", level.globalexecutions ); - incrementcounter( "global_sharedpackagemedals", level.globalsharepackages ); - incrementcounter( "global_dem_bombsdestroyed", level.globaldembombsdestroyed ); - incrementcounter( "global_dem_bombsprotected", level.globaldembombsprotected ); - incrementcounter( "global_contracts_failed", level.globalcontractsfailed ); - incrementcounter( "global_killstreaks_called", level.globalkillstreakscalled ); - incrementcounter( "global_killstreaks_destroyed", level.globalkillstreaksdestroyed ); - incrementcounter( "global_killstreaks_deathsfrom", level.globalkillstreaksdeathsfrom ); - incrementcounter( "global_buzzkills", level.globalbuzzkills ); - incrementcounter( "global_revives", level.globalrevives ); - incrementcounter( "global_afterlifes", level.globalafterlifes ); - incrementcounter( "global_comebacks", level.globalcomebacks ); - incrementcounter( "global_paybacks", level.globalpaybacks ); - incrementcounter( "global_backstabs", level.globalbackstabs ); - incrementcounter( "global_bankshots", level.globalbankshots ); - incrementcounter( "global_skewered", level.globalskewered ); - incrementcounter( "global_teammedals", level.globalteammedals ); - incrementcounter( "global_fraggrenadesthrown", level.globalfraggrenadesfired ); - incrementcounter( "global_c4thrown", level.globalsatchelchargefired ); - incrementcounter( "global_shotsfired", level.globalshotsfired ); - incrementcounter( "global_crossbowfired", level.globalcrossbowfired ); - incrementcounter( "global_carsdestroyed", level.globalcarsdestroyed ); - incrementcounter( "global_barrelsdestroyed", level.globalbarrelsdestroyed ); - incrementcounter( "global_challenges_finished", level.globalchallenges ); - incrementcounter( "global_contractscppaid", level.globalcontractscppaid ); - incrementcounter( "global_distancesprinted100inches", int( level.globaldistancesprinted ) ); - incrementcounter( "global_combattraining_botskilled", level.globallarryskilled ); - incrementcounter( "global_distancefeetfallen", int( level.globalfeetfallen ) ); - incrementcounter( "global_minutes", int( totaltimeplayed / 60 ) ); - if ( !waslastround() ) - { - return; - } - wait 0,05; - players = get_players(); - i = 0; - while ( i < players.size ) - { - player = players[ i ]; - totalkills += player.kills; - totaldeaths += player.deaths; - totalassists += player.assists; - totalheadshots += player.headshots; - totalsuicides += player.suicides; - totalhumiliations += player.humiliated; - totaltimeplayed += int( min( player.timeplayed[ "alive" ], level.timeplayedcap ) ); - switch( level.gametype ) + } + players = get_players(); + for ( i = 0; i < players.size; i++ ) + { + player = players[ i ]; + totaltimeplayed += min( player.timeplayed[ "total" ], level.timeplayedcap ); + } + incrementcounter( "global_executions", level.globalexecutions ); + incrementcounter( "global_sharedpackagemedals", level.globalsharepackages ); + incrementcounter( "global_dem_bombsdestroyed", level.globaldembombsdestroyed ); + incrementcounter( "global_dem_bombsprotected", level.globaldembombsprotected ); + incrementcounter( "global_contracts_failed", level.globalcontractsfailed ); + incrementcounter( "global_killstreaks_called", level.globalkillstreakscalled ); + incrementcounter( "global_killstreaks_destroyed", level.globalkillstreaksdestroyed ); + incrementcounter( "global_killstreaks_deathsfrom", level.globalkillstreaksdeathsfrom ); + incrementcounter( "global_buzzkills", level.globalbuzzkills ); + incrementcounter( "global_revives", level.globalrevives ); + incrementcounter( "global_afterlifes", level.globalafterlifes ); + incrementcounter( "global_comebacks", level.globalcomebacks ); + incrementcounter( "global_paybacks", level.globalpaybacks ); + incrementcounter( "global_backstabs", level.globalbackstabs ); + incrementcounter( "global_bankshots", level.globalbankshots ); + incrementcounter( "global_skewered", level.globalskewered ); + incrementcounter( "global_teammedals", level.globalteammedals ); + incrementcounter( "global_fraggrenadesthrown", level.globalfraggrenadesfired ); + incrementcounter( "global_c4thrown", level.globalsatchelchargefired ); + incrementcounter( "global_shotsfired", level.globalshotsfired ); + incrementcounter( "global_crossbowfired", level.globalcrossbowfired ); + incrementcounter( "global_carsdestroyed", level.globalcarsdestroyed ); + incrementcounter( "global_barrelsdestroyed", level.globalbarrelsdestroyed ); + incrementcounter( "global_challenges_finished", level.globalchallenges ); + incrementcounter( "global_contractscppaid", level.globalcontractscppaid ); + incrementcounter( "global_distancesprinted100inches", int( level.globaldistancesprinted ) ); + incrementcounter( "global_combattraining_botskilled", level.globallarryskilled ); + incrementcounter( "global_distancefeetfallen", int( level.globalfeetfallen ) ); + incrementcounter( "global_minutes", int( totaltimeplayed / 60 ) ); + if ( !waslastround() ) + { + return; + } + wait 0.05; + players = get_players(); + for ( i = 0; i < players.size; i++ ) + { + player = players[ i ]; + totalkills += player.kills; + totaldeaths += player.deaths; + totalassists += player.assists; + totalheadshots += player.headshots; + totalsuicides += player.suicides; + totalhumiliations += player.humiliated; + totaltimeplayed += int( min( player.timeplayed[ "alive" ], level.timeplayedcap ) ); + switch( level.gametype ) + { + case "ctf": + totalflagscaptured += player.captures; + totalflagsreturned += player.returns; + break; + case "koth": + totalhqsdestroyed += player.destructions; + totalhqscaptured += player.captures; + break; + case "sd": + totalsddefused += player.defuses; + totalsdplants += player.plants; + break; + case "sab": + if ( isDefined( player.team ) && isDefined( level.teams[ player.team ] ) ) { - case "ctf": - totalflagscaptured += player.captures; - totalflagsreturned += player.returns; - break; - i++; - continue; - case "koth": - totalhqsdestroyed += player.destructions; - totalhqscaptured += player.captures; - break; - i++; - continue; - case "sd": - totalsddefused += player.defuses; - totalsdplants += player.plants; - break; - i++; - continue; - case "sab": - if ( isDefined( player.team ) && isDefined( level.teams[ player.team ] ) ) - { - totalsabdestroyedbyteam[ player.team ] += player.destructions; - } - break; - i++; - continue; + totalsabdestroyedbyteam[ player.team ] += player.destructions; } - i++; - } - if ( maps/mp/bots/_bot::is_bot_ranked_match() ) - { - incrementcounter( "global_combattraining_gamesplayed", 1 ); - } - incrementcounter( "global_kills", totalkills ); - incrementcounter( "global_deaths", totaldeaths ); - incrementcounter( "global_assists", totalassists ); - incrementcounter( "global_headshots", totalheadshots ); - incrementcounter( "global_suicides", totalsuicides ); - incrementcounter( "global_games", 1 ); - incrementcounter( "global_ctf_flagscaptured", totalflagscaptured ); - incrementcounter( "global_ctf_flagsreturned", totalflagsreturned ); - incrementcounter( "global_hq_destroyed", totalhqsdestroyed ); - incrementcounter( "global_hq_captured", totalhqscaptured ); - incrementcounter( "global_snd_defuses", totalsddefused ); - incrementcounter( "global_snd_plants", totalsdplants ); - incrementcounter( "global_sab_destroyedbyops", totalsabdestroyedbyteam[ "allies" ] ); - incrementcounter( "global_sab_destroyedbycommunists", totalsabdestroyedbyteam[ "axis" ] ); - incrementcounter( "global_humiliations", totalhumiliations ); - if ( isDefined( game[ "wager_pot" ] ) ) - { - incrementcounter( "global_wageredcp", game[ "wager_pot" ] ); - } + break; } } + if ( maps/mp/bots/_bot::is_bot_ranked_match() ) + { + incrementcounter( "global_combattraining_gamesplayed", 1 ); + } + incrementcounter( "global_kills", totalkills ); + incrementcounter( "global_deaths", totaldeaths ); + incrementcounter( "global_assists", totalassists ); + incrementcounter( "global_headshots", totalheadshots ); + incrementcounter( "global_suicides", totalsuicides ); + incrementcounter( "global_games", 1 ); + incrementcounter( "global_ctf_flagscaptured", totalflagscaptured ); + incrementcounter( "global_ctf_flagsreturned", totalflagsreturned ); + incrementcounter( "global_hq_destroyed", totalhqsdestroyed ); + incrementcounter( "global_hq_captured", totalhqscaptured ); + incrementcounter( "global_snd_defuses", totalsddefused ); + incrementcounter( "global_snd_plants", totalsdplants ); + incrementcounter( "global_sab_destroyedbyops", totalsabdestroyedbyteam[ "allies" ] ); + incrementcounter( "global_sab_destroyedbycommunists", totalsabdestroyedbyteam[ "axis" ] ); + incrementcounter( "global_humiliations", totalhumiliations ); + if ( isDefined( game[ "wager_pot" ] ) ) + { + incrementcounter( "global_wageredcp", game[ "wager_pot" ] ); + } } -statgetwithgametype( dataname ) +statgetwithgametype( dataname ) //checked matches cerberus output { if ( isDefined( level.nopersistence ) && level.nopersistence ) { @@ -254,7 +232,7 @@ statgetwithgametype( dataname ) return self getdstat( "PlayerStatsByGameType", getgametypename(), dataname, "StatValue" ); } -getgametypename() +getgametypename() //checked matches cerberus output { if ( !isDefined( level.fullgametypename ) ) { @@ -271,7 +249,7 @@ getgametypename() return level.fullgametypename; } -ispartygamemode() +ispartygamemode() //checked changed to match cerberus output { switch( level.gametype ) { @@ -280,20 +258,20 @@ ispartygamemode() case "sas": case "shrp": return 1; - } - return 0; } + return 0; } -isstatmodifiable( dataname ) +isstatmodifiable( dataname ) //checked changed at own discretion { - if ( !level.rankedmatch ) + if ( level.rankedmatch || level.wagermatch ) { - return level.wagermatch; + return 1; } + return 0; } -statsetwithgametype( dataname, value, incvalue ) +statsetwithgametype( dataname, value, incvalue ) //checked matches cerberus output { if ( isDefined( level.nopersistence ) && level.nopersistence ) { @@ -310,38 +288,37 @@ statsetwithgametype( dataname, value, incvalue ) self setdstat( "PlayerStatsByGameType", getgametypename(), dataname, "StatValue", value ); } -adjustrecentstats() +adjustrecentstats() //checked matches cerberus output { + /* /# if ( getDvarInt( "scr_writeConfigStrings" ) == 1 || getDvarInt( "scr_hostmigrationtest" ) == 1 ) { return; #/ } + */ initializematchstats(); } -getrecentstat( isglobal, index, statname ) +getrecentstat( isglobal, index, statname ) //checked changed to match cerberus output { if ( level.wagermatch ) { return self getdstat( "RecentEarnings", index, statname ); } + else if ( isglobal ) + { + modename = maps/mp/gametypes/_globallogic::getcurrentgamemode(); + return self getdstat( "gameHistory", modename, "matchHistory", index, statname ); + } else { - if ( isglobal ) - { - modename = maps/mp/gametypes/_globallogic::getcurrentgamemode(); - return self getdstat( "gameHistory", modename, "matchHistory", index, statname ); - } - else - { - return self getdstat( "PlayerStatsByGameType", getgametypename(), "prevScores", index, statname ); - } + return self getdstat( "PlayerStatsByGameType", getgametypename(), "prevScores", index, statname ); } } -setrecentstat( isglobal, index, statname, value ) +setrecentstat( isglobal, index, statname, value ) //checked matches cerberus output { if ( isDefined( level.nopersistence ) && level.nopersistence ) { @@ -376,7 +353,7 @@ setrecentstat( isglobal, index, statname, value ) } } -addrecentstat( isglobal, index, statname, value ) +addrecentstat( isglobal, index, statname, value ) //checked matches cerberus output { if ( isDefined( level.nopersistence ) && level.nopersistence ) { @@ -394,21 +371,21 @@ addrecentstat( isglobal, index, statname, value ) setrecentstat( isglobal, index, statname, currstat + value ); } -setmatchhistorystat( statname, value ) +setmatchhistorystat( statname, value ) //checked matches cerberus output { modename = maps/mp/gametypes/_globallogic::getcurrentgamemode(); historyindex = self getdstat( "gameHistory", modename, "currentMatchHistoryIndex" ); setrecentstat( 1, historyindex, statname, value ); } -addmatchhistorystat( statname, value ) +addmatchhistorystat( statname, value ) //checked matches cerberus output { modename = maps/mp/gametypes/_globallogic::getcurrentgamemode(); historyindex = self getdstat( "gameHistory", modename, "currentMatchHistoryIndex" ); addrecentstat( 1, historyindex, statname, value ); } -initializematchstats() +initializematchstats() //checked matches cerberus output { if ( isDefined( level.nopersistence ) && level.nopersistence ) { @@ -427,19 +404,21 @@ initializematchstats() self gamehistorystartmatch( getgametypeenumfromname( currgametype, level.hardcoremode ) ); } -setafteractionreportstat( statname, value, index ) +setafteractionreportstat( statname, value, index ) //checked changed to match cerberus output { if ( self is_bot() ) { return; } + /* /# if ( getDvarInt( "scr_writeConfigStrings" ) == 1 || getDvarInt( "scr_hostmigrationtest" ) == 1 ) { return; #/ } - if ( !level.rankedmatch || level.wagermatch && level.leaguematch ) + */ + if ( level.rankedmatch || level.wagermatch && level.leaguematch ) { if ( isDefined( index ) ) { @@ -453,31 +432,31 @@ setafteractionreportstat( statname, value, index ) } } -codecallback_challengecomplete( rewardxp, maxval, row, tablenumber, challengetype, itemindex, challengeindex ) +codecallback_challengecomplete( rewardxp, maxval, row, tablenumber, challengetype, itemindex, challengeindex ) //checked matches cerberus output { self luinotifyevent( &"challenge_complete", 7, challengeindex, itemindex, challengetype, tablenumber, row, maxval, rewardxp ); self luinotifyeventtospectators( &"challenge_complete", 7, challengeindex, itemindex, challengetype, tablenumber, row, maxval, rewardxp ); } -codecallback_gunchallengecomplete( rewardxp, attachmentindex, itemindex, rankid ) +codecallback_gunchallengecomplete( rewardxp, attachmentindex, itemindex, rankid ) //checked matches cerberus output { self luinotifyevent( &"gun_level_complete", 4, rankid, itemindex, attachmentindex, rewardxp ); self luinotifyeventtospectators( &"gun_level_complete", 4, rankid, itemindex, attachmentindex, rewardxp ); } -checkcontractexpirations() +checkcontractexpirations() //checked matches cerberus output { } -incrementcontracttimes( timeinc ) +incrementcontracttimes( timeinc ) //checked matches cerberus output { } -addcontracttoqueue( index, passed ) +addcontracttoqueue( index, passed ) //checked matches cerberus output { } -uploadstatssoon() +uploadstatssoon() //checked matches cerberus output { self notify( "upload_stats_soon" ); self endon( "upload_stats_soon" ); @@ -486,14 +465,15 @@ uploadstatssoon() uploadstats( self ); } -codecallback_onaddplayerstat( dataname, value ) +codecallback_onaddplayerstat( dataname, value ) //checked matches cerberus output { } -codecallback_onaddweaponstat( weapname, dataname, value ) +codecallback_onaddweaponstat( weapname, dataname, value ) //checked matches cerberus output { } -processcontractsonaddstat( stattype, dataname, value, weapname ) +processcontractsonaddstat( stattype, dataname, value, weapname ) //checked matches cerberus output { } + diff --git a/patch_mp/maps/mp/gametypes/_pregame.gsc b/patch_mp/maps/mp/gametypes/_pregame.gsc index 2721cfd..2ade502 100644 --- a/patch_mp/maps/mp/gametypes/_pregame.gsc +++ b/patch_mp/maps/mp/gametypes/_pregame.gsc @@ -1,19 +1,26 @@ +//checked includes changed to match cerberus output #include maps/mp/gametypes/_globallogic_score; #include maps/mp/gametypes/_globallogic_utils; #include maps/mp/gametypes/_globallogic_ui; #include maps/mp/gametypes/_hud; #include maps/mp/gametypes/_globallogic_player; +#include maps/mp/gametypes/_gameobjects; #include maps/mp/gametypes/_spawning; #include maps/mp/gametypes/_spawnlogic; +#include maps/mp/gametypes/_callbacksetup; +#include maps/mp/gametypes/_globallogic; #include maps/mp/gametypes/_hud_util; #include maps/mp/_utility; -main() + +main() //checked matches cerberus output { level.pregame = 1; + /* /# println( "Pregame main() level.pregame = " + level.pregame + "\n" ); #/ + */ maps/mp/gametypes/_globallogic::init(); maps/mp/gametypes/_callbacksetup::setupcallbacks(); maps/mp/gametypes/_globallogic::setupcallbacks(); @@ -39,16 +46,13 @@ main() setmatchtalkflag( "EveryoneHearsEveryone", 1 ); } -onstartgametype() +onstartgametype() //checked changed to match cerberus output { setclientnamemode( "auto_change" ); - level.spawnmins = ( 1, 1, 1 ); - level.spawnmaxs = ( 1, 1, 1 ); - _a85 = level.teams; - _k85 = getFirstArrayKey( _a85 ); - while ( isDefined( _k85 ) ) + level.spawnmins = ( 0, 0, 0 ); + level.spawnmaxs = ( 0, 0, 0 ); + foreach(team in level.teams) { - team = _a85[ _k85 ]; setobjectivetext( team, &"OBJECTIVES_PREGAME" ); setobjectivehinttext( team, &"OBJECTIVES_PREGAME_HINT" ); if ( level.splitscreen ) @@ -60,7 +64,6 @@ onstartgametype() setobjectivescoretext( team, &"OBJECTIVES_PREGAME_SCORE" ); } maps/mp/gametypes/_spawnlogic::addspawnpoints( team, "mp_dm_spawn" ); - _k85 = getNextArrayKey( _a85, _k85 ); } maps/mp/gametypes/_spawning::updateallspawnpoints(); level.mapcenter = maps/mp/gametypes/_spawnlogic::findboxcenter( level.spawnmins, level.spawnmaxs ); @@ -81,7 +84,7 @@ onstartgametype() startpregame(); } -startpregame() +startpregame() //checked matches cerberus output { game[ "strings" ][ "waiting_for_players" ] = &"MP_WAITING_FOR_X_PLAYERS"; game[ "strings" ][ "pregame" ] = &"MP_PREGAME"; @@ -94,12 +97,12 @@ startpregame() thread pregamemain(); } -onspawnplayerunified() +onspawnplayerunified() //checked matches cerberus output { maps/mp/gametypes/_spawning::onspawnplayer_unified(); } -onspawnplayer( predictedspawn ) +onspawnplayer( predictedspawn ) //checked matches cerberus output { spawnpoints = maps/mp/gametypes/_spawnlogic::getteamspawnpoints( self.pers[ "team" ] ); spawnpoint = maps/mp/gametypes/_spawnlogic::getspawnpoint_dm( spawnpoints ); @@ -113,21 +116,19 @@ onspawnplayer( predictedspawn ) } } -onplayerclasschange( response ) +onplayerclasschange( response ) //checked matches cerberus output { self.pregameclassresponse = response; } -endpregame() +endpregame() //checked changed to match cerberus output { level.pregame = 0; players = level.players; - index = 0; - while ( index < players.size ) + for ( index = 0; index < players.size; index++ ) { player = players[ index ]; player maps/mp/gametypes/_globallogic_player::freezeplayerforroundend(); - index++; } setmatchtalkflag( "EveryoneHearsEveryone", 0 ); level.pregameplayercount destroyelem(); @@ -135,12 +136,11 @@ endpregame() level.pregametitle destroyelem(); } -getplayersneededcount() +getplayersneededcount() //checked changed to match cerberus output { players = level.players; count = 0; - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { player = players[ i ]; team = player.team; @@ -149,16 +149,14 @@ getplayersneededcount() { count++; } - i++; } return int( level.pregame_minplayers - count ); } -saveplayerspregameinfo() +saveplayerspregameinfo() //checked changed to match cerberus output { players = level.players; - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { player = players[ i ]; team = player.team; @@ -171,16 +169,15 @@ saveplayerspregameinfo() { player setpregameclass( class ); } - i++; } } -pregamemain() +pregamemain() //checked did not reference cerberus output used beta dump _pregame.gsc as a reference { level endon( "game_ended" ); - green = ( 0,6, 0,9, 0,6 ); - red = ( 0,7, 0,3, 0,2 ); - yellow = ( 1, 1, 1 ); + green = ( 0.6, 0.9, 0.6 ); + red = ( 0.7, 0.3, 0.2 ); + yellow = ( 1, 1, 0 ); white = ( 1, 1, 1 ); titlesize = 3; textsize = 2; @@ -204,7 +201,7 @@ pregamemain() level.pregamesubtitle.archived = 1; level.pregamesubtitle settext( game[ "strings" ][ "waiting_for_players" ] ); level.pregamesubtitle.color = green; - level.pregameplayercount = createserverfontstring( font, 2,2 ); + level.pregameplayercount = createserverfontstring( font, 2.2 ); level.pregameplayercount setparent( level.pregametitle ); level.pregameplayercount setpoint( "TOP", "BOTTOM", -11, 0 ); level.pregamesubtitle.glowalpha = 1; @@ -215,41 +212,40 @@ pregamemain() level.pregameplayercount.color = yellow; level.pregameplayercount maps/mp/gametypes/_hud::fontpulseinit(); oldcount = -1; - for ( ;; ) + for(;;) { - wait 1; - count = getplayersneededcount(); - if ( count < 0 ) + wait( 1 ); + + count = GetPlayersNeededCount(); + + if ( 0 >= count ) { break; } - else /# - if ( getDvarInt( "scr_pregame_abort" ) > 0 ) + /* +/# + if ( GetDvarint( "scr_pregame_abort" ) > 0 ) { - setdvar( "scr_pregame_abort", 0 ); + SetDvar( "scr_pregame_abort", 0 ); break; + } #/ - } - else + */ + if ( oldcount != count ) { - if ( oldcount != count ) - { - level.pregameplayercount setvalue( count ); - level.pregameplayercount thread maps/mp/gametypes/_hud::fontpulse( level ); - oldcount = count; - } + level.pregamePlayerCount setValue( count ); + level.pregamePlayerCount thread maps\mp\gametypes\_hud::fontPulse( level ); + oldcount = count; } } level.pregameplayercount settext( "" ); level.pregamesubtitle settext( game[ "strings" ][ "pregameover" ] ); players = level.players; - index = 0; - while ( index < players.size ) + for ( index = 0; index < players.size; index++ ) { player = players[ index ]; player maps/mp/gametypes/_globallogic_player::freezeplayerforroundend(); player maps/mp/gametypes/_globallogic_ui::freegameplayhudelems(); - index++; } visionsetnaked( "mpIntro", 3 ); wait 4; @@ -259,12 +255,12 @@ pregamemain() map_restart( 0 ); } -onendgame( winner ) +onendgame( winner ) //checked matches cerberus output { endpregame(); } -ontimelimit() +ontimelimit() //checked changed to match cerberus output { winner = undefined; if ( level.teambased ) @@ -272,21 +268,24 @@ ontimelimit() winner = maps/mp/gametypes/_globallogic::determineteamwinnerbygamestat( "teamScores" ); maps/mp/gametypes/_globallogic_utils::logteamwinstring( "time limit", winner ); } - else winner = maps/mp/gametypes/_globallogic_score::gethighestscoringplayer(); - if ( isDefined( winner ) ) - { - logstring( "time limit, win: " + winner.name ); - } else { - logstring( "time limit, tie" ); + winner = maps/mp/gametypes/_globallogic_score::gethighestscoringplayer(); + if ( isDefined( winner ) ) + { + logstring( "time limit, win: " + winner.name ); + } + else + { + logstring( "time limit, tie" ); + } } makedvarserverinfo( "ui_text_endreason", game[ "strings" ][ "pregame_time_limit_reached" ] ); setdvar( "ui_text_endreason", game[ "strings" ][ "time_limit_reached" ] ); thread maps/mp/gametypes/_globallogic::endgame( winner, game[ "strings" ][ "pregame_time_limit_reached" ] ); } -get_pregame_class() +get_pregame_class() //checked matches cerberus output { pclass = self getpregameclass(); if ( isDefined( pclass ) && pclass[ 0 ] != "" ) @@ -298,3 +297,4 @@ get_pregame_class() return "smg_mp,0"; } } + diff --git a/patch_mp/readme.md b/patch_mp/readme.md index 1affbec..d5e0872 100644 --- a/patch_mp/readme.md +++ b/patch_mp/readme.md @@ -10,6 +10,7 @@ patch_mp/maps/mp/gametypes/_shellshock.gsc ``` ### The following scripts compile and run successfully with major errors: ``` +patch_mp/maps/mp/bots/_bot.gsc ``` ### The following scripts compile and run serverside but clients cannot join due to exe_client_field_mismatch ``` @@ -19,7 +20,6 @@ patch_mp/maps/mp/gametypes/_shellshock.gsc ``` ### The following scripts have been checked, but they have not been tested yet ``` -patch_mp/maps/mp/bots/_bot.gsc patch_mp/maps/mp/bots/_bot_combat.gsc patch_mp/maps/mp/bots/_bot_loadout.gsc patch_mp/maps/mp/bots/_bot_conf.gsc @@ -31,6 +31,7 @@ patch_mp/maps/mp/bots/_bot_hq.gsc patch_mp/maps/mp/bots/_bot_koth.gsc patch_mp/maps/mp/bots/_bot_sd.gsc +patch_mp/maps/mp/gametypes/_battlechatter_mp.gsc patch_mp/maps/mp/gametypes/_callbacksetup.gsc patch_mp/maps/mp/gametypes/_damagefeedback.gsc patch_mp/maps/mp/gametypes/_deathicons.gsc @@ -43,6 +44,8 @@ patch_mp/maps/mp/gametypes/_killcam.gsc patch_mp/maps/mp/gametypes/_menus.gsc patch_mp/maps/mp/gametypes/_objpoints.gsc patch_mp/maps/mp/gametypes/_perplayer.gsc +patch_mp/maps/mp/gametypes/_persistence.gsc +patch_mp/maps/mp/gametypes/_pregame.gsc patch_mp/maps/mp/gametypes/_rank.gsc patch_mp/maps/mp/gametypes/_serversettings.gsc patch_mp/maps/mp/gametypes/_spectating.gsc @@ -65,7 +68,6 @@ patch_mp/maps/mp/gametypes/tdm.gsc ``` ### The following scripts are not checked yet, uploaded to setup a baseline: ``` -patch_mp/maps/mp/gametypes/_battlechatter.gsc patch_mp/maps/mp/gametypes/_class.gsc patch_mp/maps/mp/gametypes/_copter.gsc patch_mp/maps/mp/gametypes/_gameobjects.gsc @@ -80,8 +82,6 @@ patch_mp/maps/mp/gametypes/_globallogic_utils.gsc patch_mp/maps/mp/gametypes/_globallogic_vehicle.gsc patch_mp/maps/mp/gametypes/_hud_message.gsc patch_mp/maps/mp/gametypes/_hud_util.gsc -patch_mp/maps/mp/gametypes/_persistence.gsc -patch_mp/maps/mp/gametypes/_pregame.gsc patch_mp/maps/mp/gametypes/_spawning.gsc patch_mp/maps/mp/gametypes/_spawnlogic.gsc patch_mp/maps/mp/gametypes/_wager.gsc