diff --git a/patch_zm/maps/mp/zombies/_zm_zonemgr.gsc b/patch_zm/maps/mp/zombies/_zm_zonemgr.gsc index ffbe0c0..5727ea9 100644 --- a/patch_zm/maps/mp/zombies/_zm_zonemgr.gsc +++ b/patch_zm/maps/mp/zombies/_zm_zonemgr.gsc @@ -4,7 +4,7 @@ #include maps/mp/_utility; #include common_scripts/utility; -init() +init() //checked matches cerberus output { flag_init( "zones_initialized" ); level.zones = []; @@ -16,58 +16,48 @@ init() } } -zone_is_enabled( zone_name ) +zone_is_enabled( zone_name ) //checked matches cerberus output { - if ( isDefined( level.zones ) || !isDefined( level.zones[ zone_name ] ) && !level.zones[ zone_name ].is_enabled ) + if ( isDefined( level.zones ) || !isDefined( level.zones[ zone_name ] ) || !level.zones[ zone_name ].is_enabled ) { return 0; } return 1; } -get_player_zone() +get_player_zone() //checked changed to match cerberus output { player_zone = undefined; - keys = getarraykeys( level.zones ); - i = 0; - while ( i < keys.size ) + keys = getarraykeys(level.zones); + for(i = 0; i < keys.size; i++) { - if ( self entity_in_zone( keys[ i ] ) ) + if(self entity_in_zone(keys[i])) { - player_zone = keys[ i ]; + player_zone = keys[i]; break; } - else - { - i++; - } } return player_zone; } -get_zone_from_position( v_pos, ignore_enabled_check ) +get_zone_from_position( v_pos, ignore_enabled_check ) //checked changed to match cerberus output { zone = undefined; - scr_org = spawn( "script_origin", v_pos ); - keys = getarraykeys( level.zones ); - i = 0; - while ( i < keys.size ) + scr_org = spawn("script_origin", v_pos); + keys = getarraykeys(level.zones); + for(i = 0; i < keys.size; i++) { - if ( scr_org entity_in_zone( keys[ i ], ignore_enabled_check ) ) + if(scr_org entity_in_zone(keys[i], ignore_enabled_check)) { - zone = keys[ i ]; + zone = keys[i]; break; } - else - { - i++; - } } scr_org delete(); return zone; } -get_zone_magic_boxes( zone_name ) +get_zone_magic_boxes( zone_name ) //checked matches cerberus output { if ( isDefined( zone_name ) && !zone_is_enabled( zone_name ) ) { @@ -77,7 +67,7 @@ get_zone_magic_boxes( zone_name ) return zone.magic_boxes; } -get_zone_zbarriers( zone_name ) +get_zone_zbarriers( zone_name ) //checked matches cerberus output { if ( isDefined( zone_name ) && !zone_is_enabled( zone_name ) ) { @@ -87,98 +77,86 @@ get_zone_zbarriers( zone_name ) return zone.zbarriers; } -get_players_in_zone( zone_name, return_players ) +get_players_in_zone( zone_name, return_players ) //checked changed to match cerberus output { - if ( !zone_is_enabled( zone_name ) ) + if(!zone_is_enabled(zone_name)) { return 0; } - zone = level.zones[ zone_name ]; + zone = level.zones[zone_name]; num_in_zone = 0; players_in_zone = []; players = get_players(); - i = 0; - while ( i < zone.volumes.size ) + for(i = 0; i < zone.volumes.size; i++) { - j = 0; - while ( j < players.size ) + for(j = 0; j < players.size; j++) { - if ( players[ j ] istouching( zone.volumes[ i ] ) ) + if(players[j] istouching(zone.volumes[i])) { num_in_zone++; - players_in_zone[ players_in_zone.size ] = players[ j ]; + players_in_zone[players_in_zone.size] = players[j]; } - j++; } - i++; } - if ( isDefined( return_players ) ) + if(isdefined(return_players)) { return players_in_zone; } return num_in_zone; } -player_in_zone( zone_name ) +player_in_zone( zone_name ) //checked changed to match cerberus output { - if ( !zone_is_enabled( zone_name ) ) + if(!zone_is_enabled(zone_name)) { return 0; } - zone = level.zones[ zone_name ]; - i = 0; - while ( i < zone.volumes.size ) + zone = level.zones[zone_name]; + for(i = 0; i < zone.volumes.size; i++) { players = get_players(); - j = 0; - while ( j < players.size ) + for(j = 0; j < players.size; j++) { - if ( players[ j ] istouching( zone.volumes[ i ] ) && players[ j ].sessionstate != "spectator" ) + if(players[j] istouching(zone.volumes[i]) && !players[j].sessionstate == "spectator") { return 1; } - j++; } - i++; } return 0; } -entity_in_zone( zone_name, ignore_enabled_check ) +entity_in_zone( zone_name, ignore_enabled_check ) //checked changed to match cerberus output { - if ( !zone_is_enabled( zone_name ) && isDefined( ignore_enabled_check ) && !ignore_enabled_check ) + if(!zone_is_enabled(zone_name) && isdefined(ignore_enabled_check ) && !ignore_enabled_check) { return 0; } - zone = level.zones[ zone_name ]; - i = 0; - while ( i < zone.volumes.size ) + zone = level.zones[zone_name]; + for(i = 0; i < zone.volumes.size; i++) { - if ( self istouching( zone.volumes[ i ] ) ) + if(self istouching(zone.volumes[i])) { return 1; } - i++; } return 0; } -deactivate_initial_barrier_goals() +deactivate_initial_barrier_goals() //checked changed to match cerberus output { special_goals = getstructarray( "exterior_goal", "targetname" ); - i = 0; - while ( i < special_goals.size ) + for(i = 0; i < special_goals.size; i++) { - if ( isDefined( special_goals[ i ].script_noteworthy ) ) + if(isdefined(special_goals[i].script_noteworthy)) { - special_goals[ i ].is_active = 0; - special_goals[ i ] trigger_off(); + special_goals[i].is_active = 0; + special_goals[i] trigger_off(); } - i++; } } -zone_init( zone_name ) +zone_init( zone_name ) //checked changed to match cerberus output { if ( isDefined( level.zones[ zone_name ] ) ) { @@ -194,15 +172,14 @@ zone_init( zone_name ) zone.volumes = []; volumes = getentarray( zone_name, "targetname" ); i = 0; - while ( i < volumes.size ) + for(i = 0; i < volumes.size; i++) { - if ( volumes[ i ].classname == "info_volume" ) + if(volumes[i].classname == "info_volume") { - zone.volumes[ zone.volumes.size ] = volumes[ i ]; + zone.volumes[zone.volumes.size] = volumes[i]; } - i++; } - while ( isDefined( zone.volumes[ 0 ].target ) ) + if( isdefined( zone.volumes[ 0 ].target ) ) { spots = getstructarray( zone.volumes[ 0 ].target, "targetname" ); zone.spawn_locations = []; @@ -220,132 +197,113 @@ zone_init( zone_name ) zone.magic_boxes = []; barricades = getstructarray( "exterior_goal", "targetname" ); box_locs = getstructarray( "treasure_chest_use", "targetname" ); - i = 0; - while ( i < spots.size ) + for(i = 0; i < spots.size; i++) { - spots[ i ].zone_name = zone_name; - if ( isDefined( spots[ i ].is_blocked ) && !spots[ i ].is_blocked ) + spots[i].zone_name = zone_name; + if(isdefined(spots[i].is_blocked ) && !spots[i].is_blocked) { - spots[ i ].is_enabled = 1; + spots[i].is_enabled = 1; } else { - spots[ i ].is_enabled = 0; + spots[i].is_enabled = 0; } - tokens = strtok( spots[ i ].script_noteworthy, " " ); - _a325 = tokens; - _k325 = getFirstArrayKey( _a325 ); - while ( isDefined( _k325 ) ) + tokens = strtok(spots[i].script_noteworthy, " "); + foreach(token in tokens) { - token = _a325[ _k325 ]; - if ( token == "dog_location" ) + if(token == "dog_location") { - zone.dog_locations[ zone.dog_locations.size ] = spots[ i ]; + zone.dog_locations[zone.dog_locations.size] = spots[i]; } - else if ( token == "screecher_location" ) + if(token == "screecher_location") { - zone.screecher_locations[ zone.screecher_locations.size ] = spots[ i ]; + zone.screecher_locations[zone.screecher_locations.size] = spots[i]; } - else if ( token == "avogadro_location" ) + if(token == "avogadro_location") { - zone.avogadro_locations[ zone.avogadro_locations.size ] = spots[ i ]; + zone.avogadro_locations[zone.avogadro_locations.size] = spots[i]; } - else if ( token == "inert_location" ) + if(token == "inert_location") { - zone.inert_locations[ zone.inert_locations.size ] = spots[ i ]; + zone.inert_locations[zone.inert_locations.size] = spots[i]; } - else if ( token == "quad_location" ) + if(token == "quad_location") { - zone.quad_locations[ zone.quad_locations.size ] = spots[ i ]; + zone.quad_locations[zone.quad_locations.size] = spots[i]; } - else if ( token == "leaper_location" ) + if(token == "leaper_location") { - zone.leaper_locations[ zone.leaper_locations.size ] = spots[ i ]; + zone.leaper_locations[zone.leaper_locations.size] = spots[i]; } - else if ( token == "brutus_location" ) + if(token == "brutus_location") { - zone.brutus_locations[ zone.brutus_locations.size ] = spots[ i ]; + zone.brutus_locations[zone.brutus_locations.size] = spots[i]; } - else if ( token == "mechz_location" ) + if(token == "mechz_location") { - zone.mechz_locations[ zone.mechz_locations.size ] = spots[ i ]; + zone.mechz_locations[zone.mechz_locations.size] = spots[i]; } - else if ( token == "astro_location" ) + if(token == "astro_location") { - zone.astro_locations[ zone.astro_locations.size ] = spots[ i ]; + zone.astro_locations[zone.astro_locations.size] = spots[i]; } - else if ( token == "napalm_location" ) + if(token == "napalm_location") { - zone.napalm_locations[ zone.napalm_locations.size ] = spots[ i ]; + zone.napalm_locations[zone.napalm_locations.size] = spots[i]; } - else - { - zone.spawn_locations[ zone.spawn_locations.size ] = spots[ i ]; - } - _k325 = getNextArrayKey( _a325, _k325 ); + zone.spawn_locations[zone.spawn_locations.size] = spots[i]; } - while ( isDefined( spots[ i ].script_string ) ) + if(isdefined(spots[i].script_string)) { - barricade_id = spots[ i ].script_string; - k = 0; - while ( k < barricades.size ) + barricade_id = spots[i].script_string; + for(k = 0; k < barricades.size; k++) { - while ( isDefined( barricades[ k ].script_string ) && barricades[ k ].script_string == barricade_id ) + if(isdefined(barricades[k].script_string) && barricades[k].script_string == barricade_id) { - nodes = getnodearray( barricades[ k ].target, "targetname" ); - j = 0; - while ( j < nodes.size ) + nodes = getnodearray(barricades[k].target, "targetname"); + for(j = 0; j < nodes.size; j++) { - if ( isDefined( nodes[ j ].type ) && nodes[ j ].type == "Begin" ) + if(isdefined(nodes[j].type) && nodes[j].type == "Begin") { - spots[ i ].target = nodes[ j ].targetname; + spots[i].target = nodes[j].targetname; } - j++; } } - k++; } } - i++; } - i = 0; - while ( i < barricades.size ) + for(i = 0; i < barricades.size; i++) { - targets = getentarray( barricades[ i ].target, "targetname" ); - j = 0; - while ( j < targets.size ) + targets = getentarray(barricades[i].target, "targetname"); + for(j = 0; j < targets.size; j++) { - if ( targets[ j ] iszbarrier() && isDefined( targets[ j ].script_string ) && targets[ j ].script_string == zone_name ) + if(targets[j] iszbarrier() && isdefined(targets[j].script_string) && targets[j].script_string == zone_name) { - zone.zbarriers[ zone.zbarriers.size ] = targets[ j ]; + zone.zbarriers[zone.zbarriers.size] = targets[j]; } - j++; } - i++; } - i = 0; - while ( i < box_locs.size ) + for(i = 0; i < box_locs.size; i++) { - chest_ent = getent( box_locs[ i ].script_noteworthy + "_zbarrier", "script_noteworthy" ); - if ( chest_ent entity_in_zone( zone_name, 1 ) ) + chest_ent = getent(box_locs[i].script_noteworthy + "_zbarrier", "script_noteworthy"); + if(chest_ent entity_in_zone(zone_name, 1)) { - zone.magic_boxes[ zone.magic_boxes.size ] = box_locs[ i ]; + zone.magic_boxes[zone.magic_boxes.size] = box_locs[i]; } - i++; } } } -reinit_zone_spawners() + +reinit_zone_spawners() //checked changed to match cerberus output { - zkeys = getarraykeys( level.zones ); - i = 0; - while ( i < level.zones.size ) + zkeys = getarraykeys(level.zones); + for(i = 0; i < level.zones.size; i++) { zone = level.zones[ zkeys[ i ] ]; - while ( isDefined( zone.volumes[ 0 ].target ) ) + if(isdefined(zone.volumes[0].target)) { - spots = getstructarray( zone.volumes[ 0 ].target, "targetname" ); + spots = getstructarray(zone.volumes[0].target, "targetname"); zone.spawn_locations = []; zone.dog_locations = []; zone.screecher_locations = []; @@ -356,103 +314,90 @@ reinit_zone_spawners() zone.mechz_locations = []; zone.astro_locations = []; zone.napalm_locations = []; - j = 0; - while ( j < spots.size ) + for(j = 0; j < spots.size; j++) { spots[ j ].zone_name = zkeys[ j ]; - if ( isDefined( spots[ j ].is_blocked ) && !spots[ j ].is_blocked ) + if(isdefined(spots[ j ].is_blocked ) && !spots[j].is_blocked) { - spots[ j ].is_enabled = 1; + spots[j].is_enabled = 1; } else { - spots[ j ].is_enabled = 0; + spots[j].is_enabled = 0; } - tokens = strtok( spots[ j ].script_noteworthy, " " ); - _a452 = tokens; - _k452 = getFirstArrayKey( _a452 ); - while ( isDefined( _k452 ) ) + tokens = strtok(spots[j].script_noteworthy, " "); + foreach(token in tokens) { - token = _a452[ _k452 ]; - if ( token == "dog_location" ) + if(token == "dog_location") { - zone.dog_locations[ zone.dog_locations.size ] = spots[ j ]; + zone.dog_locations[zone.dog_locations.size] = spots[j]; } - else if ( token == "screecher_location" ) + if(token == "screecher_location") { - zone.screecher_locations[ zone.screecher_locations.size ] = spots[ j ]; + zone.screecher_locations[zone.screecher_locations.size] = spots[j]; } - else if ( token == "avogadro_location" ) + if(token == "avogadro_location") { - zone.avogadro_locations[ zone.avogadro_locations.size ] = spots[ j ]; + zone.avogadro_locations[zone.avogadro_locations.size] = spots[j]; } - else if ( token == "quad_location" ) + if(token == "quad_location") { - zone.quad_locations[ zone.quad_locations.size ] = spots[ j ]; + zone.quad_locations[zone.quad_locations.size] = spots[j]; } - else if ( token == "leaper_location" ) + if(token == "leaper_location") { - zone.leaper_locations[ zone.leaper_locations.size ] = spots[ j ]; + zone.leaper_locations[zone.leaper_locations.size] = spots[j]; } - else if ( token == "brutus_location" ) + if(token == "brutus_location") { - zone.brutus_locations[ zone.brutus_locations.size ] = spots[ j ]; + zone.brutus_locations[zone.brutus_locations.size] = spots[j]; } - else if ( token == "mechz_location" ) + if(token == "mechz_location") { - zone.mechz_locations[ zone.mechz_locations.size ] = spots[ j ]; + zone.mechz_locations[zone.mechz_locations.size] = spots[j]; } - else if ( token == "astro_location" ) + if(token == "astro_location") { - zone.astro_locations[ zone.astro_locations.size ] = spots[ j ]; + zone.astro_locations[zone.astro_locations.size] = spots[j]; } - else if ( token == "napalm_location" ) + if(token == "napalm_location") { - zone.napalm_locations[ zone.napalm_locations.size ] = spots[ j ]; + zone.napalm_locations[zone.napalm_locations.size] = spots[j]; } - else - { - zone.spawn_locations[ zone.spawn_locations.size ] = spots[ j ]; - } - _k452 = getNextArrayKey( _a452, _k452 ); + zone.spawn_locations[zone.spawn_locations.size] = spots[j]; } - j++; } } - i++; } } -enable_zone( zone_name ) + +enable_zone( zone_name ) //checked changed to match cerberus output { - if ( level.zones[ zone_name ].is_enabled ) + if(level.zones[zone_name].is_enabled) { return; } - level.zones[ zone_name ].is_enabled = 1; - level.zones[ zone_name ].is_spawning_allowed = 1; - level notify( zone_name ); + level.zones[zone_name].is_enabled = 1; + level.zones[zone_name].is_spawning_allowed = 1; + level notify(zone_name); spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype(); - i = 0; - while ( i < spawn_points.size ) + for(i = 0; i < spawn_points.size; i++) { - if ( spawn_points[ i ].script_noteworthy == zone_name ) + if(spawn_points[i].script_noteworthy == zone_name) { - spawn_points[ i ].locked = 0; + spawn_points[i].locked = 0; } - i++; } - entry_points = getstructarray( zone_name + "_barriers", "script_noteworthy" ); - i = 0; - while ( i < entry_points.size ) + entry_points = getstructarray(zone_name + "_barriers", "script_noteworthy"); + for(i = 0; i < entry_points.size; i++) { - entry_points[ i ].is_active = 1; - entry_points[ i ] trigger_on(); - i++; + entry_points[i].is_active = 1; + entry_points[i] trigger_on(); } } -make_zone_adjacent( main_zone_name, adj_zone_name, flag_name ) +make_zone_adjacent( main_zone_name, adj_zone_name, flag_name ) //checked matches cerberus output { main_zone = level.zones[ main_zone_name ]; if ( !isDefined( main_zone.adjacent_zones[ adj_zone_name ] ) ) @@ -479,7 +424,7 @@ make_zone_adjacent( main_zone_name, adj_zone_name, flag_name ) } } -add_zone_flags( wait_flag, add_flags ) +add_zone_flags( wait_flag, add_flags ) //checked changed to match cerberus output { if ( !isarray( add_flags ) ) { @@ -489,19 +434,18 @@ add_zone_flags( wait_flag, add_flags ) } keys = getarraykeys( level.zone_flags ); i = 0; - while ( i < keys.size ) + for(i = 0; i < keys.size; i++) { - if ( keys[ i ] == wait_flag ) + if(keys[i] == wait_flag) { - level.zone_flags[ keys[ i ] ] = arraycombine( level.zone_flags[ keys[ i ] ], add_flags, 1, 0 ); + level.zone_flags[ keys[ i ] ] = arraycombine(level.zone_flags[ keys[ i ] ], add_flags, 1, 0); return; } - i++; } level.zone_flags[ wait_flag ] = add_flags; } -add_adjacent_zone( zone_name_a, zone_name_b, flag_name, one_way ) +add_adjacent_zone( zone_name_a, zone_name_b, flag_name, one_way ) //checked matches cerberus output { if ( !isDefined( one_way ) ) { @@ -520,121 +464,100 @@ add_adjacent_zone( zone_name_a, zone_name_b, flag_name, one_way ) } } -setup_zone_flag_waits() +setup_zone_flag_waits() //checked changed to match cerberus output { flags = []; - zkeys = getarraykeys( level.zones ); - z = 0; - while ( z < level.zones.size ) + zkeys = getarraykeys(level.zones); + for(z = 0; z < level.zones.size; z++) { zone = level.zones[ zkeys[ z ] ]; - azkeys = getarraykeys( zone.adjacent_zones ); - az = 0; - while ( az < zone.adjacent_zones.size ) + azkeys = getarraykeys(zone.adjacent_zones); + for(az = 0; az < zone.adjacent_zones.size; az++) { azone = zone.adjacent_zones[ azkeys[ az ] ]; - f = 0; - while ( f < azone.flags.size ) + for(f = 0; f < azone.flags.size; f++) { - flags = add_to_array( flags, azone.flags[ f ], 0 ); - f++; + flags = add_to_array(flags, azone.flags[f], 0); } - az++; } - z++; } - i = 0; - while ( i < flags.size ) + for(i = 0; i < flags.size; i++) { - level thread zone_flag_wait( flags[ i ] ); - i++; + level thread zone_flag_wait(flags[i]); } } zone_flag_wait( flag_name ) { - if ( !isDefined( level.flag[ flag_name ] ) ) + if(!isdefined(level.flag[flag_name])) { - flag_init( flag_name ); + flag_init(flag_name); } - flag_wait( flag_name ); + flag_wait(flag_name); flags_set = 0; - z = 0; - while ( z < level.zones.size ) + for(z = 0; z < level.zones.size; z++) { - zkeys = getarraykeys( level.zones ); + zkeys = getarraykeys(level.zones); zone = level.zones[ zkeys[ z ] ]; - az = 0; - while ( az < zone.adjacent_zones.size ) + for(az = 0; az < zone.adjacent_zones.size; az++) { - azkeys = getarraykeys( zone.adjacent_zones ); + azkeys = getarraykeys(zone.adjacent_zones); azone = zone.adjacent_zones[ azkeys[ az ] ]; - if ( !azone.is_connected ) + if(!azone.is_connected) { - if ( azone.flags_do_or_check ) + if(azone.flags_do_or_check) { flags_set = 0; - f = 0; - while ( f < azone.flags.size ) + for(f = 0; f < azone.flags.size; f++) { - if ( flag( azone.flags[ f ] ) ) + if(flag(azone.flags[f])) { flags_set = 1; break; } - else - { - f++; - } } + //break; } - else flags_set = 1; - f = 0; - while ( f < azone.flags.size ) + flags_set = 1; + for(f = 0; f < azone.flags.size; f++) { - if ( !flag( azone.flags[ f ] ) ) + if(!flag(azone.flags[f])) { flags_set = 0; } - f++; } - if ( flags_set ) + if(flags_set) { enable_zone( zkeys[ z ] ); azone.is_connected = 1; - if ( !level.zones[ azkeys[ az ] ].is_enabled ) + if(!level.zones[ azkeys[ az ] ].is_enabled) { - enable_zone( azkeys[ az ] ); + enable_zone(azkeys[az]); } - if ( flag( "door_can_close" ) ) + if(flag("door_can_close")) { - azone thread door_close_disconnect( flag_name ); + azone thread door_close_disconnect(flag_name); } } } - az++; } - z++; } - keys = getarraykeys( level.zone_flags ); - i = 0; - while ( i < keys.size ) + keys = getarraykeys(level.zone_flags); + for(i = 0; i < keys.size; i++) { - if ( keys[ i ] == flag_name ) + if(keys[i] == flag_name) { check_flag = level.zone_flags[ keys[ i ] ]; - k = 0; - while ( k < check_flag.size ) + for(k = 0; k < check_flag.size; k++) { - flag_set( check_flag[ k ] ); - k++; + flag_set(check_flag[k]); } + //break; } - else i++; } } -door_close_disconnect( flag_name ) +door_close_disconnect( flag_name ) //checked matches cerberus output { while ( flag( flag_name ) ) { @@ -644,7 +567,7 @@ door_close_disconnect( flag_name ) level thread zone_flag_wait( flag_name ); } -connect_zones( zone_name_a, zone_name_b, one_way ) +connect_zones( zone_name_a, zone_name_b, one_way ) //checked matches cerberus output { if ( !isDefined( one_way ) ) { @@ -669,130 +592,114 @@ connect_zones( zone_name_a, zone_name_b, one_way ) } } -manage_zones( initial_zone ) +manage_zones( initial_zone ) //checked changed to match cerberus output { deactivate_initial_barrier_goals(); zone_choke = 0; spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype(); - i = 0; - while ( i < spawn_points.size ) + for(i = 0; i < spawn_points.size; i++) { - - spawn_points[ i ].locked = 1; - i++; + spawn_points[i].locked = 1; } if ( isDefined( level.zone_manager_init_func ) ) { [[ level.zone_manager_init_func ]](); } - if ( isarray( initial_zone ) ) + if(isarray(initial_zone)) { - i = 0; - while ( i < initial_zone.size ) + for(i = 0; i < initial_zone.size; i++) { - zone_init( initial_zone[ i ] ); - enable_zone( initial_zone[ i ] ); - i++; + zone_init(initial_zone[i]); + enable_zone(initial_zone[i]); } } - zone_init( initial_zone ); - enable_zone( initial_zone ); + else + { + zone_init(initial_zone); + enable_zone(initial_zone); + } setup_zone_flag_waits(); zkeys = getarraykeys( level.zones ); level.zone_keys = zkeys; level.newzones = []; - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { level.newzones[ zkeys[ z ] ] = spawnstruct(); - z++; } oldzone = undefined; flag_set( "zones_initialized" ); flag_wait( "begin_spawning" ); - while ( getDvarInt( #"10873CCA" ) == 0 || getDvarInt( #"762F1309" ) != 0 ) + while ( getDvarInt( "noclip" ) == 0 || getDvarInt( "notarget" ) != 0 ) { - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { level.newzones[ zkeys[ z ] ].is_active = 0; level.newzones[ zkeys[ z ] ].is_occupied = 0; - z++; } a_zone_is_active = 0; a_zone_is_spawning_allowed = 0; level.zone_scanning_active = 1; - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { zone = level.zones[ zkeys[ z ] ]; newzone = level.newzones[ zkeys[ z ] ]; - if ( !zone.is_enabled ) + if(!zone.is_enabled) { - z++; continue; } + if(isdefined(level.zone_occupied_func)) + { + newzone.is_occupied = [[ level.zone_occupied_func ]]( zkeys[ z ] ); + } else { - if ( isDefined( level.zone_occupied_func ) ) + newzone.is_occupied = player_in_zone( zkeys[ z ] ); + } + if(newzone.is_occupied) + { + newzone.is_active = 1; + a_zone_is_active = 1; + if(zone.is_spawning_allowed) { - newzone.is_occupied = [[ level.zone_occupied_func ]]( zkeys[ z ] ); + a_zone_is_spawning_allowed = 1; } - else + if(!isdefined(oldzone) || oldzone != newzone) { - newzone.is_occupied = player_in_zone( zkeys[ z ] ); + level notify("newzoneActive", zkeys[ z ]); + oldzone = newzone; } - while ( newzone.is_occupied ) + azkeys = getarraykeys(zone.adjacent_zones); + for(az = 0; az < zone.adjacent_zones.size; az++) { - newzone.is_active = 1; - a_zone_is_active = 1; - if ( zone.is_spawning_allowed ) + if(zone.adjacent_zones[ azkeys[ az ] ].is_connected && level.zones[ azkeys[ az ] ].is_enabled) { - a_zone_is_spawning_allowed = 1; - } - if ( !isDefined( oldzone ) || oldzone != newzone ) - { - level notify( "newzoneActive" ); - oldzone = newzone; - } - azkeys = getarraykeys( zone.adjacent_zones ); - az = 0; - while ( az < zone.adjacent_zones.size ) - { - if ( zone.adjacent_zones[ azkeys[ az ] ].is_connected && level.zones[ azkeys[ az ] ].is_enabled ) + level.newzones[ azkeys[ az ] ].is_active = 1; + if(level.zones[ azkeys[ az ] ].is_spawning_allowed) { - level.newzones[ azkeys[ az ] ].is_active = 1; - if ( level.zones[ azkeys[ az ] ].is_spawning_allowed ) - { - a_zone_is_spawning_allowed = 1; - } + a_zone_is_spawning_allowed = 1; } - az++; } } - zone_choke++; - if ( zone_choke >= 3 ) - { - zone_choke = 0; - wait 0.05; - } } - z++; + zone_choke++; + if(zone_choke >= 3) + { + zone_choke = 0; + wait(0.05); + } } level.zone_scanning_active = 0; - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { level.zones[ zkeys[ z ] ].is_active = level.newzones[ zkeys[ z ] ].is_active; level.zones[ zkeys[ z ] ].is_occupied = level.newzones[ zkeys[ z ] ].is_occupied; - z++; } - if ( !a_zone_is_active || !a_zone_is_spawning_allowed ) + if(!a_zone_is_active || !a_zone_is_spawning_allowed) { - if ( isarray( initial_zone ) ) + if(isarray(initial_zone)) { level.zones[ initial_zone[ 0 ] ].is_active = 1; level.zones[ initial_zone[ 0 ] ].is_occupied = 1; @@ -800,113 +707,101 @@ manage_zones( initial_zone ) } else { - level.zones[ initial_zone ].is_active = 1; - level.zones[ initial_zone ].is_occupied = 1; - level.zones[ initial_zone ].is_spawning_allowed = 1; + level.zones[initial_zone].is_active = 1; + level.zones[initial_zone].is_occupied = 1; + level.zones[initial_zone].is_spawning_allowed = 1; } } [[ level.create_spawner_list_func ]]( zkeys ); - level.active_zone_names = maps/mp/zombies/_zm_zonemgr::get_active_zone_names(); - wait 1; + wait(1); } } -debug_show_spawn_locations() +debug_show_spawn_locations() //checked dev call deleted { } -old_manage_zones( initial_zone ) +old_manage_zones( initial_zone ) //checked changed to match cerberus output { deactivate_initial_barrier_goals(); spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype(); - i = 0; - while ( i < spawn_points.size ) + for(i = 0; i < spawn_points.size; i++) { - spawn_points[ i ].locked = 1; - i++; + spawn_points[i].locked = 1; } if ( isDefined( level.zone_manager_init_func ) ) { [[ level.zone_manager_init_func ]](); } - if ( isarray( initial_zone ) ) + if(isarray(initial_zone)) { - i = 0; - while ( i < initial_zone.size ) + for(i = 0; i < initial_zone.size; i++) { - zone_init( initial_zone[ i ] ); - enable_zone( initial_zone[ i ] ); - i++; + zone_init(initial_zone[ i ]); + enable_zone(initial_zone[ i ]); } } - zone_init( initial_zone ); - enable_zone( initial_zone ); + else + { + zone_init(initial_zone); + enable_zone(initial_zone); + } setup_zone_flag_waits(); zkeys = getarraykeys( level.zones ); level.zone_keys = zkeys; flag_set( "zones_initialized" ); flag_wait( "begin_spawning" ); - while ( getDvarInt( #"10873CCA" ) == 0 || getDvarInt( #"762F1309" ) != 0 ) + while ( getDvarInt( "noclip" ) == 0 || getDvarInt( "notarget" ) != 0 ) { - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { level.zones[ zkeys[ z ] ].is_active = 0; level.zones[ zkeys[ z ] ].is_occupied = 0; - z++; } a_zone_is_active = 0; a_zone_is_spawning_allowed = 0; - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { zone = level.zones[ zkeys[ z ] ]; - if ( !zone.is_enabled ) + if(!zone.is_enabled) { - z++; continue; } + if(isdefined(level.zone_occupied_func)) + { + zone.is_occupied = [[ level.zone_occupied_func ]]( zkeys[ z ] ); + } else { - if ( isDefined( level.zone_occupied_func ) ) + zone.is_occupied = player_in_zone( zkeys[ z ] ); + } + if(zone.is_occupied) + { + zone.is_active = 1; + a_zone_is_active = 1; + if(zone.is_spawning_allowed) { - zone.is_occupied = [[ level.zone_occupied_func ]]( zkeys[ z ] ); + a_zone_is_spawning_allowed = 1; } - else + azkeys = getarraykeys(zone.adjacent_zones); + for(az = 0; az < zone.adjacent_zones.size; az++) { - zone.is_occupied = player_in_zone( zkeys[ z ] ); - } - while ( zone.is_occupied ) - { - zone.is_active = 1; - a_zone_is_active = 1; - if ( zone.is_spawning_allowed ) + if(zone.adjacent_zones[ azkeys[ az ] ].is_connected && level.zones[ azkeys[ az ] ].is_enabled) { - a_zone_is_spawning_allowed = 1; - } - azkeys = getarraykeys( zone.adjacent_zones ); - az = 0; - while ( az < zone.adjacent_zones.size ) - { - if ( zone.adjacent_zones[ azkeys[ az ] ].is_connected && level.zones[ azkeys[ az ] ].is_enabled ) + level.zones[ azkeys[ az ] ].is_active = 1; + if(level.zones[ azkeys[ az ] ].is_spawning_allowed) { - level.zones[ azkeys[ az ] ].is_active = 1; - if ( level.zones[ azkeys[ az ] ].is_spawning_allowed ) - { - a_zone_is_spawning_allowed = 1; - } + a_zone_is_spawning_allowed = 1; } - az++; } } } - z++; } - if ( !a_zone_is_active || !a_zone_is_spawning_allowed ) + if(!a_zone_is_active || !a_zone_is_spawning_allowed) { - if ( isarray( initial_zone ) ) + if(isarray(initial_zone)) { level.zones[ initial_zone[ 0 ] ].is_active = 1; level.zones[ initial_zone[ 0 ] ].is_occupied = 1; @@ -921,11 +816,11 @@ old_manage_zones( initial_zone ) } [[ level.create_spawner_list_func ]]( zkeys ); level.active_zone_names = maps/mp/zombies/_zm_zonemgr::get_active_zone_names(); - wait 1; + wait(1); } } -create_spawner_list( zkeys ) +create_spawner_list( zkeys ) //checked changed to match cerberus output { level.zombie_spawn_locations = []; level.inert_locations = []; @@ -938,117 +833,94 @@ create_spawner_list( zkeys ) level.zombie_brutus_locations = []; level.zombie_mechz_locations = []; level.zombie_napalm_locations = []; - z = 0; - while ( z < zkeys.size ) + for(z = 0; z < zkeys.size; z++) { zone = level.zones[ zkeys[ z ] ]; - while ( zone.is_enabled && zone.is_active && zone.is_spawning_allowed ) + if(zone.is_enabled && zone.is_active && zone.is_spawning_allowed) { - i = 0; - while ( i < zone.spawn_locations.size ) + for(i = 0; i < zone.spawn_locations.size; i++) { - if ( zone.spawn_locations[ i ].is_enabled ) + if(zone.spawn_locations[ i ].is_enabled) { - level.zombie_spawn_locations[ level.zombie_spawn_locations.size ] = zone.spawn_locations[ i ]; + level.zombie_spawn_locations[level.zombie_spawn_locations.size] = zone.spawn_locations[i]; } - i++; } - x = 0; - while ( x < zone.inert_locations.size ) + for(x = 0; x < zone.inert_locations.size; x++) { - if ( zone.inert_locations[ x ].is_enabled ) + if(zone.inert_locations[x].is_enabled) { - level.inert_locations[ level.inert_locations.size ] = zone.inert_locations[ x ]; + level.inert_locations[level.inert_locations.size] = zone.inert_locations[x]; } - x++; } - x = 0; - while ( x < zone.dog_locations.size ) + for(x = 0; x < zone.dog_locations.size; x++) { - if ( zone.dog_locations[ x ].is_enabled ) + if(zone.dog_locations[x].is_enabled) { - level.enemy_dog_locations[ level.enemy_dog_locations.size ] = zone.dog_locations[ x ]; + level.enemy_dog_locations[level.enemy_dog_locations.size] = zone.dog_locations[x]; } - x++; } - x = 0; - while ( x < zone.screecher_locations.size ) + for(x = 0; x < zone.screecher_locations.size; x++) { - if ( zone.screecher_locations[ x ].is_enabled ) + if(zone.screecher_locations[x].is_enabled) { - level.zombie_screecher_locations[ level.zombie_screecher_locations.size ] = zone.screecher_locations[ x ]; + level.zombie_screecher_locations[level.zombie_screecher_locations.size] = zone.screecher_locations[x]; } - x++; } - x = 0; - while ( x < zone.avogadro_locations.size ) + for(x = 0; x < zone.avogadro_locations.size; x++) { - if ( zone.avogadro_locations[ x ].is_enabled ) + if(zone.avogadro_locations[x].is_enabled) { - level.zombie_avogadro_locations[ level.zombie_avogadro_locations.size ] = zone.avogadro_locations[ x ]; + level.zombie_avogadro_locations[level.zombie_avogadro_locations.size] = zone.avogadro_locations[x]; } - x++; } - x = 0; - while ( x < zone.quad_locations.size ) + for(x = 0; x < zone.quad_locations.size; x++) { - if ( zone.quad_locations[ x ].is_enabled ) + if(zone.quad_locations[x].is_enabled) { - level.quad_locations[ level.quad_locations.size ] = zone.quad_locations[ x ]; + level.quad_locations[level.quad_locations.size] = zone.quad_locations[x]; } - x++; } - x = 0; - while ( x < zone.leaper_locations.size ) + for(x = 0; x < zone.leaper_locations.size; x++) { - if ( zone.leaper_locations[ x ].is_enabled ) + if(zone.leaper_locations[x].is_enabled) { - level.zombie_leaper_locations[ level.zombie_leaper_locations.size ] = zone.leaper_locations[ x ]; + level.zombie_leaper_locations[level.zombie_leaper_locations.size] = zone.leaper_locations[x]; } - x++; } - x = 0; - while ( x < zone.astro_locations.size ) + for(x = 0; x < zone.astro_locations.size; x++) { - if ( zone.astro_locations[ x ].is_enabled ) + if(zone.astro_locations[x].is_enabled) { - level.zombie_astro_locations[ level.zombie_astro_locations.size ] = zone.astro_locations[ x ]; + level.zombie_astro_locations[level.zombie_astro_locations.size] = zone.astro_locations[x]; } - x++; } - x = 0; - while ( x < zone.napalm_locations.size ) + for(x = 0; x < zone.napalm_locations.size; x++) { - if ( zone.napalm_locations[ x ].is_enabled ) + if(zone.napalm_locations[x].is_enabled) { - level.zombie_napalm_locations[ level.zombie_napalm_locations.size ] = zone.napalm_locations[ x ]; + level.zombie_napalm_locations[level.zombie_napalm_locations.size] = zone.napalm_locations[x]; } - x++; } - x = 0; - while ( x < zone.brutus_locations.size ) + for(x = 0; x < zone.brutus_locations.size; x++) { - if ( zone.brutus_locations[ x ].is_enabled ) + if(zone.brutus_locations[x].is_enabled) { - level.zombie_brutus_locations[ level.zombie_brutus_locations.size ] = zone.brutus_locations[ x ]; + level.zombie_brutus_locations[level.zombie_brutus_locations.size] = zone.brutus_locations[x]; } - x++; } - x = 0; - while ( x < zone.mechz_locations.size ) + for(x = 0; x < zone.mechz_locations.size; x++) { - if ( zone.mechz_locations[ x ].is_enabled ) + if(zone.mechz_locations[x].is_enabled) { - level.zombie_mechz_locations[ level.zombie_mechz_locations.size ] = zone.mechz_locations[ x ]; + level.zombie_mechz_locations[level.zombie_mechz_locations.size] = zone.mechz_locations[x]; } - x++; } } - z++; } } -get_active_zone_names() + +get_active_zone_names() //checked changed to match cerberus output { ret_list = []; if ( !isDefined( level.zone_keys ) ) @@ -1060,18 +932,17 @@ get_active_zone_names() wait 0.05; } i = 0; - while ( i < level.zone_keys.size ) + for(i = 0; i < level.zone_keys.size; i++) { - if ( level.zones[ level.zone_keys[ i ] ].is_active ) + if(level.zones[ level.zone_keys[ i ] ].is_active) { ret_list[ ret_list.size ] = level.zone_keys[ i ]; } - i++; } return ret_list; } -_init_debug_zones() +_init_debug_zones() //checked changed to match cerberus output { current_y = 30; current_x = 20; @@ -1082,128 +953,116 @@ _init_debug_zones() xloc[ 3 ] = 130; xloc[ 4 ] = 170; zkeys = getarraykeys( level.zones ); - i = 0; - while ( i < zkeys.size ) + for(i = 0; i < zkeys.size; i++) { - zonename = zkeys[ i ]; - zone = level.zones[ zonename ]; + zonename = zkeys[i]; + zone = level.zones[zonename]; zone.debug_hud = []; - j = 0; - while ( j < 5 ) + for(j = 0; j < 5; j++) { - zone.debug_hud[ j ] = newdebughudelem(); - if ( !j ) + zone.debug_hud[j] = newdebughudelem(); + if(!j) { - zone.debug_hud[ j ].alignx = "right"; + zone.debug_hud[j].alignx = "right"; } else { - zone.debug_hud[ j ].alignx = "left"; + zone.debug_hud[j].alignx = "left"; } - zone.debug_hud[ j ].x = xloc[ j ]; - zone.debug_hud[ j ].y = current_y; - j++; + zone.debug_hud[j].x = xloc[j]; + zone.debug_hud[j].y = current_y; } - current_y += 10; - zone.debug_hud[ 0 ] settext( zonename ); - i++; + current_y = current_y + 10; + zone.debug_hud[0] settext(zonename); } } -_destroy_debug_zones() +_destroy_debug_zones() //checked changed to match cerberus output { - zkeys = getarraykeys( level.zones ); - i = 0; - while ( i < zkeys.size ) + zkeys = getarraykeys(level.zones); + for(i = 0; i < zkeys.size; i++) { - zonename = zkeys[ i ]; - zone = level.zones[ zonename ]; - j = 0; - while ( j < 5 ) + zonename = zkeys[i]; + zone = level.zones[zonename]; + for(j = 0; j < 5; j++) { - zone.debug_hud[ j ] destroy(); - j++; + zone.debug_hud[j] destroy(); + zone.debug_hud[j] = undefined; } - i++; } } -_debug_zones() +_debug_zones() //checked changed to match cerberus output { enabled = 0; if ( getDvar( "zombiemode_debug_zones" ) == "" ) { setdvar( "zombiemode_debug_zones", "0" ); } - while ( 1 ) + while(1) { wasenabled = enabled; - enabled = getDvarInt( "zombiemode_debug_zones" ); - if ( enabled && !wasenabled ) + enabled = GetDvarInt(hash_10e35bc4); + if(enabled && !wasenabled) { _init_debug_zones(); } - else + else if(!enabled && wasenabled) { - if ( !enabled && wasenabled ) - { - _destroy_debug_zones(); - } + _destroy_debug_zones(); } - while ( enabled ) + if(enabled) { - zkeys = getarraykeys( level.zones ); - i = 0; - while ( i < zkeys.size ) + zkeys = getarraykeys(level.zones); + for(i = 0; i < zkeys.size; i++) { - zonename = zkeys[ i ]; - zone = level.zones[ zonename ]; + zonename = zkeys[i]; + zone = level.zones[zonename]; text = zonename; - zone.debug_hud[ 0 ] settext( text ); - if ( zone.is_enabled ) + zone.debug_hud[0] settext(text); + if(zone.is_enabled) { - text += " Enabled"; - zone.debug_hud[ 1 ] settext( "Enabled" ); + text = text + " Enabled"; + zone.debug_hud[1] settext("Enabled"); } else { - zone.debug_hud[ 1 ] settext( "" ); + zone.debug_hud[1] settext(""); } - if ( zone.is_active ) + if(zone.is_active) { - text += " Active"; - zone.debug_hud[ 2 ] settext( "Active" ); + text = text + " Active"; + zone.debug_hud[2] settext("Active"); } else { - zone.debug_hud[ 2 ] settext( "" ); + zone.debug_hud[2] settext(""); } - if ( zone.is_occupied ) + if(zone.is_occupied) { - text += " Occupied"; - zone.debug_hud[ 3 ] settext( "Occupied" ); + text = text + " Occupied"; + zone.debug_hud[3] settext("Occupied"); } else { - zone.debug_hud[ 3 ] settext( "" ); + zone.debug_hud[3] settext(""); } - if ( zone.is_spawning_allowed ) + if(zone.is_spawning_allowed) { - text += " SpawningAllowed"; - zone.debug_hud[ 4 ] settext( "SpawningAllowed" ); + text = text + " SpawningAllowed"; + zone.debug_hud[4] settext("SpawningAllowed"); } else { - zone.debug_hud[ 4 ] settext( "" ); + zone.debug_hud[4] settext(""); } - i++; } } - wait 0.1; + wait(0.1); } } -is_player_in_zone( zone_name ) +is_player_in_zone( zone_name ) //checked changed to match cerberus output { zone = level.zones[ zone_name ]; i = 0; @@ -1218,3 +1077,5 @@ is_player_in_zone( zone_name ) return 0; } + + diff --git a/patch_zm/readme.md b/patch_zm/readme.md index c031520..51a099a 100644 --- a/patch_zm/readme.md +++ b/patch_zm/readme.md @@ -35,12 +35,14 @@ patch_zm/maps/mp/zombies/_zm_timer.gsc ``` ### The following scripts compile and run successfully with major errors: ``` -patch_zm/maps/mp/gametypes_zm/MajorErrors/_zm_gametype.gsc +patch_zm/maps/mp/gametypes_zm/_zm_gametype.gsc patch_zm/maps/mp/zombies/_zm_chugabud.gsc patch_zm/maps/mp/zombies/_zm_magicbox.gsc patch_zm/maps/mp/zombies/_zm_perks.gsc patch_zm/maps/mp/zombies/_zm_powerups.gsc patch_zm/maps/mp/zombies/_zm_weapons.gsc +patch_zm/maps/mp/zombies/_zm_zonemgr.gsc + ``` ### The following scripts compile and run serverside but clients cannot join due to exe_client_field_mismatch ```