]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'martin-t/defaults' into martin-t/okc
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 6 Aug 2017 14:18:51 +0000 (16:18 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 6 Aug 2017 14:18:51 +0000 (16:18 +0200)
202 files changed:
.gitlab-ci.yml
CMakeLists.txt
check-cvars.sh
qcsrc/client/_all.inc [deleted file]
qcsrc/client/_all.qh [deleted file]
qcsrc/client/_mod.inc
qcsrc/client/_mod.qh
qcsrc/client/bgmscript.qc
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/chat.qc
qcsrc/client/hud/panel/engineinfo.qc
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/notify.qc
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/hud/panel/pressedkeys.qc
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/timer.qc
qcsrc/client/hud/panel/vote.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/main.qc
qcsrc/client/mapvoting.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/mutators/events.qh
qcsrc/client/player_skeleton.qh
qcsrc/client/progs.inc
qcsrc/client/shownames.qc
qcsrc/client/teamradar.qc
qcsrc/client/view.qc
qcsrc/client/view.qh
qcsrc/client/wall.qc
qcsrc/client/weapons/projectile.qc
qcsrc/client/weapons/projectile.qh
qcsrc/common/command/generic.qc
qcsrc/common/effects/all.inc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/ent_cs.qh
qcsrc/common/items/all.qh
qcsrc/common/items/item.qh
qcsrc/common/items/item/pickup.qh
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/monsters/_mod.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/sv_spawn.qc
qcsrc/common/monsters/sv_spawner.qc
qcsrc/common/monsters/sv_spawner.qh [new file with mode: 0644]
qcsrc/common/mutators/base.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/buffs/cl_buffs.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/damagetext/sv_damagetext.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/itemstime/itemstime.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/nades/nades.qh
qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/overkill/rpc.qh
qcsrc/common/mutators/mutator/pinata/sv_pinata.qc
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/mutators/mutator/superspec/sv_superspec.qc
qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc
qcsrc/common/mutators/mutator/walljump/walljump.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/player.qc
qcsrc/common/sounds/all.inc
qcsrc/common/sounds/all.qc
qcsrc/common/stats.qh
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/target/_mod.qh
qcsrc/common/triggers/target/kill.qc
qcsrc/common/triggers/target/kill.qh [new file with mode: 0644]
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/util.qh
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon.qh
qcsrc/ecs/systems/physics.qc
qcsrc/lib/registry.qh
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/common.qh
qcsrc/lib/warpzone/server.qc
qcsrc/lib/warpzone/util_server.qh
qcsrc/menu/_all.inc [deleted file]
qcsrc/menu/_all.qh [deleted file]
qcsrc/menu/_mod.inc
qcsrc/menu/_mod.qh
qcsrc/menu/item.qh
qcsrc/menu/progs.inc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/server/_all.inc [deleted file]
qcsrc/server/_all.qh [deleted file]
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/antilag.qc
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/aim.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/campaign.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/command/banning.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh
qcsrc/server/command/getreplies.qc
qcsrc/server/command/radarmap.qc
qcsrc/server/command/reg.qh
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/compat/quake.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/wop.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_world.qc
qcsrc/server/ipban.qc
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/gamemode.qh
qcsrc/server/mutators/loader.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/utility.qc
qcsrc/server/player.qc
qcsrc/server/portals.qc
qcsrc/server/progs.inc
qcsrc/server/race.qc
qcsrc/server/round_handler.qc
qcsrc/server/scores.qc
qcsrc/server/scores_rules.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/sv_main.qc
qcsrc/server/teamplay.qc
qcsrc/server/tests.qh
qcsrc/server/utils.qh [new file with mode: 0644]
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/accuracy.qh
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/spawning.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh
qcsrc/server/weapons/weaponstats.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh
qcsrc/tools/compilationunits.sh
qcsrc/tools/genmod.sh
qcsrc/tools/headerstyle.sh
qcsrc/tools/whitespace.sh

index e25bf40836322adb4649fe0ff37d099fce9690df..5427860963c0ccbf2c1760a8f49e6d75497d7acc 100644 (file)
@@ -29,7 +29,7 @@ test_sv_game:
     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
     - make
-    - EXPECT=61265f867b0817396a503ecc0411dc25
+    - EXPECT=585cfa6d62ce59f4854bedfce7c51c20
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index d550d7b6c6849d35738b93c394a9d52fed0ac79a..5ef6db722ad01d876772623932376593297cf8d0 100644 (file)
@@ -1,6 +1,46 @@
-cmake_minimum_required(VERSION 2.8.11)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-project(xonotic-data LANGUAGES ASM)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
+project(xonotic-data ASM)
+
+set(checks qc-checks)
+add_custom_target(${checks})
+
+# depend on qcc
+if (TARGET gmqcc)
+    add_dependencies(${checks} gmqcc)
+endif ()
+
+add_dependencies(${checks} data-check-cvars)
+add_custom_target(data-check-cvars
+        COMMENT "checking cvars"
+        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
+        VERBATIM COMMAND ${CMAKE_COMMAND} -E
+        env "CMAKE=1"
+        "${PROJECT_SOURCE_DIR}/check-cvars.sh"
+        )
+
+add_dependencies(${checks} qc-genmod)
+add_custom_target(qc-genmod
+        COMMENT "genmod.sh"
+        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
+        VERBATIM COMMAND ./tools/genmod.sh
+        )
+
+add_dependencies(${checks} qc-headerstyle)
+add_custom_target(qc-headerstyle
+        COMMENT "headerstyle.sh"
+        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
+        VERBATIM COMMAND ${CMAKE_COMMAND} -E
+        env "VERBOSE=0"
+        ./tools/headerstyle.sh
+        )
+
+add_dependencies(${checks} qc-whitespace)
+add_custom_target(qc-whitespace
+        COMMENT "whitespace.sh"
+        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
+        VERBATIM COMMAND ./tools/whitespace.sh
+        )
 
 include_directories(qcsrc)
 
@@ -10,10 +50,10 @@ add_definitions(-DENABLE_EFFECTINFO=0)
 add_definitions(-DENABLE_DEBUGDRAW=0)
 add_definitions(-DENABLE_DEBUGTRACE=0)
 
-find_package(Git REQUIRED)
 if (DEFINED ENV{VERSION})
     set(GIT_DESC "$ENV{VERSION}")
 else ()
+    find_package(Git REQUIRED)
     execute_process(
             COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=~
             WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
@@ -33,22 +73,16 @@ set_source_files_properties(
 )
 
 add_executable(csprogs qcsrc/client/progs.inc)
+add_dependencies(csprogs ${checks})
 target_compile_definitions(csprogs PRIVATE -DGAMEQC -DCSQC)
-if (TARGET gmqcc)
-    add_dependencies(csprogs gmqcc)
-endif ()
 
 add_executable(progs qcsrc/server/progs.inc)
+add_dependencies(progs ${checks})
 target_compile_definitions(progs PRIVATE -DGAMEQC -DSVQC)
-if (TARGET gmqcc)
-    add_dependencies(progs gmqcc)
-endif ()
 
 add_executable(menu qcsrc/menu/progs.inc)
+add_dependencies(menu ${checks})
 target_compile_definitions(menu PRIVATE -DMENUQC)
-if (TARGET gmqcc)
-    add_dependencies(menu gmqcc)
-endif ()
 
 function(set_prelude target prelude)
     get_target_property(MY_PROJECT_SOURCES target SOURCES)
index 031613a7bf00ec67744e246e99db6187be8f5399..43683feb8270802ad0c5abb52fa30356eeab4b16 100755 (executable)
@@ -27,6 +27,9 @@ check_files "balance-xonotic.cfg" "balance-*.cfg" "/^seta? g_/"
 check_files "_hud_descriptions.cfg" "hud_*.cfg" "/^seta? hud_/"
 
 if $errord; then
+    if [ "$CMAKE" != "" ]; then
+           exit 1
+       fi
        echo "Please wait for 30 seconds, so you have had enough time to read this..."
        sleep 30
 fi
diff --git a/qcsrc/client/_all.inc b/qcsrc/client/_all.inc
deleted file mode 100644 (file)
index f592f8a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <client/_all.qh>
-#include "_mod.inc"
-
-#include "commands/_mod.inc"
-#include "hud/_mod.inc"
-#include "mutators/_mod.inc"
-#include "weapons/_mod.inc"
-
-#include <common/_all.inc>
-#include <common/effects/qc/all.qc>
-
-#include <lib/csqcmodel/cl_model.qc>
-#include <lib/csqcmodel/cl_player.qc>
-#include <lib/csqcmodel/interpolate.qc>
-
-#include <lib/warpzone/anglestransform.qc>
-#include <lib/warpzone/common.qc>
-#include <lib/warpzone/client.qc>
-#include <lib/warpzone/server.qc>
-#include <lib/warpzone/util_server.qc>
diff --git a/qcsrc/client/_all.qh b/qcsrc/client/_all.qh
deleted file mode 100644 (file)
index 5935342..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-//#include "_mod.qh"
-
-#include <common/util.qh>
-
-#include <common/effects/all.qh>
-#include <common/models/all.qh>
-#include <common/sounds/all.qh>
-
-#include "autocvars.qh"
-#include "defs.qh"
-#include "main.qh"
-#include "miscfunctions.qh"
-#include "view.qh"
-
-#include <common/ent_cs.qh>
-#include <common/wepent.qh>
index 0920265d630bec596040cd55735ce790510adc76..240e07a4aed707f674c447d01bd2239a65af117c 100644 (file)
@@ -10,3 +10,8 @@
 #include <client/teamradar.qc>
 #include <client/view.qc>
 #include <client/wall.qc>
+
+#include <client/commands/_mod.inc>
+#include <client/hud/_mod.inc>
+#include <client/mutators/_mod.inc>
+#include <client/weapons/_mod.inc>
index 75266dfa2d0aaec18e189dcc84ee21f9e00abcee..10482caaa4b5081b492f925976c5a3fbbd2cc9fe 100644 (file)
@@ -10,3 +10,8 @@
 #include <client/teamradar.qh>
 #include <client/view.qh>
 #include <client/wall.qh>
+
+#include <client/commands/_mod.qh>
+#include <client/hud/_mod.qh>
+#include <client/mutators/_mod.qh>
+#include <client/weapons/_mod.qh>
index a984a19a32a283dfc7a12f2aacee211761f9e87e..4dc6204cb06a67362e130301cc191b50f8793269 100644 (file)
@@ -1,5 +1,10 @@
 #include "bgmscript.qh"
 
+#include <common/util.qh>
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/main.qh>
+
 #define CONSTANT_SPEED_DECAY
 
 float bgmscriptbuf;
index d2b28e9b08f2a9b4cacd3a49bc0f45076a52de8e..9893b8ae3cbc215fb08acb5c30586eed19fd934d 100644 (file)
@@ -1,4 +1,7 @@
 #include "csqcmodel_hooks.qh"
+#include "autocvars.qh"
+#include "csqcmodel_hooks.qh"
+#include "miscfunctions.qh"
 #include "mutators/events.qh"
 #include "player_skeleton.qh"
 #include "weapons/projectile.qh"
@@ -6,6 +9,8 @@
 #include <common/ent_cs.qh>
 #include <common/physics/movetypes/movetypes.qh>
 #include <common/viewloc.qh>
+#include <common/effects/all.qh>
+#include <common/effects/all.inc>
 #include <lib/csqcmodel/cl_model.qh>
 #include <lib/csqcmodel/cl_player.qh>
 #include <lib/csqcmodel/interpolate.qh>
@@ -134,6 +139,9 @@ void CSQCPlayer_ModelAppearance_PostUpdate(entity this)
 }
 void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
 {
+       if(MUTATOR_CALLHOOK(ForcePlayermodels_Skip, this, islocalplayer))
+               goto skipforcemodels;
+
        // FORCEMODEL
        // which one is ALWAYS good?
        if (!forceplayermodels_goodmodel)
@@ -278,6 +286,8 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
                        this.colormap = player_localnum + 1;
        }
 
+       LABEL(skipforcemodels)
+
        // GLOWMOD AND DEATH FADING
        if(this.colormap > 0)
                this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
index f6469a58b429dbbb1c7bff6f0b1702f4f6d45273..9bcdd3d6624422a18a245423dc2f44589d6a090c 100644 (file)
@@ -1,5 +1,7 @@
 #include "hud.qh"
 
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include "panel/scoreboard.qh"
 #include "hud_config.qh"
 #include "../mapvoting.qh"
@@ -7,6 +9,7 @@
 #include <common/minigames/cl_minigames.qh>
 #include <common/t_items.qh>
 #include <common/deathtypes/all.qh>
+#include <common/ent_cs.qh>
 #include <common/items/_mod.qh>
 #include <common/mapinfo.qh>
 #include <common/vehicles/all.qh>
index 073b2d0f7df3874fce2808f679f762b64b50342a..a1f1cc7ecfd6d7e069b4a2d5d90f41a8b4810a14 100644 (file)
@@ -2,6 +2,9 @@
 
 #include "hud.qh"
 #include "panel/scoreboard.qh"
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 
 #define HUD_Write(s) fputs(fh, s)
 #define HUD_Write_Cvar(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
index 7bae78cb6c5ab38385ea6a0b1cbdbc338be2a732..9e8320452a5e7dcf8db20213e12091dbd9ee1216 100644 (file)
@@ -1,6 +1,11 @@
 #include "ammo.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+#include <client/view.qh>
 #include <common/t_items.qh>
+#include <common/wepent.qh>
 
 // Ammo (#1)
 
index 3c13fd9c2bdfe2d8724c37194796821e0f6bf675..a92bdc69234a1dac1f90762cd8a74243f986c17d 100644 (file)
@@ -2,6 +2,8 @@
 
 #include "scoreboard.qh"
 #include <common/notifications/all.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 
 // CenterPrint (#16)
 
index 554f44e17ec759fa6da826b543672399405f8ee6..74d4b6d0f49462f522298e276770244dc54e278a 100644 (file)
@@ -1,5 +1,9 @@
 #include "chat.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+
 // Chat (#12)
 
 void HUD_Chat()
index c8b7203eee9cfc240c09ac0556c3709aeaea7b32..ed7966c16ea1431fe0bfcbdeab2f2386f96897cb 100644 (file)
@@ -1,5 +1,8 @@
 #include "engineinfo.qh"
 
+#include <client/autocvars.qh>
+#include <client/miscfunctions.qh>
+
 // Engine info (#13)
 
 float prevfps;
index 5e2bfd3a5505374d29473888d3c82e610e44b4b1..4c08ef900f02283ddd9fe24ca545f59334ffa31f 100644 (file)
@@ -1,5 +1,8 @@
 #include "healtharmor.qh"
 
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+
 #include <common/deathtypes/all.qh>
 
 // Health/armor (#3)
index 49739a42df7599e2b63b4370a7226842e68bfd57..1e5a0c9f2f293403c18408e3ff0cdae1fc72d649 100644 (file)
@@ -1,5 +1,8 @@
 #include "infomessages.qh"
 
+#include <client/autocvars.qh>
+#include <client/miscfunctions.qh>
+
 #include <common/ent_cs.qh>
 #include <common/mapinfo.qh>
 
index e8464cc147cb5d92176dfd6d71f6b923f286eb29..65682b3ec7d27006a653449ad69e7b725ba69516 100644 (file)
@@ -1,5 +1,7 @@
 #include "modicons.qh"
 
+#include <client/miscfunctions.qh>
+#include <client/autocvars.qh>
 #include <common/mapinfo.qh>
 #include <common/ent_cs.qh>
 #include <common/scores.qh>
@@ -513,10 +515,8 @@ void race_showTime(string text, vector pos, vector timeText_ofs, float theTime,
 
 void HUD_Mod_Race(vector pos, vector mySize)
 {
-       entity me;
-       me = playerslots[player_localnum];
-       float score;
-       score = me.(scores(ps_primary));
+       entity me = playerslots[player_localnum];
+       float score = me.(scores(ps_primary));
 
        if(!(scores_flags(ps_primary) & SFL_TIME) || teamplay) // race/cts record display on HUD
        {
@@ -589,24 +589,15 @@ void HUD_Mod_Race(vector pos, vector mySize)
        }
 
        // race "awards"
-       float a;
-       a = bound(0, race_status_time - time, 1);
+       float a = bound(0, race_status_time - time, 1);
+       string s = textShortenToWidth(ColorTranslateRGB(race_status_name), squareSize, '1 1 0' * 0.1 * squareSize, stringwidth_colors);
 
-       string s;
-       s = textShortenToWidth(ColorTranslateRGB(race_status_name), squareSize, '1 1 0' * 0.1 * squareSize, stringwidth_colors);
-
-       float rank;
+       float rank = 0;
        if(race_status > 0)
                rank = race_CheckName(race_status_name);
-       else
-               rank = 0;
-       string rankname;
-       rankname = count_ordinal(rank);
-
-       vector namepos;
-       namepos = medalPos + '0 0.8 0' * squareSize;
-       vector rankpos;
-       rankpos = medalPos + '0 0.15 0' * squareSize;
+       string rankname = count_ordinal(rank);
+       vector namepos = medalPos + '0 0.8 0' * squareSize;
+       vector rankpos = medalPos + '0 0.15 0' * squareSize;
 
        if(race_status == 0)
                drawpic_aspect_skin(medalPos, "race_newfail", '1 1 0' * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
index 910113f4e083fd877ab5d31250b82ff2e678ba86..82690bee73a3d494a84a69762f7749f75806ce49 100644 (file)
@@ -1,5 +1,7 @@
 #include "notify.qh"
 
+#include <client/autocvars.qh>
+#include <client/miscfunctions.qh>
 
 // Notifications (#4)
 
index f34bff3b8342e9e25a4b50183664d46d9849eb22..e1fffb59f34e52684ee1ac0ec2191322e61e8c59 100644 (file)
@@ -1,5 +1,8 @@
 #include "physics.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <client/main.qh>
 #include <common/mapinfo.qh>
 #include <lib/csqcmodel/cl_player.qh>
index 608e48ce39856cabc5c3d1ee575ad29869b521dd..dd574cf9b039c4b69d6654792a36525e7c54ba57 100644 (file)
@@ -1,5 +1,8 @@
 #include "powerups.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/items/_mod.qh>
 
 // Powerups (#2)
index c659648d2eb9568948c1b58096254805a0b85baa..b4da1dd7d69ce1e867524405b8dd53f9ecd6f0ce 100644 (file)
@@ -1,5 +1,8 @@
 #include "pressedkeys.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 
 // Pressed keys (#11)
 
index b1920d2b49eedc869e7259aac64dc1742e652654..3233d1b9ba9ea22acaf0d2cf3f869f08f5704473 100644 (file)
@@ -1,5 +1,8 @@
 #include "quickmenu.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/ent_cs.qh>
 #include <client/hud/_mod.qh>
 #include <client/mapvoting.qh>
index b107a40c0378b95c62ea046030e6dc03d99209d9..6a190f2ca5f7c9b14c90590ed81f5227acc56bf0 100644 (file)
@@ -1,5 +1,8 @@
 #include "racetimer.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/mapinfo.qh>
 
 // Race timer (#6)
index 10b6708e1e3f9c1e6c266f1839809a8876add2a9..b1cc222ccf1a5dab7f70fa08373a41dd184cbe68 100644 (file)
@@ -1,5 +1,8 @@
 #include "radar.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/ent_cs.qh>
 #include <common/mapinfo.qh>
 #include <client/mapvoting.qh>
index 2f0f9909ce2f8188bb93c7c091f900f64b9bb5df..56fa5867c240f33484f9495d4818bde4b5197e51 100644 (file)
@@ -1,5 +1,8 @@
 #include "score.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include "scoreboard.qh"
 #include <common/ent_cs.qh>
 #include <common/mapinfo.qh>
index 3872197c7b9940c6c94bfaa96c420ea63e28c824..34ecd834f7ec682ca1e6c1c00d9f8164928e783a 100644 (file)
@@ -1,5 +1,8 @@
 #include "scoreboard.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include "quickmenu.qh"
 #include <common/ent_cs.qh>
 #include <common/constants.qh>
index 45f46b4087ad35da1c4cff70aabe9799a40463f6..0dcbb70dba3cfe067d51160d74b2c26d8be70196 100644 (file)
@@ -1,5 +1,9 @@
 #include "timer.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+
 // Timer (#5)
 
 void HUD_Timer()
index 22f1678b6f034d1174028e97b5325c35c66a8809..750e62ef82ca44ba685032e61552639e2c6026a0 100644 (file)
@@ -1,5 +1,8 @@
 #include "vote.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/mapinfo.qh>
 
 // Vote (#9)
index b4997467ee6a5547980a5c918dd9eaafec585a17..a7c0ade00b473de2f7e49cd3604464f657e1fe59 100644 (file)
@@ -1,5 +1,10 @@
 #include "weapons.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+#include <client/view.qh>
+#include <common/wepent.qh>
 
 // Weapons (#0)
 
index 539461187e6fadf95f05a31adb55337016e56325..479dd7e8eab8486ed14e23b1b333a58df3a1ac59 100644 (file)
@@ -1,6 +1,10 @@
 #include "main.qh"
 
+#include "miscfunctions.qh"
+#include <common/effects/effect.qh>
 #include <common/effects/qc/all.qh>
+#include <common/effects/all.qh>
+#include <common/effects/all.inc>
 #include "hud/_mod.qh"
 #include "mapvoting.qh"
 #include "mutators/events.qh"
@@ -657,6 +661,9 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew)
 
 void Spawn_Draw(entity this)
 {
+       if(this.alpha <= 0)
+               return;
+
        __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
@@ -665,7 +672,14 @@ void Spawn_PreDraw(entity this)
        float alph;
        vector org = getpropertyvec(VF_ORIGIN);
        if(this.fade_start)
-               alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+       {
+               if(vdist(org - this.origin, >, this.fade_end))
+                       alph = 0; // save on some processing
+               else if(vdist(org - this.origin, <, this.fade_start))
+                       alph = 1; // more processing saved
+               else
+                       alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+       }
        else
                alph = 1;
        //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
@@ -1070,11 +1084,12 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_nextcheckpoint = ReadByte();
 
                        race_nextbesttime = ReadInt24_t();
-                       race_mybesttime = ReadInt24_t();
+                       if(b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) // not while spectating (matches server)
+                               race_mybesttime = ReadInt24_t();
                        if(race_nextbestname)
                                strunzone(race_nextbestname);
                        string newname = ReadString();
-                       if(autocvar_cl_race_cptimes_onlyself)
+                       if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING)
                        {
                                race_nextbesttime = race_mybesttime;
                                race_mybesttime = 0;
index 29728dfde6d07cd781c19ae75d199b038c1c1a85..9e783d306237b8dd49c27872c1b1cdd44098f17f 100644 (file)
@@ -1,5 +1,8 @@
 #include "mapvoting.qh"
 
+#include "autocvars.qh"
+#include "miscfunctions.qh"
+#include "defs.qh"
 #include "hud/_mod.qh"
 #include "hud/panel/scoreboard.qh"
 
index f23577d8110c44644467209f835d1b0246da0e38..84a475a7d8a80512b3f8d214711fe62d4553f0bb 100644 (file)
@@ -1,5 +1,7 @@
 #include "miscfunctions.qh"
 
+#include "autocvars.qh"
+#include "defs.qh"
 #include "hud/_mod.qh"
 
 #include <common/command/_mod.qh>
index 56947865db01bfcdc9876ac886ad9ee6e2a1342e..24d634ce8213e05759f7afed13f2f0b011be5146 100644 (file)
@@ -176,3 +176,21 @@ MUTATOR_HOOKABLE(HUD_WriteCvars, EV_HUD_WriteCvars);
        /** entity id */                i(entity, MUTATOR_ARGV_0_entity) \
        /**/
 MUTATOR_HOOKABLE(DrawViewModel, EV_DrawViewModel);
+
+/** Called when updating the view's liquid contents, return true to disable the standard checks and apply your own */
+MUTATOR_HOOKABLE(HUD_Contents, EV_NO_ARGS);
+
+/** Return true to disable player model/color forcing */
+#define EV_ForcePlayermodels_Skip(i, o) \
+       /** entity id */                i(entity, MUTATOR_ARGV_0_entity) \
+       /** is local */                 i(bool, MUTATOR_ARGV_1_bool) \
+       /**/
+MUTATOR_HOOKABLE(ForcePlayermodels_Skip, EV_ForcePlayermodels_Skip);
+
+/** Called when damage info is received on the client, useful for playing explosion effects */
+#define EV_DamageInfo(i, o) \
+       /** entity id */                i(entity, MUTATOR_ARGV_0_entity) \
+       /** death type */               i(int, MUTATOR_ARGV_1_int) \
+       /** hit origin */               i(vector, MUTATOR_ARGV_2_vector) \
+       /**/
+MUTATOR_HOOKABLE(DamageInfo, EV_DamageInfo);
index 50462bdbb298948af6a8b61305eea2cf62b165be..8c5969b09fb4db0ae068b7aa50338215be07b2dd 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <common/util.qh>
+
 void free_skeleton_from_frames(entity e);
 void skeleton_from_frames(entity e, float is_dead);
 void skeleton_loadinfo(entity e);
index 738831a5d020daf1d093806332ea290c6b8bce79..f6a7999d440a455a30dc5d0b70aa9e74f4113139 100644 (file)
@@ -1,7 +1,21 @@
 #include <lib/_all.inc>
 
 #if XONOTIC
-#include <client/_all.inc>
+
+#include <client/_mod.inc>
+
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
+
+#include <lib/csqcmodel/cl_model.qc>
+#include <lib/csqcmodel/cl_player.qc>
+#include <lib/csqcmodel/interpolate.qc>
+
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/client.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
 
 #include <ecs/_mod.inc>
 #endif
index ceaf0a6748741c424e0985bcd83f9dac9219591d..8a7d225bff7bdc319260e5e0648a2aaff9b7aa08 100644 (file)
@@ -1,5 +1,7 @@
 #include "shownames.qh"
 
+#include "autocvars.qh"
+#include "miscfunctions.qh"
 #include "hud/_mod.qh"
 
 #include <common/ent_cs.qh>
index 782776eb7866757ebc7ff8ad24076b4923e57859..7f1654de0660b3d20890730feb19f0417c3252d6 100644 (file)
@@ -1,5 +1,6 @@
 #include "teamradar.qh"
 
+#include "autocvars.qh"
 #include "hud/_mod.qh"
 
 #include <common/mutators/mutator/waypoints/all.qh>
index 0f8b5949501d0a21c4b3deb76fa73b14c551b896..e4f38b24c2d145e917765d4ee725f171feff083b 100644 (file)
@@ -1,5 +1,7 @@
 #include "view.qh"
 
+#include "autocvars.qh"
+#include "miscfunctions.qh"
 #include "announcer.qh"
 #include "hud/_mod.qh"
 #include "mapvoting.qh"
@@ -21,6 +23,7 @@
 #include <common/stats.qh>
 #include <common/triggers/target/music.qh>
 #include <common/teams.qh>
+#include <common/wepent.qh>
 
 #include <common/weapons/weapon/tuba.qh>
 
@@ -311,6 +314,7 @@ void viewmodel_draw(entity this)
                e.csqcmodel_effects = fx;
                CSQCModel_Effects_Apply(e);
        }
+       if(a >= 0)
        {
                string name = wep.mdl;
                string newname = wep.wr_viewmodel(wep, this);
@@ -2111,7 +2115,7 @@ void CSQC_UpdateView(entity this, float w, float h)
 
 
        // improved polyblend
-       if(autocvar_hud_contents)
+       if(autocvar_hud_contents && !MUTATOR_CALLHOOK(HUD_Contents))
        {
                float contentalpha_temp, incontent, liquidalpha, contentfadetime;
                vector liquidcolor;
index 01d4546374d40dcea83ae807eee7d1064a785bae..ac916a089568f55aa6f4e97e4ba4dc97f7517046 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <common/weapons/weapon.qh>
+
 vector crosshair_getcolor(entity this, float health_stat);
 
 entity viewmodels[MAX_WEAPONSLOTS];
index 7a31265db9d6a549f5c72ef86c8dff2dde75da78..a0d66d719e4ab04a201f990fbcb5defd7aa42822 100644 (file)
@@ -1,5 +1,7 @@
 #include "wall.qh"
 
+#include "autocvars.qh"
+#include "main.qh"
 #include "bgmscript.qh"
 
 
index 7f64e9ab98787708f96a5aa05e9ea783183d4e3f..3d2d32d9af16bff4eeb0c6ca89d1e7951c71e1c5 100644 (file)
@@ -6,6 +6,8 @@
 #include "../mutators/events.qh"
 
 #include <common/constants.qh>
+#include <common/effects/effect.qh>
+#include <common/effects/all.qh>
 #include <common/net_linked.qh>
 #include <common/physics/movetypes/movetypes.qh>
 
index cc95753602b08ba4be92feda0ed17a6a759f5e10..a6ae463477d51162d7364c55e35a4646d1ce20a5 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <common/sounds/sound.qh>
+
 entityclass(Projectile);
 class(Projectile).int traileffect;
 
index 49a9d130989015125f171c6dedfa59561fd7ace2..a9abd9886856080454e2db48ba3614b4d9201c7a 100644 (file)
@@ -74,13 +74,12 @@ void GenericCommand_addtolist(float request, float argc)
                                }
                                else // add it to the end of the list if the list doesn't already have it
                                {
-                                       argc = tokenizebyseparator(cvar_string(original_cvar), " ");
-                                       int i;
-                                       for(i = 0; i < argc; ++i)
-                                               if(argv(i) == tmp_string)
-                                                       return; // already in list
+                                       FOREACH_WORD(cvar_string(original_cvar), it == tmp_string,
+                                       {
+                                               return; // already in the list
+                                       });
 
-                                       cvar_set(original_cvar, strcat(tmp_string, " ", cvar_string(original_cvar)));
+                                       cvar_set(original_cvar, cons(cvar_string(original_cvar), tmp_string));
                                }
                                return;
                        }
@@ -336,19 +335,15 @@ void GenericCommand_removefromlist(float request, float argc)
                {
                        if(argc == 3)
                        {
-                               float i;
                                string original_cvar = argv(1);
                                string removal = argv(2);
-                               string tmp_string;
 
-                               argc = tokenizebyseparator(cvar_string(original_cvar), " ");
-
-                               tmp_string = "";
-                               for(i = 0; i < argc; ++i)
-                                       if(argv(i) != removal)
-                                               tmp_string = strcat(tmp_string, " ", argv(i));
+                               string tmp_string = "";
+                               FOREACH_WORD(cvar_string(original_cvar), it != removal,
+                               {
+                                       tmp_string = cons(tmp_string, it);
+                               });
 
-                               tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
                                cvar_set(original_cvar, tmp_string);
 
                                return;
index 7d2f1d592739b4777ba1c1ee2940f6ce72a8bed3..6439a49bb21ce32c6c64bbc8814f37dbb8f5520d 100644 (file)
@@ -1,3 +1,4 @@
+#pragma once
 // Global list of effects, networked to CSQC by ID to save bandwidth and to use client particle numbers (allows mismatching effectinfos to some degree)
 // Not too concerned about the order of this list, just keep the weapon effects together!
 
index c62bbd6b68cd5b08c5108a9b0c0dd9ac77598693..38241c2cc2df62999807f2cc2b153580a2c40d15 100644 (file)
@@ -390,6 +390,8 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                }
        }
 
+       MUTATOR_CALLHOOK(DamageInfo, this, w_deathtype, w_org);
+
        // TODO spawn particle effects and sounds based on w_deathtype
        if(!DEATH_ISSPECIAL(w_deathtype))
        if(!hitplayer || rad) // don't show ground impacts for hitscan weapons if a player was hit
index 65cdd83d3a71f4f5df325a8e90b727d936cb1300..14a758b2615a88f9d8bf825eab629dad3f1877ae 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef CSQC
+#include <client/defs.qh>
+#endif
+
 REGISTER_NET_LINKED(ENT_CLIENT_ENTCS)
 REGISTER_NET_TEMP(CLIENT_ENTCS)
 
index dc8cf21c020a6d06993f87281cc1dad98f29cbac..14c5a347ad26f534158fb635fc5a8ccbb9eb0cdf 100644 (file)
@@ -6,6 +6,9 @@
 
 REGISTRY(Items, BITS(7))
 #define Items_from(i) _Items_from(i, NULL)
+#ifdef GAMEQC
+REGISTRY_DEPENDS(Items, Models)
+#endif
 REGISTER_REGISTRY(Items)
 #define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
 
index 52fa9b85c6657c2858050f48410c2facfb466e9b..7072261b781b75b797806df8949fcb83ecb8f550 100644 (file)
@@ -1,6 +1,11 @@
 #pragma once
 #include <common/t_items.qh>
 
+#ifdef GAMEQC
+#include <common/sounds/all.qh>
+#include <common/sounds/all.inc>
+#endif
+
 const int IT_UNLIMITED_WEAPON_AMMO             =  BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
 const int IT_UNLIMITED_SUPERWEAPONS            =  BIT(1); // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
 
index dccd3688644e7b4fac80d5cec18f7ecac1818ff3..fae573c70c5551695c24beccdaf7f4f51563d4aa 100644 (file)
@@ -21,6 +21,12 @@ PROPERTY(float, g_pickup_respawntimejitter_powerup)
 #include <common/items/item.qh>
 #include <common/t_items.qh>
 
+#ifdef GAMEQC
+#include <common/models/all.qh>
+#include <common/sounds/all.qh>
+#include <common/sounds/all.inc>
+#endif
+
 CLASS(Pickup, GameItem)
 #ifdef GAMEQC
     ATTRIB(Pickup, m_model, Model);
index 5b0ee3c5b5d8606ecec15f5b57e57734778bfd59..2049dc9eae601b8b03598fb74c2e49efbcba65bf 100644 (file)
@@ -1,5 +1,6 @@
 #include "cl_minigames_hud.qh"
 
+#include <client/autocvars.qh>
 #include <common/ent_cs.qh>
 
 #include "minigames.qh"
index 904b7772eae4cbd4ffc1edb7abc66d0bb19d79bd..cda2e5d261368c5088beac39f9a60d71b4f98e46 100644 (file)
@@ -1020,7 +1020,7 @@ void bd_hud_board(vector pos, vector mySize)
                                minigame_drawpic_centered( tile_pos,
                                                minigame_texture(thepiece),
                                                tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
-                       }       
+                       }
                }
                else if ( e.classname == "minigame_board_piece" )
                {
@@ -1058,7 +1058,7 @@ void bd_hud_board(vector pos, vector mySize)
                                default:
                                case BD_DIR_DN: theang = M_PI; break;
                                case BD_DIR_LF: theang = M_PI * 3 / 2; break;
-                               case BD_DIR_RT: theang = M_PI / 2; break; 
+                               case BD_DIR_RT: theang = M_PI / 2; break;
                        }
 
                        drawrotpic(tile_pos, theang, minigame_texture("bd/dozer"),
index bf26a66ccc9e5150cc88b79f8172b50205e0b6cc..82e09c324ab3982966ea7a08dc33f81527e50467 100644 (file)
@@ -1,4 +1,9 @@
 #include "nmm.qh"
+
+#ifdef CSQC
+#include <client/miscfunctions.qh>
+#endif
+
 REGISTER_MINIGAME(nmm, "Nine Men's Morris");
 
 const int NMM_TURN_PLACE = 0x0100; // player has to place a piece on the board
index 4f1cd5dc2d9975bff6419159559e7ece0f3cf2e4..415417b465f627ec1f3420e6c35e7291d08e401b 100644 (file)
@@ -28,7 +28,7 @@ void minigame_rmplayer(entity minigame_session, entity player)
                GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":",
                        ftos(etof(player)),":",player.netname));
                minigame_session.minigame_players = p.list_next;
-               delete ( p );
+               delete( p );
                player_clear_minigame(player);
        }
        else
index 55204bd1a770ec46b66e48222b6d0ae3fcbf62e7..7f726d64096402e5183868fcb6fa20a8c61fd122 100644 (file)
@@ -6,5 +6,8 @@
 #ifdef SVQC
     #include <common/monsters/sv_spawn.qh>
 #endif
+#ifdef SVQC
+    #include <common/monsters/sv_spawner.qh>
+#endif
 
 #include <common/monsters/monster/_mod.qh>
index f6f8b803ba69276f5d4bd0964285137b218b6348..32383af5718e78fa530de6d2e44b620d0e7603ac 100644 (file)
@@ -120,7 +120,7 @@ void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity)
        Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1);
        RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, directhitentity);
 
-       delete (this);
+       delete(this);
 }
 
 void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
index 884fb3dea154828ee26b392be65e1cfb48afdf8e..4bbe2ce3d8f8a94fc336a0165e8009d0c16b0767 100644 (file)
@@ -19,7 +19,7 @@ entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby,
 
        if(monster == "random")
        {
-               RandomSelection_Init(); 
+               RandomSelection_Init();
                FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE) && !(it.spawnflags & MON_FLAG_HIDDEN),
                {
                        RandomSelection_AddEnt(it, 1, 1);
index 0b34d13e659633a1892e10db93771a761ad4b629..d3f4ee740ab1543d2bf8fae2090e111842f251de 100644 (file)
@@ -1,3 +1,4 @@
+#include "sv_spawner.qh"
 #include "sv_spawn.qh"
 
 void spawner_use(entity this, entity actor, entity trigger)
diff --git a/qcsrc/common/monsters/sv_spawner.qh b/qcsrc/common/monsters/sv_spawner.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 7ef70f2c46b9db347c92f45b8d04444942531fca..2b932b275fd61a068ae2b42d618533632ef68b66 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef CSQC
+#include <client/main.qh>
+#endif
+
 const int CBC_ORDER_FIRST = 1;
 const int CBC_ORDER_LAST = 2;
 const int CBC_ORDER_EXCLUSIVE = 3;
@@ -185,9 +189,9 @@ bool Mutator_SendEntity(entity this, entity to, int sf)
 void NET_Mutator_Remove(entity this)
 {
     string s = this.netname;
-    WITH(bool, mutator_log, true, LAMBDA(
+    WITH(bool, mutator_log, true, {
         FOREACH(Mutators, it.registered_id == s, Mutator_Remove(it));
-    ));
+    });
 }
 NET_HANDLE(Mutator, bool isNew)
 {
@@ -199,9 +203,9 @@ NET_HANDLE(Mutator, bool isNew)
         make_pure(this);
         this.entremove = NET_Mutator_Remove;
         int added = 0;
-        WITH(bool, mutator_log, true, LAMBDA(
+        WITH(bool, mutator_log, true, {
             FOREACH(Mutators, it.registered_id == s, { Mutator_Add(it); ++added; });
-        ));
+        });
         if (added > 1) LOG_WARNF("Added more than one mutator for %s", s);
     }
 }
index b80875e36ff8bb74bd0753006966a4095377c4ce..8ef69aad982f45e49e646d960143f2afb5900d09 100644 (file)
@@ -10,7 +10,7 @@ entity buff_FirstFromFlags(int _buffs)
 {
     if (flags)
     {
-        FOREACH(Buffs, it.m_itemid & _buffs, LAMBDA(return it));
+        FOREACH(Buffs, it.m_itemid & _buffs, { return it; });
     }
     return BUFF_Null;
 }
index ca1475372727fc1ccf6e0fbf387b609b8462edf7..a46a92d0aecdbfebfb844c0cc59610952dbbdf2d 100644 (file)
@@ -4,9 +4,9 @@ REGISTER_MUTATOR(cl_buffs, true);
 MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add)
 {
     int allBuffs = STAT(BUFFS);
-    FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA(
+    FOREACH(Buffs, it.m_itemid & allBuffs, {
                addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60);
-       ));
+       });
 }
 MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
 {
index fdc555dd2a90ede54ae5bfe332cce78a9108b833..b9b2a8e06480603bccfc1612c843f903c8896de3 100644 (file)
@@ -637,7 +637,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
        {
                float best_distance = autocvar_g_buffs_swapper_range;
                entity closest = NULL;
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle)
                        if(DIFF_TEAM(it, player))
                        {
@@ -648,7 +648,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
                                        closest = it;
                                }
                        }
-               ));
+               });
 
                if(closest)
                {
index 8daf920307d96c3d533e6b0586f699b3d6a46fed..0e170e57ec6249fd4e3ed9e82a284145f691a078 100644 (file)
@@ -16,7 +16,7 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) {
     const float armor = M_ARGV(3, float);
     const int deathtype = M_ARGV(5, int);
     const float potential_damage = M_ARGV(6, float);
-    FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+    FOREACH_CLIENT(IS_REAL_CLIENT(it), {
         if (
             (SV_DAMAGETEXT_ALL()) ||
             (SV_DAMAGETEXT_PLAYERS() && it == attacker) ||
@@ -53,5 +53,5 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) {
                 else WriteShort(MSG_ONE, potential_damage * DAMAGETEXT_PRECISION_MULTIPLIER);
                        }
         }
-    ));
+    });
 }
index 578294a725491b698591b37699f543b51a961a19..fefad540b24c6b18cb76a1f1d22196023458ce9e 100644 (file)
@@ -130,7 +130,7 @@ void instagib_ammocheck(entity this)
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(instagib_stop_countdown(it)));
+       FOREACH_CLIENT(IS_PLAYER(it), { instagib_stop_countdown(it); });
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem)
index 472fc646dbd9858615d6b25c80156073ad7d09d9..c2402ef4608c95d7b1f5fbb84e8f70768ffed1e9 100644 (file)
@@ -30,9 +30,9 @@ NET_HANDLE(itemstime, bool isNew)
 #ifdef CSQC
 void Item_ItemsTime_Init()
 {
-    FOREACH(Items, true, LAMBDA(
+    FOREACH(Items, true, {
         ItemsTime_time[it.m_id] = -1;
-    ));
+    });
     ItemsTime_time[Items_MAX] = -1;
 }
 
@@ -79,9 +79,9 @@ float it_times[Items_MAX + 1];
 
 void Item_ItemsTime_Init()
 {
-    FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+    FOREACH(Items, Item_ItemsTime_Allow(it), {
         it_times[it.m_id] = -1;
-    ));
+    });
     it_times[Items_MAX] = -1;
 }
 
@@ -92,25 +92,25 @@ STATIC_INIT(ItemsTime_Init) {
 
 void Item_ItemsTime_ResetTimes()
 {
-    FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+    FOREACH(Items, Item_ItemsTime_Allow(it), {
         it_times[it.m_id] = (it_times[it.m_id] == -1) ? -1 : 0;
-    ));
+    });
     it_times[Items_MAX] = (it_times[Items_MAX] == -1) ? -1 : 0;
 }
 
 void Item_ItemsTime_ResetTimesForPlayer(entity e)
 {
-    FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+    FOREACH(Items, Item_ItemsTime_Allow(it), {
         IT_Write(e, it.m_id, (it_times[it.m_id] == -1) ? -1 : 0);
-    ));
+    });
     IT_Write(e, Items_MAX, (it_times[Items_MAX] == -1) ? -1 : 0);
 }
 
 void Item_ItemsTime_SetTimesForPlayer(entity e)
 {
-    FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+    FOREACH(Items, Item_ItemsTime_Allow(it), {
         IT_Write(e, it.m_id, it_times[it.m_id]);
-    ));
+    });
     IT_Write(e, Items_MAX, it_times[Items_MAX]);
 }
 
@@ -131,7 +131,7 @@ void Item_ItemsTime_SetTime(entity e, float t)
 
 void Item_ItemsTime_SetTimesForAllPlayers()
 {
-    FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it) || autocvar_sv_itemstime == 2), LAMBDA(Item_ItemsTime_SetTimesForPlayer(it)));
+    FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it) || autocvar_sv_itemstime == 2), { Item_ItemsTime_SetTimesForPlayer(it); });
 }
 
 float Item_ItemsTime_UpdateTime(entity e, float t)
@@ -293,23 +293,23 @@ void HUD_ItemsTime()
     int count = 0;
     if (autocvar_hud_panel_itemstime_hidespawned == 1)
     {
-        FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+        FOREACH(Items, Item_ItemsTime_Allow(it), {
             count += (Item_ItemsTime_GetTime(it.m_id) > time || -Item_ItemsTime_GetTime(it.m_id) > time);
-        ));
+        });
         count += (Item_ItemsTime_GetTime(Items_MAX) > time || -Item_ItemsTime_GetTime(Items_MAX) > time);
     }
     else if (autocvar_hud_panel_itemstime_hidespawned == 2)
     {
-        FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+        FOREACH(Items, Item_ItemsTime_Allow(it), {
             count += (Item_ItemsTime_GetTime(it.m_id) > time);
-        ));
+        });
         count += (Item_ItemsTime_GetTime(Items_MAX) > time);
     }
     else
     {
-        FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+        FOREACH(Items, Item_ItemsTime_Allow(it), {
             count += (Item_ItemsTime_GetTime(it.m_id) != -1);
-        ));
+        });
         count += (Item_ItemsTime_GetTime(Items_MAX) != -1);
     }
     if (count == 0)
@@ -385,7 +385,7 @@ void HUD_ItemsTime()
     bool item_available;
     int id = 0;
     string icon = "";
-    FOREACH(Items, Item_ItemsTime_Allow(it) && Item_ItemsTime_GetTime(it.m_id) != -1, LAMBDA(
+    FOREACH(Items, Item_ItemsTime_Allow(it) && Item_ItemsTime_GetTime(it.m_id) != -1, {
        id = it.m_id;
        icon = it.m_icon;
 
@@ -429,7 +429,7 @@ LABEL(iteration)
         }
         if(id == Items_MAX) // can happen only in the last fake iteration
                break;
-    ));
+    });
     // add another fake iteration for superweapons time
     if(id < Items_MAX && Item_ItemsTime_GetTime(Items_MAX) != -1)
     {
index 9447ba3955e9d14355a539e45dc702b81612243a..77286eac5d4ca9cdde169e743e5f1366dc12c0e4 100644 (file)
@@ -16,7 +16,7 @@ entity Nade_TrailEffect(int proj, int nade_team)
         case PROJECTILE_NADE_BURN:  return EFFECT_NADE_TRAIL_BURN(nade_team);
     }
 
-    FOREACH(Nades, true, LAMBDA(
+    FOREACH(Nades, true, {
         for (int j = 0; j < 2; j++)
         {
             if (it.m_projectile[j] == proj)
@@ -26,7 +26,7 @@ entity Nade_TrailEffect(int proj, int nade_team)
                 break;
             }
         }
-    ));
+    });
 
     return EFFECT_Null;
 }
@@ -1278,7 +1278,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
                        if(!IS_DEAD(it))
                        if(STAT(FROZEN, it) == 0)
                        if(SAME_TEAM(it, player))
@@ -1290,7 +1290,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                                        it.reviving = true;
                                ++n;
                        }
-               ));
+               });
        }
 
        if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
@@ -1306,10 +1306,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                        Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
                }
 
-               FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
                        it.revive_progress = player.revive_progress;
                        it.reviving = false;
-               ));
+               });
        }
 }
 
index fd8d26902a4f5b6665dd2238c83c4d0f9708a26d..3618fd4181c0a4854704905e0e29a7b54ac971fb 100644 (file)
@@ -42,12 +42,12 @@ REGISTER_NADE(Null);
 
 Nade Nade_FromProjectile(int proj)
 {
-    FOREACH(Nades, true, LAMBDA(
+    FOREACH(Nades, true, {
         for (int j = 0; j < 2; j++)
         {
             if (it.m_projectile[j] == proj) return it;
         }
-    ));
+    });
     return NADE_TYPE_Null;
 }
 
index 7cf5b430dd736b5b7c331766babe7f99b07eadf7..277a4e7dba0155fbaab58120edbd3ca6742a836c 100644 (file)
@@ -78,18 +78,18 @@ REGISTER_MUTATOR(nt, cvar("g_new_toys") && !cvar("g_instagib") && !cvar("g_overk
                        error("This cannot be added at runtime\n");
 
                // mark the guns as ok to use by e.g. impulse 99
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(nt_IsNewToy(it.m_id))
                                it.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
-               ));
+               });
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
        {
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(nt_IsNewToy(it.m_id))
                                it.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
-               ));
+               });
        }
 
        MUTATOR_ONREMOVE
@@ -165,20 +165,20 @@ MUTATOR_HOOKFUNCTION(nt, SetStartItems)
 
        WepSet seti = '0 0 0';
 
-       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+       FOREACH(Weapons, it != WEP_Null, {
                seti = it.m_wepset;
                n = tokenize_console(nt_GetReplacement(it.netname, autocvar_g_new_toys_autoreplace));
 
                for(j = 0; j < n; ++j)
-                       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       FOREACH(Weapons, it != WEP_Null, {
                                if(it.netname == argv(j))
                                {
                                        WepSet setk = it.m_wepset;
                                        if(start_weapons & seti) newdefault |= setk;
                                        if(warmup_start_weapons & seti) warmup_newdefault |= setk;
                                }
-                       ));
-       ));
+                       });
+       });
 
        newdefault &= start_weapons_defaultmask;
        start_weapons &= ~start_weapons_defaultmask;
index 135e50793fa1eef7373f315d517e74f5d1d0b231..425b8c22b0e66f12e20115acbdc5a4cd6bdd0330 100644 (file)
@@ -44,7 +44,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
                nix_nextchange = 0;
                nix_nextweapon = 0;
 
-               FOREACH(Weapons, it != WEP_Null && NIX_CanChooseWeapon(it.m_id), LAMBDA(it.wr_init(it)));
+               FOREACH(Weapons, it != WEP_Null && NIX_CanChooseWeapon(it.m_id), { it.wr_init(it); });
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
@@ -100,10 +100,10 @@ bool NIX_CanChooseWeapon(int wpn)
 void NIX_ChooseNextWeapon()
 {
        RandomSelection_Init();
-       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+       FOREACH(Weapons, it != WEP_Null, {
                if(NIX_CanChooseWeapon(it.m_id))
                        RandomSelection_AddFloat(it.m_id, 1, (it.m_id != nix_weapon));
-       ));
+       });
        nix_nextweapon = RandomSelection_chosen_float;
 }
 
index a09a6a637c1da3306d46c6901536514ce8da2b4f..e9a5ce2c3fc01b3a39a0ab055234b5f23170b4fd 100644 (file)
@@ -10,7 +10,7 @@ void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity)
 
        RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity);
 
-       delete (this);
+       delete(this);
 }
 
 void W_RocketPropelledChainsaw_Explode_think(entity this)
index 8de910102da2b043841942a2e531913294b3ab7c..417e9a6612883bd69363451566c6392f17dcecb8 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(RocketPropelledChainsaw, Weapon)
 /* ammotype  */ ATTRIB(RocketPropelledChainsaw, ammo_field, .int, ammo_rockets);
-/* impulse   */ ATTRIB(RocketPropelledChainsaw, impulse, int, 7);
+/* impulse   */ ATTRIB(RocketPropelledChainsaw, impulse, int, 9);
 /* flags     */ ATTRIB(RocketPropelledChainsaw, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON);
 /* rating    */ ATTRIB(RocketPropelledChainsaw, bot_pickupbasevalue, float, 10000);
 /* color     */ ATTRIB(RocketPropelledChainsaw, wpcolor, vector, '0.5 0.5 0');
index ff44cc8bd0a89facf0ab00abd49f4c861488f498..53e4f49e60aadf08b13f9eb0880d3fe18711acd1 100644 (file)
@@ -13,12 +13,12 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
                if(frag_target.(weaponentity).m_weapon == WEP_Null)
                        continue;
 
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(frag_target.weapons & WepSet_FromWeapon(it))
                        if(frag_target.(weaponentity).m_weapon != it)
                        if(W_IsWeaponThrowable(frag_target, it.m_id))
                                W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
-               ));
+               });
        }
 
        return true;
index a2211fe75a2af294e229af70cafa403837c4a9df..0fd58c6804bbc8e2eac1a1f42b0fcda86d15455d 100644 (file)
@@ -75,14 +75,14 @@ void sandbox_ObjectFunction_Think(entity this)
        // since if the owning player disconnects, the object's owner should also be reset.
 
        // bots can't have objects
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                if(this.crypto_idfp == it.crypto_idfp)
                {
                        this.realowner = it;
                        break;
                }
                this.realowner = NULL;
-       ));
+       });
 
        this.nextthink = time;
 
@@ -209,7 +209,7 @@ void sandbox_ObjectRemove(entity e)
        sandbox_ObjectAttach_Remove(e); // detach child objects
 
        // if the object being removed has been selected for attachment by a player, unset it
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, LAMBDA(it.object_attach = NULL));
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, { it.object_attach = NULL; });
 
        if(e.material)  {       strunzone(e.material);  e.material = string_null;       }
        if(e.crypto_idfp)       {       strunzone(e.crypto_idfp);       e.crypto_idfp = string_null;    }
index ee75728630e2e5623f988e1d7efaf7b31d9f37d7..55bc12392d8e4704a2c52705361d06b102301c06 100644 (file)
@@ -33,7 +33,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
                return;
 
        RandomSelection_Init();
-       FOREACH_CLIENT(IS_PLAYER(it) && it != player && SAME_TEAM(it, player) && !IS_DEAD(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && it != player && SAME_TEAM(it, player) && !IS_DEAD(it), {
                if(vdist(spawn_spot.origin - it.origin, >, autocvar_g_spawn_near_teammate_distance))
                        continue;
                if(vdist(spawn_spot.origin - it.origin, <, 48))
@@ -41,7 +41,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
                if(!checkpvs(spawn_spot.origin, it))
                        continue;
                RandomSelection_AddEnt(it, 1, 1);
-       ));
+       });
 
        if(RandomSelection_chosen_ent)
        {
@@ -85,7 +85,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                vector best_pos = '0 0 0';
                float best_dist2 = FLOAT_MAX;
                int tested = 0;
-               FOREACH_CLIENT_RANDOM(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT_RANDOM(IS_PLAYER(it), {
                        if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_max && tested >= autocvar_g_spawn_near_teammate_ignore_spawnpoint_max) break;
 
                        if (PHYS_INPUT_BUTTON_CHAT(it)) continue;
@@ -196,7 +196,7 @@ LABEL(skip)
                                        break; // don't test the other spots near this teammate, go to the next one
                                }
                        }
-               ));
+               });
 
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
                if(best_mate)
index c423042a3c9b46fe5659cbafad09da16970a730f..4c99095b79df43f68e4daa402d97599cda72ebae 100644 (file)
@@ -103,7 +103,7 @@ MUTATOR_HOOKFUNCTION(superspec, ItemTouch)
        entity item = M_ARGV(0, entity);
        entity toucher = M_ARGV(1, entity);
 
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                if(!IS_SPEC(it) && !IS_OBSERVER(it))
                        continue;
                if(it.superspec_flags & SSF_ITEMMSG)
@@ -143,7 +143,7 @@ MUTATOR_HOOKFUNCTION(superspec, ItemTouch)
                                }
                        }
                }
-       ));
+       });
 
        return MUT_ITEMTOUCH_CONTINUE;
 }
@@ -345,7 +345,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand)
 
        if(cmd_name == "followpowerup")
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), LAMBDA(return superspec_Spectate(player, it)));
+               FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), { return superspec_Spectate(player, it); });
 
                superspec_msg("", "", player, "No active powerup\n", 1);
                return true;
@@ -353,7 +353,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand)
 
        if(cmd_name == "followstrength")
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, LAMBDA(return superspec_Spectate(player, it)));
+               FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, { return superspec_Spectate(player, it); });
 
                superspec_msg("", "", player, "No active Strength\n", 1);
                return true;
@@ -361,7 +361,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand)
 
        if(cmd_name == "followshield")
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, LAMBDA(return superspec_Spectate(player, it)));
+               FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, { return superspec_Spectate(player, it); });
 
                superspec_msg("", "", player, "No active Shield\n", 1);
                return true;
@@ -440,7 +440,7 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies)
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
 
-       FOREACH_CLIENT(IS_SPEC(it), LAMBDA(
+       FOREACH_CLIENT(IS_SPEC(it), {
                if(it.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && it.enemy == frag_target)
                {
                        if(it.autospec_flags & ASF_SHOWWHAT)
@@ -448,7 +448,7 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies)
 
                        superspec_Spectate(it, frag_attacker);
                }
-       ));
+       });
 }
 
 MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect)
index ddcd891609a493fd33e4b413112a3f449ed0a9e3..3e6edb04b356cf4b722504cbe2d5b04af8f494c8 100644 (file)
@@ -33,7 +33,7 @@ MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink)
        if(IS_PLAYER(player))
        if(!IS_DEAD(player))
        if(!IS_INDEPENDENT_PLAYER(player))
-               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
                        if(time > it.touchexplode_time)
                        if(!STAT(FROZEN, it))
                        if(!IS_DEAD(it))
@@ -43,5 +43,5 @@ MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink)
                                PlayerTouchExplode(player, it);
                                player.touchexplode_time = it.touchexplode_time = time + 0.2;
                        }
-               ));
+               });
 }
index 95a52185b849fd5c4a475b642c78d0148905a63c..b0d95ea29eb784570f48fb4621724dd930e0e292 100644 (file)
@@ -44,7 +44,7 @@ MUTATOR_HOOKFUNCTION(walljump, PlayerJump)
        if(!IS_DEAD(player))
        {
                vector plane_normal = PlayerTouchWall(player);
-               
+
                if(plane_normal != '0 0 0')
                {
                        float wj_force = PHYS_WALLJUMP_FORCE(player);
index 81f54b1c903807612713536ae6081ca311c77554..9e20392236ea32ccb73948c1a5707d93c304f1df 100644 (file)
@@ -259,9 +259,9 @@ string spritelookuptext(entity this, string s)
     }
 
     // need to loop, as our netname could be one of three
-    FOREACH(Waypoints, it.netname == s, LAMBDA(
+    FOREACH(Waypoints, it.netname == s, {
         return it.m_name;
-    ));
+    });
 
     return s;
 }
index 8b5edbf6f471f966874e83282abc5a00d788e610..cba6023bda8b10aadfcf99df8bdc8a47ffe22561 100644 (file)
     MSG_INFO_NOTIF(CHAT_NOSPECTATORS,                       N_CHATCON,  0, 0, "", "",       "",     _("^F4NOTE: ^BGSpectator chat is not sent to players during the match"), "")
 
     MULTITEAM_INFO(CTF_CAPTURE, 4,                          N_CONSOLE,  1, 0, "s1", "s1",                       "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag"), "", FLAG)
-    MULTITEAM_INFO(CTF_CAPTURE_BROKEN, 4,                   N_CONSOLE,  2, 2, "s1 f1p2dec s2 f2p2dec", "s1",    "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds"), "", FLAG)
+    MULTITEAM_INFO(CTF_CAPTURE_BROKEN, 4,                   N_CONSOLE,  2, 2, "s1 f1dtime s2 f2dtime", "s1",    "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds"), "", FLAG)
     MSG_INFO_NOTIF(CTF_CAPTURE_NEUTRAL,                     N_CONSOLE,  1, 0, "s1", "s1",                       "notify_neutral_captured",  _("^BG%s^BG captured the flag"), "")
-    MULTITEAM_INFO(CTF_CAPTURE_TIME, 4,                     N_CONSOLE,  1, 1, "s1 f1p2dec", "s1",               "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds"), "", FLAG)
-    MULTITEAM_INFO(CTF_CAPTURE_UNBROKEN, 4,                 N_CONSOLE,  2, 2, "s1 f1p2dec s2 f2p2dec", "s1",    "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag in ^F2%s^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%s^BG seconds"), "", FLAG)
+    MULTITEAM_INFO(CTF_CAPTURE_TIME, 4,                     N_CONSOLE,  1, 1, "s1 f1dtime", "s1",               "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds"), "", FLAG)
+    MULTITEAM_INFO(CTF_CAPTURE_UNBROKEN, 4,                 N_CONSOLE,  2, 2, "s1 f1dtime s2 f2dtime", "s1",    "notify_%s_captured",       _("^BG%s^BG captured the ^TC^TT^BG flag in ^F2%s^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%s^BG seconds"), "", FLAG)
     MULTITEAM_INFO(CTF_FLAGRETURN_ABORTRUN, 4,              N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe ^TC^TT^BG flag was returned to base by its owner"), "", FLAG)
     MSG_INFO_NOTIF(CTF_FLAGRETURN_ABORTRUN_NEUTRAL,         N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe flag was returned by its owner"), "")
     MULTITEAM_INFO(CTF_FLAGRETURN_DAMAGED, 4,               N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe ^TC^TT^BG flag was destroyed and returned to base"), "", FLAG)
     MSG_INFO_NOTIF(CTF_FLAGRETURN_DROPPED_NEUTRAL,          N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe flag was dropped in the base and returned itself"), "")
     MULTITEAM_INFO(CTF_FLAGRETURN_NEEDKILL, 4,              N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe ^TC^TT^BG flag fell somewhere it couldn't be reached and returned to base"), "", FLAG)
     MSG_INFO_NOTIF(CTF_FLAGRETURN_NEEDKILL_NEUTRAL,         N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe flag fell somewhere it couldn't be reached and returned to base"), "")
-    MULTITEAM_INFO(CTF_FLAGRETURN_SPEEDRUN, 4,              N_CONSOLE,  0, 1, "f1p2dec", "",                    "",                         _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself"), "", FLAG)
-    MSG_INFO_NOTIF(CTF_FLAGRETURN_SPEEDRUN_NEUTRAL,         N_CONSOLE,  0, 1, "f1p2dec", "",                    "",                         _("^BGThe flag became impatient after ^F1%.2f^BG seconds and returned itself"), "")
+    MULTITEAM_INFO(CTF_FLAGRETURN_SPEEDRUN, 4,              N_CONSOLE,  0, 1, "f1dtime", "",                    "",                         _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself"), "", FLAG)
+    MSG_INFO_NOTIF(CTF_FLAGRETURN_SPEEDRUN_NEUTRAL,         N_CONSOLE,  0, 1, "f1dtime", "",                    "",                         _("^BGThe flag became impatient after ^F1%.2f^BG seconds and returned itself"), "")
     MULTITEAM_INFO(CTF_FLAGRETURN_TIMEOUT, 4,               N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe ^TC^TT^BG flag has returned to the base"), "", FLAG)
     MSG_INFO_NOTIF(CTF_FLAGRETURN_TIMEOUT_NEUTRAL,          N_CONSOLE,  0, 0, "", "",                           "",                         _("^BGThe flag has returned to the base"), "")
     MULTITEAM_INFO(CTF_LOST, 4,                             N_CONSOLE,  1, 0, "s1", "s1",                       "notify_%s_lost",           _("^BG%s^BG lost the ^TC^TT^BG flag"), "", FLAG)
index 4bd827a6e8fe8f80f8ff6d2ef8142af8ba1964e4..4cc59a5d000a1cdebaf3f0f654ca48ad2961c406 100644 (file)
@@ -6,6 +6,10 @@
 #include <common/teams.qh>
 #include <common/util.qh>
 
+#ifdef CSQC
+#include <client/autocvars.qh>
+#endif
+
 /** main types/groups of notifications */
 ENUMCLASS(MSG)
        /** "Global" AND "personal" announcer messages */
@@ -402,8 +406,8 @@ string BUFF_NAME(int i);
        ARG_CASE(ARG_CS_SV_DC,  "f2",            ftos(f2)) \
        ARG_CASE(ARG_CS_SV,     "f3",            ftos(f3)) \
        ARG_CASE(ARG_CS_SV,     "f4",            ftos(f4)) \
-       ARG_CASE(ARG_CS_SV,     "f1p2dec",       ftos_decimals(f1/100, 2)) \
-       ARG_CASE(ARG_CS_SV,     "f2p2dec",       ftos_decimals(f2/100, 2)) \
+       ARG_CASE(ARG_CS_SV,     "f1dtime",       ftos_decimals(TIME_DECODE(f1), 2)) \
+       ARG_CASE(ARG_CS_SV,     "f2dtime",       ftos_decimals(TIME_DECODE(f2), 2)) \
        ARG_CASE(ARG_CS,        "f2primsec",     (f2 ? _("secondary") : _("primary"))) \
        ARG_CASE(ARG_CS,        "f3primsec",     (f3 ? _("secondary") : _("primary"))) \
        ARG_CASE(ARG_CS,        "f1secs",        count_seconds(f1)) \
index b73942b871db2ebfdd9b4e81a79a9ca97570c309..ac4c97618bd3fc38bd5446e956b1fd34c992a7c2 100644 (file)
@@ -813,7 +813,8 @@ void CSQC_ClientMovement_PlayerMove_Frame(entity this)
 {
 #ifdef SVQC
        // needs to be called before physics are run!
-       PM_UpdateButtons(this, CS(this));
+       if(IS_REAL_CLIENT(this))
+               PM_UpdateButtons(this, CS(this));
 #endif
 
        sys_phys_update(this, PHYS_INPUT_TIMELENGTH);
index 7462239f7701d88886e59387b5dec24d3721996b..31b5ed4873642ceb21b2fb3fae77b66c5770fd23 100644 (file)
@@ -1,3 +1,5 @@
+#pragma once
+
 // Global list of sounds
 // TODO: remove uses of _sound
 
index 203b643854c5d5cf6b7cf0aaba762390ec6fa7e4..328486d35470cfc3594e437742d6428d2426a14c 100644 (file)
@@ -1,6 +1,8 @@
 #include "all.qh"
 #ifdef SVQC
 
+#include <server/utils.qh>
+
 bool autocvar_bot_sound_monopoly;
 
 .entity realowner;
index c1503ca68b5b167f414992d97a405cbbec5dc8d2..c452b1128188603f4ec3d62027e90590d2cfd335 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 #ifdef SVQC
+#include <server/autocvars.qh>
 #include <server/client.qh>
 #endif
 
index f40e5def2e3a9512eef057057c11496b02ddc4c5..f1fe312b33089a6fb910ebde0ab3c3d2106262ce 100644 (file)
@@ -134,10 +134,17 @@ void Item_PreDraw(entity this)
        }
        float alph;
        vector org = getpropertyvec(VF_ORIGIN);
-       if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
-               alph = 0;
-       else if(this.fade_start)
-               alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+       //if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
+               //alph = 0; // this shouldn't be needed, since items behind walls are culled anyway
+       if(this.fade_start)
+       {
+               if(vdist(org - this.origin, >, this.fade_end))
+                       alph = 0; // save on some processing
+               else if(vdist(org - this.origin, <, this.fade_start))
+                       alph = 1; // more processing saved
+               else
+                       alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+       }
        else
                alph = 1;
        //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
@@ -891,7 +898,7 @@ LABEL(pickup)
        _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
 
        if (this.classname == "droppedweapon")
-               delete (this);
+               delete(this);
        else if (this.spawnshieldtime)
        {
                entity e;
@@ -1195,7 +1202,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                if(!have_pickup_item(this))
                {
                        startitem_failed = true;
-                       delete (this);
+                       delete(this);
                        return;
                }
 
@@ -1233,7 +1240,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                        // target_give not yet supported; maybe later
                        print("removed targeted ", this.classname, "\n");
                        startitem_failed = true;
-                       remove (this);
+                       delete(this);
                        return;
                }
                */
index 20963fd269e562bc06c3d1316c30dbb1c123b197..b92aceb8d0b342028f8c64f3aca50f3e975c8c78 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef SVQC
+#include <server/defs.qh>
+#endif
+
 const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
 
 // item networking
index 18fab59d1c47fce70488280c7c8c93b83057e7a0..5b6182e0ab8574877e11f8432a316bcf41e94aa3 100644 (file)
@@ -41,7 +41,7 @@ void SUB_VanishOrRemove (entity ent)
        else
        {
                // remove
-               delete (ent);
+               delete(ent);
        }
 }
 
index 6b06b75f10ef9c672238ffbd985824be6403a5c9..c59ee797615bfbd03a753f28a37fb119924263ea 100644 (file)
@@ -1,6 +1,7 @@
 // generated file; do not modify
 #include <common/triggers/target/changelevel.qh>
 #include <common/triggers/target/include.qh>
+#include <common/triggers/target/kill.qh>
 #include <common/triggers/target/levelwarp.qh>
 #include <common/triggers/target/location.qh>
 #include <common/triggers/target/music.qh>
index a086bb3c898af0a6701c7b06fc84b770d4d274bd..a821ac1393724ace54a18286c8e22aa6cb8f59ca 100644 (file)
@@ -1,3 +1,4 @@
+#include "kill.qh"
 #include "location.qh"
 #ifdef SVQC
 
diff --git a/qcsrc/common/triggers/target/kill.qh b/qcsrc/common/triggers/target/kill.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 808d08101b120ca18ced191749a3de141f4b29d2..5e8c641be542735efe020f155f2d7ff556f7dcbc 100644 (file)
@@ -54,7 +54,7 @@ void multi_trigger(entity this)
                multi_wait(this); // waiting finished
        }
        else
-       {       // we can't just remove (this) here, because this is a touch function
+       {       // we can't just delete(this) here, because this is a touch function
                // called while C code is looping through area links...
                settouch(this, func_null);
        }
index 1c0a328a13a21d638fa5b4347829ecde721a4121..c3c2c7474e6983b071464d04cc59ea45bbb47c1f 100644 (file)
@@ -34,7 +34,7 @@ void trigger_secret_touch(entity this, entity toucher)
 
        // handle normal trigger features
        multi_touch(this, toucher);
-       // we can't just remove (this) here, because this is a touch function
+       // we can't just delete(this) here, because this is a touch function
        // called while C code is looping through area links...
        //delete(this);
 }
index b9250f0a8853671261b64fb2558c0df2047581aa..cb69bf0ff12ba7f2ec9c312e0af33002af6b9393 100644 (file)
@@ -1254,7 +1254,7 @@ void turret_findtarget(entity this)
                setthink(e, turrets_manager_think);
                e.nextthink = time + 2;
        }
-       
+
        entity targ = find(NULL, targetname, this.target);
        if(targ.classname == "turret_checkpoint")
                return; // turrets don't defend checkpoints?
index edd06bd6db0f846bb793f1d950dbdfd7f4eaa529..41a7bd962dc6e8a19ffcef03eb4291db7e55ed29 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <server/miscfunctions.qh>
+
 entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
 void turret_projectile_explode(entity this);
 float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
index d8c0a675d5c0b1175be5a3f6d79c6e086df88f3d..2f651589d76728a611f7325ddaf3f683345a0f30 100644 (file)
@@ -78,7 +78,7 @@ void walker_setnoanim(entity this)
 void walker_rocket_explode(entity this)
 {
     RadiusDamage (this, this.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), this, NULL, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, NULL);
-    delete (this);
+    delete(this);
 }
 
 void walker_rocket_touch(entity this, entity toucher)
index 6e9b31a74f394a3ca38cab1e74ebf807078bc3c3..3304d0e7a455453b02615f44a5664bfaafe8cbdb 100644 (file)
@@ -33,9 +33,7 @@ string draw_UseSkinFor(string pic);
 // for each element, funcPre is called first, then funcPre and funcPost for all its children, and funcPost last
 void depthfirst(entity start, .entity up, .entity downleft, .entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass);
 
-// adding just 0.4 for race times so it rounds down in the .5 case (matching the timer display)
-// FIXME it doesn't round properly
-#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
+#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.5)
 
 const int TIME_DECIMALS = 2;
 const float TIME_FACTOR = 100;
index 47991b42391a902793e4cf62a4f815d8c38653a1..1fbd80210475debd33e63fc5823ca4dd114214bb 100644 (file)
@@ -234,7 +234,7 @@ void vehicles_projectile_explode(entity this, entity toucher)
        this.event_damage = func_null;
        RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, toucher);
 
-       delete (this);
+       delete(this);
 }
 
 void vehicles_projectile_explode_think(entity this)
index 79d938d2ef8c0fcba5b3676667ef506184242b23..93f479b14f3efb1f7e46f5cd7a5738d211fcfd4b 100644 (file)
@@ -123,9 +123,9 @@ bool spiderbot_frame(entity this, float dt)
                }
 
                if (!PHYS_INPUT_BUTTON_JUMP(this))
-                       PHYS_INPUT_BUTTON_JUMP(vehic) = false;
+                       vehic.button2 = false;
 
-               if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !PHYS_INPUT_BUTTON_JUMP(vehic) && vehic.tur_head.wait < time)
+               if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !vehic.button2 && vehic.tur_head.wait < time)
                {
                        sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
                        //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
@@ -133,7 +133,7 @@ bool spiderbot_frame(entity this, float dt)
 
                        vehic.tur_head.wait = time + 2;
                        vehic.jump_delay = time + 2;
-                       PHYS_INPUT_BUTTON_JUMP(vehic) = true; // set spider's jump
+                       vehic.button2 = true; // set spider's jump
                        //PHYS_INPUT_BUTTON_JUMP(this) = false;
 
                        vector movefix = '0 0 0';
index 83fe0c19673ccc513463f50eb13145c90a8d5f1b..c88e3a70421b239a3468af98adb79d17c1460aeb 100644 (file)
@@ -4,8 +4,8 @@
 #include <common/stats.qh>
 #include "config.qh"
 
-// weapon sets
-USING(WepSet, vector);
+#include "weapon.qh"
+
 #ifdef SVQC
 void WriteWepSet(float dest, WepSet w);
 #endif
@@ -16,8 +16,6 @@ WepSet WepSet_GetFromStat_InMap();
 WepSet ReadWepSet();
 #endif
 
-#include "weapon.qh"
-
 #ifdef GAMEQC
 #include "calculations.qh"
 #include "projectiles.qh"
index 16332634352f966d7f49f2923c1ff5a09c20901e..ab24ec4a87d894c6c924ebde154b2df753e88516 100644 (file)
@@ -7,6 +7,8 @@
 #include <common/effects/qc/all.qh>
 #endif
 
+USING(WepSet, vector);
+
 const int MAX_WEAPONSLOTS = 2;
 .entity weaponentities[MAX_WEAPONSLOTS];
 
index ba38407f34b8921fcc048b4d9139813f5e362706..e6c2f7ccd8617e0087b19d0224d5e0760174cf3f 100644 (file)
@@ -15,7 +15,10 @@ void sys_phys_update(entity this, float dt)
        sys_in_update(this, dt);
 
        sys_phys_fix(this, dt);
-       if (sys_phys_override(this, dt)) { return; } sys_phys_monitor(this, dt);
+       if (sys_phys_override(this, dt))
+               return;
+
+       sys_phys_monitor(this, dt);
 
        PHYS_CS(this).movement_old = PHYS_CS(this).movement;
        PHYS_CS(this).v_angle_old = this.v_angle;
index a3282a0ab1c9e1e3181a80353531defe91491a43..8ca07b43f3d34ecaa83e63b1810f415e26ad47a6 100644 (file)
  */
 #define REGISTRY(id, max) \
        void Register##id(); \
+       [[accumulate]] void REGISTRY_DEPENDS_(id) {} \
        [[accumulate]] REGISTRY_BEGIN(id) {} \
        [[accumulate]] REGISTRY_END(id) {} \
        void _Register##id() {} \
-       void Register##id() { REGISTRY_BEGIN_(id); _Register##id(); REGISTRY_END_(id); } \
+       int id##_state = 0; \
+       void Register##id() { if (id##_state) return; id##_state = 1; REGISTRY_DEPENDS_(id); REGISTRY_BEGIN_(id); _Register##id(); id##_state = 2; REGISTRY_END_(id); } \
        const int id##_MAX = max; \
        int id##_COUNT; \
        noref entity id##_first, id##_last; \
        SHUTDOWN(id) { _R_DEL(_##id); } \
        entity _##id##_from(int i, entity null) { if (i >= 0 && i < id##_COUNT) { entity e = _R_GET(_##id, i); if (e) return e; } return null; }
 
+/** Add registry dependencies to a registry */
+#define REGISTRY_DEPENDS(id, dep) void Register##dep(); void REGISTRY_DEPENDS_(id) { Register##dep(); }
+#define REGISTRY_DEPENDS_(id) Register##id##_Depends()
+
 /** Called before initializing a registry. */
 #define REGISTRY_BEGIN(id) [[accumulate]] void REGISTRY_BEGIN_(id) { noref void() f = Register##id; } void REGISTRY_BEGIN_(id)
 #define REGISTRY_BEGIN_(id) Register##id##_First()
@@ -189,5 +195,6 @@ void Registry_send(string id, string hash);
        ENDCLASS(id##Registry) \
        REGISTER(Registries, REGISTRY, id, m_id, NEW(id##Registry)); \
        METHOD(id##Registry, m_reload, void()) { \
+           id##_state = 0; \
                Register##id(); \
        }
index 03248ec50cca3943128c2cfa59ba6fb9ae4037ee..65b1a7f6416485d2777926c3c86e1aae006a9a02 100644 (file)
@@ -784,7 +784,7 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me)
        return e;
 }
 
-float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
+bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
 {
        return !WarpZoneLib_BoxTouchesBrush(toucher.absmin, toucher.absmax, this, toucher);
 }
@@ -804,11 +804,9 @@ void WarpZoneLib_MoveOutOfSolid_Expand(entity e, vector by)
        }
 }
 
-float WarpZoneLib_MoveOutOfSolid(entity e)
+bool WarpZoneLib_MoveOutOfSolid(entity e)
 {
-       vector o, m0, m1;
-
-       o = e.origin;
+       vector o = e.origin;
        traceline(o, o, MOVE_WORLDONLY, e);
        if (trace_startsolid)
                return false;
@@ -817,22 +815,16 @@ float WarpZoneLib_MoveOutOfSolid(entity e)
        if (!trace_startsolid)
                return true;
 
-       m0 = e.mins;
-       m1 = e.maxs;
+       vector m0 = e.mins;
+       vector m1 = e.maxs;
        e.mins = '0 0 0';
        e.maxs = '0 0 0';
-       WarpZoneLib_MoveOutOfSolid_Expand(e, '1 0 0' * m0_x);
-       e.mins_x = m0_x;
-       WarpZoneLib_MoveOutOfSolid_Expand(e, '1 0 0' * m1_x);
-       e.maxs_x = m1_x;
-       WarpZoneLib_MoveOutOfSolid_Expand(e, '0 1 0' * m0_y);
-       e.mins_y = m0_y;
-       WarpZoneLib_MoveOutOfSolid_Expand(e, '0 1 0' * m1_y);
-       e.maxs_y = m1_y;
-       WarpZoneLib_MoveOutOfSolid_Expand(e, '0 0 1' * m0_z);
-       e.mins_z = m0_z;
-       WarpZoneLib_MoveOutOfSolid_Expand(e, '0 0 1' * m1_z);
-       e.maxs_z = m1_z;
+       WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m0.x); e.mins.x = m0.x;
+       WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m1.x); e.maxs.x = m1.x;
+       WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m0.y); e.mins.y = m0.y;
+       WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m1.y); e.maxs.y = m1.y;
+       WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m0.z); e.mins.z = m0.z;
+       WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m1.z); e.maxs.z = m1.z;
        setorigin(e, e.origin);
 
        tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_WORLDONLY, e);
index 26c0e80fe4623526ee12cecc05842fb92c4f5dd0..0ddd0d052a1a41da19c5b151b1be04b7831b1281 100644 (file)
@@ -106,10 +106,10 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me); // spawn().R = me.R
 #ifndef BITXOR_ASSIGN
 # define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b)))
 #endif
-float WarpZoneLib_MoveOutOfSolid(entity e);
+bool WarpZoneLib_MoveOutOfSolid(entity e);
 #define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
 
-float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
+bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
 void WarpZoneLib_ExactTrigger_Init(entity this);
 
 // WARNING: this kills the trace globals
index 40c317a6910ec9f994614af7e88ef2db16230946..fa247896756ca68e8527c5d4a1290b048665b7c7 100644 (file)
@@ -811,7 +811,7 @@ void WarpZone_StartFrame()
                        WarpZone_StoreProjectileData(it);
                });
        }
-               
+
 
        FOREACH_CLIENT(true,
        {
index b73289927b474878d93081425a75876f7b2ae62d..515f8db2e727b47bf172e5eb91e4ca9d52deaf67 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
-float WarpZoneLib_MoveOutOfSolid(entity e);
-float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
+bool WarpZoneLib_MoveOutOfSolid(entity e);
+bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
 #ifdef SVQC
 void WarpZoneLib_ExactTrigger_Init(entity this);
 #endif
diff --git a/qcsrc/menu/_all.inc b/qcsrc/menu/_all.inc
deleted file mode 100644 (file)
index e5198f5..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <menu/_all.qh>
-#include "_mod.inc"
-
-#include "anim/_mod.inc"
-#include "command/_mod.inc"
-#include "item/_mod.inc"
-#include "mutators/_mod.inc"
-#include "xonotic/_mod.inc"
-
-#include <common/_all.inc>
diff --git a/qcsrc/menu/_all.qh b/qcsrc/menu/_all.qh
deleted file mode 100644 (file)
index 21f784e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#include "draw.qh"
-#include "xonotic/util.qh"
-#include "menu.qh"
index e1a26e76b6449bf442fb47f18e4bd6c3892e040f..d2a8d702f16ad3241b92011889b7a52da3599bd4 100644 (file)
@@ -3,3 +3,9 @@
 #include <menu/item.qc>
 #include <menu/matrix.qc>
 #include <menu/menu.qc>
+
+#include <menu/anim/_mod.inc>
+#include <menu/command/_mod.inc>
+#include <menu/item/_mod.inc>
+#include <menu/mutators/_mod.inc>
+#include <menu/xonotic/_mod.inc>
index a5fe87d3e41a80d846a7adf98620bf622dbb1ed7..da8675831a4d8e130e66df558f7ecb102625ce5a 100644 (file)
@@ -3,3 +3,9 @@
 #include <menu/item.qh>
 #include <menu/matrix.qh>
 #include <menu/menu.qh>
+
+#include <menu/anim/_mod.qh>
+#include <menu/command/_mod.qh>
+#include <menu/item/_mod.qh>
+#include <menu/mutators/_mod.qh>
+#include <menu/xonotic/_mod.qh>
index 00dae2ed37db4ae2eb84c01977b2a78917831ebb..a5df526806e851e7777f0e6792de627881a46145 100644 (file)
@@ -2,6 +2,8 @@
 
 // convenience
 #include "skin.qh"
+#include "draw.qh"
+#include "menu.qh"
 
 CLASS(Item, Object)
        METHOD(Item, draw, void(Item));
index 404c6f2e5a409a588e1014849337e1133fca81fd..e5b6fb98d0f1e6ecbfd13e454d6523ad0e4acaef 100644 (file)
@@ -1,7 +1,11 @@
 #include <lib/_all.inc>
 
 #if XONOTIC
-#include <menu/_all.inc>
+
+#include "_mod.inc"
+
+#include <common/_all.inc>
+
 #endif
 
 #ifdef BUILD_MOD
index 3ce8afcbb55098cfdf9fa086fd30a8ab76a72390..0ea24a8891931157853a55fe461888271abd5947 100644 (file)
@@ -41,10 +41,10 @@ string WeaponArenaString()
        s = "";
        for(i = 0; i < n; ++i)
        {
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(argv(i) == it.netname)
                                s = strcat(s, " & ", it.m_name);
-               ));
+               });
        }
        s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
 
index 4546a62b109503192359c91904ac49bae9b4053c..1f28a1bdfede23aa181f110ca297596457a85976 100644 (file)
@@ -51,11 +51,11 @@ void Xonotic_KeyBinds_Read()
        int i;
 
        #define ADD_TO_W_LIST(pred) \
-               FOREACH(Weapons, it != WEP_Null, LAMBDA( \
+               FOREACH(Weapons, it != WEP_Null, { \
                        if (it.impulse != imp) continue; \
                        if (!(pred)) continue; \
                        w_list = strcat(w_list, it.m_name, " / "); \
-               ))
+               })
 
        for(int imp = 1; imp <= 9; ++imp)
        {
diff --git a/qcsrc/server/_all.inc b/qcsrc/server/_all.inc
deleted file mode 100644 (file)
index 95bf715..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <server/_all.qh>
-#include "_mod.inc"
-
-#include "bot/_mod.inc"
-#include "command/_mod.inc"
-#include "compat/_mod.inc"
-#include "mutators/_mod.inc"
-#include "pathlib/_mod.inc"
-#include "weapons/_mod.inc"
-
-#include <common/_all.inc>
-#include <common/effects/qc/all.qc>
-
-#include <lib/csqcmodel/sv_model.qc>
-
-#include <lib/warpzone/anglestransform.qc>
-#include <lib/warpzone/common.qc>
-#include <lib/warpzone/server.qc>
-#include <lib/warpzone/util_server.qc>
diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh
deleted file mode 100644 (file)
index 1fabe4d..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#pragma once
-
-int maxclients;
-
-const string STR_PLAYER = "player";
-const string STR_SPECTATOR = "spectator";
-const string STR_OBSERVER = "observer";
-
-#define IS_PLAYER(v) ((v).classname == STR_PLAYER)
-#define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
-#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
-
-#define IS_CLIENT(v) (v.flags & FL_CLIENT)
-/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
-#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
-#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
-#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
-#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
-
-#define IS_MONSTER(v) (v.flags & FL_MONSTER)
-#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
-#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
-
-// NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
-// NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
-// NOTE: FOR_EACH_REALCLIENT deprecated! Use the following instead: FOREACH_CLIENT(IS_REAL_CLIENT(it), { code; });
-
-// NOTE: FOR_EACH_PLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it), { code; });
-// NOTE: FOR_EACH_SPEC deprecated! Use the following instead: FOREACH_CLIENT(IS_SPEC(it), { code; });
-// NOTE: FOR_EACH_OBSERVER deprecated! Use the following instead: FOREACH_CLIENT(IS_OBSERVER(it), { code; });
-// NOTE: FOR_EACH_REALPLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { code; });
-
-#define FOREACH_CLIENTSLOT(cond, body) \
-       MACRO_BEGIN { \
-               for(int _i = 1; _i <= maxclients; ++_i) \
-               { \
-                       const noref int i = _i; \
-                       ITER_CONST noref entity it = ftoe(i); \
-                       if(cond) { LAMBDA(body) } \
-               } \
-       } MACRO_END
-
-#define FOREACH_CLIENT(cond, body) FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), body)
-
-// using the "inside out" version of knuth-fisher-yates shuffle
-// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
-entity _FCR_clients[255];
-bool _FCR_entered = false;
-#define FOREACH_CLIENT_RANDOM(cond, body) \
-       MACRO_BEGIN { \
-               if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
-               _FCR_entered = true; \
-               int _cnt = 0; \
-               FOREACH_CLIENT(cond, LAMBDA( \
-                       int _j = floor(random() * (_cnt + 1)); \
-                       if (_j == _cnt) \
-                       { \
-                               _FCR_clients[_cnt] = it; \
-                       } \
-                       else \
-                       { \
-                               _FCR_clients[_cnt] = _FCR_clients[_j]; \
-                               _FCR_clients[_j] = it; \
-                       } \
-                       _cnt++; \
-               )); \
-               for (int _i = 0; _i < _cnt; ++_i) \
-               { \
-                       const noref int i = _i; \
-                       ITER_CONST noref entity it = _FCR_clients[i]; \
-                       if (cond) { LAMBDA(body) } \
-               } \
-               _FCR_entered = false; \
-       } MACRO_END
-
-// NOTE: FOR_EACH_MONSTER deprecated! Use the following instead: IL_EACH(g_monsters, true, { code; });
-
-#include <common/effects/all.qh>
-#include <common/models/all.qh>
-#include <common/sounds/all.qh>
-
-#include "autocvars.qh"
-#include "constants.qh"
-#include "defs.qh"
-#include "miscfunctions.qh"
index eb74529a64daf066777af19f3f5b27faae7b38e8..87a8d56892d69577c7d07d2cbe9f9ced6cc5162e 100644 (file)
 #endif
 #include <server/teamplay.qc>
 #include <server/tests.qc>
+
+#include <server/bot/_mod.inc>
+#include <server/command/_mod.inc>
+#include <server/compat/_mod.inc>
+#include <server/mutators/_mod.inc>
+#include <server/pathlib/_mod.inc>
+#include <server/weapons/_mod.inc>
index a0d160d57c31194100a4951913721c7449da2da3..2967c110ce9a5a58db86abcf00a996c27b53172b 100644 (file)
 #endif
 #include <server/teamplay.qh>
 #include <server/tests.qh>
+
+#include <server/bot/_mod.qh>
+#include <server/command/_mod.qh>
+#include <server/compat/_mod.qh>
+#include <server/mutators/_mod.qh>
+#include <server/pathlib/_mod.qh>
+#include <server/weapons/_mod.qh>
index d5f8e39f756aa00a52b9a9c7b48371beabb9bd39..46c871876108005a0a69978681454bf1a9446f09 100644 (file)
@@ -2,6 +2,7 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
+    #include <server/defs.qh>
     #include <common/state.qh>
     #include <common/vehicles/all.qh>
     #include "antilag.qh"
index d4882135768a0adf146bd93c1897d51ef6c598fb..f33cc4f2646502447f0bcf60fd4c96c10d0d5738 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <server/defs.qh>
 #include <common/weapons/_all.qh>
 
 const int WAYPOINTFLAG_GENERATED = BIT(23);
index d0ba63365abfc5fc3b7877e5e45549e4f8fced47..feb19afe1f921b25fec4c0422555482c70ff1b43 100644 (file)
@@ -1,5 +1,7 @@
 #include "aim.qh"
 
+#include <server/defs.qh>
+
 #include "cvars.qh"
 
 #include "bot.qh"
index a1d7b10a4c156c22d09e1cac733a1ce460f92b32..8cef8618f411facb0665d929925504ed5f3cb1e5 100644 (file)
@@ -175,13 +175,13 @@ void bot_setnameandstuff(entity this)
                                continue;
                        s = argv(0);
                        prio = 1;
-                       FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA(
+                       FOREACH_CLIENT(IS_BOT_CLIENT(it), {
                                if(s == it.cleanname)
                                {
                                        prio = 0;
                                        break;
                                }
-                       ));
+                       });
                        RandomSelection_AddString(readfile, 1, prio);
                }
                readfile = RandomSelection_chosen_string;
@@ -248,10 +248,10 @@ void bot_setnameandstuff(entity this)
 
        // number bots with identical names
        int j = 0;
-       FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_BOT_CLIENT(it), {
                if(it.cleanname == name)
                        ++j;
-       ));
+       });
        if (j)
                this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
        else
@@ -526,12 +526,12 @@ void autoskill(float factor)
 
        bestbot = -1;
        bestplayer = -1;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                if(IS_REAL_CLIENT(it))
                        bestplayer = max(bestplayer, it.totalfrags - it.totalfrags_lastcheck);
                else
                        bestbot = max(bestbot, it.totalfrags - it.totalfrags_lastcheck);
-       ));
+       });
 
        LOG_DEBUG("autoskill: best player got ", ftos(bestplayer), ", ");
        LOG_DEBUG("best bot got ", ftos(bestbot), "; ");
@@ -565,7 +565,7 @@ void autoskill(float factor)
                // don't reset counters, wait for them to accumulate
        }
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.totalfrags_lastcheck = it.totalfrags));
+       FOREACH_CLIENT(IS_PLAYER(it), { it.totalfrags_lastcheck = it.totalfrags; });
 }
 
 void bot_calculate_stepheightvec()
@@ -584,11 +584,11 @@ float bot_fixcount()
                activerealplayers = M_ARGV(0, int);
                realplayers = M_ARGV(1, int);
        } else {
-               FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+               FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                        if(IS_PLAYER(it))
                                ++activerealplayers;
                        ++realplayers;
-               ));
+               });
        }
 
        int bots;
index cede62366848b6407f7e8924863290c62a905099..46acf8828774324f3790596ce465576f6c6c7b77 100644 (file)
@@ -1,5 +1,7 @@
 #include "havocbot.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../cvars.qh"
 
 #include "../aim.qh"
@@ -187,13 +189,13 @@ void havocbot_ai(entity this)
                        if(skill >= 5) // bots can only look for unloaded weapons past this skill
                        if(this.(weaponentity).clip_load >= 0) // only if we're not reloading a weapon already
                        {
-                               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                               FOREACH(Weapons, it != WEP_Null, {
                                        if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo))
                                        {
                                                this.(weaponentity).m_switchweapon = it;
                                                break;
                                        }
-                               ));
+                               });
                        }
                }
        }
@@ -363,7 +365,7 @@ void havocbot_bunnyhop(entity this, vector dir)
                                        if(checkdistance)
                                        {
                                                this.aistatus &= ~AI_STATUS_RUNNING;
-                                               // increase stop distance in case the goal is on a slope or a lower platform 
+                                               // increase stop distance in case the goal is on a slope or a lower platform
                                                if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance + (this.origin.z - gco.z))
                                                        PHYS_INPUT_BUTTON_JUMP(this) = true;
                                        }
@@ -1078,10 +1080,10 @@ float havocbot_chooseweapon_checkreload(entity this, .entity weaponentity, int n
        // if this weapon is scheduled for reloading, don't switch to it during combat
        if (this.(weaponentity).weapon_load[new_weapon] < 0)
        {
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(it.wr_checkammo1(it, this, weaponentity) + it.wr_checkammo2(it, this, weaponentity))
                                return true; // other weapon available
-               ));
+               });
        }
 
        return false;
@@ -1103,13 +1105,13 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
        {
                // If no weapon was chosen get the first available weapon
                if(this.(weaponentity).m_weapon==WEP_Null)
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(client_hasweapon(this, it, weaponentity, true, false))
                        {
                                this.(weaponentity).m_switchweapon = it;
                                return;
                        }
-               ));
+               });
                return;
        }
 
index 675dd036b7e7151dfdf100c98de66b8a242ea0f3..94aed9c96e1219333a5c792572b7a33e74a9a0cd 100644 (file)
@@ -1,5 +1,7 @@
 #include "roles.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "havocbot.qh"
 
 #include "../cvars.qh"
@@ -168,7 +170,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
        ratingscale = ratingscale * 0.00005; // enemies are rated around 20000 already
 
        float t;
-       FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), {
                // TODO: Merge this logic with the bot_shouldattack function
                if(vdist(it.origin - org, <, 100) || vdist(it.origin - org, >, sradius))
                        continue;
@@ -191,7 +193,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
                ratingscale *= t;
                if (ratingscale > 0)
                        navigation_routerating(this, it, ratingscale * BOT_RATING_ENEMY, 2000);
-       ));
+       });
 }
 
 // legacy bot role for standard gamemodes
index fc97931541bc3bcdf5d8401ae7612b9e1b6da866..d0061b90068efbcade910b2332e20c5aff9198b5 100644 (file)
@@ -1,5 +1,7 @@
 #include "navigation.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
index 9dca0af07637ce9f44d1fbd194115a0a88581cf3..badf9437ecb9c8f16cc0ac28afbed8d1dc93d82c 100644 (file)
@@ -1,5 +1,7 @@
 #include "scripting.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include <common/state.qh>
@@ -539,16 +541,16 @@ float bot_cmd_barrier(entity this)
 
        if(this.bot_barrier == 1) // find other bots
        {
-               FOREACH_CLIENT(it.isbot, LAMBDA(
+               FOREACH_CLIENT(it.isbot, {
                        if(it.bot_cmdqueuebuf_allocated)
                        if(it.bot_barrier != 1)
                                return CMD_STATUS_EXECUTING; // not all are at the barrier yet
-               ));
+               });
 
                // all bots hit the barrier!
 
                // acknowledge barrier
-               FOREACH_CLIENT(it.isbot, LAMBDA(it.bot_barrier = 2));
+               FOREACH_CLIENT(it.isbot, { it.bot_barrier = 2; });
 
                bot_barriertime = time;
        }
@@ -1156,7 +1158,7 @@ void bot_setcurrentcommand(entity this)
 
 void bot_resetqueues()
 {
-       FOREACH_CLIENT(it.isbot, LAMBDA(
+       FOREACH_CLIENT(it.isbot, {
                it.bot_cmd_execution_index = 0;
                bot_clearqueue(it);
                // also, cancel all barriers
@@ -1167,7 +1169,7 @@ void bot_resetqueues()
                        it.(bot_placenames[i]) = string_null;
                }
                it.bot_places_count = 0;
-       ));
+       });
 
        bot_barriertime = time;
 }
index e4c227c8fa2f2491e1ce00e706e8a0215c5b31e8..c8a958ddbd0f2a0fca0cf8f3e7606d684ea77c7d 100644 (file)
@@ -1,5 +1,7 @@
 #include "waypoints.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
@@ -1131,12 +1133,12 @@ LABEL(next)
 
 void botframe_autowaypoints()
 {
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), {
                // going back is broken, so only fix waypoints to walk TO the player
                //botframe_autowaypoints_fix(p, false, botframe_autowaypoints_lastwp0);
                botframe_autowaypoints_fix(it, true, botframe_autowaypoints_lastwp1);
                //te_explosion(p.botframe_autowaypoints_lastwp0.origin);
-       ));
+       });
 
        if (autocvar_g_waypointeditor_auto >= 2) {
                botframe_deleteuselesswaypoints();
index 5097bd8a145bf3254beb73c947e9d8ccba9f0f81..ec8990de25602905b11a12e5e5458523cc4bf8ee 100644 (file)
@@ -1,4 +1,7 @@
 #include "campaign.qh"
+
+#include "defs.qh"
+
 #include "cheats.qh"
 #include "miscfunctions.qh"
 #include "g_world.qh"
@@ -192,12 +195,12 @@ void CampaignPreIntermission()
        int lost = 0;
        string savevar;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                if(it.winning)
                        won += 1;
                else
                        lost += 1;
-       ));
+       });
 
        if(autocvar__campaign_testrun)
        {
index 6d78e160cf1624b9a43cd5339f710e69b3c00f2d..ee1e767601a223b6964aff9ac1aba498a717796e 100644 (file)
@@ -1,5 +1,9 @@
 #include "cheats.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
+
 #include "g_damage.qh"
 #include "race.qh"
 #include "../common/triggers/teleporters.qh"
@@ -264,7 +268,7 @@ float CheatImpulse(entity this, int imp)
                case CHIMPULSE_R00T.impulse:
                        IS_CHEAT(this, imp, 0, 0);
                        RandomSelection_Init();
-                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_AddEnt(it, 1, 1)));
+                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), { RandomSelection_AddEnt(it, 1, 1); });
                        if(RandomSelection_chosen_ent)
                                e = RandomSelection_chosen_ent;
                        else
index 804868fa0031ac041b3e24cf65ae737fb0bed114..a8e2ef34818796c0b7da326d99590baee6a3eed3 100644 (file)
@@ -1,5 +1,8 @@
 #include "client.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
 #include "anticheat.qh"
 #include "impulse.qh"
 #include "player.qh"
@@ -151,7 +154,7 @@ void ClientData_Touch(entity e)
        CS(e).clientdata.SendFlags = 1;
 
        // make it spectatable
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(CS(it).clientdata.SendFlags = 1));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, { CS(it).clientdata.SendFlags = 1; });
 }
 
 void SetSpectatee(entity this, entity spectatee);
@@ -659,7 +662,7 @@ void PutPlayerInServer(entity this)
        target_voicescript_clear(this);
 
        // reset fields the weapons may use
-       FOREACH(Weapons, true, LAMBDA(
+       FOREACH(Weapons, true, {
                it.wr_resetplayer(it, this);
                        // reload all reloadable weapons
                if (it.spawnflags & WEP_FLAG_RELOADABLE) {
@@ -669,7 +672,7 @@ void PutPlayerInServer(entity this)
                                this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo;
                        }
                }
-       ));
+       });
 
        {
                string s = spot.target;
@@ -2009,13 +2012,13 @@ int nJoinAllowed(entity this, entity ignore)
        // TODO simplify this
        int totalClients = 0;
        int currentlyPlaying = 0;
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                if(it != ignore)
                        ++totalClients;
                if(IS_REAL_CLIENT(it))
                if(IS_PLAYER(it) || it.caplayer)
                        ++currentlyPlaying;
-       ));
+       });
 
        float free_slots = 0;
        if (!autocvar_g_maxplayers)
index 8e8c8d71b3a5af1d0e8c17d164bae28f2f858e23..383383ad76aaacdf4d0566a05a6de34115aa257d 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include "utils.qh"
+#include <common/sounds/all.qh>
+
 void ClientState_attach(entity this);
 
 IntrusiveList g_players;
@@ -148,7 +151,7 @@ CLASS(Spectator, Client)
 ENDCLASS(Spectator)
 
 CLASS(Player, Client)
-    
+
     // custom
 
     ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
index fa1be75112914be996dde63c5499328c79bab773..d90b372bb7a8f990b6fec7d9944a6ce93428120b 100644 (file)
@@ -1,4 +1,7 @@
 #include "banning.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/state.qh>
 #include <common/command/_mod.qh>
 #include "banning.qh"
index 03f484d2e68f566e42c526a7239a88bacf0312ec..d1d79981182ceb91e560895f22f7f3d2e4c3a3df 100644 (file)
@@ -1,4 +1,8 @@
 #include "cmd.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 
 #include "common.qh"
index 84366ea6b27b72b9f65e6fc5c6bab97090465e48..d8bc3ac8b3ef07f979c53215e0a761741c864f1e 100644 (file)
@@ -1,4 +1,8 @@
 #include "common.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 #include "common.qh"
 
@@ -115,13 +119,13 @@ entity GetIndexedEntity(float argc, float start_index)
                }
                else  // no, maybe it's a name?
                {
-                       FOREACH_CLIENT(true, LAMBDA(
+                       FOREACH_CLIENT(true, {
                                if(strdecolorize(it.netname) == strdecolorize(argv(start_index)))
                                {
                                        selection = it;
                                        break; // no reason to keep looking
                                }
-                       ));
+                       });
 
                        index = (start_index + 1);
                }
@@ -148,13 +152,13 @@ entity GetFilteredEntity(string input)
        else
        {
                selection = NULL;
-               FOREACH_CLIENT(true, LAMBDA(
+               FOREACH_CLIENT(true, {
                        if(strdecolorize(it.netname) == strdecolorize(input))
                        {
                                selection = it;
                                break; // no reason to keep looking
                        }
-               ));
+               });
        }
 
        return selection;
@@ -217,9 +221,9 @@ void timeout_handler_think(entity this)
                                cvar_set("slowmo", ftos(orig_slowmo));
 
                                // unlock the view for players so they can move around again
-                               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+                               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                                        it.fixangle = false;
-                               ));
+                               });
 
                                timeout_handler_reset(this);
                        }
@@ -244,16 +248,16 @@ void timeout_handler_think(entity this)
                                cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
 
                                // reset all the flood variables
-                               FOREACH_CLIENT(true, LAMBDA(
+                               FOREACH_CLIENT(true, {
                                        it.nickspamcount = it.nickspamtime = it.floodcontrol_chat =
                                                it.floodcontrol_chatteam = it.floodcontrol_chattell =
                                                        it.floodcontrol_voice = it.floodcontrol_voiceteam = 0;
-                               ));
+                               });
 
                                // copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink)
-                               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+                               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                                        it.lastV_angle = it.v_angle;
-                               ));
+                               });
 
                                this.nextthink = time;  // think again next frame to handle it under TIMEOUT_ACTIVE code
                        }
@@ -784,7 +788,7 @@ void CommonCommand_who(float request, entity caller, float argc)
                                "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
 
                        total_listed_players = 0;
-                       FOREACH_CLIENT(true, LAMBDA(
+                       FOREACH_CLIENT(true, {
                                is_bot = (IS_BOT_CLIENT(it));
 
                                if (is_bot)
@@ -813,7 +817,7 @@ void CommonCommand_who(float request, entity caller, float argc)
                                        tmp_crypto_idfp));
 
                                ++total_listed_players;
-                       ));
+                       });
 
                        print_to(caller, strcat("Finished listing ", ftos(total_listed_players), " client(s) out of ", ftos(maxclients), " slots."));
 
index 27dd13a2d6f9c376aa950794616a3bdf55a1dbf0..13cbfe49e127ece70856a11fcd58f670c5750fa6 100644 (file)
@@ -15,7 +15,7 @@ REGISTRY_SORT(COMMON_COMMANDS)
        METHOD(commoncommand_##id, m_invokecmd, void(commoncommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(COMMON_COMMANDS_aliases) {
-       FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
+       FOREACH(COMMON_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd")); });
 }
 
 #include "vote.qh"
@@ -157,30 +157,30 @@ COMMON_COMMAND(who, "Display detailed client information about all players") { C
 
 void CommonCommand_macro_help(entity caller)
 {
-       FOREACH(COMMON_COMMANDS, true, LAMBDA(print_to(caller, sprintf("  ^2%s^7: %s", it.m_name, it.m_description))));
+       FOREACH(COMMON_COMMANDS, true, { print_to(caller, sprintf("  ^2%s^7: %s", it.m_name, it.m_description)); });
 }
 
 float CommonCommand_macro_command(float argc, entity caller, string command)
 {
        string c = strtolower(argv(0));
-       FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+       FOREACH(COMMON_COMMANDS, it.m_name == c, {
                it.m_invokecmd(it, CMD_REQUEST_COMMAND, caller, argc, command);
                return true;
-       ));
+       });
        return false;
 }
 
 float CommonCommand_macro_usage(float argc, entity caller)
 {
        string c = strtolower(argv(1));
-       FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+       FOREACH(COMMON_COMMANDS, it.m_name == c, {
                it.m_invokecmd(it, CMD_REQUEST_USAGE, caller, argc, "");
                return true;
-       ));
+       });
        return false;
 }
 
 void CommonCommand_macro_write_aliases(float fh)
 {
-       FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description)));
+       FOREACH(COMMON_COMMANDS, true, { CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description); });
 }
index cfcadf4456cb9652ea9239e4fdf4ca532229dee2..e67625a307caac26580d06c7491f3299f8f5e255 100644 (file)
@@ -1,4 +1,8 @@
 #include "getreplies.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 #include "getreplies.qh"
 
index d8b1797166fa2108290003ea258bdb81a264bf4e..a04274ed2ef1e31719da405a97bdbe2f0eb60e67 100644 (file)
@@ -1,8 +1,7 @@
+#include "radarmap.qh"
 #ifdef RADARMAP
 
-#include "radarmap.qh"
 #include <common/command/_mod.qh>
-#include "radarmap.qh"
 
 #include "../g_world.qh"
 #include "../g_subs.qh"
index b135c0460113451fe485528457fb8ba512c22e54..8115d712ebe9f46b39f131a9c1dce48f74250377 100644 (file)
@@ -14,5 +14,5 @@ REGISTRY_SORT(SERVER_COMMANDS)
        METHOD(servercommand_##id, m_invokecmd, void(servercommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(SERVER_COMMANDS_aliases) {
-       FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv"))));
+       FOREACH(SERVER_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv")); });
 }
index 4d181c4659d7dca887f99ca1c1c6f888911b7781..49bee362e7481fdc8deb171de0c440ed88f4a2f5 100644 (file)
@@ -1,6 +1,8 @@
 #include "sv_cmd.qh"
 #include "_mod.qh"
 
+#include <common/effects/all.qh>
+
 #include "banning.qh"
 #include "cmd.qh"
 #include "common.qh"
@@ -193,11 +195,11 @@ void GameCommand_allspec(float request, float argc)
                {
                        string reason = argv(1);
                        int n = 0;
-                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                                if (it.caplayer) it.caplayer = 0;
                                PutObserverInServer(it);
                                ++n;
-                       ));
+                       });
                        if (n)   bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
                        else   LOG_INFO("No players found to spectate.\n");
                        return;
@@ -563,11 +565,11 @@ void GameCommand_defer_clear_all(float request)
                        int n = 0;
                        float argc;
 
-                       FOREACH_CLIENT(true, LAMBDA(
+                       FOREACH_CLIENT(true, {
                                argc = tokenize_console(strcat("defer_clear ", ftos(etof(it))));
                                GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
                                ++n;
-                       ));
+                       });
                        if (n)   LOG_INFO(strcat("Successfully stuffed defer clear to all clients (", ftos(n), ")\n"));  // should a message be added if no players were found?
                        return;
                }
@@ -1141,13 +1143,13 @@ void GameCommand_nospectators(float request)
                {
                        blockSpectators = 1;
                        // give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
-                       FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, LAMBDA(
+                       FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, {
                                if(!it.caplayer)
                                {
                                        CS(it).spectatortime = time;
                                        Send_Notification(NOTIF_ONE_ONLY, it, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
                                }
-                       ));
+                       });
                        bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds!\n"));
                        return;
                }
@@ -1345,7 +1347,7 @@ void GameCommand_shuffleteams(float request)
                                return;
                        }
 
-                       FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
+                       FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, {
                                if (it.team_forced) {
                                        // we could theoretically assign forced players to their teams
                                        // and shuffle the rest to fill the empty spots but in practise
@@ -1353,7 +1355,7 @@ void GameCommand_shuffleteams(float request)
                                        LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
                                        return;
                                }
-                       ));
+                       });
 
                        int number_of_teams = 0;
                        CheckAllowedTeams(NULL);
@@ -1363,11 +1365,11 @@ void GameCommand_shuffleteams(float request)
                        if (c4 >= 0) number_of_teams = max(4, number_of_teams);
 
                        int team_index = 0;
-                       FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, LAMBDA(
+                       FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, {
                                int target_team_number = Team_NumberToTeam(team_index + 1);
                                if (it.team != target_team_number) MoveToTeam(it, target_team_number, 6);
                                team_index = (team_index + 1) % number_of_teams;
-                       ));
+                       });
 
                        bprint("Successfully shuffled the players around randomly.\n");
                        return;
@@ -1731,32 +1733,32 @@ SERVER_COMMAND(warp, "Choose different level in campaign") { GameCommand_warp(re
 
 void GameCommand_macro_help()
 {
-       FOREACH(SERVER_COMMANDS, true, LAMBDA(LOG_INFOF("  ^2%s^7: %s\n", it.m_name, it.m_description)));
+       FOREACH(SERVER_COMMANDS, true, { LOG_INFOF("  ^2%s^7: %s\n", it.m_name, it.m_description); });
 }
 
 float GameCommand_macro_command(float argc, string command)
 {
        string c = strtolower(argv(0));
-       FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+       FOREACH(SERVER_COMMANDS, it.m_name == c, {
                it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
                return true;
-       ));
+       });
        return false;
 }
 
 float GameCommand_macro_usage(float argc)
 {
        string c = strtolower(argv(1));
-       FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+       FOREACH(SERVER_COMMANDS, it.m_name == c, {
                it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
                return true;
-       ));
+       });
        return false;
 }
 
 void GameCommand_macro_write_aliases(float fh)
 {
-       FOREACH(SERVER_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description)));
+       FOREACH(SERVER_COMMANDS, true, { CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description); });
 }
 
 
index 5f96334ddfd3141ff0208fbd6bb343f5f2e6724d..ed17ed0b8c89b083436b650983f6deaac3d9612f 100644 (file)
@@ -1,4 +1,8 @@
 #include "vote.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 #include "vote.qh"
 
@@ -119,7 +123,7 @@ string OriginalCallerName()
 
 void VoteReset()
 {
-       FOREACH_CLIENT(true, LAMBDA(it.vote_selection = 0));
+       FOREACH_CLIENT(true, { it.vote_selection = 0; });
 
        if (vote_called)
        {
@@ -214,7 +218,7 @@ void VoteCount(float first_count)
        Nagger_VoteCountChanged();
 
        // add up all the votes from each connected client
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), {
                ++vote_player_count;
                if (IS_PLAYER(it))   ++vote_real_player_count;
                switch (it.vote_selection)
@@ -233,7 +237,7 @@ void VoteCount(float first_count)
                        }
                        default: break;
                }
-       ));
+       });
 
        // Check to see if there are enough players on the server to allow master voting... otherwise, vote master could be used for evil.
        if ((vote_called == VOTE_MASTER) && autocvar_sv_vote_master_playerlimit > vote_player_count)
@@ -362,7 +366,7 @@ void reset_map(bool dorespawn)
                if (it.reset2) it.reset2(it);
        });
 
-       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(Unfreeze(it)));
+       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), { Unfreeze(it); });
 
        // Moving the player reset code here since the player-reset depends
        // on spawnpoint entities which have to be reset first --blub
@@ -422,11 +426,11 @@ void ReadyRestart_force()
        game_starttime = time + RESTART_COUNTDOWN;
 
        // clear player attributes
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                it.alivetime = 0;
                CS(it).killcount = 0;
                PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, -PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, 0));
-       ));
+       });
 
        restart_mapalreadyrestarted = false; // reset this var, needed when cvar sv_ready_restart_repeatable is in use
 
@@ -434,7 +438,7 @@ void ReadyRestart_force()
        warmup_stage = 0;                // once the game is restarted the game is in match stage
 
        // reset the .ready status of all players (also spectators)
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(it.ready = false));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), { it.ready = false; });
        readycount = 0;
        Nagger_ReadyCounted();  // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
 
@@ -456,7 +460,7 @@ void ReadyRestart_force()
        // after a restart every players number of allowed timeouts gets reset, too
        if (autocvar_sv_timeout)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(CS(it).allowed_timeouts = autocvar_sv_timeout_number));
+               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { CS(it).allowed_timeouts = autocvar_sv_timeout_number; });
        }
     // reset map immediately if this cvar is not set
     if (!autocvar_sv_ready_restart_after_countdown) reset_map(true);
@@ -480,10 +484,10 @@ void ReadyCount()
        float ready_needed_factor, ready_needed_count;
        float t_ready = 0, t_players = 0;
 
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_PLAYER(it) || it.caplayer == 1), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_PLAYER(it) || it.caplayer == 1), {
                ++t_players;
                if (it.ready) ++t_ready;
-       ));
+       });
 
        readycount = t_ready;
 
@@ -808,7 +812,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                                        msg_entity = caller;
                                }
 
-                               FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(++tmp_playercount));
+                               FOREACH_CLIENT(IS_REAL_CLIENT(it), { ++tmp_playercount; });
                                if (tmp_playercount > 1)   Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_VOTE_CALL);  // don't announce a "vote now" sound if player is alone
 
                                bprint("\{1}^2* ^3", OriginalCallerName(), "^2 calls a vote for ", vote_called_display, "\n");
index 539042d636038206f7c19b2cbcf77d5776bc09c9..126a0f6f6e7a98fc357917b8707f0c34ebf7dc8b 100644 (file)
@@ -1,5 +1,7 @@
 #include "quake.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
 spawnfunc(weapon_electro);
index 905523bfba33696632d096af7bbfb96efe4ba0d2..532428dd08893eb39a78c033b51850f43f3904dd 100644 (file)
@@ -1,5 +1,7 @@
 #include "quake3.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
 spawnfunc(weapon_crylink);
index f6b2f2621de31c1298fe5ab07604052bca63ccd7..6c69859fdfe0c6e748acc5b227227f49d5e9626c 100644 (file)
@@ -1,5 +1,7 @@
 #include "wop.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 // #include <server/mutators/gamemode.qh>
 
index 83911eeafec9aa0b5d16120444a74b465acefbb8..d96c28bf1adaac3df8328bbc05ef5db3c9f76b6b 100644 (file)
@@ -1,5 +1,6 @@
 #include "g_damage.qh"
 
+#include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "g_hook.qh"
 #include "mutators/_mod.qh"
@@ -1266,7 +1267,7 @@ void Fire_ApplyDamage(entity e)
 
        if(!IS_INDEPENDENT_PLAYER(e))
        if(!STAT(FROZEN, e))
-               FOREACH_CLIENT(IS_PLAYER(it) && it != e, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != e, {
                        if(!IS_DEAD(it))
                        if(!IS_INDEPENDENT_PLAYER(it))
                        if(boxesoverlap(e.absmin, e.absmax, it.absmin, it.absmax))
@@ -1275,7 +1276,7 @@ void Fire_ApplyDamage(entity e)
                                d = autocvar_g_balance_firetransfer_damage * e.fire_damagepersec * t;
                                Fire_AddDamage(it, o, d, t, DEATH_FIRE.m_id);
                        }
-               ));
+               });
 }
 
 void Fire_ApplyEffect(entity e)
index e242de4a8a2a43add28f4f008dab92e55f13186b..aee4a93df80da7cecde86899592331cd79b55777 100644 (file)
@@ -3,6 +3,8 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
+    #include <server/defs.qh>
+    #include <server/miscfunctions.qh>
     #include <lib/warpzone/common.qh>
     #include <common/constants.qh>
     #include <common/teams.qh>
index 2081b688dcb0f3d964bf3f1f374a80b2b993579d..0fc60b2cdc1ffef3f4a2bac6832822e2a0c91db3 100644 (file)
@@ -1,5 +1,8 @@
 #include "g_hook.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
 #include "weapons/common.qh"
 #include "weapons/csqcprojectile.qh"
 #include "weapons/weaponsystem.qh"
index 425716d2da7cb92dc3001d2383947b7a4eab86dd..852f1efc01d70cda4a73a3d903a67c20a67e1601 100644 (file)
@@ -1,5 +1,8 @@
 #include "g_lights.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 void train_next(entity this);
 
 const float LOOP = 1;
index d3f56f5f04424f55b9eb77c3a40fc92422ea7175..539522f2dce7f61ca49d840f6040439450916e8c 100644 (file)
@@ -1,5 +1,7 @@
 #include "g_models.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "g_subs.qh"
 #include <common/net_linked.qh>
 #include "../common/triggers/subs.qh"
index 33f471eb488cf97cde02e41d86e6390c03e6a7c0..8c39f88c9480507ab63f6cd4a5815d3db248d1d9 100644 (file)
@@ -1,5 +1,7 @@
 #include "g_subs.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "antilag.qh"
 #include "command/common.qh"
 #include "../common/state.qh"
index 73a5b8a88b983359954eb7e032c6cf206dcb97d5..f00db073e47e1b805fd1bf5ac90a85cffb2e5a3a 100644 (file)
@@ -253,6 +253,8 @@ void cvar_changes_init()
                // these can contain player IDs, so better hide
                BADPREFIX("g_forced_team_");
                BADCVAR("sv_muteban_list");
+               BADCVAR("sv_allow_customplayermodels_idlist");
+               BADCVAR("sv_allow_customplayermodels_speciallist");
 
                // mapinfo
                BADCVAR("fraglimit");
@@ -1457,7 +1459,7 @@ void DumpStats(float final)
        if(to_file)
                fputs(file, strcat(s, "\n"));
 
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), {
                s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":");
                s = strcat(s, ftos(rint(time - CS(it).jointime)), ":");
                if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
@@ -1471,7 +1473,7 @@ void DumpStats(float final)
                        GameLogEcho(strcat(s, ftos(it.playerid), ":", playername(it, false)));
                if(to_file)
                        fputs(file, strcat(s, playername(it, false), "\n"));
-       ));
+       });
 
        if(teamplay)
        {
@@ -1528,9 +1530,9 @@ void FixIntermissionClient(entity e)
                {
                        stuffcmd(e, "\nscr_printspeed 1000000\n");
                        RandomSelection_Init();
-                       FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA(
+                       FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, {
                                RandomSelection_AddString(it, 1, 1);
-                       ));
+                       });
                        if (RandomSelection_chosen_string != "")
                        {
                                stuffcmd(e, sprintf("\ncd loop %s\n", RandomSelection_chosen_string));
@@ -1580,11 +1582,11 @@ void NextLevel()
 
        GameLogClose();
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                FixIntermissionClient(it);
                if(it.winning)
                        bprint(playername(it, false), " ^7wins.\n");
-       ));
+       });
 
        target_music_kill();
 
@@ -1658,22 +1660,22 @@ float GetWinningCode(float fraglimitreached, float equality)
 // set the .winning flag for exactly those players with a given field value
 void SetWinners(.float field, float value)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = (it.(field) == value)));
+       FOREACH_CLIENT(IS_PLAYER(it), { it.winning = (it.(field) == value); });
 }
 
 // set the .winning flag for those players with a given field value
 void AddWinners(.float field, float value)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                if(it.(field) == value)
                        it.winning = 1;
-       ));
+       });
 }
 
 // clear the .winning flags
 void ClearWinners()
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = 0));
+       FOREACH_CLIENT(IS_PLAYER(it), { it.winning = 0; });
 }
 
 void ShuffleMaplist()
@@ -1766,7 +1768,7 @@ float WinningCondition_RanOutOfSpawns()
 
        team1_score = team2_score = team3_score = team4_score = 0;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
                switch(it.team)
                {
                        case NUM_TEAM_1: team1_score = 1; break;
@@ -1774,7 +1776,7 @@ float WinningCondition_RanOutOfSpawns()
                        case NUM_TEAM_3: team3_score = 1; break;
                        case NUM_TEAM_4: team4_score = 1; break;
                }
-       ));
+       });
 
        IL_EACH(g_spawnpoints, true,
        {
@@ -1900,13 +1902,13 @@ void CheckRules_World()
                                float playerswithlaps;
                                float readyplayers;
                                totalplayers = playerswithlaps = readyplayers = 0;
-                               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+                               FOREACH_CLIENT(IS_PLAYER(it), {
                                        ++totalplayers;
                                        if(PlayerScore_Add(it, SP_RACE_FASTEST, 0))
                                                ++playerswithlaps;
                                        if(it.ready)
                                                ++readyplayers;
-                               ));
+                               });
 
                                // at least 2 of the players have completed a lap: start the RACE
                                // otherwise, the players should end the qualifying on their own
@@ -2126,7 +2128,7 @@ float RedirectionThink()
        redirection_nextthink = time + 1;
 
        clients_found = 0;
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                // TODO add timer
                LOG_INFO("Redirecting: sending connect command to ", it.netname, "\n");
                if(redirection_target == "self")
@@ -2134,7 +2136,7 @@ float RedirectionThink()
                else
                        stuffcmd(it, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n"));
                ++clients_found;
-       ));
+       });
 
        LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.\n");
 
index 50c258f927a8295766d6317d92b6dc138ef2d35d..6211362ac67f815d25c153880dac6f43eb07b6fd 100644 (file)
@@ -1,5 +1,7 @@
 #include "ipban.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "autocvars.qh"
 #include "command/banning.qh"
 #include "defs.qh"
index d22073ef6c5d02e25e50263a0ac643c085372aee..209ac7af98085daf7bdffed0fc335eacba721141 100644 (file)
@@ -1,5 +1,7 @@
 #include "mapvoting.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "g_world.qh"
 #include "command/cmd.qh"
 #include "command/getreplies.qh"
@@ -100,7 +102,7 @@ string GameTypeVote_MapInfo_FixName(string m)
 
 void MapVote_ClearAllVotes()
 {
-       FOREACH_CLIENT(true, LAMBDA(it.mapvote = 0));
+       FOREACH_CLIENT(true, { it.mapvote = 0; });
 }
 
 void MapVote_UnzoneStrings()
@@ -454,7 +456,7 @@ bool MapVote_Finished(int mappos)
                        GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]));
        }
 
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(FixClientCvars(it)));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), { FixClientCvars(it); });
 
        if(gametypevote)
        {
@@ -595,7 +597,7 @@ void MapVote_Tick()
                return;
 
        int totalvotes = 0;
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                // hide scoreboard again
                if(it.health != 2342)
                {
@@ -621,7 +623,7 @@ void MapVote_Tick()
 
                if(it.mapvote)
                        ++totalvotes;
-       ));
+       });
 
        MapVote_CheckRules_1(); // just count
 }
index a1e85305427509df78c64c71fda09afbe4ebf094..ffc0e9ea568cbd65278a5f050a6f8d1babd91404 100644 (file)
@@ -1,4 +1,5 @@
 #include "miscfunctions.qh"
+
 #include "antilag.qh"
 #include "command/common.qh"
 #include "constants.qh"
@@ -463,7 +464,7 @@ string playername(entity p, bool team_colorize)
         return strcat(t, strdecolorize(p.netname));
     }
     else
-        return ColorTranslateRGB(p.netname);
+        return p.netname;
 }
 
 float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
@@ -547,10 +548,10 @@ void readplayerstartcvars()
        {
                g_weaponarena = 1;
                g_weaponarena_list = "All Weapons";
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
                                g_weaponarena_weapons |= (it.m_wepset);
-               ));
+               });
        }
        else if (s == "devall")
        {
@@ -565,11 +566,11 @@ void readplayerstartcvars()
        {
                g_weaponarena = 1;
                g_weaponarena_list = "Most Weapons";
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
                                if(it.spawnflags & WEP_FLAG_NORMAL)
                                        g_weaponarena_weapons |= (it.m_wepset);
-               ));
+               });
        }
        else if (s == "none")
        {
@@ -584,14 +585,14 @@ void readplayerstartcvars()
                for (i = 0; i < t; ++i)
                {
                        s = argv(i);
-                       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       FOREACH(Weapons, it != WEP_Null, {
                                if(it.netname == s)
                                {
                                        g_weaponarena_weapons |= (it.m_wepset);
                                        g_weaponarena_list = strcat(g_weaponarena_list, it.m_name, " & ");
                                        break;
                                }
-                       ));
+                       });
                }
                g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
        }
@@ -610,7 +611,7 @@ void readplayerstartcvars()
        }
        else
        {
-               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               FOREACH(Weapons, it != WEP_Null, {
                        int w = want_weapon(it, false);
                        WepSet s = it.m_wepset;
                        if(w & 1)
@@ -619,7 +620,7 @@ void readplayerstartcvars()
                                start_weapons_default |= s;
                        if(w & 4)
                                start_weapons_defaultmask |= s;
-               ));
+               });
        }
 
        if(!cvar("g_use_ammunition"))
@@ -671,7 +672,7 @@ void readplayerstartcvars()
                        warmup_start_weapons = '0 0 0';
                        warmup_start_weapons_default = '0 0 0';
                        warmup_start_weapons_defaultmask = '0 0 0';
-                       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       FOREACH(Weapons, it != WEP_Null, {
                                int w = want_weapon(it, g_warmup_allguns);
                                WepSet s = (it.m_wepset);
                                if(w & 1)
@@ -680,7 +681,7 @@ void readplayerstartcvars()
                                        warmup_start_weapons_default |= s;
                                if(w & 4)
                                        warmup_start_weapons_defaultmask |= s;
-                       ));
+                       });
                }
        }
 
@@ -699,10 +700,10 @@ void readplayerstartcvars()
        WepSet precache_weapons = start_weapons;
        if (g_warmup_allguns != 1)
                precache_weapons |= warmup_start_weapons;
-       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+       FOREACH(Weapons, it != WEP_Null, {
                if(precache_weapons & (it.m_wepset))
                        it.wr_init(it);
-       ));
+       });
 
        start_ammo_shells = max(0, start_ammo_shells);
        start_ammo_nails = max(0, start_ammo_nails);
@@ -763,7 +764,7 @@ void precache_all_playermodels(string pattern)
 
 void precache_playermodels(string s)
 {
-       FOREACH_WORD(s, true, LAMBDA(precache_playermodel(it)));
+       FOREACH_WORD(s, true, { precache_playermodel(it); });
 }
 
 void precache()
index c5f846b162590f19ba39031bc4a27363cf753ad9..abe8cd74a6c78c5aac70029d0acf971ce6e590a0 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <server/defs.qh>
+
 #include <common/t_items.qh>
 
 #include "mutators/events.qh"
@@ -306,7 +308,7 @@ void readlevelcvars()
        if (!warmup_stage)
                game_starttime = time + cvar("g_start_delay");
 
-       FOREACH(Weapons, it != WEP_Null, LAMBDA(it.wr_init(it)));
+       FOREACH(Weapons, it != WEP_Null, { it.wr_init(it); });
 
        readplayerstartcvars();
 }
index 84094df6bdf3a684ee64303c9d444310e4da5f23..ac8746516ca516b0552d56f6a26a1f2eea633cdb 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <server/miscfunctions.qh>
 #include <server/g_world.qh>
 #include <server/round_handler.qh>
 #include <server/scores.qh>
index 1784e72ecdeecc42e1e1f2052524fb68907ecc92..7c20b372906b842661b3abfa2e577a88448af81f 100644 (file)
@@ -1,11 +1,14 @@
 #include "loader.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 STATIC_INIT_LATE(Gametype) {
     Gametype g = MapInfo_CurrentGametype();
     if (g) {
         for (string _s = g.m_mutators; _s != ""; _s = cdr(_s)) {
             string s = car(_s);
-            FOREACH(Mutators, it.m_name == s, LAMBDA(Mutator_Add(it); break));
+            FOREACH(Mutators, it.m_name == s, { Mutator_Add(it); break; });
         }
     }
 }
index 350dc5d68f6b13f3ddc1fbc72d6ffe7ae3ea297d..85801af52a8fc900db8fcff339c2b6b153c5226d 100644 (file)
@@ -65,7 +65,7 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
                        this.enemy.health = -1;
 
                        if(this.enemy.message)
-                               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, this.enemy.message)));
+                               FOREACH_CLIENT(IS_PLAYER(it), { centerprint(it, this.enemy.message); });
 
                        SUB_UseTargets(this.enemy, this, trigger);
                }
index e46b22de22c8f2c8536bfcf423d9b75a9c625794..ca402f7f16fd0da9cfad47e0bb3de599998a84a4 100644 (file)
@@ -6,7 +6,7 @@ bool autocvar_g_ca_spectate_enemies;
 void CA_count_alive_players()
 {
        total_players = redalive = bluealive = yellowalive = pinkalive = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                switch(it.team)
                {
                        case NUM_TEAM_1: ++total_players; if(!IS_DEAD(it)) ++redalive; break;
@@ -14,13 +14,13 @@ void CA_count_alive_players()
                        case NUM_TEAM_3: ++total_players; if(!IS_DEAD(it)) ++yellowalive; break;
                        case NUM_TEAM_4: ++total_players; if(!IS_DEAD(it)) ++pinkalive; break;
                }
-       ));
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       });
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                it.redalive_stat = redalive;
                it.bluealive_stat = bluealive;
                it.yellowalive_stat = yellowalive;
                it.pinkalive_stat = pinkalive;
-       ));
+       });
 }
 
 float CA_GetWinnerTeam()
@@ -58,7 +58,7 @@ float CA_CheckWinner()
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it)));
+               FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); });
 
                allowed_to_spawn = false;
                game_stopped = true;
@@ -87,7 +87,7 @@ float CA_CheckWinner()
        game_stopped = true;
        round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it)));
+       FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); });
 
        return 1;
 }
index 253a07e722275646c5bdcb603a277b3018646921..c1698c554a0161e4e5a52523c60a0d74c425d689 100644 (file)
@@ -1,6 +1,7 @@
 #include "gamemode_ctf.qh"
 
 #ifndef CSQC
+#include <common/effects/all.qh>
 void ctf_Initialize();
 
 REGISTER_MUTATOR(ctf, false)
@@ -139,11 +140,11 @@ void ctf_CaptureRecord(entity flag, entity player)
        if(ctf_oneflag)
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CTF_CAPTURE_NEUTRAL, player.netname);
        else if(!ctf_captimerecord)
-               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_TIME), player.netname, (cap_time * 100));
+               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_TIME), player.netname, TIME_ENCODE(cap_time));
        else if(cap_time < cap_record)
-               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_BROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100));
+               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_BROKEN), player.netname, refername, TIME_ENCODE(cap_time), TIME_ENCODE(cap_record));
        else
-               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_UNBROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100));
+               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_UNBROKEN), player.netname, refername, TIME_ENCODE(cap_time), TIME_ENCODE(cap_record));
 
        // write that shit in the database
        if(!ctf_oneflag) // but not in 1-flag mode
@@ -152,7 +153,7 @@ void ctf_CaptureRecord(entity flag, entity player)
                ctf_captimerecord = cap_time;
                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(cap_time));
                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), player.netname);
-               write_recordmarker(player, (time - cap_time), cap_time);
+               write_recordmarker(player, flag.ctf_pickuptime, cap_time);
        }
 
        if(autocvar_g_ctf_leaderboard && !ctf_oneflag)
@@ -288,7 +289,7 @@ bool ctf_CaptureShield_CheckStatus(entity p)
                return false;
 
        players_total = players_worseeq = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                if(DIFF_TEAM(it, p))
                        continue;
                se  = PlayerScore_Add(it, SP_CTF_CAPS,    0);
@@ -301,7 +302,7 @@ bool ctf_CaptureShield_CheckStatus(entity p)
                if(ser <= sr)
                        ++players_worseeq;
                ++players_total;
-       ));
+       });
 
        // player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse
        // use this rule here
@@ -441,14 +442,14 @@ void ctf_Handle_Retrieve(entity flag, entity player)
        _sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM);
        ctf_EventLog("receive", flag.team, player);
 
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                if(it == sender)
                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_SENT), player.netname);
                else if(it == player)
                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_RECEIVED), sender.netname);
                else if(SAME_TEAM(it, sender))
                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_OTHER), sender.netname, player.netname);
-       ));
+       });
 
        // create new waypoint
        ctf_FlagcarrierWaypoints(player);
@@ -720,16 +721,16 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
 
        if(!flag.team)
-               FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname)));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), { Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname); });
 
        if(flag.team)
-               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
                        if(CTF_SAMETEAM(flag, it))
                        if(SAME_TEAM(player, it))
                                Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
                        else
                                Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
-               ));
+               });
 
        _sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
 
@@ -795,7 +796,7 @@ void ctf_CheckFlagReturn(entity flag, int returntype)
                                case RETURN_DAMAGE:
                                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_DAMAGED)); break;
                                case RETURN_SPEEDRUN:
-                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_SPEEDRUN), ctf_captimerecord); break;
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_SPEEDRUN), TIME_ENCODE(ctf_captimerecord)); break;
                                case RETURN_NEEDKILL:
                                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_NEEDKILL)); break;
                                default:
@@ -881,7 +882,7 @@ void ctf_CheckStalemate()
 
                if (!wpforenemy_announced)
                {
-                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER))));
+                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER)); });
 
                        wpforenemy_announced = true;
                }
@@ -919,7 +920,7 @@ void ctf_FlagThink(entity this)
 
        // captureshield
        if(this == ctf_worldflaglist) // only for the first flag
-               FOREACH_CLIENT(true, LAMBDA(ctf_CaptureShield_Update(it, 1))); // release shield only
+               FOREACH_CLIENT(true, { ctf_CaptureShield_Update(it, 1); }); // release shield only
 
        // sanity checks
        if(this.mins != this.m_mins || this.maxs != this.m_maxs) { // reset the flag boundaries in case it got squished
@@ -1458,13 +1459,13 @@ int havocbot_ctf_teamcount(entity bot, vector org, float tc_radius)
 
        int c = 0;
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                if(DIFF_TEAM(it, bot) || IS_DEAD(it) || it == bot)
                        continue;
 
                if(vdist(it.origin - org, <, tc_radius))
                        ++c;
-       ));
+       });
 
        return c;
 }
@@ -1643,7 +1644,7 @@ void havocbot_ctf_reset_role(entity this)
 
        // if there is only me on the team switch to offense
        c = 0;
-       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), LAMBDA(++c));
+       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), { ++c; });
 
        if(c==1)
        {
@@ -1998,14 +1999,14 @@ void havocbot_role_ctf_defense(entity this)
                // if enemies are closer to our base, go there
                entity closestplayer = NULL;
                float distance, bestdistance = 10000;
-               FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
                        distance = vlen(org - it.origin);
                        if(distance<bestdistance)
                        {
                                closestplayer = it;
                                bestdistance = distance;
                        }
-               ));
+               });
 
                if(closestplayer)
                if(DIFF_TEAM(closestplayer, this))
@@ -2525,7 +2526,7 @@ MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand)
                        }
                }
 
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        if(it.flagcarried && (it.team == _team || _team == 0))
                        {
                                found = true;
@@ -2533,7 +2534,7 @@ MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand)
                                        continue; // already spectating this fc, try another
                                return superspec_Spectate(player, it);
                        }
-               ));
+               });
 
                if(!found)
                        superspec_msg("", "", player, "No active flag carrier\n", 1);
index 8e7512eb6965d42a7e7e4b88bea02bfcd690189d..96c1462cb72fb2951698067b7695791f2c3d80ac 100644 (file)
@@ -146,7 +146,7 @@ MUTATOR_HOOKFUNCTION(cts, reset_map_global)
        race_ClearRecords();
        PlayerScore_Sort(race_place, 0, 1, 0);
 
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                if(it.race_place)
                {
                        s = PlayerScore_Add(it, SP_RACE_FASTEST, 0);
@@ -154,7 +154,7 @@ MUTATOR_HOOKFUNCTION(cts, reset_map_global)
                                it.race_place = 0;
                }
                cts_EventLog(ftos(it.race_place), it);
-       ));
+       });
 
        if(g_race_qualifying == 2)
        {
index cffb60cb122f51a7eb0ddb22a36c3c3e1bea742c..7c645e4d39e1596d2c21ef22368cfe93e3a5515f 100644 (file)
@@ -124,7 +124,7 @@ void dompoint_captured(entity this)
 
        this.captime = time;
 
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(set_dom_state(it)));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), { set_dom_state(it); });
 }
 
 void AnimateDomPoint(entity this)
@@ -380,7 +380,7 @@ float Domination_CheckPlayers()
 
 void Domination_RoundStart()
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.player_blocked = false));
+       FOREACH_CLIENT(IS_PLAYER(it), { it.player_blocked = false; });
 }
 
 //go to best items, or control points you don't own
@@ -445,13 +445,13 @@ MUTATOR_HOOKFUNCTION(dom, CheckAllowedTeams)
 MUTATOR_HOOKFUNCTION(dom, reset_map_players)
 {
        total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                PutClientInServer(it);
                if(domination_roundbased)
                        it.player_blocked = 1;
                if(IS_REAL_CLIENT(it))
                        set_dom_state(it);
-       ));
+       });
        return true;
 }
 
index 811614c21b9d5771f89b91db197f0742a8de7c27..9e9878c3620b6230d9b72f31dfccd4232e1a7268 100644 (file)
@@ -17,7 +17,7 @@ void freezetag_ScoreRules(int teams)
 void freezetag_count_alive_players()
 {
        total_players = redalive = bluealive = yellowalive = pinkalive = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                switch(it.team)
                {
                        case NUM_TEAM_1: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++redalive; break;
@@ -25,13 +25,13 @@ void freezetag_count_alive_players()
                        case NUM_TEAM_3: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++yellowalive; break;
                        case NUM_TEAM_4: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++pinkalive; break;
                }
-       ));
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       });
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                it.redalive_stat = redalive;
                it.bluealive_stat = bluealive;
                it.yellowalive_stat = yellowalive;
                it.pinkalive_stat = pinkalive;
-       ));
+       });
 
        eliminatedPlayers.SendFlags |= 1;
 }
@@ -106,10 +106,10 @@ float freezetag_CheckWinner()
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        it.freezetag_frozen_timeout = 0;
                        nades_Clear(it);
-               ));
+               });
                game_stopped = true;
                round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
                return 1;
@@ -131,10 +131,10 @@ float freezetag_CheckWinner()
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED);
        }
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                it.freezetag_frozen_timeout = 0;
                nades_Clear(it);
-       ));
+       });
 
        game_stopped = true;
        round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
@@ -144,7 +144,7 @@ float freezetag_CheckWinner()
 entity freezetag_LastPlayerForTeam(entity this)
 {
        entity last_pl = NULL;
-       FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
                if(it.health >= 1)
                if(!STAT(FROZEN, it))
                if(SAME_TEAM(it, this))
@@ -152,7 +152,7 @@ entity freezetag_LastPlayerForTeam(entity this)
                        last_pl = it;
                else
                        return NULL;
-       ));
+       });
        return last_pl;
 }
 
@@ -226,7 +226,7 @@ void(entity this) havocbot_role_ft_offense;
 void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org, float sradius)
 {
        float t;
-       FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
                if (STAT(FROZEN, it) == 1)
                {
                        if(vdist(it.origin - org, >, sradius))
@@ -240,7 +240,7 @@ void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org,
                        t = 0.2 * 150 / (this.health + this.armorvalue);
                        navigation_routerating(this, it, t * ratingscale, 2000);
                }
-       ));
+       });
 }
 
 void havocbot_role_ft_offense(entity this)
@@ -253,7 +253,7 @@ void havocbot_role_ft_offense(entity this)
 
        // Count how many players on team are unfrozen.
        int unfrozen = 0;
-       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++));
+       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), { unfrozen++; });
 
        // If only one left on team or if role has timed out then start trying to free players.
        if (((unfrozen == 0) && (!STAT(FROZEN, this))) || (time > this.havocbot_role_timeout))
@@ -416,12 +416,12 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(ft, reset_map_players)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                CS(it).killcount = 0;
                it.freezetag_frozen_timeout = -1;
                PutClientInServer(it);
                it.freezetag_frozen_timeout = 0;
-       ));
+       });
        freezetag_count_alive_players();
        return true;
 }
@@ -454,7 +454,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
                        if(STAT(FROZEN, it) == 0)
                        if(!IS_DEAD(it))
                        if(SAME_TEAM(it, player))
@@ -466,7 +466,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
                                        it.reviving = true;
                                ++n;
                        }
-               ));
+               });
 
        }
 
@@ -488,21 +488,21 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
                        }
 
                        // EVERY team mate nearby gets a point (even if multiple!)
-                       FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
+                       FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
                                PlayerScore_Add(it, SP_FREEZETAG_REVIVALS, +1);
                                PlayerScore_Add(it, SP_SCORE, +1);
                                nades_GiveBonus(it,autocvar_g_nades_bonus_score_low);
-                       ));
+                       });
 
                        Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
                        Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED, player.netname, o.netname);
                }
 
-               FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
                        it.revive_progress = player.revive_progress;
                        it.reviving = false;
-               ));
+               });
        }
        else if(!n && STAT(FROZEN, player) == 1) // only if no teammate is nearby will we reset
        {
index 05a89c75df6e23a2ce7d3e059a1bb637bfc4efcc..fabcc26f62cb26bef62edda59104324330421a82 100644 (file)
@@ -252,14 +252,14 @@ bool Invasion_CheckWinner()
        }
        else
        {
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        float cs = PlayerScore_Add(it, SP_KILLS, 0);
                        if(cs > winning_score)
                        {
                                winning_score = cs;
                                winner = it;
                        }
-               ));
+               });
        }
 
        IL_EACH(g_monsters, true,
@@ -295,10 +295,10 @@ bool Invasion_CheckPlayers()
 void Invasion_RoundStart()
 {
        int numplayers = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                it.player_blocked = false;
                ++numplayers;
-       ));
+       });
 
        if(inv_roundcnt < inv_maxrounds)
                inv_roundcnt += 1; // a limiter to stop crazy counts
index 0b4bd54aaa21c554d4fbaf8b0800e683a3c8c0f2..c28fd5eb8e7eab4f30378ad5fdaeccc2b84dc909 100644 (file)
@@ -1,5 +1,7 @@
 #include "gamemode_keepaway.qh"
 
+#include <common/effects/all.qh>
+
 int autocvar_g_keepaway_ballcarrier_effects;
 float autocvar_g_keepaway_ballcarrier_damage;
 float autocvar_g_keepaway_ballcarrier_force;
index 52daeb796393f6a8ff96ee493c36be5449b62828..d32df0f59058cde75fa8e55f132914ecb210b539 100644 (file)
@@ -133,7 +133,7 @@ void kh_update_state()
                s |= (32 ** key.count) * f;
        }
 
-       FOREACH_CLIENT(true, LAMBDA(it.kh_state = s));
+       FOREACH_CLIENT(true, { it.kh_state = s; });
 
        FOR_EACH_KH_KEY(key)
        {
@@ -394,9 +394,9 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
                        {
                                if (!k.owner) continue;
                                entity first = WP_Null;
-                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break));
+                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
                                entity third = WP_Null;
-                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break));
+                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
                                WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFinish, third);
                        }
                }
@@ -409,9 +409,9 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
                        {
                                if (!k.owner) continue;
                                entity first = WP_Null;
-                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break));
+                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
                                entity third = WP_Null;
-                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break));
+                               FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
                                WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFriend, third);
                        }
                }
@@ -601,7 +601,7 @@ void kh_LoserTeam(int loser_team, entity lostkey)  // runs when a player pushes
                int players = 0;
                float of = autocvar_g_balance_keyhunt_score_destroyed_ownfactor;
 
-               FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, LAMBDA(++players));
+               FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, { ++players; });
 
                entity key;
                int keys = 0;
@@ -636,16 +636,16 @@ void kh_LoserTeam(int loser_team, entity lostkey)  // runs when a player pushes
                                continue;
 
                        players = 0;
-                       FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(++players));
+                       FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, { ++players; });
 
                        DistributeEvenly_Init(fragsleft, j);
                        fragsleft = DistributeEvenly_Get(j - 1);
                        DistributeEvenly_Init(DistributeEvenly_Get(1), players);
 
-                       FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(
+                       FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, {
                                f = DistributeEvenly_Get(1);
                                kh_Scores_Event(it, NULL, "destroyed", f, 0);
-                       ));
+                       });
 
                        --j;
                }
@@ -703,7 +703,7 @@ LABEL(not_winning)
        if(kh_interferemsg_time && time > kh_interferemsg_time)
        {
                kh_interferemsg_time = 0;
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        if(it.team == kh_interferemsg_team)
                                if(it.kh_next)
                                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
@@ -711,7 +711,7 @@ LABEL(not_winning)
                                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
                        else
                                Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
-               ));
+               });
        }
 
        this.nextthink = time + 0.05;
@@ -858,10 +858,10 @@ int kh_GetMissingTeams()
        {
                int teem = kh_Team_ByID(i);
                int players = 0;
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
                                ++players;
-               ));
+               });
                if (!players)
                        missing_teams |= (2 ** i);
        }
@@ -939,14 +939,14 @@ void kh_StartRound()  // runs at the start of each round
                int teem = kh_Team_ByID(i);
                int players = 0;
                entity my_player = NULL;
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
                        {
                                ++players;
                                if(random() * players <= 1)
                                        my_player = it;
                        }
-               ));
+               });
                kh_Key_Spawn(my_player, 360 * i / NumTeams(kh_teams), i);
        }
 
index fbe6b0c1da9c5d60e3703522c3c73157aa84d834..158492cd3bc58c22e9cca7138aa13e3ea81c37b9 100644 (file)
@@ -367,10 +367,10 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch)
 
 MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
 {
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                ++M_ARGV(0, int); // activerealplayers
                ++M_ARGV(1, int); // realplayers
-       ));
+       });
 
        return true;
 }
index b1759fb6a62c2b2daafa47aed9532838ddd5d4bd..c51afbf169dba4bdae0cf3878dfc317067914642 100644 (file)
@@ -71,11 +71,11 @@ float WinningCondition_Race(float fraglimit)
 
        n = 0;
        c = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                ++n;
                if(CS(it).race_completed)
                        ++c;
-       ));
+       });
        if(n && (n == c))
                return WINNING_YES;
        wc = WinningCondition_Scores(fraglimit, 0);
@@ -198,7 +198,7 @@ MUTATOR_HOOKFUNCTION(rc, reset_map_global)
        race_ClearRecords();
        PlayerScore_Sort(race_place, 0, 1, 0);
 
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                if(it.race_place)
                {
                        s = PlayerScore_Add(it, SP_RACE_FASTEST, 0);
@@ -206,7 +206,7 @@ MUTATOR_HOOKFUNCTION(rc, reset_map_global)
                                it.race_place = 0;
                }
                race_EventLog(ftos(it.race_place), it);
-       ));
+       });
 
        if(g_race_qualifying == 2)
        {
index 706e10d9e249135e73764dcda180f4f0ac8519f3..c2f33260302c7899dbba85212c3df2eeece69172 100644 (file)
@@ -1,5 +1,7 @@
 #include "main.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 #include "utility.qh"
 #include "../command/common.qh"
index f27ab4879dad2dedeea575b1146248ae291ca4c9..cbcfe3d4c6038f07c00abb44047019d6988748a3 100644 (file)
@@ -1,5 +1,7 @@
 #include "movenode.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 #include "utility.qh"
 
index da64db697345b9a2cd70f0ef100ef6ff6409661b..151fb44b56abec6096379d63b351b42a315e7d9a 100644 (file)
@@ -1,5 +1,7 @@
 #include "utility.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 
 bool location_isok(vector point, bool waterok, bool air_isok)
index 4e8663d24af0a5aaf8b6b3f574fdd9acd9dab8d8..827c86ae47ccda1a6c8acfae6e8809ee75f57728 100644 (file)
@@ -1,5 +1,6 @@
 #include "player.qh"
 
+#include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "cheats.qh"
 #include "g_damage.qh"
@@ -235,10 +236,10 @@ void calculate_player_respawn_time(entity this)
        float pcount = 1;  // Include myself whether or not team is already set right and I'm a "player".
        if (teamplay)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
                        if(it.team == this.team)
                                ++pcount;
-               ));
+               });
                if (sdelay_small_count == 0)
                        sdelay_small_count = 1;
                if (sdelay_large_count == 0)
@@ -246,9 +247,9 @@ void calculate_player_respawn_time(entity this)
        }
        else
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
                        ++pcount;
-               ));
+               });
                if (sdelay_small_count == 0)
                {
                        if (IS_INDEPENDENT_PLAYER(this))
index 99125a1a30c502d58e736cefbdfb59033d02a05a..6de3e0af39fc0e16840ae692f4b13548ca83b755 100644 (file)
@@ -1,5 +1,6 @@
 #include "portals.qh"
 
+#include <common/effects/all.qh>
 #include "g_hook.qh"
 #include "mutators/_mod.qh"
 #include "../common/constants.qh"
@@ -473,7 +474,7 @@ void Portal_Think(entity this)
 
        fixedmakevectors(this.mangle);
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                if(it != o)
                        if(IS_INDEPENDENT_PLAYER(it) || IS_INDEPENDENT_PLAYER(o))
                                continue; // cannot go through someone else's portal
@@ -487,7 +488,7 @@ void Portal_Think(entity this)
                if(it.(weaponentity).hook)
                        Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g);
            }
-       ));
+       });
        this.solid = SOLID_TRIGGER;
        this.aiment = o;
 #endif
index 1a8ada45fe306f9156bf74e789acf51de830f1bf..f72ff8533f57555adc4e0a49526f59ab07b8b463 100644 (file)
@@ -1,7 +1,18 @@
 #include <lib/_all.inc>
 
 #if XONOTIC
-#include <server/_all.inc>
+
+#include <server/_mod.inc>
+
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
+
+#include <lib/csqcmodel/sv_model.qc>
+
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
 
 #include <ecs/_mod.inc>
 #endif
index 03c4fa828c9e2732b61c0d301516878fd2f446ab..7f2aaaaf58739f8d040460df84e6667340cf93ff 100644 (file)
@@ -1,5 +1,7 @@
 #include "race.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "client.qh"
 #include "portals.qh"
 #include "scores.qh"
@@ -443,7 +445,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                                                strunzone(race_checkpoint_recordholders[cp]);
                                        race_checkpoint_recordholders[cp] = strzone(e.netname);
                                        if(g_race_qualifying)
-                                               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, LAMBDA(race_SendNextCheckpoint(it, 0)));
+                                               FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); });
                                }
 
                        }
@@ -812,8 +814,10 @@ void trigger_race_checkpoint_verify(entity this)
 
        g_race_qualifying = qual;
 
-       IL_EACH(g_race_targets, true,
+       IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer",
        {
+               if(it.targetname == "" || !it.targetname) // somehow this is a case...
+                       continue;
                entity cpt = it;
                FOREACH_ENTITY_STRING(target, cpt.targetname,
                {
@@ -830,12 +834,15 @@ void trigger_race_checkpoint_verify(entity this)
 
        if (race_timed_checkpoint) {
                if (defrag_ents) {
-                       IL_EACH(g_race_targets, true,
+                       IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer",
                        {
                                entity cpt = it;
                                if(it.classname == "target_startTimer" || it.classname == "target_stopTimer") {
+                                       if(it.targetname == "" || !it.targetname) // somehow this is a case...
+                                               continue;
                                        FOREACH_ENTITY_STRING(target, cpt.targetname, {
-                                               WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null);
+                                               if(it.sprite)
+                                                       WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null);
                                        });
                                }
                                if(it.classname == "target_checkpoint") {
@@ -1043,7 +1050,7 @@ void race_AbandonRaceCheck(entity p)
 void race_StartCompleting()
 {
        race_completing = 1;
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), LAMBDA(race_AbandonRaceCheck(it)));
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), { race_AbandonRaceCheck(it); });
 }
 
 void race_PreparePlayer(entity this)
@@ -1086,11 +1093,11 @@ void race_ClearRecords()
                race_checkpoint_recordholders[j] = string_null;
        }
 
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                float p = it.race_place;
                race_PreparePlayer(it);
                it.race_place = p;
-       ));
+       });
 }
 
 void race_ImposePenaltyTime(entity pl, float penalty, string reason)
index 16564cd39b7c7175187e659bcb119fc7ba27cca0..ae64e74e4909d66882ea09e261926086977b4da0 100644 (file)
@@ -1,5 +1,7 @@
 #include "round_handler.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "campaign.qh"
 #include "command/vote.qh"
 #include "../common/util.qh"
index 042d450ec98e9a74c41e92d1c54a42230fc71770..266f7734b660bae45bad90f29514a869ef182b46 100644 (file)
@@ -454,7 +454,7 @@ void WinningConditionHelper(entity this)
                WinningConditionHelper_second = NULL;
                winnerscorekeeper = NULL;
                secondscorekeeper = NULL;
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it), {
                        sk = CS(it).scorekeeper;
                        c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
                        if(c < 0)
@@ -473,7 +473,7 @@ void WinningConditionHelper(entity this)
                                        secondscorekeeper = sk;
                                }
                        }
-               ));
+               });
 
                WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
                if(WinningConditionHelper_equality)
@@ -515,7 +515,7 @@ void WinningConditionHelper(entity this)
                strunzone(worldstatus);
        worldstatus = strzone(s);
 
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                string s = "";
                if(fullstatus)
                {
@@ -535,7 +535,7 @@ void WinningConditionHelper(entity this)
                if(it.clientstatus)
                        strunzone(it.clientstatus);
                it.clientstatus = strzone(s);
-       ));
+       });
 }
 
 string GetScoreLogLabel(string label, float fl)
@@ -694,7 +694,7 @@ entity PlayerScore_Sort(.float field, float teams, float strict, float nospectat
 
        plist = NULL;
 
-       FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
+       FOREACH_CLIENT(true, { it.(field) = 0; });
 
        FOREACH_CLIENT(CS(it).scorekeeper,
        {
@@ -894,12 +894,12 @@ void Score_NicePrint(entity to)
        }
 
        t = 0;
-       FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(!IS_PLAYER(it), {
                if (!t)
                        Score_NicePrint_Spectators(to);
                Score_NicePrint_Spectator(to, it);
                t = 1;
-       ));
+       });
 }
 
 void PlayerScore_PlayerStats(entity p)
index 9c416472f40a207b0870c9bc5be4fc416502d48b..97e80409cce87cc98805b1d458f3b575c82e94da 100644 (file)
@@ -1,5 +1,7 @@
 #include "scores_rules.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "client.qh"
 #include "scores.qh"
 
index bdb9cdab787a8c4f19f26ff222930b5368bbbdc8..254e799eebfb082deb3e4a1ec2eaae3fb8a8b3f4 100644 (file)
@@ -241,11 +241,11 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck)
        }
 
        shortest = vlen(world.maxs - world.mins);
-       FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
                thisdist = vlen(it.origin - spot.origin);
                if (thisdist < shortest)
                        shortest = thisdist;
-       ));
+       });
        if(shortest > mindist)
                prio += SPAWN_PRIO_GOOD_DISTANCE;
 
index 0ae9b356cd3cdecbdcaf7e8c6c8c445d13fc847b..74dce96a2bc9a23a03a06e9a68f6d3ba34bdc6eb 100644 (file)
@@ -139,10 +139,10 @@ void CreatureFrame_All()
 void Pause_TryPause(bool ispaused)
 {
        int n = 0;
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                if (PHYS_INPUT_BUTTON_CHAT(it) != ispaused) return;
                ++n;
-       ));
+       });
        if (!n) return;
        setpause(ispaused);
 }
@@ -187,12 +187,12 @@ void StartFrame()
                LOG_INFO("CEFC time: ", ftos(t * 1000), "ms; ");
                int c_seeing = 0;
                int c_seen = 0;
-               FOREACH_CLIENT(true, LAMBDA(
+               FOREACH_CLIENT(true, {
                        if(IS_REAL_CLIENT(it))
                                ++c_seeing;
                        if(IS_PLAYER(it))
                                ++c_seen;
-               ));
+               });
                LOG_INFO("CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ");
                LOG_INFO("CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0'), "\n");
 
index 2d6ceb8e0257f3546820544f276cb873d946e863..793a227b897bb1d6b92a5c438184568f44e0b564 100644 (file)
@@ -328,7 +328,7 @@ void GetTeamCounts(entity ignore)
        // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
        // also remember the lowest-scoring player
 
-       FOREACH_CLIENT(true, LAMBDA(
+       FOREACH_CLIENT(true, {
                float t;
                if(IS_PLAYER(it) || it.caplayer)
                        t = it.team;
@@ -376,7 +376,7 @@ void GetTeamCounts(entity ignore)
                                }
                        }
                }
-       ));
+       });
 
        // if the player who has a forced team has not joined yet, reserve the spot
        if(autocvar_g_campaign)
@@ -737,7 +737,7 @@ void ShufflePlayerOutOfTeam (float source_team)
        lowest_player_score = 999999999;
 
        // find the lowest-scoring player & bot of that team
-       FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, {
                if(it.isbot)
                {
                        if(it.totalfrags < lowest_bot_score)
@@ -754,7 +754,7 @@ void ShufflePlayerOutOfTeam (float source_team)
                                lowest_player_score = it.totalfrags;
                        }
                }
-       ));
+       });
 
        // prefers to move a bot...
        if(lowest_bot != NULL)
index e6d6f66a0d0442ef426980cf355006af81698fd6..ad40da4dd99c8533527c8454cfdc593875a94f7b 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "defs.qh"
+#include "miscfunctions.qh"
 #include "autocvars.qh"
 #include "client.qh"
 #include "command/_mod.qh"
diff --git a/qcsrc/server/utils.qh b/qcsrc/server/utils.qh
new file mode 100644 (file)
index 0000000..da5c7a5
--- /dev/null
@@ -0,0 +1,77 @@
+#pragma once
+
+int maxclients;
+
+const string STR_PLAYER = "player";
+const string STR_SPECTATOR = "spectator";
+const string STR_OBSERVER = "observer";
+
+#define IS_PLAYER(v) ((v).classname == STR_PLAYER)
+#define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
+#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
+
+#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
+#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
+
+#define IS_MONSTER(v) (v.flags & FL_MONSTER)
+#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
+#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
+
+// NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
+// NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
+// NOTE: FOR_EACH_REALCLIENT deprecated! Use the following instead: FOREACH_CLIENT(IS_REAL_CLIENT(it), { code; });
+
+// NOTE: FOR_EACH_PLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it), { code; });
+// NOTE: FOR_EACH_SPEC deprecated! Use the following instead: FOREACH_CLIENT(IS_SPEC(it), { code; });
+// NOTE: FOR_EACH_OBSERVER deprecated! Use the following instead: FOREACH_CLIENT(IS_OBSERVER(it), { code; });
+// NOTE: FOR_EACH_REALPLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { code; });
+
+#define FOREACH_CLIENTSLOT(cond, body) \
+       MACRO_BEGIN { \
+               for(int _i = 1; _i <= maxclients; ++_i) \
+               { \
+                       const noref int i = _i; \
+                       ITER_CONST noref entity it = ftoe(i); \
+                       if(cond) { LAMBDA(body) } \
+               } \
+       } MACRO_END
+
+#define FOREACH_CLIENT(cond, body) FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), body)
+
+// using the "inside out" version of knuth-fisher-yates shuffle
+// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
+entity _FCR_clients[255];
+bool _FCR_entered = false;
+#define FOREACH_CLIENT_RANDOM(cond, body) \
+       MACRO_BEGIN { \
+               if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
+               _FCR_entered = true; \
+               int _cnt = 0; \
+               FOREACH_CLIENT(cond, { \
+            int _j = floor(random() * (_cnt + 1)); \
+            if (_j == _cnt) \
+            { \
+                _FCR_clients[_cnt] = it; \
+            } \
+            else \
+            { \
+                _FCR_clients[_cnt] = _FCR_clients[_j]; \
+                _FCR_clients[_j] = it; \
+            } \
+            _cnt++; \
+        }); \
+               for (int _i = 0; _i < _cnt; ++_i) \
+               { \
+                       const noref int i = _i; \
+                       ITER_CONST noref entity it = _FCR_clients[i]; \
+                       if (cond) { LAMBDA(body) } \
+               } \
+               _FCR_entered = false; \
+       } MACRO_END
+
+// NOTE: FOR_EACH_MONSTER deprecated! Use the following instead: IL_EACH(g_monsters, true, { code; });
index bee961bc080d0aecd64ccc284e02a0d49be4517b..4b01a3138936d00e0e2401b7f7fe3ebe5ec6171e 100644 (file)
@@ -85,7 +85,7 @@ void accuracy_add(entity this, int w, int fired, int hit)
        if (b == accuracy_byte(a.accuracy_hit[w], a.accuracy_fired[w])) return; // no change
        int sf = 1 << (w % 24);
        a.SendFlags |= sf;
-       FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, LAMBDA(CS(it).accuracy.SendFlags |= sf));
+       FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, { CS(it).accuracy.SendFlags |= sf; });
 }
 
 bool accuracy_isgooddamage(entity attacker, entity targ)
index 35b0174ec7dae3ab1a0a926b66c2116fbb20ca3e..d24ee1cf50cf514605e9cc8d1122e854129ffa70 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 .bool cvar_cl_accuracy_data_share;
 REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
 .bool cvar_cl_accuracy_data_receive;
index fb57d92774d01657e5c4e98228a7175f8efe6252..b94b2533f3441a1e5955a13f54214b142e94a398 100644 (file)
@@ -1,5 +1,7 @@
 #include "common.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/t_items.qh>
 #include <common/constants.qh>
 #include <common/net_linked.qh>
index 42bff7c0e9118de43506f95d0f796081cb2c0033..d426e2f610d3000c69c2b16cba9defb350adfb9f 100644 (file)
@@ -1,5 +1,7 @@
 #include "csqcprojectile.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/t_items.qh>
 
 #include "../command/common.qh"
index 89cec6aea98dacaadca0f44df7c58e82e63653c1..fb13bd1b9e126201de97ef73bf439f4119a6a97e 100644 (file)
@@ -1,5 +1,7 @@
 #include "hitplot.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../antilag.qh"
 #include "../g_subs.qh"
 #include <common/weapons/_all.qh>
index 071a0fea8bcb73fb1b2ebad279b7d26cbdcf3f83..ea580e9118671e128bd03d45795e4dba6625e87c 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type);
 
index b493409b0296ebc8f122b473cecf8044b56b9d0a..62b11ea45d62e47e3bc9c3d7244b05837e39c737 100644 (file)
@@ -50,7 +50,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                        for (int i = 1; i < t; ++i)
                        {
                                s = argv(i);
-                               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                               FOREACH(Weapons, it != WEP_Null, {
                                        if(it.netname == s)
                                        {
                                                entity replacement = spawn();
@@ -59,20 +59,20 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                                                weapon_defaultspawnfunc(replacement, it);
                                                break;
                                        }
-                               ));
+                               });
                        }
                }
                if (t >= 1) // always the case!
                {
                        s = argv(0);
                        wpn = WEP_Null;
-                       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       FOREACH(Weapons, it != WEP_Null, {
                                if(it.netname == s)
                                {
                                        wpn = it;
                                        break;
                                }
-                       ));
+                       });
                }
                if (wpn == WEP_Null)
                {
index 9ce5ca30e4da2426627d11a463e0fcc321c8c243..d435002ad69fb3c6784bc68f210051afae856df4 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 string W_Apply_Weaponreplace(string in);
 
 void weapon_defaultspawnfunc(entity this, Weapon e);
index dd0f3a6c0a1fac62e391e1b97eb1f0ef10be1145..4b7d45b964157127f682e1de6048aa1bc3c358cd 100644 (file)
@@ -60,10 +60,10 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                else
                {
                        int superweapons = 1;
-                       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       FOREACH(Weapons, it != WEP_Null, {
                                WepSet set = it.m_wepset;
                                if((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons;
-                       ));
+                       });
                        if(superweapons <= 1)
                        {
                                wep.superweapons_finished = own.superweapons_finished;
index 1b62b64c805b28c475c04f51b50f2448459bafe7..9ea5e5cb8e442c930f628f47f1e93ff29ef150de 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 .float savenextthink;
 void thrown_wep_think(entity this);
 
index 475eb3d265c086e769242548ab018ed6a00e1bb3..649726658784d163dfbfbd92427bfc1dde6f0d33 100644 (file)
@@ -1,5 +1,7 @@
 #include "tracing.qh"
 
+#include <common/effects/all.qh>
+
 #include "accuracy.qh"
 #include "common.qh"
 #include "hitplot.qh"
@@ -262,7 +264,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
        // Find all non-hit players the beam passed close by
        if(deathtype == WEP_VAPORIZER.m_id || deathtype == WEP_VORTEX.m_id)
        {
-               FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, LAMBDA(
+               FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, {
                        if(!it.railgunhit)
                        if(!(IS_SPEC(it) && it.enemy == this))
                        {
@@ -278,7 +280,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
                                        pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
                                soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * f, ATTEN_NONE);
                        }
-               ));
+               });
 
                if(pseudoprojectile)
                        delete(pseudoprojectile);
index 0c17e197497988a2ccdee5e4bcbdbe6901f9053b..3fa16d6545910d2e99a2a02197e43440eb3aaafe 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 vector w_shotorg;
 vector w_shotdir;
 vector w_shotend;
index 2ffb1c1ec8dfa60403d672d524f5239af73da64f..a71abe70f347f780f9c8189e7e21501ee785d50a 100644 (file)
@@ -1,5 +1,7 @@
 #include "weaponstats.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../g_world.qh"
 
 #include <common/weapons/_all.qh>
index cbde7d360c61544c8ea3b4d48596c11ac2330435..f8949b15601919e1b863084a1e5653ab3f94d9c2 100644 (file)
@@ -393,10 +393,10 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
 
        if (this)
        {
-               FOREACH_CLIENT(true, LAMBDA(
+               FOREACH_CLIENT(true, {
                        if(it == actor || (IS_SPEC(it) && it.enemy == actor))
                                wframe_send(it, this, a, restartanim);
-               ));
+               });
        }
 
        if ((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
index 2fb0f9956833236250c0266fc70b91a2b412d21a..4ddf5a5159eac5adf534d6c61cafd0dc8a933445 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 float internalteam;
 float weaponswapping;
 entity weapon_dropevent_item;
index 55799ff7c4db70fe3d470284b1c8bc6b4548b69d..e835fa67135e5145c0c8bd97ace8512c05492b4f 100755 (executable)
@@ -59,8 +59,10 @@ function check1() {
     declare -l prog="${1}"
     declare -l file="${2}"
     MODE=${prog}
+    includes="-include lib/_all.inc"
+    [ -f ${prog}/_all.qh ] && includes="${includes} -include ${prog}/_all.qh"
     qpp ${file} test.dat \
-            -include lib/_all.inc -include ${prog}/_all.qh \
+            ${includes} \
             -I. ${QCCIDENT} ${QCCDEFS} > ${WORKDIR}/${prog}.qc
     qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${prog}.qc >/dev/null
 }
index 9a3ba10987b05622ad8873ee16783475a9f09b98..1c0eadcbe30b293c69a95134a2fc4e85a09c0e50 100755 (executable)
@@ -6,9 +6,17 @@ ROOT=$PWD/
 
 MOD=_mod
 
+function hash() {
+    git hash-object $1
+}
+
 function genmod() {
     # use context to work around cmake issue #12619
     CTX="${PWD#$ROOT}/"
+    oldHashC=$(hash ${MOD}.inc)
+    oldTimeC=$(stat -c "%Y" ${MOD}.inc)
+    oldHashH=$(hash ${MOD}.qh)
+    oldTimeH=$(stat -c "%Y" ${MOD}.qh)
     echo '// generated file; do not modify' > ${MOD}.inc
     echo '// generated file; do not modify' > ${MOD}.qh
     for f in $(ls | sort -k 1,1 -t .); do
@@ -43,6 +51,10 @@ function genmod() {
             echo "#include <${CTX}$f/${mod}.qh>" >> ${MOD}.qh
         fi
     fi; done
+    newHashC=$(hash ${MOD}.inc)
+    if [[ $newHashC == $oldHashC ]]; then touch -d @$oldTimeC ${MOD}.inc; fi
+    newHashH=$(hash ${MOD}.qh)
+    if [[ $newHashH == $oldHashH ]]; then touch -d @$oldTimeH ${MOD}.qh; fi
 }
 
 (cd lib; genmod)
index 924083166f08e0650e4c08f624eded6b6835822c..795a32e6ddc7d8a302f755a322dca99bc308aa2a 100755 (executable)
@@ -3,6 +3,8 @@ set -eu
 cd ${0%/*}
 cd ..
 
+VERBOSE=${VERBOSE:-1}
+
 function startswith() {
     declare -l file="${1}"
     declare -l prelude="${2}"
@@ -15,7 +17,7 @@ function startswith() {
 function check() {
     declare -l base="${1}"
     find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
-        echo "$file"
+        [ "$VERBOSE" != "0" ] && echo "$file"
         declare -l file_h="${file%.qc}.qh"
         if [[ ! -f "$file_h" ]]; then echo "#pragma once" > "$file_h"; fi
 
@@ -25,7 +27,7 @@ function check() {
         startswith "$file" "$include"
     done
     find "$base" -type f -name '*.qh' -a \! -name '_mod.qh' -print0 | sort -z | while read -r -d '' file; do
-        echo "$file"
+        [ "$VERBOSE" != "0" ] && echo "$file"
         startswith "$file" "#pragma once"
     done
 }
index 594c60ea29d8ae509dfd3d748987e74f0fe21b60..46db124008e83a88f998cd23897a2999c9761f20 100755 (executable)
@@ -3,13 +3,23 @@ set -eu
 cd ${0%/*}
 cd ..
 
+function hash() {
+    git hash-object $1
+}
+
 function check() {
     declare -l base="${1}"
-    find "$base" -type f -print0 | sort -z | xargs -0 sed -i \
-        `# strip trailing spaces`                            \
-        -e 's/[[:space:]]*$//'                               \
-        `# line feed at EOF for #include to work properly`   \
-        -e '$a\'
+    # strip trailing spaces
+    STRIP_TRAILING_WS='s/[[:space:]]\+$//'
+    # line feed at EOF for #include to work properly
+    ENSURE_EOFLF='$a\'
+    find "$base" -type f -print0 | sort -z | while read -r -d '' file; do
+        oldHash=$(hash ${file})
+        oldTime=$(stat -c "%Y" ${file})
+        sed -i -e ${STRIP_TRAILING_WS} -e ${ENSURE_EOFLF} ${file}
+        newHash=$(hash ${file})
+        if [[ $newHash == $oldHash ]]; then touch -d @$oldTime ${file}; fi
+    done
 }
 
 check lib