From: Mario Date: Sun, 21 Aug 2016 14:13:25 +0000 (+1000) Subject: Intrusify more stuff X-Git-Tag: xonotic-v0.8.2~663^2~20 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3744a5478c28b4ab4960f7acf6524b413811092f;p=xonotic%2Fxonotic-data.pk3dir.git Intrusify more stuff --- diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index c8e353928..0fde9e043 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -12,6 +12,9 @@ REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_MUSIC) #ifdef SVQC +IntrusiveList g_targetmusic_list; +STATIC_INIT(g_targetmusic_list) { g_targetmusic_list = IL_NEW(); } + // values: // volume // noise @@ -37,7 +40,8 @@ void target_music_reset(entity this) } void target_music_kill() { - FOREACH_ENTITY_CLASS("target_music", true, { + IL_EACH(g_targetmusic_list, true, + { it.volume = 0; if (it.targetname == "") target_music_sendto(it, MSG_ALL, 1); @@ -65,6 +69,7 @@ spawnfunc(target_music) this.reset = target_music_reset; if(!this.volume) this.volume = 1; + IL_PUSH(g_targetmusic_list, this); if(this.targetname == "") target_music_sendto(this, MSG_INIT, 1); else @@ -72,7 +77,7 @@ spawnfunc(target_music) } void TargetMusic_RestoreGame() { - FOREACH_ENTITY_CLASS("target_music", true, + IL_EACH(g_targetmusic_list, true, { if(it.targetname == "") target_music_sendto(it, MSG_INIT, 1); diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index a1a38d39e..b5e97b1fc 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -267,10 +267,10 @@ void teleport_findtarget(entity this) entity Teleport_Find(vector mi, vector ma) { - entity e; - for(e = NULL; (e = find(e, classname, "trigger_teleport")); ) - if(WarpZoneLib_BoxTouchesBrush(mi, ma, e, NULL)) - return e; + IL_EACH(g_teleporters, WarpZoneLib_BoxTouchesBrush(mi, ma, it, NULL), + { + return it; + }); return NULL; } diff --git a/qcsrc/common/triggers/teleporters.qh b/qcsrc/common/triggers/teleporters.qh index 513ed3e26..6f5f8cb76 100644 --- a/qcsrc/common/triggers/teleporters.qh +++ b/qcsrc/common/triggers/teleporters.qh @@ -1,5 +1,8 @@ #pragma once +IntrusiveList g_teleporters; +STATIC_INIT(g_teleporters) { g_teleporters = IL_NEW(); } + .entity pusher; const float TELEPORT_FLAG_SOUND = 1; const float TELEPORT_FLAG_PARTICLES = 2; diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 05bb13c71..c3de65460 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -99,6 +99,8 @@ spawnfunc(trigger_teleport) return; } + IL_PUSH(g_teleporters, this); + this.teleport_next = teleport_first; teleport_first = this; } @@ -106,6 +108,8 @@ spawnfunc(trigger_teleport) NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew) { this.classname = "trigger_teleport"; + if(isnew) + IL_PUSH(g_teleporters, this); int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; } this.spawnflags = ReadInt24_t(); this.active = ReadByte(); diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index d23c29675..577f4074e 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1214,7 +1214,7 @@ float havocbot_moveto(entity this, vector pos) this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_LINKING; // if pos is inside a teleport, then let's mark it as teleport waypoint - FOREACH_ENTITY_CLASS("trigger_teleport", WarpZoneLib_BoxTouchesBrush(pos, pos, it, NULL), + IL_EACH(g_teleporters, WarpZoneLib_BoxTouchesBrush(pos, pos, it, NULL), { wp.wpflags |= WAYPOINTFLAG_TELEPORT; this.lastteleporttime = 0; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 5b63aa4e0..c7b784827 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1768,7 +1768,8 @@ float WinningCondition_RanOutOfSpawns() } )); - FOREACH_ENTITY_CLASS("info_player_deathmatch", true, LAMBDA( + FOREACH_ENTITY_CLASS("info_player_deathmatch", true, + { switch(it.team) { case NUM_TEAM_1: team1_score = 1; break; @@ -1776,7 +1777,7 @@ float WinningCondition_RanOutOfSpawns() case NUM_TEAM_3: team3_score = 1; break; case NUM_TEAM_4: team4_score = 1; break; } - )); + }); ClearWinners(); if(team1_score + team2_score + team3_score + team4_score == 0) diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 1d9dc6620..7083d3a8f 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -5,6 +5,8 @@ #include +IntrusiveList g_invasion_spawns; +STATIC_INIT(g_invasion_spawns) { g_invasion_spawns = IL_NEW(); } float autocvar_g_invasion_round_timelimit; float autocvar_g_invasion_spawnpoint_spawn_delay; @@ -18,6 +20,7 @@ spawnfunc(invasion_spawnpoint) if(!g_invasion) { delete(this); return; } this.classname = "invasion_spawnpoint"; + IL_PUSH(g_invasion_spawns, this); if(autocvar_g_invasion_zombies_only) // precache only if it hasn't been already if(this.monsterid) { @@ -52,7 +55,7 @@ entity invasion_PickSpawn() { RandomSelection_Init(); - FOREACH_ENTITY_CLASS("invasion_spawnpoint", true, + IL_EACH(g_invasion_spawns, true, { RandomSelection_Add(it, 0, string_null, 1, ((time >= it.spawnshieldtime) ? 0.2 : 1)); // give recently used spawnpoints a very low rating it.spawnshieldtime = time + autocvar_g_invasion_spawnpoint_spawn_delay;