]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/target_teleporter_v2
authorMario <mario@smbclan.net>
Sun, 27 Aug 2017 14:08:11 +0000 (00:08 +1000)
committerMario <mario@smbclan.net>
Sun, 27 Aug 2017 14:08:11 +0000 (00:08 +1000)
448 files changed:
.gitlab-ci.yml
CMakeLists.txt
balance-mario.cfg
balance-nexuiz25.cfg
balance-overkill.cfg
balance-samual.cfg
balance-xdf.cfg
balance-xonotic.cfg
balance-xpm.cfg
check-cvars.sh
commands.cfg
defaultClient.cfg [new file with mode: 0644]
defaultOverkill.cfg
defaultServer.cfg [new file with mode: 0644]
defaultXDF.cfg
defaultXPM.cfg
defaultXonotic.cfg
gamemodes-client.cfg [new file with mode: 0644]
gamemodes-server.cfg [new file with mode: 0644]
gamemodes.cfg [deleted file]
gfx/smile.tga [new file with mode: 0644]
mutators.cfg
physics.cfg
qcsrc/Makefile
qcsrc/client/_all.inc [deleted file]
qcsrc/client/_all.qh [deleted file]
qcsrc/client/_mod.inc
qcsrc/client/_mod.qh
qcsrc/client/autocvars.qh
qcsrc/client/bgmscript.qc
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/defs.qh
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
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/main.qh
qcsrc/client/mapvoting.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/mutators/events.qh
qcsrc/client/player_skeleton.qc
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/_all.inc
qcsrc/common/command/generic.qc
qcsrc/common/command/rpn.qc
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/debug.qh
qcsrc/common/effects/all.inc
qcsrc/common/effects/all.qc
qcsrc/common/effects/effectinfo.qc
qcsrc/common/effects/qc/_mod.inc
qcsrc/common/effects/qc/_mod.qh
qcsrc/common/effects/qc/all.inc [deleted file]
qcsrc/common/effects/qc/all.qc [deleted file]
qcsrc/common/effects/qc/all.qh [deleted file]
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/casings.qh
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/effects/qc/lightningarc.qc
qcsrc/common/effects/qc/modeleffects.qc
qcsrc/common/ent_cs.qh
qcsrc/common/gamemodes/_mod.inc
qcsrc/common/gamemodes/_mod.qh
qcsrc/common/gamemodes/gamemode/nexball/_mod.inc
qcsrc/common/gamemodes/gamemode/nexball/_mod.qh
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
qcsrc/common/gamemodes/rules.qc [new file with mode: 0644]
qcsrc/common/gamemodes/rules.qh [new file with mode: 0644]
qcsrc/common/gamemodes/sv_rules.qc [new file with mode: 0644]
qcsrc/common/gamemodes/sv_rules.qh [new file with mode: 0644]
qcsrc/common/items/all.qh
qcsrc/common/items/item.qh
qcsrc/common/items/item/pickup.qh
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/models/all.inc
qcsrc/common/monsters/_mod.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/sv_monsters.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/bugrigs/bugrigs.qc
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc
qcsrc/common/mutators/mutator/damagetext/sv_damagetext.qc
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/itemstime/itemstime.qc
qcsrc/common/mutators/mutator/multijump/multijump.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/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc
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/vampire/sv_vampire.qc
qcsrc/common/mutators/mutator/walljump/walljump.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/playerstats.qc
qcsrc/common/sounds/all.inc
qcsrc/common/sounds/all.qc
qcsrc/common/state.qc
qcsrc/common/stats.qh
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/func/door.qc
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/target/spawn.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/disablerelay.qc
qcsrc/common/triggers/trigger/keylock.qh
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/turrets/_all.inc [deleted file]
qcsrc/common/turrets/_all.qh [deleted file]
qcsrc/common/turrets/_mod.inc
qcsrc/common/turrets/_mod.qh
qcsrc/common/turrets/all.qc
qcsrc/common/turrets/all.qh
qcsrc/common/turrets/checkpoint.qc
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/turrets/config.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/turrets/targettrigger.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/ewheel_weapon.qc
qcsrc/common/turrets/turret/flac.qc
qcsrc/common/turrets/turret/flac_weapon.qc
qcsrc/common/turrets/turret/fusionreactor.qc
qcsrc/common/turrets/turret/hellion.qc
qcsrc/common/turrets/turret/hellion_weapon.qc
qcsrc/common/turrets/turret/hk.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/machinegun.qc
qcsrc/common/turrets/turret/machinegun_weapon.qc
qcsrc/common/turrets/turret/mlrs.qc
qcsrc/common/turrets/turret/mlrs_weapon.qc
qcsrc/common/turrets/turret/phaser.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/turret/plasma.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/turrets/turret/plasma_weapon.qc
qcsrc/common/turrets/turret/tesla.qc
qcsrc/common/turrets/turret/tesla_weapon.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/turrets/turret/walker_weapon.qc
qcsrc/common/turrets/util.qc
qcsrc/common/turrets/util.qh
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/common/vehicles/_all.inc [deleted file]
qcsrc/common/vehicles/_all.qh [deleted file]
qcsrc/common/vehicles/_mod.inc
qcsrc/common/vehicles/_mod.qh
qcsrc/common/vehicles/all.qc
qcsrc/common/vehicles/all.qh
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/viewloc.qc
qcsrc/common/weapons/all.inc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/calculations.qc
qcsrc/common/weapons/config.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/arc.qh
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/blaster.qh
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/crylink.qh
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/devastator.qh
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/electro.qh
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/fireball.qh
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hagar.qh
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hlac.qh
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/hook.qh
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/machinegun.qh
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/minelayer.qh
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/mortar.qh
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/porto.qh
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rifle.qh
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/seeker.qh
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shockwave.qh
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/shotgun.qh
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/tuba.qh
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vaporizer.qh
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/common/weapons/weapon/vortex.qh
qcsrc/ecs/systems/physics.qc
qcsrc/ecs/systems/sv_physics.qc
qcsrc/lib/_all.inc
qcsrc/lib/angle.qc
qcsrc/lib/bits.qh
qcsrc/lib/bool.qh
qcsrc/lib/color.qh
qcsrc/lib/compiler.qh
qcsrc/lib/counting.qh
qcsrc/lib/csqcmodel/cl_player.qc
qcsrc/lib/csqcmodel/interpolate.qh
qcsrc/lib/cvar.qh
qcsrc/lib/draw.qh
qcsrc/lib/file.qh
qcsrc/lib/i18n.qh
qcsrc/lib/intrusivelist.qh
qcsrc/lib/json.qc
qcsrc/lib/log.qh
qcsrc/lib/map.qh
qcsrc/lib/markdown.qh
qcsrc/lib/math.qh
qcsrc/lib/noise.qh
qcsrc/lib/p2mathlib.qc
qcsrc/lib/p2mathlib.qh
qcsrc/lib/random.qc
qcsrc/lib/random.qh
qcsrc/lib/registry.qh
qcsrc/lib/replicate.qh
qcsrc/lib/sort.qh
qcsrc/lib/sortlist.qc
qcsrc/lib/static.qh
qcsrc/lib/string.qh
qcsrc/lib/test.qc
qcsrc/lib/urllib.qc
qcsrc/lib/urllib.qh
qcsrc/lib/vector.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/command/menu_cmd.qc
qcsrc/menu/item.qh
qcsrc/menu/menu.qc
qcsrc/menu/progs.inc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/maplist.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/skinlist.qc
qcsrc/menu/xonotic/slider_decibels.qc
qcsrc/menu/xonotic/util.qc
qcsrc/server/_all.inc [deleted file]
qcsrc/server/_all.qh [deleted file]
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/anticheat.qc
qcsrc/server/antilag.qc
qcsrc/server/antilag.qh
qcsrc/server/autocvars.qh
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/radarmap.qh
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/defs.qh
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/g_world.qh
qcsrc/server/impulse.qc
qcsrc/server/ipban.qc
qcsrc/server/item_key.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_assault.qh
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ca.qh
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qh
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_cts.qh
qcsrc/server/mutators/mutator/gamemode_deathmatch.qh
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_domination.qh
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qh
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qh
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qh
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qh
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_lms.qh
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/mutators/mutator/gamemode_race.qh
qcsrc/server/mutators/mutator/gamemode_tdm.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qh
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/utility.qc
qcsrc/server/player.qc
qcsrc/server/player.qh
qcsrc/server/playerdemo.qc
qcsrc/server/portals.qc
qcsrc/server/progs.inc
qcsrc/server/race.qc
qcsrc/server/race.qh
qcsrc/server/round_handler.qc
qcsrc/server/scores.qc
qcsrc/server/scores.qh
qcsrc/server/scores_rules.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/sv_main.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh
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.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
sRGB-disable.cfg
sRGB-enable.cfg
scripts/ok_nade_counter.shader

index 5427860963c0ccbf2c1760a8f49e6d75497d7acc..5d525a4c5773a647cd82ee8e27bd338b927153f0 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=585cfa6d62ce59f4854bedfce7c51c20
+    - EXPECT=662ab75eeb91d25c2d86ebb81ce8dc02
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index 2f38e43ba2be7ad75167b6683b238baae72dbc1a..2e5fc791f8585428c314a2ae9293bb011d371e3a 100644 (file)
@@ -1,19 +1,69 @@
-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(all qc-all)
+add_custom_target(${all})
+
+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)
 
 add_definitions(-DXONOTIC=1)
 add_definitions(-DNDEBUG=1)
+add_definitions(-DENABLE_EFFECTINFO=0)
+add_definitions(-DENABLE_DEBUGDRAW=0)
+add_definitions(-DENABLE_DEBUGTRACE=0)
 
-find_package(Git REQUIRED)
-execute_process(
-        COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=~
-        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-        OUTPUT_VARIABLE GIT_DESC
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-)
+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}
+            OUTPUT_VARIABLE GIT_DESC
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+endif ()
 add_definitions(-DWATERMARK=\"${GIT_DESC}\")
 
 set_source_files_properties(
@@ -26,16 +76,19 @@ set_source_files_properties(
 )
 
 add_executable(csprogs qcsrc/client/progs.inc)
+add_dependencies(${all} csprogs)
+add_dependencies(csprogs ${checks})
 target_compile_definitions(csprogs PRIVATE -DGAMEQC -DCSQC)
-add_dependencies(csprogs gmqcc)
 
 add_executable(progs qcsrc/server/progs.inc)
+add_dependencies(${all} progs)
+add_dependencies(progs ${checks})
 target_compile_definitions(progs PRIVATE -DGAMEQC -DSVQC)
-add_dependencies(progs gmqcc)
 
 add_executable(menu qcsrc/menu/progs.inc)
+add_dependencies(${all} menu)
+add_dependencies(menu ${checks})
 target_compile_definitions(menu PRIVATE -DMENUQC)
-add_dependencies(menu gmqcc)
 
 function(set_prelude target prelude)
     get_target_property(MY_PROJECT_SOURCES target SOURCES)
index d290be01265d0280de9b1f06955478a641911aa5..a8f59a8cd75a31c5f5b23b1dc4590007dd7bf8df 100644 (file)
@@ -114,7 +114,7 @@ set g_balance_pause_health_rot 1
 set g_balance_pause_health_rot_spawn 5
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0.02
@@ -123,7 +123,7 @@ set g_balance_pause_armor_rot 1
 set g_balance_pause_armor_rot_spawn 5
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
 set g_balance_armor_blockpercent 0.7
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_regenlinear 0
@@ -134,7 +134,7 @@ set g_balance_pause_fuel_rot 5
 set g_balance_pause_fuel_rot_spawn 10
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
 // }}}
 
 // {{{ misc
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 39405f399881c31eecdc243527b81eec5e3628f5..4967fa7e47936208ca64c9e719e5e41fa373b968 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1500 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 381eb51d7ba3d19948ad83cd5d3acfbb838fd828..3f025655c8826083e1280112a4550d85100d12d8 100644 (file)
@@ -114,7 +114,7 @@ set g_balance_pause_health_rot 1
 set g_balance_pause_health_rot_spawn 5
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 200
-set g_balance_health_limit 999
+set g_balance_health_limit 200
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0
@@ -123,7 +123,7 @@ set g_balance_pause_armor_rot 5
 set g_balance_pause_armor_rot_spawn 5
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 0
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
 set g_balance_armor_blockpercent 0.6
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_regenlinear 0
@@ -134,7 +134,7 @@ set g_balance_pause_fuel_rot 5
 set g_balance_pause_fuel_rot_spawn 10
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
 // }}}
 
 // {{{ misc
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index ad7192227eb4abcf842a2b02f57b1025de46ff27..52fd03dc7e32dcc3223fa5508c0b7b19bd6c1b32 100644 (file)
@@ -114,7 +114,7 @@ set g_balance_pause_health_rot 1
 set g_balance_pause_health_rot_spawn 5
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0.04
@@ -123,7 +123,7 @@ set g_balance_pause_armor_rot 1
 set g_balance_pause_armor_rot_spawn 5
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
 set g_balance_armor_blockpercent 0.6
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_regenlinear 0
@@ -134,7 +134,7 @@ set g_balance_pause_fuel_rot 5
 set g_balance_pause_fuel_rot_spawn 10
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
 // }}}
 
 // {{{ misc
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 5eda67ba945a7f66f4d178a8f80622828c792280..4d26972067abdcf3fd4a18f1e3db231bd19e4958 100644 (file)
@@ -114,7 +114,7 @@ set g_balance_pause_health_rot 1
 set g_balance_pause_health_rot_spawn 5
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0.02
@@ -123,7 +123,7 @@ set g_balance_pause_armor_rot 1
 set g_balance_pause_armor_rot_spawn 5
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
 set g_balance_armor_blockpercent 0.7
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_regenlinear 0
@@ -134,7 +134,7 @@ set g_balance_pause_fuel_rot 5
 set g_balance_pause_fuel_rot_spawn 10
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
 // }}}
 
 // {{{ misc
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index f317d2e6b422d1225078fe3fa4d58de4ee128ce4..fece8cd726072f6b9f0ca81677ce05ffc00815d7 100644 (file)
@@ -114,7 +114,7 @@ set g_balance_pause_health_rot 1
 set g_balance_pause_health_rot_spawn 5
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0.02
@@ -123,7 +123,7 @@ set g_balance_pause_armor_rot 1
 set g_balance_pause_armor_rot_spawn 5
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
 set g_balance_armor_blockpercent 0.7
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_regenlinear 0
@@ -134,7 +134,7 @@ set g_balance_pause_fuel_rot 5
 set g_balance_pause_fuel_rot_spawn 10
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
 // }}}
 
 // {{{ misc
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index f5ec29240e97d8b8646c7ba8aabb535037049acd..984972623228b5a3c98c0bf6a035db3d9a7b83d9 100644 (file)
@@ -114,7 +114,7 @@ set g_balance_pause_health_rot 1
 set g_balance_pause_health_rot_spawn 5
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0.02
@@ -123,7 +123,7 @@ set g_balance_pause_armor_rot 1
 set g_balance_pause_armor_rot_spawn 5
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
 set g_balance_armor_blockpercent 0.7
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_regenlinear 0
@@ -134,7 +134,7 @@ set g_balance_pause_fuel_rot 5
 set g_balance_pause_fuel_rot_spawn 10
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
 // }}}
 
 // {{{ misc
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
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
index 93b68f901e57154ec7512a2d98830fce7ec168ad..66ca90e2aa25dcb0aab5f659ba07b2c722b2e44b 100644 (file)
@@ -185,6 +185,7 @@ alias skinmob "editmob skin ${* ?}"
 alias namemob "editmob name ${* ?}"
 alias movemob "editmob movetarget ${* ?}"
 alias butcher "editmob butcher ${* ?}"
+alias mobbutcher "editmob butcher ${* ?}"
 
 
 // ============================================================
@@ -209,7 +210,6 @@ alias gettaginfo           "qc_cmd_sv     gettaginfo           ${* ?}" // Get sp
 alias gotomap              "qc_cmd_sv     gotomap              ${* ?}" // Simple command to switch to another map
 alias lockteams            "qc_cmd_sv     lockteams            ${* ?}" // Disable the ability for players to switch or enter teams
 alias make_mapinfo         "qc_cmd_sv     make_mapinfo         ${* ?}" // Automatically rebuild mapinfo files
-alias mobbutcher           "qc_cmd_sv     mobbutcher           ${* ?}" // Remove all monsters on the map
 alias moveplayer           "qc_cmd_sv     moveplayer           ${* ?}" // Change the team/status of a player
 alias nospectators         "qc_cmd_sv     nospectators         ${* ?}" // Automatically remove spectators from a match
 alias playerdemo           "qc_cmd_sv     playerdemo           ${* ?}" // Control the ability to save demos of players
diff --git a/defaultClient.cfg b/defaultClient.cfg
new file mode 100644 (file)
index 0000000..c12f69f
--- /dev/null
@@ -0,0 +1,847 @@
+// this resets most client cvars and aliases to their defaults
+// if you want to reset your client to defaults, it's probably a better idea to delete (parts of) config.cfg and restart
+
+
+// changes a cvar and reports it to the server (for the menu to notify the
+// server about changes)
+alias setreport "set \"$1\" \"$2\" ; sendcvar \"$1\""
+
+seta cl_firststart "" "how many times the client has been run"
+seta cl_startcount 0 "how many times the client has been run"
+
+// other aliases
+alias +hook +button6
+alias -hook -button6
+alias +jetpack +button10
+alias -jetpack -button10
+alias +dodge +button11
+alias -dodge -button11
+alias use "impulse 21"
+
+// for backwards compatibility
+// TODO Remove after 0.8 release!
+cl_particles_forcetraileffects 1
+
+alias dropweapon "impulse 17"
+alias +show_info +button7
+alias -show_info -button7
+
+// merge lightmaps up to 2048x2048 textures
+mod_q3bsp_lightmapmergepower 4
+
+// player defaults
+_cl_color "112.211" // same effect as 112, but menuqc can detect this as the default and not intentionally set
+_cl_name ""
+seta _cl_gender 0 "storage cvar for current player gender (0 = undisclosed, 1 = male, 2 = female)"
+_cl_playermodel models/player/erebus.iqm
+_cl_playerskin 0
+
+seta cl_reticle 1 "enable zoom reticles"
+seta cl_reticle_stretch 0 "stretch reticles so they fit the screen (breaks image proportions)"
+seta cl_reticle_normal 1 "draw an aiming reticle when zooming with the zoom button"
+seta cl_reticle_normal_alpha 1 "alpha of the normal reticle"
+seta cl_reticle_weapon 1 "draw custom aiming reticle when zooming with certain weapons"
+seta cl_reticle_weapon_alpha 1 "alpha of the custom reticle"
+
+fov 100
+seta cl_velocityzoom_enabled 0 "velocity based zooming of fov"
+seta cl_velocityzoom_factor 0 "factor of fov zooming (negative values zoom out)"
+seta cl_velocityzoom_type 3 "how to factor in speed, 1 = all velocity in all directions, 2 = velocity only in forward direction (can be negative), 3 = velocity only in forward direction (limited to forward only)"
+seta cl_velocityzoom_speed 1000 "target speed for fov factoring"
+seta cl_velocityzoom_time 0.2  "time value for averaging speed values"
+seta cl_spawnzoom 1 "zoom effect immediately when a player spawns"
+seta cl_spawnzoom_speed 1 "speed at which zooming occurs while spawning"
+seta cl_spawnzoom_factor 2 "factor of zoom while spawning"
+seta cl_zoomfactor 5   "how much +zoom will zoom (1-30)"
+seta cl_zoomspeed 8    "how fast it will zoom (0.5-16), negative values mean instant zoom"
+seta cl_zoomsensitivity 0      "how zoom changes sensitivity (0 = weakest, 1 = strongest)"
+
+seta cl_unpress_zoom_on_spawn 1 "automatically unpress zoom when you spawn"
+seta cl_unpress_zoom_on_death 1 "automatically unpress zoom when you die (and don't allow zoom again while dead)"
+seta cl_unpress_zoom_on_weapon_switch 1 "automatically unpress zoom when you switch a weapon"
+seta cl_unpress_attack_on_weapon_switch 0 "automatically unpress fire and fire1 attack buttons when you switch a weapon"
+
+seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns"
+seta cl_spawn_event_sound 1 "sound effect whenever a player spawns"
+//seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model
+seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points" // managed by effects-.cfg files
+seta cl_spawn_point_dist_min 1200
+seta cl_spawn_point_dist_max 1600
+
+freelook 1
+sensitivity 6
+v_gamma 1
+viewsize 100
+bgmvolume 1
+volume 0.5
+// fullscreen 1024x768x32bit
+vid_bitsperpixel 32
+vid_fullscreen 1
+vid_width 1024
+vid_height 768
+vid_pixelheight 1
+vid_resizable 0 // cannot be turned on before it is sure it cannot cause a r_restart
+vid_desktopfullscreen 1
+prvm_language en
+set _menu_prvm_language ""
+set _menu_vid_width "$vid_width"
+set _menu_vid_height "$vid_height"
+set _menu_vid_pixelheight "$vid_pixelheight"
+set _menu_vid_desktopfullscreen "$vid_desktopfullscreen"
+seta menu_vid_scale 0
+seta menu_vid_allowdualscreenresolution 0
+// 2D resolution 800x600
+vid_conwidth 800
+vid_conheight 600
+// menu_conwidth, menu_conheight are set inside quake.rc
+v_deathtilt 0 // needed for spectators (who are dead to avoid prediction)
+
+// create a temporary empty alias for menu_sync so that execution of effects-normal.cfg, hud_luma.cfg
+// and sRGB-{disable,enable}.cfg on game start doesn't show an error message in the console
+alias menu_sync "" // will be re-aliased later
+
+// we want to use sRGB for our maps!
+exec sRGB-disable.cfg
+vid_sRGB_fallback 2
+r_hdr_glowintensity 1
+// #define Image_LinearFloatFromsRGBFloat(c) (((c) <= 0.04045f) ? (c) * (1.0f / 12.92f) : (float)pow(((c) + 0.055f)*(1.0f/1.055f), 2.4f))
+set rpn_sRGB_to_linear "dup 0.055 add 1.055 div 2.4 pow exch 12.92 div dup 0.0031308 gt when"
+// #define Image_sRGBFloatFromLinearFloat(c) (((c) < 0.0031308f) ? (c) * 12.92f : 1.055f * (float)pow((c), 1.0f/2.4f) - 0.055f)
+set rpn_linear_to_sRGB "dup 1.0 2.4 div pow 1.055 mul 0.055 sub exch 12.92 mul dup 0.04045 ge when"
+
+// -nosRGB to -sRGB sky shader conversion:
+//
+// q3map_sunExt 1 0.6875 0.375 340 25 47 0 16
+//                                    ^^ elevation
+//                             ^^^ sunlight
+// q3map_skylight 110 3
+//                ^^^ skylight
+//
+// With that, do (the last parameter is the ratio of skylight you assume hits
+// the surfaces, about 0.25 for inner surfaces near sky, about 1.00 on
+// terrain):
+// ]skybox_nosRGB_to_sRGB 340 47 110 0.25
+// rpn: still on stack: new_sunlight:
+// rpn: still on stack: 380.464142
+// rpn: still on stack: new_skylight:
+// rpn: still on stack: 9.32523632
+//
+// The equivalent -sRGB shader then will have:
+//
+// q3map_sunExt 1 0.6875 0.375 380.464142 25 47 0 16
+// q3map_skylight 9.32523632 3
+alias skybox_nosRGB_to_sRGB "rpn $3 402.123 $4 div div $rpn_sRGB_to_linear 402.123 $4 div mul /new_skylight: $3 402.123 $4 div div $1 256 div $2 0.017453 mul sin mul add $rpn_sRGB_to_linear $3 402.123 $4 div div $rpn_sRGB_to_linear sub 256 mul $2 0.017453 mul sin div /new_sunlight:"
+
+set cl_orthoview 0 "enable top-down view of the map- meant to be used for radar map images (note: orthoview sets cvars temporarily, requires restart to return them to normal)"
+set cl_orthoview_nofog 1 "disable fog while in orthoview-- note, should not be enabled on ALL maps, i.e. oilrig works fine with this disabled"
+
+// these settings determine how much the view is affected by movement/damage
+cl_smoothviewheight 0.05 // time of the averaging to the viewheight value so that it creates a smooth transition for crouching and such. 0 for instant transition
+cl_deathfade 0 // fade screen to dark red when dead, value represents how fast the fade is (higher is faster)
+cl_bobcycle 0.5 // how long the cycle of up/down view movement takes (only works if cl_bob is not 0), default is 0.6
+cl_bob 0 // how much view moves up/down when moving (does not move if cl_bobcycle is 0, but still enables cl_bobmodel), default is 0.02
+cl_bob2cycle 1 // how long the cycle of left/right view movement takes (only works if cl_bob2 is not 0), default is 0.6
+cl_bob2 0 // how much view moves left/right when moving (does not move if cl_bob2cycle is 0), default is 0.01
+cl_bobfall 0.05 "how much the view swings down when falling (influenced by the speed you hit the ground with)"
+cl_bobfallcycle 3 "speed of the bobfall swing"
+cl_bobfallspeed 200 "necessary amount of speed for bob-falling to occur"
+cl_bobmodel 1 // whether to have gun model move around on screen when moving (only works if cl_bob is not 0), default is 1
+cl_bobmodel_side 0.2 // amount the gun sways to the sides
+cl_bobmodel_speed 10 // rate at which the gun sways
+cl_bobmodel_up 0.1 // amount the gun sways up and down
+
+cl_followmodel 1 // enables weapon pushing / pulling effect when walking
+seta cl_followmodel_speed 0.3 "gun following speed"
+seta cl_followmodel_limit 135 "gun following limit"
+seta cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone)"
+seta cl_followmodel_velocity_lowpass 0.05 "gun following velocity lowpass averaging time"
+seta cl_followmodel_highpass 0.05 "gun following highpass averaging time"
+seta cl_followmodel_lowpass 0.03 "gun following lowpass averaging time"
+
+cl_leanmodel 1 // enables weapon leaning effect when looking around
+seta cl_leanmodel_speed 0.3 "gun leaning speed"
+seta cl_leanmodel_limit 30 "gun leaning limit"
+seta cl_leanmodel_highpass1 0.2 "gun leaning pre-highpass averaging time"
+seta cl_leanmodel_highpass 0.2 "gun leaning highpass averaging time"
+seta cl_leanmodel_lowpass 0.05 "gun leaning lowpass averaging time"
+
+cl_rollangle 0 // amount of view tilt when strafing, default is 2.0
+v_kicktime 0 // how long damage kicks of the view last, default is 0 seconds
+gl_polyblend 0 // whether to use screen tints, this has now been replaced by a better system in CSQC
+r_motionblur 0 // motion blur value, default is 0
+r_damageblur 0 // motion blur when damaged, default is 0 (removed in Xonotic)
+
+r_bloom_blur 4
+r_bloom_brighten 2
+r_bloom_colorexponent 1
+r_bloom_colorscale 1
+r_bloom_colorsubtract 0.125
+r_bloom_resolution 320
+r_bloom_scenebrightness 0.85
+
+seta vid_x11_display ""        "xonotic-linux-*.sh will use this to start xonotic on an other/new X display"
+// This can have three possible settings:
+//     ""              run as usual
+//     ":n"            use DISPLAY=:n, create it if needed
+//     ":n/layout"     use DISPLAY=:n, create it if needed with ServerLayout layout
+
+cl_autodemo_nameformat demos/%Y-%m-%d_%H-%M
+
+// taunts and voices
+seta cl_autotaunt 0 "automatically taunt enemies when fragging them"
+seta cl_voice_directional 1    "0 = all voices are non-directional, 1 = all voices are directional, 2 = only taunts are directional"
+seta cl_voice_directional_taunt_attenuation 0.5 "this defines the distance from which taunts can be heard"
+
+seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy, 1: same pitch 2: increase pitch with more damage 3: decrease pitch with more damage"
+set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this"
+seta cl_hitsound_min_pitch 0.75 "minimum pitch of hit sound"
+seta cl_hitsound_max_pitch 1.5 "maximum pitch of hit sound"
+seta cl_hitsound_nom_damage 25 "damage amount at which hitsound bases pitch off"
+
+seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead; set to 2 to active the effect only when the corpse doesn't move anymore"
+seta cl_eventchase_frozen 0 "camera goes into 3rd person mode when the player is frozen"
+seta cl_eventchase_nexball 1 "camera goes into 3rd person mode when in nexball game-mode"
+seta cl_eventchase_distance 140 "final camera distance"
+seta cl_eventchase_generator_distance 400 "final camera distance while viewing generator explosion"
+seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
+seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
+seta cl_eventchase_mins "-12 -12 -8" "min size of eventchase camera bbox"
+seta cl_eventchase_viewoffset "0 0 20" "viewoffset of eventchase camera"
+seta cl_eventchase_generator_viewoffset "0 0 80" "viewoffset of eventchase camera while viewing generator explosion"
+seta cl_eventchase_vehicle 1 "camera goes into 3rd person mode when inside a vehicle"
+seta cl_eventchase_vehicle_viewoffset "0 0 80"
+seta cl_eventchase_vehicle_distance 250
+
+set _vehicles_shownchasemessage 0
+
+seta cl_particles_oldvortexbeam 0 "Uses the old v2.3 Vortex beam instead of the new beam, only works if server allows it (g_allow_oldvortexbeam 1)"
+
+seta cl_damageeffect 1 "enable weapon damage effects: 1 enables the feature on skeletal models, 2 on any model"
+seta cl_damageeffect_ticrate 0.1 "particle spawn rate"
+seta cl_damageeffect_bones 5 "how many damages to allow on a rigged mesh at once (non-skeletal objects are limited to one)"
+seta cl_damageeffect_distribute 1 "divide particle intensity if multiple damages are present"
+seta cl_damageeffect_lifetime 0.1 "how much a damage effect lasts, based on damage amount"
+seta cl_damageeffect_lifetime_min 3 "minimum lifetime a damage effect may have"
+seta cl_damageeffect_lifetime_max 6 "maximum lifetime a damage effect may have"
+
+set cl_deathglow 0.8 "number of seconds during which dead bodies glow out"
+
+cl_movement 1
+cl_movement_track_canjump 0
+cl_stairsmoothspeed 200
+
+alias g_waypointeditor_spawn "impulse 103"
+alias g_waypointeditor_remove "impulse 104"
+alias g_waypointeditor_relinkall "impulse 105"
+alias g_waypointeditor_saveall "impulse 106"
+alias g_waypointeditor_unreachable "impulse 107"
+
+seta menu_sandbox_spawn_model ""
+seta menu_sandbox_attach_bone ""
+seta menu_sandbox_edit_skin 0
+seta menu_sandbox_edit_alpha 1
+seta menu_sandbox_edit_color_main "1 1 1"
+seta menu_sandbox_edit_color_glow "1 1 1"
+seta menu_sandbox_edit_frame 0
+seta menu_sandbox_edit_scale 1
+seta menu_sandbox_edit_solidity 1
+seta menu_sandbox_edit_physics 1
+seta menu_sandbox_edit_force 1
+seta menu_sandbox_edit_material ""
+
+seta menu_monsters_edit_spawn ""
+seta menu_monsters_edit_skin 0
+seta menu_monsters_edit_movetarget 1
+
+// effects
+r_glsl_vertextextureblend_usebothalphas 1 // allows to abuse texture blending as detail texture
+mod_q3shader_force_terrain_alphaflag 1 // supposedly now required for r_glsl_vertextextureblend_usebothalphas to work
+r_glsl_postprocess 0 // but note, hud_postprocessing enables this
+r_picmipsprites 0 // Xonotic uses sprites that should never be picmipped (team mate, typing, waypoints)
+r_picmipworld 1
+gl_picmip_world 0
+gl_picmip_sprites 0
+gl_picmip_other 1 // so, picmip -1 is best possible quality
+r_mipsprites 1
+r_mipskins 1
+gl_max_lightmapsize 4096
+r_shadow_realtime_world_lightmaps 1
+r_shadow_realtime_world_importlightentitiesfrommap 0 // Whether build process uses keepLights is nontransparent and may change, so better make keepLights not matter.
+cl_decals_fadetime 5
+cl_decals_time 1
+seta cl_gunalign 3 "Gun alignment; 1 = center, 3 = right, 4 = left; requires reconnect"
+seta cl_nogibs 0 "reduce number of violence effects, or remove them totally"
+seta cl_particlegibs 0 "simpler gibs"
+seta cl_gibs_damageforcescale 3.5 "force to push around gibs"
+seta cl_gibs_lifetime 2.5 "average lifetime of gibs"
+seta cl_gibs_velocity_scale 1 "gib throw velocity force scale"
+seta cl_gibs_velocity_random 1 "gib throw velocity randomness scale"
+seta cl_gibs_velocity_up 1 "extra z velocity for gibs"
+seta cl_gibs_ticrate 0.1 "ticrate for gibs"
+seta cl_gibs_sloppy 1 "sloppy gibs, may temporarily penetrate walls"
+seta cl_gibs_avelocity_scale 1 "how much angular velocity to use on gibs"
+seta cl_casings 1 "enable or disable bullet casings"
+seta cl_casings_shell_time 30 "shell casing lifetime"
+seta cl_casings_bronze_time 10 "bullet casings lifetime"
+seta cl_casings_ticrate 0.1 "ticrate for casings"
+seta cl_casings_sloppy 1 "sloppy casings, may temporarily penetrate walls"
+seta cl_projectiles_sloppy 1 "sloppy projectiles, may temporarily penetrate walls"
+cl_stainmaps 0
+cl_particles_smoke 1
+vid_gl20 1
+r_glsl_deluxemapping 1
+r_glsl_offsetmapping 0
+r_glsl_offsetmapping_lod 1
+r_glsl_offsetmapping_reliefmapping 0
+r_glsl_offsetmapping_scale 0.02
+
+scr_conalpha 1
+scr_conbrightness 0.2
+scr_screenshot_jpeg 1
+scr_screenshot_jpeg_quality 0.9
+
+cl_sound_wizardhit ""
+cl_sound_hknighthit ""
+cl_sound_tink1 weapons/tink1.wav
+cl_sound_ric1 weapons/ric1.wav
+cl_sound_ric2 weapons/ric2.wav
+cl_sound_ric3 weapons/ric3.wav
+cl_sound_r_exp3 ""
+
+seta cl_announcer default "name of the announcer you wish to use from data/sound/announcer"
+seta cl_announcer_antispam 2 "number of seconds before an announcement of the same sound can be played again"
+seta cl_announcer_maptime 3 "play announcer sound telling you the remaining maptime - 0: do not play at all, 1: play at one minute, 2: play at five minutes, 3: play both"
+
+// aliases:
+alias +fire +attack
+alias -fire -attack
+alias +fire2 +button3
+alias -fire2 -button3
+alias +attack2 +button3 // old alias from Nexuiz
+alias -attack2 -button3 // old alias name from Nexuiz
+alias +crouch +button5
+alias -crouch -button5
+alias weapnext "_weapnext_${cl_weaponpriority_useforcycling}"
+alias _weapnext_0 "impulse 18"
+alias _weapnext_1 "impulse 15"
+alias _weapnext_2 "impulse 10"
+alias weaplast "impulse 11"
+alias weapprev "_weapprev_${cl_weaponpriority_useforcycling}"
+alias _weapprev_0 "impulse 19"
+alias _weapprev_1 "impulse 16"
+alias _weapprev_2 "impulse 12"
+alias weapbest "impulse 13"
+
+// experimental zoom toggle (can be in wrong state at start of a game, though)
+set _togglezoom +
+alias +zoom "set _togglezoom -; +button4"
+alias -zoom "set _togglezoom +; -button4"
+alias togglezoom "${_togglezoom}zoom"
+
+alias reload "impulse 20"
+
+// weapons
+alias weapon_group_1 "impulse 1"
+alias weapon_group_2 "impulse 2"
+alias weapon_group_3 "impulse 3"
+alias weapon_group_4 "impulse 4"
+alias weapon_group_5 "impulse 5"
+alias weapon_group_6 "impulse 6"
+alias weapon_group_7 "impulse 7"
+alias weapon_group_8 "impulse 8"
+alias weapon_group_9 "impulse 9"
+alias weapon_group_0 "impulse 14" // cycles the superweapons
+// TODO: remove after 0.8.2. Default impulse commands for 0.8.1 servers
+exec weapons.cfg
+
+cl_curl_enabled 1
+cl_curl_maxdownloads 3
+cl_curl_maxspeed 0
+cl_curl_useragent 1
+cl_curl_useragent_append "$g_xonoticversion"
+
+seta g_waypointsprite_alpha 1 "This allows the client to control transparency of the waypoint"
+seta g_waypointsprite_crosshairfadealpha 0.25 "alpha multiplier near crosshair"
+seta g_waypointsprite_crosshairfadescale 1 "scale multiplier near the crosshair"
+seta g_waypointsprite_crosshairfadedistance 150 "distance in virtual pixels from crosshair where to start fading"
+seta g_waypointsprite_distancefadealpha 1 "alpha multiplier near distance"
+seta g_waypointsprite_distancefadescale 0.7 "scale multiplier near the distance"
+seta g_waypointsprite_distancefadedistancemultiplier 0.5 "distance in map sizes from distance where to stop fading"
+set g_waypointsprite_distancealphaexponent 2
+seta g_waypointsprite_edgefadealpha 0.5 "alpha multiplier near the edge"
+seta g_waypointsprite_edgefadedistance 50 "distance in virtual pixels from edge where to start fading"
+seta g_waypointsprite_edgefadescale 1 "scale multiplier near the edge"
+seta g_waypointsprite_edgeoffset_bottom 0 "offset of how close the waypoint can be to the bottom edge of the screen"
+seta g_waypointsprite_edgeoffset_left 0 "offset of how close the waypoint can be to the left edge of the screen"
+seta g_waypointsprite_edgeoffset_right 0 "offset of how close the waypoint can be to the right edge of the screen"
+seta g_waypointsprite_edgeoffset_top 0 "offset of how close the waypoint can be to the top edge of the screen"
+seta g_waypointsprite_fontsize 12
+seta g_waypointsprite_itemstime 2 "show waypoints to indicate that some important items (mega health, large armor) are about to respawn: 1 when spectating, 2 even playing in warmup stage"
+set g_waypointsprite_minscale 0.5
+set g_waypointsprite_minalpha 0.4
+set g_waypointsprite_normdistance 512
+seta g_waypointsprite_scale 1
+set g_waypointsprite_spam 0 "Debugging feature. Set to 10 and load courtfun in race mode to test."
+set g_waypointsprite_timealphaexponent 1
+seta g_waypointsprite_turrets 1 "disable turret waypoints"
+seta g_waypointsprite_turrets_maxdist 5000 "max distance for turret waypoints"
+seta g_waypointsprite_uppercase 1
+
+alias "g_waypointsprite_personal"      "impulse 30"
+alias "g_waypointsprite_personal_p"    "impulse 31"
+alias "g_waypointsprite_personal_d"    "impulse 32"
+alias "g_waypointsprite_team_helpme"   "impulse 33"
+alias "g_waypointsprite_team_here"     "impulse 34"
+alias "g_waypointsprite_team_here_p"   "impulse 35"
+alias "g_waypointsprite_team_here_d"   "impulse 36"
+alias "g_waypointsprite_team_danger"   "impulse 37"
+alias "g_waypointsprite_team_danger_p" "impulse 38"
+alias "g_waypointsprite_team_danger_d" "impulse 39"
+alias "g_waypointsprite_clear_personal"        "impulse 47"
+alias "g_waypointsprite_clear" "impulse 48"
+alias "g_waypointsprite_toggle"        "toggle cl_hidewaypoints"
+
+seta cl_hidewaypoints 0 "disable static waypoints, only show team waypoints"
+
+seta cl_damagetext "1" "Draw damage dealt where you hit the enemy"
+seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health"
+seta cl_damagetext_format_verbose 0 "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ"
+seta cl_damagetext_format_hide_redundant 0 "hide {armor} if 0; hide {potential} and {potential_health} when same as actual"
+seta cl_damagetext_color "1 1 0" "Damage text color"
+seta cl_damagetext_color_per_weapon "0" "Damage text uses weapon color"
+seta cl_damagetext_size_min 10 "Damage text font size for small damage"
+seta cl_damagetext_size_min_damage 25 "How much damage is considered small"
+seta cl_damagetext_size_max 16 "Damage text font size for large damage"
+seta cl_damagetext_size_max_damage 140 "How much damage is considered large"
+seta cl_damagetext_alpha_start "1" "Damage text initial alpha"
+seta cl_damagetext_alpha_lifetime "3" "Damage text lifetime in seconds"
+seta cl_damagetext_velocity "0 0 20" "Damage text move direction"
+seta cl_damagetext_offset "0 -40 0" "Damage text offset"
+seta cl_damagetext_accumulate_range "30" "Damage text spawned within this range is accumulated"
+seta cl_damagetext_accumulate_alpha_rel "0.65" "Only update existing damage text when it's above this much percentage (0 to 1) of the starting alpha"
+seta cl_damagetext_friendlyfire "1" "Show damage text for friendlyfire too"
+seta cl_damagetext_friendlyfire_color "1 0 0" "Damage text color for friendlyfire"
+
+seta cl_damagetext_2d_pos "0.47 0.53 0" "2D damage text initial position (X and Y between 0 and 1)"
+seta cl_damagetext_2d_alpha_start 1 "2D damage text initial alpha"
+seta cl_damagetext_2d_alpha_lifetime 1.3 "2D damage text lifetime (alpha fading) in seconds"
+seta cl_damagetext_2d_size_lifetime 3 "2D damage text lifetime (size shrinking) in seconds"
+seta cl_damagetext_2d_velocity "-25 0 0" "2D damage text move direction (screen coordinates)"
+seta cl_damagetext_2d_overlap_offset "0 -15 0" "Offset 2D damage text by this much to prevent overlapping (screen coordinates)"
+seta cl_damagetext_2d_close_range 125 "Always use 2D damagetext for hits closer that this"
+seta cl_damagetext_2d_out_of_view 1 "Always use 2D damagetext for hits that occured off-screen"
+
+seta cl_vehicles_alarm 1 "Play an alarm sound when the vehicle you are driving is heavily damaged"
+seta cl_vehicles_hud_tactical 1
+seta cl_vehicles_hudscale 0.5
+seta cl_vehicles_notify_time 15
+seta cl_vehicles_crosshair_size 0.5
+seta cl_vehicles_crosshair_colorize 1
+
+r_labelsprites_scale 0.40625 // labels sprites get displayed at 0.5x from 640x480 to 1280x1024, and at 1x from 1600x1200 onwards
+
+exec binds-xonotic.cfg
+
+seta menu_skin "luma"
+set menu_slowmo 1
+seta menu_sounds 0 "enables menu sound effects. 1 enables click sounds, 2 also enables hover sounds"
+seta menu_tooltips 1 "menu tooltips: 0 disabled, 1 enabled, 2 also shows cvar or console command (when available) changed or executed by the item"
+set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!"
+set menu_showboxes 0 "show item bounding boxes (debug)"
+set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list"
+set menu_force_on_disconnection 1 "force to show the menu this number of seconds after you get disconnected (0 to disable)"
+
+r_textbrightness 0.2
+r_textcontrast 0.8
+r_textshadow 0
+r_font_postprocess_blur 1
+r_font_postprocess_outline 1
+
+// good settings for these fonts
+con_chat 5
+con_chatpos -9
+con_chatsize 10
+con_chatwidth 0.6
+con_notify 0
+con_notifysize 10
+con_notifyalign 0
+con_textsize 10
+
+seta sbar_info_pos 0 "Y-axis distance from lower right corner for engine info prints"
+
+// scoreboard
+seta scoreboard_columns default
+
+// keep old scoreboard cvars for compatibility's sake
+// they've been replaced by hud_panel_scoreboard_* cvars
+// TODO remove them after a future release (0.8.2+)
+seta scoreboard_border_thickness 1 "scoreboard border thickness"
+seta scoreboard_accuracy_border_thickness 1 "accuracy stats border thickness"
+seta scoreboard_accuracy_doublerows 0 "use two rows instead of one"
+seta scoreboard_accuracy_nocolors 0 "don't use colors displaying accuracy stats"
+seta scoreboard_accuracy 1 "show weapon accuracy stats panel on scoreboard; colors can be configured with accuracy_color* cvars"
+seta scoreboard_color_bg_r 0.125 "red color component of the scoreboard background"
+seta scoreboard_color_bg_g 0.55 "green color component of the scoreboard background"
+seta scoreboard_color_bg_b 0.875 "blue color component of the scoreboard background"
+seta scoreboard_color_bg_team 0.6 "team color multiplier of the scoreboard background"
+seta scoreboard_alpha_bg 0.7 "scoreboard background alpha"
+seta scoreboard_alpha_fg 1 "scoreboard foreground alpha"
+seta scoreboard_alpha_name 0.9 "alpha of player text in scoreboard list other than self"
+seta scoreboard_alpha_name_self 1 "alpha of player text in scoreboard list of self"
+seta scoreboard_fadeinspeed 10 "speed at which scoreboard fades in, higher is faster (0 = instant)"
+seta scoreboard_fadeoutspeed 5 "speed at which scoreboard fades out, higher is faster (0 = instant)"
+seta scoreboard_highlight 1 "enable highlighting for rows and columns in the scoreboard"
+seta scoreboard_highlight_alpha 0.08 "highlight alpha value (depends on hud_scoreboard_highlight 1)"
+seta scoreboard_highlight_alpha_self 0.3 "self highlight alpha value"
+seta scoreboard_offset_left 0.15 "how far (by percent) the scoreboard is offset from the left screen edge"
+seta scoreboard_offset_right 0.15 "how far (by percent) the scoreboard is offset from the right screen edge"
+seta scoreboard_offset_vertical 0.05 "how far (by percent) the scoreboard is offset from the top and bottom of the screen"
+seta scoreboard_bg_scale 0.25 "scale for the tiled scoreboard background"
+seta scoreboard_respawntime_decimals 1 "decimal places to show for the respawntime countdown display on the scoreboard"
+seta scoreboard_dynamichud 0 "apply the dynamic hud effects to the scoreboard"
+
+seta accuracy_color_levels "0 20 100" "accuracy values at which a specified color (accuracy_color<X>) will be used. If your accuracy is between 2 of these values then a mix of the Xth and X+1th colors will be used. You can specify up to 10 values, in increasing order"
+seta accuracy_color0 "1 0 0"
+seta accuracy_color1 "1 1 0"
+seta accuracy_color2 "0 1 0"
+
+// for menu server list (eventually make them have engine support?)
+seta menu_slist_showfull 1 "show servers even if they are full and have no slots to join"
+seta menu_slist_showempty 1 "show servers even if they are no empty and have no opponents to play against"
+seta menu_slist_modfilter "" // set to either: !modname or modname. modname of = means "same as we are running now".
+
+// other serverlist cvars
+seta menu_slist_categories 1
+seta menu_slist_categories_onlyifmultiple 1
+seta menu_slist_purethreshold 0
+seta menu_slist_modimpurity 0
+seta menu_slist_recommendations 3
+seta menu_slist_recommendations_maxping 150
+seta menu_slist_recommendations_minfreeslots 1
+seta menu_slist_recommendations_minhumans 0
+seta menu_slist_recommendations_purethreshold -1
+
+// serverlist category override cvars
+seta menu_slist_categories_CAT_FAVORITED_override ""
+seta menu_slist_categories_CAT_RECOMMENDED_override ""
+seta menu_slist_categories_CAT_NORMAL_override ""
+seta menu_slist_categories_CAT_SERVERS_override "CAT_NORMAL"
+seta menu_slist_categories_CAT_XPM_override ""
+seta menu_slist_categories_CAT_MODIFIED_override ""
+seta menu_slist_categories_CAT_OVERKILL_override ""
+seta menu_slist_categories_CAT_INSTAGIB_override ""
+seta menu_slist_categories_CAT_DEFRAG_override ""
+
+seta menu_weaponarena ""
+
+seta menu_maxplayers 16 "maxplayers value when the menu starts a game"
+
+// useful keybind to maximize the chat area temporarily
+// HUD code takes care of many of these now...
+//set _backup_con_chatvars_set 0
+//alias _restore_con_chatvars_0 ""
+//alias _restore_con_chatvars_1 "set _backup_con_chatvars_set 0; con_chatpos $_backup_con_chatpos; con_chat $_backup_con_chat; con_notify $_backup_con_notify; con_chattime $_backup_con_chattime; cl_deathscoreboard $_backup_cl_deathscoreboard; scr_centertime $_backup_scr_centertime;r_track_sprites $_backup_r_track_sprites"
+//alias _restore_con_chatvars "_restore_con_chatvars_$_backup_con_chatvars_set"
+//alias _backup_con_chatvars_0 "set _backup_con_chatvars_set 1; set _backup_con_chatpos $con_chatpos; set _backup_con_chat $con_chat; set _backup_con_notify $con_notify; set _backup_con_chattime $con_chattime; set _backup_cl_deathscoreboard $cl_deathscoreboard; set _backup_scr_centertime $scr_centertime;set _backup_r_track_sprites $r_track_sprites"
+//alias _backup_con_chatvars_1 ""
+//alias _backup_con_chatvars "_backup_con_chatvars_$_backup_con_chatvars_set"
+//alias +con_chat_maximize "_backup_con_chatvars; con_chatpos -9; con_chat 100; con_notify 0; con_chattime 3600; cl_deathscoreboard 0; scr_centertime 0; r_track_sprites 0"
+//alias -con_chat_maximize "_restore_con_chatvars"
+
+set _con_chat_maximized 0
+set _backup_con_chatvars_set 0
+alias _restore_con_chatvars_0 ""
+alias _restore_con_chatvars_1 "set _backup_con_chatvars_set 0; con_notify $_backup_con_notify; con_chattime $_backup_con_chattime; cl_deathscoreboard $_backup_cl_deathscoreboard; scr_centertime $_backup_scr_centertime;r_track_sprites $_backup_r_track_sprites"
+alias _restore_con_chatvars "_restore_con_chatvars_$_backup_con_chatvars_set"
+alias _backup_con_chatvars_0 "set _backup_con_chatvars_set 1; set _backup_con_notify $con_notify; set _backup_con_chattime $con_chattime; set _backup_cl_deathscoreboard $cl_deathscoreboard; set _backup_scr_centertime $scr_centertime;set _backup_r_track_sprites $r_track_sprites"
+alias _backup_con_chatvars_1 ""
+alias _backup_con_chatvars "_backup_con_chatvars_$_backup_con_chatvars_set"
+alias +con_chat_maximize "_con_chat_maximized 1; _backup_con_chatvars; con_notify 0; con_chattime 3600; cl_deathscoreboard 0; scr_centertime 0; r_track_sprites 0"
+alias -con_chat_maximize "_con_chat_maximized 0; _restore_con_chatvars"
+
+// tab completion
+set con_completion_playdemo    *.dem
+set con_completion_timedemo    *.dem
+set con_completion_ply         *.dem
+set con_completion_tdem                *.dem
+set con_completion_exec                *.cfg
+set con_completion_chmap       map
+set con_completion_devmap      map
+set con_completion_gotomap     map
+set con_completion_vmap                map
+set con_completion_vnextmap    map
+set con_completion_vdomap      map
+set con_completion_playermodel "models/player/*.iqm"
+
+// helper
+// these non-saved engine cvars shall be saved
+alias makesaved "seta $1 \"${$1 ?}\""
+makesaved cl_maxfps_alwayssleep
+makesaved cl_port
+makesaved gl_finish
+makesaved net_slist_queriespersecond
+makesaved r_ambient
+makesaved r_drawviewmodel
+makesaved r_showsurfaces
+makesaved r_subdivisions_tolerance
+makesaved skill
+makesaved vid_gl13
+makesaved vid_gl20
+makesaved v_idlescale
+makesaved v_kicktime
+makesaved music_playlist_list0
+makesaved music_playlist_random0
+
+cl_netfps 60 // should match or be a multiple of sys_ticrate
+
+seta gl_texturecompression 0
+gl_texturecompression_color 1
+gl_texturecompression_gloss 1
+gl_texturecompression_glow 1
+gl_texturecompression_lightcubemaps 1
+gl_texturecompression_q3bsplightmaps 0
+gl_texturecompression_sky 1
+
+cl_maxfps 200
+
+seta menu_mouse_absolute 1 "use the OS mouse pointer motion for menu"
+seta menu_mouse_speed 1 "speed multiplier for the mouse in the menu (does not affect in-game aiming)"
+set menu_use_default_hostname 1
+alias sethostname "set menu_use_default_hostname 0; hostname $*"
+
+seta cl_weaponpriority "vaporizer hmg rpc vortex fireball mortar machinegun hagar rifle arc electro devastator crylink minelayer shotgun shockwave hlac tuba blaster porto seeker hook" "weapon priority list"
+seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wheel makes use of the weapon priority list (the special value 2 uses the weapon ID list for cycling)"
+seta cl_weaponpriority0 "rpc devastator mortar hagar seeker fireball"                   "use weapon_priority_0_prev for prev gun from this list, weapon_priority_0_best for best gun, weapon_priority_0_next for next gun.  Default value: explosives"
+seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave"   "use weapon_priority_1_prev for prev gun from this list, weapon_priority_1_best for best gun, weapon_priority_1_next for next gun.  Default value: energy"
+seta cl_weaponpriority2 "vaporizer vortex rifle"                                        "use weapon_priority_2_prev for prev gun from this list, weapon_priority_2_best for best gun, weapon_priority_2_next for next gun.  Default value: hitscan exact"
+seta cl_weaponpriority3 "vaporizer hmg vortex rifle machinegun shotgun shockwave"       "use weapon_priority_3_prev for prev gun from this list, weapon_priority_3_best for best gun, weapon_priority_3_next for next gun.  Default value: hitscan all"
+seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun shockwave"  "use weapon_priority_4_prev for prev gun from this list, weapon_priority_4_best for best gun, weapon_priority_4_next for next gun.  Default value: spam weapons"
+seta cl_weaponpriority5 "blaster shockwave hook porto"                                  "use weapon_priority_5_prev for prev gun from this list, weapon_priority_5_best for best gun, weapon_priority_5_next for next gun.  Default value: weapons for moving"
+seta cl_weaponpriority6 ""                                                              "use weapon_priority_6_prev for prev gun from this list, weapon_priority_6_best for best gun, weapon_priority_6_next for next gun"
+seta cl_weaponpriority7 ""                                                              "use weapon_priority_7_prev for prev gun from this list, weapon_priority_7_best for best gun, weapon_priority_7_next for next gun"
+seta cl_weaponpriority8 ""                                                              "use weapon_priority_8_prev for prev gun from this list, weapon_priority_8_best for best gun, weapon_priority_8_next for next gun"
+seta cl_weaponpriority9 ""                                                              "use weapon_priority_9_prev for prev gun from this list, weapon_priority_9_best for best gun, weapon_priority_9_next for next gun"
+seta cl_weaponimpulsemode 0 "0: only cycle between currently usable weapons in weapon priority order; 1: cycle between all possible weapons on a key in weapon priority order"
+
+alias _gl_flashblend_update_00 "gl_flashblend 1"
+alias _gl_flashblend_update_10 "gl_flashblend 0"
+alias _gl_flashblend_update_01 "gl_flashblend 0"
+alias _gl_flashblend_update_11 "gl_flashblend 0"
+alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_showsurfaces"
+
+set cl_handicap 1      "multiplies damage received and divides damage dealt NOTE: reconnect or use 'sendcvar cl_handicap' to update the choice."
+
+seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice."
+
+seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway."
+
+seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"
+
+seta cl_race_cptimes_showself 1 "Always show your own times as well as the current best on checkpoints in Race/CTS"
+seta cl_race_cptimes_onlyself 0 "Only show your own times on checkpoints in Race/CTS"
+
+set cl_stripcolorcodes 0       "experimental feature (notes: strips ALL color codes from messages!)"
+
+// Demo camera
+set camera_enable              0       "Enables the camera for demo playback"
+set camera_free                0       "Free camera instead of chasing the player"
+set camera_reset               0       "Resets the camera position and switch to chase mode"
+set camera_speed_roll          0.9     "Camera rotation speed"
+set camera_speed_chase                 4       "Camera movement speed on the x/y/z axis while chasing the player"
+set camera_speed_free          8       "Camera movement speed on the x/y/z axis in free mode"
+set camera_speed_attenuation   10      "Camera movements attenuation factor. Bigger is smoother. Applies to mouse movements"
+set camera_mouse_threshold     0.5     "Use to ignore small mouse movements. This allows for smoother camera control"
+set camera_chase_smoothly      0       "Attenuate player movements (only in chase mode)"
+set camera_look_player         0       "Always look to the player. Mouse input is ignored in this mode"
+set camera_look_attenuation    8       "Attenuation of \"looking\" movements, only if camera_look_player is set. Bigger is smoother"
+set camera_forward_follows     1       "0: Move the camera forwards without changing altitude. 1: Move towards what you are looking"
+
+// "Gentle mode": show no blood
+seta cl_gentle 0               "client side gentle mode, master switch for removing both gibs and messages"
+seta cl_gentle_gibs 0          "client side gentle mode (only replaces gibs); when set to 1, white smoke replaces gibs, when set to 2, colorful clouds replace gibs"
+seta cl_gentle_messages 0      "client side gentle mode (only replaces frag messages/centerprints)"
+seta cl_gentle_damage 0        "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomly colored flash is used instead"
+
+set cl_jetpack_attenuation 2 "jetpack sound attenuation"
+
+set cl_warpzone_usetrace 1 "do not touch"
+
+set cl_effects_lightningarc_simple 0
+set cl_effects_lightningarc_segmentlength 64
+set cl_effects_lightningarc_drift_start 0.45
+set cl_effects_lightningarc_drift_end 0.1
+set cl_effects_lightningarc_branchfactor_start 0.25
+set cl_effects_lightningarc_branchfactor_add 0.1
+
+set menu_updatecheck 1 "check for updates"
+set menu_updatecheck_getpacks 1 "get update packs from update server"
+
+set cl_loddistance1 1024
+set cl_loddistance2 3072
+seta cl_playerdetailreduction 4        "the higher, the less detailed player models are displayed (LOD)"
+seta cl_modeldetailreduction 1 "the higher, the less detailed certain map models are displayed (LOD)"
+
+seta cl_casings_maxcount 100 "maximum amount of shell casings (must be at least 1)"
+seta cl_gibs_maxcount 100 "maximum amount of gibs (must be at least 1)"
+
+//cl_gunalign calculator
+seta menu_cl_gunalign 3 "Gun alignment; 1 = center (if allowed by g_shootfromclient) or right, 2 = center (if allowed by g_shootfromclient) or left, 3 = right only, 4 = left only"
+alias _gunalign_01 "cl_gunalign 1"
+alias _gunalign_02 "cl_gunalign 2"
+alias _gunalign_03 "cl_gunalign 3"
+alias _gunalign_04 "cl_gunalign 4"
+alias _gunalign_11 "cl_gunalign 2"
+alias _gunalign_12 "cl_gunalign 1"
+alias _gunalign_13 "cl_gunalign 4"
+alias _gunalign_14 "cl_gunalign 3"
+alias _gunalign_update "_gunalign_$v_flipped$menu_cl_gunalign"
+
+set _menu_alpha "" // will be set by menu QC to the current fading of the menu, can be used by CSQC to fade items
+set _menu_initialized 0 "is 0 on first menu loading, 1 later"
+
+seta cl_noantilag 0 "turn this on if you believe antilag is bad"
+
+set cl_accuracy_data_share 0 "1 share my weapon accuracy data statistics with other players, 0 keep my weapon accuracy data statistics hidden"
+set cl_accuracy_data_receive 0 "1 receive weapon accuracy data statistics at the end of the match"
+
+set developer_csqcentities 0 "csqc entity spam"
+
+seta cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_defaultcharacter 0)"
+seta cl_forceplayercolors 0 "make enemies look like your own color (requires server to have sv_defaultcharacter 0); set it to 2 to enable it even in teamplay (only when there is exactly one enemy team)"
+seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
+seta cl_forcemyplayerskin 0 "set to the skin number you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
+seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_color) for your own player model (ignored in teamplay; does not affect how enemies look with cl_forceplayermodels)"
+seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce perceived lag"
+seta cl_movement_intermissionrunning 0 "keep velocity after the match ends, players may appear to continue running while stationary"
+
+set debugdraw 0
+set debugdraw_filter ""
+set debugdraw_filterout ""
+set debugtrace 0
+
+// FIXME remove this when the engine feature FINALLY MAYBE works
+r_glsl_skeletal 0
+
+// animation tuning
+set cl_lerpanim_maxdelta_framegroups 0.05 // must be faster than fastest weapon refire
+set cl_lerpanim_maxdelta_server 0.1 // must be slower than slowest server controlled anim (e.g. animinfo stuff)
+
+// autodemo deleting
+seta cl_autodemo_delete_keeprecords 0 "when 1, records with a newly made race/cts demo are kept even if cl_autodemo_delete is used to delete demos"
+
+// freeze camera
+set cl_lockview 0 "when 1, the camera does not move any more"
+
+// we now use mastervolume
+volume 1
+
+// sucks less than the old one
+cl_decals_newsystem 1
+
+scr_conalpha 1
+scr_conalpha2factor 0.3
+scr_conalpha3factor 1
+scr_conalphafactor 0.8
+scr_conbrightness 0.35
+scr_conforcewhiledisconnected 1
+scr_conscroll2_x 0.11
+scr_conscroll2_y 0.2
+scr_conscroll3_x 0
+scr_conscroll3_y 0
+scr_conscroll_x -0.1
+scr_conscroll_y -0.3
+
+scr_conforcewhiledisconnected 0
+scr_infobar_height 12
+
+// DP cannot properly detect this, so rather turn off the detection
+r_texture_dds_load_alphamode 2
+r_texture_dds_swdecode 1 // SW decode to quarter res if we want to load DDS but don't support the extension for it
+r_texture_dds_load_logfailure 0 // this engine feature SUCKS
+set vid_netwmfullscreen 0 // doesn't support non-native res
+
+// particles optimization
+r_drawparticles_nearclip_min 8
+r_drawparticles_nearclip_max 16
+
+r_cullentities_trace 0
+
+// exact gloss looks better, e.g. on g-23
+r_shadow_glossexact 1
+r_shadow_glossintensity 1
+
+// use fake light if map has no lightmaps
+r_fakelight 1
+
+r_water_hideplayer 1 // hide your own feet/player model in refraction views, this way you don't see half of your body under water
+r_water_refractdistort 0.019
+
+set cl_rainsnow_maxdrawdist 2048
+
+// equalize looks better than fullbright
+r_equalize_entities_fullbright 1
+
+// safe font defaults
+r_font_hinting 1
+r_font_disable_freetype 0
+r_font_size_snapping 4
+
+// database management
+set cl_db_saveasdump 0 "write client.db in dump format (loads slower, easier to read/parse)"
+
+// uid2name
+seta cl_allow_uid2name -1 "-1 = ask if the player wants to disable/enable this feature, 0 = disable, 1 = enable uid2name (allows showing your name in race rankings for instance)"
+seta cl_allow_uidtracking 1 "-1 = ask if the player wants to disable/enable this feature, 0 = disable, 1 = enable uid tracking (allows associating your data with your player ID)"
+// FIXME set to -1 before release, once we have a dialog for this!
+
+// polygonoffset for submodel SUCKS SUCKS SUCKS (only a hack for quake1, we don't need that)
+r_polygonoffset_submodel_offset 0
+r_polygonoffset_submodel_factor 0
+// decals: need a higher polygonoffset than default to not compete with _decal surfaces too much
+r_polygonoffset_decals_offset -28
+r_polygonoffset_decals_factor 0
+
+// loading screen
+scr_loadingscreen_background 0
+scr_loadingscreen_barcolor "0 0.5 1"
+scr_loadingscreen_barheight 12
+scr_loadingscreen_count 1
+scr_loadingscreen_firstforstartup 1
+scr_loadingscreen_scale 999
+scr_loadingscreen_scale_base 1
+scr_loadingscreen_scale_limit 2
+
+// other config files
+exec effects-normal.cfg
+exec crosshairs.cfg
+exec gamemodes-client.cfg
+exec notifications.cfg
+
+seta cl_physics "default" "client selected physics set"
+
+// hud cvar descriptions and common settings
+exec _hud_common.cfg
+exec _hud_descriptions.cfg
+// exec the default skin config
+// please add any new cvars into the hud_save script in qcsrc/client/hud_config.qc for consistency
+exec hud_luma.cfg
+
+// enable menu syncing - must be after files that call menu_sync on startup - see alias menu_sync ""
+alias menu_sync "menu_cmd sync"
+
+seta cl_items_nofade 0
+seta cl_animate_items 1
+seta cl_ghost_items 0.45 "enable ghosted items (when between 0 and 1, overrides the alpha value)"
+seta cl_ghost_items_color "-1 -1 -1" "color of ghosted items, 0 0 0 leaves the color unchanged"
+seta cl_simple_items 0 "enable simple items (if server allows)"
+set cl_simpleitems_postfix "_luma" "posfix to add fo model name when simple items are enabled"
+set cl_fullbright_items 0 "enable fullbright items (if server allows, controlled by g_fullbrightitems)"
+set cl_weapon_stay_color "2 0.5 0.5" "Color of picked up weapons when g_weapon_stay > 0"
+set cl_weapon_stay_alpha 0.75 "Alpha of picked up weapons when g_weapon_stay > 0"
+
+seta cl_showspectators 0 "Show who's spectating you if server has sv_showspectators enabled"
+
+// Facility for config.cfg use ONLY.
+// Interpreted in post-config.cfg.
+seta menu_forced_saved_cvars "" "These cvars will always be saved, despite engine/Xonotic cvar saving status"
+set menu_reverted_nonsaved_cvars "" "These cvars are currently marked as saved in the flags, but have been reverted and won't stay saved. INTERNAL USE ONLY."
index ae5df4a1ab98818c9dd0d2e127fe002cfc211c5a..634943c581dfd85e7c94b2fef04bc0f3b704ad93 100644 (file)
@@ -2,7 +2,7 @@
 //  Overkill Mod
 // ==============
 
-exec defaultXonotic.cfg
+exec defaultServer.cfg
 exec balance-overkill.cfg
 exec physicsOverkill.cfg
 
diff --git a/defaultServer.cfg b/defaultServer.cfg
new file mode 100644 (file)
index 0000000..ed24832
--- /dev/null
@@ -0,0 +1,548 @@
+// this should reset most cvars and aliases affecting gameplay to their defaults
+// note that it doesn't reset all server cvars,
+// some are shared with the client and so are left in defaultXonotic.cfg
+
+
+// taunts and voices
+set sv_taunt 1 "allow taunts on the server"
+set sv_autotaunt 1 "allow autotaunts on the server"
+
+// server settings
+hostname "Xonotic $g_xonoticversion Server"
+set sv_mapchange_delay 5
+set minplayers 0 "number of players playing at the same time (if not enough real players are there the remaining slots are filled with bots)"
+
+// restart server if all players hit "ready"-button
+set sv_ready_restart 0 "allow a map to be restarted once all players pressed the \"ready\" button"
+set sv_ready_restart_after_countdown 0 "reset players and map items after the countdown ended, instead of at the beginning of the countdown"
+set sv_ready_restart_repeatable 0      "allows the players to restart the game as often as needed"
+
+//nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
+set teamplay_lockonrestart 0 "lock teams once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
+
+set g_maxplayers 0     "maximum number of players allowed to play at the same time, set to 0 to allow all players to join the game"
+set g_maxplayers_spectator_blocktime 5 "if the players voted for the \"nospectators\" command, this setting defines the number of seconds a observer/spectator has time to join the game before he gets kicked"
+
+// tournament mod
+set g_warmup 0 "split the game into a warmup- and match-stage"
+set g_warmup_limit 0   "limit warmup-stage to this time (in seconds); if set to -1 the warmup-stage is not affected by any timelimit, if set to 0 the usual timelimit also affects warmup-stage"
+set g_warmup_allow_timeout 0   "allow calling timeouts in the warmup-stage (if sv_timeout is set to 1)"
+set g_warmup_allguns 1 "provide more weapons on start while in warmup: 0 = normal start weapons, 1 = all guns available on the map, 2 = all normal weapons"
+set g_warmup_majority_factor 0.8 "minimum percentage of players ready needed for warmup to end"
+
+set g_chat_nospectators 0      "if 0 spec/observer chat is always visible to the player, if 1 it is never visible to players, if 2 it is only visible to players during warmup stage"
+set sv_vote_nospectators 0     "only players can call a vote (thus spectators and observers can't call a vote): 0 = all people can vote, 1 = spectators can vote in warmup stage, 2 = only players can vote (no exceptions)."
+
+alias g_tourney "g_tourney_$1"
+alias g_tourney_1 "g_warmup 1; g_chat_nospectators 2; sv_vote_nospectators 1"
+alias g_tourney_0 "g_warmup 0; g_chat_nospectators 0; sv_vote_nospectators 0"
+
+set sv_timeout 0       "allow a player to call a timeout, this will pause the game for some time"
+set sv_timeout_length 120      "how long the game will be paused at max, in seconds"
+set sv_timeout_number 2        "how many timeouts one player is allowed to call (gets reset after a restart)"
+set sv_timeout_leadtime 4      "how long the players will be informed that a timeout was called before it starts, in seconds"
+set sv_timeout_resumetime 3    "how long the remaining timeout-time will be after a player called the timein command"
+
+set g_allow_oldvortexbeam 0 "If enabled, clients are allowed to use old v2.3 Vortex beam"
+
+set g_telefrags 1 "telefragging, i.e. killing someone who stands in the way of someone who is teleporting"
+set g_telefrags_teamplay 1 "never telefrag team mates"
+set g_telefrags_avoid 1 "when teleporters have a random destination, avoid teleporting to locations where a telefrag would happen"
+set g_teleport_maxspeed 0 "maximum speed that a player can keep when going through a teleporter (if a misc_teleporter_dest also has a cap the smallest one of these will be used), 0 = don't limit, -1 = keep no speed"
+
+set g_respawn_ghosts 1 "if 1 dead bodies become ghosts and float away when the player respawns"
+set g_respawn_ghosts_speed 5 "the speed with which respawn ghosts float and rotate"
+set g_respawn_ghosts_maxtime 6 "maximum amount of time a respawn ghost can last, minimum time is half this value. 0 disables and ghosts fade when the body would"
+
+set sv_gibhealth 100 "Minus health a dead body must have in order to get gibbed"
+
+// use default physics
+set sv_friction_on_land 0
+set sv_friction_slick 0.5
+
+set sv_slick_applygravity 0
+
+set sv_aircontrol_backwards 0 "apply forward aircontrol options to backward movement"
+set sv_aircontrol_sidewards 0 "apply forward aircontrol options to sideward movement"
+
+set sv_player_viewoffset "0 0 35" "view offset of the player model"
+set sv_player_mins "-16 -16 -24" "playermodel mins"
+set sv_player_maxs "16 16 45" "playermodel maxs"
+set sv_player_crouch_viewoffset "0 0 20" "view offset of the player model when crouched"
+set sv_player_crouch_mins "-16 -16 -24" "mins of a crouched playermodel"
+set sv_player_crouch_maxs "16 16 25" "maxs of a crouched playermodel"
+
+set sv_doublejump 0 "allow Quake 2-style double jumps"
+set sv_jumpspeedcap_min "" "lower bound on the baseline velocity of a jump; final velocity will be >= (jumpheight * min + jumpheight)"
+set sv_jumpspeedcap_max "" "upper bound on the baseline velocity of a jump; final velocity will be <= (jumpheight * max + jumpheight)"
+set sv_jumpspeedcap_max_disable_on_ramps 0 "disable upper baseline velocity bound on ramps to preserve the old rampjump style"
+set sv_track_canjump 0 "track if the player released the jump key between 2 jumps to decide if they are able to jump or not"
+
+set sv_precacheplayermodels 1
+set sv_precacheweapons 0
+set sv_precacheitems 0
+set sv_spectator_speed_multiplier 1.5
+set sv_spectate 1 "if set to 1, new clients are allowed to spectate or observe the game, if set to 0 joining clients spawn as players immediately (no spectating)"
+set sv_defaultcharacter 0 "master switch, if set to 1 the further configuration for replacing all player models, skins and colors is taken from the sv_defaultplayermodel, sv_defaultplayerskin and sv_defaultplayercolors variables"
+set sv_defaultcharacterskin 0 "if set to 1 the further configuration for replacing all skins is taken from the sv_defaultplayerskin variables"
+set sv_defaultplayermodel "models/player/erebus.iqm" "default model selection, only works if sv_defaultcharacter is set to 1; you may append a :<skinnumber> suffix to model names; you can specify multiple, separated by space, and a random one will be chosen"
+set sv_defaultplayerskin 0 "each model has 1 or more skins (combination of model and skin = character), set which skin of the model you wish the default character to have, only works if sv_defaultcharacter is set to 1; can be overridden by :<skinnumber> suffix in sv_defaultplayermodel"
+set sv_defaultplayermodel_red ""       "\"\" means see sv_defaultplayermodel"
+set sv_defaultplayerskin_red 0
+set sv_defaultplayermodel_blue "" "\"\" means see sv_defaultplayermodel"
+set sv_defaultplayerskin_blue 0
+set sv_defaultplayermodel_yellow "" "\"\" means see sv_defaultplayermodel"
+set sv_defaultplayerskin_yellow 0
+set sv_defaultplayermodel_pink "" "\"\" means see sv_defaultplayermodel"
+set sv_defaultplayerskin_pink 0
+set sv_defaultplayercolors ""  "set to 16*shirt+pants to force a color, note: it does NOT depend on defaultcharacter! Set to \"\" to disable"
+set sv_autoscreenshot 0 "if set to 1, the server forces all clients to create a local screenshot once the map ended"
+net_messagetimeout 30
+net_connecttimeout 30
+sv_jumpstep 1 // step up stairs while jumping, makes it easier to reach ledges
+
+set sv_shownames_cull_distance 2500 "distance after which to not send origin/health/armor of another player"
+
+set bot_config_file bots.txt "Name and path of the bot configuration file"
+set bot_number 0       "Minimum number of bots"
+set bot_usemodelnames 0        "Use player model names for bot names"
+set bot_nofire 0       "When set, bots never fire. Mainly for testing in g_waypointeditor mode"
+set bot_prefix [BOT]   "Prefix in front of the bot names"
+set bot_suffix ""      "Suffix behind the bot names"
+set skill_auto 0       "when 1, \"skill\" gets adjusted to match the best player on the map"
+set bot_debug_tracewalk 0 "Enable visual indicators for short-term navigation. Green: Goal Reached / Yellow: Obstacle found / Red: Unsolvable obstacle found"
+set bot_debug_goalstack 0 "Visualize the current path that each bot is following. Use with as few bots as possible."
+set bot_wander_enable 1 "Have bots wander around if they are unable to reach any useful goal. Disable only for debugging purposes."
+// general bot AI cvars
+set bot_ai_thinkinterval 0.05
+set bot_ai_strategyinterval 5 "How often a new objective is chosen"
+set bot_ai_enemydetectioninterval 2 "How often bots pick a new target"
+set bot_ai_enemydetectionradius 10000 "How far bots can see enemies"
+set bot_ai_dodgeupdateinterval 0.2 "How often scan for items to dodge. Currently not in use."
+set bot_ai_chooseweaponinterval 0.5 "How often the best weapon according to the situation will be chosen"
+set bot_ai_dangerdetectioninterval 0.25 "How often scan for waypoints with dangers near"
+set bot_ai_dangerdetectionupdates 64 "How many waypoints will be considered for danger detection"
+set bot_ai_aimskill_blendrate 2        "How much correction will be applied to the aiming angle"
+set bot_ai_aimskill_fixedrate 15
+set bot_ai_aimskill_firetolerance_distdegrees 100
+set bot_ai_aimskill_firetolerance_mindegrees 2 "Minimum angle tolerance. Used on large distances"
+set bot_ai_aimskill_firetolerance_maxdegrees 60 "Maximum firing angle. Used on close range"
+set bot_ai_aimskill_mouse 1 "How much of the aiming filters are applied"
+set bot_ai_keyboard_distance 250 "Keyboard emulation is disabled after this distance to the goal"
+set bot_ai_keyboard_threshold 0.57
+set bot_ai_aimskill_offset 0.3 "Amount of error induced to the bots aim"
+set bot_ai_aimskill_think 1 "Aiming velocity. Use values below 1 for slower aiming"
+set bot_ai_custom_weapon_priority_distances "300 850"  "Define close and far distances in any order. Based on the distance to the enemy bots will choose different weapons"
+set bot_ai_custom_weapon_priority_far   "vaporizer vortex rifle electro devastator mortar hagar hlac crylink blaster machinegun fireball seeker shotgun shockwave tuba minelayer"      "Desired weapons for far distances ordered by priority"
+set bot_ai_custom_weapon_priority_mid   "vaporizer devastator vortex fireball seeker mortar electro machinegun arc crylink hlac hagar shotgun shockwave blaster rifle tuba minelayer"  "Desired weapons for middle distances ordered by priority"
+set bot_ai_custom_weapon_priority_close "vaporizer vortex shotgun shockwave machinegun arc hlac tuba seeker hagar crylink mortar electro devastator blaster fireball rifle minelayer"  "Desired weapons for close distances ordered by priority"
+set bot_ai_weapon_combo 1      "Enable bots to do weapon combos"
+set bot_ai_weapon_combo_threshold 0.4  "Try to make a combo N seconds after the last attack"
+set bot_ai_friends_aware_pickup_radius "500"   "Bots will not pickup items if a team mate is this distance near the item"
+set bot_ai_ignoregoal_timeout 3        "Ignore goals making bots to get stuck in front of a wall for N seconds"
+set bot_ai_bunnyhop_skilloffset 7      "Bots with skill equal or greater than this value will perform the  \"bunnyhop\" technique"
+set bot_ai_bunnyhop_startdistance 200 "Run to goals located further than this distance"
+set bot_ai_bunnyhop_stopdistance 300 "Stop jumping after reaching this distance to the goal"
+set bot_ai_bunnyhop_firstjumpdelay 0.2 "Start running to the goal only if it was seen for more than N seconds"
+set bot_god 0 "god mode for bots"
+set bot_ai_navigation_jetpack 0 "Enable bots to navigate maps using the jetpack"
+set bot_ai_navigation_jetpack_mindistance 3500 "Bots will try fly to objects located farther than this distance"
+// Better don't touch these, there are hard to tweak!
+set bot_ai_aimskill_order_mix_1st 0.01 "Amount of the 1st filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_mix_2nd 0.1 "Amount of the 2nd filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_mix_3th 0.01 "Amount of the 3th filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_mix_4th 0.05 "Amount of the 4th filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_mix_5th 0.01 "Amount of the 5th filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_filter_1st 0.4 "Position filter"
+set bot_ai_aimskill_order_filter_2nd 0.4 "Movement filter"
+set bot_ai_aimskill_order_filter_3th 0.2 "Acceleration filter"
+set bot_ai_aimskill_order_filter_4th 0.4 "Position prediction filter. Used rarely"
+set bot_ai_aimskill_order_filter_5th 0.5 "Movement prediction filter. Used rarely"
+set bot_ai_timeitems 1 "allow skilled bots to run to important items a little time before respawning"
+set bot_ai_timeitems_minrespawndelay 25 "bots run to items with this minimum respawn delay before respawning"
+
+// waypoint editor enable
+set g_waypointeditor 0
+set g_waypointeditor_auto 0 "Automatically create waypoints for bots while playing; BEWARE, this currently creates too many of them"
+set g_waypointeditor_symmetrical 0 "Enable symmetrical editing of waypoints on symmetrical CTF maps (NOTE: it assumes that the map is perfectly symmetrical). 1: automatically determine origin of symmetry; -1: use custom origin (g_waypointeditor_symmetrical_origin); 2: automatically determine axis of symmetry; -2: use custom axis (g_waypointeditor_symmetrical_axis)"
+set g_waypointeditor_symmetrical_origin "0 0" "Custom origin of symmetry (x y)"
+set g_waypointeditor_symmetrical_order 0 "if >= 2 apply rotational symmetry (around origin of symmetry) of this order, otherwise apply autodetected order of symmetry"
+set g_waypointeditor_symmetrical_axis "0 0" "Custom axis of symmetry (m q parameters of y = mx + q)"
+set bot_ignore_bots 0  "When set, bots don't shoot at other bots"
+set bot_join_empty 0   "When set, bots also play if no player has joined the server"
+set bot_vs_human 0     "Bots and humans play in different teams when set. positive values to make an all-bot blue team, set to negative values to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count). Changes will be correctly applied only from the next game"
+
+set g_spawnshieldtime 1 "number of seconds you are invincible after you spawned, this shield is lost after you fire"
+set g_spawnshield_blockdamage 1 "how much spawn shield protects you from damage (1 = full protection)"
+set g_antilag 2        "AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2 = server side hit scan in the past, 3 = unverified client side hit scan)"
+set g_antilag_nudge 0 "don't touch"
+set g_shootfromeye 0 "shots are fired from your eye/crosshair; visual gun position can still be influenced by cl_gunalign 1 and 2"
+set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from the barrel of your weapon; visual gun position can still be influenced by cl_gunalign 1 and 2"
+set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved to the given y and z coordinates. If set to a string like x y z, the whole shot origin is used"
+set g_pinata 0 "if set to 1 you will not only drop your current weapon when you are killed, but you will drop all weapons that you possessed"
+set g_weapon_stay 0 "1: ghost weapons can be picked up too but give no ammo, 2: ghost weapons refill ammo to one pickup size, thrown guns have no ammo"
+set g_weapon_throwable 1 "if set to 1, weapons can be dropped"
+set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default"
+set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammunition"
+set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn"
+set g_weaponarena "0"  "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\""
+set g_weaponarena_random "0"   "if set to a number, only that weapon count is given on every spawn (randomly)"
+set g_weaponarena_random_with_blaster "1"      "additionally, always provide the blaster in random weapon arena games"
+set g_spawnpoints_auto_move_out_of_solid 0 "if set to 1 you will see a warning if a spawn point was placed inside a solid"
+set g_forced_respawn 0 "if set to 1 and a player died, that player gets automatically respawned once <g_respawn_delay> seconds are over"
+set g_fullbrightplayers 0 "brightens up player models (note that the color, skin or model of the players does not change!)"
+set g_fullbrightitems 0 "brightens up items"
+set g_nodepthtestplayers 0 "disables depth testing on players"
+set g_nodepthtestitems 0 "disables depth testing on items"
+set g_casings 2 "specifies which casings (0: none, 1: only shotgun casings, 2: shotgun and machine gun casings) are sent to the client"
+set g_norecoil 0 "if set to 1 shooting weapons won't make you crosshair to move upwards (recoil)"
+set g_maplist_mostrecent "" "contains the name of the maps that were most recently played"
+set g_maplist_mostrecent_count 3       "number of most recent maps that are blocked from being played again"
+set g_maplist "" "the list of maps to be cycled among (is autogenerated if empty)"
+set g_maplist_index 0  "this is used internally for saving position in maplist cycle"
+set g_maplist_selectrandom 0   "if 1, a random map will be chosen as next map - DEPRECATED in favor of g_maplist_shuffle"
+set g_maplist_shuffle 1        "new randomization method: like selectrandom, but avoid playing the same maps in short succession. This works by taking out the first element and inserting it into g_maplist with a bias to the end of the list"
+set g_maplist_check_waypoints 0        "when 1, maps are skipped if there currently are bots, but the map has no waypoints"
+
+set g_items_mindist 4000 "starting distance for the fading of items"
+set g_items_maxdist 4500 "maximum distance at which an item can be viewed, after which it will be invisible"
+
+set g_grab_range 200 "distance at which dragable objects can be grabbed"
+
+set g_cloaked 0 "display all players mostly invisible"
+set g_player_alpha 1
+set g_player_brightness 0      "set to 2 for brighter players"
+set g_balance_cloaked_alpha 0.25
+
+set g_playerclip_collisions 1 "0 = disable collision testing against playerclips, might be useful on some defrag maps"
+set g_botclip_collisions 1 "0 = disable collision testing against botclips, might be useful on some defrag maps"
+
+set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
+set g_grappling_hook_useammo 0 "use ammunition with the off-hand grappling hook"
+
+set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info"
+set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players"
+set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
+// respawn delay
+set g_respawn_delay_small 2 "small game number of seconds you have to wait before you can respawn again"
+set g_respawn_delay_small_count 0 "Player count per team for g_respawn_delay_small. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)."
+set g_respawn_delay_large 2 "large game number of seconds you have to wait before you can respawn again"
+set g_respawn_delay_large_count 8 "Player count per team for g_respawn_delay_large. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)."
+set g_respawn_delay_max 5 "number of seconds you can wait before you're forced to respawn (only effective with g_forced_respawn 1)"
+set g_respawn_delay_forced 0 "enforce regular respawn delay (prevent gamemode specific respawn delays)"
+set g_respawn_waves 0 "respawn in waves (every n seconds), intended to decrease overwhelming base attacks"
+
+// overtime
+set timelimit_overtime 2 "duration in minutes of one added overtime, added to the timelimit"
+set timelimit_overtimes 0 "how many overtimes to add at max"
+set timelimit_suddendeath 5 "number of minutes suddendeath mode lasts after all overtimes were added and still no winner was found"
+
+// common team values
+set g_tdm 0 "Team Deathmatch: the team who kills their opponents most often wins"
+set g_tdm_on_dm_maps 0 "when this is set, all DM maps automatically support TDM"
+
+set teamplay_mode 4 "default teamplay setting in team games. 1 = no friendly fire, self damage. 2 = friendly fire and self damage enabled. 3 = no friendly fire, but self damage enabled. 4 = obey the cvars g_mirrordamage*, g_friendlyfire* and g_teamdamage*"
+set g_mirrordamage 0.7              "for teamplay_mode 4: mirror damage factor"
+set g_mirrordamage_virtual 1        "for teamplay_mode 4: do not actually apply mirror damage, just show graphics effect for it"
+set g_mirrordamage_onlyweapons 0    "for teamplay_mode 4: only apply mirror damage if the attack was from a weapon"
+set g_friendlyfire 0.5              "for teamplay_mode 4: friendly fire factor"
+set g_friendlyfire_virtual 1        "for teamplay_mode 4: do not actually apply friendly fire, just show graphics effect for it"
+set g_friendlyfire_virtual_force 1  "for teamplay_mode 4: apply force even though damage was made virtual only"
+set g_teamdamage_threshold 40       "for teamplay_mode 4: threshold over which to apply mirror damage"
+set g_teamdamage_resetspeed 20      "for teamplay_mode 4: how fast player's teamdamage count decreases"
+
+set g_balance_teams 1  "automatically balance out players entering instead of asking them for their preferred team"
+set g_balance_teams_prevent_imbalance  1       "prevent players from changing to larger teams"
+set g_balance_teams_scorefactor 0.25 "at the end of the game, take score into account instead of team size by this amount (beware: values over 0.5 mean that a x:0 score imbalance will cause ALL new players to prefer the losing team at the end, despite numbers)"
+set g_changeteam_banned 0      "not allowed to change team"
+set g_changeteam_fragtransfer 0        "% of frags you get to keep when you change teams (rounded down)"
+
+set sv_teamnagger 1 "enable a nag message when the teams are unbalanced"
+
+set g_bloodloss 0   "amount of health below which blood loss occurs"
+
+set g_footsteps 1      "serverside footstep sounds"
+
+set g_throughfloor_debug 0 "enable debugging messages for throughfloor calculations"
+set g_throughfloor_damage_max_stddev 2 "Maximum standard deviation for splash damage"
+set g_throughfloor_force_max_stddev 10 "Maximum standard deviation for splash force"
+set g_throughfloor_min_steps_player 1 "Minimum number of steps for splash damage"
+set g_throughfloor_min_steps_other 1 "Minimum number of steps for splash damage"
+set g_throughfloor_max_steps_player 100 "Maximum number of steps for splash damage"
+set g_throughfloor_max_steps_other 10 "Maximum number of steps for splash damage"
+// note: for damage X, 0.25 * ((1-g_throughfloor_damage)*X / g_throughfloor_damage_max_stddev)^2 steps are used
+// for these numbers:
+//   damage  25: 3
+//   damage  60: 15
+//   damage  80: 25
+//   damage 200: 157
+//   force  250: 10
+//   force  300: 15
+//   force  600: 57
+
+sv_maxvelocity 1000000000
+sv_sound_land ""
+sv_sound_watersplash ""
+
+// startmap_dm is used when running with the -listen or -dedicated commandline options
+set serverconfig server.cfg
+alias loadconfig "cvar_resettodefaults_saveonly; exec ${* !}"
+set _sv_init 0
+alias startmap_dm "set _sv_init 0; map _init/_init; exec $serverconfig; set _sv_init 1"
+
+// score log
+set sv_logscores_console 0     "print scores to server console"
+set sv_logscores_file 0        "print scores to file"
+set sv_logscores_filename scores.log   "filename"
+set sv_logscores_bots 0        "exclude bots by default"
+
+// spam (frag/capture) log
+set sv_eventlog 0      "the master switch for efficiency reasons"
+set sv_eventlog_console 1
+set sv_eventlog_files 0
+set sv_eventlog_files_timestamps 1
+set sv_eventlog_files_counter 0
+set sv_eventlog_files_nameprefix xonotic
+set sv_eventlog_files_namesuffix .log
+
+set nextmap "" "override the maplist when switching to the next map"
+set lastlevel ""
+set quit_when_empty 0  "set to 1, then the server exits when the next level would start but is empty"
+set quit_and_redirect ""       "set to an IP to redirect all players at the end of the match to another server. Set to \"self\" to let all players reconnect at the end of the match (use it to make seamless engine updates)"
+set quit_and_redirect_timer 1.5 "set to number of seconds after quit before performing the connect operation of quit_and_redirect"
+
+// Green's fullbright skins, updated by Samual
+alias sv_fbskin_unique "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors \"\""
+alias sv_fbskin_green "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 51"
+alias sv_fbskin_red "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 68"
+alias sv_fbskin_orange "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 238"
+alias sv_fbskin_rainbow "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 95"
+
+alias sv_fbskin_off "sv_defaultcharacter 0; sv_defaultplayerskin 0; sv_defaultplayercolors \"\""
+
+set sv_servermodelsonly 1
+
+sv_curl_defaulturl "http://www.xonotic.org/contentdownload/getmap.php?file="
+set sv_curl_serverpackages_auto 1 "automatically add packs with *.serverpackage files to sv_curl_serverpackages"
+
+set sv_motd ""
+
+set g_waypoints_for_items 0    "make waypoints out of items, values: 0 = never, 1 = unless the mapper prevents it by worldspawn.spawnflags & 1, 2 = always"
+
+set g_maplist_votable 6 "number of maps that are shown in the map voting at the end of a match"
+set g_maplist_votable_keeptwotime 15 "show only 2 options after this amount of time during map vote screen"
+set g_maplist_votable_timeout 30       "timeout for the map voting; must be below 50 seconds!"
+set g_maplist_votable_suggestions 2
+set g_maplist_votable_suggestions_override_mostrecent 0
+set g_maplist_votable_nodetail 1       "nodetail only shows total count instead of all vote counts per map, so votes don't influence others that much"
+set g_maplist_votable_abstain 0        "when 1, you can abstain from your vote"
+set g_maplist_votable_screenshot_dir "maps levelshots" "where to look for map screenshots"
+
+set sv_vote_gametype 0 "show a vote screen for gametypes before map vote screen"
+set sv_vote_gametype_keeptwotime 10 "show only 2 options after this amount of time during gametype vote screen"
+set sv_vote_gametype_options "dm ctf ca lms tdm ft"
+set sv_vote_gametype_timeout 20
+set sv_vote_gametype_default_current 1 "Keep the current gametype if no one votes"
+
+set g_chat_flood_spl 3 "normal chat: seconds between lines to not count as flooding"
+set g_chat_flood_lmax 2        "normal chat: maximum number of lines per chat message at once"
+set g_chat_flood_burst 2       "normal chat: allow bursts of so many chat lines"
+set g_chat_flood_spl_team 1    "team chat: seconds between lines to not count as flooding"
+set g_chat_flood_lmax_team 2   "team chat: maximum number of lines per chat message at once"
+set g_chat_flood_burst_team 2  "team chat: allow bursts of so many chat lines"
+set g_chat_flood_spl_tell 1    "private chat: seconds between lines to not count as flooding"
+set g_chat_flood_lmax_tell 2   "private chat: maximum number of lines per chat message at once"
+set g_chat_flood_burst_tell 2  "private chat: allow bursts of so many chat lines"
+set g_chat_flood_notify_flooder 1      "when 0, the flooder still can see his own message"
+set g_chat_teamcolors 0        "colorize nicknames in team color for chat"
+set g_chat_tellprivacy 1 "when disabled, tell messages are also sent to the server console log... otherwise they're kept private between players."
+set g_nick_flood_timeout 120 "time after which nick flood protection resets (set to 0 to disable nick flood checking)"
+set g_nick_flood_penalty 0.5 "duration of the nick flood penalty"
+set g_nick_flood_penalty_yellow 3 "number of changes to allow before warning and movement blocking"
+set g_nick_flood_penalty_red 30 "number of changes to allow before totally disorienting the player"
+
+set sv_waypointsprite_deployed_lifetime 10
+set sv_waypointsprite_deadlifetime 1
+set sv_waypointsprite_limitedrange 5120
+
+set sv_itemstime 1 "enable networking of time left until respawn for items such as mega health/armor and powerups"
+
+set g_ban_default_bantime 5400 "90 minutes"
+set g_ban_default_masksize 3   "masksize 0 means banning by UID only, 1 means banning by /8 (IPv6: /32) network, 2 means banning by /16 (IPv6: /48) network, 3 means banning by /24 (IPv6: /56) network, 4 means banning by single IP (IPv6: /64 network)"
+set g_banned_list ""   "format: IP remainingtime IP remainingtime ..."
+set g_banned_list_idmode "1"   "when set, the IP banning system always uses the ID over the IP address (so a user in a banned IP range can connect if they have a valid signed ID)"
+
+// useful vote aliases
+set timelimit_increment 5
+set timelimit_decrement 5
+set timelimit_min 5
+set timelimit_max 60
+
+sv_gameplayfix_delayprojectiles 0
+sv_gameplayfix_q2airaccelerate 1
+sv_gameplayfix_stepmultipletimes 1
+
+// delay for "kill" to prevent abuse
+set g_balance_kill_delay 2
+set g_balance_kill_antispam 5
+
+// this feature is currently buggy in the engine (it appears to PREVENT any dropping in lots of maps, leading to weirdly aligned entities, and in some cases even CAUSES them to drop through solid, like in facing worlds nex)
+sv_gameplayfix_droptofloorstartsolid 0
+
+set sv_foginterval 1 "force enable fog in regular intervals"
+
+set sv_maxidle 0 "kick players idle for more than this amount of time in seconds"
+set sv_maxidle_spectatorsareidle 0 "when sv_maxidle is not 0, assume spectators are idle too"
+set sv_maxidle_slots 0 "when not 0, only kick idlers when this many or less player slots are available"
+set sv_maxidle_slots_countbots 1 "count bots as player slots"
+
+sv_allowdownloads_inarchive 1 // for csprogs.dat
+sv_allowdownloads 0 // download protocol is evil
+
+set g_jump_grunt 0     "Do you make a grunting noise every time you jump? Is it the same grunting noise every time?"
+
+set g_maplist_allow_hidden 0           "allow hidden maps to be, e.g., voted for and in the maplist"
+set g_maplist_allow_frustrating 0      "allow impossible maps to be, e.g., voted for and in the maplist (if set to 2, ONLY impossible maps are allowed)"
+
+set sv_clones 0        "number of clones a player may make (reset by the \"kill\" command)"
+
+set g_ban_sync_uri ""  "sync using this ban list provider (empty string to disable)"
+set g_ban_sync_interval 5      "sync every 5 minutes"
+set g_ban_sync_trusted_servers ""      "request ban lists from these xonotic servers (do not include your own server there, or unbanning may fail)"
+set g_ban_sync_timeout 45      "time out in seconds for the ban sync requests"
+set g_ban_sync_trusted_servers_verify 0        "when set to 1, additional bans sent by the servers are ignored, and only bans for the requested IP are used"
+
+set g_showweaponspawns 1 "1: display waypoints for weapon spawns found on the map when a weapon key is pressed and the weapon is not owned; 2: for dropped weapons too; 3: for all the weapons sharing the same impulse"
+
+// ballistics use physical units, but qu based
+//   Quake-Newton: 1 qN  = 1 qu * 1 g / 1 s^2
+//   Quake-Joule:  1 qJ  = 1 qN * 1 qu
+//   Quake-Pascal: 1 qPa = 1 qN / 1 qu^2
+
+set g_ballistics_mindistance 2 // enable ballistics starting from 2 qu
+set g_ballistics_density_player 0.50 // players are 2x as easy to pass as walls
+set g_ballistics_density_corpse 0.10 // corpses are 10x as easy to pass as walls
+set g_ballistics_penetrate_clips 0 "allow ballistics to pass through weapon clips"
+
+sv_status_show_qcstatus 1      "Xonotic uses this field instead of frags"
+set g_full_getstatus_responses 0       "this currently breaks qstat"
+
+// "Gentle mode": show no blood
+set sv_gentle 0                "force gentle mode for everyone, also remove references to acts of killing from the messages"
+
+set g_jetpack 0 "Jetpack mutator"
+
+set g_hitplots 0 "when set to 1, hitplots are stored by the server to provide a means of proving that a triggerbot was used"
+set g_hitplots_individuals "" "the individuals, by IP, that should have their hitplots recorded"
+
+set bot_navigation_ignoreplayers 0 // FIXME remove this once the issue is solved
+set bot_sound_monopoly 0 "when enabled, only bots can make any noise"
+
+set g_mapinfo_settemp_acl "+*" "ACL for mapinfo setting cvars"
+
+set g_triggerimpulse_accel_power 1 "trigger_impulse accelerator power (applied BEFORE the multiplier)"
+set g_triggerimpulse_accel_multiplier 1 "trigger_impulse accelerator multiplier (applied AFTER the power)"
+set g_triggerimpulse_directional_multiplier 1 "trigger_impulse directional field multiplier"
+set g_triggerimpulse_radial_multiplier 1 "trigger_impulse radial field multiplier"
+
+set sv_weaponstats_file "" "when set to a file name, per-weapon stats get written to that file"
+
+set rescan_pending 0 "set to 1 to schedule a fs_rescan at the end of this match"
+
+set g_mapinfo_allow_unsupported_modes_and_let_stuff_break "0" "set to 1 to be able to force game types using g_ cvars even if the map does not support them"
+set g_mutatormsg "" "mutator message"
+
+set spawn_debug 0 "use all spawns one by one, then abort, to verify all spawnpoints"
+set loddebug 0 "force this LOD level"
+set speedmeter 0 "print landing speeds"
+set waypoint_benchmark 0 "quit after waypoint loading to benchmark bot navigation code"
+set g_debug_bot_commands 0 "print scripted bot commands before executing"
+
+// weapon accuracy stats
+set sv_accuracy_data_share 1 "1 send weapon accuracy data statistics to spectating clients, depends on cl_accuracy_data_share"
+set sv_accuracy_data_send 1 "1 send weapon accuracy data statistics and improved score info to all the clients at the end of the match, depends on cl_accuracy_data_receive, 0 send the current 'player has won' to all the clients"
+
+// debug
+set _independent_players 0 "DO NOT TOUCH"
+set _notarget 0 "NO, REALLY, DON'T"
+
+// otherwise, antilag breaks
+sv_gameplayfix_consistentplayerprethink 1
+
+// improve some minor details
+sv_gameplayfix_gravityunaffectedbyticrate 1
+sv_gameplayfix_nogravityonground 1
+
+set sv_q3acompat_machineshotgunswap 0 "shorthand for swapping machinegun and shotgun (for Q3A map compatibility in mapinfo files)"
+
+set g_movement_highspeed 1 "movement speed modification factor (only changes movement when above maxspeed)"
+
+set g_maxspeed 0 "player speed limit, faster players are killed (0 for unlimited speed)"
+
+// sv_cullentities_trace is 1, so the client doesn't have to
+sv_cullentities_trace 1
+
+// less "lagging" of other players, but also less PL tolerant... let's try this
+sv_clmovement_inputtimeout 0.066 // slightly less than 2 frames, so only one frame can be compensated
+
+// strength sound settings
+set sv_strengthsound_antispam_time 0.1 "minimum distance of strength sounds"
+set sv_strengthsound_antispam_refire_threshold 0.04 "apply minimum distance only if refire of the gun is smaller than this"
+
+// database management
+set sv_db_saveasdump 0 "write server.db in dump format (loads slower, easier to read/parse)"
+
+// allow fullbright
+set sv_allow_fullbright 1 "when set, clients may use r_fullbright on this server without getting a night vision effect overlay"
+
+// auto-teams (team selection by player ID)
+// any player not listed is forced to spectate
+set g_forced_team_red "" "list of player IDs for red team"
+set g_forced_team_blue "" "list of player IDs for blue team"
+set g_forced_team_yellow "" "list of player IDs for yellow team"
+set g_forced_team_pink "" "list of player IDs for pink team"
+set g_forced_team_otherwise "default" "action if a non listed player joins (can be default for default action, spectate for forcing to spectate, or red, blue, yellow, pink)"
+
+// nice alias to set up a match
+// example: g_forced_team_matchsetup stormkeep "mzDo0nO2y3XpFPNbQAyeUucyaejZ9xpiXLYMGU2x3qM=" "BRLOGENSHFEGLE/+Mq3x2UGMYLXipx9ZjeaycuUeyAQ="
+// will set up a match on stormkeep where mzDo0nO2y3XpFPNbQAyeUucyaejZ9xpiXLYMGU2x3qM= and BRLOGENSHFEGLE/+Mq3x2UGMYLXipx9ZjeaycuUeyAQ= play against each other
+alias g_forced_team_matchsetup "map $1; settemp g_forced_team_red \"$2\"; settemp g_forced_team_blue \"$3\"; settemp g_forced_team_yellow \"$4\"; settemp g_forced_team_pink \"$5\"; settemp g_forced_team_otherwise spectate"
+
+// frozen
+set g_frozen_revive_falldamage 0 "Enable reviving from this amount of fall damage"
+set g_frozen_revive_falldamage_health 40 "Amount of health player has if they revived from falling"
+set g_frozen_damage_trigger 1 "if 1, frozen players falling into the void will die instead of teleporting to spawn"
+set g_frozen_force 0.6 "How much to multiply the force on a frozen player with"
+
+// player statistics
+set g_playerstats_gamereport_uri "http://stats.xonotic.org/stats/submit" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
+set g_playerstats_gamereport_ladder ""
+set g_playerstats_playerbasic_uri "http://stats.xonotic.org"
+set g_playerstats_playerdetail_uri "http://stats.xonotic.org/player/me"
+set g_playerstats_playerdetail_autoupdatetime 1800 // automatically update every 30 minutes anyway
+
+// autoscreenshots
+set g_max_info_autoscreenshot 3 "how many info_autoscreenshot entities are allowed"
+
+// mod names for server browser
+// note: the lowest of these that mismatches default is used
+set g_mod_physics "" "Current physics config name"
+set g_mod_balance "" "Current balance config name"
+set g_mod_config  "" "Current config mod name"
+
+// other config files
+exec balance-xonotic.cfg
+exec physicsX.cfg
+exec turrets.cfg
+exec gamemodes-server.cfg
+exec mutators.cfg
+exec monsters.cfg
+exec minigames.cfg
+exec physics.cfg
+
+set sv_join_notices ""
+set sv_join_notices_time 15
+
+set sv_simple_items 1 "allow or forbid client use of simple items"
+
+set sv_showspectators 1 "Show who's spectating who in the player info panel when client has cl_showspectators on. Shouldn't be used on competitive servers, also disable when watching a suspected cheater"
index c23c9cacfa8b20cb2a3fd030ec2a7e094fc73edf..d504b2a617b536278b0b88c554f4926ecabe0c7b 100644 (file)
@@ -2,7 +2,7 @@
 //  Xonotic Defrag
 // ================
 
-exec defaultXonotic.cfg
+exec defaultServer.cfg
 exec balance-xdf.cfg
 exec physicsXDF.cfg
 
index e06df7d828abece621023637618574cde11053c1..fd3449763d4e297c527ba85d3dfff91699519305 100644 (file)
@@ -2,7 +2,7 @@
 //  Xonotic Pro-Mode
 // ==================
 
-exec defaultXonotic.cfg
+exec defaultServer.cfg
 exec balance-xpm.cfg
 
 // general gameplay
index ba8bdb228d0f7116abaf7a7cea39eb25561d122a..b3b23fec76e6619a0bc286bac4d68723f33dac37 100644 (file)
@@ -22,665 +22,18 @@ gameversion_max 65535 // git builds see all versions
 //   gameversion_min = (gameversion / 100) * 100 - 100
 //   gameversion_max = (gameversion / 100) * 100 + 199
 
-// changes a cvar and reports it to the server (for the menu to notify the
-// server about changes)
-alias setreport "set \"$1\" \"$2\" ; sendcvar \"$1\""
-
-seta cl_firststart "" "how many times the client has been run"
-seta cl_startcount 0 "how many times the client has been run"
-
 seta g_configversion 0 "Configuration file version (used to upgrade settings) 0: first run, or previous start was <2.4.1  Later, it's overridden by config.cfg, version ranges are defined in config_update.cfg"
 
-// other aliases
-alias +hook +button6
-alias -hook -button6
-alias +jetpack +button10
-alias -jetpack -button10
-alias +dodge +button11
-alias -dodge -button11
-alias use "impulse 21"
-
-// for backwards compatibility
-// TODO Remove after 0.8 release!
-cl_particles_forcetraileffects 1
-
-alias dropweapon "impulse 17"
-alias +show_info +button7
-alias -show_info -button7
-
-// merge lightmaps up to 2048x2048 textures
-mod_q3bsp_lightmapmergepower 4
-
-// player defaults
-_cl_color "112.211" // same effect as 112, but menuqc can detect this as the default and not intentionally set
-_cl_name ""
-seta _cl_gender 0 "storage cvar for current player gender (0 = undisclosed, 1 = male, 2 = female)"
-_cl_playermodel models/player/erebus.iqm
-_cl_playerskin 0
-
-seta cl_reticle 1 "enable zoom reticles"
-seta cl_reticle_stretch 0 "stretch reticles so they fit the screen (breaks image proportions)"
-seta cl_reticle_normal 1 "draw an aiming reticle when zooming with the zoom button"
-seta cl_reticle_normal_alpha 1 "alpha of the normal reticle"
-seta cl_reticle_weapon 1 "draw custom aiming reticle when zooming with certain weapons"
-seta cl_reticle_weapon_alpha 1 "alpha of the custom reticle"
-
-fov 100
-seta cl_velocityzoom_enabled 0 "velocity based zooming of fov"
-seta cl_velocityzoom_factor 0 "factor of fov zooming (negative values zoom out)"
-seta cl_velocityzoom_type 3 "how to factor in speed, 1 = all velocity in all directions, 2 = velocity only in forward direction (can be negative), 3 = velocity only in forward direction (limited to forward only)"
-seta cl_velocityzoom_speed 1000 "target speed for fov factoring"
-seta cl_velocityzoom_time 0.2  "time value for averaging speed values"
-seta cl_spawnzoom 1 "zoom effect immediately when a player spawns"
-seta cl_spawnzoom_speed 1 "speed at which zooming occurs while spawning"
-seta cl_spawnzoom_factor 2 "factor of zoom while spawning"
-seta cl_zoomfactor 5   "how much +zoom will zoom (1-30)"
-seta cl_zoomspeed 8    "how fast it will zoom (0.5-16), negative values mean instant zoom"
-seta cl_zoomsensitivity 0      "how zoom changes sensitivity (0 = weakest, 1 = strongest)"
-
-seta cl_unpress_zoom_on_spawn 1 "automatically unpress zoom when you spawn"
-seta cl_unpress_zoom_on_death 1 "automatically unpress zoom when you die (and don't allow zoom again while dead)"
-seta cl_unpress_zoom_on_weapon_switch 1 "automatically unpress zoom when you switch a weapon"
-seta cl_unpress_attack_on_weapon_switch 0 "automatically unpress fire and fire1 attack buttons when you switch a weapon"
-
-seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns"
-seta cl_spawn_event_sound 1 "sound effect whenever a player spawns"
-//seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model
-seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points" // managed by effects-.cfg files
-seta cl_spawn_point_dist_min 1200
-seta cl_spawn_point_dist_max 1600
-
-freelook 1
-sensitivity 6
-v_gamma 1
-viewsize 100
-bgmvolume 1
-volume 0.5
-// fullscreen 1024x768x32bit
-vid_bitsperpixel 32
-vid_fullscreen 1
-vid_width 1024
-vid_height 768
-vid_pixelheight 1
-vid_resizable 0 // cannot be turned on before it is sure it cannot cause a r_restart
-vid_desktopfullscreen 1
-prvm_language en
-set _menu_prvm_language ""
-set _menu_vid_width "$vid_width"
-set _menu_vid_height "$vid_height"
-set _menu_vid_pixelheight "$vid_pixelheight"
-set _menu_vid_desktopfullscreen "$vid_desktopfullscreen"
-seta menu_vid_scale 0
-seta menu_vid_allowdualscreenresolution 0
-// 2D resolution 800x600
-vid_conwidth 800
-vid_conheight 600
-// menu_conwidth, menu_conheight are set inside quake.rc
-v_deathtilt 0 // needed for spectators (who are dead to avoid prediction)
-
-// we want to use sRGB for our maps!
-exec sRGB-disable.cfg
-vid_sRGB_fallback 2
-r_hdr_glowintensity 1
-// #define Image_LinearFloatFromsRGBFloat(c) (((c) <= 0.04045f) ? (c) * (1.0f / 12.92f) : (float)pow(((c) + 0.055f)*(1.0f/1.055f), 2.4f))
-set rpn_sRGB_to_linear "dup 0.055 add 1.055 div 2.4 pow exch 12.92 div dup 0.0031308 gt when"
-// #define Image_sRGBFloatFromLinearFloat(c) (((c) < 0.0031308f) ? (c) * 12.92f : 1.055f * (float)pow((c), 1.0f/2.4f) - 0.055f)
-set rpn_linear_to_sRGB "dup 1.0 2.4 div pow 1.055 mul 0.055 sub exch 12.92 mul dup 0.04045 ge when"
-
-// -nosRGB to -sRGB sky shader conversion:
-//
-// q3map_sunExt 1 0.6875 0.375 340 25 47 0 16
-//                                    ^^ elevation
-//                             ^^^ sunlight
-// q3map_skylight 110 3
-//                ^^^ skylight
-//
-// With that, do (the last parameter is the ratio of skylight you assume hits
-// the surfaces, about 0.25 for inner surfaces near sky, about 1.00 on
-// terrain):
-// ]skybox_nosRGB_to_sRGB 340 47 110 0.25
-// rpn: still on stack: new_sunlight:
-// rpn: still on stack: 380.464142
-// rpn: still on stack: new_skylight:
-// rpn: still on stack: 9.32523632
-//
-// The equivalent -sRGB shader then will have:
-//
-// q3map_sunExt 1 0.6875 0.375 380.464142 25 47 0 16
-// q3map_skylight 9.32523632 3
-alias skybox_nosRGB_to_sRGB "rpn $3 402.123 $4 div div $rpn_sRGB_to_linear 402.123 $4 div mul /new_skylight: $3 402.123 $4 div div $1 256 div $2 0.017453 mul sin mul add $rpn_sRGB_to_linear $3 402.123 $4 div div $rpn_sRGB_to_linear sub 256 mul $2 0.017453 mul sin div /new_sunlight:"
-
-set cl_orthoview 0 "enable top-down view of the map- meant to be used for radar map images (note: orthoview sets cvars temporarily, requires restart to return them to normal)"
-set cl_orthoview_nofog 1 "disable fog while in orthoview-- note, should not be enabled on ALL maps, i.e. oilrig works fine with this disabled"
-
-// these settings determine how much the view is affected by movement/damage
-cl_smoothviewheight 0.05 // time of the averaging to the viewheight value so that it creates a smooth transition for crouching and such. 0 for instant transition
-cl_deathfade 0 // fade screen to dark red when dead, value represents how fast the fade is (higher is faster)
-cl_bobcycle 0.5 // how long the cycle of up/down view movement takes (only works if cl_bob is not 0), default is 0.6
-cl_bob 0 // how much view moves up/down when moving (does not move if cl_bobcycle is 0, but still enables cl_bobmodel), default is 0.02
-cl_bob2cycle 1 // how long the cycle of left/right view movement takes (only works if cl_bob2 is not 0), default is 0.6
-cl_bob2 0 // how much view moves left/right when moving (does not move if cl_bob2cycle is 0), default is 0.01
-cl_bobfall 0.05 "how much the view swings down when falling (influenced by the speed you hit the ground with)"
-cl_bobfallcycle 3 "speed of the bobfall swing"
-cl_bobfallspeed 200 "necessary amount of speed for bob-falling to occur"
-cl_bobmodel 1 // whether to have gun model move around on screen when moving (only works if cl_bob is not 0), default is 1
-cl_bobmodel_side 0.2 // amount the gun sways to the sides
-cl_bobmodel_speed 10 // rate at which the gun sways
-cl_bobmodel_up 0.1 // amount the gun sways up and down
-
-cl_followmodel 1 // enables weapon pushing / pulling effect when walking
-seta cl_followmodel_speed 0.3 "gun following speed"
-seta cl_followmodel_limit 135 "gun following limit"
-seta cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone)"
-seta cl_followmodel_velocity_lowpass 0.05 "gun following velocity lowpass averaging time"
-seta cl_followmodel_highpass 0.05 "gun following highpass averaging time"
-seta cl_followmodel_lowpass 0.03 "gun following lowpass averaging time"
-
-cl_leanmodel 1 // enables weapon leaning effect when looking around
-seta cl_leanmodel_speed 0.3 "gun leaning speed"
-seta cl_leanmodel_limit 30 "gun leaning limit"
-seta cl_leanmodel_highpass1 0.2 "gun leaning pre-highpass averaging time"
-seta cl_leanmodel_highpass 0.2 "gun leaning highpass averaging time"
-seta cl_leanmodel_lowpass 0.05 "gun leaning lowpass averaging time"
-
-cl_rollangle 0 // amount of view tilt when strafing, default is 2.0
-v_kicktime 0 // how long damage kicks of the view last, default is 0 seconds
-gl_polyblend 0 // whether to use screen tints, this has now been replaced by a better system in CSQC
-r_motionblur 0 // motion blur value, default is 0
-r_damageblur 0 // motion blur when damaged, default is 0 (removed in Xonotic)
-
-r_bloom_blur 4
-r_bloom_brighten 2
-r_bloom_colorexponent 1
-r_bloom_colorscale 1
-r_bloom_colorsubtract 0.125
-r_bloom_resolution 320
-r_bloom_scenebrightness 0.85
-
-seta vid_x11_display ""        "xonotic-linux-*.sh will use this to start xonotic on an other/new X display"
-// This can have three possible settings:
-//     ""              run as usual
-//     ":n"            use DISPLAY=:n, create it if needed
-//     ":n/layout"     use DISPLAY=:n, create it if needed with ServerLayout layout
-
-cl_autodemo_nameformat demos/%Y-%m-%d_%H-%M
-
-// taunts and voices
-seta cl_autotaunt 0 "automatically taunt enemies when fragging them"
-seta sv_taunt 1 "allow taunts on the server"
-seta sv_autotaunt 1 "allow autotaunts on the server"
-seta cl_voice_directional 1    "0 = all voices are non-directional, 1 = all voices are directional, 2 = only taunts are directional"
-seta cl_voice_directional_taunt_attenuation 0.5 "this defines the distance from which taunts can be heard"
-
-// server settings
-hostname "Xonotic $g_xonoticversion Server"
-set sv_mapchange_delay 5
-set minplayers 0 "number of players playing at the same time (if not enough real players are there the remaining slots are filled with bots)"
+exec defaultClient.cfg
+exec defaultServer.cfg
 
-// restart server if all players hit "ready"-button
-set sv_ready_restart 0 "allow a map to be restarted once all players pressed the \"ready\" button"
-set sv_ready_restart_after_countdown 0 "reset players and map items after the countdown ended, instead of at the beginning of the countdown"
-set sv_ready_restart_repeatable 0      "allows the players to restart the game as often as needed"
-
-seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy, 1: same pitch 2: increase pitch with more damage 3: decrease pitch with more damage"
-set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this"
-seta cl_hitsound_min_pitch 0.75 "minimum pitch of hit sound"
-seta cl_hitsound_max_pitch 1.5 "maximum pitch of hit sound"
-seta cl_hitsound_nom_damage 25 "damage amount at which hitsound bases pitch off"
-
-seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead; set to 2 to active the effect only when the corpse doesn't move anymore"
-seta cl_eventchase_frozen 0 "camera goes into 3rd person mode when the player is frozen"
-seta cl_eventchase_nexball 1 "camera goes into 3rd person mode when in nexball game-mode"
-seta cl_eventchase_distance 140 "final camera distance"
-seta cl_eventchase_generator_distance 400 "final camera distance while viewing generator explosion"
-seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
-seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
-seta cl_eventchase_mins "-12 -12 -8" "min size of eventchase camera bbox"
-seta cl_eventchase_viewoffset "0 0 20" "viewoffset of eventchase camera"
-seta cl_eventchase_generator_viewoffset "0 0 80" "viewoffset of eventchase camera while viewing generator explosion"
-seta cl_eventchase_vehicle 1 "camera goes into 3rd person mode when inside a vehicle"
-seta cl_eventchase_vehicle_viewoffset "0 0 80"
-seta cl_eventchase_vehicle_distance 250
-
-set _vehicles_shownchasemessage 0
-
-//nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
-set teamplay_lockonrestart 0 "lock teams once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
-
-set g_maxplayers 0     "maximum number of players allowed to play at the same time, set to 0 to allow all players to join the game"
-set g_maxplayers_spectator_blocktime 5 "if the players voted for the \"nospectators\" command, this setting defines the number of seconds a observer/spectator has time to join the game before he gets kicked"
-
-// tournament mod
-set g_warmup 0 "split the game into a warmup- and match-stage"
-set g_warmup_limit 0   "limit warmup-stage to this time (in seconds); if set to -1 the warmup-stage is not affected by any timelimit, if set to 0 the usual timelimit also affects warmup-stage"
-set g_warmup_allow_timeout 0   "allow calling timeouts in the warmup-stage (if sv_timeout is set to 1)"
-set g_warmup_allguns 1 "provide more weapons on start while in warmup: 0 = normal start weapons, 1 = all guns available on the map, 2 = all normal weapons"
-set g_warmup_majority_factor 0.8 "minimum percentage of players ready needed for warmup to end"
-
-set g_chat_nospectators 0      "if 0 spec/observer chat is always visible to the player, if 1 it is never visible to players, if 2 it is only visible to players during warmup stage"
-set sv_vote_nospectators 0     "only players can call a vote (thus spectators and observers can't call a vote): 0 = all people can vote, 1 = spectators can vote in warmup stage, 2 = only players can vote (no exceptions)."
-
-alias g_tourney "g_tourney_$1"
-alias g_tourney_1 "g_warmup 1; g_chat_nospectators 2; sv_vote_nospectators 1"
-alias g_tourney_0 "g_warmup 0; g_chat_nospectators 0; sv_vote_nospectators 0"
-
-set sv_timeout 0       "allow a player to call a timeout, this will pause the game for some time"
-set sv_timeout_length 120      "how long the game will be paused at max, in seconds"
-set sv_timeout_number 2        "how many timeouts one player is allowed to call (gets reset after a restart)"
-set sv_timeout_leadtime 4      "how long the players will be informed that a timeout was called before it starts, in seconds"
-set sv_timeout_resumetime 3    "how long the remaining timeout-time will be after a player called the timein command"
-
-set g_allow_oldvortexbeam 0 "If enabled, clients are allowed to use old v2.3 Vortex beam"
-seta cl_particles_oldvortexbeam 0 "Uses the old v2.3 Vortex beam instead of the new beam, only works if server allows it (g_allow_oldvortexbeam 1)"
-
-set g_telefrags 1 "telefragging, i.e. killing someone who stands in the way of someone who is teleporting"
-set g_telefrags_teamplay 1 "never telefrag team mates"
-set g_telefrags_avoid 1 "when teleporters have a random destination, avoid teleporting to locations where a telefrag would happen"
-set g_teleport_maxspeed 0 "maximum speed that a player can keep when going through a teleporter (if a misc_teleporter_dest also has a cap the smallest one of these will be used), 0 = don't limit, -1 = keep no speed"
-
-seta cl_damageeffect 1 "enable weapon damage effects: 1 enables the feature on skeletal models, 2 on any model"
-seta cl_damageeffect_ticrate 0.1 "particle spawn rate"
-seta cl_damageeffect_bones 5 "how many damages to allow on a rigged mesh at once (non-skeletal objects are limited to one)"
-seta cl_damageeffect_distribute 1 "divide particle intensity if multiple damages are present"
-seta cl_damageeffect_lifetime 0.1 "how much a damage effect lasts, based on damage amount"
-seta cl_damageeffect_lifetime_min 3 "minimum lifetime a damage effect may have"
-seta cl_damageeffect_lifetime_max 6 "maximum lifetime a damage effect may have"
-
-set g_respawn_ghosts 1 "if 1 dead bodies become ghosts and float away when the player respawns"
-set g_respawn_ghosts_speed 5 "the speed with which respawn ghosts float and rotate"
-set g_respawn_ghosts_maxtime 6 "maximum amount of time a respawn ghost can last, minimum time is half this value. 0 disables and ghosts fade when the body would"
-set cl_deathglow 0.8 "number of seconds during which dead bodies glow out"
-
-set sv_gibhealth 100 "Minus health a dead body must have in order to get gibbed"
-
-// use default physics
-set sv_friction_on_land 0
-set sv_friction_slick 0.5
-
-set sv_slick_applygravity 0
-
-set sv_aircontrol_backwards 0 "apply forward aircontrol options to backward movement"
-set sv_aircontrol_sidewards 0 "apply forward aircontrol options to sideward movement"
-
-set sv_player_viewoffset "0 0 35" "view offset of the player model"
-set sv_player_mins "-16 -16 -24" "playermodel mins"
-set sv_player_maxs "16 16 45" "playermodel maxs"
-set sv_player_crouch_viewoffset "0 0 20" "view offset of the player model when crouched"
-set sv_player_crouch_mins "-16 -16 -24" "mins of a crouched playermodel"
-set sv_player_crouch_maxs "16 16 25" "maxs of a crouched playermodel"
-
-set sv_doublejump 0 "allow Quake 2-style double jumps"
-set sv_jumpspeedcap_min "" "lower bound on the baseline velocity of a jump; final velocity will be >= (jumpheight * min + jumpheight)"
-set sv_jumpspeedcap_max "" "upper bound on the baseline velocity of a jump; final velocity will be <= (jumpheight * max + jumpheight)"
-set sv_jumpspeedcap_max_disable_on_ramps 0 "disable upper baseline velocity bound on ramps to preserve the old rampjump style"
-set sv_track_canjump 0 "track if the player released the jump key between 2 jumps to decide if they are able to jump or not"
-
-seta sv_precacheplayermodels 1
-seta sv_precacheweapons 0
-seta sv_precacheitems 0
-set sv_spectator_speed_multiplier 1.5
-seta sv_spectate 1 "if set to 1, new clients are allowed to spectate or observe the game, if set to 0 joining clients spawn as players immediately (no spectating)"
-seta sv_defaultcharacter 0 "master switch, if set to 1 the further configuration for replacing all player models, skins and colors is taken from the sv_defaultplayermodel, sv_defaultplayerskin and sv_defaultplayercolors variables"
-seta sv_defaultcharacterskin 0 "if set to 1 the further configuration for replacing all skins is taken from the sv_defaultplayerskin variables"
-seta sv_defaultplayermodel "models/player/erebus.iqm" "default model selection, only works if sv_defaultcharacter is set to 1; you may append a :<skinnumber> suffix to model names; you can specify multiple, separated by space, and a random one will be chosen"
-seta sv_defaultplayerskin 0 "each model has 1 or more skins (combination of model and skin = character), set which skin of the model you wish the default character to have, only works if sv_defaultcharacter is set to 1; can be overridden by :<skinnumber> suffix in sv_defaultplayermodel"
-seta sv_defaultplayermodel_red ""      "\"\" means see sv_defaultplayermodel"
-seta sv_defaultplayerskin_red 0
-seta sv_defaultplayermodel_blue "" "\"\" means see sv_defaultplayermodel"
-seta sv_defaultplayerskin_blue 0
-seta sv_defaultplayermodel_yellow "" "\"\" means see sv_defaultplayermodel"
-seta sv_defaultplayerskin_yellow 0
-seta sv_defaultplayermodel_pink "" "\"\" means see sv_defaultplayermodel"
-seta sv_defaultplayerskin_pink 0
-seta sv_defaultplayercolors "" "set to 16*shirt+pants to force a color, note: it does NOT depend on defaultcharacter! Set to \"\" to disable"
-set sv_autoscreenshot 0 "if set to 1, the server forces all clients to create a local screenshot once the map ended"
-net_messagetimeout 30
-net_connecttimeout 30
-sv_jumpstep 1 // step up stairs while jumping, makes it easier to reach ledges
 set ekg 0      "Throw huge amounts of gibs"
 
-seta sv_shownames_cull_distance 2500 "distance after which to not send origin/health/armor of another player"
-
-cl_movement 1
-cl_movement_track_canjump 0
-cl_stairsmoothspeed 200
-
-set bot_config_file bots.txt "Name and path of the bot configuration file"
-set bot_number 0       "Minimum number of bots"
-seta bot_usemodelnames 0       "Use player model names for bot names"
-set bot_nofire 0       "When set, bots never fire. Mainly for testing in g_waypointeditor mode"
-seta bot_prefix [BOT]  "Prefix in front of the bot names"
-seta bot_suffix ""     "Suffix behind the bot names"
-seta skill_auto 0      "when 1, \"skill\" gets adjusted to match the best player on the map"
-set bot_debug_tracewalk 0 "Enable visual indicators for short-term navigation. Green: Goal Reached / Yellow: Obstacle found / Red: Unsolvable obstacle found"
-set bot_debug_goalstack 0 "Visualize the current path that each bot is following. Use with as few bots as possible."
-set bot_wander_enable 1 "Have bots wander around if they are unable to reach any useful goal. Disable only for debugging purposes."
-// general bot AI cvars
-set bot_ai_thinkinterval 0.05
-set bot_ai_strategyinterval 5 "How often a new objective is chosen"
-set bot_ai_enemydetectioninterval 2 "How often bots pick a new target"
-set bot_ai_enemydetectionradius 10000 "How far bots can see enemies"
-set bot_ai_dodgeupdateinterval 0.2 "How often scan for items to dodge. Currently not in use."
-set bot_ai_chooseweaponinterval 0.5 "How often the best weapon according to the situation will be chosen"
-set bot_ai_dangerdetectioninterval 0.25 "How often scan for waypoints with dangers near"
-set bot_ai_dangerdetectionupdates 64 "How many waypoints will be considered for danger detection"
-set bot_ai_aimskill_blendrate 2        "How much correction will be applied to the aiming angle"
-set bot_ai_aimskill_fixedrate 15
-set bot_ai_aimskill_firetolerance_distdegrees 100
-set bot_ai_aimskill_firetolerance_mindegrees 2 "Minimum angle tolerance. Used on large distances"
-set bot_ai_aimskill_firetolerance_maxdegrees 60 "Maximum firing angle. Used on close range"
-set bot_ai_aimskill_mouse 1 "How much of the aiming filters are applied"
-set bot_ai_keyboard_distance 250 "Keyboard emulation is disabled after this distance to the goal"
-set bot_ai_keyboard_threshold 0.57
-set bot_ai_aimskill_offset 0.3 "Amount of error induced to the bots aim"
-set bot_ai_aimskill_think 1 "Aiming velocity. Use values below 1 for slower aiming"
-set bot_ai_custom_weapon_priority_distances "300 850"  "Define close and far distances in any order. Based on the distance to the enemy bots will choose different weapons"
-set bot_ai_custom_weapon_priority_far   "vaporizer vortex rifle electro devastator mortar hagar hlac crylink blaster machinegun fireball seeker shotgun shockwave tuba minelayer"      "Desired weapons for far distances ordered by priority"
-set bot_ai_custom_weapon_priority_mid   "vaporizer devastator vortex fireball seeker mortar electro machinegun arc crylink hlac hagar shotgun shockwave blaster rifle tuba minelayer"  "Desired weapons for middle distances ordered by priority"
-set bot_ai_custom_weapon_priority_close "vaporizer vortex shotgun shockwave machinegun arc hlac tuba seeker hagar crylink mortar electro devastator blaster fireball rifle minelayer"  "Desired weapons for close distances ordered by priority"
-set bot_ai_weapon_combo 1      "Enable bots to do weapon combos"
-set bot_ai_weapon_combo_threshold 0.4  "Try to make a combo N seconds after the last attack"
-set bot_ai_friends_aware_pickup_radius "500"   "Bots will not pickup items if a team mate is this distance near the item"
-set bot_ai_ignoregoal_timeout 3        "Ignore goals making bots to get stuck in front of a wall for N seconds"
-set bot_ai_bunnyhop_skilloffset 7      "Bots with skill equal or greater than this value will perform the  \"bunnyhop\" technique"
-set bot_ai_bunnyhop_startdistance 200 "Run to goals located further than this distance"
-set bot_ai_bunnyhop_stopdistance 300 "Stop jumping after reaching this distance to the goal"
-set bot_ai_bunnyhop_firstjumpdelay 0.2 "Start running to the goal only if it was seen for more than N seconds"
-set bot_god 0 "god mode for bots"
-set bot_ai_navigation_jetpack 0 "Enable bots to navigate maps using the jetpack"
-set bot_ai_navigation_jetpack_mindistance 3500 "Bots will try fly to objects located farther than this distance"
-// Better don't touch these, there are hard to tweak!
-set bot_ai_aimskill_order_mix_1st 0.01 "Amount of the 1st filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_mix_2nd 0.1 "Amount of the 2nd filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_mix_3th 0.01 "Amount of the 3th filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_mix_4th 0.05 "Amount of the 4th filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_mix_5th 0.01 "Amount of the 5th filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_filter_1st 0.4 "Position filter"
-set bot_ai_aimskill_order_filter_2nd 0.4 "Movement filter"
-set bot_ai_aimskill_order_filter_3th 0.2 "Acceleration filter"
-set bot_ai_aimskill_order_filter_4th 0.4 "Position prediction filter. Used rarely"
-set bot_ai_aimskill_order_filter_5th 0.5 "Movement prediction filter. Used rarely"
-set bot_ai_timeitems 1 "allow skilled bots to run to important items a little time before respawning"
-set bot_ai_timeitems_minrespawndelay 25 "bots run to items with this minimum respawn delay before respawning"
-
-// waypoint editor enable
-set g_waypointeditor 0
-set g_waypointeditor_auto 0 "Automatically create waypoints for bots while playing; BEWARE, this currently creates too many of them"
-set g_waypointeditor_symmetrical 0 "Enable symmetrical editing of waypoints on symmetrical CTF maps (NOTE: it assumes that the map is perfectly symmetrical). 1: automatically determine origin of symmetry; -1: use custom origin (g_waypointeditor_symmetrical_origin); 2: automatically determine axis of symmetry; -2: use custom axis (g_waypointeditor_symmetrical_axis)"
-set g_waypointeditor_symmetrical_origin "0 0" "Custom origin of symmetry (x y)"
-set g_waypointeditor_symmetrical_order 0 "if >= 2 apply rotational symmetry (around origin of symmetry) of this order, otherwise apply autodetected order of symmetry"
-set g_waypointeditor_symmetrical_axis "0 0" "Custom axis of symmetry (m q parameters of y = mx + q)"
-set bot_ignore_bots 0  "When set, bots don't shoot at other bots"
-set bot_join_empty 0   "When set, bots also play if no player has joined the server"
-set bot_vs_human 0     "Bots and humans play in different teams when set. positive values to make an all-bot blue team, set to negative values to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count). Changes will be correctly applied only from the next game"
-
-alias g_waypointeditor_spawn "impulse 103"
-alias g_waypointeditor_remove "impulse 104"
-alias g_waypointeditor_relinkall "impulse 105"
-alias g_waypointeditor_saveall "impulse 106"
-alias g_waypointeditor_unreachable "impulse 107"
-
 locs_enable 0
 pausable 0
-set g_spawnshieldtime 1 "number of seconds you are invincible after you spawned, this shield is lost after you fire"
-set g_spawnshield_blockdamage 1 "how much spawn shield protects you from damage (1 = full protection)"
-set g_antilag 2        "AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2 = server side hit scan in the past, 3 = unverified client side hit scan)"
-set g_antilag_nudge 0 "don't touch"
-set g_shootfromeye 0 "shots are fired from your eye/crosshair; visual gun position can still be influenced by cl_gunalign 1 and 2"
-set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from the barrel of your weapon; visual gun position can still be influenced by cl_gunalign 1 and 2"
-set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved to the given y and z coordinates. If set to a string like x y z, the whole shot origin is used"
-set g_pinata 0 "if set to 1 you will not only drop your current weapon when you are killed, but you will drop all weapons that you possessed"
-set g_weapon_stay 0 "1: ghost weapons can be picked up too but give no ammo, 2: ghost weapons refill ammo to one pickup size, thrown guns have no ammo"
-set g_weapon_throwable 1 "if set to 1, weapons can be dropped"
-set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default"
-set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammunition"
-set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn"
-set g_weaponarena "0"  "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\""
-set g_weaponarena_random "0"   "if set to a number, only that weapon count is given on every spawn (randomly)"
-set g_weaponarena_random_with_blaster "1"      "additionally, always provide the blaster in random weapon arena games"
-set g_spawnpoints_auto_move_out_of_solid 0 "if set to 1 you will see a warning if a spawn point was placed inside a solid"
-set g_forced_respawn 0 "if set to 1 and a player died, that player gets automatically respawned once <g_respawn_delay> seconds are over"
-set g_fullbrightplayers 0 "brightens up player models (note that the color, skin or model of the players does not change!)"
-set g_fullbrightitems 0 "brightens up items"
-set g_nodepthtestplayers 0 "disables depth testing on players"
-set g_nodepthtestitems 0 "disables depth testing on items"
-set g_casings 2 "specifies which casings (0: none, 1: only shotgun casings, 2: shotgun and machine gun casings) are sent to the client"
-set g_norecoil 0 "if set to 1 shooting weapons won't make you crosshair to move upwards (recoil)"
-set g_maplist_mostrecent "" "contains the name of the maps that were most recently played"
-seta g_maplist_mostrecent_count 3      "number of most recent maps that are blocked from being played again"
-seta g_maplist "" "the list of maps to be cycled among (is autogenerated if empty)"
-seta g_maplist_index 0 "this is used internally for saving position in maplist cycle"
-seta g_maplist_selectrandom 0  "if 1, a random map will be chosen as next map - DEPRECATED in favor of g_maplist_shuffle"
-seta g_maplist_shuffle 1       "new randomization method: like selectrandom, but avoid playing the same maps in short succession. This works by taking out the first element and inserting it into g_maplist with a bias to the end of the list"
-set g_maplist_check_waypoints 0        "when 1, maps are skipped if there currently are bots, but the map has no waypoints"
 set samelevel 0 "when 1, always play the same level over and over again"
 
-set g_items_mindist 4000 "starting distance for the fading of items"
-set g_items_maxdist 4500 "maximum distance at which an item can be viewed, after which it will be invisible"
-
-set g_grab_range 200 "distance at which dragable objects can be grabbed"
-
-set g_cloaked 0 "display all players mostly invisible"
-set g_player_alpha 1
-set g_player_brightness 0      "set to 2 for brighter players"
-seta g_balance_cloaked_alpha 0.25
-
-seta menu_sandbox_spawn_model ""
-seta menu_sandbox_attach_bone ""
-seta menu_sandbox_edit_skin 0
-seta menu_sandbox_edit_alpha 1
-seta menu_sandbox_edit_color_main "1 1 1"
-seta menu_sandbox_edit_color_glow "1 1 1"
-seta menu_sandbox_edit_frame 0
-seta menu_sandbox_edit_scale 1
-seta menu_sandbox_edit_solidity 1
-seta menu_sandbox_edit_physics 1
-seta menu_sandbox_edit_force 1
-seta menu_sandbox_edit_material ""
-
-seta menu_monsters_edit_spawn ""
-seta menu_monsters_edit_skin 0
-seta menu_monsters_edit_movetarget 1
-
-set g_playerclip_collisions 1 "0 = disable collision testing against playerclips, might be useful on some defrag maps"
-set g_botclip_collisions 1 "0 = disable collision testing against botclips, might be useful on some defrag maps"
-
-set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
-set g_grappling_hook_useammo 0 "use ammunition with the off-hand grappling hook"
-
-set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info"
-set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players"
-set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
-// respawn delay
-set g_respawn_delay_small 2 "small game number of seconds you have to wait before you can respawn again"
-set g_respawn_delay_small_count 0 "Player count per team for g_respawn_delay_small. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)."
-set g_respawn_delay_large 2 "large game number of seconds you have to wait before you can respawn again"
-set g_respawn_delay_large_count 8 "Player count per team for g_respawn_delay_large. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)."
-set g_respawn_delay_max 5 "number of seconds you can wait before you're forced to respawn (only effective with g_forced_respawn 1)"
-set g_respawn_delay_forced 0 "enforce regular respawn delay (prevent gamemode specific respawn delays)"
-set g_respawn_waves 0 "respawn in waves (every n seconds), intended to decrease overwhelming base attacks"
-
-// overtime
-seta timelimit_overtime 2 "duration in minutes of one added overtime, added to the timelimit"
-seta timelimit_overtimes 0 "how many overtimes to add at max"
-seta timelimit_suddendeath 5 "number of minutes suddendeath mode lasts after all overtimes were added and still no winner was found"
-
-// common team values
-set g_tdm 0 "Team Deathmatch: the team who kills their opponents most often wins"
-set g_tdm_on_dm_maps 0 "when this is set, all DM maps automatically support TDM"
-
-seta teamplay_mode 4 "default teamplay setting in team games. 1 = no friendly fire, self damage. 2 = friendly fire and self damage enabled. 3 = no friendly fire, but self damage enabled. 4 = obey the cvars g_mirrordamage*, g_friendlyfire* and g_teamdamage*"
-seta g_mirrordamage 0.7              "for teamplay_mode 4: mirror damage factor"
-seta g_mirrordamage_virtual 1        "for teamplay_mode 4: do not actually apply mirror damage, just show graphics effect for it"
-seta g_mirrordamage_onlyweapons 0    "for teamplay_mode 4: only apply mirror damage if the attack was from a weapon"
-seta g_friendlyfire 0.5              "for teamplay_mode 4: friendly fire factor"
-seta g_friendlyfire_virtual 1        "for teamplay_mode 4: do not actually apply friendly fire, just show graphics effect for it"
-seta g_friendlyfire_virtual_force 1  "for teamplay_mode 4: apply force even though damage was made virtual only"
-seta g_teamdamage_threshold 40       "for teamplay_mode 4: threshold over which to apply mirror damage"
-seta g_teamdamage_resetspeed 20      "for teamplay_mode 4: how fast player's teamdamage count decreases"
-
-seta g_balance_teams 1 "automatically balance out players entering instead of asking them for their preferred team"
-seta g_balance_teams_prevent_imbalance 1       "prevent players from changing to larger teams"
-set g_balance_teams_scorefactor 0.25 "at the end of the game, take score into account instead of team size by this amount (beware: values over 0.5 mean that a x:0 score imbalance will cause ALL new players to prefer the losing team at the end, despite numbers)"
-set g_changeteam_banned 0      "not allowed to change team"
-set g_changeteam_fragtransfer 0        "% of frags you get to keep when you change teams (rounded down)"
-
-set sv_teamnagger 1 "enable a nag message when the teams are unbalanced"
-
-set g_bloodloss 0   "amount of health below which blood loss occurs"
-
-set g_footsteps 1      "serverside footstep sounds"
-
-set g_throughfloor_debug 0 "enable debugging messages for throughfloor calculations"
-set g_throughfloor_damage_max_stddev 2 "Maximum standard deviation for splash damage"
-set g_throughfloor_force_max_stddev 10 "Maximum standard deviation for splash force"
-set g_throughfloor_min_steps_player 1 "Minimum number of steps for splash damage"
-set g_throughfloor_min_steps_other 1 "Minimum number of steps for splash damage"
-set g_throughfloor_max_steps_player 100 "Maximum number of steps for splash damage"
-set g_throughfloor_max_steps_other 10 "Maximum number of steps for splash damage"
-// note: for damage X, 0.25 * ((1-g_throughfloor_damage)*X / g_throughfloor_damage_max_stddev)^2 steps are used
-// for these numbers:
-//   damage  25: 3
-//   damage  60: 15
-//   damage  80: 25
-//   damage 200: 157
-//   force  250: 10
-//   force  300: 15
-//   force  600: 57
-
-// effects
-r_glsl_vertextextureblend_usebothalphas 1 // allows to abuse texture blending as detail texture
-mod_q3shader_force_terrain_alphaflag 1 // supposedly now required for r_glsl_vertextextureblend_usebothalphas to work
-r_glsl_postprocess 0 // but note, hud_postprocessing enables this
-r_picmipsprites 0 // Xonotic uses sprites that should never be picmipped (team mate, typing, waypoints)
-r_picmipworld 1
-gl_picmip_world 0
-gl_picmip_sprites 0
-gl_picmip_other 1 // so, picmip -1 is best possible quality
-r_mipsprites 1
-r_mipskins 1
-gl_max_lightmapsize 4096
-r_shadow_realtime_world_lightmaps 1
-r_shadow_realtime_world_importlightentitiesfrommap 0 // Whether build process uses keepLights is nontransparent and may change, so better make keepLights not matter.
-cl_decals_fadetime 5
-cl_decals_time 1
-seta cl_gunalign 3 "Gun alignment; 1 = center (if allowed by g_shootfromclient) or right, 2 = center (if allowed by g_shootfromclient) or left, 3 = right only, 4 = left only"
-seta cl_nogibs 0 "reduce number of violence effects, or remove them totally"
-seta cl_particlegibs 0 "simpler gibs"
-seta cl_gibs_damageforcescale 3.5 "force to push around gibs"
-seta cl_gibs_lifetime 2.5 "average lifetime of gibs"
-seta cl_gibs_velocity_scale 1 "gib throw velocity force scale"
-seta cl_gibs_velocity_random 1 "gib throw velocity randomness scale"
-seta cl_gibs_velocity_up 1 "extra z velocity for gibs"
-seta cl_gibs_ticrate 0.1 "ticrate for gibs"
-seta cl_gibs_sloppy 1 "sloppy gibs, may temporarily penetrate walls"
-seta cl_gibs_avelocity_scale 1 "how much angular velocity to use on gibs"
-seta cl_casings 1 "enable or disable bullet casings"
-seta cl_casings_shell_time 30 "shell casing lifetime"
-seta cl_casings_bronze_time 10 "bullet casings lifetime"
-seta cl_casings_ticrate 0.1 "ticrate for casings"
-seta cl_casings_sloppy 1 "sloppy casings, may temporarily penetrate walls"
-seta cl_projectiles_sloppy 1 "sloppy projectiles, may temporarily penetrate walls"
-cl_stainmaps 0
-cl_particles_smoke 1
-vid_gl20 1
-r_glsl_deluxemapping 1
-r_glsl_offsetmapping 0
-r_glsl_offsetmapping_lod 1
-r_glsl_offsetmapping_reliefmapping 0
-r_glsl_offsetmapping_scale 0.02
-// execute effects-normal.cfg to make sure that all effect settings are reset
-alias menu_sync "" // will be re-aliased later
-
-// misc
 fs_empty_files_in_pack_mark_deletions 1 // makes patches able to delete files
-scr_conalpha 1
-scr_conbrightness 0.2
-scr_screenshot_jpeg 1
-scr_screenshot_jpeg_quality 0.9
-sv_maxvelocity 1000000000
-cl_sound_wizardhit ""
-cl_sound_hknighthit ""
-cl_sound_tink1 weapons/tink1.wav
-cl_sound_ric1 weapons/ric1.wav
-cl_sound_ric2 weapons/ric2.wav
-cl_sound_ric3 weapons/ric3.wav
-cl_sound_r_exp3 ""
-sv_sound_land ""
-sv_sound_watersplash ""
-
-seta cl_announcer default "name of the announcer you wish to use from data/sound/announcer"
-seta cl_announcer_antispam 2 "number of seconds before an announcement of the same sound can be played again"
-seta cl_announcer_maptime 3 "play announcer sound telling you the remaining maptime - 0: do not play at all, 1: play at one minute, 2: play at five minutes, 3: play both"
-
-// startmap_dm is used when running with the -listen or -dedicated commandline options
-set serverconfig server.cfg
-alias loadconfig "cvar_resettodefaults_saveonly; exec ${* !}"
-set _sv_init 0
-alias startmap_dm "set _sv_init 0; map _init/_init; exec $serverconfig; set _sv_init 1"
-
-// aliases:
-alias +fire +attack
-alias -fire -attack
-alias +fire2 +button3
-alias -fire2 -button3
-alias +attack2 +button3 // old alias from Nexuiz
-alias -attack2 -button3 // old alias name from Nexuiz
-alias +crouch +button5
-alias -crouch -button5
-alias weapnext "_weapnext_${cl_weaponpriority_useforcycling}"
-alias _weapnext_0 "impulse 18"
-alias _weapnext_1 "impulse 15"
-alias _weapnext_2 "impulse 10"
-alias weaplast "impulse 11"
-alias weapprev "_weapprev_${cl_weaponpriority_useforcycling}"
-alias _weapprev_0 "impulse 19"
-alias _weapprev_1 "impulse 16"
-alias _weapprev_2 "impulse 12"
-alias weapbest "impulse 13"
-
-// experimental zoom toggle (can be in wrong state at start of a game, though)
-set _togglezoom +
-alias +zoom "set _togglezoom -; +button4"
-alias -zoom "set _togglezoom +; -button4"
-alias togglezoom "${_togglezoom}zoom"
-
-alias reload "impulse 20"
-
-// weapons
-alias weapon_group_1 "impulse 1"
-alias weapon_group_2 "impulse 2"
-alias weapon_group_3 "impulse 3"
-alias weapon_group_4 "impulse 4"
-alias weapon_group_5 "impulse 5"
-alias weapon_group_6 "impulse 6"
-alias weapon_group_7 "impulse 7"
-alias weapon_group_8 "impulse 8"
-alias weapon_group_9 "impulse 9"
-alias weapon_group_0 "impulse 14" // cycles the superweapons
-// TODO: remove after 0.8.2. Default impulse commands for 0.8.1 servers
-exec weapons.cfg
-
-// score log
-set sv_logscores_console 0     "print scores to server console"
-set sv_logscores_file 0        "print scores to file"
-set sv_logscores_filename scores.log   "filename"
-set sv_logscores_bots 0        "exclude bots by default"
-
-// spam (frag/capture) log
-set sv_eventlog 0      "the master switch for efficiency reasons"
-set sv_eventlog_console 1
-set sv_eventlog_files 0
-set sv_eventlog_files_timestamps 1
-seta sv_eventlog_files_counter 0
-set sv_eventlog_files_nameprefix xonotic
-set sv_eventlog_files_namesuffix .log
-
-set nextmap "" "override the maplist when switching to the next map"
-set lastlevel ""
-set quit_when_empty 0  "set to 1, then the server exits when the next level would start but is empty"
-set quit_and_redirect ""       "set to an IP to redirect all players at the end of the match to another server. Set to \"self\" to let all players reconnect at the end of the match (use it to make seamless engine updates)"
-set quit_and_redirect_timer 1.5 "set to number of seconds after quit before performing the connect operation of quit_and_redirect"
 
 // singleplayer campaign
 set g_campaign 0
@@ -692,349 +45,17 @@ alias singleplayer_start "g_campaign_index 0; set scmenu_campaign_goto 0"
 alias singleplayer_continue "set scmenu_campaign_goto -1"
 alias singleplayer_levellist "set scmenu_campaign_dump 1; togglemenu; wait; togglemenu"
 
-// Green's fullbright skins, updated by Samual
-alias sv_fbskin_unique "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors \"\""
-alias sv_fbskin_green "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 51"
-alias sv_fbskin_red "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 68"
-alias sv_fbskin_orange "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 238"
-alias sv_fbskin_rainbow "sv_defaultcharacter 1; sv_defaultplayermodel models/player/megaerebus.iqm; sv_defaultplayerskin 1; sv_defaultplayercolors 95"
-
-alias sv_fbskin_off "sv_defaultcharacter 0; sv_defaultplayerskin 0; sv_defaultplayercolors \"\""
-
-seta sv_servermodelsonly 1
-
-cl_curl_enabled 1
-cl_curl_maxdownloads 3
-cl_curl_maxspeed 0
-cl_curl_useragent 1
-cl_curl_useragent_append "$g_xonoticversion"
-
-sv_curl_defaulturl "http://www.xonotic.org/contentdownload/getmap.php?file="
-set sv_curl_serverpackages_auto 1 "automatically add packs with *.serverpackage files to sv_curl_serverpackages"
-
-set sv_motd ""
-
-set g_waypoints_for_items 0    "make waypoints out of items, values: 0 = never, 1 = unless the mapper prevents it by worldspawn.spawnflags & 1, 2 = always"
-
-seta g_maplist_votable 6 "number of maps that are shown in the map voting at the end of a match"
-seta g_maplist_votable_keeptwotime 15 "show only 2 options after this amount of time during map vote screen"
-seta g_maplist_votable_timeout 30      "timeout for the map voting; must be below 50 seconds!"
-seta g_maplist_votable_suggestions 2
-seta g_maplist_votable_suggestions_override_mostrecent 0
-seta g_maplist_votable_nodetail 1      "nodetail only shows total count instead of all vote counts per map, so votes don't influence others that much"
-seta g_maplist_votable_abstain 0       "when 1, you can abstain from your vote"
-seta g_maplist_votable_screenshot_dir "maps levelshots"        "where to look for map screenshots"
-
-set sv_vote_gametype 0 "show a vote screen for gametypes before map vote screen"
-set sv_vote_gametype_keeptwotime 10 "show only 2 options after this amount of time during gametype vote screen"
-set sv_vote_gametype_options "dm ctf ca lms tdm ft"
-set sv_vote_gametype_timeout 20
-set sv_vote_gametype_default_current 1 "Keep the current gametype if no one votes"
-
-set g_chat_flood_spl 3 "normal chat: seconds between lines to not count as flooding"
-set g_chat_flood_lmax 2        "normal chat: maximum number of lines per chat message at once"
-set g_chat_flood_burst 2       "normal chat: allow bursts of so many chat lines"
-set g_chat_flood_spl_team 1    "team chat: seconds between lines to not count as flooding"
-set g_chat_flood_lmax_team 2   "team chat: maximum number of lines per chat message at once"
-set g_chat_flood_burst_team 2  "team chat: allow bursts of so many chat lines"
-set g_chat_flood_spl_tell 1    "private chat: seconds between lines to not count as flooding"
-set g_chat_flood_lmax_tell 2   "private chat: maximum number of lines per chat message at once"
-set g_chat_flood_burst_tell 2  "private chat: allow bursts of so many chat lines"
-set g_chat_flood_notify_flooder 1      "when 0, the flooder still can see his own message"
-set g_chat_teamcolors 0        "colorize nicknames in team color for chat"
-set g_chat_tellprivacy 1 "when disabled, tell messages are also sent to the server console log... otherwise they're kept private between players."
-set g_nick_flood_timeout 120 "time after which nick flood protection resets (set to 0 to disable nick flood checking)"
-set g_nick_flood_penalty 0.5 "duration of the nick flood penalty"
-set g_nick_flood_penalty_yellow 3 "number of changes to allow before warning and movement blocking"
-set g_nick_flood_penalty_red 30 "number of changes to allow before totally disorienting the player"
-
-set sv_waypointsprite_deployed_lifetime 10
-set sv_waypointsprite_deadlifetime 1
-set sv_waypointsprite_limitedrange 5120
-
-seta g_waypointsprite_uppercase 1
-set g_waypointsprite_normdistance 512
-set g_waypointsprite_minscale 0.5
-set g_waypointsprite_minalpha 0.4
-set g_waypointsprite_distancealphaexponent 2
-set g_waypointsprite_timealphaexponent 1
-set g_waypointsprite_stuffbinds 0
-seta g_waypointsprite_scale 1
-seta g_waypointsprite_fontsize 12
-seta g_waypointsprite_alpha 1 "This allows the client to control transparency of the waypoint"
-seta g_waypointsprite_edgefadealpha 0.5 "alpha multiplier near the edge"
-seta g_waypointsprite_edgefadescale 1 "scale multiplier near the edge"
-seta g_waypointsprite_edgefadedistance 50 "distance in virtual pixels from edge where to start fading"
-seta g_waypointsprite_edgeoffset_bottom 0 "offset of how close the waypoint can be to the bottom edge of the screen"
-seta g_waypointsprite_edgeoffset_left 0 "offset of how close the waypoint can be to the left edge of the screen"
-seta g_waypointsprite_edgeoffset_right 0 "offset of how close the waypoint can be to the right edge of the screen"
-seta g_waypointsprite_edgeoffset_top 0 "offset of how close the waypoint can be to the top edge of the screen"
-seta g_waypointsprite_crosshairfadealpha 0.25 "alpha multiplier near crosshair"
-seta g_waypointsprite_crosshairfadescale 1 "scale multiplier near the crosshair"
-seta g_waypointsprite_crosshairfadedistance 150 "distance in virtual pixels from crosshair where to start fading"
-seta g_waypointsprite_distancefadealpha 1 "alpha multiplier near distance"
-seta g_waypointsprite_distancefadescale 0.7 "scale multiplier near the distance"
-seta g_waypointsprite_distancefadedistancemultiplier 0.5 "distance in map sizes from distance where to stop fading"
-seta g_waypointsprite_itemstime 2 "show waypoints to indicate that some important items (mega health, large armor) are about to respawn: 1 when spectating, 2 even playing in warmup stage"
-set g_waypointsprite_spam 0 "Debugging feature. Set to 10 and load courtfun in race mode to test."
-alias "g_waypointsprite_personal"      "impulse 30"
-alias "g_waypointsprite_personal_p"    "impulse 31"
-alias "g_waypointsprite_personal_d"    "impulse 32"
-alias "g_waypointsprite_team_helpme"   "impulse 33"
-alias "g_waypointsprite_team_here"     "impulse 34"
-alias "g_waypointsprite_team_here_p"   "impulse 35"
-alias "g_waypointsprite_team_here_d"   "impulse 36"
-alias "g_waypointsprite_team_danger"   "impulse 37"
-alias "g_waypointsprite_team_danger_p" "impulse 38"
-alias "g_waypointsprite_team_danger_d" "impulse 39"
-alias "g_waypointsprite_clear_personal"        "impulse 47"
-alias "g_waypointsprite_clear" "impulse 48"
-alias "g_waypointsprite_toggle"        "toggle cl_hidewaypoints"
-
-seta cl_hidewaypoints 0 "disable static waypoints, only show team waypoints"
-
-seta g_waypointsprite_turrets 1 "disable turret waypoints"
-seta g_waypointsprite_turrets_maxdist 5000 "max distance for turret waypoints"
-
-seta cl_damagetext "1" "Draw damage dealt where you hit the enemy"
-seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health"
-seta cl_damagetext_format_verbose 0 "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ"
-seta cl_damagetext_format_hide_redundant 0 "hide {armor} if 0; hide {potential} and {potential_health} when same as actual"
-seta cl_damagetext_color "1 1 0" "Damage text color"
-seta cl_damagetext_color_per_weapon "0" "Damage text uses weapon color"
-seta cl_damagetext_size_min 10 "Damage text font size for small damage"
-seta cl_damagetext_size_min_damage 25 "How much damage is considered small"
-seta cl_damagetext_size_max 16 "Damage text font size for large damage"
-seta cl_damagetext_size_max_damage 140 "How much damage is considered large"
-seta cl_damagetext_alpha_start "1" "Damage text initial alpha"
-seta cl_damagetext_alpha_lifetime "3" "Damage text lifetime in seconds"
-seta cl_damagetext_velocity "0 0 20" "Damage text move direction"
-seta cl_damagetext_offset "0 -40 0" "Damage text offset"
-seta cl_damagetext_accumulate_range "30" "Damage text spawned within this range is accumulated"
-seta cl_damagetext_accumulate_alpha_rel "0.65" "Only update existing damage text when it's above this much percentage (0 to 1) of the starting alpha"
-seta cl_damagetext_friendlyfire "1" "Show damage text for friendlyfire too"
-seta cl_damagetext_friendlyfire_color "1 0 0" "Damage text color for friendlyfire"
-
-seta cl_damagetext_2d_pos "0.47 0.53 0" "2D damage text initial position (X and Y between 0 and 1)"
-seta cl_damagetext_2d_alpha_start 1 "2D damage text initial alpha"
-seta cl_damagetext_2d_alpha_lifetime 1.3 "2D damage text lifetime (alpha fading) in seconds"
-seta cl_damagetext_2d_size_lifetime 3 "2D damage text lifetime (size shrinking) in seconds"
-seta cl_damagetext_2d_velocity "-25 0 0" "2D damage text move direction (screen coordinates)"
-seta cl_damagetext_2d_overlap_offset "0 -15 0" "Offset 2D damage text by this much to prevent overlapping (screen coordinates)"
-seta cl_damagetext_2d_close_range 125 "Always use 2D damagetext for hits closer that this"
-seta cl_damagetext_2d_out_of_view 1 "Always use 2D damagetext for hits that occured off-screen"
-
-seta cl_vehicles_alarm 1 "Play an alarm sound when the vehicle you are driving is heavily damaged"
-seta cl_vehicles_hud_tactical 1
-seta cl_vehicles_hudscale 0.5
-seta cl_vehicles_notify_time 15
-seta cl_vehicles_crosshair_size 0.5
-seta cl_vehicles_crosshair_colorize 1
-
-set sv_itemstime 1 "enable networking of time left until respawn for items such as mega health/armor and powerups"
-
-// so it can be stuffcmd-ed still
-set cl_gravity 800     "but ignored anyway"
-
-set g_ban_default_bantime 5400 "90 minutes"
-set g_ban_default_masksize 3   "masksize 0 means banning by UID only, 1 means banning by /8 (IPv6: /32) network, 2 means banning by /16 (IPv6: /48) network, 3 means banning by /24 (IPv6: /56) network, 4 means banning by single IP (IPv6: /64 network)"
-set g_banned_list ""   "format: IP remainingtime IP remainingtime ..."
-set g_banned_list_idmode "1"   "when set, the IP banning system always uses the ID over the IP address (so a user in a banned IP range can connect if they have a valid signed ID)"
-
-r_labelsprites_scale 0.40625 // labels sprites get displayed at 0.5x from 640x480 to 1280x1024, and at 1x from 1600x1200 onwards
-
-exec binds-xonotic.cfg
+// campaign internal, set when loading a campaign map1G
+set _campaign_index ""
+set _campaign_name ""
+set _campaign_testrun 0 "To verify the campaign file, set this to 1, then start the first campaign level from the menu. If you end up in the menu again, it's good, if you get a QC crash, it's bad."
 
 // we must change its default from 1.0 to 1 to be consistent with menuqc
 set slowmo 1
 
-seta menu_skin "luma"
-set menu_slowmo 1
-seta menu_sounds 0 "enables menu sound effects. 1 enables click sounds, 2 also enables hover sounds"
-seta menu_tooltips 1 "menu tooltips: 0 disabled, 1 enabled, 2 also shows cvar or console command (when available) changed or executed by the item"
-set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!"
-set menu_showboxes 0 "show item bounding boxes (debug)"
-set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list"
-set menu_force_on_disconnection 1 "force to show the menu this number of seconds after you get disconnected (0 to disable)"
-
-r_textbrightness 0.2
-r_textcontrast 0.8
-r_textshadow 0
-r_font_postprocess_blur 1
-r_font_postprocess_outline 1
-
-// good settings for these fonts
-con_chat 5
-con_chatpos -9
-con_chatsize 10
-con_chatwidth 0.6
-con_notify 0
-con_notifysize 10
-con_notifyalign 0
-con_textsize 10
-
-seta sbar_info_pos 0 "Y-axis distance from lower right corner for engine info prints"
-
-// scoreboard
-seta scoreboard_columns default
-
-// keep old scoreboard cvars for compatibility's sake
-// they've been replaced by hud_panel_scoreboard_* cvars
-// TODO remove them after a future release (0.8.2+)
-seta scoreboard_border_thickness 1 "scoreboard border thickness"
-seta scoreboard_accuracy_border_thickness 1 "accuracy stats border thickness"
-seta scoreboard_accuracy_doublerows 0 "use two rows instead of one"
-seta scoreboard_accuracy_nocolors 0 "don't use colors displaying accuracy stats"
-seta scoreboard_accuracy 1 "show weapon accuracy stats panel on scoreboard; colors can be configured with accuracy_color* cvars"
-seta scoreboard_color_bg_r 0.125 "red color component of the scoreboard background"
-seta scoreboard_color_bg_g 0.55 "green color component of the scoreboard background"
-seta scoreboard_color_bg_b 0.875 "blue color component of the scoreboard background"
-seta scoreboard_color_bg_team 0.6 "team color multiplier of the scoreboard background"
-seta scoreboard_alpha_bg 0.7 "scoreboard background alpha"
-seta scoreboard_alpha_fg 1 "scoreboard foreground alpha"
-seta scoreboard_alpha_name 0.9 "alpha of player text in scoreboard list other than self"
-seta scoreboard_alpha_name_self 1 "alpha of player text in scoreboard list of self"
-seta scoreboard_fadeinspeed 10 "speed at which scoreboard fades in, higher is faster (0 = instant)"
-seta scoreboard_fadeoutspeed 5 "speed at which scoreboard fades out, higher is faster (0 = instant)"
-seta scoreboard_highlight 1 "enable highlighting for rows and columns in the scoreboard"
-seta scoreboard_highlight_alpha 0.08 "highlight alpha value (depends on hud_scoreboard_highlight 1)"
-seta scoreboard_highlight_alpha_self 0.3 "self highlight alpha value"
-seta scoreboard_offset_left 0.15 "how far (by percent) the scoreboard is offset from the left screen edge"
-seta scoreboard_offset_right 0.15 "how far (by percent) the scoreboard is offset from the right screen edge"
-seta scoreboard_offset_vertical 0.05 "how far (by percent) the scoreboard is offset from the top and bottom of the screen"
-seta scoreboard_bg_scale 0.25 "scale for the tiled scoreboard background"
-seta scoreboard_respawntime_decimals 1 "decimal places to show for the respawntime countdown display on the scoreboard"
-seta scoreboard_dynamichud 0 "apply the dynamic hud effects to the scoreboard"
-
-seta accuracy_color_levels "0 20 100" "accuracy values at which a specified color (accuracy_color<X>) will be used. If your accuracy is between 2 of these values then a mix of the Xth and X+1th colors will be used. You can specify up to 10 values, in increasing order"
-seta accuracy_color0 "1 0 0"
-seta accuracy_color1 "1 1 0"
-seta accuracy_color2 "0 1 0"
-
-// for menu server list (eventually make them have engine support?)
-seta menu_slist_showfull 1 "show servers even if they are full and have no slots to join"
-seta menu_slist_showempty 1 "show servers even if they are no empty and have no opponents to play against"
-seta menu_slist_modfilter "" // set to either: !modname or modname. modname of = means "same as we are running now".
-
-// other serverlist cvars
-seta menu_slist_categories 1
-seta menu_slist_categories_onlyifmultiple 1
-seta menu_slist_purethreshold 0
-seta menu_slist_modimpurity 0
-seta menu_slist_recommendations 3
-seta menu_slist_recommendations_maxping 150
-seta menu_slist_recommendations_minfreeslots 1
-seta menu_slist_recommendations_minhumans 0
-seta menu_slist_recommendations_purethreshold -1
-
-// serverlist category override cvars
-seta menu_slist_categories_CAT_FAVORITED_override ""
-seta menu_slist_categories_CAT_RECOMMENDED_override ""
-seta menu_slist_categories_CAT_NORMAL_override ""
-seta menu_slist_categories_CAT_SERVERS_override "CAT_NORMAL"
-seta menu_slist_categories_CAT_XPM_override ""
-seta menu_slist_categories_CAT_MODIFIED_override ""
-seta menu_slist_categories_CAT_OVERKILL_override ""
-seta menu_slist_categories_CAT_INSTAGIB_override ""
-seta menu_slist_categories_CAT_DEFRAG_override ""
-
-seta menu_weaponarena ""
-
-seta menu_maxplayers 16 "maxplayers value when the menu starts a game"
-
-// useful vote aliases
-set timelimit_increment 5
-set timelimit_decrement 5
-set timelimit_min 5
-set timelimit_max 60
-
-// useful keybind to maximize the chat area temporarily
-// HUD code takes care of many of these now...
-//set _backup_con_chatvars_set 0
-//alias _restore_con_chatvars_0 ""
-//alias _restore_con_chatvars_1 "set _backup_con_chatvars_set 0; con_chatpos $_backup_con_chatpos; con_chat $_backup_con_chat; con_notify $_backup_con_notify; con_chattime $_backup_con_chattime; cl_deathscoreboard $_backup_cl_deathscoreboard; scr_centertime $_backup_scr_centertime;r_track_sprites $_backup_r_track_sprites"
-//alias _restore_con_chatvars "_restore_con_chatvars_$_backup_con_chatvars_set"
-//alias _backup_con_chatvars_0 "set _backup_con_chatvars_set 1; set _backup_con_chatpos $con_chatpos; set _backup_con_chat $con_chat; set _backup_con_notify $con_notify; set _backup_con_chattime $con_chattime; set _backup_cl_deathscoreboard $cl_deathscoreboard; set _backup_scr_centertime $scr_centertime;set _backup_r_track_sprites $r_track_sprites"
-//alias _backup_con_chatvars_1 ""
-//alias _backup_con_chatvars "_backup_con_chatvars_$_backup_con_chatvars_set"
-//alias +con_chat_maximize "_backup_con_chatvars; con_chatpos -9; con_chat 100; con_notify 0; con_chattime 3600; cl_deathscoreboard 0; scr_centertime 0; r_track_sprites 0"
-//alias -con_chat_maximize "_restore_con_chatvars"
-
-set _con_chat_maximized 0
-set _backup_con_chatvars_set 0
-alias _restore_con_chatvars_0 ""
-alias _restore_con_chatvars_1 "set _backup_con_chatvars_set 0; con_notify $_backup_con_notify; con_chattime $_backup_con_chattime; cl_deathscoreboard $_backup_cl_deathscoreboard; scr_centertime $_backup_scr_centertime;r_track_sprites $_backup_r_track_sprites"
-alias _restore_con_chatvars "_restore_con_chatvars_$_backup_con_chatvars_set"
-alias _backup_con_chatvars_0 "set _backup_con_chatvars_set 1; set _backup_con_notify $con_notify; set _backup_con_chattime $con_chattime; set _backup_cl_deathscoreboard $cl_deathscoreboard; set _backup_scr_centertime $scr_centertime;set _backup_r_track_sprites $r_track_sprites"
-alias _backup_con_chatvars_1 ""
-alias _backup_con_chatvars "_backup_con_chatvars_$_backup_con_chatvars_set"
-alias +con_chat_maximize "_con_chat_maximized 1; _backup_con_chatvars; con_notify 0; con_chattime 3600; cl_deathscoreboard 0; scr_centertime 0; r_track_sprites 0"
-alias -con_chat_maximize "_con_chat_maximized 0; _restore_con_chatvars"
-
-// tab completion
-set con_completion_playdemo    *.dem
-set con_completion_timedemo    *.dem
-set con_completion_ply         *.dem
-set con_completion_tdem                *.dem
-set con_completion_exec                *.cfg
-set con_completion_chmap       map
-set con_completion_devmap      map
-set con_completion_gotomap     map
-set con_completion_vmap                map
-set con_completion_vnextmap    map
-set con_completion_vdomap      map
-set con_completion_playermodel "models/player/*.iqm"
-
-// helper
-// these non-saved engine cvars shall be saved
-alias makesaved "seta $1 \"${$1 ?}\""
-makesaved cl_maxfps_alwayssleep
-makesaved cl_port
-makesaved gl_finish
-makesaved net_slist_queriespersecond
-makesaved r_ambient
-makesaved r_drawviewmodel
-makesaved r_showsurfaces
-makesaved r_subdivisions_tolerance
-makesaved skill
-makesaved vid_gl13
-makesaved vid_gl20
-makesaved v_idlescale
-makesaved v_kicktime
-makesaved music_playlist_list0
-makesaved music_playlist_random0
-
 // ticrate
 //sys_ticrate 0.0166667 // 60fps. This would be ideal, but kills home routers.
 sys_ticrate 0.0333333 // Use 30fps instead.
-cl_netfps 60 // should match or be a multiple
-sv_gameplayfix_delayprojectiles 0
-sv_gameplayfix_q2airaccelerate 1
-sv_gameplayfix_stepmultipletimes 1
-
-// delay for "kill" to prevent abuse
-set g_balance_kill_delay 2
-set g_balance_kill_antispam 5
-
-// this feature is currently buggy in the engine (it appears to PREVENT any dropping in lots of maps, leading to weirdly aligned entities, and in some cases even CAUSES them to drop through solid, like in facing worlds nex)
-sv_gameplayfix_droptofloorstartsolid 0
-
-seta gl_texturecompression 0
-gl_texturecompression_color 1
-gl_texturecompression_gloss 1
-gl_texturecompression_glow 1
-gl_texturecompression_lightcubemaps 1
-gl_texturecompression_q3bsplightmaps 0
-gl_texturecompression_sky 1
-
-cl_maxfps 200
-
-seta menu_mouse_absolute 1 "use the OS mouse pointer motion for menu"
-seta menu_mouse_speed 1 "speed multiplier for the mouse in the menu (does not affect in-game aiming)"
-set menu_use_default_hostname 1
-alias sethostname "set menu_use_default_hostname 0; hostname $*"
-
-set sv_foginterval 1 "force enable fog in regular intervals"
 
 // Audio track names (for old-style "cd loop NUMBER" usage)
 set _cdtrack_first "1"
@@ -1054,355 +75,31 @@ set sv_intermission_cdtrack ""
 set g_cdtracks_dontusebydefault "rising-of-the-phoenix"
 seta menu_cdtrack "rising-of-the-phoenix"
 
-set sv_maxidle 0 "kick players idle for more than this amount of time in seconds"
-set sv_maxidle_spectatorsareidle 0 "when sv_maxidle is not 0, assume spectators are idle too"
-set sv_maxidle_slots 0 "when not 0, only kick idlers when this many or less player slots are available"
-set sv_maxidle_slots_countbots 1 "count bots as player slots"
-
 // these entities are not referenced by anything directly, they just represent
 // teams and are found by find() when needed
 prvm_leaktest_ignore_classnames "ctf_team dom_team tdm_team"
 prvm_backtraceforwarnings 1
 
-sv_allowdownloads_inarchive 1 // for csprogs.dat
-sv_allowdownloads 0 // download protocol is evil
-
-set g_jump_grunt 0     "Do you make a grunting noise every time you jump? Is it the same grunting noise every time?"
-
-seta cl_weaponpriority "vaporizer hmg rpc vortex fireball mortar machinegun hagar rifle arc electro devastator crylink minelayer shotgun shockwave hlac tuba blaster porto seeker hook" "weapon priority list"
-seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wheel makes use of the weapon priority list (the special value 2 uses the weapon ID list for cycling)"
-seta cl_weaponpriority0 "rpc devastator mortar hagar seeker fireball"                   "use weapon_priority_0_prev for prev gun from this list, weapon_priority_0_best for best gun, weapon_priority_0_next for next gun.  Default value: explosives"
-seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave"   "use weapon_priority_1_prev for prev gun from this list, weapon_priority_1_best for best gun, weapon_priority_1_next for next gun.  Default value: energy"
-seta cl_weaponpriority2 "vaporizer vortex rifle"                                        "use weapon_priority_2_prev for prev gun from this list, weapon_priority_2_best for best gun, weapon_priority_2_next for next gun.  Default value: hitscan exact"
-seta cl_weaponpriority3 "vaporizer hmg vortex rifle machinegun shotgun shockwave"       "use weapon_priority_3_prev for prev gun from this list, weapon_priority_3_best for best gun, weapon_priority_3_next for next gun.  Default value: hitscan all"
-seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun shockwave"  "use weapon_priority_4_prev for prev gun from this list, weapon_priority_4_best for best gun, weapon_priority_4_next for next gun.  Default value: spam weapons"
-seta cl_weaponpriority5 "blaster shockwave hook porto"                                  "use weapon_priority_5_prev for prev gun from this list, weapon_priority_5_best for best gun, weapon_priority_5_next for next gun.  Default value: weapons for moving"
-seta cl_weaponpriority6 ""                                                              "use weapon_priority_6_prev for prev gun from this list, weapon_priority_6_best for best gun, weapon_priority_6_next for next gun"
-seta cl_weaponpriority7 ""                                                              "use weapon_priority_7_prev for prev gun from this list, weapon_priority_7_best for best gun, weapon_priority_7_next for next gun"
-seta cl_weaponpriority8 ""                                                              "use weapon_priority_8_prev for prev gun from this list, weapon_priority_8_best for best gun, weapon_priority_8_next for next gun"
-seta cl_weaponpriority9 ""                                                              "use weapon_priority_9_prev for prev gun from this list, weapon_priority_9_best for best gun, weapon_priority_9_next for next gun"
-seta cl_weaponimpulsemode 0 "0: only cycle between currently usable weapons in weapon priority order; 1: cycle between all possible weapons on a key in weapon priority order"
-
-set g_maplist_allow_hidden 0           "allow hidden maps to be, e.g., voted for and in the maplist"
-set g_maplist_allow_frustrating 0      "allow impossible maps to be, e.g., voted for and in the maplist (if set to 2, ONLY impossible maps are allowed)"
-
-alias _gl_flashblend_update_00 "gl_flashblend 1"
-alias _gl_flashblend_update_10 "gl_flashblend 0"
-alias _gl_flashblend_update_01 "gl_flashblend 0"
-alias _gl_flashblend_update_11 "gl_flashblend 0"
-alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_showsurfaces"
-
-set sv_clones 0        "number of clones a player may make (reset by the \"kill\" command)"
-
-set cl_handicap 1      "multiplies damage received and divides damage dealt NOTE: reconnect or use 'sendcvar cl_handicap' to update the choice."
-
-seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice."
-
-seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway."
-
-seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"
-
-seta cl_race_cptimes_onlyself 0 "Only show your own times on checkpoints in Race/CTS"
-
-// must be at the bottom of this file:
-
-set g_bugrigs 0
-set g_bugrigs_planar_movement 1        "BROTRR bug emulation"
-set g_bugrigs_planar_movement_car_jumping 1    "my own bug"
-set g_bugrigs_reverse_speeding 1       "BROTRR bug emulation"
-set g_bugrigs_reverse_spinning 1       "BROTRR bug emulation"
-set g_bugrigs_reverse_stopping 1       "BROTRR bug emulation"
-set g_bugrigs_air_steering 1   "NFS bug emulation"
-set g_bugrigs_angle_smoothing 5        "smooth the car angle a bit, looks nice"
-set g_bugrigs_friction_floor 50        "units/sec friction on floor"
-set g_bugrigs_friction_brake 950       "units/sec friction for braking"
-set g_bugrigs_friction_air 0.00001     "(very small) v <- v - v^2 * g_bugrigs_friction_air"
-set g_bugrigs_accel 800        "acceleration"
-set g_bugrigs_speed_ref 400    "reference speed for accel and steer responsiveness"
-set g_bugrigs_speed_pow 2      "reference power for accel and steer responsiveness"
-set g_bugrigs_steer 1  "steering amount"
-
-set g_ban_sync_uri ""  "sync using this ban list provider (empty string to disable)"
-set g_ban_sync_interval 5      "sync every 5 minutes"
-set g_ban_sync_trusted_servers ""      "request ban lists from these xonotic servers (do not include your own server there, or unbanning may fail)"
-set g_ban_sync_timeout 45      "time out in seconds for the ban sync requests"
-set g_ban_sync_trusted_servers_verify 0        "when set to 1, additional bans sent by the servers are ignored, and only bans for the requested IP are used"
-
-set g_showweaponspawns 1 "1: display waypoints for weapon spawns found on the map when a weapon key is pressed and the weapon is not owned; 2: for dropped weapons too; 3: for all the weapons sharing the same impulse"
-
-// ballistics use physical units, but qu based
-//   Quake-Newton: 1 qN  = 1 qu * 1 g / 1 s^2
-//   Quake-Joule:  1 qJ  = 1 qN * 1 qu
-//   Quake-Pascal: 1 qPa = 1 qN / 1 qu^2
-
-set g_ballistics_mindistance 2 // enable ballistics starting from 2 qu
-set g_ballistics_density_player 0.50 // players are 2x as easy to pass as walls
-set g_ballistics_density_corpse 0.10 // corpses are 10x as easy to pass as walls
-set g_ballistics_penetrate_clips 0 "allow ballistics to pass through weapon clips"
-
-set cl_stripcolorcodes 0       "experimental feature (notes: strips ALL color codes from messages!)"
-
-sv_status_show_qcstatus 1      "Xonotic uses this field instead of frags"
-set g_full_getstatus_responses 0       "this currently breaks qstat"
-
-// Demo camera
-set camera_enable              0       "Enables the camera for demo playback"
-set camera_free                0       "Free camera instead of chasing the player"
-set camera_reset               0       "Resets the camera position and switch to chase mode"
-set camera_speed_roll          0.9     "Camera rotation speed"
-set camera_speed_chase                 4       "Camera movement speed on the x/y/z axis while chasing the player"
-set camera_speed_free          8       "Camera movement speed on the x/y/z axis in free mode"
-set camera_speed_attenuation   10      "Camera movements attenuation factor. Bigger is smoother. Applies to mouse movements"
-set camera_mouse_threshold     0.5     "Use to ignore small mouse movements. This allows for smoother camera control"
-set camera_chase_smoothly      0       "Attenuate player movements (only in chase mode)"
-set camera_look_player         0       "Always look to the player. Mouse input is ignored in this mode"
-set camera_look_attenuation    8       "Attenuation of \"looking\" movements, only if camera_look_player is set. Bigger is smoother"
-set camera_forward_follows     1       "0: Move the camera forwards without changing altitude. 1: Move towards what you are looking"
-
-// "Gentle mode": show no blood
-seta sv_gentle 0               "force gentle mode for everyone, also remove references to acts of killing from the messages"
-seta cl_gentle 0               "client side gentle mode, master switch for removing both gibs and messages"
-seta cl_gentle_gibs 0          "client side gentle mode (only replaces gibs); when set to 1, white smoke replaces gibs, when set to 2, colorful clouds replace gibs"
-seta cl_gentle_messages 0      "client side gentle mode (only replaces frag messages/centerprints)"
-seta cl_gentle_damage 0        "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomly colored flash is used instead"
-
-set g_jetpack 0 "Jetpack mutator"
-
-set g_running_guns 0 "... or wonder, till it drives you mad, what would have followed if you had."
-
 set _urllib_nextslot 0 "temp variable"
-set cl_warpzone_usetrace 1 "do not touch"
-
-set cl_effects_lightningarc_simple 0
-set cl_effects_lightningarc_segmentlength 64
-set cl_effects_lightningarc_drift_start 0.45
-set cl_effects_lightningarc_drift_end 0.1
-set cl_effects_lightningarc_branchfactor_start 0.25
-set cl_effects_lightningarc_branchfactor_add 0.1
-
-set g_hitplots 0 "when set to 1, hitplots are stored by the server to provide a means of proving that a triggerbot was used"
-seta g_hitplots_individuals "" "the individuals, by IP, that should have their hitplots recorded"
-
-set menu_updatecheck 1 "check for updates"
-set menu_updatecheck_getpacks 1 "get update packs from update server"
-
-set bot_navigation_ignoreplayers 0 // FIXME remove this once the issue is solved
-set bot_sound_monopoly 0 "when enabled, only bots can make any noise"
-
-set cl_loddistance1 1024
-set cl_loddistance2 3072
-seta cl_playerdetailreduction 4        "the higher, the less detailed player models are displayed (LOD)"
-seta cl_modeldetailreduction 1 "the higher, the less detailed certain map models are displayed (LOD)"
-
-set g_mapinfo_settemp_acl "+*" "ACL for mapinfo setting cvars"
-
-seta cl_casings_maxcount 100 "maximum amount of shell casings (must be at least 1)"
-seta cl_gibs_maxcount 100 "maximum amount of gibs (must be at least 1)"
-
-//cl_gunalign calculator
-seta menu_cl_gunalign 3 "Gun alignment; 1 = center (if allowed by g_shootfromclient) or right, 2 = center (if allowed by g_shootfromclient) or left, 3 = right only, 4 = left only"
-alias _gunalign_01 "cl_gunalign 1"
-alias _gunalign_02 "cl_gunalign 2"
-alias _gunalign_03 "cl_gunalign 3"
-alias _gunalign_04 "cl_gunalign 4"
-alias _gunalign_11 "cl_gunalign 2"
-alias _gunalign_12 "cl_gunalign 1"
-alias _gunalign_13 "cl_gunalign 4"
-alias _gunalign_14 "cl_gunalign 3"
-alias _gunalign_update "_gunalign_$v_flipped$menu_cl_gunalign"
-
-set _menu_alpha "" // will be set by menu QC to the current fading of the menu, can be used by CSQC to fade items
-set _menu_initialized 0 "is 0 on first menu loading, 1 later"
-
-set g_triggerimpulse_accel_power 1 "trigger_impulse accelerator power (applied BEFORE the multiplier)"
-set g_triggerimpulse_accel_multiplier 1 "trigger_impulse accelerator multiplier (applied AFTER the power)"
-set g_triggerimpulse_directional_multiplier 1 "trigger_impulse directional field multiplier"
-set g_triggerimpulse_radial_multiplier 1 "trigger_impulse radial field multiplier"
-set the_goggles "they do nothing" "but the googles, they do"
-
-set sv_weaponstats_file "" "when set to a file name, per-weapon stats get written to that file"
 
-seta cl_noantilag 0 "turn this on if you believe antilag is bad"
-
-set rescan_pending 0 "set to 1 to schedule a fs_rescan at the end of this match"
-
-set g_mapinfo_allow_unsupported_modes_and_let_stuff_break "0" "set to 1 to be able to force game types using g_ cvars even if the map does not support them"
-
-// weapon accuracy stats
-set sv_accuracy_data_share 1 "1 send weapon accuracy data statistics to spectating clients, depends on cl_accuracy_data_share"
-set sv_accuracy_data_send 1 "1 send weapon accuracy data statistics and improved score info to all the clients at the end of the match, depends on cl_accuracy_data_receive, 0 send the current 'player has won' to all the clients"
-set cl_accuracy_data_share 0 "1 share my weapon accuracy data statistics with other players, 0 keep my weapon accuracy data statistics hidden"
-set cl_accuracy_data_receive 0 "1 receive weapon accuracy data statistics at the end of the match"
-
-set spawn_debug 0 "use all spawns one by one, then abort, to verify all spawnpoints"
-set loddebug 0 "force this LOD level"
-set spawn_debugview 0 "display spawnpoints and their rating on spawn to debug spawnpoint rating calculation"
-set g_mutatormsg "" "mutator message"
-set speedmeter 0 "print landing speeds"
-set developer_csqcentities 0 "csqc entity spam"
-set waypoint_benchmark 0 "quit after waypoint loading to benchmark bot navigation code"
-set g_debug_bot_commands 0 "print scripted bot commands before executing"
 set g_debug_defaultsounds 0 "always use default sounds"
-seta cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_defaultcharacter 0)"
-seta cl_forceplayercolors 0 "make enemies look like your own color (requires server to have sv_defaultcharacter 0); set it to 2 to enable it even in teamplay (only when there is exactly one enemy team)"
-seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
-seta cl_forcemyplayerskin 0 "set to the skin number you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
-seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_color) for your own player model (ignored in teamplay; does not affect how enemies look with cl_forceplayermodels)"
-seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce perceived lag"
-seta cl_movement_intermissionrunning 0 "keep velocity after the match ends, players may appear to continue running while stationary"
-
-// campaign internal, set when loading a campaign map1G
-set _campaign_index ""
-set _campaign_name ""
-set _campaign_testrun 0 "To verify the campaign file, set this to 1, then start the first campaign level from the menu. If you end up in the menu again, it's good, if you get a QC crash, it's bad."
-
-// debug
-set _independent_players 0 "DO NOT TOUCH"
-set _notarget 0 "NO, REALLY, DON'T"
-set debugdraw 0
-set debugdraw_filter ""
-set debugdraw_filterout ""
-set debugtrace 0
 
 // define some engine cvars that we need even on dedicated server
 set r_showbboxes 0
 
-// we REALLY need the end pos nudging DP bug workaround for trace-to-end-of-solid to work
-collision_endposnudge 1
-
-// FIXME remove this when the engine feature FINALLY MAYBE works
-r_glsl_skeletal 0
-
-// animation tuning
-set cl_lerpanim_maxdelta_framegroups 0.05 // must be faster than fastest weapon refire
-set cl_lerpanim_maxdelta_server 0.1 // must be slower than slowest server controlled anim (e.g. animinfo stuff)
-
-// otherwise, antilag breaks
-sv_gameplayfix_consistentplayerprethink 1
-
 // support Q1BSP maps
 mod_q1bsp_polygoncollisions 1
 
 // match q3map2
 mod_obj_orientation 0
 
-// improve some minor details
-sv_gameplayfix_gravityunaffectedbyticrate 1
-sv_gameplayfix_nogravityonground 1
-
-// autodemo deleting
-seta cl_autodemo_delete_keeprecords 0 "when 1, records with a newly made race/cts demo are kept even if cl_autodemo_delete is used to delete demos"
-
-// freeze camera
-set cl_lockview 0 "when 1, the camera does not move any more"
-
-// we now use mastervolume
-volume 1
-
-// sucks less than the old one
-cl_decals_newsystem 1
-
-set sv_q3acompat_machineshotgunswap 0 "shorthand for swapping machinegun and shotgun (for Q3A map compatibility in mapinfo files)"
-
-set g_movement_highspeed 1 "movement speed modification factor (only changes movement when above maxspeed)"
-
-set g_maxspeed 0 "player speed limit, faster players are killed (0 for unlimited speed)"
-
-scr_conalpha 1
-scr_conalpha2factor 0.3
-scr_conalpha3factor 1
-scr_conalphafactor 0.8
-scr_conbrightness 0.35
-scr_conforcewhiledisconnected 1
-scr_conscroll2_x 0.11
-scr_conscroll2_y 0.2
-scr_conscroll3_x 0
-scr_conscroll3_y 0
-scr_conscroll_x -0.1
-scr_conscroll_y -0.3
-
-scr_conforcewhiledisconnected 0
-scr_infobar_height 12
-
-// DP cannot properly detect this, so rather turn off the detection
-r_texture_dds_load_alphamode 2
-r_texture_dds_swdecode 1 // SW decode to quarter res if we want to load DDS but don't support the extension for it
-r_texture_dds_load_logfailure 0 // this engine feature SUCKS
-set vid_netwmfullscreen 0 // doesn't support non-native res
-
-// particles optimization
-r_drawparticles_nearclip_min 8
-r_drawparticles_nearclip_max 16
-
-// sv_cullentities_trace is 1, so the client doesn't have to
-sv_cullentities_trace 1
-r_cullentities_trace 0
-
-// less "lagging" of other players, but also less PL tolerant... let's try this
-sv_clmovement_inputtimeout 0.066 // slightly less than 2 frames, so only one frame can be compensated
-
-// exact gloss looks better, e.g. on g-23
-r_shadow_glossexact 1
-r_shadow_glossintensity 1
-
-// use fake light if map has no lightmaps
-r_fakelight 1
-
-r_water_hideplayer 1 // hide your own feet/player model in refraction views, this way you don't see half of your body under water
-r_water_refractdistort 0.019
-
-set cl_rainsnow_maxdrawdist 2048
-
-// strength sound settings
-set sv_strengthsound_antispam_time 0.1 "minimum distance of strength sounds"
-set sv_strengthsound_antispam_refire_threshold 0.04 "apply minimum distance only if refire of the gun is smaller than this"
-
-// equalize looks better than fullbright
-r_equalize_entities_fullbright 1
-
 // UTF-8
 utf8_enable 1
 
-// safe font defaults
-r_font_hinting 1
-r_font_disable_freetype 0
-r_font_size_snapping 4
-
-// database management
-set sv_db_saveasdump 0 "write server.db in dump format (loads slower, easier to read/parse)"
-set cl_db_saveasdump 0 "write client.db in dump format (loads slower, easier to read/parse)"
-
-// uid2name
-seta cl_allow_uid2name -1 "-1 = ask if the player wants to disable/enable this feature, 0 = disable, 1 = enable uid2name (allows showing your name in race rankings for instance)"
-seta cl_allow_uidtracking 1 "-1 = ask if the player wants to disable/enable this feature, 0 = disable, 1 = enable uid tracking (allows associating your data with your player ID)"
-// FIXME set to -1 before release, once we have a dialog for this!
-
-// polygonoffset for submodel SUCKS SUCKS SUCKS (only a hack for quake1, we don't need that)
-r_polygonoffset_submodel_offset 0
-r_polygonoffset_submodel_factor 0
-// decals: need a higher polygonoffset than default to not compete with _decal surfaces too much
-r_polygonoffset_decals_offset -28
-r_polygonoffset_decals_factor 0
 // this is mainly for _decal entities (their shaders should use "polygonoffset" shader parameter) - this is "good enough" as it seems, but smaller than the decals one so these don't zfight decals
 mod_q3shader_default_polygonoffset -14
 mod_q3shader_default_polygonfactor 0
 
-// allow fullbright
-set sv_allow_fullbright 1 "when set, clients may use r_fullbright on this server without getting a night vision effect overlay"
-
-// auto-teams (team selection by player ID)
-// any player not listed is forced to spectate
-set g_forced_team_red "" "list of player IDs for red team"
-set g_forced_team_blue "" "list of player IDs for blue team"
-set g_forced_team_yellow "" "list of player IDs for yellow team"
-set g_forced_team_pink "" "list of player IDs for pink team"
-set g_forced_team_otherwise "default" "action if a non listed player joins (can be default for default action, spectate for forcing to spectate, or red, blue, yellow, pink)"
-
-// nice alias to set up a match
-// example: g_forced_team_matchsetup stormkeep "mzDo0nO2y3XpFPNbQAyeUucyaejZ9xpiXLYMGU2x3qM=" "BRLOGENSHFEGLE/+Mq3x2UGMYLXipx9ZjeaycuUeyAQ="
-// will set up a match on stormkeep where mzDo0nO2y3XpFPNbQAyeUucyaejZ9xpiXLYMGU2x3qM= and BRLOGENSHFEGLE/+Mq3x2UGMYLXipx9ZjeaycuUeyAQ= play against each other
-alias g_forced_team_matchsetup "map $1; settemp g_forced_team_red \"$2\"; settemp g_forced_team_blue \"$3\"; settemp g_forced_team_yellow \"$4\"; settemp g_forced_team_pink \"$5\"; settemp g_forced_team_otherwise spectate"
-
 // random charge stuff :P
 set g_weapon_charge_colormod_hdrmultiplier 4 "how much to multiply the colors by in the colormod vector"
 set g_weapon_charge_colormod_red_half 0
@@ -1412,28 +109,6 @@ set g_weapon_charge_colormod_red_full 1
 set g_weapon_charge_colormod_green_full -0.5
 set g_weapon_charge_colormod_blue_full -1
 
-// frozen
-set g_frozen_revive_falldamage 0 "Enable reviving from this amount of fall damage"
-set g_frozen_revive_falldamage_health 40 "Amount of health player has if they revived from falling"
-set g_frozen_damage_trigger 1 "if 1, frozen players falling into the void will die instead of teleporting to spawn"
-set g_frozen_force 0.6 "How much to multiply the force on a frozen player with"
-
-// player statistics
-set g_playerstats_gamereport_uri "http://stats.xonotic.org/stats/submit" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
-set g_playerstats_gamereport_ladder ""
-set g_playerstats_playerbasic_uri "http://stats.xonotic.org"
-set g_playerstats_playerdetail_uri "http://stats.xonotic.org/player/me"
-set g_playerstats_playerdetail_autoupdatetime 1800 // automatically update every 30 minutes anyway
-
-// autoscreenshots
-set g_max_info_autoscreenshot 3 "how many info_autoscreenshot entities are allowed"
-
-// mod names for server browser
-// note: the lowest of these that mismatches default is used
-set g_mod_physics "" "Current physics config name"
-set g_mod_balance "" "Current balance config name"
-set g_mod_config  "" "Current config mod name"
-
 // session locking
 locksession 1
 
@@ -1457,67 +132,11 @@ seta snd_channel9volume 1 "QuakeC controlled ambient sound volume"
 snd_identicalsoundrandomization_time -0.1
 snd_identicalsoundrandomization_tics    1
 
-// loading screen
-scr_loadingscreen_background 0
-scr_loadingscreen_barcolor "0 0.5 1"
-scr_loadingscreen_barheight 12
-scr_loadingscreen_count 1
-scr_loadingscreen_firstforstartup 1
-scr_loadingscreen_scale 999
-scr_loadingscreen_scale_base 1
-scr_loadingscreen_scale_limit 2
-
-// other config files
-exec balance-xonotic.cfg
-exec effects-normal.cfg
-exec physicsX.cfg
-exec turrets.cfg
-exec crosshairs.cfg
-exec gamemodes.cfg
-exec mutators.cfg
-exec notifications.cfg
-exec monsters.cfg
-exec minigames.cfg
-exec physics.cfg
-
 // load console command aliases and settings
 exec commands.cfg
 
-// hud cvar descriptions and common settings
-exec _hud_common.cfg
-exec _hud_descriptions.cfg
-// exec the default skin config
-// please add any new cvars into the hud_save script in qcsrc/client/hud_config.qc for consistency
-exec hud_luma.cfg
-
-
 // ... and now that everything is configured/aliased, we can do some things:
 
 // Change g_start_delay based upon if the server is local or not.
 if_client set g_start_delay 0  "delay before the game starts, so everyone can join; recommended to set this to like 15 on a public server"
 if_dedicated set g_start_delay 15      "delay before the game starts, so everyone can join; recommended to set this to like 15 on a public server"
-
-// enable menu syncing
-alias menu_sync "menu_cmd sync"
-
-set sv_join_notices ""
-set sv_join_notices_time 15
-
-seta cl_items_nofade 0
-seta cl_animate_items 1
-seta cl_ghost_items 0.45 "enable ghosted items (when between 0 and 1, overrides the alpha value)"
-seta cl_ghost_items_color "-1 -1 -1" "color of ghosted items, 0 0 0 leaves the color unchanged"
-set sv_simple_items 1 "allow or forbid client use of simple items"
-seta cl_simple_items 0 "enable simple items (if server allows)"
-set cl_simpleitems_postfix "_luma" "posfix to add fo model name when simple items are enabled"
-set cl_fullbright_items 0 "enable fullbright items (if server allows, controlled by g_fullbrightitems)"
-set cl_weapon_stay_color "2 0.5 0.5" "Color of picked up weapons when g_weapon_stay > 0"
-set cl_weapon_stay_alpha 0.75 "Alpha of picked up weapons when g_weapon_stay > 0"
-
-set sv_showspectators 1 "Show who's spectating who in the player info panel when client has cl_showspectators on. Shouldn't be used on competitive servers, also disable when watching a suspected cheater"
-seta cl_showspectators 0 "Show who's spectating you if server has sv_showspectators enabled"
-
-// Facility for config.cfg use ONLY.
-// Interpreted in post-config.cfg.
-seta menu_forced_saved_cvars "" "These cvars will always be saved, despite engine/Xonotic cvar saving status"
-set menu_reverted_nonsaved_cvars "" "These cvars are currently marked as saved in the flags, but have been reverted and won't stay saved. INTERNAL USE ONLY."
diff --git a/gamemodes-client.cfg b/gamemodes-client.cfg
new file mode 100644 (file)
index 0000000..e7a1607
--- /dev/null
@@ -0,0 +1,36 @@
+// say aliases
+alias asay_ctf_flagcarrier "say_team flag carrier at %y"
+alias asay_ctf_haveflag "say_team (%l) have the flag"
+alias asay_willgo "say_team will go to %y"
+alias asay_support "say_team (%l) need help, %h%%"
+alias asay_killed "say_team got killed at %d"
+alias asay_noammo "say_team (%l) need %W for %w"
+alias asay_drop "say_team (%l) dropped %w ; impulse 17"
+
+// =================
+//  gamestart hooks
+// =================
+
+seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to
+alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2"
+alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}"
+alias cl_hook_gamestart_all
+alias cl_hook_gamestart_nop  //is only called when CSQC unloads before knowing the gametype, very unlikely
+alias cl_hook_gamestart_dm
+alias cl_hook_gamestart_tdm
+alias cl_hook_gamestart_dom
+alias cl_hook_gamestart_ctf
+alias cl_hook_gamestart_lms
+alias cl_hook_gamestart_ca
+alias cl_hook_gamestart_kh
+alias cl_hook_gamestart_ons
+alias cl_hook_gamestart_as
+alias cl_hook_gamestart_rc
+alias cl_hook_gamestart_nb
+alias cl_hook_gamestart_cts
+alias cl_hook_gamestart_ka
+alias cl_hook_gamestart_ft
+alias cl_hook_gamestart_inv
+alias cl_hook_gameend "rpn /cl_matchcount dup load 1 + =" // increase match count every time a game ends
+alias cl_hook_shutdown
+alias cl_hook_activeweapon
diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg
new file mode 100644 (file)
index 0000000..6790a3b
--- /dev/null
@@ -0,0 +1,524 @@
+// ===================================
+//  Master config for core game modes
+// ===================================
+
+// global gametype setting (0 = deathmatch)
+set gamecfg 0
+
+
+// =================
+//  gamestart hooks
+// =================
+
+alias _sv_hook_gamestart "set _sv_hook_gametype $1; _sv_hook_gamestart_stage2"
+alias _sv_hook_gamestart_stage2 "sv_hook_gamestart_all; sv_hook_gamestart_${_sv_hook_gametype}"
+alias sv_hook_gamestart_all
+alias sv_hook_gamestart_dm
+alias sv_hook_gamestart_tdm
+alias sv_hook_gamestart_dom
+alias sv_hook_gamestart_ctf
+alias sv_hook_gamestart_lms
+alias sv_hook_gamestart_ca
+alias sv_hook_gamestart_kh
+alias sv_hook_gamestart_ons
+alias sv_hook_gamestart_as
+alias sv_hook_gamestart_rc
+alias sv_hook_gamestart_nb
+alias sv_hook_gamestart_cts
+alias sv_hook_gamestart_ka
+alias sv_hook_gamestart_ft
+alias sv_hook_gamestart_inv
+alias sv_hook_gamerestart
+alias sv_hook_gameend
+
+
+// =====================
+//  gametype vote hooks
+// =====================
+// These are called when the mode is switched via gametype vote screen,
+// earlier than gamestart hooks (useful for enabling per-gamemode mutators)
+// The _all hook is called before the specific one
+// here it sets g_maxplayers to undo what duel does
+alias sv_vote_gametype_hook_all "set g_maxplayers 0"
+alias sv_vote_gametype_hook_as
+alias sv_vote_gametype_hook_ca
+alias sv_vote_gametype_hook_ctf
+alias sv_vote_gametype_hook_cts
+alias sv_vote_gametype_hook_dm
+alias sv_vote_gametype_hook_dom
+alias sv_vote_gametype_hook_ft
+alias sv_vote_gametype_hook_inv
+alias sv_vote_gametype_hook_ka
+alias sv_vote_gametype_hook_kh
+alias sv_vote_gametype_hook_lms
+alias sv_vote_gametype_hook_nb
+alias sv_vote_gametype_hook_ons
+alias sv_vote_gametype_hook_rc
+alias sv_vote_gametype_hook_tdm
+
+// Preset to allow duel to be used for the gametype voting screen
+// sv_vote_gametype_*_type Must be set to the name of the gametype the option is based on
+// sv_vote_gametype_*_name Contains a human-readable name of the gametype
+// sv_vote_gametype_*_description Contains a longer description
+set sv_vote_gametype_duel_type dm
+set sv_vote_gametype_duel_name Duel
+set sv_vote_gametype_duel_description "One vs One match"
+alias sv_vote_gametype_hook_duel "set g_maxplayers 2"
+
+
+// ===========
+//  leadlimit
+// ===========
+// this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF, and Runematch.
+set leadlimit 0
+set leadlimit_and_fraglimit 0 "if set, leadlimit is ANDed with fraglimit (otherwise ORed)"
+seta timelimit_override -1     "Time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta fraglimit_override -1     "Frag limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta leadlimit_override -1     "Lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta capturelimit_override -1  "Capture limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta captureleadlimit_override -1      "Capture llead imit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_domination_point_limit -1       "Domination point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_domination_point_leadlimit -1   "Domination point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_keyhunt_point_limit -1  "Keyhunt point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_keyhunt_point_leadlimit -1      "Keyhunt point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_race_laps_limit -1      "Race laps limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_nexball_goallimit -1 "Nexball goal limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_nexball_goalleadlimit -1 "Nexball goal lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_invasion_point_limit -1 "Invasion point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+
+
+// =================================
+//  respawn delay/waves/weapon_stay
+// =================================
+// when variables are set to anything other than 0, they take over the global setting. Negative values force an output value of zero.
+set g_ctf_respawn_delay_small 1
+set g_ctf_respawn_delay_small_count 1
+set g_ctf_respawn_delay_large 5
+set g_ctf_respawn_delay_large_count 5
+set g_ctf_respawn_delay_max 0
+set g_ctf_respawn_waves 0
+set g_ctf_weapon_stay 0
+set g_dm_respawn_delay_small 0
+set g_dm_respawn_delay_small_count 0
+set g_dm_respawn_delay_large 0
+set g_dm_respawn_delay_large_count 0
+set g_dm_respawn_delay_max 0
+set g_dm_respawn_waves 0
+set g_dm_weapon_stay 0
+set g_dom_respawn_delay_small 0
+set g_dom_respawn_delay_small_count 0
+set g_dom_respawn_delay_large 0
+set g_dom_respawn_delay_large_count 0
+set g_dom_respawn_delay_max 0
+set g_dom_respawn_waves 0
+set g_dom_weapon_stay 0
+set g_lms_respawn_delay_small 0
+set g_lms_respawn_delay_small_count 0
+set g_lms_respawn_delay_large 0
+set g_lms_respawn_delay_large_count 0
+set g_lms_respawn_delay_max 0
+set g_lms_respawn_waves 0
+set g_lms_weapon_stay 0
+set g_tdm_respawn_delay_small 0
+set g_tdm_respawn_delay_small_count 0
+set g_tdm_respawn_delay_large 0
+set g_tdm_respawn_delay_large_count 0
+set g_tdm_respawn_delay_max 0
+set g_tdm_respawn_waves 0
+set g_tdm_weapon_stay 0
+set g_ka_respawn_delay_small 0
+set g_ka_respawn_delay_small_count 0
+set g_ka_respawn_delay_large 0
+set g_ka_respawn_delay_large_count 0
+set g_ka_respawn_delay_max 0
+set g_ka_respawn_waves 0
+set g_ka_weapon_stay 0
+set g_kh_respawn_delay_small 0
+set g_kh_respawn_delay_small_count 0
+set g_kh_respawn_delay_large 0
+set g_kh_respawn_delay_large_count 0
+set g_kh_respawn_delay_max 0
+set g_kh_respawn_waves 0
+set g_kh_weapon_stay 0
+set g_ca_respawn_delay_small 0
+set g_ca_respawn_delay_small_count 0
+set g_ca_respawn_delay_large 0
+set g_ca_respawn_delay_large_count 0
+set g_ca_respawn_delay_max 0
+set g_ca_respawn_waves 0
+set g_ca_weapon_stay 0
+set g_nb_respawn_delay_small 0
+set g_nb_respawn_delay_small_count 0
+set g_nb_respawn_delay_large 0
+set g_nb_respawn_delay_large_count 0
+set g_nb_respawn_delay_max 0
+set g_nb_respawn_waves 0
+set g_nb_weapon_stay 0
+set g_as_respawn_delay_small 0
+set g_as_respawn_delay_small_count 0
+set g_as_respawn_delay_large 0
+set g_as_respawn_delay_large_count 0
+set g_as_respawn_delay_max 0
+set g_as_respawn_waves 0
+set g_as_weapon_stay 0
+set g_ons_respawn_delay_small 0
+set g_ons_respawn_delay_small_count 0
+set g_ons_respawn_delay_large 0
+set g_ons_respawn_delay_large_count 0
+set g_ons_respawn_delay_max 0
+set g_ons_respawn_waves 0
+set g_ons_weapon_stay 0
+set g_rc_respawn_delay_small 0
+set g_rc_respawn_delay_small_count 0
+set g_rc_respawn_delay_large 0
+set g_rc_respawn_delay_large_count 0
+set g_rc_respawn_delay_max 0
+set g_rc_respawn_waves 0
+set g_rc_weapon_stay 0
+set g_cts_respawn_delay_small -1  // CTS shall have instant respawn.
+set g_cts_respawn_delay_small_count 0
+set g_cts_respawn_delay_large -1  // CTS shall have instant respawn.
+set g_cts_respawn_delay_large_count 0
+set g_cts_respawn_delay_max 0
+set g_cts_respawn_waves 0
+set g_cts_weapon_stay 2
+set g_ft_respawn_delay_small 0
+set g_ft_respawn_delay_small_count 0
+set g_ft_respawn_delay_large 0
+set g_ft_respawn_delay_large_count 0
+set g_ft_respawn_delay_max 0
+set g_ft_respawn_waves 0
+set g_ft_weapon_stay 0
+set g_inv_respawn_delay_small 0
+set g_inv_respawn_delay_small_count 0
+set g_inv_respawn_delay_large 0
+set g_inv_respawn_delay_large_count 0
+set g_inv_respawn_delay_max 0
+set g_inv_respawn_waves 0
+set g_inv_weapon_stay 0
+
+
+// =========
+//  assault
+// =========
+set g_assault 0 "Assault: attack the enemy base as fast as you can, then defend the base against the enemy for that time to win"
+
+
+// ============
+//  clan arena
+// ============
+set g_ca 0 "Clan Arena: Played in rounds, once you're dead you're out! The team with survivors wins the round"
+seta g_ca_point_limit -1 "Clan Arena point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_ca_point_leadlimit -1 "Clan Arena point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games"
+set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts"
+set g_ca_damage2score_multiplier 0.01
+set g_ca_round_timelimit 180 "round time limit in seconds"
+seta g_ca_teams_override 0
+set g_ca_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
+set g_ca_teams 0
+
+
+// ==================
+//  capture the flag
+// ==================
+set g_ctf 0 "Capture The Flag: take the enemy flag and bring it to yours at your base to score"
+set g_ctf_oneflag 0 "Allow oneflag CTF mode on maps that support it"
+set g_ctf_oneflag_reverse 0 "apply reverse mode to oneflag CTF (take flag to enemy bases to cap), overrides g_ctf_reverse only in oneflag, g_ctf_reverse still affects oneflag"
+set g_ctf_leaderboard 0 "show top capture times in the scoreboard"
+set g_ctf_flag_return 1 "auto return the flag to base when touched by a teammate"
+set g_ctf_flag_return_carrying 0 "(manual return mode) auto return the flag to base if touched by a flag carrier"
+set g_ctf_flag_return_carried_radius 100 "allow flags to be returned by carrier if base is within this radius"
+set g_ctf_flag_return_time 15 "automatically return the flag to base after this amount of time"
+set g_ctf_flag_return_dropped 100 "automatically return the flag to base if dropped within this distance from base (in qu)"
+set g_ctf_flag_return_damage 0 "allow the flag to be damaged, reducing time needed to automatically return to base"
+set g_ctf_flag_return_damage_delay 0 "how much time the flag takes to automatically return to base if it falls into lava/slime/trigger hurt"
+set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
+set g_ctf_flagcarrier_auto_helpme_damage 100 "automatically place a helpme notification on flag carrier waypointsprite if they get hit and their health dips below this value"
+set g_ctf_flagcarrier_auto_helpme_time 2 "antispam time for the helpme notification"
+set g_ctf_flagcarrier_selfdamagefactor 1
+set g_ctf_flagcarrier_selfforcefactor 1
+set g_ctf_flagcarrier_damagefactor 1
+set g_ctf_flagcarrier_forcefactor 1
+set g_ctf_stalemate 1 "show the enemy flagcarrier location after both teams have held the flags a certain amount of time"
+set g_ctf_stalemate_endcondition 1 "condition for stalemate mode to be finished: 1 = If ONE flag is no longer stale, 2 = If BOTH flags are no longer stale"
+set g_ctf_stalemate_time 60 "time for each flag until stalemate mode is activated"
+set g_ctf_flagcarrier_waypointforenemy_spotting 1 "show the enemy flagcarrier location if a team mate presses +use to spot them"
+set g_ctf_dropped_capture_delay 1 "dropped capture delay"
+set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
+set g_ctf_flag_damageforcescale 2
+set g_ctf_portalteleport 0 "allow flag carriers to go through portals made in portal gun without dropping the flag"
+set g_ctf_reverse 0 "if enabled, you score by bringing your own flag to an enemy's flag in their base"
+set g_ctf_flag_collect_delay 1
+set g_ctf_flag_health 0
+set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
+set g_ctf_flag_dropped_floatinwater 200 "move upwards while in water at this velocity"
+set g_ctf_throw 1 "throwing allows circumventing carrierkill score, so enable this with care!"
+set g_ctf_throw_angle_max 90 "maximum upwards angle you can throw the flag"
+set g_ctf_throw_angle_min -90 "minimum downwards angle you can throw the flag"
+set g_ctf_throw_punish_count 3
+set g_ctf_throw_punish_delay 30
+set g_ctf_throw_punish_time 10
+set g_ctf_throw_strengthmultiplier 2 "multiplier for velocity when you have the strength... essentially, throw the flag REALLY hard when you have the strength :D"
+set g_ctf_throw_velocity_forward 500 "how fast or far a player can throw the flag"
+set g_ctf_throw_velocity_up 200 "upwards velocity added upon initial throw"
+set g_ctf_drop_velocity_up 200 "upwards velocity when a flag is dropped (i.e. when a flag carrier dies)"
+set g_ctf_drop_velocity_side 100 "randomized sideways velocity when a flag is dropped"
+set g_ctf_pass 1 "allow passing of flags to nearby team mates"
+set g_ctf_pass_arc 20 "upwards arcing of the flag path to look more like a throw"
+set g_ctf_pass_arc_max 200 "maximum height for upwards arcing of the flag path to look more like a throw"
+set g_ctf_pass_directional_max 200 "maximum radius from crosshair for line of sight selection when passing"
+set g_ctf_pass_directional_min 50 "minimum radius from crosshair for line of sight selection when passing"
+set g_ctf_pass_radius 500 "maximum radius that you can pass to a team mate in"
+set g_ctf_pass_wait 2 "delay in seconds between how often players can pass the flag (antispam, essentially)"
+set g_ctf_pass_request 1 "allow players to request the flag carrier to pass the flag to them"
+set g_ctf_pass_turnrate 50 "how well the flag follows the best direction to its target while passing"
+set g_ctf_pass_timelimit 2 "how long a flag can stay trying to pass before it gives up and just becomes dropped"
+set g_ctf_pass_velocity 750 "how fast or far a player can pass the flag"
+set g_ctf_allow_vehicle_touch 0 "allow flags to be picked up/captured/returned without even leaving the vehicle"
+set g_ctf_allow_vehicle_carry 1 "allow players to hold flags inside a vehicle"
+set g_ctf_allow_monster_touch 0 "allow flags to be returned by monsters"
+set g_ctf_score_ignore_fields 0 "force regular score settings to override per entity specified scores"
+
+set g_ctf_shield_max_ratio 0   "shield at most this percentage of a team from the enemy flag (try: 0.4 for 40%)"
+set g_ctf_shield_min_negscore 20       "shield the player from the flag if he's got this negative amount of points or less"
+set g_ctf_shield_force 100     "push force of the shield"
+
+set g_ctf_flag_red_model "models/ctf/flags.md3"
+set g_ctf_flag_red_skin 0
+set g_ctf_flag_blue_model "models/ctf/flags.md3"
+set g_ctf_flag_blue_skin 1
+set g_ctf_flag_yellow_model "models/ctf/flags.md3"
+set g_ctf_flag_yellow_skin 2
+set g_ctf_flag_pink_model "models/ctf/flags.md3"
+set g_ctf_flag_pink_skin 3
+set g_ctf_flag_neutral_model "models/ctf/flags.md3"
+set g_ctf_flag_neutral_skin 4
+set g_ctf_flag_glowtrails 1
+set g_ctf_fullbrightflags 0
+set g_ctf_dynamiclights 0
+
+seta g_ctf_ignore_frags 0      "1: regular frags give no points"
+exec ctfscoring-samual.cfg
+
+
+// ====================
+//  complete the stage
+// ====================
+set g_cts 0 "CTS: complete the stage"
+set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts"
+set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start line, and starting out with more speed than otherwise possible"
+
+
+// ==========================
+//  deathmatch (ffa or team)
+// ==========================
+set g_dm 1 "Deathmatch: killing any other player is one frag, player with most frags wins"
+set g_tdm_teams 2 "how many teams are in team deathmatch (set by mapinfo)"
+set g_tdm_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
+seta g_tdm_teams_override 0    "how many teams are in team deathmatch"
+set g_tdm_point_limit -1 "TDM point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+set g_tdm_point_leadlimit -1 "TDM point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+
+
+// ============
+//  domination
+// ============
+set g_domination                       0 "Domination: capture and hold control points to gain points"
+set g_domination_default_teams         2 "default number of teams for maps that aren't domination-specific"
+seta g_domination_teams_override               0 "use a specific number of teams in domination games (minimum 2), disables dom_team entities"
+set g_domination_disable_frags         0 "players can't get frags normally, only get points from kills"
+set g_domination_point_amt             0 "override: how many points to get per ping"
+set g_domination_point_fullbright      0 "domination point fullbright"
+set g_domination_point_rate            0 "override: how often to give those points"
+//set g_domination_point_capturetime   0.1 "how long it takes to capture a point (given no interference)"
+set g_domination_point_glow            0 "domination point glow (warning, slow)"
+set g_domination_roundbased 0 "enable round-based domination (capture all control points to win the round)"
+set g_domination_roundbased_point_limit 5 "capture limit in round-based domination mode"
+set g_domination_round_timelimit 120
+set g_domination_warmup 5
+//set g_domination_balance_team_points 1 "# of points received is based on team sizes"
+
+
+// ===========
+//  freezetag
+// ===========
+set g_freezetag 0 "Freeze Tag: Freeze the opposing team(s) to win, unfreeze teammates by standing next to them"
+set g_freezetag_warmup 5 "Time players get to run around before the round starts"
+seta g_freezetag_point_limit -1        "Freeze Tag point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+seta g_freezetag_point_leadlimit -1    "Freeze Tag point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+set g_freezetag_revive_speed 0.4 "Speed for reviving a frozen teammate"
+set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets lost when out of range"
+set g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him"
+set g_freezetag_revive_nade 1 "Enable reviving from own nade explosion"
+set g_freezetag_revive_nade_health 40 "Amount of health player has if they revived from their own nade explosion"
+set g_freezetag_round_timelimit 180 "round time limit in seconds"
+set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds"
+seta g_freezetag_teams_override 0
+set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
+set g_freezetag_teams 0
+
+
+// ==========
+//  keepaway
+// ==========
+set g_keepaway 0 "game mode which focuses around a ball"
+set g_keepaway_score_bckill 1 "enable scoring points (y/n) for ball carrier kills (value is how many points to award)"
+set g_keepaway_score_killac 1 "amount of points to give when you kill someone while you have the ball"
+set g_keepaway_score_timeinterval 1 "amount of time it takes between intervals for timepoints to be added to the score"
+set g_keepaway_score_timepoints 0 "points to add to score per timeinterval, 0 for no points"
+set g_keepaway_ballcarrier_effects 8 "Add together the numbers you want: EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
+set g_keepaway_ballcarrier_highspeed 1 "speed multiplier done to the person holding the ball (recommended when used with some mutators)"
+set g_keepaway_ballcarrier_damage      1       "damage multiplier while holding the ball"
+set g_keepaway_ballcarrier_force       1       "force multiplier while holding the ball"
+set g_keepaway_ballcarrier_selfdamage  1       "self damage multiplier while holding the ball"
+set g_keepaway_ballcarrier_selfforce   1       "self force multiplier while holding the ball"
+set g_keepaway_noncarrier_warn 1       "warn players when they kill without holding the ball"
+set g_keepaway_noncarrier_damage       1       "damage done to other players if both you and they don't have the ball"
+set g_keepaway_noncarrier_force        1       "force done to other players if both you and they don't have the ball"
+set g_keepaway_noncarrier_selfdamage   1       "self damage if you don't have the ball"
+set g_keepaway_noncarrier_selfforce    1       "self force if you don't have the ball"
+set g_keepawayball_effects 0 "Add together the numbers you want: EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
+set g_keepawayball_trail_color 254     "particle trail color from player/ball"
+set g_keepawayball_damageforcescale    3 "Scale of force which is applied to the ball by weapons/explosions/etc"
+set g_keepawayball_respawntime 10      "if no one picks up the ball, how long to wait until the ball respawns"
+
+
+// ==========
+//  key hunt
+// ==========
+set g_keyhunt 0 "Key Hunt: collect all keys from the enemies and bring them together to score"
+set g_balance_keyhunt_return_when_unreachable 1 "automatically destroy a key if it falls into lava/slime/trigger hurt"
+set g_balance_keyhunt_delay_damage_return 5 "time a key takes to automatically destroy itself if it falls into lava/slime/trigger hurt"
+set g_balance_keyhunt_delay_return 60 "time a key takes to destroy itself if dropped"
+set g_balance_keyhunt_delay_round 5
+set g_balance_keyhunt_delay_tracking 10
+set g_balance_keyhunt_delay_fadeout 2
+set g_balance_keyhunt_delay_collect 1.5
+set g_balance_keyhunt_maxdist 150
+set g_balance_keyhunt_score_collect 3
+set g_balance_keyhunt_score_carrierfrag 2
+set g_balance_keyhunt_score_capture 100
+set g_balance_keyhunt_score_push 60
+set g_balance_keyhunt_score_destroyed 50
+set g_balance_keyhunt_score_destroyed_ownfactor 1
+set g_balance_keyhunt_dropvelocity 300
+set g_balance_keyhunt_throwvelocity 400
+set g_balance_keyhunt_protecttime 0.8
+set g_balance_keyhunt_damageforcescale 1
+seta g_keyhunt_teams_override 0
+set g_keyhunt_teams 0
+set g_keyhunt_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
+
+
+// ===================
+//  last man standing
+// ===================
+set g_lms 0 "Last Man Standing: everyone starts with a certain amount of lives, and the survivor wins"
+set g_lms_lives_override -1
+set g_lms_extra_lives 0
+set g_lms_regenerate 0
+set g_lms_last_join 3  "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives"
+set g_lms_join_anytime 1       "if true, new players can join, but get same amount of lives as the worst player"
+
+
+// =========
+//  nexball
+// =========
+set g_nexball 0 "Nexball: Basketball and Soccer go Xonotic"
+set g_nexball_basketball_effects_default     8    "default: dim light. The original version used 1024 (fire) but it gives bad performance"
+set g_balance_nexball_primary_speed       1000    "launching speed"
+set g_balance_nexball_primary_refire         0.7  "launching refire"
+set g_balance_nexball_primary_animtime       0.3  "launching animtime"
+set g_balance_nexball_secondary_animtime     0.3  "launching animtime"
+set g_balance_nexball_secondary_speed     3000    "stealing projectile speed"
+set g_balance_nexball_secondary_lifetime     0.15 "stealing projectile lifetime"
+set g_balance_nexball_secondary_force      500    "stealing projectile force"
+set g_balance_nexball_secondary_refire       0.6  "stealing projectile refire"
+set g_balance_nexball_secondary_animtime     0.3  "stealing projectile animtime"
+set g_nexball_football_physics  2  "0: Revenant's original movement, 1: 0 but half independant of aiming height, 2: 1 fully independant, -1: first recode try"
+set g_nexball_basketball_jumppad 1    "whether basketballs should be pushable by jumppads"
+set g_nexball_basketball_bouncefactor 0.6    "velocity loss when the ball bounces"
+set g_nexball_basketball_bouncestop   0.075  "speed at which the ball stops when it hits the ground (multiplied by sv_gravity)"
+set g_nexball_football_jumppad 1    "whether footballs should be pushable by jumppads"
+set g_nexball_football_bouncefactor   0.6    "velocity loss when the ball bounces"
+set g_nexball_football_bouncestop     0.075  "speed at which the ball stops when it hits the ground (multiplied by sv_gravity)"
+set g_nexball_football_boost_forward      100   "forward velocity boost when the ball is touched"
+set g_nexball_football_boost_up           200   "vertical velocity boost when the ball is touched"
+set g_nexball_basketball_delay_hold           20    "time before a player who caught the ball loses it (anti-ballcamp)"
+set g_nexball_basketball_delay_hold_forteam   60    "time before a ball reset when a team holds the ball for too long"
+set g_nexball_basketball_teamsteal             1    "1 to allow players to steal from teammates, 0 to disallow"
+set g_nexball_basketball_carrier_highspeed         0.8  "speed multiplier for the ballcarrier"
+set g_nexball_meter_period                  1    "time to make a full cycle on the power meter"
+set g_nexball_basketball_meter              1    "use the power meter for basketball"
+set g_nexball_basketball_meter_minpower   0.5    "minimal multiplier to the launching speed when using the power meter"
+set g_nexball_basketball_meter_maxpower   1.2    "maximal multiplier to the launching speed when using the power meter"
+set g_nexball_delay_goal     3    "delay between a goal and a ball reset"
+set g_nexball_delay_idle     10   "maximal idle time before a reset"
+set g_nexball_delay_start    3    "time the ball stands on its spawn before being released"
+set g_nexball_delay_collect  0.5  "time before the same player can catch the ball he launched"
+set g_nexball_sound_bounce   1    "bouncing sound (0: off)"
+set g_nexball_basketball_trail  1  "1 to leave a trail"
+set g_nexball_football_trail    0  "1 to leave a trail"
+set g_nexball_trail_color     254  "1-256 for different colors (Quake palette, 254 is white)"
+set g_nexball_playerclip_collisions 1 "make the ball bounce off clips"
+set g_nexball_radar_showallplayers 1  "1: show every player and the ball on the radar  0: only show teammates and the ball on the radar"
+seta g_nexball_safepass_maxdist 5000 "Max distance to allow save fassping (0 to turn off safe passing)"
+seta g_nexball_safepass_turnrate 0.1 "How fast the safe-pass ball can habge direction"
+seta g_nexball_safepass_holdtime 0.75 "How long to remeber last teammate you pointed at"
+seta g_nexball_viewmodel_scale 0.25 "How large the ball for the carrier"
+seta g_nexball_viewmodel_offset "8 8 0" "Where the ball is located on carrier forward right up"
+seta g_nexball_tackling 1 "Allow ball theft?"
+
+
+// ===========
+//  onslaught
+// ===========
+set g_onslaught 0 "Onslaught: take control points towards the enemy generator and then destroy it"
+set g_onslaught_point_limit 1 "Onslaught point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+set g_onslaught_warmup 5
+set g_onslaught_round_timelimit 280
+set g_onslaught_teleport_radius 200 "Allows teleporting from a control point to another"
+set g_onslaught_teleport_wait 5 "Time before player can teleport again"
+set g_onslaught_spawn_choose 1 "Allow players to choose the control point to be spawned at"
+set g_onslaught_click_radius 500 "When choosing from the map, this level of precision is required"
+
+set g_onslaught_gen_health 2500
+set g_onslaught_allow_vehicle_touch 0
+set g_onslaught_cp_health 1000
+set g_onslaught_cp_buildhealth 100
+set g_onslaught_cp_buildtime 5
+set g_onslaught_cp_regen 20
+set g_onslaught_cp_proxydecap 0 "de-capture controlpoints by standing close to them"
+set g_onslaught_cp_proxydecap_distance 512
+set g_onslaught_cp_proxydecap_dps 100
+set g_onslaught_shield_force 100
+set g_onslaught_spawn_at_controlpoints 0
+set g_onslaught_spawn_at_controlpoints_chance 0.5
+set g_onslaught_spawn_at_controlpoints_random 0
+set g_onslaught_spawn_at_generator 0
+set g_onslaught_spawn_at_generator_chance 0
+set g_onslaught_spawn_at_generator_random 0
+
+
+// ======
+//  race
+// ======
+set g_race 0 "Race: be faster than your opponents"
+set g_race_qualifying_timelimit 0
+set g_race_qualifying_timelimit_override -1 "qualifying session time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
+set g_race_teams 0     "when 2, 3, or 4, the race is played as a team game (the team members can add up their laps)"
+
+// ==========
+//  invasion
+// ==========
+set g_invasion 0 "Invasion: survive against waves of monsters"
+set g_invasion_round_timelimit 120 "maximum time to kill all monsters"
+set g_invasion_warmup 10 "time between waves to prepare for battle"
+set g_invasion_monster_count 10 "number of monsters on first wave (increments)"
+set g_invasion_zombies_only 0 "only spawn zombies"
+set g_invasion_spawn_delay 0.25
+set g_invasion_spawnpoint_spawn_delay 0.5
+set g_invasion_teams 0 "number of teams in invasion (note: use mapinfo to set this)"
+set g_invasion_team_spawns 1 "use team spawns in teamplay invasion mode"
+set g_invasion_type 0 "type of invasion mode - 0: round-based, 1: hunting, 2: complete the stage (note: use mapinfo to set this)"
diff --git a/gamemodes.cfg b/gamemodes.cfg
deleted file mode 100644 (file)
index 80d9902..0000000
+++ /dev/null
@@ -1,555 +0,0 @@
-// ===================================
-//  Master config for core game modes
-// ===================================
-
-// global gametype setting (0 = deathmatch)
-set gamecfg 0
-
-// say aliases
-alias asay_ctf_flagcarrier "say_team flag carrier at %y"
-alias asay_ctf_haveflag "say_team (%l) have the flag"
-alias asay_willgo "say_team will go to %y"
-alias asay_support "say_team (%l) need help, %h%%"
-alias asay_killed "say_team got killed at %d"
-alias asay_noammo "say_team (%l) need %W for %w"
-alias asay_drop "say_team (%l) dropped %w ; impulse 17"
-
-
-// =================
-//  gamestart hooks
-// =================
-seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to
-alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2"
-alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}"
-alias cl_hook_gamestart_all
-alias cl_hook_gamestart_nop  //is only called when CSQC unloads before knowing the gametype, very unlikely
-alias cl_hook_gamestart_dm
-alias cl_hook_gamestart_tdm
-alias cl_hook_gamestart_dom
-alias cl_hook_gamestart_ctf
-alias cl_hook_gamestart_lms
-alias cl_hook_gamestart_ca
-alias cl_hook_gamestart_kh
-alias cl_hook_gamestart_ons
-alias cl_hook_gamestart_as
-alias cl_hook_gamestart_rc
-alias cl_hook_gamestart_nb
-alias cl_hook_gamestart_cts
-alias cl_hook_gamestart_ka
-alias cl_hook_gamestart_ft
-alias cl_hook_gamestart_inv
-alias cl_hook_gameend "rpn /cl_matchcount dup load 1 + =" // increase match count every time a game ends
-alias cl_hook_shutdown
-alias cl_hook_activeweapon
-
-alias _sv_hook_gamestart "set _sv_hook_gametype $1; _sv_hook_gamestart_stage2"
-alias _sv_hook_gamestart_stage2 "sv_hook_gamestart_all; sv_hook_gamestart_${_sv_hook_gametype}"
-alias sv_hook_gamestart_all
-alias sv_hook_gamestart_dm
-alias sv_hook_gamestart_tdm
-alias sv_hook_gamestart_dom
-alias sv_hook_gamestart_ctf
-alias sv_hook_gamestart_lms
-alias sv_hook_gamestart_ca
-alias sv_hook_gamestart_kh
-alias sv_hook_gamestart_ons
-alias sv_hook_gamestart_as
-alias sv_hook_gamestart_rc
-alias sv_hook_gamestart_nb
-alias sv_hook_gamestart_cts
-alias sv_hook_gamestart_ka
-alias sv_hook_gamestart_ft
-alias sv_hook_gamestart_inv
-alias sv_hook_gamerestart
-alias sv_hook_gameend
-
-
-// =====================
-//  gametype vote hooks
-// =====================
-// These are called when the mode is switched via gametype vote screen,
-// earlier than gamestart hooks (useful for enabling per-gamemode mutators)
-// The _all hook is called before the specific one
-// here it sets g_maxplayers to undo what duel does
-alias sv_vote_gametype_hook_all "set g_maxplayers 0"
-alias sv_vote_gametype_hook_as
-alias sv_vote_gametype_hook_ca
-alias sv_vote_gametype_hook_ctf
-alias sv_vote_gametype_hook_cts
-alias sv_vote_gametype_hook_dm
-alias sv_vote_gametype_hook_dom
-alias sv_vote_gametype_hook_ft
-alias sv_vote_gametype_hook_inv
-alias sv_vote_gametype_hook_ka
-alias sv_vote_gametype_hook_kh
-alias sv_vote_gametype_hook_lms
-alias sv_vote_gametype_hook_nb
-alias sv_vote_gametype_hook_ons
-alias sv_vote_gametype_hook_rc
-alias sv_vote_gametype_hook_tdm
-
-// Preset to allow duel to be used for the gametype voting screen
-// sv_vote_gametype_*_type Must be set to the name of the gametype the option is based on
-// sv_vote_gametype_*_name Contains a human-readable name of the gametype
-// sv_vote_gametype_*_description Contains a longer description
-set sv_vote_gametype_duel_type dm
-set sv_vote_gametype_duel_name Duel
-set sv_vote_gametype_duel_description "One vs One match"
-alias sv_vote_gametype_hook_duel "set g_maxplayers 2"
-
-
-// ===========
-//  leadlimit
-// ===========
-// this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF, and Runematch.
-set leadlimit 0
-set leadlimit_and_fraglimit 0 "if set, leadlimit is ANDed with fraglimit (otherwise ORed)"
-seta timelimit_override -1     "Time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta fraglimit_override -1     "Frag limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta leadlimit_override -1     "Lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta capturelimit_override -1  "Capture limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta captureleadlimit_override -1      "Capture llead imit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_domination_point_limit -1       "Domination point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_domination_point_leadlimit -1   "Domination point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_keyhunt_point_limit -1  "Keyhunt point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_keyhunt_point_leadlimit -1      "Keyhunt point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_race_laps_limit -1      "Race laps limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_nexball_goallimit -1 "Nexball goal limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_nexball_goalleadlimit -1 "Nexball goal lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_invasion_point_limit -1 "Invasion point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-
-
-// =================================
-//  respawn delay/waves/weapon_stay
-// =================================
-// when variables are set to anything other than 0, they take over the global setting. Negative values force an output value of zero.
-set g_ctf_respawn_delay_small 1
-set g_ctf_respawn_delay_small_count 1
-set g_ctf_respawn_delay_large 5
-set g_ctf_respawn_delay_large_count 5
-set g_ctf_respawn_delay_max 0
-set g_ctf_respawn_waves 0
-set g_ctf_weapon_stay 0
-set g_dm_respawn_delay_small 0
-set g_dm_respawn_delay_small_count 0
-set g_dm_respawn_delay_large 0
-set g_dm_respawn_delay_large_count 0
-set g_dm_respawn_delay_max 0
-set g_dm_respawn_waves 0
-set g_dm_weapon_stay 0
-set g_dom_respawn_delay_small 0
-set g_dom_respawn_delay_small_count 0
-set g_dom_respawn_delay_large 0
-set g_dom_respawn_delay_large_count 0
-set g_dom_respawn_delay_max 0
-set g_dom_respawn_waves 0
-set g_dom_weapon_stay 0
-set g_lms_respawn_delay_small 0
-set g_lms_respawn_delay_small_count 0
-set g_lms_respawn_delay_large 0
-set g_lms_respawn_delay_large_count 0
-set g_lms_respawn_delay_max 0
-set g_lms_respawn_waves 0
-set g_lms_weapon_stay 0
-set g_tdm_respawn_delay_small 0
-set g_tdm_respawn_delay_small_count 0
-set g_tdm_respawn_delay_large 0
-set g_tdm_respawn_delay_large_count 0
-set g_tdm_respawn_delay_max 0
-set g_tdm_respawn_waves 0
-set g_tdm_weapon_stay 0
-set g_ka_respawn_delay_small 0
-set g_ka_respawn_delay_small_count 0
-set g_ka_respawn_delay_large 0
-set g_ka_respawn_delay_large_count 0
-set g_ka_respawn_delay_max 0
-set g_ka_respawn_waves 0
-set g_ka_weapon_stay 0
-set g_kh_respawn_delay_small 0
-set g_kh_respawn_delay_small_count 0
-set g_kh_respawn_delay_large 0
-set g_kh_respawn_delay_large_count 0
-set g_kh_respawn_delay_max 0
-set g_kh_respawn_waves 0
-set g_kh_weapon_stay 0
-set g_ca_respawn_delay_small 0
-set g_ca_respawn_delay_small_count 0
-set g_ca_respawn_delay_large 0
-set g_ca_respawn_delay_large_count 0
-set g_ca_respawn_delay_max 0
-set g_ca_respawn_waves 0
-set g_ca_weapon_stay 0
-set g_nb_respawn_delay_small 0
-set g_nb_respawn_delay_small_count 0
-set g_nb_respawn_delay_large 0
-set g_nb_respawn_delay_large_count 0
-set g_nb_respawn_delay_max 0
-set g_nb_respawn_waves 0
-set g_nb_weapon_stay 0
-set g_as_respawn_delay_small 0
-set g_as_respawn_delay_small_count 0
-set g_as_respawn_delay_large 0
-set g_as_respawn_delay_large_count 0
-set g_as_respawn_delay_max 0
-set g_as_respawn_waves 0
-set g_as_weapon_stay 0
-set g_ons_respawn_delay_small 0
-set g_ons_respawn_delay_small_count 0
-set g_ons_respawn_delay_large 0
-set g_ons_respawn_delay_large_count 0
-set g_ons_respawn_delay_max 0
-set g_ons_respawn_waves 0
-set g_ons_weapon_stay 0
-set g_rc_respawn_delay_small 0
-set g_rc_respawn_delay_small_count 0
-set g_rc_respawn_delay_large 0
-set g_rc_respawn_delay_large_count 0
-set g_rc_respawn_delay_max 0
-set g_rc_respawn_waves 0
-set g_rc_weapon_stay 0
-set g_cts_respawn_delay_small -1  // CTS shall have instant respawn.
-set g_cts_respawn_delay_small_count 0
-set g_cts_respawn_delay_large -1  // CTS shall have instant respawn.
-set g_cts_respawn_delay_large_count 0
-set g_cts_respawn_delay_max 0
-set g_cts_respawn_waves 0
-set g_cts_weapon_stay 2
-set g_ft_respawn_delay_small 0
-set g_ft_respawn_delay_small_count 0
-set g_ft_respawn_delay_large 0
-set g_ft_respawn_delay_large_count 0
-set g_ft_respawn_delay_max 0
-set g_ft_respawn_waves 0
-set g_ft_weapon_stay 0
-set g_inv_respawn_delay_small 0
-set g_inv_respawn_delay_small_count 0
-set g_inv_respawn_delay_large 0
-set g_inv_respawn_delay_large_count 0
-set g_inv_respawn_delay_max 0
-set g_inv_respawn_waves 0
-set g_inv_weapon_stay 0
-
-
-// =========
-//  assault
-// =========
-set g_assault 0 "Assault: attack the enemy base as fast as you can, then defend the base against the enemy for that time to win"
-
-
-// ============
-//  clan arena
-// ============
-set g_ca 0 "Clan Arena: Played in rounds, once you're dead you're out! The team with survivors wins the round"
-seta g_ca_point_limit -1 "Clan Arena point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_ca_point_leadlimit -1 "Clan Arena point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games"
-set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts"
-set g_ca_damage2score_multiplier 0.01
-set g_ca_round_timelimit 180 "round time limit in seconds"
-seta g_ca_teams_override 0
-set g_ca_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
-set g_ca_teams 0
-
-
-// ==================
-//  capture the flag
-// ==================
-set g_ctf 0 "Capture The Flag: take the enemy flag and bring it to yours at your base to score"
-set g_ctf_oneflag 0 "Allow oneflag CTF mode on maps that support it"
-set g_ctf_oneflag_reverse 0 "apply reverse mode to oneflag CTF (take flag to enemy bases to cap), overrides g_ctf_reverse only in oneflag, g_ctf_reverse still affects oneflag"
-set g_ctf_leaderboard 0 "show top capture times in the scoreboard"
-set g_ctf_flag_return 1 "auto return the flag to base when touched by a teammate"
-set g_ctf_flag_return_carrying 0 "(manual return mode) auto return the flag to base if touched by a flag carrier"
-set g_ctf_flag_return_carried_radius 100 "allow flags to be returned by carrier if base is within this radius"
-set g_ctf_flag_return_time 15 "automatically return the flag to base after this amount of time"
-set g_ctf_flag_return_dropped 100 "automatically return the flag to base if dropped within this distance from base (in qu)"
-set g_ctf_flag_return_damage 0 "allow the flag to be damaged, reducing time needed to automatically return to base"
-set g_ctf_flag_return_damage_delay 0 "how much time the flag takes to automatically return to base if it falls into lava/slime/trigger hurt"
-set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
-set g_ctf_flagcarrier_auto_helpme_damage 100 "automatically place a helpme notification on flag carrier waypointsprite if they get hit and their health dips below this value"
-set g_ctf_flagcarrier_auto_helpme_time 2 "antispam time for the helpme notification"
-set g_ctf_flagcarrier_selfdamagefactor 1
-set g_ctf_flagcarrier_selfforcefactor 1
-set g_ctf_flagcarrier_damagefactor 1
-set g_ctf_flagcarrier_forcefactor 1
-set g_ctf_stalemate 1 "show the enemy flagcarrier location after both teams have held the flags a certain amount of time"
-set g_ctf_stalemate_endcondition 1 "condition for stalemate mode to be finished: 1 = If ONE flag is no longer stale, 2 = If BOTH flags are no longer stale"
-set g_ctf_stalemate_time 60 "time for each flag until stalemate mode is activated"
-set g_ctf_flagcarrier_waypointforenemy_spotting 1 "show the enemy flagcarrier location if a team mate presses +use to spot them"
-set g_ctf_dropped_capture_delay 1 "dropped capture delay"
-set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
-set g_ctf_flag_damageforcescale 2
-set g_ctf_portalteleport 0 "allow flag carriers to go through portals made in portal gun without dropping the flag"
-set g_ctf_reverse 0 "if enabled, you score by bringing your own flag to an enemy's flag in their base"
-set g_ctf_flag_collect_delay 1
-set g_ctf_flag_health 0
-set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
-set g_ctf_flag_dropped_floatinwater 200 "move upwards while in water at this velocity"
-set g_ctf_throw 1 "throwing allows circumventing carrierkill score, so enable this with care!"
-set g_ctf_throw_angle_max 90 "maximum upwards angle you can throw the flag"
-set g_ctf_throw_angle_min -90 "minimum downwards angle you can throw the flag"
-set g_ctf_throw_punish_count 2
-set g_ctf_throw_punish_delay 30
-set g_ctf_throw_punish_time 5
-set g_ctf_throw_strengthmultiplier 2 "multiplier for velocity when you have the strength... essentially, throw the flag REALLY hard when you have the strength :D"
-set g_ctf_throw_velocity_forward 500 "how fast or far a player can throw the flag"
-set g_ctf_throw_velocity_up 200 "upwards velocity added upon initial throw"
-set g_ctf_drop_velocity_up 200 "upwards velocity when a flag is dropped (i.e. when a flag carrier dies)"
-set g_ctf_drop_velocity_side 100 "randomized sideways velocity when a flag is dropped"
-set g_ctf_pass 1 "allow passing of flags to nearby team mates"
-set g_ctf_pass_arc 20 "upwards arcing of the flag path to look more like a throw"
-set g_ctf_pass_arc_max 200 "maximum height for upwards arcing of the flag path to look more like a throw"
-set g_ctf_pass_directional_max 200 "maximum radius from crosshair for line of sight selection when passing"
-set g_ctf_pass_directional_min 50 "minimum radius from crosshair for line of sight selection when passing"
-set g_ctf_pass_radius 500 "maximum radius that you can pass to a team mate in"
-set g_ctf_pass_wait 2 "delay in seconds between how often players can pass the flag (antispam, essentially)"
-set g_ctf_pass_request 1 "allow players to request the flag carrier to pass the flag to them"
-set g_ctf_pass_turnrate 50 "how well the flag follows the best direction to its target while passing"
-set g_ctf_pass_timelimit 2 "how long a flag can stay trying to pass before it gives up and just becomes dropped"
-set g_ctf_pass_velocity 750 "how fast or far a player can pass the flag"
-set g_ctf_allow_vehicle_touch 0 "allow flags to be picked up/captured/returned without even leaving the vehicle"
-set g_ctf_allow_vehicle_carry 1 "allow players to hold flags inside a vehicle"
-set g_ctf_allow_monster_touch 0 "allow flags to be returned by monsters"
-set g_ctf_score_ignore_fields 0 "force regular score settings to override per entity specified scores"
-
-set g_ctf_shield_max_ratio 0   "shield at most this percentage of a team from the enemy flag (try: 0.4 for 40%)"
-set g_ctf_shield_min_negscore 20       "shield the player from the flag if he's got this negative amount of points or less"
-set g_ctf_shield_force 100     "push force of the shield"
-
-set g_ctf_flag_red_model "models/ctf/flags.md3"
-set g_ctf_flag_red_skin 0
-set g_ctf_flag_blue_model "models/ctf/flags.md3"
-set g_ctf_flag_blue_skin 1
-set g_ctf_flag_yellow_model "models/ctf/flags.md3"
-set g_ctf_flag_yellow_skin 2
-set g_ctf_flag_pink_model "models/ctf/flags.md3"
-set g_ctf_flag_pink_skin 3
-set g_ctf_flag_neutral_model "models/ctf/flags.md3"
-set g_ctf_flag_neutral_skin 4
-set g_ctf_flag_glowtrails 1
-set g_ctf_fullbrightflags 0
-set g_ctf_dynamiclights 0
-
-seta g_ctf_ignore_frags 0      "1: regular frags give no points"
-exec ctfscoring-samual.cfg
-
-
-// ====================
-//  complete the stage
-// ====================
-set g_cts 0 "CTS: complete the stage"
-set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts"
-set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start line, and starting out with more speed than otherwise possible"
-
-
-// ==========================
-//  deathmatch (ffa or team)
-// ==========================
-set g_dm 1 "Deathmatch: killing any other player is one frag, player with most frags wins"
-set g_tdm_teams 2 "how many teams are in team deathmatch (set by mapinfo)"
-set g_tdm_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
-seta g_tdm_teams_override 0    "how many teams are in team deathmatch"
-set g_tdm_point_limit -1 "TDM point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-set g_tdm_point_leadlimit -1 "TDM point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-
-
-// ============
-//  domination
-// ============
-set g_domination                       0 "Domination: capture and hold control points to gain points"
-set g_domination_default_teams         2 "default number of teams for maps that aren't domination-specific"
-seta g_domination_teams_override               0 "use a specific number of teams in domination games (minimum 2), disables dom_team entities"
-set g_domination_disable_frags         0 "players can't get frags normally, only get points from kills"
-set g_domination_point_amt             0 "override: how many points to get per ping"
-set g_domination_point_fullbright      0 "domination point fullbright"
-set g_domination_point_rate            0 "override: how often to give those points"
-//set g_domination_point_capturetime   0.1 "how long it takes to capture a point (given no interference)"
-set g_domination_point_glow            0 "domination point glow (warning, slow)"
-set g_domination_roundbased 0 "enable round-based domination (capture all control points to win the round)"
-set g_domination_roundbased_point_limit 5 "capture limit in round-based domination mode"
-set g_domination_round_timelimit 120
-set g_domination_warmup 5
-//set g_domination_balance_team_points 1 "# of points received is based on team sizes"
-
-
-// ===========
-//  freezetag
-// ===========
-set g_freezetag 0 "Freeze Tag: Freeze the opposing team(s) to win, unfreeze teammates by standing next to them"
-set g_freezetag_warmup 5 "Time players get to run around before the round starts"
-seta g_freezetag_point_limit -1        "Freeze Tag point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-seta g_freezetag_point_leadlimit -1    "Freeze Tag point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-set g_freezetag_revive_speed 0.4 "Speed for reviving a frozen teammate"
-set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets lost when out of range"
-set g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him"
-set g_freezetag_revive_nade 1 "Enable reviving from own nade explosion"
-set g_freezetag_revive_nade_health 40 "Amount of health player has if they revived from their own nade explosion"
-set g_freezetag_round_timelimit 180 "round time limit in seconds"
-set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds"
-seta g_freezetag_teams_override 0
-set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
-set g_freezetag_teams 0
-
-
-// ==========
-//  keepaway
-// ==========
-set g_keepaway 0 "game mode which focuses around a ball"
-set g_keepaway_score_bckill 1 "enable scoring points (y/n) for ball carrier kills (value is how many points to award)"
-set g_keepaway_score_killac 1 "amount of points to give when you kill someone while you have the ball"
-set g_keepaway_score_timeinterval 1 "amount of time it takes between intervals for timepoints to be added to the score"
-set g_keepaway_score_timepoints 0 "points to add to score per timeinterval, 0 for no points"
-set g_keepaway_ballcarrier_effects 8 "Add together the numbers you want: EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
-set g_keepaway_ballcarrier_highspeed 1 "speed multiplier done to the person holding the ball (recommended when used with some mutators)"
-set g_keepaway_ballcarrier_damage      1       "damage multiplier while holding the ball"
-set g_keepaway_ballcarrier_force       1       "force multiplier while holding the ball"
-set g_keepaway_ballcarrier_selfdamage  1       "self damage multiplier while holding the ball"
-set g_keepaway_ballcarrier_selfforce   1       "self force multiplier while holding the ball"
-set g_keepaway_noncarrier_warn 1       "warn players when they kill without holding the ball"
-set g_keepaway_noncarrier_damage       1       "damage done to other players if both you and they don't have the ball"
-set g_keepaway_noncarrier_force        1       "force done to other players if both you and they don't have the ball"
-set g_keepaway_noncarrier_selfdamage   1       "self damage if you don't have the ball"
-set g_keepaway_noncarrier_selfforce    1       "self force if you don't have the ball"
-set g_keepawayball_effects 0 "Add together the numbers you want: EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
-set g_keepawayball_trail_color 254     "particle trail color from player/ball"
-set g_keepawayball_damageforcescale    3 "Scale of force which is applied to the ball by weapons/explosions/etc"
-set g_keepawayball_respawntime 10      "if no one picks up the ball, how long to wait until the ball respawns"
-
-
-// ==========
-//  key hunt
-// ==========
-set g_keyhunt 0 "Key Hunt: collect all keys from the enemies and bring them together to score"
-set g_balance_keyhunt_return_when_unreachable 1 "automatically destroy a key if it falls into lava/slime/trigger hurt"
-set g_balance_keyhunt_delay_damage_return 5 "time a key takes to automatically destroy itself if it falls into lava/slime/trigger hurt"
-set g_balance_keyhunt_delay_return 60 "time a key takes to destroy itself if dropped"
-set g_balance_keyhunt_delay_round 5
-set g_balance_keyhunt_delay_tracking 10
-set g_balance_keyhunt_delay_fadeout 2
-set g_balance_keyhunt_delay_collect 1.5
-set g_balance_keyhunt_maxdist 150
-set g_balance_keyhunt_score_collect 3
-set g_balance_keyhunt_score_carrierfrag 2
-set g_balance_keyhunt_score_capture 100
-set g_balance_keyhunt_score_push 60
-set g_balance_keyhunt_score_destroyed 50
-set g_balance_keyhunt_score_destroyed_ownfactor 1
-set g_balance_keyhunt_dropvelocity 300
-set g_balance_keyhunt_throwvelocity 400
-set g_balance_keyhunt_protecttime 0.8
-set g_balance_keyhunt_damageforcescale 1
-seta g_keyhunt_teams_override 0
-set g_keyhunt_teams 0
-set g_keyhunt_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
-
-
-// ===================
-//  last man standing
-// ===================
-set g_lms 0 "Last Man Standing: everyone starts with a certain amount of lives, and the survivor wins"
-set g_lms_lives_override -1
-set g_lms_extra_lives 0
-set g_lms_regenerate 0
-set g_lms_last_join 3  "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives"
-set g_lms_join_anytime 1       "if true, new players can join, but get same amount of lives as the worst player"
-
-
-// =========
-//  nexball
-// =========
-set g_nexball 0 "Nexball: Basketball and Soccer go Xonotic"
-set g_nexball_basketball_effects_default     8    "default: dim light. The original version used 1024 (fire) but it gives bad performance"
-set g_balance_nexball_primary_speed       1000    "launching speed"
-set g_balance_nexball_primary_refire         0.7  "launching refire"
-set g_balance_nexball_primary_animtime       0.3  "launching animtime"
-set g_balance_nexball_secondary_animtime     0.3  "launching animtime"
-set g_balance_nexball_secondary_speed     3000    "stealing projectile speed"
-set g_balance_nexball_secondary_lifetime     0.15 "stealing projectile lifetime"
-set g_balance_nexball_secondary_force      500    "stealing projectile force"
-set g_balance_nexball_secondary_refire       0.6  "stealing projectile refire"
-set g_balance_nexball_secondary_animtime     0.3  "stealing projectile animtime"
-set g_nexball_football_physics  2  "0: Revenant's original movement, 1: 0 but half independant of aiming height, 2: 1 fully independant, -1: first recode try"
-set g_nexball_basketball_jumppad 1    "whether basketballs should be pushable by jumppads"
-set g_nexball_basketball_bouncefactor 0.6    "velocity loss when the ball bounces"
-set g_nexball_basketball_bouncestop   0.075  "speed at which the ball stops when it hits the ground (multiplied by sv_gravity)"
-set g_nexball_football_jumppad 1    "whether footballs should be pushable by jumppads"
-set g_nexball_football_bouncefactor   0.6    "velocity loss when the ball bounces"
-set g_nexball_football_bouncestop     0.075  "speed at which the ball stops when it hits the ground (multiplied by sv_gravity)"
-set g_nexball_football_boost_forward      100   "forward velocity boost when the ball is touched"
-set g_nexball_football_boost_up           200   "vertical velocity boost when the ball is touched"
-set g_nexball_basketball_delay_hold           20    "time before a player who caught the ball loses it (anti-ballcamp)"
-set g_nexball_basketball_delay_hold_forteam   60    "time before a ball reset when a team holds the ball for too long"
-set g_nexball_basketball_teamsteal             1    "1 to allow players to steal from teammates, 0 to disallow"
-set g_nexball_basketball_carrier_highspeed         0.8  "speed multiplier for the ballcarrier"
-set g_nexball_meter_period                  1    "time to make a full cycle on the power meter"
-set g_nexball_basketball_meter              1    "use the power meter for basketball"
-set g_nexball_basketball_meter_minpower   0.5    "minimal multiplier to the launching speed when using the power meter"
-set g_nexball_basketball_meter_maxpower   1.2    "maximal multiplier to the launching speed when using the power meter"
-set g_nexball_delay_goal     3    "delay between a goal and a ball reset"
-set g_nexball_delay_idle     10   "maximal idle time before a reset"
-set g_nexball_delay_start    3    "time the ball stands on its spawn before being released"
-set g_nexball_delay_collect  0.5  "time before the same player can catch the ball he launched"
-set g_nexball_sound_bounce   1    "bouncing sound (0: off)"
-set g_nexball_basketball_trail  1  "1 to leave a trail"
-set g_nexball_football_trail    0  "1 to leave a trail"
-set g_nexball_trail_color     254  "1-256 for different colors (Quake palette, 254 is white)"
-set g_nexball_playerclip_collisions 1 "make the ball bounce off clips"
-set g_nexball_radar_showallplayers 1  "1: show every player and the ball on the radar  0: only show teammates and the ball on the radar"
-seta g_nexball_safepass_maxdist 5000 "Max distance to allow save fassping (0 to turn off safe passing)"
-seta g_nexball_safepass_turnrate 0.1 "How fast the safe-pass ball can habge direction"
-seta g_nexball_safepass_holdtime 0.75 "How long to remeber last teammate you pointed at"
-seta g_nexball_viewmodel_scale 0.25 "How large the ball for the carrier"
-seta g_nexball_viewmodel_offset "8 8 0" "Where the ball is located on carrier forward right up"
-seta g_nexball_tackling 1 "Allow ball theft?"
-
-
-// ===========
-//  onslaught
-// ===========
-set g_onslaught 0 "Onslaught: take control points towards the enemy generator and then destroy it"
-set g_onslaught_point_limit 1 "Onslaught point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-set g_onslaught_warmup 5
-set g_onslaught_round_timelimit 280
-set g_onslaught_teleport_radius 200 "Allows teleporting from a control point to another"
-set g_onslaught_teleport_wait 5 "Time before player can teleport again"
-set g_onslaught_spawn_choose 1 "Allow players to choose the control point to be spawned at"
-set g_onslaught_click_radius 500 "When choosing from the map, this level of precision is required"
-
-set g_onslaught_gen_health 2500
-set g_onslaught_allow_vehicle_touch 0
-set g_onslaught_cp_health 1000
-set g_onslaught_cp_buildhealth 100
-set g_onslaught_cp_buildtime 5
-set g_onslaught_cp_regen 20
-set g_onslaught_cp_proxydecap 0 "de-capture controlpoints by standing close to them"
-set g_onslaught_cp_proxydecap_distance 512
-set g_onslaught_cp_proxydecap_dps 100
-set g_onslaught_shield_force 100
-set g_onslaught_spawn_at_controlpoints 0
-set g_onslaught_spawn_at_controlpoints_chance 0.5
-set g_onslaught_spawn_at_controlpoints_random 0
-set g_onslaught_spawn_at_generator 0
-set g_onslaught_spawn_at_generator_chance 0
-set g_onslaught_spawn_at_generator_random 0
-
-
-// ======
-//  race
-// ======
-set g_race 0 "Race: be faster than your opponents"
-set g_race_qualifying_timelimit 0
-set g_race_qualifying_timelimit_override -1 "qualifying session time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
-set g_race_teams 0     "when 2, 3, or 4, the race is played as a team game (the team members can add up their laps)"
-
-// ==========
-//  invasion
-// ==========
-set g_invasion 0 "Invasion: survive against waves of monsters"
-set g_invasion_round_timelimit 120 "maximum time to kill all monsters"
-set g_invasion_warmup 10 "time between waves to prepare for battle"
-set g_invasion_monster_count 10 "number of monsters on first wave (increments)"
-set g_invasion_zombies_only 0 "only spawn zombies"
-set g_invasion_spawn_delay 0.25
-set g_invasion_spawnpoint_spawn_delay 0.5
-set g_invasion_teams 0 "number of teams in invasion (note: use mapinfo to set this)"
-set g_invasion_team_spawns 1 "use team spawns in teamplay invasion mode"
diff --git a/gfx/smile.tga b/gfx/smile.tga
new file mode 100644 (file)
index 0000000..54ba1bc
Binary files /dev/null and b/gfx/smile.tga differ
index d078494899004d591cb01ffad0c5c68acb14fa4d..9e8460da15ad4dbcfcc3edf24802e65eaf02a3a4 100644 (file)
@@ -48,7 +48,7 @@ set g_instagib_friendlypush 1 "allow pushing teammates with the vaporizer primar
 // ==========
 //  overkill
 // ==========
-set g_overkill 0 "enable overkill"
+set g_overkill 0 "internal cvar, to enable overkill, use  `exec defaultOverkill.cfg`"
 
 set g_overkill_powerups_replace 1
 set g_overkill_itemwaypoints 1
@@ -440,3 +440,27 @@ set g_globalforces 0 "Global forces: knockback affects everyone"
 set g_globalforces_noself 1 "Global forces: ignore self damage"
 set g_globalforces_self 1 "Global forces: knockback self scale"
 set g_globalforces_range 1000 "Global forces: max range of effect"
+
+// =========
+//  bugrigs
+// =========
+set g_bugrigs 0
+set g_bugrigs_planar_movement 1        "BROTRR bug emulation"
+set g_bugrigs_planar_movement_car_jumping 1    "my own bug"
+set g_bugrigs_reverse_speeding 1       "BROTRR bug emulation"
+set g_bugrigs_reverse_spinning 1       "BROTRR bug emulation"
+set g_bugrigs_reverse_stopping 1       "BROTRR bug emulation"
+set g_bugrigs_air_steering 1   "NFS bug emulation"
+set g_bugrigs_angle_smoothing 5        "smooth the car angle a bit, looks nice"
+set g_bugrigs_friction_floor 50        "units/sec friction on floor"
+set g_bugrigs_friction_brake 950       "units/sec friction for braking"
+set g_bugrigs_friction_air 0.00001     "(very small) v <- v - v^2 * g_bugrigs_friction_air"
+set g_bugrigs_accel 800        "acceleration"
+set g_bugrigs_speed_ref 400    "reference speed for accel and steer responsiveness"
+set g_bugrigs_speed_pow 2      "reference power for accel and steer responsiveness"
+set g_bugrigs_steer 1  "steering amount"
+
+// ==============
+//  running guns
+// ==============
+set g_running_guns 0 "... or wonder, till it drives you mad, what would have followed if you had."
index b3439d691308a215a59dc7286e0790fc7cd103bd..88742ff0b89943675ba5347037376d6fe96325a6 100644 (file)
@@ -6,8 +6,6 @@
 // ==============
 //  Main options
 // ==============
-seta cl_physics "default" "client selected physics set"
-
 set g_physics_clientselect 0 "allow clients to select their physics set"
 set g_physics_clientselect_options "xonotic nexuiz quake warsow defrag quake3 vecxis quake2 bones"
 set g_physics_clientselect_default "" "override default physics"
index c660a7e94e5269d40aeea9f433fc2de70ee00bca..bd17dad6aaf5e93c0c729891009cfedfa85ca258 100644 (file)
@@ -8,6 +8,9 @@ QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
 VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
 NDEBUG ?= 1
 XONOTIC ?= 1
+ENABLE_EFFECTINFO ?= 0
+ENABLE_DEBUGDRAW ?= 0
+ENABLE_DEBUGTRACE ?= 0
 BUILD_MOD ?=
 
 ifndef ZIP
@@ -34,6 +37,9 @@ QCCDEFS ?= \
        -DXONOTIC=$(XONOTIC) \
        -DWATERMARK="$(QCCFLAGS_WATERMARK)" \
        -DNDEBUG=$(NDEBUG) \
+       -DENABLE_EFFECTINFO=$(ENABLE_EFFECTINFO) \
+       -DENABLE_DEBUGDRAW=$(ENABLE_DEBUGDRAW) \
+       -DENABLE_DEBUGTRACE=$(ENABLE_DEBUGTRACE) \
        $(if $(BUILD_MOD), -DBUILD_MOD="$(BUILD_MOD)" -I$(BUILD_MOD), ) \
        $(QCCDEFS_EXTRA)
 
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 d95958392bb9626e2cadba13cd6edf88394bdb98..6d3fb626771723a0d86af77ab2e775f7a24364f7 100644 (file)
@@ -152,7 +152,6 @@ float autocvar_crosshair_ring_reload_size;
 float autocvar_crosshair_size;
 int autocvar_ekg;
 float autocvar_fov;
-float autocvar_g_balance_damagepush_speedfactor;
 bool autocvar_hud_cursormode = true;
 float autocvar_hud_colorflash_alpha;
 bool autocvar_hud_configure_checkcollisions;
@@ -441,7 +440,9 @@ int autocvar__cl_playerskin;
 string autocvar__cl_playermodel;
 float autocvar_cl_deathglow;
 bool autocvar_developer_csqcentities;
-float autocvar_g_jetpack_attenuation;
+float autocvar_cl_jetpack_attenuation = 2;
 bool autocvar_cl_showspectators;
 int autocvar_cl_nade_timer;
 bool autocvar_r_drawviewmodel;
+bool autocvar_cl_race_cptimes_onlyself;
+bool autocvar_cl_race_cptimes_showself = false;
index a984a19a32a283dfc7a12f2aacee211761f9e87e..2db9e54cf1af01dfd8bf9e0348a204f11d9e4f47 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;
@@ -133,7 +138,7 @@ void BGMScript_InitEntity(entity e)
                e.bgmscriptline = e.bgmscriptline0 = i;
                if(i >= bgmscriptbufsize)
                {
-                       LOG_INFOF("ERROR: bgmscript does not define %s\n", e.bgmscript);
+                       LOG_INFOF("ERROR: bgmscript does not define %s", e.bgmscript);
                        strunzone(e.bgmscript);
                        e.bgmscript = string_null;
                }
index 6777eefa9572b734b66eaed6bb92dcfd348e7bf2..8faf0f387b6ccd33103cbfd825dec2692a7ac760 100644 (file)
@@ -52,22 +52,22 @@ void LocalCommand_blurtest(int request)
                        blurtest_time1 = time + stof(argv(1));
                        blurtest_radius = stof(argv(2));
                        blurtest_power = stof(argv(3));
-                       LOG_INFO("Enabled blurtest\n");
+                       LOG_INFO("Enabled blurtest");
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd blurtest\n");
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 cl_cmd blurtest");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
        #else
        if (request)
        {
-               LOG_INFO("Blurtest is not enabled on this client.\n");
+               LOG_INFO("Blurtest is not enabled on this client.");
                return;
        }
        #endif
@@ -105,23 +105,25 @@ void LocalCommand_boxparticles(int request, int argc)
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2boxparticles^7\n");
+                       LOG_INFO("Incorrect parameters for ^2boxparticles^7");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 lv_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n");
-                       LOG_INFO("  'effectname' is the name of a particle effect in effectinfo.txt\n");
-                       LOG_INFO("  'own' is the entity number of the owner (negative for csqc ent, positive for svqc ent)\n");
-                       LOG_INFO("  'org_from' is the starting origin of the box\n");
-                       LOG_INFO("  'org_to' is the ending origin of the box\n");
-                       LOG_INFO("  'dir_from' is the minimum velocity\n");
-                       LOG_INFO("  'dir_to' is the maximum velocity\n");
-                       LOG_INFO("  'countmultiplier' defines a multiplier for the particle count (affects count only, not countabsolute or trailspacing)\n");
-                       LOG_INFO("  'flags' can contain:\n");
-                       LOG_INFO("    1 to respect globals particles_alphamin, particles_alphamax (set right before via prvm_globalset client)\n");
-                       LOG_INFO("    2 to respect globals particles_colormin, particles_colormax (set right before via prvm_globalset client)\n");
-                       LOG_INFO("    4 to respect globals particles_fade (set right before via prvm_globalset client)\n");
-                       LOG_INFO("    128 to draw a trail, not a box\n");
+                       LOG_INFO(
+                           "Usage:^3 lv_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n"
+                "  'effectname' is the name of a particle effect in effectinfo.txt\n"
+                "  'own' is the entity number of the owner (negative for csqc ent, positive for svqc ent)\n"
+                "  'org_from' is the starting origin of the box\n"
+                "  'org_to' is the ending origin of the box\n"
+                "  'dir_from' is the minimum velocity\n"
+                "  'dir_to' is the maximum velocity\n"
+                "  'countmultiplier' defines a multiplier for the particle count (affects count only, not countabsolute or trailspacing)\n"
+                "  'flags' can contain:\n"
+                "    1 to respect globals particles_alphamin, particles_alphamax (set right before via prvm_globalset client)\n"
+                "    2 to respect globals particles_colormin, particles_colormax (set right before via prvm_globalset client)\n"
+                "    4 to respect globals particles_fade (set right before via prvm_globalset client)\n"
+                "    128 to draw a trail, not a box\n"
+                       );
                        return;
                }
        }
@@ -146,13 +148,13 @@ void LocalCommand_create_scrshot_ent(int request)
                                fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles.x), " ", ftos(view_angles.y), " ", ftos(view_angles.z)), "\"\n"));
                                fputs(fh, "}\n");
 
-                               LOG_INFO("Completed screenshot entity dump in ^2data/data/", path, MapInfo_Map_bspname, "_scrshot_ent.txt^7.\n");
+                               LOG_INFO("Completed screenshot entity dump in ^2data/data/", path, MapInfo_Map_bspname, "_scrshot_ent.txt^7.");
 
                                fclose(fh);
                        }
                        else
                        {
-                               LOG_INFO("^1Error: ^7Could not dump to file!\n");
+                               LOG_INFO("^1Error: ^7Could not dump to file!");
                        }
                        return;
                }
@@ -160,8 +162,8 @@ void LocalCommand_create_scrshot_ent(int request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd create_scrshot_ent [path]\n");
-                       LOG_INFO("  Where 'path' can be the subdirectory of data/data in which the file is saved.\n");
+                       LOG_INFO("Usage:^3 cl_cmd create_scrshot_ent [path]");
+                       LOG_INFO("  Where 'path' can be the subdirectory of data/data in which the file is saved.");
                        return;
                }
        }
@@ -190,8 +192,8 @@ void LocalCommand_debugmodel(int request, int argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd debugmodel model\n");
-                       LOG_INFO("  Where 'model' is a string of the model name to use for the debug model.\n");
+                       LOG_INFO("Usage:^3 cl_cmd debugmodel model");
+                       LOG_INFO("  Where 'model' is a string of the model name to use for the debug model.");
                        return;
                }
        }
@@ -236,12 +238,12 @@ void LocalCommand_handlevote(int request, int argc)
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2handlevote^7\n");
+                       LOG_INFO("Incorrect parameters for ^2handlevote^7");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd handlevote vote\n");
-                       LOG_INFO("  Where 'vote' is the selection for either the current poll or uid2name.\n");
+                       LOG_INFO("Usage:^3 cl_cmd handlevote vote");
+                       LOG_INFO("  Where 'vote' is the selection for either the current poll or uid2name.");
                        return;
                }
        }
@@ -279,10 +281,10 @@ void LocalCommand_hud(int request, int argc)
                                {
                                        if (argv(2) == "help")
                                        {
-                                               LOG_INFO(" quickmenu [[default | file | \"\"] submenu file]\n");
-                                               LOG_INFO("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n");
-                                               LOG_INFO("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.\n");
-                                               LOG_INFO("A file name can also be given to open a different quickmenu\n");
+                                               LOG_INFO(" quickmenu [[default | file | \"\"] submenu file]");
+                                               LOG_INFO("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.");
+                                               LOG_INFO("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.");
+                                               LOG_INFO("A file name can also be given to open a different quickmenu");
                                                return;
                                        }
                                        string file = ((argv(4) == "") ? autocvar_hud_panel_quickmenu_file : argv(4));
@@ -337,16 +339,16 @@ void LocalCommand_hud(int request, int argc)
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2hud^7\n");
+                       LOG_INFO("Incorrect parameters for ^2hud^7");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd hud action [configname | radartoggle | layout]\n");
-                       LOG_INFO("  Where 'action' is the command to complete,\n");
-                       LOG_INFO("  'configname' is the name to save to for \"save\" action,\n");
-                       LOG_INFO("  'radartoggle' is to control hud_panel_radar_maximized for \"radar\" action,\n");
-                       LOG_INFO("  and 'layout' is how to organize the scoreboard columns for the set action.\n");
-                       LOG_INFO("  Full list of commands here: \"configure, quickmenu, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"\n");
+                       LOG_INFO("Usage:^3 cl_cmd hud action [configname | radartoggle | layout]");
+                       LOG_INFO("  Where 'action' is the command to complete,");
+                       LOG_INFO("  'configname' is the name to save to for \"save\" action,");
+                       LOG_INFO("  'radartoggle' is to control hud_panel_radar_maximized for \"radar\" action,");
+                       LOG_INFO("  and 'layout' is how to organize the scoreboard columns for the set action.");
+                       LOG_INFO("  Full list of commands here: \"configure, quickmenu, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"");
                        return;
                }
        }
@@ -368,12 +370,12 @@ void LocalCommand_localprint(int request, int argc)
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2localprint^7\n");
+                       LOG_INFO("Incorrect parameters for ^2localprint^7");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd localprint \"message\"\n");
-                       LOG_INFO("  'message' is the centerprint message to send to yourself.\n");
+                       LOG_INFO("Usage:^3 cl_cmd localprint \"message\"");
+                       LOG_INFO("  'message' is the centerprint message to send to yourself.");
                        return;
                }
        }
@@ -395,12 +397,12 @@ void LocalCommand_mv_download(int request, int argc)
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2mv_download^7\n");
+                       LOG_INFO("Incorrect parameters for ^2mv_download^7");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd mv_download mapid\n");
-                       LOG_INFO("  Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.\n");
+                       LOG_INFO("Usage:^3 cl_cmd mv_download mapid");
+                       LOG_INFO("  Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.");
                        return;
                }
        }
@@ -432,12 +434,12 @@ void LocalCommand_sendcvar(int request, int argc)
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2sendcvar^7\n");
+                       LOG_INFO("Incorrect parameters for ^2sendcvar^7");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd sendcvar <cvar>\n");
-                       LOG_INFO("  Where 'cvar' is the cvar plus arguments to send to the server.\n");
+                       LOG_INFO("Usage:^3 cl_cmd sendcvar <cvar>");
+                       LOG_INFO("  Where 'cvar' is the cvar plus arguments to send to the server.");
                        return;
                }
        }
@@ -484,7 +486,7 @@ CLIENT_COMMAND(sendcvar, "Send a cvar to the server (like weaponpriority)") { Lo
 
 void LocalCommand_macro_help()
 {
-       FOREACH(CLIENT_COMMANDS, true, LOG_INFOF("  ^2%s^7: %s\n", it.m_name, it.m_description));
+       FOREACH(CLIENT_COMMANDS, true, LOG_INFOF("  ^2%s^7: %s", it.m_name, it.m_description));
 }
 
 bool LocalCommand_macro_command(int argc, string command)
@@ -531,14 +533,14 @@ void GameCommand(string command)
        {
                if (argc == 1)
                {
-                       LOG_INFO("\nClient console commands:\n");
+                       LOG_INFO("Client console commands:");
                        LocalCommand_macro_help();
 
-                       LOG_INFO("\nGeneric commands shared by all programs:\n");
+                       LOG_INFO("\nGeneric commands shared by all programs:");
                        GenericCommand_macro_help();
 
-                       LOG_INFO("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are listed above.\n");
-                       LOG_INFO("For help about a specific command, type cl_cmd help COMMAND\n");
+                       LOG_INFO("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are listed above.");
+                       LOG_INFO("For help about a specific command, type cl_cmd help COMMAND");
 
                        return;
                }
@@ -558,7 +560,7 @@ void GameCommand(string command)
           ) return;
 
        // nothing above caught the command, must be invalid
-       LOG_INFO(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.\n");
+       LOG_INFO(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.");
 }
 
 
index 104465360770beaddc14298f06d2872f0d2d6d1f..6499a683e8f4c2cf198be39cb0bee2c9eb9e9a3f 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>
@@ -129,11 +134,14 @@ void CSQCPlayer_ModelAppearance_PostUpdate(entity this)
                this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel);
                this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel;
                if(!this.forceplayermodels_isgoodmodel)
-                       LOG_INFOF("Warning: missing model %s has been used\n", this.forceplayermodels_savemodel);
+                       LOG_INFOF("Warning: missing model %s has been used", this.forceplayermodels_savemodel);
        }
 }
 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;
@@ -561,7 +571,7 @@ void CSQCModel_Effects_Apply(entity this)
        {
                if(!this.snd_looping)
                {
-                       sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation);
+                       sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_cl_jetpack_attenuation);
                        this.snd_looping = CH_TRIGGER_SINGLE;
                }
        }
@@ -569,7 +579,7 @@ void CSQCModel_Effects_Apply(entity this)
        {
                if(this.snd_looping)
                {
-                       sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
+                       sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
                        this.snd_looping = 0;
                }
        }
index c520a2f1eb8fe6180cfb7ddb18ab5d890f91b259..d36994ec3d2e69bbc6849d82eaf3272686c01949 100644 (file)
@@ -36,9 +36,11 @@ float race_time;
 float race_laptime;
 float race_checkpointtime;
 float race_previousbesttime;
+float race_mypreviousbesttime;
 string race_previousbestname;
 float race_nextcheckpoint;
 float race_nextbesttime;
+float race_mybesttime;
 string race_nextbestname;
 float race_penaltyaccumulator; // qualifying: total penalty time in tenths
 float race_penaltyeventtime; // time when the player got the penalty
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 1418dff830e28379454380c5a848c056eac51766..d070dce380d3b4877f5ac6457a9993a388717957 100644 (file)
@@ -61,7 +61,7 @@ void HUD_Reset ();
 void HUD_Main ();
 
 int race_CheckName(string net_name);
-string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname);
+string MakeRaceString(int cp, float mytime, float theirtime, float othertime, float lapdelta, string theirname);
 
 int vote_yescount;
 int vote_nocount;
index 073b2d0f7df3874fce2808f679f762b64b50342a..ec07ee4095a30e3c1c462f25fae034882e87b123 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"))
@@ -236,11 +239,11 @@ void HUD_Panel_ExportCfg(string cfgname)
 
                HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
 
-               LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
+               LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)"), filename);
                fclose(fh);
        }
        else
-               LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
+               LOG_INFOF(_("^1Couldn't write to %s"), filename);
 }
 
 void HUD_Configure_Exit_Force()
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..9af8673dab8941adc2ad73decdd4834ba6ddce63 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>
@@ -80,12 +83,12 @@ bool QuickMenu_Open(string mode, string submenu, string file)
        if(mode == "file")
        {
                if(file == "" || file == "0")
-                       LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
+                       LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu");
                else
                {
                        fh = fopen(file, FILE_READ);
                        if(fh < 0)
-                               LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", file);
+                               LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu", file);
                }
                if(fh < 0)
                        mode = "default";
index 2f54e2a37981bfa42c166fbe8ea18f1d7a5b7c42..6a190f2ca5f7c9b14c90590ed81f5227acc56bf0 100644 (file)
@@ -1,18 +1,19 @@
 #include "racetimer.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/mapinfo.qh>
 
 // Race timer (#6)
 
 // return the string of the onscreen race timer
-string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
+string MakeRaceString(int cp, float mytime, float theirtime, float othertime, float lapdelta, string theirname)
 {
        TC(int, cp);
-       string col;
-       string timestr;
-       string cpname;
-       string lapstr;
-       lapstr = "";
+       string cpname, lapstr = "", timestr = "", col = "^7", othercol = "^7", othertimestr = "";
+       if(theirname == "" || !autocvar_cl_race_cptimes_showself)
+               othertime = 0; // don't count personal time
 
        if(theirtime == 0) // goal hit
        {
@@ -32,6 +33,22 @@ string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, str
                        col = "^2";
                }
 
+               if(othertime > 0)
+               {
+                       othertimestr = strcat("+", ftos_decimals(+othertime, TIME_DECIMALS));
+                       othercol = "^1";
+               }
+               else if(othertime == 0)
+               {
+                       othertimestr = "+0.0";
+                       othercol = "^3";
+               }
+               else
+               {
+                       othertimestr = strcat("-", ftos_decimals(-othertime, TIME_DECIMALS));
+                       othercol = "^2";
+               }
+
                if(lapdelta > 0)
                {
                        lapstr = sprintf(_(" (-%dL)"), lapdelta);
@@ -50,11 +67,11 @@ string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, str
                else
                        timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
                col = "^3";
-       }
-       else
-       {
-               col = "^7";
-               timestr = "";
+               if(mytime >= othertime)
+                       othertimestr = strcat("+", ftos_decimals(mytime - othertime, TIME_DECIMALS));
+               else
+                       othertimestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(othertime));
+               othercol = "^7";
        }
 
        if(cp == 254)
@@ -70,6 +87,8 @@ string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, str
                return strcat(col, cpname);
        else if(theirname == "")
                return strcat(col, sprintf("%s (%s)", cpname, timestr));
+       else if(othertime)
+               return strcat(col, sprintf("%s %s(%s)%s (%s %s)", cpname, othercol, othertimestr, col, timestr, strcat(ColorTranslateRGB(theirname), col, lapstr)));
        else
                return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(ColorTranslateRGB(theirname), col, lapstr)));
 }
@@ -146,20 +165,24 @@ void HUD_RaceTimer ()
                        if(race_checkpoint != 254)
                        {
                                if(race_time && race_previousbesttime)
-                                       s = MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, 0, race_previousbestname);
+                                       s = MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, ((race_mypreviousbesttime) ? TIME_DECODE(race_time) - TIME_DECODE(race_mypreviousbesttime) : 0), 0, race_previousbestname);
                                else
-                                       s = MakeRaceString(race_checkpoint, 0, -1, 0, race_previousbestname);
+                                       s = MakeRaceString(race_checkpoint, 0, -1, 0, 0, race_previousbestname);
                                if(race_time)
                                        forcetime = TIME_ENCODED_TOSTRING(race_time);
                        }
                }
                else
                {
-                       if(race_laptime && race_nextbesttime && race_nextcheckpoint != 254)
+                       if(race_laptime && race_nextcheckpoint != 254)
                        {
-                               a = bound(0, 2 - ((race_laptime + TIME_DECODE(race_nextbesttime)) - (time + TIME_DECODE(race_penaltyaccumulator))), 1);
-                               if(a > 0) // next one?
-                                       s = MakeRaceString(race_nextcheckpoint, (time + TIME_DECODE(race_penaltyaccumulator)) - race_laptime, TIME_DECODE(race_nextbesttime), 0, race_nextbestname);
+                               if(race_nextbesttime)
+                               {
+                                       a = bound(0, 2 - ((race_laptime + TIME_DECODE(race_nextbesttime)) - (time + TIME_DECODE(race_penaltyaccumulator))), 1);
+                                       float a2 = ((race_mybesttime) ? bound(0, 2 - ((race_laptime + TIME_DECODE(race_mybesttime)) - (time + TIME_DECODE(race_penaltyaccumulator))), 1) : 0);
+                                       if(a > 0) // next one?
+                                               s = MakeRaceString(race_nextcheckpoint, (time + TIME_DECODE(race_penaltyaccumulator)) - race_laptime, TIME_DECODE(race_nextbesttime), ((a2 > 0) ? TIME_DECODE(race_mybesttime) : 0), 0, race_nextbestname);
+                               }
                        }
                }
 
@@ -205,14 +228,14 @@ void HUD_RaceTimer ()
                if(race_mycheckpointtime)
                {
                        a = bound(0, 2 - (time - race_mycheckpointtime), 1);
-                       s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -(race_mycheckpointenemy == ""), race_mycheckpointlapsdelta, race_mycheckpointenemy);
+                       s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -(race_mycheckpointenemy == ""), 0, race_mycheckpointlapsdelta, race_mycheckpointenemy);
                        str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
                        drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
                if(race_othercheckpointtime && race_othercheckpointenemy != "")
                {
                        a = bound(0, 2 - (time - race_othercheckpointtime), 1);
-                       s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -(race_othercheckpointenemy == ""), race_othercheckpointlapsdelta, race_othercheckpointenemy);
+                       s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -(race_othercheckpointenemy == ""), 0, race_othercheckpointlapsdelta, race_othercheckpointenemy);
                        str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
                        drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
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..8e0d0f057695d8e237fbcbe2816b11298c6fce89 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>
@@ -150,13 +153,12 @@ float SetTeam(entity pl, float Team);
 //float lastpnum;
 void Scoreboard_UpdatePlayerTeams()
 {
-       float Team;
        entity pl, tmp;
        //int num = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
                //num += 1;
-               Team = entcs_GetScoreTeam(pl.sv_entnum);
+               int Team = entcs_GetScoreTeam(pl.sv_entnum);
                if(SetTeam(pl, Team))
                {
                        tmp = pl.sort_prev;
@@ -293,48 +295,48 @@ void Scoreboard_UpdateTeamPos(entity Team)
 
 void Cmd_Scoreboard_Help()
 {
-       LOG_INFO(_("You can modify the scoreboard using the ^2scoreboard_columns_set command.\n"));
-       LOG_INFO(_("^3|---------------------------------------------------------------|\n"));
-       LOG_INFO(_("Usage:\n"));
-       LOG_INFO(_("^2scoreboard_columns_set default\n"));
-       LOG_INFO(_("^2scoreboard_columns_set ^7field1 field2 ...\n"));
-       LOG_INFO(_("The following field names are recognized (case insensitive):\n"));
-       LOG_INFO(_("You can use a ^3|^7 to start the right-aligned fields.\n"));
-       LOG_INFO("\n");
-
-       LOG_INFO(_("^3name^7 or ^3nick^7             Name of a player\n"));
-       LOG_INFO(_("^3ping^7                     Ping time\n"));
-       LOG_INFO(_("^3pl^7                       Packet loss\n"));
-       LOG_INFO(_("^3elo^7                      Player ELO\n"));
-       LOG_INFO(_("^3kills^7                    Number of kills\n"));
-       LOG_INFO(_("^3deaths^7                   Number of deaths\n"));
-       LOG_INFO(_("^3suicides^7                 Number of suicides\n"));
-       LOG_INFO(_("^3frags^7                    kills - suicides\n"));
-       LOG_INFO(_("^3kd^7                       The kill-death ratio\n"));
-       LOG_INFO(_("^3dmg^7                      The total damage done\n"));
-       LOG_INFO(_("^3dmgtaken^7                 The total damage taken\n"));
-       LOG_INFO(_("^3sum^7                      frags - deaths\n"));
-       LOG_INFO(_("^3caps^7                     How often a flag (CTF) or a key (KeyHunt) was captured\n"));
-       LOG_INFO(_("^3pickups^7                  How often a flag (CTF) or a key (KeyHunt) or a ball (Keepaway) was picked up\n"));
-       LOG_INFO(_("^3captime^7                  Time of fastest cap (CTF)\n"));
-       LOG_INFO(_("^3fckills^7                  Number of flag carrier kills\n"));
-       LOG_INFO(_("^3returns^7                  Number of flag returns\n"));
-       LOG_INFO(_("^3drops^7                    Number of flag drops\n"));
-       LOG_INFO(_("^3lives^7                    Number of lives (LMS)\n"));
-       LOG_INFO(_("^3rank^7                     Player rank\n"));
-       LOG_INFO(_("^3pushes^7                   Number of players pushed into void\n"));
-       LOG_INFO(_("^3destroyed^7                Number of keys destroyed by pushing them into void\n"));
-       LOG_INFO(_("^3kckills^7                  Number of keys carrier kills\n"));
-       LOG_INFO(_("^3losses^7                   Number of times a key was lost\n"));
-       LOG_INFO(_("^3laps^7                     Number of laps finished (race/cts)\n"));
-       LOG_INFO(_("^3time^7                     Total time raced (race/cts)\n"));
-       LOG_INFO(_("^3fastest^7                  Time of fastest lap (race/cts)\n"));
-       LOG_INFO(_("^3ticks^7                    Number of ticks (DOM)\n"));
-       LOG_INFO(_("^3takes^7                    Number of domination points taken (DOM)\n"));
-       LOG_INFO(_("^3bckills^7                  Number of ball carrier kills\n"));
-       LOG_INFO(_("^3bctime^7                   Total amount of time holding the ball in Keepaway\n"));
-       LOG_INFO(_("^3score^7                    Total score\n"));
-       LOG_INFO("\n");
+       LOG_INFO(_("You can modify the scoreboard using the ^2scoreboard_columns_set command."));
+       LOG_INFO(_("^3|---------------------------------------------------------------|"));
+       LOG_INFO(_("Usage:"));
+       LOG_INFO(_("^2scoreboard_columns_set default"));
+       LOG_INFO(_("^2scoreboard_columns_set ^7field1 field2 ..."));
+       LOG_INFO(_("The following field names are recognized (case insensitive):"));
+       LOG_INFO(_("You can use a ^3|^7 to start the right-aligned fields."));
+       LOG_INFO("");
+
+       LOG_INFO(_("^3name^7 or ^3nick^7             Name of a player"));
+       LOG_INFO(_("^3ping^7                     Ping time"));
+       LOG_INFO(_("^3pl^7                       Packet loss"));
+       LOG_INFO(_("^3elo^7                      Player ELO"));
+       LOG_INFO(_("^3kills^7                    Number of kills"));
+       LOG_INFO(_("^3deaths^7                   Number of deaths"));
+       LOG_INFO(_("^3suicides^7                 Number of suicides"));
+       LOG_INFO(_("^3frags^7                    kills - suicides"));
+       LOG_INFO(_("^3kd^7                       The kill-death ratio"));
+       LOG_INFO(_("^3dmg^7                      The total damage done"));
+       LOG_INFO(_("^3dmgtaken^7                 The total damage taken"));
+       LOG_INFO(_("^3sum^7                      frags - deaths"));
+       LOG_INFO(_("^3caps^7                     How often a flag (CTF) or a key (KeyHunt) was captured"));
+       LOG_INFO(_("^3pickups^7                  How often a flag (CTF) or a key (KeyHunt) or a ball (Keepaway) was picked up"));
+       LOG_INFO(_("^3captime^7                  Time of fastest cap (CTF)"));
+       LOG_INFO(_("^3fckills^7                  Number of flag carrier kills"));
+       LOG_INFO(_("^3returns^7                  Number of flag returns"));
+       LOG_INFO(_("^3drops^7                    Number of flag drops"));
+       LOG_INFO(_("^3lives^7                    Number of lives (LMS)"));
+       LOG_INFO(_("^3rank^7                     Player rank"));
+       LOG_INFO(_("^3pushes^7                   Number of players pushed into void"));
+       LOG_INFO(_("^3destroyed^7                Number of keys destroyed by pushing them into void"));
+       LOG_INFO(_("^3kckills^7                  Number of keys carrier kills"));
+       LOG_INFO(_("^3losses^7                   Number of times a key was lost"));
+       LOG_INFO(_("^3laps^7                     Number of laps finished (race/cts)"));
+       LOG_INFO(_("^3time^7                     Total time raced (race/cts)"));
+       LOG_INFO(_("^3fastest^7                  Time of fastest lap (race/cts)"));
+       LOG_INFO(_("^3ticks^7                    Number of ticks (DOM)"));
+       LOG_INFO(_("^3takes^7                    Number of domination points taken (DOM)"));
+       LOG_INFO(_("^3bckills^7                  Number of ball carrier kills"));
+       LOG_INFO(_("^3bctime^7                   Total amount of time holding the ball in Keepaway"));
+       LOG_INFO(_("^3score^7                    Total score"));
+       LOG_INFO("");
 
        LOG_INFO(_("Before a field you can put a + or - sign, then a comma separated list\n"
                "of game types, then a slash, to make the field show up only in these\n"
@@ -344,11 +346,10 @@ void Cmd_Scoreboard_Help()
        LOG_INFO(_("The special game type names 'teams' and 'noteams' can be used to\n"
                "include/exclude ALL teams/noteams game modes.\n\n"));
 
-       LOG_INFO(_("Example: scoreboard_columns_set name ping pl | +ctf/field3 -dm/field4\n"));
-       LOG_INFO(_("will display name, ping and pl aligned to the left, and the fields\n"
+       LOG_INFO(_("Example: scoreboard_columns_set name ping pl | +ctf/field3 -dm/field4"));
+       LOG_INFO(_("will display name, ping and pl aligned to the left, and the fields"
                "right of the vertical bar aligned to the right.\n"));
-       LOG_INFO(_("'field3' will only be shown in CTF, and 'field4' will be shown in all\n"
-               "other gamemodes except DM.\n"));
+       LOG_INFO(_("'field3' will only be shown in CTF, and 'field4' will be shown in all\nother gamemodes except DM.\n"));
 }
 
 // NOTE: adding a gametype with ? to not warn for an optional field
@@ -473,7 +474,7 @@ LABEL(notfound)
                                else
                                {
                                        if(!nocomplain)
-                                               LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str);
+                                               LOG_INFOF("^1Error:^7 Unknown score field: '%s'", str);
                                        continue;
                                }
 LABEL(found)
@@ -512,7 +513,7 @@ LABEL(found)
                        sbt_field_title[0] = strzone(TranslateScoresLabel("name"));
                        sbt_field[0] = SP_NAME;
                        ++sbt_num_fields;
-                       LOG_INFO("fixed missing field 'name'\n");
+                       LOG_INFO("fixed missing field 'name'");
 
                        if(!have_separator)
                        {
@@ -527,7 +528,7 @@ LABEL(found)
                                sbt_field[1] = SP_SEPARATOR;
                                sbt_field_size[1] = stringwidth("|", false, hud_fontsize);
                                ++sbt_num_fields;
-                               LOG_INFO("fixed missing field '|'\n");
+                               LOG_INFO("fixed missing field '|'");
                        }
                }
                else if(!have_separator)
@@ -537,7 +538,7 @@ LABEL(found)
                        sbt_field_size[sbt_num_fields] = stringwidth("|", false, hud_fontsize);
                        sbt_field[sbt_num_fields] = SP_SEPARATOR;
                        ++sbt_num_fields;
-                       LOG_INFO("fixed missing field '|'\n");
+                       LOG_INFO("fixed missing field '|'");
                }
                if(!have_secondary)
                {
@@ -546,7 +547,7 @@ LABEL(found)
                        sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
                        sbt_field[sbt_num_fields] = ps_secondary;
                        ++sbt_num_fields;
-                       LOG_INFOF("fixed missing field '%s'\n", scores_label(ps_secondary));
+                       LOG_INFOF("fixed missing field '%s'", scores_label(ps_secondary));
                }
                if(!have_primary)
                {
@@ -555,7 +556,7 @@ LABEL(found)
                        sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
                        sbt_field[sbt_num_fields] = ps_primary;
                        ++sbt_num_fields;
-                       LOG_INFOF("fixed missing field '%s'\n", scores_label(ps_primary));
+                       LOG_INFOF("fixed missing field '%s'", scores_label(ps_primary));
                }
        }
 
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..15e18e8f445a2b86f7ed9af851c332a856b99e4c 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)
@@ -21,7 +24,7 @@ void HUD_Vote()
                {
                        vote_yescount = 0;
                        vote_nocount = 0;
-                       LOG_INFO(_("^1You must answer before entering hud configure mode\n"));
+                       LOG_INFO(_("^1You must answer before entering hud configure mode"));
                        cvar_set("_hud_configure", "0");
                }
                if(vote_called_vote)
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 bf82ccb3425840d2b82409c12bf23bf001dbd66f..ae624ef85c88c1a7c2b6a09d0fb7617629cfb089 100644 (file)
@@ -1,6 +1,12 @@
 #include "main.qh"
 
-#include <common/effects/qc/all.qh>
+#include "defs.qh"
+#include <common/ent_cs.qh>
+#include "miscfunctions.qh"
+#include <common/effects/effect.qh>
+#include <common/effects/qc/_mod.qh>
+#include <common/effects/all.qh>
+#include <common/effects/all.inc>
 #include "hud/_mod.qh"
 #include "mapvoting.qh"
 #include "mutators/events.qh"
@@ -91,7 +97,7 @@ void CSQC_Init()
        prvm_language = strzone(cvar_string("prvm_language"));
 
 #ifdef WATERMARK
-       LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK);
+       LOG_INFOF("^4CSQC Build information: ^1%s", WATERMARK);
 #endif
 
        {
@@ -132,8 +138,6 @@ void CSQC_Init()
 
        registercvar("cl_spawn_near_teammate", "1");
 
-       registercvar("cl_race_cptimes_onlyself", "0");
-
        if(autocvar_cl_lockview)
                cvar_set("cl_lockview", "0");
 
@@ -148,6 +152,9 @@ void CSQC_Init()
 
        GetTeam(NUM_SPECTATOR, true); // add specs first
 
+       for (int w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
+               weapon_accuracy[w] = -1;
+
        // precaches
 
        if(autocvar_cl_reticle)
@@ -407,7 +414,7 @@ NET_HANDLE(ENT_CLIENT_SCORES, bool isnew)
        if(!isNew && n != this.sv_entnum)
        {
                //print("A CSQC entity changed its owner!\n");
-               LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname);
+               LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)", etof(this), this.classname);
                isNew = true;
                Ent_Remove(this);
        }
@@ -489,9 +496,9 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
 
     int f = ReadByte();
 
-       scoreboard_showscores_force = (f & 1);
+       scoreboard_showscores_force = (f & BIT(0));
 
-       if(f & 2)
+       if(f & BIT(1))
        {
                newspectatee_status = ReadByte();
                if(newspectatee_status == player_localnum + 1)
@@ -500,9 +507,9 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
        else
                newspectatee_status = 0;
 
-       spectatorbutton_zoom = (f & 4);
+       spectatorbutton_zoom = (f & BIT(2));
 
-       if(f & 16)
+       if(f & BIT(4))
        {
                num_spectators = ReadByte();
 
@@ -659,6 +666,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));
 }
 
@@ -667,7 +677,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));
@@ -809,7 +826,7 @@ void CSQC_Ent_Update(entity this, bool isnew)
        {
                if (t != this.enttype || isnew)
                {
-                       LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t);
+                       LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)", etof(this), this.entnum, this.enttype, t);
                        Ent_Remove(this);
                        clearentity(this);
                        isnew = true;
@@ -819,7 +836,7 @@ void CSQC_Ent_Update(entity this, bool isnew)
        {
                if (!isnew)
                {
-                       LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t);
+                       LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)", etof(this), this.entnum, t);
                        isnew = true;
                }
        }
@@ -829,7 +846,7 @@ void CSQC_Ent_Update(entity this, bool isnew)
        FOREACH(LinkedEntities, it.m_id == t, {
                if (isnew) this.classname = it.netname;
                if (autocvar_developer_csqcentities)
-            LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", isnew, savetime, this, this.entnum, this.enttype, this.classname, t);
+            LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)", isnew, savetime, this, this.entnum, this.enttype, this.classname, t);
                done = it.m_read(this, NULL, isnew);
                MUTATOR_CALLHOOK(Ent_Update, this, isnew);
                break;
@@ -856,7 +873,7 @@ void Ent_Remove(entity this)
 
        if(this.snd_looping > 0)
        {
-               sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
+               sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
                this.snd_looping = 0;
        }
 
@@ -869,7 +886,7 @@ void Ent_Remove(entity this)
 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(this) as well.
 void CSQC_Ent_Remove(entity this)
 {
-       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}\n", this, this.entnum, this.enttype);
+       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}", this, this.entnum, this.enttype);
        if (wasfreed(this))
        {
                LOG_WARN("CSQC_Ent_Remove called for already removed entity. Packet loss?");
@@ -891,20 +908,20 @@ void Gamemode_Init()
 // CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided.  To execute standard behavior, simply execute localcmd with the string.
 void CSQC_Parse_StuffCmd(string strMessage)
 {
-       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage);
+       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_StuffCmd(\"%s\")", strMessage);
        localcmd(strMessage);
 }
 // CSQC_Parse_Print : Provides the print string in the first parameter that the server provided.  To execute standard behavior, simply execute print with the string.
 void CSQC_Parse_Print(string strMessage)
 {
-       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_Print(\"%s\")\n", strMessage);
+       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_Print(\"%s\")", strMessage);
        print(ColorTranslateRGB(strMessage));
 }
 
 // CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
 void CSQC_Parse_CenterPrint(string strMessage)
 {
-       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_CenterPrint(\"%s\")\n", strMessage);
+       if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_CenterPrint(\"%s\")", strMessage);
        centerprint_hud(strMessage);
 }
 
@@ -918,12 +935,12 @@ bool CSQC_Parse_TempEntity()
 
        FOREACH(TempEntities, it.m_id == nTEID, {
                if (autocvar_developer_csqcentities)
-                       LOG_INFOF("CSQC_Parse_TempEntity() nTEID=%s (%d)\n", it.netname, nTEID);
+                       LOG_INFOF("CSQC_Parse_TempEntity() nTEID=%s (%d)", it.netname, nTEID);
                return it.m_read(NULL, NULL, true);
        });
 
        if (autocvar_developer_csqcentities)
-               LOG_INFOF("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID);
+               LOG_INFOF("CSQC_Parse_TempEntity() with nTEID=%d", nTEID);
 
        // No special logic for this temporary entity; return 0 so the engine can handle it
        return false;
@@ -978,6 +995,7 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
        forcefog = strzone(ReadString());
 
        armorblockpercent = ReadByte() / 255.0;
+       damagepush_speedfactor = ReadByte() / 255.0;
 
        serverflags = ReadByte();
 
@@ -1036,25 +1054,18 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_checkpoint = ReadByte();
                        race_time = ReadInt24_t();
                        race_previousbesttime = ReadInt24_t();
+                       race_mypreviousbesttime = ReadInt24_t();
                        if(race_previousbestname)
                                strunzone(race_previousbestname);
-                       race_previousbestname = strzone(ReadString());
-
-                       race_checkpointtime = time;
-
-                       if(race_checkpoint == 0 || race_checkpoint == 254)
+                       string pbestname = ReadString();
+                       if(autocvar_cl_race_cptimes_onlyself)
                        {
-                               race_penaltyaccumulator = 0;
-                               race_laptime = time; // valid
+                               race_previousbesttime = race_mypreviousbesttime;
+                               race_mypreviousbesttime = 0;
+                               race_previousbestname = strzone("");
                        }
-                       break;
-               case RACE_NET_CHECKPOINT_HIT_SELF_QUALIFYING:
-                       race_checkpoint = ReadByte();
-                       race_time = ReadInt24_t();
-                       race_previousbesttime = ReadInt24_t();
-                       if(race_previousbestname)
-                               strunzone(race_previousbestname);
-                       race_previousbestname = strzone(""); // handled by MakeRaceString
+                       else
+                               race_previousbestname = strzone(pbestname);
 
                        race_checkpointtime = time;
 
@@ -1078,18 +1089,19 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_nextcheckpoint = ReadByte();
 
                        race_nextbesttime = 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);
-                       race_nextbestname = strzone(ReadString());
-                       break;
-
-               case RACE_NET_CHECKPOINT_NEXT_SELF_QUALIFYING:
-                       race_nextcheckpoint = ReadByte();
-
-                       race_nextbesttime = ReadInt24_t();
-                       if(race_nextbestname)
-                               strunzone(race_nextbestname);
-                       race_nextbestname = strzone(""); // handled by MakeRaceString
+                       string newname = ReadString();
+                       if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING)
+                       {
+                               race_nextbesttime = race_mybesttime;
+                               race_mybesttime = 0;
+                               race_nextbestname = strzone("");
+                       }
+                       else
+                               race_nextbestname = strzone(newname);
                        break;
 
                case RACE_NET_CHECKPOINT_HIT_RACE:
index bbf69d28d1bcd39586a78041babc247bc2166cea..a2f4d18bba97e2ef4070fe83ac362d83dd462404 100644 (file)
@@ -86,6 +86,7 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
 const float ALPHA_MIN_VISIBLE = 0.003;
 
 float armorblockpercent;
+float damagepush_speedfactor;
 
 //hooks
 int calledhooks;
index 29728dfde6d07cd781c19ae75d199b038c1c1a85..b34bd0f3a1476b9fda20e2da89b0c7249c648a03 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"
 
@@ -494,7 +497,7 @@ void Cmd_MapVote_MapDownload(int argc)
 
        if(argc != 2 || !mv_pk3list)
        {
-               LOG_INFO(_("mv_mapdownload: ^3You're not supposed to use this command on your own!\n"));
+               LOG_INFO(_("mv_mapdownload: ^3You're not supposed to use this command on your own!"));
                return;
        }
 
@@ -504,7 +507,7 @@ void Cmd_MapVote_MapDownload(int argc)
                        break;
 
        if(!pak || pak.sv_entnum != id) {
-               LOG_INFO(_("^1Error:^7 Couldn't find pak index.\n"));
+               LOG_INFO(_("^1Error:^7 Couldn't find pak index."));
                return;
        }
 
@@ -513,7 +516,7 @@ void Cmd_MapVote_MapDownload(int argc)
                mv_preview[id] = true;
                return;
        } else {
-               LOG_INFO(_("Requesting preview...\n"));
+               LOG_INFO(_("Requesting preview..."));
                localcmd(strcat("\ncmd mv_getpicture ", ftos(id), "\n"));
        }
 }
index f23577d8110c44644467209f835d1b0246da0e38..fd1647ddcce350abe5a7af8ea85b2e2fe70f1630 100644 (file)
@@ -1,5 +1,7 @@
 #include "miscfunctions.qh"
 
+#include "autocvars.qh"
+#include "defs.qh"
 #include "hud/_mod.qh"
 
 #include <common/command/_mod.qh>
@@ -567,7 +569,7 @@ void URI_Get_Callback(int id, int status, string data)
        }
        else
        {
-               LOG_INFOF("Received HTTP request data for an invalid id %d.\n", id);
+               LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
        }
 }
 
@@ -582,7 +584,7 @@ void Accuracy_LoadLevels()
                if(acc_levels > MAX_ACCURACY_LEVELS)
                        acc_levels = MAX_ACCURACY_LEVELS;
                if(acc_levels < 2)
-                       LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values\n");
+                       LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values");
 
                int i;
                for(i = 0; i < acc_levels; ++i)
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 66827c8f30e3bdc2bfeb9508ce64a5a69bf86bea..55e54d8ac2c641ad49b10bf03a979f0603eff9d3 100644 (file)
@@ -1,11 +1,11 @@
 #include "player_skeleton.qh"
 
 #include <common/physics/movetypes/movetypes.qh>
+#include <common/physics/player.qh>
 #include "mutators/events.qh"
 #include "../lib/csqcmodel/cl_player.qh"
 #include "../lib/warpzone/anglestransform.qh"
 
-.vector v_angle;
 .float v_angle_save_x;
 
 class(Skeleton) .float skeleton_info_modelindex;
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..3b607a7e14add199cd354940018de71d588f2566 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/_mod.inc>
+
+#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 75afcfccb1691869a863bab13166837ee142f32c..7a054606313f1e64d90b61105c2ae98683a909b9 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);
@@ -1347,6 +1351,71 @@ void HUD_Crosshair(entity this)
        }
 }
 
+const int MAX_SPECIALCOMMAND = 15;
+vector specialcommand_slots[MAX_SPECIALCOMMAND];
+vector specialcommand_colors[MAX_SPECIALCOMMAND];
+const float SPECIALCOMMAND_SPEED = 150;
+const float SPECIALCOMMAND_TURNSPEED = 2;
+const float SPECIALCOMMAND_SIZE = 0.025;
+const float SPECIALCOMMAND_CHANCE = 0.35;
+float sc_spawntime, sc_changetime;
+vector sc_color = '1 1 1';
+void SpecialCommand()
+{
+       if(!STAT(MOVEVARS_SPECIALCOMMAND))
+               return;
+
+       if(time >= sc_changetime)
+       {
+               sc_changetime = time + 1;
+               sc_color = randomvec() * 1.5;
+               sc_color.x = bound(0.2, sc_color.x, 0.75);
+               sc_color.y = bound(0.2, sc_color.y, 0.75);
+               sc_color.z = bound(0.2, sc_color.z, 0.75);
+       }
+       drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), sc_color, autocvar_hud_colorflash_alpha * bound(0.1, sc_changetime - time, 0.3), DRAWFLAG_ADDITIVE);
+
+       if(!precache_pic("gfx/smile"))
+               return; // damn party poopers
+
+       for(int j = MAX_SPECIALCOMMAND - 1; j >= 0; --j)
+       {
+               vector slot = specialcommand_slots[j];
+               if(slot.y)
+                       slot.y += SPECIALCOMMAND_SPEED * frametime;
+               if(slot.z)
+                       slot.z = sin(SPECIALCOMMAND_TURNSPEED * M_PI * time);
+               if(slot.y >= vid_conheight)
+                       slot = '0 0 0';
+
+               if(slot == '0 0 0')
+               {
+                       if(random() <= SPECIALCOMMAND_CHANCE && time > sc_spawntime) // low chance to spawn!
+                       {
+                               slot.x = bound(0, (random() * vid_conwidth + 1), vid_conwidth);
+                               slot.y = 1; // start it off 0 so we can use it
+                               slot.z = random();
+                               sc_spawntime = time + bound(0.4, random(), 0.75); // prevent spawning another one for this amount of time!
+                               vector newcolor = randomvec() * 2;
+                               newcolor.x = bound(0.4, newcolor.x, 1);
+                               newcolor.y = bound(0.4, newcolor.y, 1);
+                               newcolor.z = bound(0.4, newcolor.z, 1);
+                               specialcommand_colors[j] = newcolor;
+                       }
+               }
+               else
+               {
+                       vector splash_size = '0 0 0';
+                       splash_size.x = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE;
+                       splash_size.y = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE;
+                       drawpic(vec2(slot), "gfx/smile", vec2(splash_size), specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL);
+                       //drawrotpic(vec2(slot), slot.z, "gfx/smile", vec2(splash_size), vec2(splash_size) / 2, specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL);
+               }
+
+               specialcommand_slots[j] = slot;
+       }
+}
+
 void HUD_Draw(entity this)
 {
        // if we don't know gametype and scores yet avoid drawing the scoreboard
@@ -1402,6 +1471,7 @@ void HUD_Draw(entity this)
                }
 
        // crosshair goes VERY LAST
+       SpecialCommand();
        UpdateDamage();
        HUD_Crosshair(this);
        HitSound();
@@ -1712,7 +1782,7 @@ void CSQC_UpdateView(entity this, float w, float h)
                ov_enabled = true;
 
                #if 0
-               LOG_INFOF("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
+               LOG_INFOF("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f",
                        vtos(ov_org),
                        vtos(getpropertyvec(VF_ANGLES)),
                        ov_distance,
@@ -2045,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;
@@ -2256,7 +2326,7 @@ void CSQC_UpdateView(entity this, float w, float h)
        // draw 2D entities
        IL_EACH(g_drawables_2d, it.draw2d, it.draw2d(it));
        Draw_ShowNames_All();
-#ifdef DEBUGDRAW
+#if ENABLE_DEBUGDRAW
        Debug_Draw();
 #endif
 
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 56681b099e756f6075da949446ca5dd605c7f102..32dbf5208ff23a278196f70ad4d9156a1e0f9d55 100644 (file)
@@ -45,8 +45,8 @@ noref float autocvar_net_connecttimeout = 30;
 #include "items/_mod.inc"
     #include "weapons/_all.inc"
         #include "monsters/_mod.inc"
-        #include "turrets/all.qc"
-        #include "vehicles/all.qc"
+        #include "turrets/_mod.inc"
+        #include "vehicles/_mod.inc"
 
 #include "mutators/_mod.inc"
     #include "gamemodes/_mod.inc"
index 49a9d130989015125f171c6dedfa59561fd7ace2..c58a3df75a50d83e55731bc5955020f999781007 100644 (file)
@@ -74,25 +74,24 @@ 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;
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2addtolist^7\n");
+                       LOG_INFO("Incorrect parameters for ^2addtolist^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value\n"));
-                       LOG_INFO("  Where 'variable' is what to add 'value' to.\n");
-                       LOG_INFO("See also: ^2removefromlist^7\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " addtolist variable value");
+                       LOG_INFO("  Where 'variable' is what to add 'value' to.");
+                       LOG_INFO("See also: ^2removefromlist^7");
                        return;
                }
        }
@@ -154,7 +153,7 @@ void GenericCommand_qc_curl(float request, float argc)
                                curl_uri_get_pos = (curl_uri_get_pos + 1) % (URI_GET_CURL_END - URI_GET_CURL + 1);
                        }
                        else
-                               LOG_INFO(_("error creating curl handle\n"));
+                               LOG_INFO(_("error creating curl handle"));
 
                        buf_del(buf);
 
@@ -164,7 +163,7 @@ void GenericCommand_qc_curl(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " qc_curl [--key N] [--cvar] [--exec] URL [postargs...]"));
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " qc_curl [--key N] [--cvar] [--exec] URL [postargs...]");
                        return;
                }
        }
@@ -204,13 +203,13 @@ GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to *_cmd_dump.tx
                                CMD_Write("\ndump of generic commands:\n");
                                GenericCommand_macro_write_aliases(fh);
 
-                               LOG_INFO("Completed dump of aliases in ^2data/data/", GetProgramCommandPrefix(), "_dump.txt^7.\n");
+                               LOG_INFO("Completed dump of aliases in ^2data/data/", GetProgramCommandPrefix(), "_dump.txt^7.");
 
                                fclose(fh);
                        }
                        else
                        {
-                               LOG_INFO("^1Error: ^7Could not dump to file!\n");
+                               LOG_INFO("^1Error: ^7Could not dump to file!");
                        }
                        return;
                }
@@ -218,8 +217,8 @@ GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to *_cmd_dump.tx
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpcommands"));
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpcommands");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
@@ -242,7 +241,7 @@ void GenericCommand_maplist(float request, float argc)
                                        {
                                                if (!fexists(strcat("maps/", argv(2), ".bsp")))
                                                {
-                                                       LOG_INFO("maplist: ERROR: ", argv(2), " does not exist!\n");
+                                                       LOG_INFO("maplist: ERROR: ", argv(2), " does not exist!");
                                                        break;
                                                }
 
@@ -296,13 +295,13 @@ void GenericCommand_maplist(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2maplist^7\n");
+                       LOG_INFO("Incorrect parameters for ^2maplist^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]\n"));
-                       LOG_INFO("  Where 'action' is the command to complete,\n");
-                       LOG_INFO("  and 'map' is what it acts upon (if required).\n");
-                       LOG_INFO("  Full list of commands here: \"add, cleanup, remove, shuffle.\"\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " maplist action [map]");
+                       LOG_INFO("  Where 'action' is the command to complete,");
+                       LOG_INFO("  and 'map' is what it acts upon (if required).");
+                       LOG_INFO("  Full list of commands here: \"add, cleanup, remove, shuffle.\"");
                        return;
                }
        }
@@ -321,8 +320,8 @@ void GenericCommand_nextframe(float request, float arguments, string command)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command...\n"));
-                       LOG_INFO("  Where command will be executed next frame of this VM\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " nextframe command...");
+                       LOG_INFO("  Where command will be executed next frame of this VM");
                        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;
@@ -356,12 +351,12 @@ void GenericCommand_removefromlist(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2removefromlist^7\n");
+                       LOG_INFO("Incorrect parameters for ^2removefromlist^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value\n"));
-                       LOG_INFO("  Where 'variable' is what cvar to remove 'value' from.\n");
-                       LOG_INFO("See also: ^2addtolist^7\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value");
+                       LOG_INFO("  Where 'variable' is what cvar to remove 'value' from.");
+                       LOG_INFO("See also: ^2addtolist^7");
                        return;
                }
        }
@@ -380,10 +375,10 @@ void GenericCommand_restartnotifs(float request)
                        int NOTIF_MULTI_COUNT   = 0; FOREACH(Notifications, it.nent_type == MSG_MULTI,   { ++NOTIF_MULTI_COUNT;  });
                        int NOTIF_CHOICE_COUNT  = 0; FOREACH(Notifications, it.nent_type == MSG_CHOICE,  { ++NOTIF_CHOICE_COUNT; });
                        LOG_INFOF(
-                               strcat(
-                                       "Restart_Notifications(): Restarting %d notifications... ",
-                                       "Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n"
-                               ),
+                           (
+                    "Restart_Notifications(): Restarting %d notifications... "
+                    "Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d"
+                ),
                                (
                                        NOTIF_ANNCE_COUNT +
                                        NOTIF_INFO_COUNT +
@@ -400,7 +395,7 @@ void GenericCommand_restartnotifs(float request)
                        Destroy_All_Notifications();
                        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
                        #else
-                       LOG_INFO(_("Notification restart command only works with cl_cmd and sv_cmd.\n"));
+                       LOG_INFO(_("Notification restart command only works with cl_cmd and sv_cmd."));
                        #endif
                        return;
                }
@@ -408,8 +403,8 @@ void GenericCommand_restartnotifs(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " restartnotifs"));
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " restartnotifs");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
@@ -435,12 +430,12 @@ void GenericCommand_settemp(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2settemp^7\n");
+                       LOG_INFO("Incorrect parameters for ^2settemp^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"\n"));
-                       LOG_INFO("  Where 'cvar' is the cvar you want to temporarily set with 'arguments'.\n");
-                       LOG_INFO("See also: ^2settemp_restore^7\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"");
+                       LOG_INFO("  Where 'cvar' is the cvar you want to temporarily set with 'arguments'.");
+                       LOG_INFO("See also: ^2settemp_restore^7");
                        return;
                }
        }
@@ -465,9 +460,9 @@ void GenericCommand_settemp_restore(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp_restore\n"));
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2settemp^7\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " settemp_restore");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2settemp^7");
                        return;
                }
        }
@@ -493,7 +488,7 @@ void GenericCommand_runtest(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " [function to run]"));
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " [function to run]");
                        return;
                }
        }
@@ -536,7 +531,7 @@ GENERIC_COMMAND(runtest, "Run unit tests") { GenericCommand_runtest(request, arg
 
 void GenericCommand_macro_help()
 {
-       FOREACH(GENERIC_COMMANDS, true, LOG_INFOF("  ^2%s^7: %s\n", it.m_name, it.m_description));
+       FOREACH(GENERIC_COMMANDS, true, LOG_INFOF("  ^2%s^7: %s", it.m_name, it.m_description));
 }
 
 float GenericCommand_macro_command(float argc, string command)
index 828fbdf7dd7850004caa793a342896077a5530e4..7e1c4f52eb2879e58f47328c9402f33879398cd5 100644 (file)
@@ -13,7 +13,7 @@ string rpn_pop()
                --rpn_sp;
                return rpn_stack[rpn_sp];
        } else {
-               LOG_INFO("rpn: stack underflow\n");
+               LOG_INFO("rpn: stack underflow");
                rpn_error = true;
                return "";
        }
@@ -24,7 +24,7 @@ void rpn_push(string s)
                rpn_stack[rpn_sp] = s;
                ++rpn_sp;
        } else {
-               LOG_INFO("rpn: stack overflow\n");
+               LOG_INFO("rpn: stack overflow");
                rpn_error = true;
        }
 }
@@ -33,7 +33,7 @@ string rpn_get()
        if(rpn_sp > 0) {
                return rpn_stack[rpn_sp - 1];
        } else {
-               LOG_INFO("rpn: empty stack\n");
+               LOG_INFO("rpn: empty stack");
                rpn_error = true;
                return "";
        }
@@ -43,7 +43,7 @@ void rpn_set(string s)
        if(rpn_sp > 0) {
                rpn_stack[rpn_sp - 1] = s;
        } else {
-               LOG_INFO("rpn: empty stack\n");
+               LOG_INFO("rpn: empty stack");
                rpn_error = true;
        }
 }
@@ -107,7 +107,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                }
                                                else
                                                {
-                                                       LOG_INFO("rpn: empty cvar name for 'def'\n");
+                                                       LOG_INFO("rpn: empty cvar name for 'def'");
                                                        rpn_error = true;
                                                }
                                        } else if(rpncmd == "defs" || rpncmd == "@") {
@@ -132,7 +132,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                }
                                                else
                                                {
-                                                       LOG_INFO("rpn: empty cvar name for 'defs'\n");
+                                                       LOG_INFO("rpn: empty cvar name for 'defs'");
                                                        rpn_error = true;
                                                }
                                        } else if(rpncmd == "load") {
@@ -288,7 +288,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                                db_put(rpn_db, "stack.pos", ftos(i-2));
                                                } else {
                                                        rpn_error = 1;
-                                                       LOG_INFO("rpn: database underflow\n");
+                                                       LOG_INFO("rpn: database underflow");
                                                }
                                        } else if(rpncmd == "dbget") {
 
@@ -298,7 +298,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        rpn_push(db_get(rpn_db, strcat("stack.", ftos(i-1))));
                                                } else {
                                                        rpn_error = 1;
-                                                       LOG_INFO("rpn: database empty\n");
+                                                       LOG_INFO("rpn: database empty");
                                                }
                                        } else if(rpncmd == "dblen") {
                                                rpn_push(db_get(rpn_db, "stack.pointer"));
@@ -347,7 +347,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                if(!j)
                                                {
                                                        rpn_error = true;
-                                                       LOG_INFO("rpn: empty database\n");
+                                                       LOG_INFO("rpn: empty database");
                                                } else {
                                                        --j;
                                                        rpn_push(db_get(rpn_db, strcat("stack.", ftos(i))));
@@ -372,7 +372,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        rpn_push(db_get(rpn_db, strcat("stack.", s)));
                                                } else {
                                                        rpn_error = 1;
-                                                       LOG_INFO("rpn: empty database\n");
+                                                       LOG_INFO("rpn: empty database");
                                                }
                                        } else if(rpncmd == "dbat") {
                                                rpn_push(db_get(rpn_db, "stack.pos"));
@@ -384,7 +384,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                {
                                                        if(i < 0 || i >= j)
                                                        {
-                                                               LOG_INFO("rpn: database cursor out of bounds\n");
+                                                               LOG_INFO("rpn: database cursor out of bounds");
                                                                rpn_error = true;
                                                        }
                                                        if(!rpn_error)
@@ -398,7 +398,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                if(!j)
                                                {
                                                        rpn_error = true;
-                                                       LOG_INFO("rpn: empty database, cannot move cursor\n");
+                                                       LOG_INFO("rpn: empty database, cannot move cursor");
                                                }
                                                if(!rpn_error)
                                                {
@@ -412,7 +412,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        j = stof(db_get(rpn_db, "stack.pointer"));
                                                        if(i < 0 || i >= j)
                                                        {
-                                                               LOG_INFO("rpn: database cursor destination out of bounds\n");
+                                                               LOG_INFO("rpn: database cursor destination out of bounds");
                                                                rpn_error = true;
                                                        }
                                                        if(!rpn_error)
@@ -514,7 +514,7 @@ LABEL(skip_difference)
                                                {
                                                        if (!fexists(s))
                                                        {
-                                                               LOG_INFO("rpn: ERROR: ", s, " does not exist!\n");
+                                                               LOG_INFO("rpn: ERROR: ", s, " does not exist!");
                                                                rpn_error = true;
                                                        }
                                                }
@@ -553,7 +553,7 @@ LABEL(skip_difference)
                                while(rpn_sp > 0)
                                {
                                        s = rpn_pop();
-                                       LOG_INFO("rpn: still on stack: ", s, "\n");
+                                       LOG_INFO("rpn: still on stack: ", s);
                                }
                        }
 
@@ -563,42 +563,42 @@ LABEL(skip_difference)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...\n"));
-                       LOG_INFO("    Operator description (x: string, s: set, f: float):\n");
-                       LOG_INFO("    x pop ----------------------------->     : removes the top\n");
-                       LOG_INFO("    x dup -----------------------------> x x : duplicates the top\n");
-                       LOG_INFO("    x x exch --------------------------> x x : swap the top two\n");
-                       LOG_INFO("    /cvarname load --------------------> x   : loads a cvar\n");
-                       LOG_INFO("    /cvarname x def ------------------->     : writes to a cvar\n");
-                       LOG_INFO("    f f add|sub|mul|div|mod|pow -------> f   : adds/... two numbers\n");
-                       LOG_INFO("    f f and|or|xor|bitand|bitor|bitxor > f   : logical and bitwise operations\n");
-                       LOG_INFO("    f f eq|ne|gt|ge|lt|le|max|min -----> f   : compares two numbers\n");
-                       LOG_INFO("    f neg|abs|sgn|rand|floor|ceil------> f   : negates/... a number\n");
-                       LOG_INFO("    f not|bitnot ----------------------> f   : logical and bitwise negation\n");
-                       LOG_INFO("    f exp|log|sin|cos -----------------> f   : exponential function & Co.\n");
-                       LOG_INFO("    f f f bound -----------------------> f   : bounds the middle number\n");
-                       LOG_INFO("    f1 f2 b when ----------------------> f   : f1 if b, f2 otherwise\n");
-                       LOG_INFO("    s s union|intersection|difference -> s   : set operations\n");
-                       LOG_INFO("    s shuffle -------------------------> s   : randomly arrange elements\n");
-                       LOG_INFO("    /key /value put ------------------->     : set a database key\n");
-                       LOG_INFO("    /key get --------------------------> s   : get a database value\n");
-                       LOG_INFO("    x dbpush -------------------------->     : pushes the top onto the database\n");
-                       LOG_INFO("    dbpop|dbget -----------------------> x   : removes/reads DB's top\n");
-                       LOG_INFO("    dblen|dbat ------------------------> f   : gets the DB's size/cursor pos\n");
-                       LOG_INFO("    dbclr ----------------------------->     : clear the DB\n");
-                       LOG_INFO("    s dbsave|dbload-------------------->     : save/load the DB to/from a file\n");
-                       LOG_INFO("    x dbins --------------------------->     : moves the top into the DB\n");
-                       LOG_INFO("    dbext|dbread ----------------------> x   : extract/get from the DB's cursor\n");
-                       LOG_INFO("    f dbmov|dbgoto -------------------->     : move or set the DB's cursor\n");
-                       LOG_INFO("    s localtime -----------------------> s   : formats the current local time\n");
-                       LOG_INFO("    s gmtime --------------------------> s   : formats the current UTC time\n");
-                       LOG_INFO("    time ------------------------------> f   : seconds since VM start\n");
-                       LOG_INFO("    s /MD4 digest ---------------------> s   : MD4 digest\n");
-                       LOG_INFO("    s /SHA256 digest ------------------> s   : SHA256 digest\n");
-                       LOG_INFO("    s /formatstring sprintf1s ---------> s   : sprintf with 1 string (pad, cut)\n");
-                       LOG_INFO("    s eval ---------------------------->     : does something eval\n");
-                       LOG_INFO("    Set operations operate on 'such''strings'.\n");
-                       LOG_INFO("    Unknown tokens insert their cvar value.\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...");
+                       LOG_INFO("    Operator description (x: string, s: set, f: float):");
+                       LOG_INFO("    x pop ----------------------------->     : removes the top");
+                       LOG_INFO("    x dup -----------------------------> x x : duplicates the top");
+                       LOG_INFO("    x x exch --------------------------> x x : swap the top two");
+                       LOG_INFO("    /cvarname load --------------------> x   : loads a cvar");
+                       LOG_INFO("    /cvarname x def ------------------->     : writes to a cvar");
+                       LOG_INFO("    f f add|sub|mul|div|mod|pow -------> f   : adds/... two numbers");
+                       LOG_INFO("    f f and|or|xor|bitand|bitor|bitxor > f   : logical and bitwise operations");
+                       LOG_INFO("    f f eq|ne|gt|ge|lt|le|max|min -----> f   : compares two numbers");
+                       LOG_INFO("    f neg|abs|sgn|rand|floor|ceil------> f   : negates/... a number");
+                       LOG_INFO("    f not|bitnot ----------------------> f   : logical and bitwise negation");
+                       LOG_INFO("    f exp|log|sin|cos -----------------> f   : exponential function & Co.");
+                       LOG_INFO("    f f f bound -----------------------> f   : bounds the middle number");
+                       LOG_INFO("    f1 f2 b when ----------------------> f   : f1 if b, f2 otherwise");
+                       LOG_INFO("    s s union|intersection|difference -> s   : set operations");
+                       LOG_INFO("    s shuffle -------------------------> s   : randomly arrange elements");
+                       LOG_INFO("    /key /value put ------------------->     : set a database key");
+                       LOG_INFO("    /key get --------------------------> s   : get a database value");
+                       LOG_INFO("    x dbpush -------------------------->     : pushes the top onto the database");
+                       LOG_INFO("    dbpop|dbget -----------------------> x   : removes/reads DB's top");
+                       LOG_INFO("    dblen|dbat ------------------------> f   : gets the DB's size/cursor pos");
+                       LOG_INFO("    dbclr ----------------------------->     : clear the DB");
+                       LOG_INFO("    s dbsave|dbload-------------------->     : save/load the DB to/from a file");
+                       LOG_INFO("    x dbins --------------------------->     : moves the top into the DB");
+                       LOG_INFO("    dbext|dbread ----------------------> x   : extract/get from the DB's cursor");
+                       LOG_INFO("    f dbmov|dbgoto -------------------->     : move or set the DB's cursor");
+                       LOG_INFO("    s localtime -----------------------> s   : formats the current local time");
+                       LOG_INFO("    s gmtime --------------------------> s   : formats the current UTC time");
+                       LOG_INFO("    time ------------------------------> f   : seconds since VM start");
+                       LOG_INFO("    s /MD4 digest ---------------------> s   : MD4 digest");
+                       LOG_INFO("    s /SHA256 digest ------------------> s   : SHA256 digest");
+                       LOG_INFO("    s /formatstring sprintf1s ---------> s   : sprintf with 1 string (pad, cut)");
+                       LOG_INFO("    s eval ---------------------------->     : does something eval");
+                       LOG_INFO("    Set operations operate on 'such''strings'.");
+                       LOG_INFO("    Unknown tokens insert their cvar value.");
                        return;
                }
        }
index 9e96756ba52de4feb7709164226599e2a8d1632f..125ef6bf36c99bf5d25a281e88c2053113109a91 100644 (file)
@@ -26,9 +26,6 @@
 # define TAG_VIEWLOC_TYPE entity
 #endif
 
-// new fields
-.vector v_angle;
-
 // add properties you want networked to CSQC here
 #define CSQCMODEL_EXTRAPROPERTIES \
        CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \
index 7aabe69a90e51f29d6cdcb6156a8730a25cb29a3..0200883b8dbbc89867e6c888b7489889bb606f54 100644 (file)
@@ -47,7 +47,7 @@ REGISTER_NET_TEMP(net_debug)
        }
 #endif
 
-#ifdef DEBUGDRAW
+#if ENABLE_DEBUGDRAW
 #ifdef GAMEQC
 /**
  * 0: off
@@ -170,14 +170,14 @@ bool autocvar_debugdraw;
                                        e.debug = true;
                                        --rem;
                                }
-                               LOG_INFOF("%d server entities sent\n", n - rem);
+                               LOG_INFOF("%d server entities sent", n - rem);
                                return;
                        }
 
                        default:
                        case CMD_REQUEST_USAGE:
                        {
-                               LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " debugdraw_sv"));
+                               LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " debugdraw_sv");
                                return;
                        }
                }
@@ -194,14 +194,14 @@ GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
                        int bufhandle = stof(argv(1));
                        int string_index = stof(argv(2));
                        string s = bufstr_get(bufhandle, string_index);
-                       LOG_INFOF("%s\n", s);
+                       LOG_INFOF("%s", s);
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " bufstr_get bufhandle string_index"));
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " bufstr_get bufhandle string_index");
                        return;
                }
        }
@@ -213,13 +213,13 @@ GENERIC_COMMAND(version, "Print the current version")
        {
                case CMD_REQUEST_COMMAND:
                {
-                       LOG_INFO(WATERMARK "\n");
+                       LOG_INFO(WATERMARK);
                        return;
                }
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " version"));
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " version");
                        return;
                }
        }
@@ -253,13 +253,13 @@ GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars")
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges"));
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges");
                        return;
                }
        }
 }
 
-#ifdef DEBUGTRACE
+#if ENABLE_DEBUGTRACE
 REGISTER_STAT(TRACE_ENT, int)
 #ifdef SVQC
 bool autocvar_debugtrace;
@@ -326,22 +326,22 @@ GENERIC_COMMAND(find, "Search through entities for matching classname")
                        int entcnt = 0;
                        FOREACH_ENTITY_CLASS_ORDERED(argv(1), true,
                        {
-                               LOG_INFOF("%i (%s)\n", it, it.classname);
+                               LOG_INFOF("%i (%s)", it, it.classname);
                                ++entcnt;
                        });
                        if(entcnt)
-                               LOG_INFOF("Found %d entities\n", entcnt);
+                               LOG_INFOF("Found %d entities", entcnt);
                        return;
                }
 
                default:
                {
-                       LOG_INFO("Incorrect parameters for ^2find^7\n");
+                       LOG_INFO("Incorrect parameters for ^2find^7");
         }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 " GetProgramCommandPrefix() " find classname\n");
-                       LOG_INFO("  Where 'classname' is the classname to search for.\n");
+                       LOG_INFO("Usage:^3 " GetProgramCommandPrefix() " find classname");
+                       LOG_INFO("  Where 'classname' is the classname to search for.");
                        return;
                }
        }
@@ -354,15 +354,15 @@ GENERIC_COMMAND(findat, "Search through entities for matching origin")
                case CMD_REQUEST_COMMAND:
                {
                    vector match = stov(argv(1));
-                   FOREACH_ENTITY_ORDERED(it.origin == match, LOG_INFOF("%i (%s)\n", it, it.classname));
+                   FOREACH_ENTITY_ORDERED(it.origin == match, LOG_INFOF("%i (%s)", it, it.classname));
                        return;
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2findat^7\n");
+                       LOG_INFO("Incorrect parameters for ^2findat^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 " GetProgramCommandPrefix() " findat \"0 0 0\"\n");
+                       LOG_INFO("Usage:^3 " GetProgramCommandPrefix() " findat \"0 0 0\"");
                        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 f43b25dcfbcac143bb7e29580befba124cc782c3..af41054e31c1c40c462ce041a2cc540fa1c570be 100644 (file)
@@ -91,6 +91,6 @@ void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
 }
 #endif
 
-#ifdef EFFECTINFO_ENABLED
+#if ENABLE_EFFECTINFO
        #include "effectinfo.qc"
 #endif
index f662aee7b2a0e4b8d097537308cf96a98f6a1e41..71260eb3d04fa49ae2ffaeaca9c5b001ec8f8070 100644 (file)
@@ -303,8 +303,8 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
             int fh = fopen(filename, FILE_WRITE);
             if (fh >= 0) {
                effectinfo_dump(fh, alsoprint);
-                LOG_INFOF("Dumping effectinfo... File located at ^2data/data/%s^7.\n", filename);
-                               LOG_INFOF("Reload with ^2cl_particles_reloadeffects data/%s^7.\n", filename);
+                LOG_INFOF("Dumping effectinfo... File located at ^2data/data/%s^7.", filename);
+                               LOG_INFOF("Reload with ^2cl_particles_reloadeffects data/%s^7.", filename);
                 fclose(fh);
             } else {
                 LOG_WARNF("Could not open file '%s'!", filename);
@@ -313,10 +313,10 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
         }
         default:
         case CMD_REQUEST_USAGE: {
-            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]"));
-            LOG_INFO("  Where 'filename' is the file to write (default is effectinfo_dump.txt),\n");
-            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-            LOG_INFO("  if left blank, it will only write to default.\n");
+            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]");
+            LOG_INFO("  Where 'filename' is the file to write (default is effectinfo_dump.txt),");
+            LOG_INFO("  if supplied with '-' output to console as well as default,");
+            LOG_INFO("  if left blank, it will only write to default.");
             return;
         }
     }
index befcce83d8d95ee23300856661ba1fab3ffe46e8..8df95b821ae2ea07cec594230396235d74fb2529 100644 (file)
@@ -1,5 +1,4 @@
 // generated file; do not modify
-#include <common/effects/qc/all.qc>
 #include <common/effects/qc/casings.qc>
 #include <common/effects/qc/damageeffects.qc>
 #include <common/effects/qc/gibs.qc>
index 91298f3124d61c972b9d6bdd970d241c5f882acc..3f6387f0eb21a179d6a259466c914dfbb6cc4d19 100644 (file)
@@ -1,5 +1,4 @@
 // generated file; do not modify
-#include <common/effects/qc/all.qh>
 #include <common/effects/qc/casings.qh>
 #include <common/effects/qc/damageeffects.qh>
 #include <common/effects/qc/gibs.qh>
diff --git a/qcsrc/common/effects/qc/all.inc b/qcsrc/common/effects/qc/all.inc
deleted file mode 100644 (file)
index 6b5c2ff..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "casings.qc"
-#include "damageeffects.qc"
-#include "gibs.qc"
-#include "globalsound.qc"
-#include "lightningarc.qc"
-#include "modeleffects.qc"
diff --git a/qcsrc/common/effects/qc/all.qc b/qcsrc/common/effects/qc/all.qc
deleted file mode 100644 (file)
index f0fc719..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "all.qh"
-
-#define IMPLEMENTATION
-#include "all.inc"
-#undef IMPLEMENTATION
diff --git a/qcsrc/common/effects/qc/all.qh b/qcsrc/common/effects/qc/all.qh
deleted file mode 100644 (file)
index 54cf6b6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-#include "all.inc"
index d0befbb7ed04705feb92bb01e63d291011003bed..60f9633027eb2125d0278bd6abaaa2cb9ed1505a 100644 (file)
@@ -1,9 +1,4 @@
 #include "casings.qh"
-#ifdef SVQC
-void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity);
-#endif
-
-#ifdef IMPLEMENTATION
 
 #include <common/util.qh>
 
@@ -178,4 +173,3 @@ NET_HANDLE(casings, bool isNew)
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..137aa365ca1412b16c83b6eda2b0ca681d13709d 100644 (file)
@@ -1 +1,5 @@
 #pragma once
+
+#ifdef SVQC
+void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity);
+#endif
index 71e1e2a7bcdd96dcf3f72629d7e147d4db03aab3..c85d66eeb6686cee70d27d77482757baf0336550 100644 (file)
@@ -1,7 +1,5 @@
 #include "damageeffects.qh"
 
-#ifdef IMPLEMENTATION
-
 REGISTER_NET_LINKED(ENT_CLIENT_DAMAGEINFO)
 
 #ifdef SVQC
@@ -244,7 +242,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                if(it.damageforcescale)
                        if(vdist(thisforce, !=, 0))
                        {
-                               it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, autocvar_g_balance_damagepush_speedfactor);
+                               it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, damagepush_speedfactor);
                                UNSET_ONGROUND(it);
                        }
 
@@ -390,6 +388,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
@@ -413,5 +413,3 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
 }
 
 #endif
-
-#endif
index d1e3d9880da4244206e9ea38ef037c38a828653b..7be63e2e55c5e1056a544f23ae9bc0331ec8138a 100644 (file)
@@ -1,6 +1,5 @@
 #include "gibs.qh"
 
-#ifdef IMPLEMENTATION
 REGISTER_NET_TEMP(net_gibsplash)
 
 #ifdef SVQC
@@ -314,5 +313,3 @@ NET_HANDLE(net_gibsplash, bool isNew)
        delete(this);
 }
 #endif
-
-#endif
index d60b2e8a65892bd33f4d0b285ce00328b2b095a0..edf995a0f6ccf453f64aa49ff175608aa3c6205f 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/ent_cs.qh>
 
-#ifdef IMPLEMENTATION
        #include <common/animdecide.qh>
 
        #ifdef SVQC
                                                msg_entity = this.pusher;
                                                if (IS_REAL_CLIENT(msg_entity))
                                                {
-                                                       float atten = (msg_entity.cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
+                                                       float atten = (CS(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
                                                        if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten);
                                                        else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten);
                                                        else soundto(MSG_ONE, this, chan, sample, vol, atten);
                                        #define X() \
                                                MACRO_BEGIN \
                                                { \
-                                                       float atten = (msg_entity.cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
+                                                       float atten = (CS(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
                                                        if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten); \
                                                        else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten); \
                                                        else soundto(MSG_ONE, this, chan, sample, vol, atten); \
                                        #define X() \
                                                MACRO_BEGIN \
                                                { \
-                                                       if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < msg_entity.cvar_cl_autotaunt) \
+                                                       if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < CS(msg_entity).cvar_cl_autotaunt) \
                                                        { \
-                                                               float atten = (msg_entity.cvar_cl_voice_directional >= 1) \
-                                                                   ? bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, \
+                                                               float atten = (CS(msg_entity).cvar_cl_voice_directional >= 1) \
+                                                                   ? bound(ATTEN_MIN, CS(msg_entity).cvar_cl_voice_directional_taunt_attenuation, \
                                                                        ATTEN_MAX) \
                                                                        : ATTEN_NONE; \
                                                                if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten); \
                }
 
        #endif
-#endif
index c1c3bb8872c3ea917e51168b90be0a8566d43a75..6388575b72cb09a5baa576a0e8c3882fdeff8ffb 100644 (file)
@@ -1,6 +1,5 @@
 #include "lightningarc.qh"
 
-#ifdef IMPLEMENTATION
 REGISTER_NET_TEMP(TE_CSQC_ARC)
 
 #if defined(SVQC)
@@ -117,5 +116,3 @@ void b_make(vector s,vector e, string t,float l,float z)
        }
 
 #endif
-
-#endif
index 8fbef5b587e9c56a7ed1f7cbc20d445cd32dab4f..1b70daee2fbbd5621e8e33198ffcec7c7380b2fd 100644 (file)
@@ -1,7 +1,5 @@
 #include "modeleffects.qh"
 
-#ifdef IMPLEMENTATION
-
 REGISTER_NET_LINKED(ENT_CLIENT_MODELEFFECT)
 
 #ifdef SVQC
@@ -162,5 +160,3 @@ NET_HANDLE(ENT_CLIENT_MODELEFFECT, bool isnew)
        return true;
 }
 #endif
-
-#endif
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 c3cec69dc5268cddd04a9afb11e422e4bf3b3a71..90cfa6aa4ce1b4a089bbada081774d692e92b8df 100644 (file)
@@ -1,3 +1,7 @@
 // generated file; do not modify
+#include <common/gamemodes/rules.qc>
+#ifdef SVQC
+    #include <common/gamemodes/sv_rules.qc>
+#endif
 
 #include <common/gamemodes/gamemode/_mod.inc>
index 685c277b4e18bf7771f2852d40138ad39dc14063..b3ed42da611d3a6aeedb4dd2e334cb52cba769a2 100644 (file)
@@ -1,3 +1,7 @@
 // generated file; do not modify
+#include <common/gamemodes/rules.qh>
+#ifdef SVQC
+    #include <common/gamemodes/sv_rules.qh>
+#endif
 
 #include <common/gamemodes/gamemode/_mod.qh>
index f48ef74501f430260f2292642dc6a8e44f6483ad..78727675637493289d22309c4d98da3a1a7649cb 100644 (file)
@@ -1,3 +1,6 @@
 // generated file; do not modify
 #include <common/gamemodes/gamemode/nexball/nexball.qc>
 #include <common/gamemodes/gamemode/nexball/weapon.qc>
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/nexball/sv_weapon.qc>
+#endif
index 4ac2347c5d1893bb031150ae480a6a75af4ddc72..a1cf54437108efae947d84ea02e8e9a9488f3926 100644 (file)
@@ -1,3 +1,6 @@
 // generated file; do not modify
 #include <common/gamemodes/gamemode/nexball/nexball.qh>
 #include <common/gamemodes/gamemode/nexball/weapon.qh>
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/nexball/sv_weapon.qh>
+#endif
index b917deba6a05f5d6be554cf68f04dc55d5d85ed2..5a0ff2a2c22ade90150d22cad3fbcfdb8be07f3b 100644 (file)
@@ -15,6 +15,8 @@ MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase)
 #ifdef SVQC
 .float metertime = _STAT(NB_METERSTART);
 
+.entity ballcarried;
+
 int autocvar_g_nexball_goalleadlimit;
 #define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit")
 
@@ -69,14 +71,14 @@ float OtherTeam(float t)  //works only if there are two teams on the map!
        return e.team;
 }
 
-const float ST_NEXBALL_GOALS = 1;
+const int ST_NEXBALL_GOALS = 1;
 void nb_ScoreRules(int teams)
 {
-       ScoreRules_basics(teams, 0, 0, true);
-       ScoreInfo_SetLabel_TeamScore(   ST_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
-       ScoreRules_basics_end();
+    GameRules_scoring(teams, 0, 0, {
+        field_team(ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
+        field(SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
+        field(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
+    });
 }
 
 void LogNB(string mode, entity actor)
@@ -119,14 +121,16 @@ void relocate_nexball(entity this)
        tracebox(this.origin, BALL_MINS, BALL_MAXS, this.origin, true, this);
        if(trace_startsolid)
        {
-               vector o;
-               o = this.origin;
-               if(!move_out_of_solid(this))
+               vector o = this.origin;
+               if (!move_out_of_solid(this)) {
                        objerror(this, "could not get out of solid at all!");
-               LOG_INFO("^1NOTE: this map needs FIXING. ", this.classname, " at ", vtos(o - '0 0 1'));
-               LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
-               LOG_INFO(" ", ftos(this.origin.y - o.y));
-               LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n");
+        }
+        LOG_INFOF(
+            "^1NOTE: this map needs FIXING. %s at %s needs to be moved out of solid, e.g. by %s",
+            this.classname,
+            vtos(o - '0 0 1'),
+            vtos(this.origin - o)
+        );
                this.origin = o;
        }
 }
@@ -149,6 +153,7 @@ void GiveBall(entity plyr, entity ball)
        {
                ownr.effects &= ~autocvar_g_nexball_basketball_effects_default;
                ownr.ballcarried = NULL;
+               GameRules_scoring_vip(ownr, false);
                if(ownr.metertime)
                {
                        ownr.metertime = 0;
@@ -171,6 +176,7 @@ void GiveBall(entity plyr, entity ball)
        ball.weaponentity_fld = weaponentity;
        ball.team = plyr.team;
        plyr.ballcarried = ball;
+       GameRules_scoring_vip(plyr, true);
        ball.nb_dropper = plyr;
 
        plyr.effects |= autocvar_g_nexball_basketball_effects_default;
@@ -228,8 +234,9 @@ void DropBall(entity ball, vector org, vector vel)
        WaypointSprite_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please
        WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
 
-       ball.owner.ballcarried = NULL;
-       ball.owner = NULL;
+       entity e = ball.owner; ball.owner = NULL;
+       e.ballcarried = NULL;
+       GameRules_scoring_vip(e, false);
 }
 
 void InitBall(entity this)
@@ -428,9 +435,9 @@ void GoalTouch(entity this, entity toucher)
        if(isclient)
        {
                if(pscore > 0)
-                       PlayerScore_Add(ball.pusher, SP_NEXBALL_GOALS, pscore);
+                       GameRules_scoring_add(ball.pusher, NEXBALL_GOALS, pscore);
                else if(pscore < 0)
-                       PlayerScore_Add(ball.pusher, SP_NEXBALL_FAULTS, -pscore);
+                       GameRules_scoring_add(ball.pusher, NEXBALL_FAULTS, -pscore);
        }
 
        if(ball.owner)  // Happens on spawnflag GOAL_TOUCHPLAYER
@@ -715,136 +722,6 @@ spawnfunc(ball_bound)
        spawnfunc_nexball_out(this);
 }
 
-//=======================//
-//       Weapon code     //
-//=======================//
-
-
-void W_Nexball_Think(entity this)
-{
-       //dprint("W_Nexball_Think\n");
-       //vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
-       vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
-       vector old_dir = normalize(this.velocity);
-       float _speed = vlen(this.velocity);
-       vector new_vel = normalize(old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
-       //vector new_vel = (new_dir * autocvar_g_nexball_safepass_turnrate
-
-       this.velocity = new_vel;
-
-       this.nextthink = time;
-}
-
-void W_Nexball_Touch(entity this, entity toucher)
-{
-       entity ball, attacker;
-       attacker = this.owner;
-       //this.think = func_null;
-       //this.enemy = NULL;
-
-       PROJECTILE_TOUCH(this, toucher);
-       if(attacker.team != toucher.team || autocvar_g_nexball_basketball_teamsteal)
-               if((ball = toucher.ballcarried) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (IS_PLAYER(attacker)))
-               {
-                       toucher.velocity = toucher.velocity + normalize(this.velocity) * toucher.damageforcescale * autocvar_g_balance_nexball_secondary_force;
-                       UNSET_ONGROUND(toucher);
-                       if(!attacker.ballcarried)
-                       {
-                               LogNB("stole", attacker);
-                               _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
-
-                               if(SAME_TEAM(attacker, toucher) && time > attacker.teamkill_complain)
-                               {
-                                       attacker.teamkill_complain = time + 5;
-                                       attacker.teamkill_soundtime = time + 0.4;
-                                       attacker.teamkill_soundsource = toucher;
-                               }
-
-                               GiveBall(attacker, toucher.ballcarried);
-                       }
-               }
-       delete(this);
-}
-
-void W_Nexball_Attack(entity actor, .entity weaponentity, float t)
-{
-       entity ball;
-       float mul, mi, ma;
-       if(!(ball = actor.ballcarried))
-               return;
-
-       W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
-       tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, NULL);
-       if(trace_startsolid)
-       {
-               if(actor.metertime)
-                       actor.metertime = 0; // Shot failed, hide the power meter
-               return;
-       }
-
-       //Calculate multiplier
-       if(t < 0)
-               mul = 1;
-       else
-       {
-               mi = autocvar_g_nexball_basketball_meter_minpower;
-               ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
-               //One triangle wave period with 1 as max
-               mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period;
-               if(mul > 1)
-                       mul = 2 - mul;
-               mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
-       }
-
-       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor, actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
-
-
-       //TODO: use the speed_up cvar too ??
-}
-
-vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
-
-void W_Nexball_Attack2(entity actor, .entity weaponentity)
-{
-       if(actor.ballcarried.enemy)
-       {
-               entity _ball = actor.ballcarried;
-               W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
-               DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
-               setthink(_ball, W_Nexball_Think);
-               _ball.nextthink = time;
-               return;
-       }
-
-       if(!autocvar_g_nexball_tackling)
-               return;
-
-       W_SetupShot(actor, weaponentity, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
-       entity missile = new(ballstealer);
-
-       missile.owner = actor;
-
-       set_movetype(missile, MOVETYPE_FLY);
-       PROJECTILE_MAKETRIGGER(missile);
-
-       //setmodel(missile, "models/elaser.mdl");  // precision set below
-       setsize(missile, '0 0 0', '0 0 0');
-       setorigin(missile, w_shotorg);
-
-       W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
-       missile.angles = vectoangles(missile.velocity);
-       settouch(missile, W_Nexball_Touch);
-       setthink(missile, SUB_Remove);
-       missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
-
-       missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
-       missile.flags = FL_PROJECTILE;
-       IL_PUSH(g_projectiles, missile);
-       IL_PUSH(g_bot_dodge, missile);
-
-       CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
-}
-
 bool ball_customize(entity this, entity client)
 {
        if(!this.owner)
@@ -872,61 +749,6 @@ bool ball_customize(entity this, entity client)
        return true;
 }
 
-METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
-{
-    TC(BallStealer, thiswep);
-    if(fire & 1)
-        if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
-            if(autocvar_g_nexball_basketball_meter)
-            {
-                if(actor.ballcarried && !actor.metertime)
-                    actor.metertime = time;
-                else
-                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-            }
-            else
-            {
-                W_Nexball_Attack(actor, weaponentity, -1);
-                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-            }
-    if(fire & 2)
-        if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
-        {
-            W_Nexball_Attack2(actor, weaponentity);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
-        }
-
-    if(!(fire & 1) && actor.metertime && actor.ballcarried)
-    {
-        W_Nexball_Attack(actor, weaponentity, time - actor.metertime);
-        // DropBall or stealing will set metertime back to 0
-        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-    }
-}
-
-METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weaponentity))
-{
-    TC(BallStealer, this);
-    //weapon_setup(WEP_PORTO.m_id);
-}
-
-METHOD(BallStealer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-{
-    TC(BallStealer, this);
-}
-
-METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
-{
-    TC(BallStealer, this);
-    return true;
-}
-
-METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor, .entity weaponentity))
-{
-    TC(BallStealer, this);
-    return true;
-}
-
 void nb_DropBall(entity player)
 {
        if(player.ballcarried && g_nexball)
@@ -1134,6 +956,7 @@ MUTATOR_HOOKFUNCTION(nb, SendWaypoint)
 
 REGISTER_MUTATOR(nb, g_nexball)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
                g_nexball_meter_period = autocvar_g_nexball_meter_period;
@@ -1153,25 +976,15 @@ REGISTER_MUTATOR(nb, g_nexball)
                InitializeEntity(NULL, nb_delayedinit, INITPRIO_GAMETYPE);
                WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
 
-               ActivateTeamplay();
-               SetLimits(autocvar_g_nexball_goallimit, autocvar_g_nexball_goalleadlimit, autocvar_timelimit_override, -1);
-               have_team_spawns = -1; // request team spawns
+               GameRules_teams(true);
+               GameRules_limit_score(autocvar_g_nexball_goallimit);
+               GameRules_limit_lead(autocvar_g_nexball_goalleadlimit);
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
        {
                WEP_NEXBALL.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
-               // we actually cannot roll back nb_delayedinit here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
        }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
        return 0;
 }
 
diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc
new file mode 100644 (file)
index 0000000..705ac6d
--- /dev/null
@@ -0,0 +1,183 @@
+#include "sv_weapon.qh"
+
+void W_Nexball_Attack(entity actor, .entity weaponentity, float t);
+void W_Nexball_Attack2(entity actor, .entity weaponentity);
+vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
+
+METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
+{
+    TC(BallStealer, thiswep);
+    if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
+            if(autocvar_g_nexball_basketball_meter)
+            {
+                if(actor.ballcarried && !actor.metertime)
+                    actor.metertime = time;
+                else
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+            }
+            else
+            {
+                W_Nexball_Attack(actor, weaponentity, -1);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+            }
+    if(fire & 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
+        {
+            W_Nexball_Attack2(actor, weaponentity);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
+        }
+
+    if(!(fire & 1) && actor.metertime && actor.ballcarried)
+    {
+        W_Nexball_Attack(actor, weaponentity, time - actor.metertime);
+        // DropBall or stealing will set metertime back to 0
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+    }
+}
+
+METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weaponentity))
+{
+    TC(BallStealer, this);
+    //weapon_setup(WEP_PORTO.m_id);
+}
+
+METHOD(BallStealer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    TC(BallStealer, this);
+}
+
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
+{
+    TC(BallStealer, this);
+    return true;
+}
+
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor, .entity weaponentity))
+{
+    TC(BallStealer, this);
+    return true;
+}
+
+void W_Nexball_Think(entity this)
+{
+       //dprint("W_Nexball_Think\n");
+       //vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
+       vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
+       vector old_dir = normalize(this.velocity);
+       float _speed = vlen(this.velocity);
+       vector new_vel = normalize(old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
+       //vector new_vel = (new_dir * autocvar_g_nexball_safepass_turnrate
+
+       this.velocity = new_vel;
+
+       this.nextthink = time;
+}
+
+void W_Nexball_Touch(entity this, entity toucher)
+{
+       entity ball, attacker;
+       attacker = this.owner;
+       //this.think = func_null;
+       //this.enemy = NULL;
+
+       PROJECTILE_TOUCH(this, toucher);
+       if(attacker.team != toucher.team || autocvar_g_nexball_basketball_teamsteal)
+               if((ball = toucher.ballcarried) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (IS_PLAYER(attacker)))
+               {
+                       toucher.velocity = toucher.velocity + normalize(this.velocity) * toucher.damageforcescale * autocvar_g_balance_nexball_secondary_force;
+                       UNSET_ONGROUND(toucher);
+                       if(!attacker.ballcarried)
+                       {
+                               LogNB("stole", attacker);
+                               _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
+
+                               if(SAME_TEAM(attacker, toucher) && time > CS(attacker).teamkill_complain)
+                               {
+                                       CS(attacker).teamkill_complain = time + 5;
+                                       CS(attacker).teamkill_soundtime = time + 0.4;
+                                       CS(attacker).teamkill_soundsource = toucher;
+                               }
+
+                               GiveBall(attacker, toucher.ballcarried);
+                       }
+               }
+       delete(this);
+}
+
+void W_Nexball_Attack(entity actor, .entity weaponentity, float t)
+{
+       entity ball;
+       float mul, mi, ma;
+       if(!(ball = actor.ballcarried))
+               return;
+
+       W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+       tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, NULL);
+       if(trace_startsolid)
+       {
+               if(actor.metertime)
+                       actor.metertime = 0; // Shot failed, hide the power meter
+               return;
+       }
+
+       //Calculate multiplier
+       if(t < 0)
+               mul = 1;
+       else
+       {
+               mi = autocvar_g_nexball_basketball_meter_minpower;
+               ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
+               //One triangle wave period with 1 as max
+               mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period;
+               if(mul > 1)
+                       mul = 2 - mul;
+               mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
+       }
+
+       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor, actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
+
+
+       //TODO: use the speed_up cvar too ??
+}
+
+void W_Nexball_Attack2(entity actor, .entity weaponentity)
+{
+       if(actor.ballcarried.enemy)
+       {
+               entity _ball = actor.ballcarried;
+               W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+               DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
+               setthink(_ball, W_Nexball_Think);
+               _ball.nextthink = time;
+               return;
+       }
+
+       if(!autocvar_g_nexball_tackling)
+               return;
+
+       W_SetupShot(actor, weaponentity, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
+       entity missile = new(ballstealer);
+
+       missile.owner = actor;
+
+       set_movetype(missile, MOVETYPE_FLY);
+       PROJECTILE_MAKETRIGGER(missile);
+
+       //setmodel(missile, "models/elaser.mdl");  // precision set below
+       setsize(missile, '0 0 0', '0 0 0');
+       setorigin(missile, w_shotorg);
+
+       W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
+       missile.angles = vectoangles(missile.velocity);
+       settouch(missile, W_Nexball_Touch);
+       setthink(missile, SUB_Remove);
+       missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
+
+       missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
+       missile.flags = FL_PROJECTILE;
+       IL_PUSH(g_projectiles, missile);
+       IL_PUSH(g_bot_dodge, missile);
+
+       CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
+}
diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qh b/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 223a81f7c4d4dfb6039a3ea6b2189b0df864dfd0..0150de3925ee90072b040e2f5d132cd301a736ad 100644 (file)
@@ -426,8 +426,8 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
                pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
 
-               PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
-               PlayerScore_Add(attacker, SP_SCORE, 10);
+               GameRules_scoring_add(attacker, ONS_TAKES, 1);
+               GameRules_scoring_add(attacker, SCORE, 10);
 
                this.owner.goalentity = NULL;
                this.owner.islinked = false;
@@ -555,8 +555,8 @@ void ons_ControlPoint_Icon_BuildThink(entity this)
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
                        Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE_TEAM), this.owner.message);
                        Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message);
-                       PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1);
-                       PlayerTeamScore_AddScore(this.owner.ons_toucher, 10);
+                       GameRules_scoring_add(this.owner.ons_toucher, ONS_CAPS, 1);
+                       GameRules_scoring_add_team(this.owner.ons_toucher, SCORE, 10);
                }
 
                this.owner.ons_toucher = NULL;
@@ -911,7 +911,7 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d
                else
                {
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
-                       PlayerScore_Add(attacker, SP_SCORE, 100);
+                       GameRules_scoring_add(attacker, SCORE, 100);
                }
                this.iscaptured = false;
                this.islinked = false;
@@ -1377,8 +1377,8 @@ void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale
                        best.cnt += 1;
 
                        this.havocbot_attack_time = 0;
-                       if(checkpvs(this.view_ofs,cp))
-                       if(checkpvs(this.view_ofs,best))
+                       if(checkpvs(this.origin + this.view_ofs, cp))
+                       if(checkpvs(this.origin + this.view_ofs, best))
                                this.havocbot_attack_time = time + 2;
                }
                else
@@ -1448,8 +1448,8 @@ bool havocbot_goalrating_ons_generator_attack(entity this, float ratingscale)
                        bestwp.cnt += 1;
 
                        this.havocbot_attack_time = 0;
-                       if(checkpvs(this.view_ofs,g))
-                       if(checkpvs(this.view_ofs,bestwp))
+                       if(checkpvs(this.origin + this.view_ofs, g))
+                       if(checkpvs(this.origin + this.view_ofs, bestwp))
                                this.havocbot_attack_time = time + 5;
 
                        return true;
@@ -2174,11 +2174,11 @@ void ons_ScoreRules()
        if(c2 >= 0) teams |= BIT(1);
        if(c3 >= 0) teams |= BIT(2);
        if(c4 >= 0) teams |= BIT(3);
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
-       ScoreInfo_SetLabel_TeamScore  (ST_ONS_CAPS,     "destroyed", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS,    "caps",      SFL_SORT_PRIO_SECONDARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES,    "takes",     0);
-       ScoreRules_basics_end();
+       GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+           field_team(ST_ONS_CAPS, "destroyed", SFL_SORT_PRIO_PRIMARY);
+           field(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+           field(SP_ONS_TAKES, "takes", 0);
+       });
 }
 
 void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
index 0757d7bc6014645c37260a1620563ea066aca9bf..5c7fd469735b1e38cad2abdf8e11165d9ffb3d66 100644 (file)
@@ -5,30 +5,14 @@ void ons_Initialize();
 
 REGISTER_MUTATOR(ons, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               ons_Initialize();
-
-               ActivateTeamplay();
-               SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
-               have_team_spawns = -1; // request team spawns
-       }
+               GameRules_teams(true);
+               GameRules_limit_score(autocvar_g_onslaught_point_limit);
 
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back ons_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               ons_Initialize();
        }
-
        return false;
 }
 
diff --git a/qcsrc/common/gamemodes/rules.qc b/qcsrc/common/gamemodes/rules.qc
new file mode 100644 (file)
index 0000000..5cfbba2
--- /dev/null
@@ -0,0 +1 @@
+#include "rules.qh"
diff --git a/qcsrc/common/gamemodes/rules.qh b/qcsrc/common/gamemodes/rules.qh
new file mode 100644 (file)
index 0000000..542548d
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#ifdef SVQC
+#include <common/gamemodes/sv_rules.qh>
+#endif
diff --git a/qcsrc/common/gamemodes/sv_rules.qc b/qcsrc/common/gamemodes/sv_rules.qc
new file mode 100644 (file)
index 0000000..a4a4bcd
--- /dev/null
@@ -0,0 +1,112 @@
+#include "sv_rules.qh"
+
+#include <server/teamplay.qh>
+
+void GameRules_teams(bool value)
+{
+    if (value) {
+        serverflags |= SERVERFLAG_TEAMPLAY;
+        teamplay = 1;
+        cvar_set("teamplay", "2");  // DP needs this for sending proper getstatus replies.
+        GameRules_spawning_teams(true);
+    } else {
+       serverflags &= ~SERVERFLAG_TEAMPLAY;
+       teamplay = 0;
+       cvar_set("teamplay", "0");  // DP needs this for sending proper getstatus replies.
+       GameRules_spawning_teams(false);
+    }
+}
+
+void GameRules_spawning_teams(bool value)
+{
+    have_team_spawns = value ? -1 : 0;
+}
+
+bool _GameRules_score_enabled = true;
+void GameRules_score_enabled(bool value)
+{
+    _GameRules_score_enabled = value;
+}
+
+bool GameRules_limit_score_initialized;
+void GameRules_limit_score(int limit)
+{
+    if (GameRules_limit_score_initialized) return;
+    if (autocvar_g_campaign) return;
+    if (limit < 0) return;
+    cvar_set("fraglimit", ftos(limit));
+    GameRules_limit_score_initialized = true;
+}
+
+bool GameRules_limit_lead_initialized;
+void GameRules_limit_lead(int limit)
+{
+    if (GameRules_limit_lead_initialized) return;
+    if (autocvar_g_campaign) return;
+    if (limit < 0) return;
+    cvar_set("leadlimit", ftos(limit));
+    GameRules_limit_lead_initialized = true;
+}
+
+bool GameRules_limit_time_initialized;
+void GameRules_limit_time(int limit)
+{
+    if (GameRules_limit_time_initialized) return;
+    if (autocvar_g_campaign) return;
+    if (limit < 0) return;
+    cvar_set("timelimit", ftos(limit));
+    GameRules_limit_time_initialized = true;
+}
+
+bool GameRules_limit_time_qualifying_initialized;
+void GameRules_limit_time_qualifying(int limit)
+{
+    if (GameRules_limit_time_qualifying_initialized) return;
+    if (autocvar_g_campaign) return;
+    if (limit < 0) return;
+    cvar_set("g_race_qualifying_timelimit", ftos(limit));
+    GameRules_limit_time_qualifying_initialized = true;
+}
+
+void GameRules_limit_fallbacks()
+{
+    GameRules_limit_score(autocvar_fraglimit_override);
+    GameRules_limit_lead(autocvar_leadlimit_override);
+    GameRules_limit_time(autocvar_timelimit_override);
+}
+
+void _GameRules_scoring_begin(int teams, float spprio, float stprio)
+{
+    ScoreRules_basics(teams, spprio, stprio, _GameRules_score_enabled);
+}
+void _GameRules_scoring_field(entity i, string label, int scoreflags)
+{
+    ScoreInfo_SetLabel_PlayerScore(i, label, scoreflags);
+}
+void _GameRules_scoring_field_team(float i, string label, int scoreflags)
+{
+    ScoreInfo_SetLabel_TeamScore(i, label, scoreflags);
+}
+void _GameRules_scoring_end()
+{
+    ScoreRules_basics_end();
+}
+
+.bool m_GameRules_scoring_vip;
+void GameRules_scoring_vip(entity player, bool value)
+{
+    player.m_GameRules_scoring_vip = value;
+}
+bool GameRules_scoring_is_vip(entity player)
+{
+    return player.m_GameRules_scoring_vip;
+}
+
+float _GameRules_scoring_add(entity client, entity sp, float value)
+{
+    return PlayerScore_Add(client, sp, value);
+}
+float _GameRules_scoring_add_team(entity client, entity sp, int st, float value)
+{
+    return PlayerTeamScore_Add(client, sp, st, value);
+}
diff --git a/qcsrc/common/gamemodes/sv_rules.qh b/qcsrc/common/gamemodes/sv_rules.qh
new file mode 100644 (file)
index 0000000..35a643d
--- /dev/null
@@ -0,0 +1,56 @@
+#pragma once
+
+// todo: accept the number of teams as a parameter
+void GameRules_teams(bool value);
+
+/**
+ * Used to disable team spawns in team modes
+ */
+void GameRules_spawning_teams(bool value);
+
+/**
+ * Disabling score disables the "score" column on the scoreboard
+ */
+void GameRules_score_enabled(bool value);
+
+void GameRules_limit_score(int limit);
+void GameRules_limit_lead(int limit);
+void GameRules_limit_time(int limit);
+void GameRules_limit_time_qualifying(int limit);
+
+/**
+ * Set any unspecified rules to their defaults
+ */
+void GameRules_limit_fallbacks();
+
+/**
+ * @param teams a bitmask of active teams
+ * @param spprio player score priority (if frags aren't enabled)
+ * @param stprio team score priority (if frags aren't enabled)
+ */
+#define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN { \
+    _GameRules_scoring_begin((teams), (spprio), (stprio)); \
+    noref void(entity, string, float) field = _GameRules_scoring_field; \
+    /* todo: just have the one `field` function */ \
+    noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
+    LAMBDA(fields); \
+    _GameRules_scoring_end(); \
+} MACRO_END
+
+void _GameRules_scoring_begin(int teams, float spprio, float stprio);
+void _GameRules_scoring_field(entity i, string label, int scoreflags);
+void _GameRules_scoring_field_team(float i, string label, int scoreflags);
+void _GameRules_scoring_end();
+
+/**
+ * Mark a player as being 'important' (flag carrier, ball carrier, etc)
+ * @param player the entity to mark
+ * @param value VIP status
+ */
+void GameRules_scoring_vip(entity player, bool value);
+bool GameRules_scoring_is_vip(entity player);
+
+#define GameRules_scoring_add(client, fld, value) _GameRules_scoring_add(client, SP_##fld, value)
+float _GameRules_scoring_add(entity client, entity sp, float value);
+#define GameRules_scoring_add_team(client, fld, value) _GameRules_scoring_add_team(client, SP_##fld, ST_##fld, value)
+float _GameRules_scoring_add_team(entity client, entity sp, int st, float value);
index dc8cf21c020a6d06993f87281cc1dad98f29cbac..623f71b3904ab7654d9e9e88e23291c45d84bb09 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))
 
@@ -23,7 +26,7 @@ GENERIC_COMMAND(dumpitems, "Dump all items to the console") {
         }
         default:
         case CMD_REQUEST_USAGE: {
-            LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
+            LOG_INFOF("Usage:^3 %s dumpitems", GetProgramCommandPrefix());
             return;
         }
     }
index 52fa9b85c6657c2858050f48410c2facfb466e9b..c302ae40281d43699b335ab24a7d382b7d3d667e 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.
 
@@ -62,7 +67,7 @@ CLASS(GameItem, Object)
     METHOD(GameItem, show, void(GameItem this))
     {
         TC(GameItem, this);
-        LOG_INFO("A game item\n");
+        LOG_INFO("A game item");
     }
     void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
 ENDCLASS(GameItem)
index dccd3688644e7b4fac80d5cec18f7ecac1818ff3..39cf78cc3016e3d3b4714bcf169c843892342f59 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);
@@ -31,7 +37,7 @@ CLASS(Pickup, GameItem)
     METHOD(Pickup, show, void(Pickup this))
     {
         TC(Pickup, this);
-        LOG_INFOF("%s: %s\n", etos(this), this.m_name);
+        LOG_INFOF("%s: %s", etos(this), this.m_name);
     }
     ATTRIB(Pickup, m_itemid, int, 0);
 #ifdef SVQC
index f6a14814bcbab1ac1982ec4f0b9905b0eced93af..62600a9c4b07fec9deb809985b6c88df86aab09b 100644 (file)
@@ -283,7 +283,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
        }
        if(fh < 0)
                return 0;
-       LOG_INFO("Analyzing ", fn, " to generate initial mapinfo\n");
+       LOG_INFO("Analyzing ", fn, " to generate initial mapinfo");
 
        inWorldspawn = 2;
        MapInfo_Map_flags = 0;
@@ -1190,7 +1190,7 @@ void MapInfo_LoadMap(string s, float reinit)
        //      MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH.m_flags);
        //}
 
-       LOG_INFO("Switching to map ", s, "\n");
+       LOG_INFO("Switching to map ", s);
 
        cvar_settemp_restore();
        if(reinit)
index 4c0fd782904bab4993f0839d428210bb42b2746d..2dd84596e46991e8f3f75daeb63b524273825d01 100644 (file)
@@ -458,7 +458,7 @@ REGISTER_GAMETYPE(KEEPAWAY, NEW(Keepaway));
 CLASS(Invasion, Gametype)
     INIT(Invasion)
     {
-        this.gametype_init(this, _("Invasion"),"inv","g_invasion",false,"","pointlimit=50 teams=0",_("Survive against waves of monsters"));
+        this.gametype_init(this, _("Invasion"),"inv","g_invasion",false,"","pointlimit=50 teams=0 type=0",_("Survive against waves of monsters"));
     }
     METHOD(Invasion, m_parse_mapinfo, bool(string k, string v))
     {
@@ -466,6 +466,9 @@ CLASS(Invasion, Gametype)
             case "teams":
                 cvar_set("g_invasion_teams", v);
                 return true;
+            case "type":
+                cvar_set("g_invasion_type", v);
+                return true;
         }
         return false;
     }
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..4790f1f1f785eaba2d48eb66a07fbb932a1d8f3f 100644 (file)
@@ -348,7 +348,7 @@ void bd_move(entity minigame, entity player, string dir)
                        entity dozer = bd_find_dozer(minigame);
                        if(!dozer)
                        {
-                               LOG_INFO("Dozer wasn't found!\n");
+                               LOG_INFO("Dozer wasn't found!");
                                return; // should not happen... TODO: end match?
                        }
 
@@ -740,7 +740,7 @@ bool bd_save_level(entity minigame)
 
                if(boulder_count != target_count)
                {
-                       LOG_INFO("Not enough targets or boulders, fix your level!\n");
+                       LOG_INFO("Not enough targets or boulders, fix your level!");
                        return false;
                }
 
@@ -791,7 +791,7 @@ void bd_load_level(entity minigame)
        file_get = fopen(file_name, FILE_READ);
        if(file_get < 0)
        {
-               LOG_INFO("^3BULLDOZER: ^7could not find storage file ^3", file_name, "^7, no items were loaded\n");
+               LOG_INFO("^3BULLDOZER: ^7could not find storage file ^3", file_name, "^7, no items were loaded");
        }
        else
        {
@@ -829,7 +829,7 @@ void bd_close_editor(entity minigame, entity player)
        entity dozer = bd_find_dozer(minigame);
        if(!dozer)
        {
-               LOG_INFO("You need to place a bulldozer on the level to save it!\n");
+               LOG_INFO("You need to place a bulldozer on the level to save it!");
                return;
        }
 
@@ -840,7 +840,7 @@ void bd_close_editor(entity minigame, entity player)
        }
        else
        {
-               LOG_INFO("You need to set the level name!\n");
+               LOG_INFO("You need to set the level name!");
                return;
        }
 }
@@ -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 dd072a05be1f279b3b5f9b740a38702250890a7e..3cfee03b5f5cce0536759e307f80c2b8425d2a40 100644 (file)
@@ -427,8 +427,12 @@ int pong_server_event(entity minigame, string event, ...)
                                        return true;
                                case "pong_aimore":
                                {
+                                       // keep declaration here, moving it into for() reverses weapon order
+                                       // potentially compiler bug
+                                       int j;
                                        if ( minigame.minigame_flags & PONG_STATUS_WAIT )
-                                               for ( int j = 0; j < PONG_MAX_PLAYERS; j++ )
+                                               for ( j = 0; j < PONG_MAX_PLAYERS; j++ )
+                                               //for ( int j = 0; j < PONG_MAX_PLAYERS; j++ )
                                                {
                                                        if ( minigame.pong_paddles[j] == NULL )
                                                        {
index 033a524fb3cf896b7c26e928a3634cb75637b625..415417b465f627ec1f3420e6c35e7291d08e401b 100644 (file)
@@ -3,7 +3,7 @@
 
 void player_clear_minigame(entity player)
 {
-       player.active_minigame = NULL;
+       CS(player).active_minigame = NULL;
        player.minigame_players = NULL;
        if ( IS_PLAYER(player) )
                set_movetype(player, MOVETYPE_WALK);
@@ -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
@@ -124,11 +124,11 @@ bool minigame_CheckSend(entity this, entity client)
 
 int minigame_addplayer(entity minigame_session, entity player)
 {
-       if ( player.active_minigame )
+       if ( CS(player).active_minigame )
        {
-               if ( player.active_minigame == minigame_session )
+               if ( CS(player).active_minigame == minigame_session )
                        return 0;
-               minigame_rmplayer(player.active_minigame,player);
+               minigame_rmplayer(CS(player).active_minigame,player);
        }
        entity player_pointer = new(minigame_player);
        int mgteam = minigame_session.minigame_event(minigame_session,"join",player,player_pointer);
@@ -140,7 +140,7 @@ int minigame_addplayer(entity minigame_session, entity player)
                player_pointer.team = mgteam;
                player_pointer.list_next = minigame_session.minigame_players;
                minigame_session.minigame_players = player_pointer;
-               player.active_minigame = minigame_session;
+               CS(player).active_minigame = minigame_session;
                player.minigame_players = player_pointer;
                setcefc(player_pointer, minigame_CheckSend);
                Net_LinkEntity(player_pointer, false, 0, minigame_SendEntity);
@@ -215,7 +215,7 @@ entity join_minigame(entity player, string game_id )
 
 void part_minigame(entity player )
 {
-       entity minig = player.active_minigame;
+       entity minig = CS(player).active_minigame;
 
        if ( minig && minig.classname == "minigame" )
                minigame_rmplayer(minig,player);
@@ -262,19 +262,19 @@ void end_minigames()
 
 string invite_minigame(entity inviter, entity player)
 {
-       if ( !inviter || !inviter.active_minigame )
+       if ( !inviter || !CS(inviter).active_minigame )
                return "Invalid minigame";
        if ( VerifyClientEntity(player, true, false) <= 0 )
                return "Invalid player";
        if ( inviter == player )
                return "You can't invite yourself";
-       if ( player.active_minigame == inviter.active_minigame )
+       if ( CS(player).active_minigame == CS(inviter).active_minigame )
                return strcat(player.netname," is already playing");
 
        Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_MINIGAME_INVITE,
-               inviter.active_minigame.netname, inviter.netname );
+               CS(inviter).active_minigame.netname, inviter.netname );
 
-       GameLogEcho(strcat(":minigame:invite:",inviter.active_minigame.netname,":",
+       GameLogEcho(strcat(":minigame:invite:",CS(inviter).active_minigame.netname,":",
                ftos(etof(player)),":",player.netname));
 
        return "";
@@ -282,10 +282,10 @@ string invite_minigame(entity inviter, entity player)
 
 entity minigame_find_player(entity client)
 {
-       if ( ! client.active_minigame )
+       if ( ! CS(client).active_minigame )
                return NULL;
        entity e;
-       for ( e = client.active_minigame.minigame_players; e; e = e.list_next )
+       for ( e = CS(client).active_minigame.minigame_players; e; e = e.list_next )
                if ( e.minigame_players == client )
                        return e;
        return NULL;
@@ -293,11 +293,11 @@ entity minigame_find_player(entity client)
 
 bool MinigameImpulse(entity this, int imp)
 {
-       if (!this.active_minigame) return false;
+       if (!CS(this).active_minigame) return false;
        entity e = minigame_find_player(this);
-       if ( imp && this.active_minigame && e )
+       if ( imp && CS(this).active_minigame && e )
        {
-               return this.active_minigame.minigame_event(this.active_minigame,"impulse",e,imp);
+               return CS(this).active_minigame.minigame_event(CS(this).active_minigame,"impulse",e,imp);
        }
        return false;
 }
@@ -350,7 +350,7 @@ void ClientCommand_minigame(entity caller, int request, int argc, string command
                }
                else if ( minig_cmd == "end" || minig_cmd == "part" )
                {
-                       if ( caller.active_minigame )
+                       if ( CS(caller).active_minigame )
                        {
                                part_minigame(caller);
                                sprint(caller,"Left minigame session\n");
@@ -361,14 +361,14 @@ void ClientCommand_minigame(entity caller, int request, int argc, string command
                }
                else if ( minig_cmd == "invite" && argc > 2 )
                {
-                       if ( caller.active_minigame )
+                       if ( CS(caller).active_minigame )
                        {
                                entity client = GetIndexedEntity(argc, 2);
                                string error = invite_minigame(caller,client);
                                if ( error == "" )
                                {
                                        sprint(caller,"You have invited ",client.netname,
-                                               " to join your game of ", caller.active_minigame.descriptor.message, "\n");
+                                               " to join your game of ", CS(caller).active_minigame.descriptor.message, "\n");
                                }
                                else
                                        sprint(caller,"Could not invite: ", error, ".\n");
@@ -377,12 +377,12 @@ void ClientCommand_minigame(entity caller, int request, int argc, string command
                                sprint(caller,"You aren't playing any minigame...\n");
                        return;
                }
-               else if ( caller.active_minigame )
+               else if ( CS(caller).active_minigame )
                {
                        entity e = minigame_find_player(caller);
                        string subcommand = substring(command,argv_end_index(0),-1);
                        int arg_c = tokenize_console(subcommand);
-                       if ( caller.active_minigame.minigame_event(caller.active_minigame,"cmd",e,arg_c,subcommand) )
+                       if ( CS(caller).active_minigame.minigame_event(CS(caller).active_minigame,"cmd",e,arg_c,subcommand) )
                                return;
 
                }
index f47d8e7c5afdd76ea2ce79630d28a11e4ee608e6..eb95d7c28260d2a81ad306a1a37b00c97b4802ca 100644 (file)
@@ -335,6 +335,7 @@ MODEL(VEH_SPIDERBOT_TOP,                "models/vehicles/spiderbot_top.dpm");
 MODEL(VEH_SPIDERBOT_VIEW,               "models/vehicles/spiderbot_cockpit.dpm");
 
 MODEL(CHAT,                             "models/misc/chatbubble.spr");
+MODEL(CHAT_MINIGAME,                    "models/sprites/minigame_busy.iqm");
 
 MODEL(0,                                "models/sprites/0.spr32");
 MODEL(1,                                "models/sprites/1.spr32");
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 b03766bcf234b55d4753b5c65a1c2dddb1b91922..338acacd61fdb343357451cc09c801526196cc2e 100644 (file)
@@ -50,7 +50,7 @@ void M_Shambler_Attack_Swing(entity this)
        Monster_Attack_Melee(this, this.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((random() >= 0.5) ? this.anim_melee2 : this.anim_melee3), this.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW.m_id, true);
 }
 
-#include <common/effects/qc/all.qh>
+#include <common/effects/qc/_mod.qh>
 
 void M_Shambler_Attack_Lightning_Explode(entity this, entity directhitentity)
 {
index 5307ccd2de7324b0cb9430d3b6481295f04b0dbe..80cd21b481b41474dcf860d2d42178c95428f228 100644 (file)
@@ -943,7 +943,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
 
        if(IS_PLAYER(attacker))
        if(autocvar_g_monsters_score_spawned || !((this.spawnflags & MONSTERFLAG_SPAWNED) || (this.spawnflags & MONSTERFLAG_RESPAWNED)))
-               PlayerScore_Add(attacker, SP_SCORE, +autocvar_g_monsters_score_kill);
+               GameRules_scoring_add(attacker, SCORE, +autocvar_g_monsters_score_kill);
 
        if(gibbed)
        {
index 884fb3dea154828ee26b392be65e1cfb48afdf8e..d6989ad31839d52229cc8f612879fd6c83ab8686 100644 (file)
@@ -16,11 +16,12 @@ entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby,
        //if(invincible) { e.spawnflags |= MONSTERFLAG_INVINCIBLE; }
 
        setorigin(e, orig);
+       bool allow_any = boolean(monster == "anyrandom");
 
-       if(monster == "random")
+       if(monster == "random" || allow_any)
        {
-               RandomSelection_Init(); 
-               FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE) && !(it.spawnflags & MON_FLAG_HIDDEN),
+               RandomSelection_Init();
+               FOREACH(Monsters, it != MON_Null && (allow_any || (!(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..4f940c42b3c016f3e9131e0c6d3b213bc4d5497a 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);
     }
 }
@@ -276,6 +280,20 @@ STATIC_INIT_LATE(Mutators) {
 #define MUTATOR_ONADD                   if (mode == MUTATOR_ADDING)
 #define MUTATOR_ONREMOVE                if (mode == MUTATOR_REMOVING)
 #define MUTATOR_ONROLLBACK_OR_REMOVE    if (mode == MUTATOR_REMOVING || mode == MUTATOR_ROLLING_BACK)
+
+#define MUTATOR_STATIC() MACRO_BEGIN { \
+    MUTATOR_ONADD { \
+        /* game loads at time 1 */ \
+        if (time > 1) { \
+            error("This is a game type and it cannot be added at runtime."); \
+        } \
+    } \
+       MUTATOR_ONREMOVE { \
+               LOG_INFO("This is a game type and it cannot be removed at runtime."); \
+               return -1; \
+       } \
+} MACRO_END
+
 #define MUTATOR_ADD(name)               Mutator_Add(MUTATOR_##name)
 #define MUTATOR_REMOVE(name)            Mutator_Remove(MUTATOR_##name)
 #define MUTATOR_RETURNVALUE             CallbackChain_ReturnValue
@@ -301,7 +319,7 @@ STATIC_INIT_LATE(Mutators) {
 #define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN {                     \
     MUTATOR_ONADD {                                                     \
         if (!CallbackChain_Add(HOOK_##cb, CALLBACK_##func, order)) {    \
-            LOG_INFO("HOOK FAILED: ", #cb, ":", #func, "\n");           \
+            LOG_INFO("HOOK FAILED: ", #cb, ":", #func);                 \
             return true;                                                \
         }                                                               \
     }                                                                   \
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 032ecff0a0d78b844d0f195f379916ddd441e520..925525f395a80e672113ff19e6f5768e81ac1d17 100644 (file)
@@ -85,7 +85,7 @@ bool buff_Waypoint_visible_for_player(entity this, entity player, entity view)
 
        if (view.buffs)
        {
-               return view.cvar_cl_buffs_autoreplace == false || view.buffs != this.owner.buffs;
+               return CS(view).cvar_cl_buffs_autoreplace == false || view.buffs != this.owner.buffs;
        }
 
        return WaypointSprite_visible_for_player(this, player, view);
@@ -157,16 +157,8 @@ void buff_Touch(entity this, entity toucher)
                return;
        }
 
-       if((this.team && DIFF_TEAM(toucher, this))
-       || (STAT(FROZEN, toucher))
-       || (toucher.vehicle)
-       || (time < toucher.buff_shield)
-       || (!this.buff_active)
-       )
-       {
-               // can't touch this
+       if(!this.buff_active)
                return;
-       }
 
        if(MUTATOR_CALLHOOK(BuffTouch, this, toucher))
                return;
@@ -175,9 +167,19 @@ void buff_Touch(entity this, entity toucher)
        if(!IS_PLAYER(toucher))
                return; // incase mutator changed toucher
 
+       if((this.team && DIFF_TEAM(toucher, this))
+       || (STAT(FROZEN, toucher))
+       || (toucher.vehicle)
+       || (time < PS(toucher).buff_shield)
+       )
+       {
+               // can't touch this
+               return;
+       }
+
        if (toucher.buffs)
        {
-               if (toucher.cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs)
+               if (CS(toucher).cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs)
                {
                        int buffid = buff_FirstFromFlags(toucher.buffs).m_id;
                        //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, toucher.buffs);
@@ -550,7 +552,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn)
 
        player.buffs = 0;
        player.buff_time = 0;
-       player.buff_shield = time + 0.5; // prevent picking up buffs immediately
+       PS(player).buff_shield = time + 0.5; // prevent picking up buffs immediately
        // reset timers here to prevent them continuing after re-spawn
        player.buff_disability_time = 0;
        player.buff_disability_effect_time = 0;
@@ -619,7 +621,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST)
                Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
 
                player.buffs = 0;
-               player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
+               PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
                //player.buff_time = 0; // already notified
                sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                return true;
@@ -635,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))
                        {
@@ -646,7 +648,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
                                        closest = it;
                                }
                        }
-               ));
+               });
 
                if(closest)
                {
@@ -821,7 +823,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                        else
                                Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
                        player.buffs = 0;
-                       player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
+                       PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
                }
        }
 
index 318cc10f4a95657a2d237a5e904ebd44283aa002..40f19d6b1770bc88fa1fded89aa345397f2f3812 100644 (file)
@@ -63,6 +63,24 @@ void bugrigs_SetVars()
 
 #endif
 
+float racecar_angle(float forward, float down)
+{
+       if (forward < 0)
+       {
+               forward = -forward;
+               down = -down;
+       }
+
+       float ret = vectoyaw('0 1 0' * down + '1 0 0' * forward);
+
+       float angle_mult = forward / (800 + forward);
+
+       if (ret > 180)
+               return ret * angle_mult + 360 * (1 - angle_mult);
+       else
+               return ret * angle_mult;
+}
+
 void RaceCarPhysics(entity this, float dt)
 {
        // using this move type for "big rigs"
@@ -71,8 +89,8 @@ void RaceCarPhysics(entity this, float dt)
        vector rigvel;
 
        vector angles_save = this.angles;
-       float accel = bound(-1, this.movement.x / PHYS_MAXSPEED(this), 1);
-       float steer = bound(-1, this.movement.y / PHYS_MAXSPEED(this), 1);
+       float accel = bound(-1, PHYS_CS(this).movement.x / PHYS_MAXSPEED(this), 1);
+       float steer = bound(-1, PHYS_CS(this).movement.y / PHYS_MAXSPEED(this), 1);
 
        if (PHYS_BUGRIGS_REVERSE_SPEEDING(this))
        {
@@ -202,11 +220,11 @@ void RaceCarPhysics(entity this, float dt)
                {
                        // now set angles_x so that the car points parallel to the surface
                        this.angles = vectoangles(
-                                       '1 0 0' * v_forward_x * trace_plane_normal_z
+                                       '1 0 0' * v_forward.x * trace_plane_normal.z
                                        +
-                                       '0 1 0' * v_forward_y * trace_plane_normal_z
+                                       '0 1 0' * v_forward.y * trace_plane_normal.z
                                        +
-                                       '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y)
+                                       '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y)
                                        );
                        SET_ONGROUND(this);
                }
@@ -231,11 +249,11 @@ void RaceCarPhysics(entity this, float dt)
        if (trace_fraction != 1)
        {
                this.angles = vectoangles2(
-                               '1 0 0' * v_forward_x * trace_plane_normal_z
+                               '1 0 0' * v_forward.x * trace_plane_normal.z
                                +
-                               '0 1 0' * v_forward_y * trace_plane_normal_z
+                               '0 1 0' * v_forward.y * trace_plane_normal.z
                                +
-                               '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y),
+                               '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y),
                                trace_plane_normal
                                );
        }
@@ -243,12 +261,12 @@ void RaceCarPhysics(entity this, float dt)
        {
                vector vel_local;
 
-               vel_local_x = v_forward * this.velocity;
-               vel_local_y = v_right * this.velocity;
-               vel_local_z = v_up * this.velocity;
+               vel_local.x = v_forward * this.velocity;
+               vel_local.y = v_right * this.velocity;
+               vel_local.z = v_up * this.velocity;
 
-               this.angles_x = racecar_angle(vel_local_x, vel_local_z);
-               this.angles_z = racecar_angle(-vel_local_y, vel_local_z);
+               this.angles_x = racecar_angle(vel_local.x, vel_local.z);
+               this.angles_z = racecar_angle(-vel_local.y, vel_local.z);
        }
 
        // smooth the angles
@@ -263,8 +281,8 @@ void RaceCarPhysics(entity this, float dt)
        vf1 = vf1 + v_forward * (1 - f);
        vu1 = vu1 + v_up * (1 - f);
        smoothangles = vectoangles2(vf1, vu1);
-       this.angles_x = -smoothangles_x;
-       this.angles_z =  smoothangles_z;
+       this.angles_x = -smoothangles.x;
+       this.angles_z =  smoothangles.z;
 }
 
 #ifdef SVQC
index 41f538b7a52f02e018c364ef1aec9b123e9a7383..52fc52466d5f93ec8203f3b104ac2b72e295dba1 100644 (file)
@@ -9,6 +9,8 @@ REGISTER_MUTATOR(campcheck, cvar("g_campcheck"));
 .float campcheck_nextcheck;
 .float campcheck_traveled_distance;
 
+.vector campcheck_prevorigin;
+
 MUTATOR_HOOKFUNCTION(campcheck, PlayerDies)
 {
        entity frag_target = M_ARGV(2, entity);
@@ -33,23 +35,19 @@ MUTATOR_HOOKFUNCTION(campcheck, Damage_Calculate)
 MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
+       bool checked = false;
 
-       if(!game_stopped)
-       if(!warmup_stage) // don't consider it camping during warmup?
-       if(time >= game_starttime)
+       if(autocvar_g_campcheck_interval)
+       if(!game_stopped && !warmup_stage && time >= game_starttime)
        if(IS_PLAYER(player))
-       if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
        if(!IS_DEAD(player))
-       if(!forbidWeaponUse(player))
        if(!STAT(FROZEN, player))
        if(!PHYS_INPUT_BUTTON_CHAT(player))
-       if(autocvar_g_campcheck_interval)
+       if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
+       if(!forbidWeaponUse(player))
        {
-               vector dist;
-
                // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
-               dist = player.prevorigin - player.origin;
-               dist.z = 0;
+               vector dist = vec2(player.campcheck_prevorigin - player.origin);
                player.campcheck_traveled_distance += fabs(vlen(dist));
 
                if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
@@ -72,10 +70,21 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
                        player.campcheck_traveled_distance = 0;
                }
 
-               return;
+               checked = true;
        }
 
-       player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date
+       if(!checked)
+               player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date
+
+       player.campcheck_prevorigin = player.origin;
+}
+
+MUTATOR_HOOKFUNCTION(campcheck, CopyBody)
+{
+       entity player = M_ARGV(0, entity);
+       entity clone = M_ARGV(1, entity);
+
+       clone.campcheck_prevorigin = player.campcheck_prevorigin;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn)
index 8daf920307d96c3d533e6b0586f699b3d6a46fed..4a18cc930879ad34e28ef7551c7af1e381bf8d46 100644 (file)
@@ -1,13 +1,13 @@
 #include "sv_damagetext.qh"
 
-AUTOCVAR(sv_damagetext, int, 2, "<= 0: disabled, >= 1: spectators, >= 2: players, >= 3: all players");
+AUTOCVAR(sv_damagetext, int, 2, "<= 0: disabled, >= 1: visible to spectators, >= 2: visible to attacker, >= 3: all players see everyone's damage");
 
 REGISTER_MUTATOR(damagetext, true);
 
-#define SV_DAMAGETEXT_DISABLED()        (autocvar_sv_damagetext <= 0 /* disabled */)
-#define SV_DAMAGETEXT_SPECTATORS_ONLY() (autocvar_sv_damagetext >= 1 /* spectators only */)
-#define SV_DAMAGETEXT_PLAYERS()         (autocvar_sv_damagetext >= 2 /* players */)
-#define SV_DAMAGETEXT_ALL()             (autocvar_sv_damagetext >= 3 /* all players */)
+#define SV_DAMAGETEXT_DISABLED()        (autocvar_sv_damagetext <= 0 || autocvar_g_instagib)
+#define SV_DAMAGETEXT_SPECTATORS_ONLY() (autocvar_sv_damagetext >= 1)
+#define SV_DAMAGETEXT_PLAYERS()         (autocvar_sv_damagetext >= 2)
+#define SV_DAMAGETEXT_ALL()             (autocvar_sv_damagetext >= 3)
 MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) {
     if (SV_DAMAGETEXT_DISABLED()) return;
     const entity attacker = M_ARGV(0, entity);
@@ -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 88547f7bf4c2268e3dabd7507152aa100fa9d87d..d62aa42c4e529e8c64ff85798a8e4a85b98534b9 100644 (file)
@@ -12,7 +12,6 @@
 #define PHYS_DODGING_WALL                                      autocvar_sv_dodging_wall_dodging
 #define PHYS_DODGING_AIR                                       autocvar_sv_dodging_air_dodging
 #define PHYS_DODGING_MAXSPEED                          autocvar_sv_dodging_maxspeed
-#define PHYS_DODGING_PRESSED_KEYS(s)           (s).pressedkeys
 
 // we ran out of stats slots! TODO: re-enable this when prediction is available for dodging
 #if 0
 #ifdef CSQC
        #define PHYS_DODGING_FRAMETIME                          (1 / (frametime <= 0 ? 60 : frametime))
        #define PHYS_DODGING_TIMEOUT(s)                         STAT(DODGING_TIMEOUT)
+       #define PHYS_DODGING_PRESSED_KEYS(s)            (s).pressedkeys
 #elif defined(SVQC)
        #define PHYS_DODGING_FRAMETIME                          sys_frametime
-       #define PHYS_DODGING_TIMEOUT(s)                         s.cvar_cl_dodging_timeout
+       #define PHYS_DODGING_TIMEOUT(s)                         CS(s).cvar_cl_dodging_timeout
+       #define PHYS_DODGING_PRESSED_KEYS(s)            CS(s).pressedkeys
 #endif
 
 #ifdef SVQC
@@ -51,7 +52,7 @@ bool autocvar_sv_dodging_sound;
 #include <common/animdecide.qh>
 #include <common/physics/player.qh>
 
-.float cvar_cl_dodging_timeout = _STAT(DODGING_TIMEOUT);
+.float cvar_cl_dodging_timeout;
 
 REGISTER_MUTATOR(dodging, cvar("g_dodging"))
 {
@@ -156,9 +157,10 @@ bool PM_dodging_checkpressedkeys(entity this)
        float tap_direction_x = 0;
        float tap_direction_y = 0;
        bool dodge_detected = false;
+       vector mymovement = PHYS_CS(this).movement;
 
        #define X(COND,BTN,RESULT)                                                                                                                      \
-       if (this.movement_##COND)                                                                                               \
+       if (mymovement_##COND)                                                                                          \
                /* is this a state change? */                                                                                                   \
                if(!(PHYS_DODGING_PRESSED_KEYS(this) & KEY_##BTN) || frozen_no_doubletap) {             \
                                tap_direction_##RESULT;                                                                                                 \
@@ -236,7 +238,7 @@ void PM_dodging(entity this)
        if (this.dodging_action == 1)
        {
                //disable jump key during dodge accel phase
-               if(this.movement_z > 0) { this.movement_z = 0; }
+               if(PHYS_CS(this).movement.z > 0) { PHYS_CS(this).movement_z = 0; }
 
                this.velocity += ((this.dodging_direction_y * velocity_difference) * v_right)
                                        + ((this.dodging_direction_x * velocity_difference) * v_forward);
@@ -279,10 +281,10 @@ void PM_dodging_GetPressedKeys(entity this)
        PM_dodging_checkpressedkeys(this);
 
        int keys = this.pressedkeys;
-       keys = BITSET(keys, KEY_FORWARD,        this.movement.x > 0);
-       keys = BITSET(keys, KEY_BACKWARD,       this.movement.x < 0);
-       keys = BITSET(keys, KEY_RIGHT,          this.movement.y > 0);
-       keys = BITSET(keys, KEY_LEFT,           this.movement.y < 0);
+       keys = BITSET(keys, KEY_FORWARD,        PHYS_CS(this).movement.x > 0);
+       keys = BITSET(keys, KEY_BACKWARD,       PHYS_CS(this).movement.x < 0);
+       keys = BITSET(keys, KEY_RIGHT,          PHYS_CS(this).movement.y > 0);
+       keys = BITSET(keys, KEY_LEFT,           PHYS_CS(this).movement.y < 0);
 
        keys = BITSET(keys, KEY_JUMP,           PHYS_INPUT_BUTTON_JUMP(this));
        keys = BITSET(keys, KEY_CROUCH,         PHYS_INPUT_BUTTON_CROUCH(this));
@@ -305,6 +307,13 @@ MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 
 REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
 
+MUTATOR_HOOKFUNCTION(dodging, PlayerPreThink)
+{
+       entity player = M_ARGV(0, entity);
+
+       STAT(DODGING_TIMEOUT, player) = CS(player).cvar_cl_dodging_timeout;
+}
+
 MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
 {
        entity player = M_ARGV(0, entity);
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 ecedc475961585184fd61bad6785d2986f00f23e..47dcfd4afd550230ab85fbff4872d03cdc6e13bd 100644 (file)
@@ -30,7 +30,7 @@ bool autocvar_cl_multijump = true;
 #elif defined(SVQC)
 .bool cvar_cl_multijump;
 
-       #define PHYS_MULTIJUMP_CLIENT(s)        (s).cvar_cl_multijump
+       #define PHYS_MULTIJUMP_CLIENT(s)        CS(s).cvar_cl_multijump
 #endif
 
 MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
@@ -82,7 +82,7 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
                        if(M_ARGV(2, bool))
                        {
                                if(PHYS_MULTIJUMP_DODGING(player))
-                               if(player.movement_x != 0 || player.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+                               if(PHYS_CS(player).movement_x != 0 || PHYS_CS(player).movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
                                {
                                        float curspeed;
                                        vector wishvel, wishdir;
@@ -97,7 +97,7 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
 //#endif
 
                                        makevectors(player.v_angle_y * '0 1 0');
-                                       wishvel = v_forward * player.movement_x + v_right * player.movement_y;
+                                       wishvel = v_forward * PHYS_CS(player).movement_x + v_right * PHYS_CS(player).movement_y;
                                        wishdir = normalize(wishvel);
 
                                        player.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
index 052a132b93b1aea01e8bf0924947c9c31b253700..62b0fcf79dfde23b3d0ff10a500b210e9f7e9dd6 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;
 }
@@ -1093,8 +1093,8 @@ void nade_prime(entity this)
        }
        else
        {
-               ntype = ((autocvar_g_nades_client_select) ? this.cvar_cl_nade_type : autocvar_g_nades_nade_type);
-               pntype = ((autocvar_g_nades_client_select) ? this.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
+               ntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
+               pntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
 
        spawn_held_nade(this, this, autocvar_g_nades_nade_lifetime, ntype, pntype);
@@ -1240,7 +1240,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                        FOR_EACH_KH_KEY(key) if(key.owner == player) { ++key_count; }
 
                        float time_score;
-                       if(player.flagcarried || player.ballcarried) // this player is important
+                       if(GameRules_scoring_is_vip(player))
                                time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
                        else
                                time_score = autocvar_g_nades_bonus_score_time;
@@ -1250,8 +1250,8 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
 
                        if(autocvar_g_nades_bonus_client_select)
                        {
-                               player.nade_type = player.cvar_cl_nade_type;
-                               player.pokenade_type = player.cvar_cl_pokenade_type;
+                               player.nade_type = CS(player).cvar_cl_nade_type;
+                               player.pokenade_type = CS(player).cvar_cl_pokenade_type;
                        }
                        else
                        {
@@ -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;
-               ));
+               });
        }
 }
 
@@ -1345,7 +1345,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
                player.nade_refire  = time + autocvar_g_nades_nade_refire;
 
        if(autocvar_g_nades_bonus_client_select)
-               player.nade_type = player.cvar_cl_nade_type;
+               player.nade_type = CS(player).cvar_cl_nade_type;
 
        player.nade_timer = 0;
 
@@ -1373,19 +1373,19 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
        if(!STAT(FROZEN, frag_target) || !autocvar_g_freezetag_revive_nade)
                toss_nade(frag_target, true, '0 0 100', max(frag_target.nade.wait, time + 0.05));
 
-       float killcount_bonus = ((frag_attacker.killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * frag_attacker.killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor);
-
        if(IS_PLAYER(frag_attacker))
        {
+               float killcount_bonus = ((CS(frag_attacker).killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * CS(frag_attacker).killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor);
+
                if (SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
                        nades_RemoveBonus(frag_attacker);
-               else if(frag_target.flagcarried)
+               else if(GameRules_scoring_is_vip(frag_target))
                        nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_medium);
-               else if(autocvar_g_nades_bonus_score_spree && frag_attacker.killcount > 1)
+               else if(autocvar_g_nades_bonus_score_spree && CS(frag_attacker).killcount > 1)
                {
                        #define SPREE_ITEM(counta,countb,center,normal,gentle) \
                                case counta: { nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_spree); break; }
-                       switch(frag_attacker.killcount)
+                       switch(CS(frag_attacker).killcount)
                        {
                                KILL_SPREE_LIST
                                default: nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor); break;
@@ -1481,11 +1481,6 @@ MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
        M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Nades");
 }
 
-MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
-{
-       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Nades");
-}
-
 MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString)
 {
        M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3nades^8 are enabled, press 'g' to use them\n");
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..288c2d5c8363ea473d824edf867275700221b677 100644 (file)
@@ -78,23 +78,23 @@ 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
        {
-               LOG_INFO("This cannot be removed at runtime\n");
+               LOG_INFO("This cannot be removed at runtime");
                return -1;
        }
 
@@ -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 82df487c5cc33253e20c69e6b0a4dff91ac5b3dc..f39c4fc0f7ef7ca4edb7d37780569c436016f9fe 100644 (file)
@@ -120,10 +120,9 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
        if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player))
                return;
 
-       if(PHYS_INPUT_BUTTON_ATCK2(player))
+       if(PHYS_INPUT_BUTTON_ATCK2(player) && time >= player.jump_interval)
        if( !forbidWeaponUse(player)
                || (round_handler_IsActive() && !round_handler_IsRoundStarted()) )
-       if(time >= player.jump_interval)
        {
                player.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(player);
                makevectors(player.v_angle);
index 62b30e2d14785e9f9745d4a2059e9b13946046fa..62781c92073cfbd11278ea0313364bdac5bc0d8e 100644 (file)
@@ -23,7 +23,7 @@ REGISTER_MUTATOR(physical_items, cvar("g_physical_items"))
 
        MUTATOR_ONREMOVE
        {
-               LOG_INFO("This cannot be removed at runtime\n");
+               LOG_INFO("This cannot be removed at runtime");
                return -1;
        }
 
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..93dc602f0299df56c21597ea6cf966e951d2db78 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;    }
@@ -407,7 +407,7 @@ void sandbox_Database_Load()
        if(file_get < 0)
        {
                if(autocvar_g_sandbox_info > 0)
-                       LOG_INFO(strcat("^3SANDBOX - SERVER: ^7could not find storage file ^3", file_name, "^7, no objects were loaded\n"));
+                       LOG_INFO("^3SANDBOX - SERVER: ^7could not find storage file ^3", file_name, "^7, no objects were loaded");
        }
        else
        {
@@ -432,7 +432,7 @@ void sandbox_Database_Load()
                        }
                }
                if(autocvar_g_sandbox_info > 0)
-                       LOG_INFO(strcat("^3SANDBOX - SERVER: ^7successfully loaded storage file ^3", file_name, "\n"));
+                       LOG_INFO("^3SANDBOX - SERVER: ^7successfully loaded storage file ^3", file_name);
        }
        fclose(file_get);
 }
@@ -524,7 +524,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                _setmodel(e, argv(2));
 
                                if(autocvar_g_sandbox_info > 0)
-                                       LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " spawned an object at origin ^3", vtos(e.origin), "\n"));
+                                       LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " spawned an object at origin ^3", vtos(e.origin));
                                return true;
 
                        // ---------------- COMMAND: OBJECT, REMOVE ----------------
@@ -533,7 +533,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                if(e != NULL)
                                {
                                        if(autocvar_g_sandbox_info > 0)
-                                               LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " removed an object at origin ^3", vtos(e.origin), "\n"));
+                                               LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " removed an object at origin ^3", vtos(e.origin));
                                        sandbox_ObjectRemove(e);
                                        return true;
                                }
@@ -582,7 +582,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
 
                                                print_to(player, "^2SANDBOX - INFO: ^7Object pasted successfully");
                                                if(autocvar_g_sandbox_info > 0)
-                                                       LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " pasted an object at origin ^3", vtos(e.origin), "\n"));
+                                                       LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " pasted an object at origin ^3", vtos(e.origin));
                                                return true;
                                }
                                return true;
@@ -617,7 +617,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                                        player.object_attach = NULL; // object was attached, no longer keep it scheduled for attachment
                                                        print_to(player, "^2SANDBOX - INFO: ^7Object attached successfully");
                                                        if(autocvar_g_sandbox_info > 1)
-                                                               LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " attached objects at origin ^3", vtos(e.origin), "\n"));
+                                                               LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " attached objects at origin ^3", vtos(e.origin));
                                                        return true;
                                                }
                                                print_to(player, "^1SANDBOX - WARNING: ^7Object could not be attached to the parent. Make sure you are facing an object that you have edit rights over");
@@ -630,7 +630,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                                        sandbox_ObjectAttach_Remove(e);
                                                        print_to(player, "^2SANDBOX - INFO: ^7Child objects detached successfully");
                                                        if(autocvar_g_sandbox_info > 1)
-                                                               LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " detached objects at origin ^3", vtos(e.origin), "\n"));
+                                                               LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " detached objects at origin ^3", vtos(e.origin));
                                                        return true;
                                                }
                                                print_to(player, "^1SANDBOX - WARNING: ^7Child objects could not be detached. Make sure you are facing an object that you have edit rights over");
@@ -721,7 +721,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                        e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S"));
 
                                        if(autocvar_g_sandbox_info > 1)
-                                               LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin), "\n"));
+                                               LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin));
                                        return true;
                                }
 
index ee75728630e2e5623f988e1d7efaf7b31d9f37d7..9ff3644748112eaad8c6dc1894487b52afe4dd21 100644 (file)
@@ -24,7 +24,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
        entity spawn_spot = M_ARGV(1, entity);
        vector spawn_score = M_ARGV(2, vector);
 
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && player.cvar_cl_spawn_near_teammate))
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS(player).cvar_cl_spawn_near_teammate))
                return;
 
        spawn_spot.msnt_lookat = NULL;
@@ -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)
        {
@@ -76,7 +76,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                return; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage!
 
        // Note: when entering this, fixangle is already set.
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && player.cvar_cl_spawn_near_teammate))
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS(player).cvar_cl_spawn_near_teammate))
        {
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
                        player.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
@@ -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 3a435c5ed1dea13ad797e4097e1a79c749b319cf..92c5943c3d75455f7bc3d41b6f95184df7ba8555 100644 (file)
@@ -12,8 +12,7 @@ MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
        if(frag_target != frag_attacker)
        if(!IS_DEAD(frag_target))
        {
-               frag_attacker.health += bound(0, damage_take, frag_target.health);
-               frag_attacker.health = bound(0, frag_attacker.health, autocvar_g_balance_health_limit);
+               GivePlayerHealth(frag_attacker, bound(0, damage_take, frag_target.health));
        }
 }
 
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..6dec163fa237c97f0492f9dfc83a32fadb79f425 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;
 }
@@ -530,7 +530,7 @@ void Draw_WaypointSprite(entity this)
     if (rgb == '0 0 0')
     {
         this.teamradar_color = '1 0 1';
-        LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
+        LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
     }
 
     if (time - floor(time) > 0.5)
index d77a4aa61827d36f302c5c0d2b53d5506d7b6899..6a8d57157c010f0fbb10c9fa22b9865292b31bea 100644 (file)
@@ -27,7 +27,6 @@ class(WaypointSprite) .float build_started;
 class(WaypointSprite) .float build_starthealth;
 class(WaypointSprite) .float build_finished;
 
-bool autocvar_g_waypointsprite_uppercase;
 float autocvar_g_waypointsprite_alpha;
 float autocvar_g_waypointsprite_crosshairfadealpha;
 float autocvar_g_waypointsprite_crosshairfadedistance;
@@ -53,6 +52,7 @@ int autocvar_g_waypointsprite_spam;
 float autocvar_g_waypointsprite_timealphaexponent;
 bool autocvar_g_waypointsprite_turrets = true;
 float autocvar_g_waypointsprite_turrets_maxdist = 5000;
+bool autocvar_g_waypointsprite_uppercase;
 
 float waypointsprite_fadedistance;
 float waypointsprite_normdistance;
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 d39c9f86e13bb59a3b2ba0952a8fbe4f4f5d2f35..b9350758a115fb6ab3558c86e867a5e62d549c73 100644 (file)
@@ -200,7 +200,7 @@ string Process_Notif_Line(
                LOG_INFOF(
                        (
                                "^1TRAILING NEW LINE AT END OF NOTIFICATION: "
-                               "^7net_type = %s, net_name = %s, string = %s.\n"
+                               "^7net_type = %s, net_name = %s, string = %s."
                        ),
                        notiftype,
                        notifname,
@@ -235,7 +235,7 @@ string Process_Notif_Args(
                                        LOG_INFOF(
                                                (
                                                        "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
-                                                       "^7net_type = %s, net_name = %s, max args = %d.\n"
+                                                       "^7net_type = %s, net_name = %s, max args = %d."
                                                ),
                                                notiftype,
                                                notifname,
@@ -267,7 +267,7 @@ string Process_Notif_Args(
                                                LOG_INFOF(
                                                        (
                                                                "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
-                                                               "^7net_type = %s, net_name = %s, args arg = '%s'.\n"
+                                                               "^7net_type = %s, net_name = %s, args arg = '%s'."
                                                        ),
                                                        notiftype,
                                                        notifname,
@@ -286,7 +286,7 @@ string Process_Notif_Args(
                                        LOG_INFOF(
                                                (
                                                        "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
-                                                       "^7net_type = %s, net_name = %s, max hudargs = %d.\n"
+                                                       "^7net_type = %s, net_name = %s, max hudargs = %d."
                                                ),
                                                notiftype,
                                                notifname,
@@ -318,7 +318,7 @@ string Process_Notif_Args(
                                                LOG_INFOF(
                                                        (
                                                                "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
-                                                               "^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
+                                                               "^7net_type = %s, net_name = %s, hudargs arg = '%s'."
                                                        ),
                                                        notiftype,
                                                        notifname,
@@ -337,7 +337,7 @@ string Process_Notif_Args(
                                        LOG_INFOF(
                                                (
                                                        "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
-                                                       "^7net_type = %s, net_name = %s, max durcnt = %d.\n"
+                                                       "^7net_type = %s, net_name = %s, max durcnt = %d."
                                                ),
                                                notiftype,
                                                notifname,
@@ -372,7 +372,7 @@ string Process_Notif_Args(
                                                        LOG_INFOF(
                                                                (
                                                                        "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
-                                                                       "^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
+                                                                       "^7net_type = %s, net_name = %s, durcnt arg = '%s'."
                                                                ),
                                                                notiftype,
                                                                notifname,
@@ -421,7 +421,7 @@ void Create_Notification_Entity(entity notif,
                        LOG_INFOF(
                                (
                                        "^1NOTIFICATION WITH IMPROPER TYPE: "
-                                       "^7net_type = %d, net_name = %s.\n"
+                                       "^7net_type = %d, net_name = %s."
                                ),
                                typeId,
                                namestring
@@ -471,7 +471,7 @@ void Create_Notification_Entity_Annce(entity notif,
                                        LOG_INFOF(
                                                (
                                                        "^1NOTIFICATION WITH NO SOUND: "
-                                                       "^7net_type = %s, net_name = %s.\n"
+                                                       "^7net_type = %s, net_name = %s."
                                                ),
                                                typestring,
                                                namestring
@@ -529,7 +529,7 @@ void Create_Notification_Entity_InfoCenter(entity notif,
                                                LOG_INFOF(
                                                        (
                                                                "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: "
-                                                               "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
+                                                               "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d"
                                                        ),
                                                        typestring,
                                                        namestring,
@@ -563,7 +563,7 @@ void Create_Notification_Entity_InfoCenter(entity notif,
                                                LOG_INFOF(
                                                        (
                                                                "^1NOTIFICATION HAS HUDARGS BUT NO ICON: "
-                                                               "^7net_type = %s, net_name = %s.\n"
+                                                               "^7net_type = %s, net_name = %s."
                                                        ),
                                                        typestring,
                                                        namestring
@@ -635,7 +635,7 @@ void Create_Notification_Entity_InfoCenter(entity notif,
                                        LOG_INFOF(
                                                (
                                                        "^1EMPTY NOTIFICATION: "
-                                                       "^7net_type = %s, net_name = %s.\n"
+                                                       "^7net_type = %s, net_name = %s."
                                                ),
                                                typestring,
                                                namestring
@@ -661,7 +661,7 @@ void Create_Notification_Entity_Multi(entity notif,
                                LOG_INFOF(
                                        (
                                                "^1NOTIFICATION WITH NO SUBCALLS: "
-                                               "^7net_type = %s, net_name = %s.\n"
+                                               "^7net_type = %s, net_name = %s."
                                        ),
                                        typestring,
                                        namestring
@@ -713,7 +713,7 @@ void Create_Notification_Entity_Choice(entity notif,
                                LOG_INFOF(
                                        (
                                                "^1NOTIFICATION IS MISSING CHOICE PARAMS: "
-                                               "^7net_type = %s, net_name = %s.\n"
+                                               "^7net_type = %s, net_name = %s."
                                        ),
                                        typestring,
                                        namestring
@@ -764,6 +764,7 @@ void Notification_GetCvars(entity this)
        FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
                GetCvars_handleFloat(
                        this,
+                       CS(this),
                        get_cvars_s,
                        get_cvars_f,
                        msg_choice_choices[it.nent_choice_idx],
@@ -1605,7 +1606,7 @@ void Send_Notification(
 
                #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \
                        if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) { \
-                               switch (ent.msg_choice_choices[net_name.nent_choice_idx]) \
+                               switch (CS(ent).msg_choice_choices[net_name.nent_choice_idx]) \
                                { \
                                        case 1: found_choice = notif.nent_optiona; break; \
                                        case 2: found_choice = notif.nent_optionb; break; \
index 4bd827a6e8fe8f80f8ff6d2ef8142af8ba1964e4..1721303ab526a6d2fc93d5a406d99b5ad1973d43 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 */
@@ -177,25 +181,25 @@ GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt"
                        if (fh >= 0)
                        {
                                Dump_Notifications(fh, alsoprint);
-                               LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
+                               LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.", filename);
                                fclose(fh);
                        }
                        else
                        {
-                               LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename);
+                               LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
                        }
                        #else
-                       LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
+                       LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd."));
                        #endif
                        return;
                }
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
-                       LOG_INFO("  Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
-                       LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-                       LOG_INFO("  if left blank, it will only write to default.\n");
+                       LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]");
+                       LOG_INFO("  Where 'filename' is the file to write (default is notifications_dump.cfg),");
+                       LOG_INFO("  if supplied with '-' output to console as well as default,");
+                       LOG_INFO("  if left blank, it will only write to default.");
                        return;
                }
        }
@@ -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 3b86ebcecacc7433bfc8f86ad594e04d4f17be6c..20e2d4cc32f16d0b736e421d0a1172262492ff7c 100644 (file)
@@ -15,9 +15,9 @@ bool Physics_Valid(string thecvar)
 
 float Physics_ClientOption(entity this, string option, float defaultval)
 {
-       if(IS_REAL_CLIENT(this) && Physics_Valid(this.cvar_cl_physics))
+       if(IS_REAL_CLIENT(this) && Physics_Valid(CS(this).cvar_cl_physics))
        {
-               string s = strcat("g_physics_", this.cvar_cl_physics, "_", option);
+               string s = strcat("g_physics_", CS(this).cvar_cl_physics, "_", option);
                if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
                        return cvar(s);
        }
@@ -30,8 +30,14 @@ float Physics_ClientOption(entity this, string option, float defaultval)
        return defaultval;
 }
 
-void Physics_UpdateStats(entity this, float maxspd_mod)
+void Physics_UpdateStats(entity this)
 {
+       // update this first, as it's used on all stats (wouldn't want to update them all manually from a mutator hook now, would we?)
+       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
+
+       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this);
+       float maxspd_mod = PHYS_HIGHSPEED(this);
+
        STAT(MOVEVARS_AIRACCEL_QW, this) = AdjustAirAccelQW(Physics_ClientOption(this, "airaccel_qw", autocvar_sv_airaccel_qw), maxspd_mod);
        STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw))
                ? AdjustAirAccelQW(Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw), maxspd_mod)
@@ -135,13 +141,13 @@ void PM_ClientMovement_UpdateStatus(entity this)
 
 void CPM_PM_Aircontrol(entity this, float dt, vector wishdir, float wishspeed)
 {
-       float movity = IsMoveInDirection(this.movement, 0);
+       float movity = IsMoveInDirection(PHYS_CS(this).movement, 0);
        if(PHYS_AIRCONTROL_BACKWARDS(this))
-               movity += IsMoveInDirection(this.movement, 180);
+               movity += IsMoveInDirection(PHYS_CS(this).movement, 180);
        if(PHYS_AIRCONTROL_SIDEWARDS(this))
        {
-               movity += IsMoveInDirection(this.movement, 90);
-               movity += IsMoveInDirection(this.movement, -90);
+               movity += IsMoveInDirection(PHYS_CS(this).movement, 90);
+               movity += IsMoveInDirection(PHYS_CS(this).movement, -90);
        }
 
        float k = 32 * (2 * movity - 1);
@@ -427,7 +433,7 @@ void CheckWaterJump(entity this)
 
 
 #ifdef SVQC
-       #define JETPACK_JUMP(s) s.cvar_cl_jetpack_jump
+       #define JETPACK_JUMP(s) CS(s).cvar_cl_jetpack_jump
 #elif defined(CSQC)
        float autocvar_cl_jetpack_jump;
        #define JETPACK_JUMP(s) autocvar_cl_jetpack_jump
@@ -477,31 +483,18 @@ void CheckPlayerJump(entity this)
                CheckWaterJump(this);
 }
 
-float racecar_angle(float forward, float down)
-{
-       if (forward < 0)
-       {
-               forward = -forward;
-               down = -down;
-       }
-
-       float ret = vectoyaw('0 1 0' * down + '1 0 0' * forward);
-
-       float angle_mult = forward / (800 + forward);
-
-       if (ret > 180)
-               return ret * angle_mult + 360 * (1 - angle_mult);
-       else
-               return ret * angle_mult;
-}
-
 #ifdef SVQC
 string specialcommand = "xwxwxsxsxaxdxaxdx1x ";
 .float specialcommand_pos;
 void SpecialCommand(entity this)
 {
-       if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
-               LOG_INFO("A hollow voice says \"Plugh\".\n");
+       if(autocvar_sv_cheats || this.maycheat)
+       {
+               if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
+                       LOG_INFO("A hollow voice says \"Plugh\".");
+       }
+       else
+               STAT(MOVEVARS_SPECIALCOMMAND, this) = true;
 }
 #endif
 
@@ -526,18 +519,18 @@ bool PM_check_specialcommand(entity this, int buttons)
        else
                c = "?";
 
-       if (c == substring(specialcommand, this.specialcommand_pos, 1))
+       if (c == substring(specialcommand, CS(this).specialcommand_pos, 1))
        {
-               this.specialcommand_pos += 1;
-               if (this.specialcommand_pos >= strlen(specialcommand))
+               CS(this).specialcommand_pos += 1;
+               if (CS(this).specialcommand_pos >= strlen(specialcommand))
                {
-                       this.specialcommand_pos = 0;
+                       CS(this).specialcommand_pos = 0;
                        SpecialCommand(this);
                        return true;
                }
        }
-       else if (this.specialcommand_pos && (c != substring(specialcommand, this.specialcommand_pos - 1, 1)))
-               this.specialcommand_pos = 0;
+       else if (CS(this).specialcommand_pos && (c != substring(specialcommand, CS(this).specialcommand_pos - 1, 1)))
+               CS(this).specialcommand_pos = 0;
 #endif
        return false;
 }
@@ -550,7 +543,7 @@ void PM_check_nickspam(entity this)
        if (this.nickspamcount >= autocvar_g_nick_flood_penalty_yellow)
        {
                // slight annoyance for nick change scripts
-               this.movement = -1 * this.movement;
+               PHYS_CS(this).movement = -1 * PHYS_CS(this).movement;
                PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = PHYS_INPUT_BUTTON_HOOK(this) = PHYS_INPUT_BUTTON_USE(this) = false;
 
                if (this.nickspamcount >= autocvar_g_nick_flood_penalty_red) // if you are persistent and the slight annoyance above does not stop you, I'll show you!
@@ -598,12 +591,12 @@ void PM_check_frozen(entity this)
 #endif
        )
        {
-               this.movement_x = bound(-5, this.movement.x, 5);
-               this.movement_y = bound(-5, this.movement.y, 5);
-               this.movement_z = bound(-5, this.movement.z, 5);
+               PHYS_CS(this).movement_x = bound(-5, PHYS_CS(this).movement.x, 5);
+               PHYS_CS(this).movement_y = bound(-5, PHYS_CS(this).movement.y, 5);
+               PHYS_CS(this).movement_z = bound(-5, PHYS_CS(this).movement.z, 5);
        }
        else
-               this.movement = '0 0 0';
+               PHYS_CS(this).movement = '0 0 0';
 
        vector midpoint = ((this.absmin + this.absmax) * 0.5);
        if (pointcontents(midpoint) == CONTENT_WATER)
@@ -684,7 +677,7 @@ void PM_check_blocked(entity this)
 #ifdef SVQC
        if (!this.player_blocked)
                return;
-       this.movement = '0 0 0';
+       PHYS_CS(this).movement = '0 0 0';
        this.disableclientprediction = 1;
 #endif
 }
@@ -693,8 +686,8 @@ void PM_jetpack(entity this, float maxspd_mod, float dt)
 {
        //makevectors(this.v_angle.y * '0 1 0');
        makevectors(this.v_angle);
-       vector wishvel = v_forward * this.movement_x
-                                       + v_right * this.movement_y;
+       vector wishvel = v_forward * PHYS_CS(this).movement_x
+                                       + v_right * PHYS_CS(this).movement_y;
        // add remaining speed as Z component
        float maxairspd = PHYS_MAXAIRSPEED(this) * max(1, maxspd_mod);
        // fix speedhacks :P
@@ -818,10 +811,16 @@ void SV_PlayerPhysics(entity this)
 void CSQC_ClientMovement_PlayerMove_Frame(entity this)
 #endif
 {
+#ifdef SVQC
+       // needs to be called before physics are run!
+       if(IS_REAL_CLIENT(this))
+               PM_UpdateButtons(this, CS(this));
+#endif
+
        sys_phys_update(this, PHYS_INPUT_TIMELENGTH);
 
 #ifdef SVQC
-       this.pm_frametime = frametime;
+       CS(this).pm_frametime = frametime;
 #elif defined(CSQC)
        if((ITEMS_STAT(this) & IT_USING_JETPACK) && !IS_DEAD(this) && !intermission)
                this.csqcmodel_modelflags |= MF_ROCKET;
index 88c735c630fac40950ba1e9eb965f1decc5f83ea..d5a8e605af8a5b1721fa4d478b35d7de88727cc7 100644 (file)
@@ -2,7 +2,10 @@
 
 // Client/server mappings
 
-.float pm_frametime;
+#ifdef SVQC
+// TODO: get rid of this random dumb include!
+       #include <common/state.qh>
+#endif
 
 .entity conveyor;
 
@@ -19,8 +22,8 @@
 .float spectatorspeed;
 #endif
 
+.int buttons_old;
 .vector movement_old;
-.float buttons_old;
 .vector v_angle_old;
 .string lastclassname;
 
@@ -187,6 +190,13 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        .int items;
 
        .vector movement;
+
+       // angles of the player's view (as opposed to their model which uses `.vector angles;`) in degrees
+       // x is pitch: positive means down (unlike .angles)
+       // y is yaw: between -180 and 180, increases when turning left
+       // z is roll: positive means tilted clockwise, usually is 0
+       // when .fixangle is set, the player's view will change to the direction where the model is facing
+       // more info: https://gitlab.com/xonotic/xonotic-data.pk3dir/merge_requests/447#note_32816794
        .vector v_angle;
 
        .entity hook;
@@ -208,6 +218,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_INPUT_FRAMETIME                serverdeltatime
 
        #define PHYS_INPUT_MOVEVALUES(s)            input_movevalues
+       #define PHYS_CS(s)                          (s)
 
        #define PHYS_INPUT_BUTTON_BUTTON1(s)        boolean(input_buttons & BIT(0))
        #define PHYS_INPUT_BUTTON_BUTTON2(s)        boolean(input_buttons & BIT(1))
@@ -244,7 +255,9 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
 
        bool Physics_Valid(string thecvar);
 
-       void Physics_UpdateStats(entity this, float maxspd_mod);
+       void Physics_UpdateStats(entity this);
+
+       void PM_UpdateButtons(entity this, entity store);
 
        .float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW);
        .float stat_sv_maxspeed = _STAT(MOVEVARS_MAXSPEED);
@@ -259,27 +272,28 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_INPUT_TIMELENGTH               frametime
        #define PHYS_INPUT_FRAMETIME                sys_frametime
 
-       #define PHYS_INPUT_MOVEVALUES(s)            ((s).movement)
-
-       #define PHYS_INPUT_BUTTON_BUTTON1(s)        ((s).button0)
-       #define PHYS_INPUT_BUTTON_BUTTON2(s)        ((s).button2)
-       #define PHYS_INPUT_BUTTON_BUTTON3(s)        ((s).button3)
-       #define PHYS_INPUT_BUTTON_BUTTON4(s)        ((s).button4)
-       #define PHYS_INPUT_BUTTON_BUTTON5(s)        ((s).button5)
-       #define PHYS_INPUT_BUTTON_BUTTON6(s)        ((s).button6)
-       #define PHYS_INPUT_BUTTON_BUTTON7(s)        ((s).button7)
-       #define PHYS_INPUT_BUTTON_BUTTON8(s)        ((s).button8)
-       #define PHYS_INPUT_BUTTON_BUTTON_USE(s)     ((s).buttonuse)
-       #define PHYS_INPUT_BUTTON_BUTTON_CHAT(s)    ((s).buttonchat)
-       #define PHYS_INPUT_BUTTON_BUTTON_PRYDON(s)  ((s).cursor_active)
-       #define PHYS_INPUT_BUTTON_BUTTON9(s)        ((s).button9)
-       #define PHYS_INPUT_BUTTON_BUTTON10(s)       ((s).button10)
-       #define PHYS_INPUT_BUTTON_BUTTON11(s)       ((s).button11)
-       #define PHYS_INPUT_BUTTON_BUTTON12(s)       ((s).button12)
-       #define PHYS_INPUT_BUTTON_BUTTON13(s)       ((s).button13)
-       #define PHYS_INPUT_BUTTON_BUTTON14(s)       ((s).button14)
-       #define PHYS_INPUT_BUTTON_BUTTON15(s)       ((s).button15)
-       #define PHYS_INPUT_BUTTON_BUTTON16(s)       ((s).button16)
+       #define PHYS_INPUT_MOVEVALUES(s)            CS(s).movement
+       #define PHYS_CS(s)                          CS(s)
+
+       #define PHYS_INPUT_BUTTON_BUTTON1(s)        (CS(s).button0)
+       #define PHYS_INPUT_BUTTON_BUTTON2(s)        (CS(s).button2)
+       #define PHYS_INPUT_BUTTON_BUTTON3(s)        (CS(s).button3)
+       #define PHYS_INPUT_BUTTON_BUTTON4(s)        (CS(s).button4)
+       #define PHYS_INPUT_BUTTON_BUTTON5(s)        (CS(s).button5)
+       #define PHYS_INPUT_BUTTON_BUTTON6(s)        (CS(s).button6)
+       #define PHYS_INPUT_BUTTON_BUTTON7(s)        (CS(s).button7)
+       #define PHYS_INPUT_BUTTON_BUTTON8(s)        (CS(s).button8)
+       #define PHYS_INPUT_BUTTON_BUTTON_USE(s)     (CS(s).buttonuse)
+       #define PHYS_INPUT_BUTTON_BUTTON_CHAT(s)    (CS(s).buttonchat)
+       #define PHYS_INPUT_BUTTON_BUTTON_PRYDON(s)  (CS(s).cursor_active)
+       #define PHYS_INPUT_BUTTON_BUTTON9(s)        (CS(s).button9)
+       #define PHYS_INPUT_BUTTON_BUTTON10(s)       (CS(s).button10)
+       #define PHYS_INPUT_BUTTON_BUTTON11(s)       (CS(s).button11)
+       #define PHYS_INPUT_BUTTON_BUTTON12(s)       (CS(s).button12)
+       #define PHYS_INPUT_BUTTON_BUTTON13(s)       (CS(s).button13)
+       #define PHYS_INPUT_BUTTON_BUTTON14(s)       (CS(s).button14)
+       #define PHYS_INPUT_BUTTON_BUTTON15(s)       (CS(s).button15)
+       #define PHYS_INPUT_BUTTON_BUTTON16(s)       (CS(s).button16)
 
        #define IS_DUCKED(s)                        ((s).crouch)
        #define SET_DUCKED(s)                       ((s).crouch = true)
@@ -288,7 +302,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_sv_jumpspeedcap_min
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_sv_jumpspeedcap_max
 
-       #define PHYS_CL_TRACK_CANJUMP(s)            ((s).cvar_cl_movement_track_canjump)
+       #define PHYS_CL_TRACK_CANJUMP(s)            (CS(s).cvar_cl_movement_track_canjump)
 
 #endif
 
index 2342af6d978abb79c1d29e2d648e0c192ee294d0..d8af629624b5e8ea10c22f7cc446681fb8346362 100644 (file)
@@ -24,7 +24,7 @@ void PlayerStats_GameReport_AddPlayer(entity e)
        // set up player identification
        string s = "";
 
-       if((e.crypto_idfp != "") && (e.cvar_cl_allow_uidtracking == 1))
+       if((e.crypto_idfp != "") && (CS(e).cvar_cl_allow_uidtracking == 1))
                { s = e.crypto_idfp; }
        else if(IS_BOT_CLIENT(e))
                { s = sprintf("bot#%g#%s", skill, e.cleanname); }
@@ -108,7 +108,7 @@ float PlayerStats_GameReport_Event(string prefix, string event_id, float value)
 void PlayerStats_GameReport_Accuracy(entity p)
 {
        #define ACCMAC(suffix, field) \
-               PS_GR_P_ADDVAL(p, sprintf("acc-%s-%s", it.netname, suffix), p.accuracy.(field[i-1]));
+               PS_GR_P_ADDVAL(p, sprintf("acc-%s-%s", it.netname, suffix), CS(p).accuracy.(field[i-1]));
        FOREACH(Weapons, it != WEP_Null, {
                ACCMAC("hit", accuracy_hit)
                ACCMAC("fired", accuracy_fired)
@@ -132,7 +132,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
 
        db_put(PS_GR_OUT_DB, sprintf("%s:_playerid", p.playerstats_id), ftos(p.playerid));
 
-       if(p.cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
+       if(CS(p).cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
                db_put(PS_GR_OUT_DB, sprintf("%s:_netname", p.playerstats_id), playername(p, false));
 
        if(teamplay)
@@ -146,9 +146,9 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
 
        if(IS_REAL_CLIENT(p))
        {
-               if(p.latency_cnt)
+               if(CS(p).latency_cnt)
                {
-                       float latency = (p.latency_sum / p.latency_cnt);
+                       float latency = (CS(p).latency_sum / CS(p).latency_cnt);
                        if(latency) { PS_GR_P_ADDVAL(p, PLAYERSTATS_AVGLATENCY, latency); }
                }
        }
@@ -420,7 +420,7 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
                case URL_READY_ERROR:
                default:
                {
-                       LOG_INFO("Player stats writing failed: ", ftos(status), "\n");
+                       LOG_INFO("Player stats writing failed: ", ftos(status));
                        PlayerStats_GameReport_DelayMapVote = false;
                        if(PS_GR_OUT_DB >= 0)
                        {
@@ -434,13 +434,13 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
 
 void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest)
 {
-       PlayerScore_Add(joiningplayer, SP_ELO, -1);
+       GameRules_scoring_add(joiningplayer, ELO, -1);
        // http://stats.xonotic.org/player/GgXRw6piDtFIbMArMuiAi8JG4tiin8VLjZgsKB60Uds=/elo.txt
        if(autocvar_g_playerstats_playerbasic_uri != "")
        {
                string uri = autocvar_g_playerstats_playerbasic_uri;
                if (joiningplayer.crypto_idfp == "") {
-                       PlayerScore_Add(joiningplayer, SP_ELO, -1);
+                       GameRules_scoring_add(joiningplayer, ELO, -1);
                } else {
                        // create the database if it doesn't already exist
                        if(PS_B_IN_DB < 0)
@@ -472,7 +472,7 @@ void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest)
        else
        {
                // server has this disabled, kill the DB and set status to idle
-               PlayerScore_Add(joiningplayer, SP_ELO, -1);
+               GameRules_scoring_add(joiningplayer, ELO, -1);
                if(PS_B_IN_DB >= 0)
                {
                        db_close(PS_B_IN_DB);
@@ -573,7 +573,7 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
                         if (gt == PlayerStats_GetGametype()) {
                             handled = true;
                             float e = stof(data);
-                            PlayerScore_Add(p, SP_ELO, +1 + e);
+                            GameRules_scoring_add(p, ELO, +1 + e);
                         }
                         if (gt == "") {
                             // PlayerInfo_AddItem(p, value, data);
@@ -590,18 +590,18 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
                case URL_READY_CLOSED:
                {
                        // url_fclose has finished
-                       LOG_INFO("Player stats synchronized with server\n");
+                       LOG_INFO("Player stats synchronized with server");
                        return;
                }
 
                case URL_READY_ERROR:
                default:
                {
-                       LOG_INFO("Receiving player stats failed: ", ftos(status), "\n");
+                       LOG_INFO("Receiving player stats failed: ", ftos(status));
                        break;
                }
        }
-       PlayerScore_Add(p, SP_ELO, -1);
+       GameRules_scoring_add(p, ELO, -1);
 }
 #endif // SVQC
 
@@ -613,7 +613,7 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
        float i = 0;
        for(e = PS_D_IN_EVL; (en = db_get(PS_D_IN_DB, e)) != ""; e = en)
        {
-               LOG_INFO(sprintf("%d:%s:%s\n", i, e, db_get(PS_D_IN_DB, sprintf("#%s", e))));
+               LOG_INFOF("%d:%s:%s", i, e, db_get(PS_D_IN_DB, sprintf("#%s", e)));
                ++i;
        }
 #endif
@@ -679,7 +679,7 @@ void PlayerStats_PlayerDetail_CheckUpdate()
        float gamecount = cvar("cl_matchcount");
 
        #if 0
-       LOG_INFOF("PlayerStats_PlayerDetail_CheckUpdate(): %f >= %f, %d > %d\n",
+       LOG_INFOF("PlayerStats_PlayerDetail_CheckUpdate(): %f >= %f, %d > %d",
                time,
                PS_D_NEXTUPDATETIME,
                PS_D_LASTGAMECOUNT,
@@ -782,7 +782,7 @@ void PlayerStats_PlayerDetail_Handler(entity fh, entity unused, float status)
                                                        "PlayerStats_PlayerDetail_Handler(): ERROR: "
                                                        "Key went unhandled? Is our version outdated?\n"
                                                        "PlayerStats_PlayerDetail_Handler(): "
-                                                       "Key '%s', Event '%s', Data '%s'\n",
+                                                       "Key '%s', Event '%s', Data '%s'",
                                                        key,
                                                        event,
                                                        data
@@ -792,13 +792,13 @@ void PlayerStats_PlayerDetail_Handler(entity fh, entity unused, float status)
                                }
 
                                #if 0
-                               LOG_INFO(sprintf(
+                               LOG_INFOF(
                                        "PlayerStats_PlayerDetail_Handler(): "
-                                       "Key '%s', Event '%s', Data '%s'\n",
+                                       "Key '%s', Event '%s', Data '%s'",
                                        key,
                                        event,
                                        data
-                               ));
+                               );
                                #endif
                        }
                        //print("PlayerStats_PlayerDetail_Handler(): End of response.\n");
@@ -811,14 +811,14 @@ void PlayerStats_PlayerDetail_Handler(entity fh, entity unused, float status)
                case URL_READY_CLOSED:
                {
                        // url_fclose has finished
-                       LOG_INFO("PlayerStats_PlayerDetail_Handler(): Player stats synchronized with server.\n");
+                       LOG_INFO("PlayerStats_PlayerDetail_Handler(): Player stats synchronized with server.");
                        break;
                }
 
                case URL_READY_ERROR:
                default:
                {
-                       LOG_INFO("PlayerStats_PlayerDetail_Handler(): Receiving player stats failed: ", ftos(status), "\n");
+                       LOG_INFO("PlayerStats_PlayerDetail_Handler(): Receiving player stats failed: ", ftos(status));
                        PlayerStats_PlayerDetail_Status = PS_D_STATUS_ERROR;
                        if(PS_D_IN_DB >= 0)
                        {
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 a47188422ebea5d562e3e090445ee0b216cb0877..ea936185b95ee2b1227a58be5664a7e2ecfda30c 100644 (file)
@@ -25,7 +25,7 @@ void PlayerState_detach(entity this)
     Inventory_delete(this);
 }
 
-void GetCvars(entity this, int);
+void GetCvars(entity this, entity store, int);
 void DecodeLevelParms(entity this);
 void PlayerScore_Attach(entity this);
 void ClientData_Attach(entity this);
@@ -40,7 +40,7 @@ void ClientState_attach(entity this)
 {
        this._cs = NEW(ClientState, this);
 
-    GetCvars(this, 0);  // get other cvars from player
+    GetCvars(this, CS(this), 0);  // get other cvars from player
 
        // TODO: fold all of these into ClientState
 
@@ -69,18 +69,18 @@ void PlayerScore_Detach(entity this);
 
 void ClientState_detach(entity this)
 {
+    GetCvars(this, CS(this), -1);  // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
+    accuracy_free(this); // TODO: needs to be before CS() is deleted!
+    PlayerScore_Detach(this); // what ^they^ said
+    W_HitPlotClose(this);
+    ClientData_Detach(this);
        delete(CS(this));
        this._cs = NULL;
 
-    GetCvars(this, -1);  // free cvars
 
     bot_clientdisconnect(this);
 
-    W_HitPlotClose(this);
     anticheat_report_to_eventlog(this);
     playerdemo_shutdown(this);
     entcs_detach(this);
-    accuracy_free(this);
-    ClientData_Detach(this);
-    PlayerScore_Detach(this);
 }
index 2cb353361eb0867750cbbfc2a9ee47e26086dca7..94e408d7f614be2d769fc229625a390bfd357ba0 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 #ifdef SVQC
+#include <server/autocvars.qh>
 #include <server/client.qh>
 #endif
 
@@ -41,8 +42,11 @@ const int MAX_CL_STATS = 256;
     #define stat_VIEWHEIGHT view_ofs_z
 #endif
 
+#ifdef SVQC
+vector weaponsInMap;
+#endif
 REGISTER_STAT(WEAPONS, vectori)
-REGISTER_STAT(WEAPONSINMAP, vectori)
+REGISTER_STAT(WEAPONSINMAP, vectori, weaponsInMap)
 
 REGISTER_STAT(PL_VIEW_OFS, vector)
 REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector)
@@ -58,22 +62,26 @@ REGISTER_STAT(KH_KEYS, int)
 #ifdef SVQC
 float W_WeaponRateFactor(entity this);
 float game_stopped;
+float game_starttime;
+float round_starttime;
+bool autocvar_g_allow_oldvortexbeam;
+int autocvar_leadlimit;
 #endif
 REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
 REGISTER_STAT(GAME_STOPPED, int, game_stopped)
-REGISTER_STAT(GAMESTARTTIME, float)
+REGISTER_STAT(GAMESTARTTIME, float, game_starttime)
 REGISTER_STAT(STRENGTH_FINISHED, float)
 REGISTER_STAT(INVINCIBLE_FINISHED, float)
 /** arc heat in [0,1] */
 REGISTER_STAT(ARC_HEAT, float)
 REGISTER_STAT(PRESSED_KEYS, int)
 /** this stat could later contain some other bits of info, like, more server-side particle config */
-REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool)
+REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool, autocvar_g_allow_oldvortexbeam)
 REGISTER_STAT(FUEL, int)
 REGISTER_STAT(NB_METERSTART, float)
 /** compressShotOrigin */
 REGISTER_STAT(SHOTORG, int)
-REGISTER_STAT(LEADLIMIT, float)
+REGISTER_STAT(LEADLIMIT, float, autocvar_leadlimit)
 REGISTER_STAT(WEAPON_CLIPLOAD, int)
 REGISTER_STAT(WEAPON_CLIPSIZE, int)
 
@@ -99,7 +107,7 @@ REGISTER_STAT(NADE_TIMER, float)
 REGISTER_STAT(SECRETS_TOTAL, float)
 REGISTER_STAT(SECRETS_FOUND, float)
 REGISTER_STAT(RESPAWN_TIME, float)
-REGISTER_STAT(ROUNDSTARTTIME, float)
+REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime)
 REGISTER_STAT(MONSTERS_TOTAL, int)
 REGISTER_STAT(MONSTERS_KILLED, int)
 REGISTER_STAT(BUFFS, int)
@@ -334,6 +342,7 @@ REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float)
 REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
 REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
 REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
+REGISTER_STAT(MOVEVARS_SPECIALCOMMAND, bool)
 
 
 #ifdef CSQC
@@ -343,7 +352,7 @@ noref int autocvar_cl_gunalign;
 .int cvar_cl_gunalign;
 REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
 #endif
-REGISTER_STAT(GUNALIGN, int, this.cvar_cl_gunalign)
+REGISTER_STAT(GUNALIGN, int)
 #ifdef SVQC
 SPECTATE_COPYFIELD(_STAT(GUNALIGN))
 #endif
index 811115b68071f36e358f2faa6d664b6a801f585d..e47b98a663c7b498db2baa37c5bdae224daafcf2 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));
@@ -641,7 +648,119 @@ void Item_ScheduleInitialRespawn(entity e)
        Item_ScheduleRespawnIn(e, max(0, game_starttime - time) + ((e.respawntimestart) ? e.respawntimestart : ITEM_RESPAWNTIME_INITIAL(e)));
 }
 
-float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
+void GivePlayerResource(entity player, .float resource_type, float amount)
+{
+       if (amount == 0)
+       {
+               return;
+       }
+       switch (resource_type)
+       {
+               case health:
+               {
+                       // Ugly hack. We do not check if health goes beyond hard limit since
+                       // currently it is done in player_regen. We need to bring back this
+                       // check when other code is ported to this function.
+                       player.health = bound(player.health, player.health + amount,
+                               autocvar_g_balance_health_limit);
+                       // Correct code:
+                       //player.health = bound(player.health, player.health + amount,
+                       //      min(autocvar_g_balance_health_limit,
+                       //      RESOURCE_AMOUNT_HARD_LIMIT));
+                       player.pauserothealth_finished = max(player.pauserothealth_finished,
+                               time + autocvar_g_balance_pause_health_rot);
+                       return;
+               }
+               case armorvalue:
+               {
+                       // Ugly hack. We do not check if armor goes beyond hard limit since
+                       // currently it is done in player_regen. We need to bring back this
+                       // check when other code is ported to this function.
+                       player.armorvalue = bound(player.armorvalue, player.armorvalue +
+                               amount, autocvar_g_balance_armor_limit);
+                       // Correct code:
+                       //player.armorvalue = bound(player.armorvalue, player.armorvalue +
+                       //      amount, min(autocvar_g_balance_armor_limit,
+                       //      RESOURCE_AMOUNT_HARD_LIMIT));
+                       player.pauserotarmor_finished = max(player.pauserotarmor_finished,
+                               time + autocvar_g_balance_pause_armor_rot);
+                       return;
+               }
+               case ammo_shells:
+               case ammo_nails:
+               case ammo_rockets:
+               case ammo_cells:
+               case ammo_plasma:
+               {
+                       GivePlayerAmmo(player, resource_type, amount);
+                       return;
+               }
+               case ammo_fuel:
+               {
+                       player.ammo_fuel = bound(player.ammo_fuel, player.ammo_fuel +
+                               amount, min(g_pickup_fuel_max, RESOURCE_AMOUNT_HARD_LIMIT));
+                       player.pauserotfuel_finished = max(player.pauserotfuel_finished,
+                               time + autocvar_g_balance_pause_fuel_rot);
+                       return;
+               }
+       }
+}
+
+void GivePlayerHealth(entity player, float amount)
+{
+       GivePlayerResource(player, health, amount);
+}
+
+void GivePlayerArmor(entity player, float amount)
+{
+       GivePlayerResource(player, armorvalue, amount);
+}
+
+void GivePlayerAmmo(entity player, .float ammotype, float amount)
+{
+       if (amount == 0)
+       {
+               return;
+       }
+       float maxvalue = RESOURCE_AMOUNT_HARD_LIMIT;
+       switch (ammotype)
+       {
+               case ammo_shells:
+               {
+                       maxvalue = g_pickup_shells_max;
+                       break;
+               }
+               case ammo_cells:
+               {
+                       maxvalue = g_pickup_cells_max;
+                       break;
+               }
+               case ammo_rockets:
+               {
+                       maxvalue = g_pickup_rockets_max;
+                       break;
+               }
+               case ammo_plasma:
+               {
+                       maxvalue = g_pickup_plasma_max;
+                       break;
+               }
+               case ammo_nails:
+               {
+                       maxvalue = g_pickup_nails_max;
+                       break;
+               }
+       }
+       player.(ammotype) = min(player.(ammotype) + amount,
+               min(maxvalue, RESOURCE_AMOUNT_HARD_LIMIT));
+}
+
+void GivePlayerFuel(entity player, float amount)
+{
+       GivePlayerResource(player, ammo_fuel, amount);
+}
+
+float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax)
 {
        if (!item.(ammotype))
                return false;
@@ -650,8 +769,13 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
        {
                if ((player.(ammotype) < ammomax) || item.pickup_anyway > 0)
                {
-                       player.(ammotype) = bound(player.(ammotype), ammomax, player.(ammotype) + item.(ammotype));
-                       goto YEAH;
+                       float amount = item.(ammotype);
+                       if ((player.(ammotype) + amount) > ammomax)
+                       {
+                               amount = ammomax - player.(ammotype);
+                       }
+                       GivePlayerResource(player, ammotype, amount);
+                       return true;
                }
        }
        else if(g_weapon_stay == 2)
@@ -659,29 +783,11 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
                float mi = min(item.(ammotype), ammomax);
                if (player.(ammotype) < mi)
                {
-                       player.(ammotype) = mi;
-                       goto YEAH;
+                       GivePlayerResource(player, ammotype, mi - player.(ammotype));
                }
+               return true;
        }
-
        return false;
-
-LABEL(YEAH)
-       switch(mode)
-       {
-               case ITEM_MODE_FUEL:
-                       player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + autocvar_g_balance_pause_fuel_rot);
-                       break;
-               case ITEM_MODE_HEALTH:
-                       player.pauserothealth_finished = max(player.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
-                       break;
-               case ITEM_MODE_ARMOR:
-                       player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + autocvar_g_balance_pause_armor_rot);
-                       break;
-               default:
-                       break;
-       }
-       return true;
 }
 
 float Item_GiveTo(entity item, entity player)
@@ -695,7 +801,7 @@ float Item_GiveTo(entity item, entity player)
        // if the player is using their best weapon before items are given, they
        // probably want to switch to an even better weapon after items are given
 
-       if(player.autoswitch)
+       if(CS(player).autoswitch)
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
@@ -710,16 +816,14 @@ float Item_GiveTo(entity item, entity player)
                        }
                }
        }
-
-       pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
-       pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max, ITEM_MODE_NONE);
-       pickedup |= Item_GiveAmmoTo(item, player, ammo_nails, g_pickup_nails_max, ITEM_MODE_NONE);
-       pickedup |= Item_GiveAmmoTo(item, player, ammo_rockets, g_pickup_rockets_max, ITEM_MODE_NONE);
-       pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, g_pickup_cells_max, ITEM_MODE_NONE);
-       pickedup |= Item_GiveAmmoTo(item, player, ammo_plasma, g_pickup_plasma_max, ITEM_MODE_NONE);
-       pickedup |= Item_GiveAmmoTo(item, player, health, item.max_health, ITEM_MODE_HEALTH);
-       pickedup |= Item_GiveAmmoTo(item, player, armorvalue, item.max_armorvalue, ITEM_MODE_ARMOR);
-
+       pickedup |= Item_GiveAmmoTo(item, player, health, item.max_health);
+       pickedup |= Item_GiveAmmoTo(item, player, armorvalue, item.max_armorvalue);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_nails, g_pickup_nails_max);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_rockets, g_pickup_rockets_max);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, g_pickup_cells_max);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_plasma, g_pickup_plasma_max);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max);
        if (item.itemdef.instanceOfWeaponPickup)
        {
                WepSet w;
@@ -868,7 +972,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;
@@ -1024,25 +1128,27 @@ float ammo_pickupevalfunc(entity player, entity item)
                rating = item.bot_pickupbasevalue;
        }
 
+       float noammorating = 0.5;
+
        if ((need_shells) && (item.ammo_shells) && (player.ammo_shells < g_pickup_shells_max))
-               c = item.ammo_shells / player.ammo_shells;
+               c = item.ammo_shells / max(noammorating, player.ammo_shells);
 
        if ((need_nails) && (item.ammo_nails) && (player.ammo_nails < g_pickup_nails_max))
-               c = item.ammo_nails / player.ammo_nails;
+               c = item.ammo_nails / max(noammorating, player.ammo_nails);
 
        if ((need_rockets) && (item.ammo_rockets) && (player.ammo_rockets < g_pickup_rockets_max))
-               c = item.ammo_rockets / player.ammo_rockets;
+               c = item.ammo_rockets / max(noammorating, player.ammo_rockets);
 
        if ((need_cells) && (item.ammo_cells) && (player.ammo_cells < g_pickup_cells_max))
-               c = item.ammo_cells / player.ammo_cells;
+               c = item.ammo_cells / max(noammorating, player.ammo_cells);
 
        if ((need_plasma) && (item.ammo_plasma) && (player.ammo_plasma < g_pickup_plasma_max))
-               c = item.ammo_plasma / player.ammo_plasma;
+               c = item.ammo_plasma / max(noammorating, player.ammo_plasma);
 
        if ((need_fuel) && (item.ammo_fuel) && (player.ammo_fuel < g_pickup_fuel_max))
-               c = item.ammo_fuel / player.ammo_fuel;
+               c = item.ammo_fuel / max(noammorating, player.ammo_fuel);
 
-       rating *= min(2, c);
+       rating *= min(c, 2);
        if(wpn)
                rating += wpn.bot_pickupbasevalue * 0.1;
        return rating;
@@ -1170,7 +1276,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                if(!have_pickup_item(this))
                {
                        startitem_failed = true;
-                       delete (this);
+                       delete(this);
                        return;
                }
 
@@ -1208,7 +1314,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;
                }
                */
@@ -1364,7 +1470,7 @@ spawnfunc(item_rockets)
 
 spawnfunc(item_bullets)
 {
-       if(!weaponswapping && autocvar_sv_q3acompat_machineshotgunswap && 
+       if(!weaponswapping && autocvar_sv_q3acompat_machineshotgunswap &&
           (this.classname != "droppedweapon"))
        {
                weaponswapping = true;
@@ -1721,7 +1827,7 @@ float GiveItems(entity e, float beginarg, float endarg)
 
        int _switchweapon = 0;
 
-       if(e.autoswitch)
+       if(CS(e).autoswitch)
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
index 1b2293bcff0651d442032c328d7a0455783adb3b..c7287b67a67b3a1ebc285ad1119f868965e4988f 100644 (file)
@@ -1,5 +1,12 @@
 #pragma once
 
+#ifdef SVQC
+#include <server/defs.qh>
+#endif
+
+/// \brief Unconditional maximum amount of resources the player can have.
+const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
+
 const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
 
 // item networking
@@ -81,11 +88,40 @@ void Item_ScheduleRespawnIn(entity e, float t);
 void Item_ScheduleRespawn(entity e);
 
 void Item_ScheduleInitialRespawn(entity e);
-float ITEM_MODE_NONE = 0;
-float ITEM_MODE_HEALTH = 1;
-float ITEM_MODE_ARMOR = 2;
-float ITEM_MODE_FUEL = 3;
-float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode);
+
+/// \brief Gives player a resource such as health, armor or ammo.
+/// \param[in,out] player Player to give resource to.
+/// \param[in] resource_type Type of the resource.
+/// \param[in] amount Amount of resource to give.
+/// \return No return.
+void GivePlayerResource(entity player, .float resource_type, float amount);
+
+/// \brief Gives health to the player.
+/// \param[in,out] player Player to give health to.
+/// \param[in] amount Amount of health to give.
+/// \return No return.
+void GivePlayerHealth(entity player, float amount);
+
+/// \brief Gives armor to the player.
+/// \param[in,out] player Player to give armor to.
+/// \param[in] amount Amount of armor to give.
+/// \return No return.
+void GivePlayerArmor(entity player, float amount);
+
+/// \brief Gives ammo of the specified type to the player.
+/// \param[in,out] player Player to give ammo to.
+/// \param[in] type Ammo type property.
+/// \param[in] amount Amount of ammo to give.
+/// \return No return.
+void GivePlayerAmmo(entity player, .float ammotype, float amount);
+
+/// \brief Gives fuel to the player.
+/// \param[in,out] player Player to give fuel to.
+/// \param[in] amount Amount of fuel to give.
+/// \return No return.
+void GivePlayerFuel(entity player, float amount);
+
+float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax);
 
 float Item_GiveTo(entity item, entity player);
 
index 01250e0aae6ab3baba60262094db79c95d43fff2..dc0be6ae24a9822b67865e2c4a2cb0c6b0b32c6b 100644 (file)
@@ -169,7 +169,11 @@ bool door_check_keys(entity door, entity player)
        if(!IS_PLAYER(player))
                return false;
 
-       int valid = (door.itemkeys & player.itemkeys);
+       entity store = player;
+#ifdef SVQC
+       store = PS(player);
+#endif
+       int valid = (door.itemkeys & store.itemkeys);
        door.itemkeys &= ~valid; // only some of the needed keys were given
 
        if(!door.itemkeys)
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 4eed8ef345872f3726bcb03fd4904fdcb63a871e..1464da95511260b8ce4592e705b50bf9a62e7c2d 100644 (file)
@@ -55,7 +55,7 @@ void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, enti
                        data = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", key)));
                        if(data.y == 0) // undefined field, i.e., invalid type
                        {
-                               LOG_INFO("target_spawn: invalid/unknown entity key ", key, " specified, ignored!\n");
+                               LOG_INFO("target_spawn: invalid/unknown entity key ", key, " specified, ignored!");
                                continue;
                        }
                }
@@ -150,7 +150,7 @@ void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, enti
                                }
                                else
                                {
-                                       LOG_INFO("target_spawn: invalid/unknown variable replacement ", value, " specified, ignored!\n");
+                                       LOG_INFO("target_spawn: invalid/unknown variable replacement ", value, " specified, ignored!");
                                        continue;
                                }
 
@@ -163,13 +163,13 @@ void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, enti
                                {
                                        if(value != "")
                                        {
-                                               LOG_INFO("target_spawn: try to get a field of a non-entity, ignored!\n");
+                                               LOG_INFO("target_spawn: try to get a field of a non-entity, ignored!");
                                                continue;
                                        }
                                        data2 = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", valuefield)));
                                        if(data2_y == 0) // undefined field, i.e., invalid type
                                        {
-                                               LOG_INFO("target_spawn: invalid/unknown entity key replacement ", valuefield, " specified, ignored!\n");
+                                               LOG_INFO("target_spawn: invalid/unknown entity key replacement ", valuefield, " specified, ignored!");
                                                continue;
                                        }
                                        value = getentityfieldstring(data2_x, valueent);
@@ -189,7 +189,7 @@ void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, enti
                                                        value = vtos(stov(value) + stov(valueoffset));
                                                        break;
                                                default:
-                                                       LOG_INFO("target_spawn: only string, float and vector fields can do calculations, calculation ignored!\n");
+                                                       LOG_INFO("target_spawn: only string, float and vector fields can do calculations, calculation ignored!");
                                                        break;
                                        }
                                }
@@ -206,7 +206,7 @@ void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, enti
                                                        value = vtos(stov(value) + random() * data2_x * '1 0 0' + random() * data2_y * '0 1 0' + random() * data2_z * '0 0 1');
                                                        break;
                                                default:
-                                                       LOG_INFO("target_spawn: only float and vector fields can do random calculations, calculation ignored!\n");
+                                                       LOG_INFO("target_spawn: only float and vector fields can do random calculations, calculation ignored!");
                                                        break;
                                        }
                                }
index 169cdf0615620cd19a2aee6408b5788f69bc929d..e1cd95058dbb7b597f174614c8b203be1674e05d 100644 (file)
@@ -206,7 +206,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
 #ifdef SVQC
        if(!e) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
 #elif defined(CSQC)
-       if(!e) { LOG_INFO("Teleport destination could not be found from CSQC.\n"); }
+       if(!e) { LOG_INFO("Teleport destination could not be found from CSQC."); }
 #endif
 
        makevectors(e.mangle);
@@ -238,7 +238,7 @@ void teleport_findtarget(entity this)
                if(e.move_movetype == MOVETYPE_NONE)
                        waypoint_spawnforteleporter(this, e.origin, 0);
                if(e.classname != "info_teleport_destination")
-                       LOG_INFO("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.\n");
+                       LOG_INFO("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.");
 #endif
        }
 
@@ -295,7 +295,7 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl)
        #elif defined(CSQC)
                if(!(pl.flags & BIT(15))) // FL_PROJECTILE
        #endif
-                       LOG_INFO("A non-projectile got through a warpzone and its owner cleared. It's a ", pl.classname, ".\n");
+                       LOG_INFO("A non-projectile got through a warpzone and its owner cleared. It's a ", pl.classname, ".");
                pl.owner = NULL;
        }
        if(IS_PLAYER(pl))
index 6154f6bf0aa073e67c3aa522bb7a96501c541f6a..eee61c993535f063b5ba30eeccdd6db3550b0273 100644 (file)
@@ -19,7 +19,7 @@ void trigger_disablerelay_use(entity this, entity actor, entity trigger)
        }
 
        if((!a) == (!b))
-               LOG_INFO("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!\n");
+               LOG_INFO("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!");
 }
 
 spawnfunc(trigger_disablerelay)
index 756d3b25a5c861867fc8f0b525836d40c21f5671..904c3fa3d4a7404d5d4c0535fbc59858b2d6cc42 100644 (file)
@@ -3,7 +3,7 @@
 #ifdef CSQC
 bool item_keys_usekey(entity l, entity p)
 {
-       int valid = (l.itemkeys & p.itemkeys);
+       int valid = (l.itemkeys & p.itemkeys); // TODO: itemkeys isn't networked or anything!
        l.itemkeys &= ~valid; // only some of the needed keys were given
        return valid != 0;
 }
index 7e6311df1bc7cde481ee40b3efcf54ec58e51522..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);
        }
@@ -86,9 +86,8 @@ void multi_touch(entity this, entity toucher)
        }
 
        // if the trigger has pressed keys, check that the player is pressing those keys
-       if(this.pressedkeys)
-       if(IS_PLAYER(toucher)) // only for players
-       if(!(toucher.pressedkeys & this.pressedkeys))
+       if(this.pressedkeys && IS_PLAYER(toucher)) // only for players
+       if(!(CS(toucher).pressedkeys & this.pressedkeys))
                return;
 
        EXACTTRIGGER_TOUCH(this, toucher);
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 a600263542afab2266461d91a2f350489b4344b9..ffc04a0782bf8d0a5b59c00876adf0b8319dc078 100644 (file)
@@ -72,7 +72,7 @@ void viewloc_init(entity this)
                        break;
                }
 
-       if(!this.enemy) { LOG_INFO("^1FAIL!\n"); delete(this); return; }
+       if(!this.enemy) { LOG_INFO("^1FAIL!"); delete(this); return; }
 
        if(!this.goalentity)
                this.goalentity = this.enemy; // make them match so CSQC knows what to do
@@ -86,7 +86,7 @@ void viewloc_init(entity this)
 spawnfunc(trigger_viewlocation)
 {
        // we won't check target2 here yet, as it may not even need to exist
-       if(this.target == "") { LOG_INFO("^1FAIL!\n"); delete(this); return; }
+       if(this.target == "") { LOG_INFO("^1FAIL!"); delete(this); return; }
 
        EXACTTRIGGER_INIT;
        InitializeEntity(this, viewloc_init, INITPRIO_FINDTARGET);
diff --git a/qcsrc/common/turrets/_all.inc b/qcsrc/common/turrets/_all.inc
deleted file mode 100644 (file)
index 8bc63f7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "_all.qh"
-#include "_mod.inc"
diff --git a/qcsrc/common/turrets/_all.qh b/qcsrc/common/turrets/_all.qh
deleted file mode 100644 (file)
index 947026d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#pragma once
-#include "_mod.qh"
index 8fff9535c5ce40ca345d9175a859b509dd053218..f8eb32263b30eb48f6d5b7329354a8f5f1a8a605 100644 (file)
@@ -11,3 +11,5 @@
     #include <common/turrets/sv_turrets.qc>
 #endif
 #include <common/turrets/util.qc>
+
+#include <common/turrets/turret/_mod.inc>
index 06978f1d41e23fa375a94ab19463287553d0736c..427ec4049a807e70bc659edfcd0ddfc9c414d51d 100644 (file)
@@ -11,3 +11,5 @@
     #include <common/turrets/sv_turrets.qh>
 #endif
 #include <common/turrets/util.qh>
+
+#include <common/turrets/turret/_mod.qh>
index 469a64c9274b240758ebd40eeeb8d4f19576d767..54e63748c3d2360d7e34be08ac20aaf4f6b419e0 100644 (file)
@@ -1,23 +1,3 @@
 #include "all.qh"
 
 REGISTER_NET_LINKED(ENT_CLIENT_TURRET)
-
-#ifdef SVQC
-#include "sv_turrets.qh"
-#endif
-
-#define IMPLEMENTATION
-#include "turret/_mod.inc"
-#undef IMPLEMENTATION
-
-#ifdef CSQC
-#include "cl_turrets.qc"
-#endif
-
-#ifdef SVQC
-#include "sv_turrets.qc"
-#include "config.qc"
-#include "util.qc"
-#include "checkpoint.qc"
-#include "targettrigger.qc"
-#endif
index 1a77e989121b0cade1ab49e584f93e6e575b29d4..e63a931a67361df15b0d7b15f71fbc16e484c862 100644 (file)
@@ -38,17 +38,17 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
             if(tur_config_file >= 0)
             {
                 Dump_Turret_Settings();
-                LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename));
+                LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename);
                 fclose(tur_config_file);
                 tur_config_file = -1;
                 tur_config_alsoprint = -1;
             }
             else
             {
-                LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+                LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
             }
             #else
-            LOG_INFO(_("Turrets dump command only works with sv_cmd.\n"));
+            LOG_INFO(_("Turrets dump command only works with sv_cmd."));
             #endif
             return;
         }
@@ -56,10 +56,10 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
         default:
         case CMD_REQUEST_USAGE:
         {
-            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"));
-            LOG_INFO("  Where 'filename' is the file to write (default is turrets_dump.cfg),\n");
-            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-            LOG_INFO("  if left blank, it will only write to default.\n");
+            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]");
+            LOG_INFO("  Where 'filename' is the file to write (default is turrets_dump.cfg),");
+            LOG_INFO("  if supplied with '-' output to console as well as default,");
+            LOG_INFO("  if left blank, it will only write to default.");
             return;
         }
     }
@@ -73,4 +73,4 @@ const int TUR_FIRST = 1;
 
 REGISTER_TURRET(Null, NEW(Turret));
 
-#include "turret/_mod.inc"
+#include "turret/_mod.qh"
index d9a20dc97c81d52104604e612e0d59c1b27ded74..f5ba71477982d4ec6b727d1312aaf36633269a1c 100644 (file)
@@ -1,4 +1,7 @@
 #include "checkpoint.qh"
+
+#ifdef SVQC
+
 /**
     turret_checkpoint
 **/
@@ -75,3 +78,5 @@ spawnfunc(walker_checkpoint)
     this.classname = "turret_checkpoint";
     spawnfunc_turret_checkpoint(this);
 }
+
+#endif
index 11d5e5d7202de6b76901498463bd58938edc8708..d75e4a925ce0bf30c781a40f825cdc5b4ffa82f0 100644 (file)
@@ -112,7 +112,7 @@ void turret_draw2d(entity this)
        if(rgb == '0 0 0')
        {
                this.teamradar_color = '1 0 1';
-               LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
+               LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
        }
 
        txt = this.netname;
index 7d1a81d490b1be213ad7d12faa20ca3d6e2d6355..effabeac275ded29fed4b17d370f6e56e7cd5fb2 100644 (file)
@@ -3,6 +3,8 @@
 //  Turret Config Generator
 // ==========================
 
+#ifdef SVQC
+
 void T_Config_Queue_Swap(float root, float child, entity pass)
 {
        string oldroot = config_queue[root];
@@ -48,7 +50,7 @@ void Dump_Turret_Settings()
                TUR_CONFIG_WRITETOFILE("// }}}\n")
 
                // step 5: debug info
-               LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, it.turret_name, TUR_CONFIG_COUNT));
+               LOG_INFOF("#%d: %s: %d settings...", i, it.turret_name, TUR_CONFIG_COUNT);
                totalsettings += TUR_CONFIG_COUNT;
        });
 
@@ -58,5 +60,7 @@ void Dump_Turret_Settings()
                config_queue[j] = string_null;
 
        // extra information
-       LOG_INFO(sprintf("Totals: %d turrets, %d settings\n", (Turrets_COUNT - 1), totalsettings));
+       LOG_INFOF("Totals: %d turrets, %d settings", (Turrets_COUNT - 1), totalsettings);
 }
+
+#endif
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 152a7d6a2715e362fde40fca3be8f20497ccc511..d64616f50354ca6ad092c4a0b1dae10a6ef8881b 100644 (file)
@@ -1,4 +1,7 @@
 #include "targettrigger.qh"
+
+#ifdef SVQC
+
 spawnfunc(turret_targettrigger);
 void turret_targettrigger_touch(entity this, entity toucher);
 
@@ -24,3 +27,5 @@ spawnfunc(turret_targettrigger)
 
     settouch(this, turret_targettrigger_touch);
 }
+
+#endif
index 403a0ddf6c2bedcefa2a23b8e20d993710137786..5625d23fc935e8be8453afb9517ef40e333243a8 100644 (file)
@@ -1,7 +1,5 @@
 #include "ewheel.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 float autocvar_g_turrets_unit_ewheel_speed_fast;
@@ -245,4 +243,3 @@ void ewheel_draw(entity this)
         }
 
 #endif // CSQC
-#endif
index e77b534022423e2ae72de04f2de5e4822c2de027..fc22c3086c861505e57b49baff564297a74a1b26 100644 (file)
@@ -1,7 +1,5 @@
 #include "ewheel_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 void turret_initparams(entity);
@@ -36,5 +34,3 @@ METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, .entity weapon
 }
 
 #endif
-
-#endif
index ab6e5f5cb67afe9bec1f43fb0adf6a88df0a309f..6a81bc2c9919d28d04c8fea015593803a51b27cd 100644 (file)
@@ -1,7 +1,5 @@
 #include "flac.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_flac) { if (!turret_initialize(this, TUR_FLAC)) delete(this); }
@@ -15,5 +13,3 @@ METHOD(Flac, tr_setup, void(Flac this, entity it))
 }
 
 #endif
-
-#endif
index 357bba975d853cfcd6cb50af66692cb16165a099..10d53aa08f527e64dd53ce05d92a0329d54d8465 100644 (file)
@@ -1,7 +1,5 @@
 #include "flac_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 void turret_flac_projectile_think_explode(entity this);
@@ -53,5 +51,3 @@ void turret_flac_projectile_think_explode(entity this)
 }
 
 #endif
-
-#endif
index 3c468535c86f87962ef5894662f8243e3793b540..32ac81d586cc7ecc9035d7accddf5aada188bbdb 100644 (file)
@@ -1,6 +1,5 @@
 #include "fusionreactor.qh"
 
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 bool turret_fusionreactor_firecheck(entity this)
 {
@@ -53,4 +52,3 @@ METHOD(FusionReactor, tr_setup, void(FusionReactor this, entity it))
 }
 
 #endif
-#endif
index 88a0170ea67d4d556f7dd8a72c483615d0af8016..15dc36b3d7eadeb107446c3d257bd9c5a5a08eb9 100644 (file)
@@ -1,7 +1,5 @@
 #include "hellion.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_hellion) { if (!turret_initialize(this, TUR_HELLION)) delete(this); }
@@ -23,4 +21,3 @@ METHOD(Hellion, tr_setup, void(Hellion this, entity it))
 }
 
 #endif
-#endif
index ea392ec4ed9540f94fde30c999c5ae8aed3c1841..a1065dec1b12033916dc30437a2a9a92c9be62bd 100644 (file)
@@ -1,7 +1,5 @@
 #include "hellion_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 float autocvar_g_turrets_unit_hellion_shot_speed_gain;
@@ -103,5 +101,3 @@ void turret_hellion_missile_think(entity this)
 }
 
 #endif
-
-#endif
index 255821e1c368209aa8d229703f6c5dedcc8ec7ba..811e386f5b4e38bc85cb90f8f0ade95e0e3b3e8c 100644 (file)
@@ -1,7 +1,5 @@
 #include "hk.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 #ifdef TURRET_DEBUG_HK
@@ -47,4 +45,3 @@ bool turret_hk_addtarget(entity this, entity e_target,entity e_sender)
 }
 
 #endif // SVQC
-#endif
index 5a2f05a4832219fdc3ed9c51a3238c79de625f49..9a243adaa73c6903cad83ea22e1eb9155bb84d44 100644 (file)
@@ -1,7 +1,5 @@
 #include "hk_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 float autocvar_g_turrets_unit_hk_shot_speed;
@@ -278,5 +276,3 @@ bool hk_is_valid_target(entity this, entity proj, entity targ)
 }
 
 #endif
-
-#endif
index db3cb47bf2fbb6cc3d173ccce2edba39f3ea6072..a2ee1def6b8a68bb65671c545f33dc5871574718 100644 (file)
@@ -1,7 +1,5 @@
 #include "machinegun.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_machinegun) { if (!turret_initialize(this, TUR_MACHINEGUN)) delete(this); }
@@ -16,4 +14,3 @@ METHOD(MachineGunTurret, tr_setup, void(MachineGunTurret this, entity it))
 }
 
 #endif // SVQC
-#endif
index c60cd3b37e11ff245e3877dd76c638585079ce3c..846b5234376a0c7bcaf50c1e85224e49846d1eff 100644 (file)
@@ -1,7 +1,5 @@
 #include "machinegun_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 void W_MachineGun_MuzzleFlash(entity actor, .entity weaponentity);
@@ -26,5 +24,3 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .ent
 }
 
 #endif
-
-#endif
index 472a0cb09a5c410ad5ae5a7060e410799189ccd4..2315012b11379bed39838e697795a6345569dbf5 100644 (file)
@@ -1,7 +1,5 @@
 #include "mlrs.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_mlrs) { if (!turret_initialize(this, TUR_MLRS)) delete(this); }
@@ -27,4 +25,3 @@ METHOD(MLRSTurret, tr_setup, void(MLRSTurret this, entity it))
 }
 
 #endif // SVQC
-#endif
index cfd51c732076b2686fc9ae12e96adae33db462ea..ccf309aaf7c31ef8015b788b17d3a112551f49f6 100644 (file)
@@ -1,7 +1,5 @@
 #include "mlrs_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 SOUND(MLRSTurretAttack_FIRE, W_Sound("electro_fire"));
 METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
@@ -27,5 +25,3 @@ METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, .entity we
 }
 
 #endif
-
-#endif
index 31ece9cb2b8b86d7946d9c0eaf45634910e09036..9c93a6e89a742313b097ba23fd1a03a3267a16df 100644 (file)
@@ -1,7 +1,5 @@
 #include "phaser.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_phaser) { if (!turret_initialize(this, TUR_PHASER)) delete(this); }
@@ -45,4 +43,3 @@ bool turret_phaser_firecheck(entity this)
 }
 
 #endif
-#endif
index bf901d886a77e407292d8d208d20f37819f5b8cc..3fb34fb14c2b9b1d97f7c0a6ad3008ba3e6011af 100644 (file)
@@ -1,7 +1,5 @@
 #include "phaser_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 void beam_think(entity this);
 
@@ -90,5 +88,3 @@ void beam_think(entity this)
 }
 
 #endif
-
-#endif
index 7317930c9005001578140ceb2233352393215ee4..96fa81f8eee98cdbbf72ce9761e2f5eaf2c1c717 100644 (file)
@@ -1,7 +1,5 @@
 #include "plasma.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_plasma) { if (!turret_initialize(this, TUR_PLASMA)) delete(this); }
@@ -46,4 +44,3 @@ METHOD(PlasmaTurret, tr_setup, void(PlasmaTurret this, entity it))
 }
 
 #endif
-#endif
index 3efe969f31afe79d73702e014c770032ac59bc86..2a6f997cf3f009f533858d9099c0fb3492e2b7c3 100644 (file)
@@ -1,7 +1,5 @@
 #include "plasma_dual.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_plasma_dual) { if (!turret_initialize(this, TUR_PLASMA_DUAL)) delete(this); }
@@ -34,4 +32,3 @@ METHOD(DualPlasmaTurret, tr_think, void(DualPlasmaTurret thistur, entity it))
 }
 
 #endif
-#endif
index f6f717f85ff6b612974ec854de8888913199aa20..7de7406e2da1fe195f38bf1b06caf70cbcfb54aa 100644 (file)
@@ -1,7 +1,5 @@
 #include "plasma_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 SOUND(PlasmaAttack_FIRE, W_Sound("electro_fire"));
 METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
@@ -23,5 +21,3 @@ METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, .entity weapon
 }
 
 #endif
-
-#endif
index 249fe18eb92042465d499a947929c672aee49fa3..4c27bc9acce8cd112e0426e0062a0cceee1e115e 100644 (file)
@@ -1,7 +1,5 @@
 #include "tesla.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 spawnfunc(turret_tesla) { if (!turret_initialize(this, TUR_TESLA)) delete(this); }
@@ -88,4 +86,3 @@ bool turret_tesla_firecheck(entity this)
 }
 
 #endif
-#endif
index 7e6fda78ab8df41381679ad98b159fd1d6c24f98..88ca4db9702f491d237edd4adade82a526b0c9af 100644 (file)
@@ -1,7 +1,5 @@
 #include "tesla_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 entity toast(entity actor, entity from, float range, float damage);
@@ -84,5 +82,3 @@ entity toast(entity actor, entity from, float range, float damage)
 }
 
 #endif
-
-#endif
index d8c0a675d5c0b1175be5a3f6d79c6e086df88f3d..415d5dfeef16fd315cd5c08d7dc269be2c199bd9 100644 (file)
@@ -1,7 +1,5 @@
 #include "walker.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 float autocvar_g_turrets_unit_walker_melee_damage;
@@ -78,7 +76,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)
@@ -643,4 +641,3 @@ void walker_draw(entity this)
         }
 
 #endif // CSQC
-#endif
index 9bcf902902f2b43f07efe0cba526d08b086f3a64..b418ce40d32240445a75560a8e35bbbd521f89ff 100644 (file)
@@ -1,7 +1,5 @@
 #include "walker_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 SOUND(WalkerTurretAttack_FIRE, W_Sound("electro_fire"));
@@ -24,5 +22,3 @@ METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
 }
 
 #endif
-
-#endif
index 5fef364580860b256d624eb552b32a13c55fc098..d4cbb4fb1da280665f62c00f00dc3b340f251909 100644 (file)
@@ -1,4 +1,7 @@
 #include "util.qh"
+
+#ifdef SVQC
+
 /*
 * Update this.tur_shotorg by getting up2date bone info
 * NOTICE this func overwrites the global v_forward, v_right and v_up vectors.
@@ -210,3 +213,5 @@ void paint_target3(vector where, float f_size, vector v_color, float f_time)
        SUB_SetFade(e,time,f_time);
 }
 #endif
+
+#endif
index be207b711e85748328723a6d31e2919bf5cc6403..4c84f268d3024679102f158cf5e017bf229ff28a 100644 (file)
@@ -1,4 +1,8 @@
 #pragma once
 
+#ifdef SVQC
+
 float turret_tag_fire_update(entity this);
 void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax, float bforce, float f_dmg, float f_velfactor, float deathtype);
+
+#endif
index 6340c007ad19cc3c62d947f61233859bb0026036..deba86c289dc8f4966407fa6dd6f7c4f9e308ed8 100644 (file)
@@ -336,17 +336,19 @@ STATIC_INIT(compressShortVector)
 
        if(cvar("developer"))
        {
-               LOG_INFO("Verifying vector compression table...\n");
+               LOG_INFO("Verifying vector compression table...");
                for(i = 0x0F00; i < 0xFFFF; ++i)
                        if(i != compressShortVector(decompressShortVector(i)))
                        {
-                               LOG_INFO("BROKEN vector compression: ", ftos(i));
-                               LOG_INFO(" -> ", vtos(decompressShortVector(i)));
-                               LOG_INFO(" -> ", ftos(compressShortVector(decompressShortVector(i))));
-                               LOG_INFO("\n");
+                               LOG_INFOF(
+                                   "BROKEN vector compression: %s -> %s -> %s",
+                                   ftos(i),
+                                   vtos(decompressShortVector(i)),
+                                   ftos(compressShortVector(decompressShortVector(i)))
+                );
                                error("b0rk");
                        }
-               LOG_INFO("Done.\n");
+               LOG_INFO("Done.");
        }
 }
 
@@ -596,7 +598,7 @@ float cvar_settemp(string tmp_cvar, string tmp_value)
 
        if(!cvar_type(tmp_cvar))
        {
-               LOG_INFOF("Error: cvar %s doesn't exist!\n", tmp_cvar);
+               LOG_INFOF("Error: cvar %s doesn't exist!", tmp_cvar);
                return 0;
        }
 
@@ -638,7 +640,7 @@ int cvar_settemp_restore()
                        ++j;
                }
                else
-                       LOG_INFOF("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", it.netname);
+                       LOG_INFOF("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.", it.netname);
        });
 
 #else
@@ -652,7 +654,7 @@ int cvar_settemp_restore()
                        ++j;
                }
                else
-                       print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname));
+                       print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.", e.netname));
        }
 #endif
 
@@ -1362,7 +1364,7 @@ void m_shutdown()
 {
        if(shutdown_running)
        {
-               LOG_INFO("Recursive shutdown detected! Only restoring cvars...\n");
+               LOG_INFO("Recursive shutdown detected! Only restoring cvars...");
        }
        else
        {
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;
diff --git a/qcsrc/common/vehicles/_all.inc b/qcsrc/common/vehicles/_all.inc
deleted file mode 100644 (file)
index 8bc63f7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "_all.qh"
-#include "_mod.inc"
diff --git a/qcsrc/common/vehicles/_all.qh b/qcsrc/common/vehicles/_all.qh
deleted file mode 100644 (file)
index 947026d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#pragma once
-#include "_mod.qh"
index ed26659daa5c9ed37cbb384c8d9a2823e73d6c05..b358830dfe12d0df70392ff8ac25870bfe4821e0 100644 (file)
@@ -7,3 +7,5 @@
 #ifdef SVQC
     #include <common/vehicles/sv_vehicles.qc>
 #endif
+
+#include <common/vehicles/vehicle/_mod.inc>
index 4892b0f317baad43e5bc15d6e8fef0d91931f2ff..755a9a049f7e82c79dc229ec6338301805980cd2 100644 (file)
@@ -7,3 +7,5 @@
 #ifdef SVQC
     #include <common/vehicles/sv_vehicles.qh>
 #endif
+
+#include <common/vehicles/vehicle/_mod.qh>
index 4aef11cad56ed35fc49ca0b037842aceb861a74b..eed249b978d6d5fbd11f5187321853d94af8d64e 100644 (file)
@@ -1,17 +1,3 @@
 #include "all.qh"
-#ifndef VEHICLES_ALL_C
-#define VEHICLES_ALL_C
 
 REGISTER_NET_LINKED(ENT_CLIENT_AUXILIARYXHAIR)
-
-#if defined(SVQC)
-       #include "sv_vehicles.qc"
-#elif defined(CSQC)
-       #include "cl_vehicles.qc"
-#endif
-
-#define IMPLEMENTATION
-#include "vehicle/_mod.inc"
-#undef IMPLEMENTATION
-
-#endif
index 158492f661e7e1326cc248283c3b4841bb64c76a..ed44be777bf369acd3cc2ad697b89cb03b5bfd11 100644 (file)
@@ -20,4 +20,4 @@ const int VEH_FIRST = 1;
 
 REGISTER_VEHICLE(Null, NEW(Vehicle));
 
-#include "vehicle/_mod.inc"
+#include "vehicle/_mod.qh"
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 653532b43dd9ce1f8a143e51770c06120359a9f0..22e2e4859dd170c94f3bf03c571822bb9c496052 100644 (file)
@@ -67,6 +67,8 @@ const float VHSF_FACTORY = 2;
 .int hud = _STAT(HUD);
 .float dmg_time;
 
+.float play_time;
+
 .int volly_counter;
 
 const int MAX_AXH = 4;
index 1c9e6e1a41d549166b53d6c9f3ec004438a1dc07..018e1a17db9cf3ee0277d7097ec8188bcb7ce2f0 100644 (file)
@@ -1,7 +1,5 @@
 #include "bumblebee.qh"
 
-#ifdef IMPLEMENTATION
-
 const float BRG_SETUP = 2;
 const float BRG_START = 4;
 const float BRG_END = 8;
@@ -439,9 +437,9 @@ bool bumblebee_pilot_frame(entity this, float dt)
 
        // Pitch
        ftmp = 0;
-       if(this.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
+       if(CS(this).movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = 4;
-       else if(this.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+       else if(CS(this).movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = -8;
 
        newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
@@ -455,19 +453,19 @@ bool bumblebee_pilot_frame(entity this, float dt)
        makevectors('0 1 0' * vehic.angles.y);
        newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
 
-       if(this.movement.x != 0)
+       if(CS(this).movement.x != 0)
        {
-               if(this.movement.x > 0)
+               if(CS(this).movement.x > 0)
                        newvel += v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
-               else if(this.movement.x < 0)
+               else if(CS(this).movement.x < 0)
                        newvel -= v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
        }
 
-       if(this.movement.y != 0)
+       if(CS(this).movement.y != 0)
        {
-               if(this.movement.y < 0)
+               if(CS(this).movement.y < 0)
                        newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
-               else if(this.movement.y > 0)
+               else if(CS(this).movement.y > 0)
                        newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
                ftmp = newvel * v_right;
                ftmp *= dt * 0.1;
@@ -486,7 +484,7 @@ bool bumblebee_pilot_frame(entity this, float dt)
                newvel +=  v_up * autocvar_g_vehicle_bumblebee_speed_up;
 
        vehic.velocity  += newvel * dt;
-       this.velocity = this.movement  = vehic.velocity;
+       this.velocity = CS(this).movement  = vehic.velocity;
 
 
        if(autocvar_g_vehicle_bumblebee_healgun_locktime)
@@ -968,4 +966,3 @@ METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
 }
 
 #endif
-#endif
index 889ca471593f4930741e4816a2267d07e6b7231e..fa05c6a6f12dbd46343c941148c46b4c14db0366 100644 (file)
@@ -1,7 +1,5 @@
 #include "bumblebee_weapons.qh"
 
-#ifdef IMPLEMENTATION
-
 REGISTER_NET_LINKED(ENT_CLIENT_BUMBLE_RAYGUN)
 
 #ifdef SVQC
@@ -132,5 +130,3 @@ void bumble_raygun_draw(entity this)
 }
 
 #endif
-
-#endif
index 01488e624e2c0781580f8fd782dc1cc7e14b2f17..8dbfae4677221eb70a7d63feb206b3f9724f3f4a 100644 (file)
@@ -1,7 +1,5 @@
 #include "racer.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 #include <common/triggers/trigger/impulse.qh>
 
@@ -198,17 +196,17 @@ bool racer_frame(entity this, float dt)
        vector df = vehic.velocity * -autocvar_g_vehicle_racer_friction;
        //vehic.velocity_z = ftmp;
 
-       if(this.movement)
+       if(CS(this).movement)
        {
                if(cont & DPCONTENTS_LIQUIDSMASK)
                {
-                       if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
-                       if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
+                       if(CS(this).movement_x) { df += v_forward * ((CS(this).movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
+                       if(CS(this).movement_y) { df += v_right * ((CS(this).movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
                }
                else
                {
-                       if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
-                       if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
+                       if(CS(this).movement_x) { df += v_forward * ((CS(this).movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
+                       if(CS(this).movement_y) { df += v_right * ((CS(this).movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
                }
 
 #ifdef SVQC
@@ -284,7 +282,7 @@ bool racer_frame(entity this, float dt)
                dforce = autocvar_g_vehicle_racer_water_downforce;
 
        df -= v_up * (vlen(vehic.velocity) * dforce);
-       this.movement = vehic.velocity += df * dt;
+       CS(this).movement = vehic.velocity += df * dt;
 
 #ifdef SVQC
 
@@ -637,5 +635,3 @@ METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
     AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Rocket
 #endif
 }
-
-#endif
index 838f0cf42773b81469326c48d17dfe88e32c9268..02015eb8daba23c239bee5794c9734b206b2decc 100644 (file)
@@ -1,7 +1,5 @@
 #include "racer_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
@@ -169,5 +167,3 @@ void racer_rocket_groundhugger(entity this)
 }
 
 #endif
-
-#endif
index da556c4fc5a53a2fe991fcbf5ced0ee9562c5f24..d7ef38abcad18d731ee7337e5f7a17bcc9f4c7f4 100644 (file)
@@ -1,7 +1,5 @@
 #include "raptor.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 bool autocvar_g_vehicle_raptor = true;
@@ -204,8 +202,8 @@ bool raptor_frame(entity this, float dt)
 
        // Pitch
        ftmp = 0;
-       if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
-       else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
+       if(CS(this).movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
+       else if(CS(this).movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
 
        df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
        ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
@@ -222,22 +220,22 @@ bool raptor_frame(entity this, float dt)
 
        df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
 
-       if(this.movement_x != 0)
+       if(CS(this).movement_x != 0)
        {
-               if(this.movement_x > 0)
+               if(CS(this).movement_x > 0)
                        df += v_forward  * autocvar_g_vehicle_raptor_speed_forward;
-               else if(this.movement_x < 0)
+               else if(CS(this).movement_x < 0)
                        df -= v_forward  * autocvar_g_vehicle_raptor_speed_forward;
        }
 
-       if(this.movement_y != 0)
+       if(CS(this).movement_y != 0)
        {
-               if(this.movement_y < 0)
+               if(CS(this).movement_y < 0)
                        df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
-               else if(this.movement_y > 0)
+               else if(CS(this).movement_y > 0)
                        df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
 
-               vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
+               vehic.angles_z = bound(-30,vehic.angles_z + (CS(this).movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
        }
        else
        {
@@ -252,7 +250,7 @@ bool raptor_frame(entity this, float dt)
                df +=  v_up * autocvar_g_vehicle_raptor_speed_up;
 
        vehic.velocity  += df * dt;
-       this.velocity = this.movement  = vehic.velocity;
+       this.velocity = CS(this).movement  = vehic.velocity;
        setorigin(this, vehic.origin + '0 0 32');
        this.oldorigin = this.origin; // negate fall damage
 
@@ -833,4 +831,3 @@ METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
 }
 
 #endif
-#endif
index 5cb0f271c52fec0effb514dff201983fa2069c02..514d67c0e6cd5b31c0ea805c39d0200c26fd2c2b 100644 (file)
@@ -1,7 +1,5 @@
 #include "raptor_weapons.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
@@ -259,5 +257,3 @@ void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
 }
 
 #endif
-
-#endif
index 164371e131b5274eef7f81c41e7d74f4ffcf9911..57486a2f38bf22987abcdb403db3a68086c51214 100644 (file)
@@ -1,7 +1,5 @@
 #include "spiderbot.qh"
 
-#ifdef IMPLEMENTATION
-
 const int SBRM_FIRST = 1;
 const int SBRM_VOLLY = 1;
 const int SBRM_GUIDE = 2;
@@ -123,9 +121,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,14 +131,14 @@ 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';
-                       if(this.movement_x > 0) movefix_x = 1;
-                       if(this.movement_x < 0) movefix_x = -1;
-                       if(this.movement_y > 0) movefix_y = 1;
-                       if(this.movement_y < 0) movefix_y = -1;
+                       if(CS(this).movement_x > 0) movefix_x = 1;
+                       if(CS(this).movement_x < 0) movefix_x = -1;
+                       if(CS(this).movement_y > 0) movefix_y = 1;
+                       if(CS(this).movement_y < 0) movefix_y = -1;
 
                        vector rt = movefix_y * v_right;
                        vector sd = movefix_x * v_forward;
@@ -154,7 +152,7 @@ bool spiderbot_frame(entity this, float dt)
                }
                else if(time >= vehic.jump_delay)
                {
-                       if(!this.movement)
+                       if(!CS(this).movement)
                        {
                                if(IS_ONGROUND(vehic))
                                {
@@ -172,7 +170,7 @@ bool spiderbot_frame(entity this, float dt)
                        else
                        {
                                // Turn Body
-                               if(this.movement_x == 0 && this.movement_y != 0)
+                               if(CS(this).movement_x == 0 && CS(this).movement_y != 0)
                                        ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * PHYS_INPUT_FRAMETIME;
                                else
                                        ftmp = autocvar_g_vehicle_spiderbot_turnspeed * PHYS_INPUT_FRAMETIME;
@@ -181,23 +179,23 @@ bool spiderbot_frame(entity this, float dt)
                                vehic.angles_y = anglemods(vehic.angles_y + ftmp);
                                vehic.tur_head.angles_y -= ftmp;
 
-                               if(this.movement_x != 0)
+                               if(CS(this).movement_x != 0)
                                {
-                                       if(this.movement_x > 0)
+                                       if(CS(this).movement_x > 0)
                                        {
-                                               this.movement_x = 1;
+                                               CS(this).movement_x = 1;
                                                if(IS_ONGROUND(vehic))
                                                        vehic.frame = 0;
                                        }
-                                       else if(this.movement_x < 0)
+                                       else if(CS(this).movement_x < 0)
                                        {
-                                               this.movement_x = -1;
+                                               CS(this).movement_x = -1;
                                                if(IS_ONGROUND(vehic))
                                                        vehic.frame = 1;
                                        }
-                                       this.movement_y = 0;
+                                       CS(this).movement_y = 0;
                                        float oldvelz = vehic.velocity_z;
-                                       movelib_move_simple(vehic, normalize(v_forward * this.movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       movelib_move_simple(vehic, normalize(v_forward * CS(this).movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
                                        vehic.velocity_z = oldvelz;
                                        float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
                                        if(vehic.velocity_z <= 20) // not while jumping
@@ -211,23 +209,23 @@ bool spiderbot_frame(entity this, float dt)
                                                //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
                                        }
                                }
-                               else if(this.movement_y != 0)
+                               else if(CS(this).movement_y != 0)
                                {
-                                       if(this.movement_y < 0)
+                                       if(CS(this).movement_y < 0)
                                        {
-                                               this.movement_y = -1;
+                                               CS(this).movement_y = -1;
                                                if(IS_ONGROUND(vehic))
                                                        vehic.frame = 2;
                                        }
-                                       else if(this.movement_y > 0)
+                                       else if(CS(this).movement_y > 0)
                                        {
-                                               this.movement_y = 1;
+                                               CS(this).movement_y = 1;
                                                if(IS_ONGROUND(vehic))
                                                        vehic.frame = 3;
                                        }
 
                                        float oldvelz = vehic.velocity_z;
-                                       movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       movelib_move_simple(vehic, normalize(v_right * CS(this).movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
                                        vehic.velocity_z = oldvelz;
                                        float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
                                        if(vehic.velocity_z <= 20) // not while jumping
@@ -639,4 +637,3 @@ METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
 }
 
 #endif
-#endif
index 1fde99b3fcc48e87014fa84f57e1d1a0d11bd9b2..7887781ed7a74f3b5c3850dfad0cfdd64a48e398 100644 (file)
@@ -1,7 +1,5 @@
 #include "spiderbot_weapons.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 void spiderbot_rocket_artillery(entity this)
@@ -248,5 +246,3 @@ void spiderbot_rocket_do(entity this)
 }
 
 #endif
-
-#endif
index 90da2662facda4b54627b3a6f64cfee608c53bb2..d6d7d9facfb2edc3f7f32c39138119723a47f5b0 100644 (file)
@@ -17,12 +17,12 @@ void viewloc_PlayerPhysics(entity this)
                if(this.viewloc.goalentity == this.viewloc.enemy)
                        return; // we can't side-scroll in this case
 
-               vector old_movement = this.movement;
-               this.movement_x = old_movement_y;
-               this.movement_y = 0;
+               vector old_movement = PHYS_CS(this).movement;
+               PHYS_CS(this).movement_x = old_movement_y;
+               PHYS_CS(this).movement_y = 0;
 
-               if(this.movement_x < 0)
-                       this.movement_x = -this.movement_x;
+               if(PHYS_CS(this).movement_x < 0)
+                       PHYS_CS(this).movement_x = -PHYS_CS(this).movement_x;
 
                vector level_start, level_end;
                level_start = this.viewloc.enemy.origin;
@@ -31,9 +31,9 @@ void viewloc_PlayerPhysics(entity this)
                forward = vectoangles(normalize(level_end - level_start));
                backward = vectoangles(normalize(level_start - level_end));
 
-               if(this.movement_x < 0) // left
+               if(PHYS_CS(this).movement_x < 0) // left
                        this.angles_y = backward_y;
-               if(this.movement_x > 0) // right
+               if(PHYS_CS(this).movement_x > 0) // right
                        this.angles_y = forward_y;
 
                if(old_movement_x > 0)
index 99c7225ac1a4402f475e907a820d07b6d97bfc3f..4da01579f19b55edbf4f22a89d609e4420263047 100644 (file)
@@ -3,25 +3,25 @@
 // IF YOU DISREGARD THIS NOTICE, I'LL KILL YOU WITH THE @!#%'N TUBA
 
 // core weapons
-#include "weapon/blaster.qc"
-#include "weapon/shotgun.qc"
-#include "weapon/machinegun.qc"
-#include "weapon/mortar.qc"
-#include "weapon/minelayer.qc"
-#include "weapon/electro.qc"
-#include "weapon/crylink.qc"
-#include "weapon/vortex.qc"
-#include "weapon/hagar.qc"
-#include "weapon/devastator.qc"
+#include "weapon/blaster.qh"
+#include "weapon/shotgun.qh"
+#include "weapon/machinegun.qh"
+#include "weapon/mortar.qh"
+#include "weapon/minelayer.qh"
+#include "weapon/electro.qh"
+#include "weapon/crylink.qh"
+#include "weapon/vortex.qh"
+#include "weapon/hagar.qh"
+#include "weapon/devastator.qh"
 
 // other weapons
-#include "weapon/porto.qc"
-#include "weapon/vaporizer.qc"
-#include "weapon/hook.qc"
-#include "weapon/hlac.qc"
-#include "weapon/tuba.qc"
-#include "weapon/rifle.qc"
-#include "weapon/fireball.qc"
-#include "weapon/seeker.qc"
-#include "weapon/shockwave.qc"
-#include "weapon/arc.qc"
+#include "weapon/porto.qh"
+#include "weapon/vaporizer.qh"
+#include "weapon/hook.qh"
+#include "weapon/hlac.qh"
+#include "weapon/tuba.qh"
+#include "weapon/rifle.qh"
+#include "weapon/fireball.qh"
+#include "weapon/seeker.qh"
+#include "weapon/shockwave.qh"
+#include "weapon/arc.qh"
index 94deed55197c21056d7f8a56b03bbed4af1aa14f..afbf79eb54777d0e2852366e9d44956ff69c3966 100644 (file)
@@ -50,9 +50,9 @@
 #ifdef SVQC
        #include "config.qc"
 #endif
-#define IMPLEMENTATION
-#include "all.inc"
-#undef IMPLEMENTATION
+
+#include "weapon/_mod.inc"
+
 
 // WEAPON PLUGIN SYSTEM
 
@@ -192,14 +192,11 @@ string W_FixWeaponOrder_ForceComplete(string order)
        return W_FixWeaponOrder(order, 1);
 }
 
-void W_RandomWeapons(entity e, float n)
+void W_RandomWeapons(entity e, int n)
 {
-       int i;
-       WepSet remaining;
-       WepSet result;
-       remaining = e.weapons;
-       result = '0 0 0';
-       for (i = 0; i < n; ++i)
+       WepSet remaining = e.weapons;
+       WepSet result = '0 0 0';
+       for (int j = 0; j < n; ++j)
        {
                RandomSelection_Init();
                FOREACH(Weapons, it != WEP_Null, {
@@ -642,12 +639,12 @@ CLIENT_COMMAND(weapon_find, "Show spawn locations of a weapon")
                }
                default:
                {
-                       LOG_INFOF("Incorrect parameters for ^2%s^7\n", "weapon_find");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", "weapon_find");
                }
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 cl_cmd weapon_find weapon\n");
-                       LOG_INFO("  Where 'weapon' is the lowercase weapon name, 'all' or 'unowned'.\n");
+                       LOG_INFO("Usage:^3 cl_cmd weapon_find weapon");
+                       LOG_INFO("  Where 'weapon' is the lowercase weapon name, 'all' or 'unowned'.");
                        return;
                }
        }
index 83fe0c19673ccc513463f50eb13145c90a8d5f1b..beaa6cb48a3773e2555b4817177696242b7b7e43 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"
@@ -66,17 +64,17 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPON
             if(wep_config_file >= 0)
             {
                 Dump_Weapon_Settings();
-                LOG_INFO(sprintf("Dumping weapons... File located in ^2data/data/%s^7.\n", filename));
+                LOG_INFOF("Dumping weapons... File located in ^2data/data/%s^7.", filename);
                 fclose(wep_config_file);
                 wep_config_file = -1;
                 wep_config_alsoprint = -1;
             }
             else
             {
-                LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+                LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
             }
             #else
-            LOG_INFO(_("Weapons dump command only works with sv_cmd.\n"));
+            LOG_INFO(_("Weapons dump command only works with sv_cmd."));
             #endif
             return;
         }
@@ -84,10 +82,10 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPON
         default:
         case CMD_REQUEST_USAGE:
         {
-            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]"));
-            LOG_INFO("  Where 'filename' is the file to write (default is weapons_dump.cfg),\n");
-            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-            LOG_INFO("  if left blank, it will only write to default.\n");
+            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]");
+            LOG_INFO("  Where 'filename' is the file to write (default is weapons_dump.cfg),");
+            LOG_INFO("  if supplied with '-' output to console as well as default,");
+            LOG_INFO("  if left blank, it will only write to default.");
             return;
         }
     }
index 513af5209d670cac485f046342922c5e003c0bf3..3323d8e36a5372eb6041e2348010a735b5f6e251 100644 (file)
@@ -57,7 +57,7 @@ vector damage_explosion_calcpush(vector explosion_f, vector target_v, float spee
        v = explosion_calcpush(explosion_f * speedfactor, m, target_v, 1, 0);
        // the factor we then get is:
        //   1
-       LOG_INFOF("MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f\n",
+       LOG_INFOF("MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f",
                m,
                target_v, target_v + v,
                target_v * target_v, m * explosion_f * speedfactor * explosion_f * speedfactor, target_v * target_v + m * explosion_f * speedfactor * explosion_f * speedfactor,
index a8194772cc69fad609edcd5e7cd1a299f69a49e8..d2443f1670d360767cbc6721f6a2722d2764997c 100644 (file)
@@ -48,7 +48,7 @@ void Dump_Weapon_Settings()
                WEP_CONFIG_WRITETOFILE("// }}}\n");
 
                // step 5: debug info
-               LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, it.m_name, WEP_CONFIG_COUNT));
+               LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
                totalweapons += 1;
                totalsettings += WEP_CONFIG_COUNT;
        });
@@ -59,5 +59,5 @@ void Dump_Weapon_Settings()
                config_queue[x] = string_null;
 
        // extra information
-       LOG_INFO(sprintf("Totals: %d weapons, %d settings\n", totalweapons, totalsettings));
+       LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings);
 }
index 634fbf812cc8133ef060ec68c697eeeefd034ae5..4be22446bf9dae2f8a314138be4e4b4fd4909426 100644 (file)
@@ -4,9 +4,11 @@
 #include <common/stats.qh>
 
 #ifdef SVQC
-#include <common/effects/qc/all.qh>
+#include <common/effects/qc/_mod.qh>
 #endif
 
+USING(WepSet, vector);
+
 const int MAX_WEAPONSLOTS = 2;
 .entity weaponentities[MAX_WEAPONSLOTS];
 
@@ -196,6 +198,7 @@ const int WEP_TYPE_MELEE_PRI      = 0x400; // primary attack is melee swing (for
 const int WEP_TYPE_MELEE_SEC      = 0x800; // secondary attack is melee swing (for animation)
 const int WEP_FLAG_DUALWIELD      = 0x1000; // weapon can be dual wielded
 const int WEP_FLAG_NODUAL         = 0x2000; // weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything
+const int WEP_FLAG_PENETRATEWALLS = 0x4000; // weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO)
 
 // variables:
 string weaponorder_byid;
@@ -208,7 +211,7 @@ string W_NumberWeaponOrder(string order);
 string W_FixWeaponOrder_BuildImpulseList(string o);
 string W_FixWeaponOrder_AllowIncomplete(entity this, string order);
 string W_FixWeaponOrder_ForceComplete(string order);
-void W_RandomWeapons(entity e, float n);
+void W_RandomWeapons(entity e, int n);
 
 string GetAmmoPicture(.int ammotype);
 
index ed5c966f1b17609b5817dcc3a01455e3a63ae996..47b92cc9f3a3819f27b6fff8bbb9be1f5496d664 100644 (file)
@@ -1,149 +1,5 @@
 #include "arc.qh"
-#ifndef IMPLEMENTATION
-CLASS(Arc, Weapon)
-/* ammotype  */ ATTRIB(Arc, ammo_field, .int, ammo_cells);
-/* impulse   */ ATTRIB(Arc, impulse, int, 3);
-/* flags     */ ATTRIB(Arc, spawnflags, int, WEP_TYPE_HITSCAN);
-/* rating    */ ATTRIB(Arc, bot_pickupbasevalue, float, 8000);
-/* color     */ ATTRIB(Arc, wpcolor, vector, '1 1 1');
-/* modelname */ ATTRIB(Arc, mdl, string, "arc");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Arc, m_model, Model, MDL_ARC_ITEM);
-#endif
-/* crosshair */ ATTRIB(Arc, w_crosshair, string, "gfx/crosshairhlac");
-/* crosshair */ ATTRIB(Arc, w_crosshair_size, float, 0.7);
-/* wepimg    */ ATTRIB(Arc, model2, string, "weaponarc");
-/* refname   */ ATTRIB(Arc, netname, string, "arc");
-/* wepname   */ ATTRIB(Arc, m_name, string, _("Arc"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, bolt, float, NONE) \
-               P(class, prefix, bolt_ammo, float, NONE) \
-        P(class, prefix, bolt_damageforcescale, float, NONE) \
-        P(class, prefix, bolt_damage, float, NONE) \
-        P(class, prefix, bolt_edgedamage, float, NONE) \
-        P(class, prefix, bolt_force, float, NONE) \
-        P(class, prefix, bolt_health, float, NONE) \
-        P(class, prefix, bolt_lifetime, float, NONE) \
-        P(class, prefix, bolt_radius, float, NONE) \
-        P(class, prefix, bolt_refire, float, NONE) \
-        P(class, prefix, bolt_speed, float, NONE) \
-        P(class, prefix, bolt_spread, float, NONE) \
-               P(class, prefix, beam_ammo, float, NONE) \
-        P(class, prefix, beam_animtime, float, NONE) \
-        P(class, prefix, beam_botaimlifetime, float, NONE) \
-        P(class, prefix, beam_botaimspeed, float, NONE) \
-        P(class, prefix, beam_damage, float, NONE) \
-        P(class, prefix, beam_degreespersegment, float, NONE) \
-        P(class, prefix, beam_distancepersegment, float, NONE) \
-        P(class, prefix, beam_falloff_halflifedist, float, NONE) \
-        P(class, prefix, beam_falloff_maxdist, float, NONE) \
-        P(class, prefix, beam_falloff_mindist, float, NONE) \
-        P(class, prefix, beam_force, float, NONE) \
-        P(class, prefix, beam_healing_amax, float, NONE) \
-        P(class, prefix, beam_healing_aps, float, NONE) \
-        P(class, prefix, beam_healing_hmax, float, NONE) \
-        P(class, prefix, beam_healing_hps, float, NONE) \
-        P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
-        P(class, prefix, beam_maxangle, float, NONE) \
-        P(class, prefix, beam_nonplayerdamage, float, NONE) \
-        P(class, prefix, beam_range, float, NONE) \
-        P(class, prefix, beam_refire, float, NONE) \
-        P(class, prefix, beam_returnspeed, float, NONE) \
-        P(class, prefix, beam_tightness, float, NONE) \
-        P(class, prefix, burst_ammo, float, NONE) \
-        P(class, prefix, burst_damage, float, NONE) \
-        P(class, prefix, burst_healing_aps, float, NONE) \
-        P(class, prefix, burst_healing_hps, float, NONE) \
-        P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
-        P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
-        P(class, prefix, cooldown_release, float, NONE) /* delay weapon re-use when releasing button */ \
-        P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
-        P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-    END()
-    W_PROPS(X, Arc, arc)
-#undef X
-
-ENDCLASS(Arc)
-REGISTER_WEAPON(ARC, arc, NEW(Arc));
-
-
-#ifdef GAMEQC
-const float ARC_MAX_SEGMENTS = 20;
-vector arc_shotorigin[4];
-.vector beam_start;
-.vector beam_dir;
-.vector beam_wantdir;
-.int beam_type;
-
-const int ARC_BT_MISS =        0x00;
-const int ARC_BT_WALL =        0x01;
-const int ARC_BT_HEAL =        0x02;
-const int ARC_BT_HIT =         0x03;
-const int ARC_BT_BURST_MISS =  0x10;
-const int ARC_BT_BURST_WALL =  0x11;
-const int ARC_BT_BURST_HEAL =  0x12;
-const int ARC_BT_BURST_HIT =   0x13;
-const int ARC_BT_BURSTMASK =   0x10;
-
-const int ARC_SF_SETTINGS =    BIT(0);
-const int ARC_SF_START =       BIT(1);
-const int ARC_SF_WANTDIR =     BIT(2);
-const int ARC_SF_BEAMDIR =     BIT(3);
-const int ARC_SF_BEAMTYPE =    BIT(4);
-const int ARC_SF_LOCALMASK =   ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
-#endif
-#ifdef SVQC
-.entity arc_beam;
-.bool arc_BUTTON_ATCK_prev; // for better animation control
-.float beam_prev;
-.float beam_initialized;
-.float beam_bursting;
-.float beam_teleporttime;
-.float beam_heat; // (beam) amount of heat produced
-.float arc_overheat; // (dropped arc/player) time during which it's too hot
-.float arc_cooldown; // (dropped arc/player) cooling speed
-.float arc_heat_percent = _STAT(ARC_HEAT);
-.float arc_smoke_sound;
-#endif
-#ifdef CSQC
 
-.vector beam_color;
-.float beam_alpha;
-.float beam_thickness;
-.entity beam_traileffect;
-.entity beam_hiteffect;
-.float beam_hitlight[4]; // 0: radius, 123: rgb
-.entity beam_muzzleeffect;
-.float beam_muzzlelight[4]; // 0: radius, 123: rgb
-.string beam_image;
-
-.entity beam_muzzleentity;
-
-.float beam_degreespersegment;
-.float beam_distancepersegment;
-.float beam_usevieworigin;
-.float beam_initialized;
-.float beam_maxangle;
-.float beam_range;
-.float beam_returnspeed;
-.float beam_tightness;
-.vector beam_shotorigin;
-
-entity Draw_ArcBeam_callback_entity;
-float Draw_ArcBeam_callback_last_thickness;
-vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
-vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
 
@@ -1656,4 +1512,3 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..01c4f2f6a3cf7b8a71c5a5fbdd50e0ded97fe9df 100644 (file)
@@ -1 +1,144 @@
 #pragma once
+
+CLASS(Arc, Weapon)
+/* ammotype  */ ATTRIB(Arc, ammo_field, .int, ammo_cells);
+/* impulse   */ ATTRIB(Arc, impulse, int, 3);
+/* flags     */ ATTRIB(Arc, spawnflags, int, WEP_TYPE_HITSCAN);
+/* rating    */ ATTRIB(Arc, bot_pickupbasevalue, float, 8000);
+/* color     */ ATTRIB(Arc, wpcolor, vector, '1 1 1');
+/* modelname */ ATTRIB(Arc, mdl, string, "arc");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Arc, m_model, Model, MDL_ARC_ITEM);
+#endif
+/* crosshair */ ATTRIB(Arc, w_crosshair, string, "gfx/crosshairhlac");
+/* crosshair */ ATTRIB(Arc, w_crosshair_size, float, 0.7);
+/* wepimg    */ ATTRIB(Arc, model2, string, "weaponarc");
+/* refname   */ ATTRIB(Arc, netname, string, "arc");
+/* wepname   */ ATTRIB(Arc, m_name, string, _("Arc"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, bolt, float, NONE) \
+               P(class, prefix, bolt_ammo, float, NONE) \
+        P(class, prefix, bolt_damageforcescale, float, NONE) \
+        P(class, prefix, bolt_damage, float, NONE) \
+        P(class, prefix, bolt_edgedamage, float, NONE) \
+        P(class, prefix, bolt_force, float, NONE) \
+        P(class, prefix, bolt_health, float, NONE) \
+        P(class, prefix, bolt_lifetime, float, NONE) \
+        P(class, prefix, bolt_radius, float, NONE) \
+        P(class, prefix, bolt_refire, float, NONE) \
+        P(class, prefix, bolt_speed, float, NONE) \
+        P(class, prefix, bolt_spread, float, NONE) \
+               P(class, prefix, beam_ammo, float, NONE) \
+        P(class, prefix, beam_animtime, float, NONE) \
+        P(class, prefix, beam_botaimlifetime, float, NONE) \
+        P(class, prefix, beam_botaimspeed, float, NONE) \
+        P(class, prefix, beam_damage, float, NONE) \
+        P(class, prefix, beam_degreespersegment, float, NONE) \
+        P(class, prefix, beam_distancepersegment, float, NONE) \
+        P(class, prefix, beam_falloff_halflifedist, float, NONE) \
+        P(class, prefix, beam_falloff_maxdist, float, NONE) \
+        P(class, prefix, beam_falloff_mindist, float, NONE) \
+        P(class, prefix, beam_force, float, NONE) \
+        P(class, prefix, beam_healing_amax, float, NONE) \
+        P(class, prefix, beam_healing_aps, float, NONE) \
+        P(class, prefix, beam_healing_hmax, float, NONE) \
+        P(class, prefix, beam_healing_hps, float, NONE) \
+        P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
+        P(class, prefix, beam_maxangle, float, NONE) \
+        P(class, prefix, beam_nonplayerdamage, float, NONE) \
+        P(class, prefix, beam_range, float, NONE) \
+        P(class, prefix, beam_refire, float, NONE) \
+        P(class, prefix, beam_returnspeed, float, NONE) \
+        P(class, prefix, beam_tightness, float, NONE) \
+        P(class, prefix, burst_ammo, float, NONE) \
+        P(class, prefix, burst_damage, float, NONE) \
+        P(class, prefix, burst_healing_aps, float, NONE) \
+        P(class, prefix, burst_healing_hps, float, NONE) \
+        P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
+        P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
+        P(class, prefix, cooldown_release, float, NONE) /* delay weapon re-use when releasing button */ \
+        P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
+        P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, Arc, arc)
+#undef X
+
+ENDCLASS(Arc)
+REGISTER_WEAPON(ARC, arc, NEW(Arc));
+
+
+#ifdef GAMEQC
+const float ARC_MAX_SEGMENTS = 20;
+vector arc_shotorigin[4];
+.vector beam_start;
+.vector beam_dir;
+.vector beam_wantdir;
+.int beam_type;
+
+const int ARC_BT_MISS =        0x00;
+const int ARC_BT_WALL =        0x01;
+const int ARC_BT_HEAL =        0x02;
+const int ARC_BT_HIT =         0x03;
+const int ARC_BT_BURST_MISS =  0x10;
+const int ARC_BT_BURST_WALL =  0x11;
+const int ARC_BT_BURST_HEAL =  0x12;
+const int ARC_BT_BURST_HIT =   0x13;
+const int ARC_BT_BURSTMASK =   0x10;
+
+const int ARC_SF_SETTINGS =    BIT(0);
+const int ARC_SF_START =       BIT(1);
+const int ARC_SF_WANTDIR =     BIT(2);
+const int ARC_SF_BEAMDIR =     BIT(3);
+const int ARC_SF_BEAMTYPE =    BIT(4);
+const int ARC_SF_LOCALMASK =   ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
+#endif
+#ifdef SVQC
+.entity arc_beam;
+.bool arc_BUTTON_ATCK_prev; // for better animation control
+.float beam_prev;
+.float beam_initialized;
+.float beam_bursting;
+.float beam_teleporttime;
+.float beam_heat; // (beam) amount of heat produced
+.float arc_overheat; // (dropped arc/player) time during which it's too hot
+.float arc_cooldown; // (dropped arc/player) cooling speed
+.float arc_heat_percent = _STAT(ARC_HEAT);
+.float arc_smoke_sound;
+#endif
+#ifdef CSQC
+
+.vector beam_color;
+.float beam_alpha;
+.float beam_thickness;
+.entity beam_traileffect;
+.entity beam_hiteffect;
+.float beam_hitlight[4]; // 0: radius, 123: rgb
+.entity beam_muzzleeffect;
+.float beam_muzzlelight[4]; // 0: radius, 123: rgb
+.string beam_image;
+
+.entity beam_muzzleentity;
+
+.float beam_degreespersegment;
+.float beam_distancepersegment;
+.float beam_usevieworigin;
+.float beam_initialized;
+.float beam_maxangle;
+.float beam_range;
+.float beam_returnspeed;
+.float beam_tightness;
+.vector beam_shotorigin;
+
+entity Draw_ArcBeam_callback_entity;
+float Draw_ArcBeam_callback_last_thickness;
+vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
+vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
+#endif
index cc2fedccfe84e21be7ccedc038aa9e12985eba1f..ac1540cd51fc860038f1f04072b55c75a40e5656 100644 (file)
@@ -1,58 +1,5 @@
 #include "blaster.qh"
-#ifndef IMPLEMENTATION
-CLASS(Blaster, Weapon)
-/* ammotype  */ //ATTRIB(Blaster, ammo_field, .int, ammo_none);
-/* impulse   */ ATTRIB(Blaster, impulse, int, 1);
-/* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(Blaster, bot_pickupbasevalue, float, 0);
-/* color     */ ATTRIB(Blaster, wpcolor, vector, '1 0.5 0.5');
-/* modelname */ ATTRIB(Blaster, mdl, string, "laser");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Blaster, m_model, Model, MDL_BLASTER_ITEM);
-#endif
-/* crosshair */ ATTRIB(Blaster, w_crosshair, string, "gfx/crosshairlaser");
-/* crosshair */ ATTRIB(Blaster, w_crosshair_size, float, 0.5);
-/* wepimg    */ ATTRIB(Blaster, model2, string, "weaponlaser");
-/* refname   */ ATTRIB(Blaster, netname, string, "blaster");
-/* wepname   */ ATTRIB(Blaster, m_name, string, _("Blaster"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, delay, float, BOTH) \
-               P(class, prefix, edgedamage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, force_zscale, float, BOTH) \
-               P(class, prefix, lifetime, float, BOTH) \
-               P(class, prefix, radius, float, BOTH) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, secondary, float, NONE) \
-               P(class, prefix, shotangle, float, BOTH) \
-               P(class, prefix, speed, float, BOTH) \
-               P(class, prefix, spread, float, BOTH) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-       W_PROPS(X, Blaster, blaster)
-#undef X
-
-ENDCLASS(Blaster)
-REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 
-#ifdef SVQC
-.float blaster_damage;
-.float blaster_edgedamage;
-.float blaster_radius;
-.float blaster_force;
-.float blaster_lifetime;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
 spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
@@ -260,4 +207,3 @@ METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..990add96bd8f271fe30571b524b148ba38536245 100644 (file)
@@ -1 +1,53 @@
 #pragma once
+
+CLASS(Blaster, Weapon)
+/* ammotype  */ //ATTRIB(Blaster, ammo_field, .int, ammo_none);
+/* impulse   */ ATTRIB(Blaster, impulse, int, 1);
+/* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(Blaster, bot_pickupbasevalue, float, 0);
+/* color     */ ATTRIB(Blaster, wpcolor, vector, '1 0.5 0.5');
+/* modelname */ ATTRIB(Blaster, mdl, string, "laser");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Blaster, m_model, Model, MDL_BLASTER_ITEM);
+#endif
+/* crosshair */ ATTRIB(Blaster, w_crosshair, string, "gfx/crosshairlaser");
+/* crosshair */ ATTRIB(Blaster, w_crosshair_size, float, 0.5);
+/* wepimg    */ ATTRIB(Blaster, model2, string, "weaponlaser");
+/* refname   */ ATTRIB(Blaster, netname, string, "blaster");
+/* wepname   */ ATTRIB(Blaster, m_name, string, _("Blaster"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, delay, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, force_zscale, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shotangle, float, BOTH) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Blaster, blaster)
+#undef X
+
+ENDCLASS(Blaster)
+REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
+
+#ifdef SVQC
+.float blaster_damage;
+.float blaster_edgedamage;
+.float blaster_radius;
+.float blaster_force;
+.float blaster_lifetime;
+#endif
index b3381fbc2fbbae4f41ccda9cb1e6e5453089872e..82b47037615e1d51cf6808e5ba55cf9fcb7a9493 100644 (file)
@@ -1,76 +1,5 @@
 #include "crylink.qh"
-#ifndef IMPLEMENTATION
-CLASS(Crylink, Weapon)
-/* ammotype  */ ATTRIB(Crylink, ammo_field, .int, ammo_cells);
-/* impulse   */ ATTRIB(Crylink, impulse, int, 6);
-/* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(Crylink, bot_pickupbasevalue, float, 6000);
-/* color     */ ATTRIB(Crylink, wpcolor, vector, '1 0.5 1');
-/* modelname */ ATTRIB(Crylink, mdl, string, "crylink");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Crylink, m_model, Model, MDL_CRYLINK_ITEM);
-#endif
-/* crosshair */ ATTRIB(Crylink, w_crosshair, string, "gfx/crosshaircrylink");
-/* crosshair */ ATTRIB(Crylink, w_crosshair_size, float, 0.5);
-/* wepimg    */ ATTRIB(Crylink, model2, string, "weaponcrylink");
-/* refname   */ ATTRIB(Crylink, netname, string, "crylink");
-/* wepname   */ ATTRIB(Crylink, m_name, string, _("Crylink"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-        P(class, prefix, animtime, float, BOTH) \
-        P(class, prefix, bouncedamagefactor, float, BOTH) \
-        P(class, prefix, bounces, float, BOTH) \
-        P(class, prefix, damage, float, BOTH) \
-        P(class, prefix, edgedamage, float, BOTH) \
-        P(class, prefix, force, float, BOTH) \
-        P(class, prefix, joindelay, float, BOTH) \
-        P(class, prefix, joinexplode, float, BOTH) \
-        P(class, prefix, joinexplode_damage, float, BOTH) \
-        P(class, prefix, joinexplode_edgedamage, float, BOTH) \
-        P(class, prefix, joinexplode_force, float, BOTH) \
-        P(class, prefix, joinexplode_radius, float, BOTH) \
-        P(class, prefix, joinspread, float, BOTH) \
-        P(class, prefix, linkexplode, float, BOTH) \
-        P(class, prefix, middle_fadetime, float, BOTH) \
-        P(class, prefix, middle_lifetime, float, BOTH) \
-        P(class, prefix, other_fadetime, float, BOTH) \
-        P(class, prefix, other_lifetime, float, BOTH) \
-        P(class, prefix, radius, float, BOTH) \
-        P(class, prefix, refire, float, BOTH) \
-        P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-        P(class, prefix, secondary, float, NONE) \
-        P(class, prefix, shots, float, BOTH) \
-        P(class, prefix, speed, float, BOTH) \
-        P(class, prefix, spreadtype, float, SEC) \
-        P(class, prefix, spread, float, BOTH) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-       W_PROPS(X, Crylink, crylink)
-#undef X
-
-ENDCLASS(Crylink)
-REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
 
-#ifdef SVQC
-.float gravity;
-.float crylink_waitrelease;
-.entity crylink_lastgroup;
-
-.entity crylink_owner; // we can't use realowner, as that's subject to change
-
-.entity queuenext;
-.entity queueprev;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(this, WEP_CRYLINK); }
 
@@ -699,4 +628,3 @@ METHOD(Crylink, wr_impacteffect, void(entity thiswep, entity actor))
     }
 }
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..326fdf15bec0aa4d970b2b4f3264776868a23845 100644 (file)
@@ -1 +1,71 @@
 #pragma once
+
+CLASS(Crylink, Weapon)
+/* ammotype  */ ATTRIB(Crylink, ammo_field, .int, ammo_cells);
+/* impulse   */ ATTRIB(Crylink, impulse, int, 6);
+/* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(Crylink, bot_pickupbasevalue, float, 6000);
+/* color     */ ATTRIB(Crylink, wpcolor, vector, '1 0.5 1');
+/* modelname */ ATTRIB(Crylink, mdl, string, "crylink");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Crylink, m_model, Model, MDL_CRYLINK_ITEM);
+#endif
+/* crosshair */ ATTRIB(Crylink, w_crosshair, string, "gfx/crosshaircrylink");
+/* crosshair */ ATTRIB(Crylink, w_crosshair_size, float, 0.5);
+/* wepimg    */ ATTRIB(Crylink, model2, string, "weaponcrylink");
+/* refname   */ ATTRIB(Crylink, netname, string, "crylink");
+/* wepname   */ ATTRIB(Crylink, m_name, string, _("Crylink"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+        P(class, prefix, animtime, float, BOTH) \
+        P(class, prefix, bouncedamagefactor, float, BOTH) \
+        P(class, prefix, bounces, float, BOTH) \
+        P(class, prefix, damage, float, BOTH) \
+        P(class, prefix, edgedamage, float, BOTH) \
+        P(class, prefix, force, float, BOTH) \
+        P(class, prefix, joindelay, float, BOTH) \
+        P(class, prefix, joinexplode, float, BOTH) \
+        P(class, prefix, joinexplode_damage, float, BOTH) \
+        P(class, prefix, joinexplode_edgedamage, float, BOTH) \
+        P(class, prefix, joinexplode_force, float, BOTH) \
+        P(class, prefix, joinexplode_radius, float, BOTH) \
+        P(class, prefix, joinspread, float, BOTH) \
+        P(class, prefix, linkexplode, float, BOTH) \
+        P(class, prefix, middle_fadetime, float, BOTH) \
+        P(class, prefix, middle_lifetime, float, BOTH) \
+        P(class, prefix, other_fadetime, float, BOTH) \
+        P(class, prefix, other_lifetime, float, BOTH) \
+        P(class, prefix, radius, float, BOTH) \
+        P(class, prefix, refire, float, BOTH) \
+        P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, secondary, float, NONE) \
+        P(class, prefix, shots, float, BOTH) \
+        P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, spreadtype, float, SEC) \
+        P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Crylink, crylink)
+#undef X
+
+ENDCLASS(Crylink)
+REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
+
+#ifdef SVQC
+.float gravity;
+.float crylink_waitrelease;
+.entity crylink_lastgroup;
+
+.entity crylink_owner; // we can't use realowner, as that's subject to change
+
+.entity queuenext;
+.entity queueprev;
+#endif
index dbdb7374b0244c3a26849680c5b21ac103ded86e..88d50f80a021eb01dadb77cb867a4bd7a85611fa 100644 (file)
@@ -1,73 +1,5 @@
 #include "devastator.qh"
-#ifndef IMPLEMENTATION
-CLASS(Devastator, Weapon)
-/* ammotype  */ ATTRIB(Devastator, ammo_field, .int, ammo_rockets);
-/* impulse   */ ATTRIB(Devastator, impulse, int, 9);
-/* flags     */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(Devastator, bot_pickupbasevalue, float, 8000);
-/* color     */ ATTRIB(Devastator, wpcolor, vector, '1 1 0');
-/* modelname */ ATTRIB(Devastator, mdl, string, "rl");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Devastator, m_model, Model, MDL_DEVASTATOR_ITEM);
-#endif
-/* crosshair */ ATTRIB(Devastator, w_crosshair, string, "gfx/crosshairrocketlauncher");
-/* crosshair */ ATTRIB(Devastator, w_crosshair_size, float, 0.7);
-/* wepimg    */ ATTRIB(Devastator, model2, string, "weaponrocketlauncher");
-/* refname   */ ATTRIB(Devastator, netname, string, "devastator");
-/* wepname   */ ATTRIB(Devastator, m_name, string, _("Devastator"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, NONE) \
-        P(class, prefix, animtime, float, NONE) \
-        P(class, prefix, damageforcescale, float, NONE) \
-        P(class, prefix, damage, float, NONE) \
-        P(class, prefix, detonatedelay, float, NONE) \
-        P(class, prefix, edgedamage, float, NONE) \
-        P(class, prefix, force, float, NONE) \
-        P(class, prefix, guidedelay, float, NONE) \
-        P(class, prefix, guidegoal, float, NONE) \
-        P(class, prefix, guideratedelay, float, NONE) \
-        P(class, prefix, guiderate, float, NONE) \
-        P(class, prefix, guidestop, float, NONE) \
-        P(class, prefix, health, float, NONE) \
-        P(class, prefix, lifetime, float, NONE) \
-        P(class, prefix, radius, float, NONE) \
-        P(class, prefix, refire, float, NONE) \
-               P(class, prefix, reload_ammo, float, NONE) \
-               P(class, prefix, reload_time, float, NONE) \
-        P(class, prefix, remote_damage, float, NONE) \
-        P(class, prefix, remote_edgedamage, float, NONE) \
-        P(class, prefix, remote_force, float, NONE) \
-        P(class, prefix, remote_jump_damage, float, NONE) \
-        P(class, prefix, remote_jump_force, float, NONE) \
-        P(class, prefix, remote_jump_radius, float, NONE) \
-        P(class, prefix, remote_jump_velocity_z_add, float, NONE) \
-        P(class, prefix, remote_jump_velocity_z_max, float, NONE) \
-        P(class, prefix, remote_jump_velocity_z_min, float, NONE) \
-        P(class, prefix, remote_radius, float, NONE) \
-        P(class, prefix, speedaccel, float, NONE) \
-        P(class, prefix, speedstart, float, NONE) \
-        P(class, prefix, speed, float, NONE) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, weaponreplace, string,NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-       W_PROPS(X, Devastator, devastator)
-#undef X
-
-ENDCLASS(Devastator)
-REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
 
-#ifdef SVQC
-.float rl_release;
-.float rl_detonate_later;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_devastator) { weapon_defaultspawnfunc(this, WEP_DEVASTATOR); }
 spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); }
@@ -557,14 +489,14 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea
     #if 0
     if(actor.rl_release == 0)
     {
-        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
         return true;
     }
     else
     {
         ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
         return ammo_amount;
     }
     #else
@@ -615,4 +547,3 @@ METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..dd68ccf58e3f6ad223ecc4b68a79366cebd98c3e 100644 (file)
@@ -1 +1,68 @@
 #pragma once
+
+CLASS(Devastator, Weapon)
+/* ammotype  */ ATTRIB(Devastator, ammo_field, .int, ammo_rockets);
+/* impulse   */ ATTRIB(Devastator, impulse, int, 9);
+/* flags     */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(Devastator, bot_pickupbasevalue, float, 8000);
+/* color     */ ATTRIB(Devastator, wpcolor, vector, '1 1 0');
+/* modelname */ ATTRIB(Devastator, mdl, string, "rl");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Devastator, m_model, Model, MDL_DEVASTATOR_ITEM);
+#endif
+/* crosshair */ ATTRIB(Devastator, w_crosshair, string, "gfx/crosshairrocketlauncher");
+/* crosshair */ ATTRIB(Devastator, w_crosshair_size, float, 0.7);
+/* wepimg    */ ATTRIB(Devastator, model2, string, "weaponrocketlauncher");
+/* refname   */ ATTRIB(Devastator, netname, string, "devastator");
+/* wepname   */ ATTRIB(Devastator, m_name, string, _("Devastator"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+        P(class, prefix, animtime, float, NONE) \
+        P(class, prefix, damageforcescale, float, NONE) \
+        P(class, prefix, damage, float, NONE) \
+        P(class, prefix, detonatedelay, float, NONE) \
+        P(class, prefix, edgedamage, float, NONE) \
+        P(class, prefix, force, float, NONE) \
+        P(class, prefix, guidedelay, float, NONE) \
+        P(class, prefix, guidegoal, float, NONE) \
+        P(class, prefix, guideratedelay, float, NONE) \
+        P(class, prefix, guiderate, float, NONE) \
+        P(class, prefix, guidestop, float, NONE) \
+        P(class, prefix, health, float, NONE) \
+        P(class, prefix, lifetime, float, NONE) \
+        P(class, prefix, radius, float, NONE) \
+        P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, remote_damage, float, NONE) \
+        P(class, prefix, remote_edgedamage, float, NONE) \
+        P(class, prefix, remote_force, float, NONE) \
+        P(class, prefix, remote_jump_damage, float, NONE) \
+        P(class, prefix, remote_jump_force, float, NONE) \
+        P(class, prefix, remote_jump_radius, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_add, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_max, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_min, float, NONE) \
+        P(class, prefix, remote_radius, float, NONE) \
+        P(class, prefix, speedaccel, float, NONE) \
+        P(class, prefix, speedstart, float, NONE) \
+        P(class, prefix, speed, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Devastator, devastator)
+#undef X
+
+ENDCLASS(Devastator)
+REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
+
+#ifdef SVQC
+.float rl_release;
+.float rl_detonate_later;
+#endif
index 9d01d1c329c46ecc6fb1de8e07f7631e9269ece7..f2fb14614004e9ef2982d5656753514ad7ecf016 100644 (file)
@@ -1,79 +1,5 @@
 #include "electro.qh"
-#ifndef IMPLEMENTATION
-CLASS(Electro, Weapon)
-/* ammotype  */ ATTRIB(Electro, ammo_field, .int, ammo_cells);
-/* impulse   */ ATTRIB(Electro, impulse, int, 5);
-/* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(Electro, bot_pickupbasevalue, float, 5000);
-/* color     */ ATTRIB(Electro, wpcolor, vector, '0 0.5 1');
-/* modelname */ ATTRIB(Electro, mdl, string, "electro");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Electro, m_model, Model, MDL_ELECTRO_ITEM);
-#endif
-/* crosshair */ ATTRIB(Electro, w_crosshair, string, "gfx/crosshairelectro");
-/* crosshair */ ATTRIB(Electro, w_crosshair_size, float, 0.6);
-/* wepimg    */ ATTRIB(Electro, model2, string, "weaponelectro");
-/* refname   */ ATTRIB(Electro, netname, string, "electro");
-/* wepname   */ ATTRIB(Electro, m_name, string, _("Electro"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, bouncefactor, float, SEC) \
-               P(class, prefix, bouncestop, float, SEC) \
-               P(class, prefix, comboradius, float, PRI) \
-               P(class, prefix, combo_comboradius, float, NONE) \
-               P(class, prefix, combo_comboradius_thruwall, float, NONE) \
-               P(class, prefix, combo_damage, float, NONE) \
-               P(class, prefix, combo_edgedamage, float, NONE) \
-               P(class, prefix, combo_force, float, NONE) \
-               P(class, prefix, combo_radius, float, NONE) \
-               P(class, prefix, combo_safeammocheck, float, NONE) \
-               P(class, prefix, combo_speed, float, NONE) \
-               P(class, prefix, count, float, SEC) \
-               P(class, prefix, damagedbycontents, float, SEC) \
-               P(class, prefix, damageforcescale, float, SEC) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, edgedamage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, health, float, SEC) \
-               P(class, prefix, lifetime, float, BOTH) \
-               P(class, prefix, midaircombo_explode, float, PRI) \
-               P(class, prefix, midaircombo_interval, float, PRI) \
-               P(class, prefix, midaircombo_radius, float, PRI) \
-               P(class, prefix, radius, float, BOTH) \
-               P(class, prefix, refire2, float, SEC) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, reload_ammo, float, NONE) \
-               P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, speed, float, BOTH) \
-               P(class, prefix, speed_up, float, SEC) \
-               P(class, prefix, speed_z, float, SEC) \
-               P(class, prefix, spread, float, BOTH) \
-               P(class, prefix, stick, float, SEC) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, touchexplode, float, SEC) \
-               P(class, prefix, weaponreplace, string,NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-       W_PROPS(X, Electro, electro)
-#undef X
-
-ENDCLASS(Electro)
-REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
-
 
-#ifdef SVQC
-.float electro_count;
-.float electro_secondarytime;
-void W_Electro_ExplodeCombo(entity this);
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_electro) { weapon_defaultspawnfunc(this, WEP_ELECTRO); }
 
@@ -643,4 +569,3 @@ METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..32b45c6928f2bb7faf1fe94919ef03260f7ce5fe 100644 (file)
@@ -1 +1,74 @@
 #pragma once
+
+CLASS(Electro, Weapon)
+/* ammotype  */ ATTRIB(Electro, ammo_field, .int, ammo_cells);
+/* impulse   */ ATTRIB(Electro, impulse, int, 5);
+/* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(Electro, bot_pickupbasevalue, float, 5000);
+/* color     */ ATTRIB(Electro, wpcolor, vector, '0 0.5 1');
+/* modelname */ ATTRIB(Electro, mdl, string, "electro");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Electro, m_model, Model, MDL_ELECTRO_ITEM);
+#endif
+/* crosshair */ ATTRIB(Electro, w_crosshair, string, "gfx/crosshairelectro");
+/* crosshair */ ATTRIB(Electro, w_crosshair_size, float, 0.6);
+/* wepimg    */ ATTRIB(Electro, model2, string, "weaponelectro");
+/* refname   */ ATTRIB(Electro, netname, string, "electro");
+/* wepname   */ ATTRIB(Electro, m_name, string, _("Electro"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bouncefactor, float, SEC) \
+               P(class, prefix, bouncestop, float, SEC) \
+               P(class, prefix, comboradius, float, PRI) \
+               P(class, prefix, combo_comboradius, float, NONE) \
+               P(class, prefix, combo_comboradius_thruwall, float, NONE) \
+               P(class, prefix, combo_damage, float, NONE) \
+               P(class, prefix, combo_edgedamage, float, NONE) \
+               P(class, prefix, combo_force, float, NONE) \
+               P(class, prefix, combo_radius, float, NONE) \
+               P(class, prefix, combo_safeammocheck, float, NONE) \
+               P(class, prefix, combo_speed, float, NONE) \
+               P(class, prefix, count, float, SEC) \
+               P(class, prefix, damagedbycontents, float, SEC) \
+               P(class, prefix, damageforcescale, float, SEC) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, health, float, SEC) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, midaircombo_explode, float, PRI) \
+               P(class, prefix, midaircombo_interval, float, PRI) \
+               P(class, prefix, midaircombo_radius, float, PRI) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire2, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, SEC) \
+               P(class, prefix, speed_z, float, SEC) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, stick, float, SEC) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, touchexplode, float, SEC) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Electro, electro)
+#undef X
+
+ENDCLASS(Electro)
+REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
+
+
+#ifdef SVQC
+.float electro_count;
+.float electro_secondarytime;
+void W_Electro_ExplodeCombo(entity this);
+#endif
index e968f881f25f9c14012ae78ad6435a24a37980ae..3f9cd4c4e18f6d731d2d7db54764b983ceb8ec0e 100644 (file)
@@ -1,65 +1,5 @@
 #include "fireball.qh"
-#ifndef IMPLEMENTATION
-CLASS(Fireball, Weapon)
-/* ammotype  */ //ATTRIB(Fireball, ammo_field, .int, ammo_none);
-/* impulse   */ ATTRIB(Fireball, impulse, int, 9);
-/* flags     */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(Fireball, bot_pickupbasevalue, float, 5000);
-/* color     */ ATTRIB(Fireball, wpcolor, vector, '1 0.5 0');
-/* modelname */ ATTRIB(Fireball, mdl, string, "fireball");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Fireball, m_model, Model, MDL_FIREBALL_ITEM);
-#endif
-/* crosshair */ ATTRIB(Fireball, w_crosshair, string, "gfx/crosshairfireball");
-/* crosshair */ //ATTRIB(Fireball, w_crosshair_size, float, 0.65);
-/* wepimg    */ ATTRIB(Fireball, model2, string, "weaponfireball");
-/* refname   */ ATTRIB(Fireball, netname, string, "fireball");
-/* wepname   */ ATTRIB(Fireball, m_name, string, _("Fireball"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, bfgdamage, float, PRI) \
-               P(class, prefix, bfgforce, float, PRI) \
-               P(class, prefix, bfgradius, float, PRI) \
-               P(class, prefix, damageforcescale, float, BOTH) \
-               P(class, prefix, damagetime, float, SEC) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, edgedamage, float, PRI) \
-               P(class, prefix, force, float, PRI) \
-               P(class, prefix, health, float, PRI) \
-               P(class, prefix, laserburntime, float, BOTH) \
-               P(class, prefix, laserdamage, float, BOTH) \
-               P(class, prefix, laseredgedamage, float, BOTH) \
-               P(class, prefix, laserradius, float, BOTH) \
-               P(class, prefix, lifetime, float, BOTH) \
-               P(class, prefix, radius, float, PRI) \
-               P(class, prefix, refire2, float, PRI) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, speed, float, BOTH) \
-               P(class, prefix, speed_up, float, SEC) \
-               P(class, prefix, speed_z, float, SEC) \
-               P(class, prefix, spread, float, BOTH) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, weaponreplace, string,NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-       W_PROPS(X, Fireball, fireball)
-#undef X
-
-ENDCLASS(Fireball)
-REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
 
-#ifdef SVQC
-.float bot_primary_fireballmooth; // whatever a mooth is
-.vector fireball_impactvec;
-.float fireball_primarytime;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(this, WEP_FIREBALL); }
 
@@ -456,4 +396,3 @@ METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..d6d8f017edc9c0027726200f00a89b689f895321 100644 (file)
@@ -1 +1,60 @@
 #pragma once
+
+CLASS(Fireball, Weapon)
+/* ammotype  */ //ATTRIB(Fireball, ammo_field, .int, ammo_none);
+/* impulse   */ ATTRIB(Fireball, impulse, int, 9);
+/* flags     */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(Fireball, bot_pickupbasevalue, float, 5000);
+/* color     */ ATTRIB(Fireball, wpcolor, vector, '1 0.5 0');
+/* modelname */ ATTRIB(Fireball, mdl, string, "fireball");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Fireball, m_model, Model, MDL_FIREBALL_ITEM);
+#endif
+/* crosshair */ ATTRIB(Fireball, w_crosshair, string, "gfx/crosshairfireball");
+/* crosshair */ //ATTRIB(Fireball, w_crosshair_size, float, 0.65);
+/* wepimg    */ ATTRIB(Fireball, model2, string, "weaponfireball");
+/* refname   */ ATTRIB(Fireball, netname, string, "fireball");
+/* wepname   */ ATTRIB(Fireball, m_name, string, _("Fireball"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bfgdamage, float, PRI) \
+               P(class, prefix, bfgforce, float, PRI) \
+               P(class, prefix, bfgradius, float, PRI) \
+               P(class, prefix, damageforcescale, float, BOTH) \
+               P(class, prefix, damagetime, float, SEC) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, PRI) \
+               P(class, prefix, force, float, PRI) \
+               P(class, prefix, health, float, PRI) \
+               P(class, prefix, laserburntime, float, BOTH) \
+               P(class, prefix, laserdamage, float, BOTH) \
+               P(class, prefix, laseredgedamage, float, BOTH) \
+               P(class, prefix, laserradius, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, PRI) \
+               P(class, prefix, refire2, float, PRI) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, SEC) \
+               P(class, prefix, speed_z, float, SEC) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Fireball, fireball)
+#undef X
+
+ENDCLASS(Fireball)
+REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
+
+#ifdef SVQC
+.float bot_primary_fireballmooth; // whatever a mooth is
+.vector fireball_impactvec;
+.float fireball_primarytime;
+#endif
index f7b289278608a7a0591abb74481d2d0878965302..5272e6060a8fdab0c417ab986c96898fe2097f07 100644 (file)
@@ -1,64 +1,5 @@
 #include "hagar.qh"
-#ifndef IMPLEMENTATION
-CLASS(Hagar, Weapon)
-/* ammotype  */ ATTRIB(Hagar, ammo_field, .int, ammo_rockets);
-/* impulse   */ ATTRIB(Hagar, impulse, int, 8);
-/* flags     */ ATTRIB(Hagar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(Hagar, bot_pickupbasevalue, float, 6000);
-/* color     */ ATTRIB(Hagar, wpcolor, vector, '1 1 0.5');
-/* modelname */ ATTRIB(Hagar, mdl, string, "hagar");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Hagar, m_model, Model, MDL_HAGAR_ITEM);
-#endif
-/* crosshair */ ATTRIB(Hagar, w_crosshair, string, "gfx/crosshairhagar");
-/* crosshair */ ATTRIB(Hagar, w_crosshair_size, float, 0.8);
-/* wepimg    */ ATTRIB(Hagar, model2, string, "weaponhagar");
-/* refname   */ ATTRIB(Hagar, netname, string, "hagar");
-/* wepname   */ ATTRIB(Hagar, m_name, string, _("Hagar"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-        P(class, prefix, damageforcescale, float, BOTH) \
-        P(class, prefix, damage, float, BOTH) \
-        P(class, prefix, edgedamage, float, BOTH) \
-        P(class, prefix, force, float, BOTH) \
-        P(class, prefix, health, float, BOTH) \
-        P(class, prefix, lifetime, float, PRI) \
-        P(class, prefix, lifetime_min, float, SEC) \
-        P(class, prefix, lifetime_rand, float, SEC) \
-        P(class, prefix, load, float, SEC) \
-        P(class, prefix, load_abort, float, SEC) \
-        P(class, prefix, load_animtime, float, SEC) \
-        P(class, prefix, load_hold, float, SEC) \
-        P(class, prefix, load_linkexplode, float, SEC) \
-        P(class, prefix, load_max, float, SEC) \
-        P(class, prefix, load_releasedeath, float, SEC) \
-        P(class, prefix, load_speed, float, SEC) \
-        P(class, prefix, load_spread, float, SEC) \
-        P(class, prefix, load_spread_bias, float, SEC) \
-        P(class, prefix, radius, float, BOTH) \
-        P(class, prefix, refire, float, BOTH) \
-        P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-        P(class, prefix, secondary, float, NONE) \
-        P(class, prefix, speed, float, BOTH) \
-        P(class, prefix, spread, float, BOTH) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string,NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Hagar, hagar)
-#undef X
-
-ENDCLASS(Hagar)
-REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
 
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); }
 
@@ -569,4 +510,3 @@ METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..7dfd3c6312541e47f4534f3af1cb756a3a5abbc6 100644 (file)
@@ -1 +1,58 @@
 #pragma once
+
+CLASS(Hagar, Weapon)
+/* ammotype  */ ATTRIB(Hagar, ammo_field, .int, ammo_rockets);
+/* impulse   */ ATTRIB(Hagar, impulse, int, 8);
+/* flags     */ ATTRIB(Hagar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(Hagar, bot_pickupbasevalue, float, 6000);
+/* color     */ ATTRIB(Hagar, wpcolor, vector, '1 1 0.5');
+/* modelname */ ATTRIB(Hagar, mdl, string, "hagar");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Hagar, m_model, Model, MDL_HAGAR_ITEM);
+#endif
+/* crosshair */ ATTRIB(Hagar, w_crosshair, string, "gfx/crosshairhagar");
+/* crosshair */ ATTRIB(Hagar, w_crosshair_size, float, 0.8);
+/* wepimg    */ ATTRIB(Hagar, model2, string, "weaponhagar");
+/* refname   */ ATTRIB(Hagar, netname, string, "hagar");
+/* wepname   */ ATTRIB(Hagar, m_name, string, _("Hagar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+        P(class, prefix, damageforcescale, float, BOTH) \
+        P(class, prefix, damage, float, BOTH) \
+        P(class, prefix, edgedamage, float, BOTH) \
+        P(class, prefix, force, float, BOTH) \
+        P(class, prefix, health, float, BOTH) \
+        P(class, prefix, lifetime, float, PRI) \
+        P(class, prefix, lifetime_min, float, SEC) \
+        P(class, prefix, lifetime_rand, float, SEC) \
+        P(class, prefix, load, float, SEC) \
+        P(class, prefix, load_abort, float, SEC) \
+        P(class, prefix, load_animtime, float, SEC) \
+        P(class, prefix, load_hold, float, SEC) \
+        P(class, prefix, load_linkexplode, float, SEC) \
+        P(class, prefix, load_max, float, SEC) \
+        P(class, prefix, load_releasedeath, float, SEC) \
+        P(class, prefix, load_speed, float, SEC) \
+        P(class, prefix, load_spread, float, SEC) \
+        P(class, prefix, load_spread_bias, float, SEC) \
+        P(class, prefix, radius, float, BOTH) \
+        P(class, prefix, refire, float, BOTH) \
+        P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, secondary, float, NONE) \
+        P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Hagar, hagar)
+#undef X
+
+ENDCLASS(Hagar)
+REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
index 6e03b1041406233b5c0130f08be7c8782c79c25f..0193270a61e592108213e723afccba610d636e92 100644 (file)
@@ -1,57 +1,5 @@
 #include "hlac.qh"
-#ifndef IMPLEMENTATION
-CLASS(HLAC, Weapon)
-/* ammotype  */ ATTRIB(HLAC, ammo_field, .int, ammo_cells);
-/* impulse   */ ATTRIB(HLAC, impulse, int, 6);
-/* flags     */ ATTRIB(HLAC, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(HLAC, bot_pickupbasevalue, float, 4000);
-/* color     */ ATTRIB(HLAC, wpcolor, vector, '0 1 0');
-/* modelname */ ATTRIB(HLAC, mdl, string, "hlac");
-#ifdef GAMEQC
-/* model     */ ATTRIB(HLAC, m_model, Model, MDL_HLAC_ITEM);
-#endif
-/* crosshair */ ATTRIB(HLAC, w_crosshair, string, "gfx/crosshairhlac");
-/* crosshair */ ATTRIB(HLAC, w_crosshair_size, float, 0.6);
-/* wepimg    */ ATTRIB(HLAC, model2, string, "weaponhlac");
-/* refname   */ ATTRIB(HLAC, netname, string, "hlac");
-/* wepname   */ ATTRIB(HLAC, m_name, string, _("Heavy Laser Assault Cannon"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, edgedamage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, lifetime, float, BOTH) \
-               P(class, prefix, radius, float, BOTH) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, reload_ammo, float, NONE) \
-               P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, secondary, float, NONE) \
-               P(class, prefix, shots, float, SEC) \
-               P(class, prefix, speed, float, BOTH) \
-               P(class, prefix, spread, float, SEC) \
-               P(class, prefix, spread_add, float, PRI) \
-               P(class, prefix, spread_crouchmod, float, BOTH) \
-               P(class, prefix, spread_max, float, PRI) \
-               P(class, prefix, spread_min, float, PRI) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, weaponreplace, string,NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, HLAC, hlac)
-#undef X
-
-ENDCLASS(HLAC)
-REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
-
 
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
 
@@ -277,4 +225,3 @@ METHOD(HLAC, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..f965abcbf79e62fac163c5f2c52dec2e98fb476e 100644 (file)
@@ -1 +1,50 @@
 #pragma once
+
+CLASS(HLAC, Weapon)
+/* ammotype  */ ATTRIB(HLAC, ammo_field, .int, ammo_cells);
+/* impulse   */ ATTRIB(HLAC, impulse, int, 6);
+/* flags     */ ATTRIB(HLAC, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(HLAC, bot_pickupbasevalue, float, 4000);
+/* color     */ ATTRIB(HLAC, wpcolor, vector, '0 1 0');
+/* modelname */ ATTRIB(HLAC, mdl, string, "hlac");
+#ifdef GAMEQC
+/* model     */ ATTRIB(HLAC, m_model, Model, MDL_HLAC_ITEM);
+#endif
+/* crosshair */ ATTRIB(HLAC, w_crosshair, string, "gfx/crosshairhlac");
+/* crosshair */ ATTRIB(HLAC, w_crosshair_size, float, 0.6);
+/* wepimg    */ ATTRIB(HLAC, model2, string, "weaponhlac");
+/* refname   */ ATTRIB(HLAC, netname, string, "hlac");
+/* wepname   */ ATTRIB(HLAC, m_name, string, _("Heavy Laser Assault Cannon"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shots, float, SEC) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, spread, float, SEC) \
+               P(class, prefix, spread_add, float, PRI) \
+               P(class, prefix, spread_crouchmod, float, BOTH) \
+               P(class, prefix, spread_max, float, PRI) \
+               P(class, prefix, spread_min, float, PRI) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, HLAC, hlac)
+#undef X
+
+ENDCLASS(HLAC)
+REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
index 26c04ad4fa200f536252a5389b5dea089137932b..d92e0caa8538b4c9ec4ccc5c0bc79a3fef41e7f4 100644 (file)
@@ -1,83 +1,7 @@
 #include "hook.qh"
-#ifndef IMPLEMENTATION
-CLASS(Hook, Weapon)
-/* ammotype  */ ATTRIB(Hook, ammo_field, .int, ammo_fuel);
-/* impulse   */ ATTRIB(Hook, impulse, int, 0);
-/* flags     */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(Hook, bot_pickupbasevalue, float, 0);
-/* color     */ ATTRIB(Hook, wpcolor, vector, '0 0.5 0');
-/* modelname */ ATTRIB(Hook, mdl, string, "hookgun");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Hook, m_model, Model, MDL_HOOK_ITEM);
-#endif
-/* crosshair */ ATTRIB(Hook, w_crosshair, string, "gfx/crosshairhook");
-/* crosshair */ ATTRIB(Hook, w_crosshair_size, float, 0.5);
-/* wepimg    */ ATTRIB(Hook, model2, string, "weaponhook");
-/* refname   */ ATTRIB(Hook, netname, string, "hook");
-/* wepname   */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
-       ATTRIB(Hook, ammo_factor, float, 1);
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, PRI) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, damageforcescale, float, SEC) \
-               P(class, prefix, damage, float, SEC) \
-               P(class, prefix, duration, float, SEC) \
-               P(class, prefix, edgedamage, float, SEC) \
-               P(class, prefix, force, float, SEC) \
-               P(class, prefix, gravity, float, SEC) \
-               P(class, prefix, health, float, SEC) \
-               P(class, prefix, hooked_ammo, float, PRI) \
-               P(class, prefix, hooked_time_free, float, PRI) \
-               P(class, prefix, hooked_time_max, float, PRI) \
-               P(class, prefix, lifetime, float, SEC) \
-               P(class, prefix, power, float, SEC) \
-               P(class, prefix, radius, float, SEC) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, speed, float, SEC) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Hook, hook)
-#undef X
-
-ENDCLASS(Hook)
-REGISTER_WEAPON(HOOK, hook, NEW(Hook));
-
-CLASS(OffhandHook, OffhandWeapon)
-#ifdef SVQC
-    METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
-    {
-       Weapon wep = WEP_HOOK;
-       .entity weaponentity = weaponentities[1];
-       wep.wr_think(wep, actor, weaponentity, key_pressed ? 1 : 0);
-    }
-#endif
-ENDCLASS(OffhandHook)
-OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
 
 #ifdef SVQC
 
-.float dmg;
-.float dmg_edge;
-.float dmg_radius;
-.float dmg_force;
-.float dmg_power;
-.float dmg_duration;
-.float dmg_last;
-.float hook_refire;
-.float hook_time_hooked;
-.float hook_time_fueldecrease;
-#endif
-#endif
-#ifdef IMPLEMENTATION
-#ifdef SVQC
-
 spawnfunc(weapon_hook) { weapon_defaultspawnfunc(this, WEP_HOOK); }
 
 void W_Hook_ExplodeThink(entity this)
@@ -583,5 +507,3 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
 
 // TODO: hook: temporarily transform this.origin for drawing the model along warpzones!
 #endif
-
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..f67db3d00d462ac141c52be86adc2d6879b49bdb 100644 (file)
@@ -1 +1,76 @@
 #pragma once
+
+CLASS(Hook, Weapon)
+/* ammotype  */ ATTRIB(Hook, ammo_field, .int, ammo_fuel);
+/* impulse   */ ATTRIB(Hook, impulse, int, 0);
+/* flags     */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(Hook, bot_pickupbasevalue, float, 0);
+/* color     */ ATTRIB(Hook, wpcolor, vector, '0 0.5 0');
+/* modelname */ ATTRIB(Hook, mdl, string, "hookgun");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Hook, m_model, Model, MDL_HOOK_ITEM);
+#endif
+/* crosshair */ ATTRIB(Hook, w_crosshair, string, "gfx/crosshairhook");
+/* crosshair */ ATTRIB(Hook, w_crosshair_size, float, 0.5);
+/* wepimg    */ ATTRIB(Hook, model2, string, "weaponhook");
+/* refname   */ ATTRIB(Hook, netname, string, "hook");
+/* wepname   */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
+       ATTRIB(Hook, ammo_factor, float, 1);
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, PRI) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damageforcescale, float, SEC) \
+               P(class, prefix, damage, float, SEC) \
+               P(class, prefix, duration, float, SEC) \
+               P(class, prefix, edgedamage, float, SEC) \
+               P(class, prefix, force, float, SEC) \
+               P(class, prefix, gravity, float, SEC) \
+               P(class, prefix, health, float, SEC) \
+               P(class, prefix, hooked_ammo, float, PRI) \
+               P(class, prefix, hooked_time_free, float, PRI) \
+               P(class, prefix, hooked_time_max, float, PRI) \
+               P(class, prefix, lifetime, float, SEC) \
+               P(class, prefix, power, float, SEC) \
+               P(class, prefix, radius, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, speed, float, SEC) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Hook, hook)
+#undef X
+
+ENDCLASS(Hook)
+REGISTER_WEAPON(HOOK, hook, NEW(Hook));
+
+CLASS(OffhandHook, OffhandWeapon)
+#ifdef SVQC
+    METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
+    {
+       Weapon wep = WEP_HOOK;
+       .entity weaponentity = weaponentities[1];
+       wep.wr_think(wep, actor, weaponentity, key_pressed ? 1 : 0);
+    }
+#endif
+ENDCLASS(OffhandHook)
+OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
+
+#ifdef SVQC
+
+.float dmg;
+.float dmg_edge;
+.float dmg_radius;
+.float dmg_force;
+.float dmg_power;
+.float dmg_duration;
+.float dmg_last;
+.float hook_refire;
+.float hook_time_hooked;
+.float hook_time_fueldecrease;
+#endif
index 163b81ca117398056acefca567c42d3b636e7611..c4f3b9bb3b29183bbcd25d0243eefdde0f5bec76 100644 (file)
@@ -1,63 +1,5 @@
 #include "machinegun.qh"
-#ifndef IMPLEMENTATION
-CLASS(MachineGun, Weapon)
-/* ammotype  */ ATTRIB(MachineGun, ammo_field, .int, ammo_nails);
-/* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
-/* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
-/* rating    */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000);
-/* color     */ ATTRIB(MachineGun, wpcolor, vector, '1 1 0');
-/* modelname */ ATTRIB(MachineGun, mdl, string, "uzi");
-#ifdef GAMEQC
-/* model     */ ATTRIB(MachineGun, m_model, Model, MDL_MACHINEGUN_ITEM);
-#endif
-/* crosshair */ ATTRIB(MachineGun, w_crosshair, string, "gfx/crosshairuzi");
-/* crosshair */ ATTRIB(MachineGun, w_crosshair_size, float, 0.6);
-/* wepimg    */ ATTRIB(MachineGun, model2, string, "weaponuzi");
-/* refname   */ ATTRIB(MachineGun, netname, string, "machinegun");
-/* wepname   */ ATTRIB(MachineGun, m_name, string, _("MachineGun"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, burst, float, NONE) \
-               P(class, prefix, burst_ammo, float, NONE) \
-               P(class, prefix, burst_animtime, float, NONE) \
-               P(class, prefix, burst_refire2, float, NONE) \
-               P(class, prefix, burst_refire, float, NONE) \
-               P(class, prefix, burst_speed, float, NONE) \
-               P(class, prefix, first, float, NONE) \
-               P(class, prefix, first_ammo, float, NONE) \
-               P(class, prefix, first_damage, float, NONE) \
-               P(class, prefix, first_force, float, NONE) \
-               P(class, prefix, first_refire, float, NONE) \
-               P(class, prefix, first_spread, float, NONE) \
-               P(class, prefix, mode, float, NONE) \
-               P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, solidpenetration, float, NONE) \
-               P(class, prefix, spread_add, float, NONE) \
-               P(class, prefix, spread_max, float, NONE) \
-               P(class, prefix, spread_min, float, NONE) \
-               P(class, prefix, sustained_ammo, float, NONE) \
-               P(class, prefix, sustained_damage, float, NONE) \
-               P(class, prefix, sustained_force, float, NONE) \
-               P(class, prefix, sustained_refire, float, NONE) \
-               P(class, prefix, sustained_spread, float, NONE) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string,NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, MachineGun, machinegun)
-#undef X
-
-ENDCLASS(MachineGun)
-REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
-
 
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 
 spawnfunc(weapon_machinegun)
@@ -375,4 +317,3 @@ METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..66a7cb674f07069f57c507c836c844df613de826 100644 (file)
@@ -1 +1,56 @@
 #pragma once
+
+CLASS(MachineGun, Weapon)
+/* ammotype  */ ATTRIB(MachineGun, ammo_field, .int, ammo_nails);
+/* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
+/* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
+/* rating    */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000);
+/* color     */ ATTRIB(MachineGun, wpcolor, vector, '1 1 0');
+/* modelname */ ATTRIB(MachineGun, mdl, string, "uzi");
+#ifdef GAMEQC
+/* model     */ ATTRIB(MachineGun, m_model, Model, MDL_MACHINEGUN_ITEM);
+#endif
+/* crosshair */ ATTRIB(MachineGun, w_crosshair, string, "gfx/crosshairuzi");
+/* crosshair */ ATTRIB(MachineGun, w_crosshair_size, float, 0.6);
+/* wepimg    */ ATTRIB(MachineGun, model2, string, "weaponuzi");
+/* refname   */ ATTRIB(MachineGun, netname, string, "machinegun");
+/* wepname   */ ATTRIB(MachineGun, m_name, string, _("MachineGun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, burst, float, NONE) \
+               P(class, prefix, burst_ammo, float, NONE) \
+               P(class, prefix, burst_animtime, float, NONE) \
+               P(class, prefix, burst_refire2, float, NONE) \
+               P(class, prefix, burst_refire, float, NONE) \
+               P(class, prefix, burst_speed, float, NONE) \
+               P(class, prefix, first, float, NONE) \
+               P(class, prefix, first_ammo, float, NONE) \
+               P(class, prefix, first_damage, float, NONE) \
+               P(class, prefix, first_force, float, NONE) \
+               P(class, prefix, first_refire, float, NONE) \
+               P(class, prefix, first_spread, float, NONE) \
+               P(class, prefix, mode, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, solidpenetration, float, NONE) \
+               P(class, prefix, spread_add, float, NONE) \
+               P(class, prefix, spread_max, float, NONE) \
+               P(class, prefix, spread_min, float, NONE) \
+               P(class, prefix, sustained_ammo, float, NONE) \
+               P(class, prefix, sustained_damage, float, NONE) \
+               P(class, prefix, sustained_force, float, NONE) \
+               P(class, prefix, sustained_refire, float, NONE) \
+               P(class, prefix, sustained_spread, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, MachineGun, machinegun)
+#undef X
+
+ENDCLASS(MachineGun)
+REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
index 73b29a48de6a97a252843512bd7c480abad539f4..463f5109b918187ed45bfe6b41e66f1eb440af76 100644 (file)
@@ -1,66 +1,5 @@
 #include "minelayer.qh"
-#ifndef IMPLEMENTATION
-CLASS(MineLayer, Weapon)
-/* ammotype  */ ATTRIB(MineLayer, ammo_field, .int, ammo_rockets);
-/* impulse   */ ATTRIB(MineLayer, impulse, int, 4);
-/* flags     */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(MineLayer, bot_pickupbasevalue, float, 7000);
-/* color     */ ATTRIB(MineLayer, wpcolor, vector, '0.75 1 0');
-/* modelname */ ATTRIB(MineLayer, mdl, string, "minelayer");
-#ifdef GAMEQC
-/* model     */ ATTRIB(MineLayer, m_model, Model, MDL_MINELAYER_ITEM);
-#endif
-/* crosshair */ ATTRIB(MineLayer, w_crosshair, string, "gfx/crosshairminelayer");
-/* crosshair */ ATTRIB(MineLayer, w_crosshair_size, float, 0.9);
-/* wepimg    */ ATTRIB(MineLayer, model2, string, "weaponminelayer");
-/* refname   */ ATTRIB(MineLayer, netname, string, "minelayer");
-/* wepname   */ ATTRIB(MineLayer, m_name, string, _("Mine Layer"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, NONE) \
-               P(class, prefix, animtime, float, NONE) \
-               P(class, prefix, damageforcescale, float, NONE) \
-               P(class, prefix, damage, float, NONE) \
-               P(class, prefix, detonatedelay, float, NONE) \
-               P(class, prefix, edgedamage, float, NONE) \
-               P(class, prefix, force, float, NONE) \
-               P(class, prefix, health, float, NONE) \
-               P(class, prefix, lifetime, float, NONE) \
-               P(class, prefix, lifetime_countdown, float, NONE) \
-               P(class, prefix, limit, float, NONE) \
-               P(class, prefix, protection, float, NONE) \
-               P(class, prefix, proximityradius, float, NONE) \
-               P(class, prefix, radius, float, NONE) \
-               P(class, prefix, refire, float, NONE) \
-               P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, remote_damage, float, NONE) \
-               P(class, prefix, remote_edgedamage, float, NONE) \
-               P(class, prefix, remote_force, float, NONE) \
-               P(class, prefix, remote_radius, float, NONE) \
-               P(class, prefix, speed, float, NONE) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, time, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, MineLayer, minelayer)
-#undef X
-ENDCLASS(MineLayer)
-REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
 
-#ifdef SVQC
-void W_MineLayer_Think(entity this);
-.float minelayer_detonate, mine_explodeanyway;
-.float mine_time;
-.vector mine_orientation;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); }
 
@@ -587,4 +526,3 @@ METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..e867db8d31634764f5f459f8df028f346535b478 100644 (file)
@@ -1 +1,61 @@
 #pragma once
+
+CLASS(MineLayer, Weapon)
+/* ammotype  */ ATTRIB(MineLayer, ammo_field, .int, ammo_rockets);
+/* impulse   */ ATTRIB(MineLayer, impulse, int, 4);
+/* flags     */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(MineLayer, bot_pickupbasevalue, float, 7000);
+/* color     */ ATTRIB(MineLayer, wpcolor, vector, '0.75 1 0');
+/* modelname */ ATTRIB(MineLayer, mdl, string, "minelayer");
+#ifdef GAMEQC
+/* model     */ ATTRIB(MineLayer, m_model, Model, MDL_MINELAYER_ITEM);
+#endif
+/* crosshair */ ATTRIB(MineLayer, w_crosshair, string, "gfx/crosshairminelayer");
+/* crosshair */ ATTRIB(MineLayer, w_crosshair_size, float, 0.9);
+/* wepimg    */ ATTRIB(MineLayer, model2, string, "weaponminelayer");
+/* refname   */ ATTRIB(MineLayer, netname, string, "minelayer");
+/* wepname   */ ATTRIB(MineLayer, m_name, string, _("Mine Layer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, damageforcescale, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, detonatedelay, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, health, float, NONE) \
+               P(class, prefix, lifetime, float, NONE) \
+               P(class, prefix, lifetime_countdown, float, NONE) \
+               P(class, prefix, limit, float, NONE) \
+               P(class, prefix, protection, float, NONE) \
+               P(class, prefix, proximityradius, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, remote_damage, float, NONE) \
+               P(class, prefix, remote_edgedamage, float, NONE) \
+               P(class, prefix, remote_force, float, NONE) \
+               P(class, prefix, remote_radius, float, NONE) \
+               P(class, prefix, speed, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, time, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, MineLayer, minelayer)
+#undef X
+ENDCLASS(MineLayer)
+REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
+
+#ifdef SVQC
+void W_MineLayer_Think(entity this);
+.float minelayer_detonate, mine_explodeanyway;
+.float mine_time;
+.vector mine_orientation;
+#endif
index f6b498a8bcd0fb690d18c0772552d9e9cb448d54..186d1f139d3f52de758e69e0bdd5360c5e4fc7e3 100644 (file)
@@ -1,65 +1,5 @@
 #include "mortar.qh"
-#ifndef IMPLEMENTATION
-CLASS(Mortar, Weapon)
-/* ammotype  */ ATTRIB(Mortar, ammo_field, .int, ammo_rockets);
-/* impulse   */ ATTRIB(Mortar, impulse, int, 4);
-/* flags     */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(Mortar, bot_pickupbasevalue, float, 7000);
-/* color     */ ATTRIB(Mortar, wpcolor, vector, '1 0 0');
-/* modelname */ ATTRIB(Mortar, mdl, string, "gl");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Mortar, m_model, Model, MDL_MORTAR_ITEM);
-#endif
-/* crosshair */ ATTRIB(Mortar, w_crosshair, string, "gfx/crosshairgrenadelauncher");
-/* crosshair */ ATTRIB(Mortar, w_crosshair_size, float, 0.7);
-/* wepimg    */ ATTRIB(Mortar, model2, string, "weapongrenadelauncher");
-/* refname   */ ATTRIB(Mortar, netname, string, "mortar");
-/* wepname   */ ATTRIB(Mortar, m_name, string, _("Mortar"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, bouncefactor, float, NONE) \
-               P(class, prefix, bouncestop, float, NONE) \
-               P(class, prefix, damageforcescale, float, BOTH) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, edgedamage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, health, float, BOTH) \
-               P(class, prefix, lifetime, float, BOTH) \
-               P(class, prefix, lifetime_bounce, float, SEC) \
-               P(class, prefix, lifetime_stick, float, BOTH) \
-               P(class, prefix, radius, float, BOTH) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, reload_ammo, float, NONE) \
-               P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, remote_detonateprimary, float, SEC) \
-               P(class, prefix, remote_minbouncecnt, float, PRI) \
-               P(class, prefix, speed, float, BOTH) \
-               P(class, prefix, speed_up, float, BOTH) \
-               P(class, prefix, speed_z, float, BOTH) \
-               P(class, prefix, spread, float, BOTH) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, type, float, BOTH) \
-               P(class, prefix, weaponreplace, string, NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Mortar, mortar)
-#undef X
-ENDCLASS(Mortar)
-REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
-
 
-#ifdef SVQC
-.float gl_detonate_later;
-.float gl_bouncecnt;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 
 spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); }
@@ -427,4 +367,3 @@ METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..58b526b8ec4eddf58e3804ceb4dd5277c9978688 100644 (file)
@@ -1 +1,60 @@
 #pragma once
+
+CLASS(Mortar, Weapon)
+/* ammotype  */ ATTRIB(Mortar, ammo_field, .int, ammo_rockets);
+/* impulse   */ ATTRIB(Mortar, impulse, int, 4);
+/* flags     */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(Mortar, bot_pickupbasevalue, float, 7000);
+/* color     */ ATTRIB(Mortar, wpcolor, vector, '1 0 0');
+/* modelname */ ATTRIB(Mortar, mdl, string, "gl");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Mortar, m_model, Model, MDL_MORTAR_ITEM);
+#endif
+/* crosshair */ ATTRIB(Mortar, w_crosshair, string, "gfx/crosshairgrenadelauncher");
+/* crosshair */ ATTRIB(Mortar, w_crosshair_size, float, 0.7);
+/* wepimg    */ ATTRIB(Mortar, model2, string, "weapongrenadelauncher");
+/* refname   */ ATTRIB(Mortar, netname, string, "mortar");
+/* wepname   */ ATTRIB(Mortar, m_name, string, _("Mortar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bouncefactor, float, NONE) \
+               P(class, prefix, bouncestop, float, NONE) \
+               P(class, prefix, damageforcescale, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, health, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, lifetime_bounce, float, SEC) \
+               P(class, prefix, lifetime_stick, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, remote_detonateprimary, float, SEC) \
+               P(class, prefix, remote_minbouncecnt, float, PRI) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, BOTH) \
+               P(class, prefix, speed_z, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, type, float, BOTH) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Mortar, mortar)
+#undef X
+ENDCLASS(Mortar)
+REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
+
+
+#ifdef SVQC
+.float gl_detonate_later;
+.float gl_bouncecnt;
+#endif
index f5a19b2c776e98f78748d9e6d2748273929a0215..b4dab73cc951c2d8e93ba90c3024da215b799e00 100644 (file)
@@ -1,49 +1,5 @@
 #include "porto.qh"
-#ifndef IMPLEMENTATION
-CLASS(PortoLaunch, Weapon)
-/* ammotype  */ ATTRIB(PortoLaunch, ammo_field, .int, ammo_none);
-/* impulse   */ ATTRIB(PortoLaunch, impulse, int, 0);
-/* flags     */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(PortoLaunch, bot_pickupbasevalue, float, 0);
-/* color     */ ATTRIB(PortoLaunch, wpcolor, vector, '0.5 0.5 0.5');
-/* modelname */ ATTRIB(PortoLaunch, mdl, string, "porto");
-#ifdef GAMEQC
-/* model     */ ATTRIB(PortoLaunch, m_model, Model, MDL_PORTO_ITEM);
-#endif
-/* crosshair */ ATTRIB(PortoLaunch, w_crosshair, string, "gfx/crosshairporto");
-/* crosshair */ ATTRIB(PortoLaunch, w_crosshair_size, float, 0.6);
-/* wepimg    */ ATTRIB(PortoLaunch, model2, string, "weaponporto");
-/* refname   */ ATTRIB(PortoLaunch, netname, string, "porto");
-/* wepname   */ ATTRIB(PortoLaunch, m_name, string, _("Port-O-Launch"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, lifetime, float, BOTH) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, secondary, float, NONE) \
-               P(class, prefix, speed, float, BOTH) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string,NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, PortoLaunch, porto)
-#undef X
-ENDCLASS(PortoLaunch)
-REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
 
-#ifdef SVQC
-.entity porto_current;
-.vector porto_v_angle; // holds "held" view angles
-.float porto_v_angle_held;
-.vector right_vector;
-.float porto_forbidden;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 #include <common/triggers/trigger/jumppads.qh>
 
@@ -377,4 +333,3 @@ METHOD(PortoLaunch, wr_impacteffect, void(entity this, entity actor)) {
     LOG_WARN("Since when does Porto send DamageInfo?");
 }
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..94c6e165c587f0f095740339c3e8e30d90e23bfe 100644 (file)
@@ -1 +1,44 @@
 #pragma once
+
+CLASS(PortoLaunch, Weapon)
+/* ammotype  */ ATTRIB(PortoLaunch, ammo_field, .int, ammo_none);
+/* impulse   */ ATTRIB(PortoLaunch, impulse, int, 0);
+/* flags     */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(PortoLaunch, bot_pickupbasevalue, float, 0);
+/* color     */ ATTRIB(PortoLaunch, wpcolor, vector, '0.5 0.5 0.5');
+/* modelname */ ATTRIB(PortoLaunch, mdl, string, "porto");
+#ifdef GAMEQC
+/* model     */ ATTRIB(PortoLaunch, m_model, Model, MDL_PORTO_ITEM);
+#endif
+/* crosshair */ ATTRIB(PortoLaunch, w_crosshair, string, "gfx/crosshairporto");
+/* crosshair */ ATTRIB(PortoLaunch, w_crosshair_size, float, 0.6);
+/* wepimg    */ ATTRIB(PortoLaunch, model2, string, "weaponporto");
+/* refname   */ ATTRIB(PortoLaunch, netname, string, "porto");
+/* wepname   */ ATTRIB(PortoLaunch, m_name, string, _("Port-O-Launch"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, PortoLaunch, porto)
+#undef X
+ENDCLASS(PortoLaunch)
+REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
+
+#ifdef SVQC
+.entity porto_current;
+.vector porto_v_angle; // holds "held" view angles
+.float porto_v_angle_held;
+.vector right_vector;
+.float porto_forbidden;
+#endif
index d75b1fe8df3c2102e1e34caa1aeb73580ff862eb..92694e2e2248570b9bcc8ebd878bd8569c23aa83 100644 (file)
@@ -1,58 +1,5 @@
 #include "rifle.qh"
-#ifndef IMPLEMENTATION
-CLASS(Rifle, Weapon)
-/* ammotype  */ ATTRIB(Rifle, ammo_field, .int, ammo_nails);
-/* impulse   */ ATTRIB(Rifle, impulse, int, 7);
-/* flags     */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
-/* rating    */ ATTRIB(Rifle, bot_pickupbasevalue, float, 7000);
-/* color     */ ATTRIB(Rifle, wpcolor, vector, '0.5 1 0');
-/* modelname */ ATTRIB(Rifle, mdl, string, "campingrifle");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Rifle, m_model, Model, MDL_RIFLE_ITEM);
-#endif
-/* crosshair */ ATTRIB(Rifle, w_crosshair, string, "gfx/crosshairrifle");
-/* crosshair */ ATTRIB(Rifle, w_crosshair_size, float, 0.6);
-/* reticle   */ ATTRIB(Rifle, w_reticle, string, "gfx/reticle_nex");
-/* wepimg    */ ATTRIB(Rifle, model2, string, "weaponrifle");
-/* refname   */ ATTRIB(Rifle, netname, string, "rifle");
-/* wepname   */ ATTRIB(Rifle, m_name, string, _("Rifle"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, bullethail, float, BOTH) \
-               P(class, prefix, burstcost, float, BOTH) \
-               P(class, prefix, bursttime, float, NONE) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, reload, float, SEC) \
-               P(class, prefix, reload_ammo, float, NONE) \
-       P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, secondary, float, NONE) \
-               P(class, prefix, shots, float, BOTH) \
-               P(class, prefix, solidpenetration, float, BOTH) \
-               P(class, prefix, spread, float, BOTH) \
-       P(class, prefix, switchdelay_drop, float, NONE) \
-       P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, tracer, float, BOTH) \
-       P(class, prefix, weaponreplace, string, NONE) \
-       P(class, prefix, weaponstartoverride, float, NONE) \
-       P(class, prefix, weaponstart, float, NONE) \
-       P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Rifle, rifle)
-#undef X
-ENDCLASS(Rifle)
-REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
-
 
-#ifdef SVQC
-.float rifle_accumulator;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(this, WEP_RIFLE); }
 spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
@@ -172,14 +119,14 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
         thiswep.wr_reload(thiswep, actor, weaponentity);
     } else
     {
-        actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
+        actor.(weaponentity).rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.(weaponentity).rifle_accumulator, time);
         if(fire & 1)
         if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
-        if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
+        if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
         {
             weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
             W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
-            actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
+            actor.(weaponentity).rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
         }
         if(fire & 2)
         {
@@ -190,11 +137,11 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
                 } else
                 {
                     if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
-                    if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
+                    if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
                     {
                         weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
                         W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
-                        actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
+                        actor.(weaponentity).rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
                     }
                 }
             }
@@ -281,4 +228,3 @@ METHOD(Rifle, wr_zoom, bool(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..ed5496f050f28cb841949a0937ebd4a279c589d6 100644 (file)
@@ -1 +1,53 @@
 #pragma once
+
+CLASS(Rifle, Weapon)
+/* ammotype  */ ATTRIB(Rifle, ammo_field, .int, ammo_nails);
+/* impulse   */ ATTRIB(Rifle, impulse, int, 7);
+/* flags     */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
+/* rating    */ ATTRIB(Rifle, bot_pickupbasevalue, float, 7000);
+/* color     */ ATTRIB(Rifle, wpcolor, vector, '0.5 1 0');
+/* modelname */ ATTRIB(Rifle, mdl, string, "campingrifle");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Rifle, m_model, Model, MDL_RIFLE_ITEM);
+#endif
+/* crosshair */ ATTRIB(Rifle, w_crosshair, string, "gfx/crosshairrifle");
+/* crosshair */ ATTRIB(Rifle, w_crosshair_size, float, 0.6);
+/* reticle   */ ATTRIB(Rifle, w_reticle, string, "gfx/reticle_nex");
+/* wepimg    */ ATTRIB(Rifle, model2, string, "weaponrifle");
+/* refname   */ ATTRIB(Rifle, netname, string, "rifle");
+/* wepname   */ ATTRIB(Rifle, m_name, string, _("Rifle"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bullethail, float, BOTH) \
+               P(class, prefix, burstcost, float, BOTH) \
+               P(class, prefix, bursttime, float, NONE) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload, float, SEC) \
+               P(class, prefix, reload_ammo, float, NONE) \
+       P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shots, float, BOTH) \
+               P(class, prefix, solidpenetration, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+       P(class, prefix, switchdelay_drop, float, NONE) \
+       P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, tracer, float, BOTH) \
+       P(class, prefix, weaponreplace, string, NONE) \
+       P(class, prefix, weaponstartoverride, float, NONE) \
+       P(class, prefix, weaponstart, float, NONE) \
+       P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Rifle, rifle)
+#undef X
+ENDCLASS(Rifle)
+REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
+
+
+#ifdef SVQC
+.float rifle_accumulator;
+#endif
index 4b5ccab4a55a5f371c8475ecf032c7321c834cab..35b48b8ea03159e9a40b448bda4be2103e794a2c 100644 (file)
@@ -1,94 +1,5 @@
 #include "seeker.qh"
-#ifndef IMPLEMENTATION
-CLASS(Seeker, Weapon)
-/* ammotype  */ ATTRIB(Seeker, ammo_field, .int, ammo_rockets);
-/* impulse   */ ATTRIB(Seeker, impulse, int, 8);
-/* flags     */ ATTRIB(Seeker, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
-/* rating    */ ATTRIB(Seeker, bot_pickupbasevalue, float, 5000);
-/* color     */ ATTRIB(Seeker, wpcolor, vector, '0.5 1 0');
-/* modelname */ ATTRIB(Seeker, mdl, string, "seeker");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Seeker, m_model, Model, MDL_SEEKER_ITEM);
-#endif
-/* crosshair */ ATTRIB(Seeker, w_crosshair, string, "gfx/crosshairseeker");
-/* crosshair */ ATTRIB(Seeker, w_crosshair_size, float, 0.8);
-/* wepimg    */ ATTRIB(Seeker, model2, string, "weaponseeker");
-/* refname   */ ATTRIB(Seeker, netname, string, "seeker");
-/* wepname   */ ATTRIB(Seeker, m_name, string, _("T.A.G. Seeker"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-       P(class, prefix, flac_ammo, float, NONE) \
-       P(class, prefix, flac_animtime, float, NONE) \
-       P(class, prefix, flac_damage, float, NONE) \
-       P(class, prefix, flac_edgedamage, float, NONE) \
-       P(class, prefix, flac_force, float, NONE) \
-       P(class, prefix, flac_lifetime, float, NONE) \
-       P(class, prefix, flac_lifetime_rand, float, NONE) \
-       P(class, prefix, flac_radius, float, NONE) \
-       P(class, prefix, flac_refire, float, NONE) \
-       P(class, prefix, flac_speed, float, NONE) \
-       P(class, prefix, flac_speed_up, float, NONE) \
-       P(class, prefix, flac_speed_z, float, NONE) \
-       P(class, prefix, flac_spread, float, NONE) \
-       P(class, prefix, missile_accel, float, NONE) \
-       P(class, prefix, missile_ammo, float, NONE) \
-       P(class, prefix, missile_animtime, float, NONE) \
-       P(class, prefix, missile_count, float, NONE) \
-       P(class, prefix, missile_damageforcescale, float, NONE) \
-       P(class, prefix, missile_damage, float, NONE) \
-       P(class, prefix, missile_decel, float, NONE) \
-       P(class, prefix, missile_delay, float, NONE) \
-       P(class, prefix, missile_edgedamage, float, NONE) \
-       P(class, prefix, missile_force, float, NONE) \
-       P(class, prefix, missile_health, float, NONE) \
-       P(class, prefix, missile_lifetime, float, NONE) \
-       P(class, prefix, missile_proxy, float, NONE) \
-       P(class, prefix, missile_proxy_delay, float, NONE) \
-       P(class, prefix, missile_proxy_maxrange, float, NONE) \
-       P(class, prefix, missile_radius, float, NONE) \
-       P(class, prefix, missile_refire, float, NONE) \
-       P(class, prefix, missile_smart, float, NONE) \
-       P(class, prefix, missile_smart_mindist, float, NONE) \
-       P(class, prefix, missile_smart_trace_max, float, NONE) \
-       P(class, prefix, missile_smart_trace_min, float, NONE) \
-       P(class, prefix, missile_speed, float, NONE) \
-       P(class, prefix, missile_speed_max, float, NONE) \
-       P(class, prefix, missile_speed_up, float, NONE) \
-       P(class, prefix, missile_speed_z, float, NONE) \
-       P(class, prefix, missile_spread, float, NONE) \
-       P(class, prefix, missile_turnrate, float, NONE) \
-       P(class, prefix, reload_ammo, float, NONE) \
-               P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-       P(class, prefix, tag_ammo, float, NONE) \
-       P(class, prefix, tag_animtime, float, NONE) \
-       P(class, prefix, tag_damageforcescale, float, NONE) \
-       P(class, prefix, tag_health, float, NONE) \
-       P(class, prefix, tag_lifetime, float, NONE) \
-       P(class, prefix, tag_refire, float, NONE) \
-       P(class, prefix, tag_speed, float, NONE) \
-       P(class, prefix, tag_spread, float, NONE) \
-       P(class, prefix, tag_tracker_lifetime, float, NONE) \
-               P(class, prefix, type, float, NONE) \
-               P(class, prefix, weaponreplace, string, NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-       W_PROPS(X, Seeker, seeker)
-#undef X
-ENDCLASS(Seeker)
-REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
-
 
-#ifdef SVQC
-.entity tag_target, wps_tag_tracker;
-.float tag_time;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(this, WEP_SEEKER); }
 
@@ -763,4 +674,3 @@ METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 5a1a73f824d5c60b2902f503bdef9dd30fb4740d..04567d1b9a583083e5cfa3dec19a804eaef7adcb 100644 (file)
@@ -1,6 +1,91 @@
 #pragma once
 
+CLASS(Seeker, Weapon)
+/* ammotype  */ ATTRIB(Seeker, ammo_field, .int, ammo_rockets);
+/* impulse   */ ATTRIB(Seeker, impulse, int, 8);
+/* flags     */ ATTRIB(Seeker, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
+/* rating    */ ATTRIB(Seeker, bot_pickupbasevalue, float, 5000);
+/* color     */ ATTRIB(Seeker, wpcolor, vector, '0.5 1 0');
+/* modelname */ ATTRIB(Seeker, mdl, string, "seeker");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Seeker, m_model, Model, MDL_SEEKER_ITEM);
+#endif
+/* crosshair */ ATTRIB(Seeker, w_crosshair, string, "gfx/crosshairseeker");
+/* crosshair */ ATTRIB(Seeker, w_crosshair_size, float, 0.8);
+/* wepimg    */ ATTRIB(Seeker, model2, string, "weaponseeker");
+/* refname   */ ATTRIB(Seeker, netname, string, "seeker");
+/* wepname   */ ATTRIB(Seeker, m_name, string, _("T.A.G. Seeker"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+       P(class, prefix, flac_ammo, float, NONE) \
+       P(class, prefix, flac_animtime, float, NONE) \
+       P(class, prefix, flac_damage, float, NONE) \
+       P(class, prefix, flac_edgedamage, float, NONE) \
+       P(class, prefix, flac_force, float, NONE) \
+       P(class, prefix, flac_lifetime, float, NONE) \
+       P(class, prefix, flac_lifetime_rand, float, NONE) \
+       P(class, prefix, flac_radius, float, NONE) \
+       P(class, prefix, flac_refire, float, NONE) \
+       P(class, prefix, flac_speed, float, NONE) \
+       P(class, prefix, flac_speed_up, float, NONE) \
+       P(class, prefix, flac_speed_z, float, NONE) \
+       P(class, prefix, flac_spread, float, NONE) \
+       P(class, prefix, missile_accel, float, NONE) \
+       P(class, prefix, missile_ammo, float, NONE) \
+       P(class, prefix, missile_animtime, float, NONE) \
+       P(class, prefix, missile_count, float, NONE) \
+       P(class, prefix, missile_damageforcescale, float, NONE) \
+       P(class, prefix, missile_damage, float, NONE) \
+       P(class, prefix, missile_decel, float, NONE) \
+       P(class, prefix, missile_delay, float, NONE) \
+       P(class, prefix, missile_edgedamage, float, NONE) \
+       P(class, prefix, missile_force, float, NONE) \
+       P(class, prefix, missile_health, float, NONE) \
+       P(class, prefix, missile_lifetime, float, NONE) \
+       P(class, prefix, missile_proxy, float, NONE) \
+       P(class, prefix, missile_proxy_delay, float, NONE) \
+       P(class, prefix, missile_proxy_maxrange, float, NONE) \
+       P(class, prefix, missile_radius, float, NONE) \
+       P(class, prefix, missile_refire, float, NONE) \
+       P(class, prefix, missile_smart, float, NONE) \
+       P(class, prefix, missile_smart_mindist, float, NONE) \
+       P(class, prefix, missile_smart_trace_max, float, NONE) \
+       P(class, prefix, missile_smart_trace_min, float, NONE) \
+       P(class, prefix, missile_speed, float, NONE) \
+       P(class, prefix, missile_speed_max, float, NONE) \
+       P(class, prefix, missile_speed_up, float, NONE) \
+       P(class, prefix, missile_speed_z, float, NONE) \
+       P(class, prefix, missile_spread, float, NONE) \
+       P(class, prefix, missile_turnrate, float, NONE) \
+       P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+       P(class, prefix, tag_ammo, float, NONE) \
+       P(class, prefix, tag_animtime, float, NONE) \
+       P(class, prefix, tag_damageforcescale, float, NONE) \
+       P(class, prefix, tag_health, float, NONE) \
+       P(class, prefix, tag_lifetime, float, NONE) \
+       P(class, prefix, tag_refire, float, NONE) \
+       P(class, prefix, tag_speed, float, NONE) \
+       P(class, prefix, tag_spread, float, NONE) \
+       P(class, prefix, tag_tracker_lifetime, float, NONE) \
+               P(class, prefix, type, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Seeker, seeker)
+#undef X
+ENDCLASS(Seeker)
+REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
+
 #ifdef SVQC
+.entity tag_target, wps_tag_tracker;
+.float tag_time;
+
 IntrusiveList g_seeker_trackers;
 STATIC_INIT(g_seeker_trackers) { g_seeker_trackers = IL_NEW(); }
 #endif
index b69b9663229a75f8de6381c458774845eabc5128..bc9e94767a45177e35b3dd788f283f3beeeb7c00 100644 (file)
@@ -1,91 +1,4 @@
 #include "shockwave.qh"
-#ifndef IMPLEMENTATION
-CLASS(Shockwave, Weapon)
-/* ammotype  */ //ATTRIB(Shockwave, ammo_field, .int, ammo_none);
-/* impulse   */ ATTRIB(Shockwave, impulse, int, 2);
-/* flags     */ ATTRIB(Shockwave, spawnflags, int, WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_TYPE_MELEE_SEC);
-/* rating    */ ATTRIB(Shockwave, bot_pickupbasevalue, float, 3000);
-/* color     */ ATTRIB(Shockwave, wpcolor, vector, '0.5 0.25 0');
-/* modelname */ ATTRIB(Shockwave, mdl, string, "shotgun");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Shockwave, m_model, Model, MDL_SHOCKWAVE_ITEM);
-#endif
-/* crosshair */ ATTRIB(Shockwave, w_crosshair, string, "gfx/crosshairshotgun");
-/* crosshair */ ATTRIB(Shockwave, w_crosshair_size, float, 0.7);
-/* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshockwave");
-/* refname   */ ATTRIB(Shockwave, netname, string, "shockwave");
-/* wepname   */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, blast_animtime, float, NONE) \
-               P(class, prefix, blast_damage, float, NONE) \
-               P(class, prefix, blast_distance, float, NONE) \
-               P(class, prefix, blast_edgedamage, float, NONE) \
-               P(class, prefix, blast_force, float, NONE) \
-               P(class, prefix, blast_force_forwardbias, float, NONE) \
-               P(class, prefix, blast_force_zscale, float, NONE) \
-               P(class, prefix, blast_jump_damage, float, NONE) \
-               P(class, prefix, blast_jump_edgedamage, float, NONE) \
-               P(class, prefix, blast_jump_force, float, NONE) \
-               P(class, prefix, blast_jump_force_velocitybias, float, NONE) \
-               P(class, prefix, blast_jump_force_zscale, float, NONE) \
-               P(class, prefix, blast_jump_multiplier_accuracy, float, NONE) \
-               P(class, prefix, blast_jump_multiplier_distance, float, NONE) \
-               P(class, prefix, blast_jump_multiplier_min, float, NONE) \
-               P(class, prefix, blast_jump_radius, float, NONE) \
-               P(class, prefix, blast_multiplier_accuracy, float, NONE) \
-               P(class, prefix, blast_multiplier_distance, float, NONE) \
-               P(class, prefix, blast_multiplier_min, float, NONE) \
-               P(class, prefix, blast_refire, float, NONE) \
-               P(class, prefix, blast_splash_damage, float, NONE) \
-               P(class, prefix, blast_splash_edgedamage, float, NONE) \
-               P(class, prefix, blast_splash_force, float, NONE) \
-               P(class, prefix, blast_splash_force_forwardbias, float, NONE) \
-               P(class, prefix, blast_splash_multiplier_accuracy, float, NONE) \
-               P(class, prefix, blast_splash_multiplier_distance, float, NONE) \
-               P(class, prefix, blast_splash_multiplier_min, float, NONE) \
-               P(class, prefix, blast_splash_radius, float, NONE) \
-               P(class, prefix, blast_spread_max, float, NONE) \
-               P(class, prefix, blast_spread_min, float, NONE) \
-               P(class, prefix, melee_animtime, float, NONE) \
-               P(class, prefix, melee_damage, float, NONE) \
-               P(class, prefix, melee_delay, float, NONE) \
-               P(class, prefix, melee_force, float, NONE) \
-               P(class, prefix, melee_multihit, float, NONE) \
-               P(class, prefix, melee_no_doubleslap, float, NONE) \
-               P(class, prefix, melee_nonplayerdamage, float, NONE) \
-               P(class, prefix, melee_range, float, NONE) \
-               P(class, prefix, melee_refire, float, NONE) \
-               P(class, prefix, melee_swing_side, float, NONE) \
-               P(class, prefix, melee_swing_up, float, NONE) \
-               P(class, prefix, melee_time, float, NONE) \
-               P(class, prefix, melee_traces, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Shockwave, shockwave)
-#undef X
-
-ENDCLASS(Shockwave)
-REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
-
-
-#ifdef CSQC
-void Net_ReadShockwaveParticle();
-.vector sw_shotorg;
-.vector sw_shotdir;
-.float sw_distance;
-.float sw_spread_max;
-.float sw_spread_min;
-.float sw_time;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 
 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
 
@@ -197,14 +110,14 @@ void W_Shockwave_Melee_Think(entity this)
                                { accuracy_add(this.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); }
 
                        #ifdef DEBUG_SHOCKWAVE
-                       LOG_INFO(sprintf(
-                               "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.\n",
+                       LOG_INFOF(
+                               "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.",
                                this.realowner.netname,
                                target_victim.netname,
                                swing_damage,
                                swing_factor,
                                time
-                       ));
+                       );
                        #endif
 
                        // allow multiple hits with one swing, but not against the same player twice
@@ -398,12 +311,11 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
                false
        );
 
-       float lag = ANTILAG_LATENCY(actor);
+       float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
+       bool noantilag = ((IS_CLIENT(actor)) ? CS(actor).cvar_cl_noantilag : false);
        if(lag < 0.001)
                lag = 0;
-       if (!IS_REAL_CLIENT(actor))
-               lag = 0;
-       if(autocvar_g_antilag == 0 || actor.cvar_cl_noantilag)
+       if(autocvar_g_antilag == 0 || noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
        {
@@ -485,15 +397,15 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
                                );
 
                                #ifdef DEBUG_SHOCKWAVE
-                               LOG_INFO(sprintf(
+                               LOG_INFOF(
                                        "SELF HIT: multiplier = %f, damage = %f, force = %f... "
-                                       "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
+                                       "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
                                        multiplier,
                                        final_damage,
                                        vlen(final_force),
                                        multiplier_from_accuracy,
                                        multiplier_from_distance
-                               ));
+                               );
                                #endif
                        }
                        else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
@@ -548,15 +460,15 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
                                if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
 
                                #ifdef DEBUG_SHOCKWAVE
-                               LOG_INFO(sprintf(
+                               LOG_INFOF(
                                        "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
-                                       "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
+                                       "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
                                        multiplier,
                                        final_damage,
                                        vlen(final_force),
                                        multiplier_from_accuracy,
                                        multiplier_from_distance
-                               ));
+                               );
                                #endif
                        }
                }
@@ -637,15 +549,15 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
                                if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
 
                                #ifdef DEBUG_SHOCKWAVE
-                               LOG_INFO(sprintf(
+                               LOG_INFOF(
                                        "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
-                                       "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
+                                       "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
                                        multiplier,
                                        final_damage,
                                        vlen(final_force),
                                        multiplier_from_accuracy,
                                        multiplier_from_distance
-                               ));
+                               );
                                #endif
                        }
                }
@@ -672,12 +584,12 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
                        accuracy_add(actor, WEP_SHOCKWAVE.m_id, 0, final_damage);
 
                #ifdef DEBUG_SHOCKWAVE
-               LOG_INFO(sprintf(
-                       "SHOCKWAVE by %s: damage = %f, force = %f.\n",
+               LOG_INFOF(
+                       "SHOCKWAVE by %s: damage = %f, force = %f.",
                        actor.netname,
                        final_damage,
                        vlen(final_force)
-               ));
+               );
                #endif
 
                shockwave_hit[i-1] = NULL;
@@ -885,4 +797,3 @@ METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..f863094c00f54582d8cf7a088adb04f33c5e27a3 100644 (file)
@@ -1 +1,86 @@
 #pragma once
+
+CLASS(Shockwave, Weapon)
+/* ammotype  */ //ATTRIB(Shockwave, ammo_field, .int, ammo_none);
+/* impulse   */ ATTRIB(Shockwave, impulse, int, 2);
+/* flags     */ ATTRIB(Shockwave, spawnflags, int, WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_TYPE_MELEE_SEC);
+/* rating    */ ATTRIB(Shockwave, bot_pickupbasevalue, float, 3000);
+/* color     */ ATTRIB(Shockwave, wpcolor, vector, '0.5 0.25 0');
+/* modelname */ ATTRIB(Shockwave, mdl, string, "shotgun");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Shockwave, m_model, Model, MDL_SHOCKWAVE_ITEM);
+#endif
+/* crosshair */ ATTRIB(Shockwave, w_crosshair, string, "gfx/crosshairshotgun");
+/* crosshair */ ATTRIB(Shockwave, w_crosshair_size, float, 0.7);
+/* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshockwave");
+/* refname   */ ATTRIB(Shockwave, netname, string, "shockwave");
+/* wepname   */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, blast_animtime, float, NONE) \
+               P(class, prefix, blast_damage, float, NONE) \
+               P(class, prefix, blast_distance, float, NONE) \
+               P(class, prefix, blast_edgedamage, float, NONE) \
+               P(class, prefix, blast_force, float, NONE) \
+               P(class, prefix, blast_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_damage, float, NONE) \
+               P(class, prefix, blast_jump_edgedamage, float, NONE) \
+               P(class, prefix, blast_jump_force, float, NONE) \
+               P(class, prefix, blast_jump_force_velocitybias, float, NONE) \
+               P(class, prefix, blast_jump_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_min, float, NONE) \
+               P(class, prefix, blast_jump_radius, float, NONE) \
+               P(class, prefix, blast_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_multiplier_min, float, NONE) \
+               P(class, prefix, blast_refire, float, NONE) \
+               P(class, prefix, blast_splash_damage, float, NONE) \
+               P(class, prefix, blast_splash_edgedamage, float, NONE) \
+               P(class, prefix, blast_splash_force, float, NONE) \
+               P(class, prefix, blast_splash_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_min, float, NONE) \
+               P(class, prefix, blast_splash_radius, float, NONE) \
+               P(class, prefix, blast_spread_max, float, NONE) \
+               P(class, prefix, blast_spread_min, float, NONE) \
+               P(class, prefix, melee_animtime, float, NONE) \
+               P(class, prefix, melee_damage, float, NONE) \
+               P(class, prefix, melee_delay, float, NONE) \
+               P(class, prefix, melee_force, float, NONE) \
+               P(class, prefix, melee_multihit, float, NONE) \
+               P(class, prefix, melee_no_doubleslap, float, NONE) \
+               P(class, prefix, melee_nonplayerdamage, float, NONE) \
+               P(class, prefix, melee_range, float, NONE) \
+               P(class, prefix, melee_refire, float, NONE) \
+               P(class, prefix, melee_swing_side, float, NONE) \
+               P(class, prefix, melee_swing_up, float, NONE) \
+               P(class, prefix, melee_time, float, NONE) \
+               P(class, prefix, melee_traces, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shockwave, shockwave)
+#undef X
+
+ENDCLASS(Shockwave)
+REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
+
+
+#ifdef CSQC
+void Net_ReadShockwaveParticle();
+.vector sw_shotorg;
+.vector sw_shotdir;
+.float sw_distance;
+.float sw_spread_max;
+.float sw_spread_min;
+.float sw_time;
+#endif
index e597665c5ebee23918afad49a5a47cf2abb48145..3644c1357e3fa2517d7a6de28832c14f2de0c394 100644 (file)
@@ -1,61 +1,5 @@
 #include "shotgun.qh"
-#ifndef IMPLEMENTATION
-CLASS(Shotgun, Weapon)
-/* ammotype  */ ATTRIB(Shotgun, ammo_field, .int, ammo_shells);
-/* impulse   */ ATTRIB(Shotgun, impulse, int, 2);
-/* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC);
-/* rating    */ ATTRIB(Shotgun, bot_pickupbasevalue, float, 6000);
-/* color     */ ATTRIB(Shotgun, wpcolor, vector, '0.5 0.25 0');
-/* modelname */ ATTRIB(Shotgun, mdl, string, "shotgun");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Shotgun, m_model, Model, MDL_SHOTGUN_ITEM);
-#endif
-/* crosshair */ ATTRIB(Shotgun, w_crosshair, string, "gfx/crosshairshotgun");
-/* crosshair */ ATTRIB(Shotgun, w_crosshair_size, float, 0.65);
-/* wepimg    */ ATTRIB(Shotgun, model2, string, "weaponshotgun");
-/* refname   */ ATTRIB(Shotgun, netname, string, "shotgun");
-/* wepname   */ ATTRIB(Shotgun, m_name, string, _("Shotgun"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, alt_animtime, float, SEC) \
-               P(class, prefix, alt_refire, float, SEC) \
-               P(class, prefix, ammo, float, PRI) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, bullets, float, PRI) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, melee_delay, float, SEC) \
-               P(class, prefix, melee_multihit, float, SEC) \
-               P(class, prefix, melee_nonplayerdamage, float, SEC) \
-               P(class, prefix, melee_no_doubleslap, float, SEC) \
-               P(class, prefix, melee_range, float, SEC) \
-               P(class, prefix, melee_swing_side, float, SEC) \
-               P(class, prefix, melee_swing_up, float, SEC) \
-               P(class, prefix, melee_time, float, SEC) \
-               P(class, prefix, melee_traces, float, SEC) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-               P(class, prefix, secondary, float, NONE) \
-               P(class, prefix, solidpenetration, float, PRI) \
-               P(class, prefix, spread, float, PRI) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, weaponreplace, string,NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Shotgun, shotgun)
-#undef X
-
-ENDCLASS(Shotgun)
-REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
-
 
-#endif
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); }
 
@@ -125,7 +69,7 @@ void W_Shotgun_Melee_Think(entity this)
                        + (v_up * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_up))
                        + (v_right * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_side)));
 
-               WarpZone_traceline_antilag(this, this.realowner.origin + this.realowner.view_ofs, targpos, false, this.realowner, ANTILAG_LATENCY(this.realowner));
+               WarpZone_traceline_antilag(this, this.realowner.origin + this.realowner.view_ofs, targpos, false, this.realowner, ((IS_CLIENT(this.realowner)) ? ANTILAG_LATENCY(this.realowner) : 0));
 
                // draw lightning beams for debugging
                //te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
@@ -335,4 +279,3 @@ METHOD(Shotgun, wr_impacteffect, void(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..2fd734d554b2ddb6dc43aa11042e41abbd02ae20 100644 (file)
@@ -1 +1,54 @@
 #pragma once
+
+CLASS(Shotgun, Weapon)
+/* ammotype  */ ATTRIB(Shotgun, ammo_field, .int, ammo_shells);
+/* impulse   */ ATTRIB(Shotgun, impulse, int, 2);
+/* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC);
+/* rating    */ ATTRIB(Shotgun, bot_pickupbasevalue, float, 6000);
+/* color     */ ATTRIB(Shotgun, wpcolor, vector, '0.5 0.25 0');
+/* modelname */ ATTRIB(Shotgun, mdl, string, "shotgun");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Shotgun, m_model, Model, MDL_SHOTGUN_ITEM);
+#endif
+/* crosshair */ ATTRIB(Shotgun, w_crosshair, string, "gfx/crosshairshotgun");
+/* crosshair */ ATTRIB(Shotgun, w_crosshair_size, float, 0.65);
+/* wepimg    */ ATTRIB(Shotgun, model2, string, "weaponshotgun");
+/* refname   */ ATTRIB(Shotgun, netname, string, "shotgun");
+/* wepname   */ ATTRIB(Shotgun, m_name, string, _("Shotgun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, alt_animtime, float, SEC) \
+               P(class, prefix, alt_refire, float, SEC) \
+               P(class, prefix, ammo, float, PRI) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bullets, float, PRI) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, melee_delay, float, SEC) \
+               P(class, prefix, melee_multihit, float, SEC) \
+               P(class, prefix, melee_nonplayerdamage, float, SEC) \
+               P(class, prefix, melee_no_doubleslap, float, SEC) \
+               P(class, prefix, melee_range, float, SEC) \
+               P(class, prefix, melee_swing_side, float, SEC) \
+               P(class, prefix, melee_swing_up, float, SEC) \
+               P(class, prefix, melee_time, float, SEC) \
+               P(class, prefix, melee_traces, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, solidpenetration, float, PRI) \
+               P(class, prefix, spread, float, PRI) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shotgun, shotgun)
+#undef X
+
+ENDCLASS(Shotgun)
+REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
index ef3c4dc83ccfeb798396159ea4c2d3beba3226c8..a5ae87c36b392256205cc47dd79aa879c628ae7a 100644 (file)
@@ -1,47 +1,4 @@
 #include "tuba.qh"
-#ifndef IMPLEMENTATION
-CLASS(Tuba, Weapon)
-/* impulse   */ ATTRIB(Tuba, impulse, int, 1);
-/* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, 2000);
-/* color     */ ATTRIB(Tuba, wpcolor, vector, '0 1 0');
-/* modelname */ ATTRIB(Tuba, mdl, string, "tuba");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Tuba, m_model, Model, MDL_TUBA_ITEM);
-#endif
-/* crosshair */ ATTRIB(Tuba, w_crosshair, string, "gfx/crosshairtuba");
-/* crosshair */ //ATTRIB(Tuba, w_crosshair_size, float, 0.65);
-/* wepimg    */ ATTRIB(Tuba, model2, string, "weapontuba");
-/* refname   */ ATTRIB(Tuba, netname, string, "tuba");
-/* xgettext:no-c-format */
-/* wepname   */ ATTRIB(Tuba, m_name, string, _("@!#%'n Tuba"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, animtime, float, NONE) \
-               P(class, prefix, attenuation, float, NONE) \
-               P(class, prefix, damage, float, NONE) \
-               P(class, prefix, edgedamage, float, NONE) \
-               P(class, prefix, fadetime, float, NONE) \
-               P(class, prefix, force, float, NONE) \
-               P(class, prefix, pitchstep, float, NONE) \
-               P(class, prefix, radius, float, NONE) \
-               P(class, prefix, refire, float, NONE) \
-               P(class, prefix, switchdelay_drop, float, NONE) \
-               P(class, prefix, switchdelay_raise, float, NONE) \
-               P(class, prefix, volume, float, NONE) \
-               P(class, prefix, weaponreplace, string, NONE) \
-               P(class, prefix, weaponstartoverride, float, NONE) \
-               P(class, prefix, weaponstart, float, NONE) \
-               P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Tuba, tuba)
-#undef X
-ENDCLASS(Tuba)
-REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
-#endif
-
-#ifdef IMPLEMENTATION
 
 #ifdef SVQC
 
@@ -186,10 +143,10 @@ void W_Tuba_NoteOff(entity this)
 int W_Tuba_GetNote(entity pl, int hittype)
 {
        float movestate = 5;
-       if (pl.movement.x < 0)          movestate -= 3;
-       else if (pl.movement.x > 0)     movestate += 3;
-       if (pl.movement.y < 0)          movestate -= 1;
-       else if (pl.movement.y > 0)     movestate += 1;
+       if (CS(pl).movement.x < 0)              movestate -= 3;
+       else if (CS(pl).movement.x > 0) movestate += 3;
+       if (CS(pl).movement.y < 0)              movestate -= 1;
+       else if (CS(pl).movement.y > 0) movestate += 1;
 
        int note = 0;
        switch (movestate)
@@ -634,4 +591,3 @@ PRECACHE(Tuba)
 }
 
 #endif
-#endif
index ce6b6ede739c76fd2dd2eed274912ffce10228a2..714a2b8b5853566a8175049433744f69dcdfc4c8 100644 (file)
@@ -1,5 +1,45 @@
 #pragma once
 
+CLASS(Tuba, Weapon)
+/* impulse   */ ATTRIB(Tuba, impulse, int, 1);
+/* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, 2000);
+/* color     */ ATTRIB(Tuba, wpcolor, vector, '0 1 0');
+/* modelname */ ATTRIB(Tuba, mdl, string, "tuba");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Tuba, m_model, Model, MDL_TUBA_ITEM);
+#endif
+/* crosshair */ ATTRIB(Tuba, w_crosshair, string, "gfx/crosshairtuba");
+/* crosshair */ //ATTRIB(Tuba, w_crosshair_size, float, 0.65);
+/* wepimg    */ ATTRIB(Tuba, model2, string, "weapontuba");
+/* refname   */ ATTRIB(Tuba, netname, string, "tuba");
+/* xgettext:no-c-format */
+/* wepname   */ ATTRIB(Tuba, m_name, string, _("@!#%'n Tuba"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, attenuation, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, fadetime, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, pitchstep, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, volume, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Tuba, tuba)
+#undef X
+ENDCLASS(Tuba)
+REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
+
 #ifdef CSQC
 entityclass(Tuba);
 class(Tuba) .int note;
index 51ce8893d305c0bf262de7bfaedde8291fca12f5..e47f8fa909565a3734188c1f57d376cc1d1a5899 100644 (file)
@@ -1,67 +1,4 @@
 #include "vaporizer.qh"
-#ifndef IMPLEMENTATION
-CLASS(Vaporizer, Weapon)
-/* ammotype  */ ATTRIB(Vaporizer, ammo_field, .int, ammo_cells);
-/* impulse   */ ATTRIB(Vaporizer, impulse, int, 7);
-/* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, 10000);
-/* color     */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1');
-/* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM);
-#endif
-/* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex");
-/* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6);
-/* reticle   */ ATTRIB(Vaporizer, w_reticle, string, "gfx/reticle_nex");
-/* wepimg    */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
-/* refname   */ ATTRIB(Vaporizer, netname, string, "vaporizer");
-/* wepname   */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, PRI) \
-       P(class, prefix, animtime, float, PRI) \
-       P(class, prefix, damage, float, PRI) \
-       P(class, prefix, refire, float, PRI) \
-       P(class, prefix, ammo, float, SEC) \
-       P(class, prefix, animtime, float, SEC) \
-       P(class, prefix, damage, float, SEC) \
-       P(class, prefix, delay, float, SEC) \
-       P(class, prefix, edgedamage, float, SEC) \
-       P(class, prefix, force, float, SEC) \
-       P(class, prefix, lifetime, float, SEC) \
-       P(class, prefix, radius, float, SEC) \
-       P(class, prefix, refire, float, SEC) \
-       P(class, prefix, shotangle, float, SEC) \
-       P(class, prefix, speed, float, SEC) \
-       P(class, prefix, spread, float, SEC) \
-       P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Vaporizer, vaporizer)
-#undef X
-
-ENDCLASS(Vaporizer)
-REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
-
-
-#ifdef SVQC
-.float vaporizer_lasthit;
-.float jump_interval;
-.float jump_interval2;
-.bool held_down;
-.float rm_force;
-.float rm_damage;
-.float rm_edmg;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 
 REGISTER_NET_TEMP(TE_CSQC_VAPORBEAMPARTICLE)
 
@@ -515,4 +452,3 @@ METHOD(Vaporizer, wr_zoom, bool(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..f0b144341d538d1f24d39f47a43990b4e1be5e98 100644 (file)
@@ -1 +1,62 @@
 #pragma once
+
+CLASS(Vaporizer, Weapon)
+/* ammotype  */ ATTRIB(Vaporizer, ammo_field, .int, ammo_cells);
+/* impulse   */ ATTRIB(Vaporizer, impulse, int, 7);
+/* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, 10000);
+/* color     */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1');
+/* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM);
+#endif
+/* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex");
+/* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6);
+/* reticle   */ ATTRIB(Vaporizer, w_reticle, string, "gfx/reticle_nex");
+/* wepimg    */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
+/* refname   */ ATTRIB(Vaporizer, netname, string, "vaporizer");
+/* wepname   */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, PRI) \
+       P(class, prefix, animtime, float, PRI) \
+       P(class, prefix, damage, float, PRI) \
+       P(class, prefix, refire, float, PRI) \
+       P(class, prefix, ammo, float, SEC) \
+       P(class, prefix, animtime, float, SEC) \
+       P(class, prefix, damage, float, SEC) \
+       P(class, prefix, delay, float, SEC) \
+       P(class, prefix, edgedamage, float, SEC) \
+       P(class, prefix, force, float, SEC) \
+       P(class, prefix, lifetime, float, SEC) \
+       P(class, prefix, radius, float, SEC) \
+       P(class, prefix, refire, float, SEC) \
+       P(class, prefix, shotangle, float, SEC) \
+       P(class, prefix, speed, float, SEC) \
+       P(class, prefix, spread, float, SEC) \
+       P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Vaporizer, vaporizer)
+#undef X
+
+ENDCLASS(Vaporizer)
+REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
+
+
+#ifdef SVQC
+.float vaporizer_lasthit;
+.float jump_interval;
+.float jump_interval2;
+.bool held_down;
+.float rm_force;
+.float rm_damage;
+.float rm_edmg;
+#endif
index ee7bf22eadbc8b1e929b0a7bac29c9e340e1f43b..454cb8bfba1b3cb53d59bbb7ced9081fc265c5b5 100644 (file)
@@ -1,71 +1,4 @@
 #include "vortex.qh"
-#ifndef IMPLEMENTATION
-CLASS(Vortex, Weapon)
-/* ammotype  */ ATTRIB(Vortex, ammo_field, .int, ammo_cells);
-/* impulse   */ ATTRIB(Vortex, impulse, int, 7);
-/* flags     */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
-/* rating    */ ATTRIB(Vortex, bot_pickupbasevalue, float, 8000);
-/* color     */ ATTRIB(Vortex, wpcolor, vector, '0.5 1 1');
-/* modelname */ ATTRIB(Vortex, mdl, string, "nex");
-#ifdef GAMEQC
-/* model     */ ATTRIB(Vortex, m_model, Model, MDL_VORTEX_ITEM);
-#endif
-/* crosshair */ ATTRIB(Vortex, w_crosshair, string, "gfx/crosshairnex");
-/* crosshair */ ATTRIB(Vortex, w_crosshair_size, float, 0.65);
-/* reticle   */ ATTRIB(Vortex, w_reticle, string, "gfx/reticle_nex");
-/* wepimg    */ ATTRIB(Vortex, model2, string, "weaponnex");
-/* refname   */ ATTRIB(Vortex, netname, string, "vortex");
-/* wepname   */ ATTRIB(Vortex, m_name, string, _("Vortex"));
-
-#define X(BEGIN, P, END, class, prefix) \
-       BEGIN(class) \
-               P(class, prefix, ammo, float, BOTH) \
-               P(class, prefix, animtime, float, BOTH) \
-               P(class, prefix, chargepool, float, SEC) \
-               P(class, prefix, chargepool_pause_regen, float, SEC) \
-               P(class, prefix, chargepool_regen, float, SEC) \
-               P(class, prefix, charge, float, NONE) \
-               P(class, prefix, charge_animlimit, float, NONE) \
-               P(class, prefix, charge_limit, float, NONE) \
-               P(class, prefix, charge_maxspeed, float, NONE) \
-               P(class, prefix, charge_mindmg, float, NONE) \
-               P(class, prefix, charge_minspeed, float, NONE) \
-               P(class, prefix, charge_rate, float, NONE) \
-               P(class, prefix, charge_rot_pause, float, NONE) \
-               P(class, prefix, charge_rot_rate, float, NONE) \
-               P(class, prefix, charge_shot_multiplier, float, NONE) \
-               P(class, prefix, charge_start, float, NONE) \
-               P(class, prefix, charge_velocity_rate, float, NONE) \
-               P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
-               P(class, prefix, damagefalloff_halflife, float, BOTH) \
-               P(class, prefix, damagefalloff_maxdist, float, BOTH) \
-               P(class, prefix, damagefalloff_mindist, float, BOTH) \
-               P(class, prefix, damage, float, BOTH) \
-               P(class, prefix, force, float, BOTH) \
-               P(class, prefix, refire, float, BOTH) \
-               P(class, prefix, secondary, float, NONE) \
-               P(class, prefix, reload_ammo, float, NONE) \
-        P(class, prefix, reload_time, float, NONE) \
-        P(class, prefix, switchdelay_raise, float, NONE) \
-        P(class, prefix, switchdelay_drop, float, NONE) \
-        P(class, prefix, weaponreplace, string, NONE) \
-        P(class, prefix, weaponstart, float, NONE) \
-        P(class, prefix, weaponstartoverride, float, NONE) \
-        P(class, prefix, weaponthrowable, float, NONE) \
-       END()
-    W_PROPS(X, Vortex, vortex)
-#undef X
-
-ENDCLASS(Vortex)
-REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
-
-
-#ifdef SVQC
-
-.float vortex_lasthit;
-#endif
-#endif
-#ifdef IMPLEMENTATION
 
 //REGISTER_STAT(WEP_CVAR_vortex_charge, bool, WEP_CVAR(vortex, charge))
 //REGISTER_STAT(WEP_CVAR_vortex_charge_animlimit, float, WEP_CVAR(vortex, charge_animlimit))
@@ -429,4 +362,3 @@ METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor))
 }
 
 #endif
-#endif
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..81ab7e6209d4389d9f8eac7765866623ab51e7c6 100644 (file)
@@ -1 +1,66 @@
 #pragma once
+
+CLASS(Vortex, Weapon)
+/* ammotype  */ ATTRIB(Vortex, ammo_field, .int, ammo_cells);
+/* impulse   */ ATTRIB(Vortex, impulse, int, 7);
+/* flags     */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
+/* rating    */ ATTRIB(Vortex, bot_pickupbasevalue, float, 8000);
+/* color     */ ATTRIB(Vortex, wpcolor, vector, '0.5 1 1');
+/* modelname */ ATTRIB(Vortex, mdl, string, "nex");
+#ifdef GAMEQC
+/* model     */ ATTRIB(Vortex, m_model, Model, MDL_VORTEX_ITEM);
+#endif
+/* crosshair */ ATTRIB(Vortex, w_crosshair, string, "gfx/crosshairnex");
+/* crosshair */ ATTRIB(Vortex, w_crosshair_size, float, 0.65);
+/* reticle   */ ATTRIB(Vortex, w_reticle, string, "gfx/reticle_nex");
+/* wepimg    */ ATTRIB(Vortex, model2, string, "weaponnex");
+/* refname   */ ATTRIB(Vortex, netname, string, "vortex");
+/* wepname   */ ATTRIB(Vortex, m_name, string, _("Vortex"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, chargepool, float, SEC) \
+               P(class, prefix, chargepool_pause_regen, float, SEC) \
+               P(class, prefix, chargepool_regen, float, SEC) \
+               P(class, prefix, charge, float, NONE) \
+               P(class, prefix, charge_animlimit, float, NONE) \
+               P(class, prefix, charge_limit, float, NONE) \
+               P(class, prefix, charge_maxspeed, float, NONE) \
+               P(class, prefix, charge_mindmg, float, NONE) \
+               P(class, prefix, charge_minspeed, float, NONE) \
+               P(class, prefix, charge_rate, float, NONE) \
+               P(class, prefix, charge_rot_pause, float, NONE) \
+               P(class, prefix, charge_rot_rate, float, NONE) \
+               P(class, prefix, charge_shot_multiplier, float, NONE) \
+               P(class, prefix, charge_start, float, NONE) \
+               P(class, prefix, charge_velocity_rate, float, NONE) \
+               P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
+               P(class, prefix, damagefalloff_halflife, float, BOTH) \
+               P(class, prefix, damagefalloff_maxdist, float, BOTH) \
+               P(class, prefix, damagefalloff_mindist, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Vortex, vortex)
+#undef X
+
+ENDCLASS(Vortex)
+REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
+
+
+#ifdef SVQC
+
+.float vortex_lasthit;
+#endif
index db59359b31abd8a22c08a5bb28f143be94356e1d..e6c2f7ccd8617e0087b19d0224d5e0760174cf3f 100644 (file)
@@ -15,11 +15,14 @@ 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);
 
-       this.buttons_old = PHYS_INPUT_BUTTON_MASK(this);
-       this.movement_old = this.movement;
-       this.v_angle_old = this.v_angle;
+       PHYS_CS(this).movement_old = PHYS_CS(this).movement;
+       PHYS_CS(this).v_angle_old = this.v_angle;
+       PHYS_CS(this).buttons_old = PHYS_INPUT_BUTTON_MASK(this);
 
        sys_phys_ai(this);
 
@@ -200,10 +203,10 @@ void sys_phys_simulate(entity this, float dt)
                }
        }
        makevectors(vmul(this.v_angle, (this.com_phys_vel_2d ? '0 1 0' : '1 1 1')));
-       // wishvel = v_forward * this.movement.x + v_right * this.movement.y + v_up * this.movement.z;
-       vector wishvel = v_forward * this.movement.x
-           + v_right * this.movement.y
-           + '0 0 1' * this.movement.z * (this.com_phys_vel_2d ? 0 : 1);
+       // wishvel = v_forward * PHYS_CS(this).movement.x + v_right * PHYS_CS(this).movement.y + v_up * PHYS_CS(this).movement.z;
+       vector wishvel = v_forward * PHYS_CS(this).movement.x
+           + v_right * PHYS_CS(this).movement.y
+           + '0 0 1' * PHYS_CS(this).movement.z * (this.com_phys_vel_2d ? 0 : 1);
        if (this.com_phys_water) {
                if (PHYS_INPUT_BUTTON_CROUCH(this)) {
                        wishvel.z = -PHYS_MAXSPEED(this);
@@ -216,7 +219,7 @@ void sys_phys_simulate(entity this, float dt)
        }
        if (this.com_phys_ladder) {
                if (this.viewloc) {
-                       wishvel.z = this.movement_old.x;
+                       wishvel.z = PHYS_CS(this).movement_old.x;
                }
                if (this.ladder_entity.classname == "func_water") {
                        float f = vlen(wishvel);
@@ -271,7 +274,7 @@ void sys_phys_simulate(entity this, float dt)
                        // dv/dt = accel * maxspeed * (1 - accelqw) (when fast)
                        // log dv/dt = logaccel + logmaxspeed (when slow)
                        // log dv/dt = logaccel + logmaxspeed + log(1 - accelqw) (when fast)
-                       float strafity = IsMoveInDirection(this.movement, -90) + IsMoveInDirection(this.movement, +90);  // if one is nonzero, other is always zero
+                       float strafity = IsMoveInDirection(PHYS_CS(this).movement, -90) + IsMoveInDirection(PHYS_CS(this).movement, +90);  // if one is nonzero, other is always zero
                        if (PHYS_MAXAIRSTRAFESPEED(this)) {
                                wishspeed =
                                    min(wishspeed,
@@ -288,7 +291,7 @@ void sys_phys_simulate(entity this, float dt)
                        }
                        // !CPM
 
-                       if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && this.movement.y == 0 && this.movement.x != 0) {
+                       if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && PHYS_CS(this).movement.y == 0 && PHYS_CS(this).movement.x != 0) {
                                PM_AirAccelerate(this, dt, wishdir, wishspeed2);
                        } else {
                                float sidefric = maxairspd ? (PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd) : 0;
index 9e46dcfc57513b42bb6d6e634666a7c30fe6ed80..c20ae8bda2065a58ffd01176ae3ebbe5aa4412f1 100644 (file)
@@ -3,19 +3,17 @@
 void sys_phys_fix(entity this, float dt)
 {
        WarpZone_PlayerPhysics_FixVAngle(this);
-       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
-       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed!
-       Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
+       Physics_UpdateStats(this);
 }
 
 bool sys_phys_override(entity this, float dt)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
-       float idlesince = this.parm_idlesince;
-       this.parm_idlesince = time; // in the case that physics are overridden
+       float idlesince = CS(this).parm_idlesince;
+       CS(this).parm_idlesince = time; // in the case that physics are overridden
        if (PM_check_specialcommand(this, buttons)) { return true; }
        if (this.PlayerPhysplug && this.PlayerPhysplug(this, dt)) { return true; }
-       this.parm_idlesince = idlesince;
+       CS(this).parm_idlesince = idlesince;
        return false;
 }
 
@@ -24,9 +22,9 @@ void sys_phys_monitor(entity this, float dt)
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
        anticheat_physics(this);
        if (sv_maxidle > 0) {
-               if (buttons != this.buttons_old
-                   || this.movement != this.movement_old
-                   || this.v_angle != this.v_angle_old) { this.parm_idlesince = time; }
+               if (buttons != CS(this).buttons_old
+                   || CS(this).movement != CS(this).movement_old
+                   || this.v_angle != CS(this).v_angle_old) { CS(this).parm_idlesince = time; }
        }
        PM_check_nickspam(this);
        PM_check_punch(this, dt);
@@ -57,28 +55,28 @@ void sys_phys_spectator_control(entity this)
 {
        float maxspeed_mod = autocvar_sv_spectator_speed_multiplier;
        if (!this.spectatorspeed) { this.spectatorspeed = maxspeed_mod; }
-       if ((this.impulse >= 1 && this.impulse <= 19)
-           || (this.impulse >= 200 && this.impulse <= 209)
-           || (this.impulse >= 220 && this.impulse <= 229)
+       if ((CS(this).impulse >= 1 && CS(this).impulse <= 19)
+           || (CS(this).impulse >= 200 && CS(this).impulse <= 209)
+           || (CS(this).impulse >= 220 && CS(this).impulse <= 229)
           ) {
                if (this.lastclassname != STR_PLAYER) {
-                       if (this.impulse == 10
-                           || this.impulse == 15
-                           || this.impulse == 18
-                           || (this.impulse >= 200 && this.impulse <= 209)
-                          ) { this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5); } else if (this.impulse == 11) {
+                       if (CS(this).impulse == 10
+                           || CS(this).impulse == 15
+                           || CS(this).impulse == 18
+                           || (CS(this).impulse >= 200 && CS(this).impulse <= 209)
+                          ) { this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5); } else if (CS(this).impulse == 11) {
                                this.spectatorspeed = maxspeed_mod;
-                       } else if (this.impulse == 12
-                           || this.impulse == 16
-                           || this.impulse == 19
-                           || (this.impulse >= 220 && this.impulse <= 229)
+                       } else if (CS(this).impulse == 12
+                           || CS(this).impulse == 16
+                           || CS(this).impulse == 19
+                           || (CS(this).impulse >= 220 && CS(this).impulse <= 229)
                                  ) {
                                this.spectatorspeed = bound(1, this.spectatorspeed - 0.5, 5);
-                       } else if (this.impulse >= 1 && this.impulse <= 9) {
-                               this.spectatorspeed = 1 + 0.5 * (this.impulse - 1);
+                       } else if (CS(this).impulse >= 1 && CS(this).impulse <= 9) {
+                               this.spectatorspeed = 1 + 0.5 * (CS(this).impulse - 1);
                        }
                }  // otherwise just clear
-               this.impulse = 0;
+               CS(this).impulse = 0;
        }
 }
 
index b8d78cd0419e209ff8eca3a62e96240ac4d99bfe..4da78f1444eb27b397d926442c7a153012adf01e 100644 (file)
        #define bool float
 #endif
 
+#ifndef QCC_SUPPORT_ERASEABLE
+       #define ERASEABLE
+#else
+       #define ERASEABLE [[eraseable]]
+#endif
+
 #include <dpdefs/pre.qh>
 
 #if defined(CSQC)
index cebf84493e09bb60ffbee5d73ac9f71b7e406608..1757c55b812a184c7f00f0e26c82eeb8704c303a 100644 (file)
@@ -1,10 +1,15 @@
 .vector origin;
+
+// angles of the player's model (as opposed to their view which uses `.vector v_angle;`) in degrees
+// x is pitch: positive means up (unlike .v_angle), usually is 0
+// y is yaw: between -180 and 180, increases when turning left
+// z is roll: positive means tilted clockwise, usually is 0
 .vector angles;
 
 /*
 * Return a angle within +/- 360.
 */
-[[eraseable]]
+ERASEABLE
 float anglemods(float v)
 {
        v = v - 360 * floor(v / 360);
@@ -20,7 +25,7 @@ float anglemods(float v)
 /*
 * Return the short angle
 */
-[[eraseable]]
+ERASEABLE
 float shortangle_f(float ang1, float ang2)
 {
        if(ang1 > ang2)
@@ -37,7 +42,7 @@ float shortangle_f(float ang1, float ang2)
        return ang1;
 }
 
-[[eraseable]]
+ERASEABLE
 vector shortangle_v(vector ang1, vector ang2)
 {
        vector vtmp;
@@ -49,7 +54,7 @@ vector shortangle_v(vector ang1, vector ang2)
        return vtmp;
 }
 
-[[eraseable]]
+ERASEABLE
 vector shortangle_vxy(vector ang1, vector ang2)
 {
        vector vtmp = '0 0 0';
@@ -64,7 +69,7 @@ vector shortangle_vxy(vector ang1, vector ang2)
 * Return the angle offset between angle ang and angle of the vector from->to
 */
 
-[[eraseable]]
+ERASEABLE
 vector angleofs3(vector from, vector ang, vector to)
 {
        vector v_res;
index ec9246c99b4ddd09da26475d93471a5f28d862de..c158ea032d497cb29a8709c2e02ad4fa8e2bd610 100644 (file)
@@ -10,7 +10,7 @@
        #define BITSET(var, mask, flag) ((var) ^ (-(flag) ^ (var)) & (mask))
 #endif
 
-[[eraseable]]
+ERASEABLE
 int lowestbit(int f)
 {
        f &= ~(f << 1);
@@ -21,7 +21,7 @@ int lowestbit(int f)
        return f;
 }
 
-[[eraseable]]
+ERASEABLE
 int randombit(int bits)
 {
        if (!(bits & (bits - 1)))  // this ONLY holds for powers of two!
@@ -44,7 +44,7 @@ int randombit(int bits)
        return b;
 }
 
-[[eraseable]]
+ERASEABLE
 int randombits(int bits, int k, bool error_return)
 {
        int r = 0;
@@ -78,7 +78,7 @@ enum {
        OP_MINUS
 };
 
-[[eraseable]]
+ERASEABLE
 bool GiveBit(entity e, .int fld, int bit, int op, int val)
 {
        int v0 = (e.(fld) & bit);
@@ -103,7 +103,7 @@ bool GiveBit(entity e, .int fld, int bit, int op, int val)
        return v0 != v1;
 }
 
-[[eraseable]]
+ERASEABLE
 bool GiveValue(entity e, .int fld, int op, int val)
 {
        int v0 = e.(fld);
index 8ea9058074e3780e60ae45862f533717369a2560..c78f717d9e983be74923a5dd8fb5252b73f9b627 100644 (file)
@@ -9,7 +9,7 @@
 #define boolean(value) ((value) != 0)
 
 // get true/false value of a string with multiple different inputs
-[[eraseable]]
+ERASEABLE
 float InterpretBoolean(string input)
 {
        switch (strtolower(input))
index 7de70e8314e9dbe47cc6a9472257a415c1230f1d..5f9297f2dab1f5be24887ff2fead30390ee59fd6 100644 (file)
@@ -3,7 +3,7 @@
 #include "string.qh"
 
 #define colormapPaletteColor(c, isPants) colormapPaletteColor_(c, isPants, time)
-[[eraseable]]
+ERASEABLE
 vector colormapPaletteColor_(int c, bool isPants, float t)
 {
        switch (c)
@@ -36,7 +36,7 @@ vector colormapPaletteColor_(int c, bool isPants, float t)
        }
 }
 
-[[eraseable]]
+ERASEABLE
 float rgb_mi_ma_to_hue(vector rgb, float mi, float ma)
 {
        if (mi == ma)
@@ -58,7 +58,7 @@ float rgb_mi_ma_to_hue(vector rgb, float mi, float ma)
        }
 }
 
-[[eraseable]]
+ERASEABLE
 vector hue_mi_ma_to_rgb(float hue, float mi, float ma)
 {
        vector rgb;
@@ -113,7 +113,7 @@ vector hue_mi_ma_to_rgb(float hue, float mi, float ma)
        return rgb;
 }
 
-[[eraseable]]
+ERASEABLE
 vector rgb_to_hsv(vector rgb)
 {
        float mi, ma;
@@ -131,13 +131,13 @@ vector rgb_to_hsv(vector rgb)
        return hsv;
 }
 
-[[eraseable]]
+ERASEABLE
 vector hsv_to_rgb(vector hsv)
 {
        return hue_mi_ma_to_rgb(hsv.x, hsv.z * (1 - hsv.y), hsv.z);
 }
 
-[[eraseable]]
+ERASEABLE
 vector rgb_to_hsl(vector rgb)
 {
        float mi, ma;
@@ -157,7 +157,7 @@ vector rgb_to_hsl(vector rgb)
        return hsl;
 }
 
-[[eraseable]]
+ERASEABLE
 vector hsl_to_rgb(vector hsl)
 {
        float mi, ma, maminusmi;
@@ -173,7 +173,7 @@ vector hsl_to_rgb(vector hsl)
        return hue_mi_ma_to_rgb(hsl.x, mi, ma);
 }
 
-[[eraseable]]
+ERASEABLE
 string rgb_to_hexcolor(vector rgb)
 {
        return strcat(
index 7cd34bc8487bfae058f168ca4471a07e07156077..d1bdc4fe5b55e609bc4d02b32dc0f55b0761f21a 100644 (file)
        #endif
 #endif
 
+#ifndef QCC_SUPPORT_ERASEABLE
+       #ifdef GMQCC
+               #define QCC_SUPPORT_ERASEABLE
+       #endif
+#endif
+
 #ifdef GMQCC
     #define LABEL(id) :id
 #else
index 12ec4a9b61dc7f09a4fff6c80a735022c558ae70..b38ba9d05a9313f670f8fa8bdeede09c565ebf2c 100644 (file)
@@ -61,7 +61,7 @@
        _("CI_THI^%d seconds"), /* third */ \
        _("CI_MUL^%d seconds")) /* multi */
 
-[[eraseable]]
+ERASEABLE
 string count_ordinal(int interval)
 {
        // This function is designed primarily for the English language, it's impossible
@@ -87,7 +87,7 @@ string count_ordinal(int interval)
        return "";
 }
 
-[[eraseable]]
+ERASEABLE
 string count_fill(float interval, string zeroth, string first, string second, string third, string multi)
 {
        // This function is designed primarily for the English language, it's impossible
@@ -118,7 +118,7 @@ string count_fill(float interval, string zeroth, string first, string second, st
        return "";
 }
 
-[[eraseable]]
+ERASEABLE
 string process_time(float outputtype, float seconds)
 {
        float tmp_hours = 0, tmp_minutes = 0, tmp_seconds = 0;
index faefdcad4316b6dc4a034432aba9e811eebf9526..225c7307ded6c60a192056eafde3078912c4ae52 100644 (file)
@@ -168,7 +168,7 @@ void CSQCPlayer_PredictTo(entity this, float endframe, bool apply_error)
        {
                csqcplayer_moveframe = clientcommandframe;
                getinputstate(csqcplayer_moveframe-1);
-               LOG_INFO("the Weird code path got hit\n");
+               LOG_INFO("the Weird code path got hit");
                return;
        }
 #endif
index 3ea385cbcd8b5e4918c1f88ed8b3c6eaed9508d4..94af8634003d471dc5529a860db91449c38d0c7a 100644 (file)
@@ -45,6 +45,3 @@ void InterpolateOrigin_Reset(entity this);
 
 // call this BEFORE drawing
 void InterpolateOrigin_Do(entity this);
-
-// in case we interpolate that:
-.vector v_angle;
index f322753c0af92d9d5eda78b9e57497633777b052..a17f2bad72397d55a470fc32bb64851cfcbe5152 100644 (file)
@@ -4,10 +4,10 @@
 #include "progname.qh"
 #include "static.qh"
 
-[[eraseable]]
+ERASEABLE
 void RegisterCvars(void(string name, string def, string desc, bool archive, string file) f) {}
 
-[[eraseable]]
+ERASEABLE
 bool cvar_value_issafe(string s)
 {
        if (strstrofs(s, "\"", 0) >= 0) return false;
@@ -20,7 +20,7 @@ bool cvar_value_issafe(string s)
 }
 
 /** escape the string to make it safe for consoles */
-[[eraseable]]
+ERASEABLE
 string MakeConsoleSafe(string input)
 {
        input = strreplace("\n", "", input);
@@ -30,19 +30,19 @@ string MakeConsoleSafe(string input)
        return input;
 }
 
-[[eraseable]]
+ERASEABLE
 void cvar_describe(string name, string desc)
 {
        localcmd(sprintf("\nset %1$s \"$%1$s\" \"%2$s\"\n", name, MakeConsoleSafe(desc)));
 }
 
-[[eraseable]]
+ERASEABLE
 void cvar_archive(string name)
 {
        localcmd(sprintf("\nseta %1$s \"$%1$s\"\n", name));
 }
 
-[[eraseable]]
+ERASEABLE
 void RegisterCvars_Set(string name, string def, string desc, bool archive, string file)
 {
        cvar_describe(name, desc);
@@ -50,7 +50,7 @@ void RegisterCvars_Set(string name, string def, string desc, bool archive, strin
 }
 
 int RegisterCvars_Save_fd;
-[[eraseable]]
+ERASEABLE
 void RegisterCvars_Save(string name, string def, string desc, bool archive, string file)
 {
        if (!archive) return;
index 5dbdb67b546a2f7774ac7fd938e8f0a6963955b6..2bf480a8782aed99c16167731c5f38efd1300fcd 100644 (file)
                }
        }
 
-       [[eraseable]]
+       ERASEABLE
        void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
        {
                position.x -= 2 / 3 * strlen(text) * theScale.x;
                drawstring_builtin(position, text, theScale, rgb, theAlpha, flag);
        }
 
-       [[eraseable]]
+       ERASEABLE
        void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
        {
                position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
index 9e1ba4c9928fcb2df244f304eab190c6acda8d76..5bc24f627185f5fd5c4bf87aaaf32a40f0908ff8 100644 (file)
@@ -1,6 +1,6 @@
 #pragma once
 
-[[eraseable]]
+ERASEABLE
 bool fexists(string f)
 {
        int fh = fopen(f, FILE_READ);
index 6a17fbaca4ab94c5a0938b55f9b0b7360d465a44..3dfac622464a1144ed74096703108d0e9afa8251 100644 (file)
@@ -10,7 +10,7 @@ string prvm_language;
 /**
  * @deprecated prefer _("translated")
  */
-[[eraseable]]
+ERASEABLE
 string language_filename(string s)
 {
        string fn = prvm_language;
@@ -41,7 +41,7 @@ string language_filename(string s)
        }
 #endif
 
-[[eraseable]]
+ERASEABLE
 string CTX(string s)
 {
 #if CTX_CACHE
index 524c6bec7d4334793b088633f9e43718c9e36247..fc0e080eae32fa103333559653d439a403895cb2 100644 (file)
@@ -4,11 +4,11 @@
 
 const int IL_MAX = 128;
 
-[[eraseable]]
+ERASEABLE
 void IL_INIT(entity this);
-[[eraseable]]
+ERASEABLE
 void IL_DTOR(entity this);
-[[eraseable]]
+ERASEABLE
 void IL_ENDFRAME();
 
 /**
@@ -40,7 +40,7 @@ ENDCLASS(IntrusiveList)
 #define IL_LAST(this) (this.il_tail)
 #define IL_PEEK(this) (this.il_tail)
 
-[[eraseable]]
+ERASEABLE
 bool IL_CONTAINS(IntrusiveList this, entity it)
 {
        assert(this, return false);
@@ -50,7 +50,7 @@ bool IL_CONTAINS(IntrusiveList this, entity it)
 /**
  * Push to tail
  */
-[[eraseable]]
+ERASEABLE
 entity IL_PUSH(IntrusiveList this, entity it)
 {
        assert(this, return NULL);
@@ -69,7 +69,7 @@ entity IL_PUSH(IntrusiveList this, entity it)
 /**
  * Push to head
  */
-[[eraseable]]
+ERASEABLE
 entity IL_UNSHIFT(IntrusiveList this, entity it)
 {
        assert(this, return NULL);
@@ -88,7 +88,7 @@ entity IL_UNSHIFT(IntrusiveList this, entity it)
 /**
  * Pop from tail
  */
-[[eraseable]]
+ERASEABLE
 entity IL_POP(IntrusiveList this)
 {
        assert(this, return NULL);
@@ -106,7 +106,7 @@ entity IL_POP(IntrusiveList this)
 /**
  * Pop from head
  */
-[[eraseable]]
+ERASEABLE
 entity IL_SHIFT(IntrusiveList this)
 {
        assert(this, return NULL);
@@ -124,7 +124,7 @@ entity IL_SHIFT(IntrusiveList this)
 /**
  * Remove any element, anywhere in the list
  */
-[[eraseable]]
+ERASEABLE
 void IL_REMOVE(IntrusiveList this, entity it)
 {
        assert(this, return);
@@ -189,7 +189,7 @@ int il_links_ptr;
 
 #define IL_LISTS_PER_BIT IL_CEIL(IL_MAX / (3 * 24))
 
-[[eraseable]]
+ERASEABLE
 void IL_INIT(IntrusiveList this)
 {
        .entity nextfld, prevfld;
@@ -218,14 +218,14 @@ void IL_INIT(IntrusiveList this)
        LOG_WARNF("IntrusiveList overflow");
 }
 
-[[eraseable]]
+ERASEABLE
 void IL_DTOR(IntrusiveList this)
 {
        IL_CLEAR(this);
        il_links[this.il_id] = NULL;
 }
 
-[[eraseable]]
+ERASEABLE
 void IL_ENDFRAME()
 {
 #if 0
@@ -245,7 +245,7 @@ void IL_ENDFRAME()
 #endif
 }
 
-[[eraseable]]
+ERASEABLE
 void ONREMOVE(entity this)
 {
        if (this.il_lists) {
index f15aa8cd62ab96d584dc18198ccf87d04a4a5858..b477fe15e59124924662e4c463030ff7016ca94e 100644 (file)
@@ -32,7 +32,7 @@ string _json_ns;
 // Current keys
 int _json_keys;
 
-[[eraseable]]
+ERASEABLE
 bool _json_parse_object() {
     JSON_BEGIN();
     if (STRING_ITERATOR_GET(_json) != '{') JSON_FAIL("expected '{'");
@@ -41,7 +41,7 @@ bool _json_parse_object() {
     JSON_END();
 }
 
-    [[eraseable]]
+    ERASEABLE
     bool _json_parse_members() {
         JSON_BEGIN();
         for (;;) {
@@ -55,7 +55,7 @@ bool _json_parse_object() {
         JSON_END();
     }
 
-        [[eraseable]]
+        ERASEABLE
         bool _json_parse_pair() {
             JSON_BEGIN();
             if (!_json_parse_string(false)) JSON_FAIL("expected string");
@@ -69,7 +69,7 @@ bool _json_parse_object() {
             JSON_END();
         }
 
-[[eraseable]]
+ERASEABLE
 bool _json_parse_array() {
     JSON_BEGIN();
     if (STRING_ITERATOR_GET(_json) != '[') JSON_FAIL("expected '['");
@@ -97,7 +97,7 @@ bool _json_parse_array() {
     JSON_END();
 }
 
-[[eraseable]]
+ERASEABLE
 bool _json_parse_value() {
     JSON_BEGIN();
     if (!(_json_parse_string(true)
@@ -110,7 +110,7 @@ bool _json_parse_value() {
     JSON_END();
 }
 
-    [[eraseable]]
+    ERASEABLE
     bool _json_parse_true() {
         JSON_BEGIN();
         if (!(STRING_ITERATOR_GET(_json) == 't'
@@ -122,7 +122,7 @@ bool _json_parse_value() {
         JSON_END();
     }
 
-    [[eraseable]]
+    ERASEABLE
     bool _json_parse_false() {
         JSON_BEGIN();
         if (!(STRING_ITERATOR_GET(_json) == 'f'
@@ -135,7 +135,7 @@ bool _json_parse_value() {
         JSON_END();
     }
 
-    [[eraseable]]
+    ERASEABLE
     bool _json_parse_null() {
         JSON_BEGIN();
         if (!(STRING_ITERATOR_GET(_json) == 'n'
@@ -147,7 +147,7 @@ bool _json_parse_value() {
         JSON_END();
     }
 
-[[eraseable]]
+ERASEABLE
 bool _json_parse_string(bool add) {
     JSON_BEGIN();
     if (STRING_ITERATOR_GET(_json) != '"') JSON_FAIL("expected opening '\"'");
@@ -179,14 +179,14 @@ bool _json_parse_string(bool add) {
     JSON_END();
 }
 
-[[eraseable]]
+ERASEABLE
 bool _json_parse_number() {
     JSON_BEGIN();
     if (!(_json_parse_float() || _json_parse_int())) JSON_FAIL("expected number");
     JSON_END();
 }
 
-    [[eraseable]]
+    ERASEABLE
     bool _json_parse_float() {
         JSON_BEGIN();
         string s = "";
@@ -208,7 +208,7 @@ bool _json_parse_number() {
         JSON_END();
     }
 
-    [[eraseable]]
+    ERASEABLE
     bool _json_parse_int() {
         JSON_BEGIN();
         string s = "";
@@ -226,7 +226,7 @@ bool _json_parse_number() {
         JSON_END();
     }
 
-[[eraseable]]
+ERASEABLE
 int json_parse(string in, bool() func) {
     string trimmed = "";
     LABEL(trim) {
@@ -272,7 +272,7 @@ int json_parse(string in, bool() func) {
     return _json_buffer;
 }
 
-[[eraseable]]
+ERASEABLE
 string json_get(int buf, string key)
 {
     for (int i = 1, n = buf_getsize(buf); i < n; i += 2) {
@@ -281,13 +281,13 @@ string json_get(int buf, string key)
     return string_null;
 }
 
-[[eraseable]]
+ERASEABLE
 void json_del(int buf)
 {
     buf_del(buf);
 }
 
-[[eraseable]]
+ERASEABLE
 void json_dump(int buf)
 {
     for (int i = 0, n = buf_getsize(buf); i < n; ++i) {
index 7f5bc720412348f2dcc8df053027f4de84f3e1b1..7491818b24ad309e7f0564efd5fb228326aa032c 100644 (file)
@@ -69,7 +69,10 @@ string(string, string...) strcat1n = #115;
 #define _LOG_INFO(s) \
        MACRO_BEGIN { \
                dprint(_LOG_HEADER("^5INFO")); \
-               print("\n^7", s); \
+               string __s = s; \
+               print("\n^7", __s); \
+               /* TODO: unconditionally add a newline when possible */ \
+               if (str2chr(__s, strlen(__s) - 1) != '\n') { print("\n"); } \
        } MACRO_END
 
 #define  LOG_TRACE(...) _LOG_TRACE(strcat1n(__VA_ARGS__))
index bec7842ecd76b593037f7c25d1d7db98bc756873..ea7f0e1fe26f62143774a14a217047780abb9e6c 100644 (file)
@@ -4,7 +4,7 @@
 
 // Databases (hash tables)
 const int DB_BUCKETS = 8192;
-[[eraseable]]
+ERASEABLE
 void db_save(int db, string filename)
 {
        int fh = fopen(filename, FILE_WRITE);
@@ -21,17 +21,17 @@ void db_save(int db, string filename)
 
 USING(HashMap, int);
 
-[[eraseable]]
+ERASEABLE
 int db_create()
 {
        return buf_create();
 }
 #define HM_NEW(this) (this = db_create())
 
-[[eraseable]]
+ERASEABLE
 void db_put(int db, string key, string value);
 
-[[eraseable]]
+ERASEABLE
 int db_load(string filename)
 {
        int db = buf_create();
@@ -65,7 +65,7 @@ int db_load(string filename)
        return db;
 }
 
-[[eraseable]]
+ERASEABLE
 void db_dump(int db, string filename)
 {
        int fh = fopen(filename, FILE_WRITE);
@@ -80,14 +80,14 @@ void db_dump(int db, string filename)
        fclose(fh);
 }
 
-[[eraseable]]
+ERASEABLE
 void db_close(int db)
 {
        buf_del(db);
 }
 #define HM_DELETE(this) db_close(this)
 
-[[eraseable]]
+ERASEABLE
 string db_get(int db, string key)
 {
        int h = crc16(false, key) % DB_BUCKETS;
@@ -97,7 +97,7 @@ string db_get(int db, string key)
 
 #define db_remove(db, key) db_put(db, key, "")
 
-[[eraseable]]
+ERASEABLE
 void db_put(int db, string key, string value)
 {
        int h = crc16(false, key) % DB_BUCKETS;
index 3244877195355bc90b7363881ebb9532443d5b2c..a3bffeaaef3b223e96273b4e81959c7306083c85 100644 (file)
@@ -5,7 +5,7 @@
  *   - two spaces escape a linebreak (otherwise text wraps)
  *   - two linebreaks become a paragraph (remain unchanged)
  */
-[[eraseable]]
+ERASEABLE
 string markdown(string s)
 {
        string buf = "";
index fbfe1d1d4fae4fa06bf5a66b2620a987597baf54..8ba31516dda7fecffca459d112cbb4affaa92a76 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "lib/float.qh"
 
-[[eraseable]]
+ERASEABLE
 void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
 {
        if (weight == 0) return;
@@ -11,7 +11,7 @@ void mean_accumulate(entity e, .float a, .float c, float mean, float value, floa
        e.(c) += weight;
 }
 
-[[eraseable]]
+ERASEABLE
 float mean_evaluate(entity e, .float a, .float c, float mean)
 {
        if (e.(c) == 0) return 0;
@@ -34,7 +34,7 @@ Angc used for animations
 */
 
 
-[[eraseable]]
+ERASEABLE
 float angc(float a1, float a2)
 {
        while (a1 > 180)
@@ -53,13 +53,13 @@ float angc(float a1, float a2)
        return a;
 }
 
-[[eraseable]]
+ERASEABLE
 float fsnap(float val, float fsize)
 {
        return rint(val / fsize) * fsize;
 }
 
-[[eraseable]]
+ERASEABLE
 vector vsnap(vector point, float fsize)
 {
        vector vret;
@@ -71,13 +71,13 @@ vector vsnap(vector point, float fsize)
        return vret;
 }
 
-[[eraseable]]
+ERASEABLE
 vector lerpv(float t0, vector v0, float t1, vector v1, float t)
 {
        return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
 }
 
-[[eraseable]]
+ERASEABLE
 vector bezier_quadratic_getpoint(vector a, vector b, vector c, float t)
 {
        return (c - 2 * b + a) * (t * t)
@@ -85,14 +85,14 @@ vector bezier_quadratic_getpoint(vector a, vector b, vector c, float t)
               + a;
 }
 
-[[eraseable]]
+ERASEABLE
 vector bezier_quadratic_getderivative(vector a, vector b, vector c, float t)
 {
        return (c - 2 * b + a) * (2 * t)
               + (b - a) * 2;
 }
 
-[[eraseable]]
+ERASEABLE
 float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd)
 {
        return (((startspeedfactor + endspeedfactor - 2
@@ -101,7 +101,7 @@ float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd)
               ) * spd;
 }
 
-[[eraseable]]
+ERASEABLE
 bool cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor)
 {
        if (startspeedfactor < 0 || endspeedfactor < 0) return false;
@@ -166,40 +166,40 @@ bool cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor)
 }
 
 /** continuous function mapping all reals into -1..1 */
-[[eraseable]]
+ERASEABLE
 float float2range11(float f)
 {
        return f / (fabs(f) + 1);
 }
 
 /** continuous function mapping all reals into 0..1 */
-[[eraseable]]
+ERASEABLE
 float float2range01(float f)
 {
        return 0.5 + 0.5 * float2range11(f);
 }
 
-[[eraseable]]
+ERASEABLE
 float median(float a, float b, float c)
 {
        return (a < c) ? bound(a, b, c) : bound(c, b, a);
 }
 
-[[eraseable]]
+ERASEABLE
 float almost_equals(float a, float b)
 {
        float eps = (max(a, -a) + max(b, -b)) * 0.001;
        return a - b < eps && b - a < eps;
 }
 
-[[eraseable]]
+ERASEABLE
 float almost_equals_eps(float a, float b, float times_eps)
 {
        float eps = max(fabs(a), fabs(b)) * FLOAT_EPSILON * times_eps;
        return a - b < eps && b - a < eps;
 }
 
-[[eraseable]]
+ERASEABLE
 float almost_in_bounds(float a, float b, float c)
 {
        float eps = (max(a, -a) + max(c, -c)) * 0.001;
@@ -207,7 +207,7 @@ float almost_in_bounds(float a, float b, float c)
        return b == median(a - eps, b, c + eps);
 }
 
-[[eraseable]]
+ERASEABLE
 float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float d)
 {
        if (halflifedist > 0) return (0.5 ** ((bound(mindist, d, maxdist) - mindist) / halflifedist));
@@ -217,7 +217,7 @@ float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float
 
 #define power2of(e) (2 ** e)
 
-[[eraseable]]
+ERASEABLE
 float log2of(float e)
 {
        // NOTE: generated code
@@ -270,7 +270,7 @@ float log2of(float e)
 }
 
 /** ax^2 + bx + c = 0 */
-[[eraseable]]
+ERASEABLE
 vector solve_quadratic(float a, float b, float c)
 {
        vector v;
index 9dc4d4f32ee041a8a1358b8c77b988d05d172572..782798c9fe5c492799d0892f4f1f5cc3f155731d 100644 (file)
@@ -8,13 +8,13 @@ class(Noise).float noise_paccum2;
 class(Noise).float noise_paccum3;
 class(Noise).float noise_bstate;
 
-[[eraseable]]
+ERASEABLE
 float Noise_Brown(entity e, float dt)
 {
        e.noise_baccum += random() * sqrt(dt);  // same stddev for all dt
        return e.noise_baccum;
 }
-[[eraseable]]
+ERASEABLE
 float Noise_Pink(entity e, float dt)
 {
        float f;
@@ -25,13 +25,13 @@ float Noise_Pink(entity e, float dt)
        if (random() > (0.9613 ** f)) e.noise_paccum3 = 0.43488 * (2 * random() - 1);
        return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
 }
-[[eraseable]]
+ERASEABLE
 float Noise_White(entity e, float dt)
 {
        return random() * 2 - 1;
 }
 /** +1 or -1 */
-[[eraseable]]
+ERASEABLE
 float Noise_Burst(entity e, float dt, float p)
 {
        if (random() > (p ** dt)) e.noise_bstate = !e.noise_bstate;
index 39b18bb62a349c9d90384bed26abf7d5552572f2..ce6f7ea899c8513995827f5c6bf373fae8baa539 100644 (file)
@@ -17,7 +17,7 @@
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
-[[eraseable]]
+ERASEABLE
 vector vec_bias(vector v, float f)
 {
        vector c;
@@ -26,7 +26,7 @@ vector vec_bias(vector v, float f)
        c.z = v.z + f;
        return c;
 }
-[[eraseable]]
+ERASEABLE
 vector vec_to_min(vector a, vector b)
 {
        vector c;
@@ -36,7 +36,7 @@ vector vec_to_min(vector a, vector b)
        return c;
 }
 
-[[eraseable]]
+ERASEABLE
 vector vec_to_max(vector a, vector b)
 {
        vector c;
@@ -47,7 +47,7 @@ vector vec_to_max(vector a, vector b)
 }
 
 // there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
-[[eraseable]]
+ERASEABLE
 vector vec_bounds_in(vector point, vector a, vector b)
 {
        vector d = vec_to_min(a, b);
@@ -58,7 +58,7 @@ vector vec_bounds_in(vector point, vector a, vector b)
        return c;
 }
 
-[[eraseable]]
+ERASEABLE
 vector vec_bounds_out(vector point, vector a, vector b)
 {
        vector d = vec_to_max(a, b);
@@ -69,7 +69,7 @@ vector vec_bounds_out(vector point, vector a, vector b)
        return c;
 }
 
-[[eraseable]]
+ERASEABLE
 float angle_snap_f(float f, float increment)
 {
        for (int j = 0; j <= 360; )
@@ -81,7 +81,7 @@ float angle_snap_f(float f, float increment)
        return 0;
 }
 
-[[eraseable]]
+ERASEABLE
 vector angle_snap_vec(vector v, float increment)
 {
        vector c;
@@ -91,7 +91,7 @@ vector angle_snap_vec(vector v, float increment)
        return c;
 }
 
-[[eraseable]]
+ERASEABLE
 vector aim_vec(vector org, vector targ)
 {
        vector v;
index 1f4deb1d877461d2b5d58234c3c82ed7720a3641..898d6ca1ceae2c3a2338a92d88e1397ce5a6e59a 100644 (file)
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
-[[eraseable]]
+ERASEABLE
 vector vec_bias(vector v, float f);
 
 
-[[eraseable]]
+ERASEABLE
 vector vec_to_min(vector a, vector b);
-[[eraseable]]
+ERASEABLE
 vector vec_to_max(vector a, vector b);
 
 // there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
-[[eraseable]]
+ERASEABLE
 vector vec_bounds_in(vector point, vector a, vector b);
-[[eraseable]]
+ERASEABLE
 vector vec_bounds_out(vector point, vector a, vector b);
 
-[[eraseable]]
+ERASEABLE
 float angle_snap_f(float f, float increment);
-[[eraseable]]
+ERASEABLE
 vector angle_snap_vec(vector v,  float increment);
 
-[[eraseable]]
+ERASEABLE
 vector aim_vec(vector org, vector targ);
index d39cfdcadcfef74b2b74e9513de62690f89ab659..a5ff69356a21f516ba290bac01761eac2a7cce88 100644 (file)
@@ -1,6 +1,6 @@
 #include "random.qh"
 
-[[eraseable]]
+ERASEABLE
 void RandomSelection_Init()
 {
        RandomSelection_totalweight = 0;
@@ -10,7 +10,7 @@ void RandomSelection_Init()
        RandomSelection_best_priority = -1;
 }
 
-[[eraseable]]
+ERASEABLE
 void RandomSelection_Add(entity e, float f, string s, vector v, float weight, float priority)
 {
        if (priority > RandomSelection_best_priority)
@@ -38,7 +38,7 @@ void RandomSelection_Add(entity e, float f, string s, vector v, float weight, fl
 float DistributeEvenly_amount;
 float DistributeEvenly_totalweight;
 
-[[eraseable]]
+ERASEABLE
 void DistributeEvenly_Init(float amount, float totalweight)
 {
        if (DistributeEvenly_amount)
@@ -50,7 +50,7 @@ void DistributeEvenly_Init(float amount, float totalweight)
        DistributeEvenly_totalweight = totalweight;
 }
 
-[[eraseable]]
+ERASEABLE
 float DistributeEvenly_Get(float weight)
 {
        float f;
@@ -61,7 +61,7 @@ float DistributeEvenly_Get(float weight)
        return f;
 }
 
-[[eraseable]]
+ERASEABLE
 float DistributeEvenly_GetRandomized(float weight)
 {
        float f;
@@ -75,7 +75,7 @@ float DistributeEvenly_GetRandomized(float weight)
 // from the GNU Scientific Library
 float gsl_ran_gaussian_lastvalue;
 float gsl_ran_gaussian_lastvalue_set;
-[[eraseable]]
+ERASEABLE
 float gsl_ran_gaussian(float sigma)
 {
        if (gsl_ran_gaussian_lastvalue_set)
index 668e49784b439c2ba79275300b5395a69f7f091d..e3900697b7d1a54b29f30a75e592abe9fc426b01 100644 (file)
@@ -7,9 +7,9 @@ float RandomSelection_chosen_float;
 string RandomSelection_chosen_string;
 vector RandomSelection_chosen_vec;
 
-[[eraseable]]
+ERASEABLE
 void RandomSelection_Init();
-[[eraseable]]
+ERASEABLE
 void RandomSelection_Add(entity e, float f, string s, vector v, float weight, float priority);
 #define RandomSelection_AddEnt(e, weight, priority) RandomSelection_Add(e, 0, string_null, '0 0 0', weight, priority)
 #define RandomSelection_AddFloat(f, weight, priority) RandomSelection_Add(NULL, f, string_null, '0 0 0', weight, priority)
index e9712970eb8747fa7a8925d0f4b7e8cdc6d5606a..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()
@@ -140,9 +146,9 @@ REGISTRY(Registries, BITS(8))
 
 #define REGISTRY_HASH(id) Registry_hash_##id
 
-[[eraseable]]
+ERASEABLE
 [[accumulate]] void Registry_check(string r, string server) { }
-[[eraseable]]
+ERASEABLE
 [[accumulate]] void Registry_send_all() { }
 
 #ifdef SVQC
@@ -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 a36466d2e0ffb8daca62e22bd35706bbeb5e761a..c7a42042deac253dc3172aeaf929a80ba2958b18 100644 (file)
@@ -12,7 +12,7 @@
        #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__))
        #define EVAL_REPLICATE(...) __VA_ARGS__
 
-       [[accumulate]] void ReplicateVars(entity this, string thisname, int i) {}
+       [[accumulate]] void ReplicateVars(entity this, entity store, string thisname, int i) {}
 
        #define REPLICATE_3(fld, type, var) REPLICATE_4(fld, type, var, )
        #define REPLICATE_4(fld, type, var, func) REPLICATE_##type(fld, var, func)
@@ -35,9 +35,9 @@
 
        #if defined(SVQC)
                #define REPLICATE_7(fld, type, var, func, create, destroy, after) \
-                       void ReplicateVars(entity this, string thisname, int i) \
+                       void ReplicateVars(entity this, entity store, string thisname, int i) \
                        { \
-                               type field = this.fld; \
+                               type field = store.fld; \
                                if (i < 0) { destroy } \
                                else \
                                { \
@@ -53,7 +53,7 @@
                                        } \
                                        if (current) { after } \
                                } \
-                               this.fld = field; \
+                               store.fld = field; \
                        }
        #elif defined(CSQC)
                // TODO
index 068707d0b649d9e709f6bd00711ba816da8eeea6..565ebb29c81513276a8f49334cfebd2589cb0986 100644 (file)
@@ -5,7 +5,7 @@ USING(swapfunc_t, void (int i1, int i2, entity pass));
 /** <0 for <, ==0 for ==, >0 for > (like strcmp) */
 USING(comparefunc_t, int (int i1, int i2, entity pass));
 
-[[eraseable]]
+ERASEABLE
 void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
 {
        #define heapify(_count) \
@@ -40,7 +40,7 @@ void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
        }
 }
 
-[[eraseable]]
+ERASEABLE
 void shuffle(float n, swapfunc_t swap, entity pass)
 {
        for (int i = 1; i < n; ++i)
index 2cc90268cd16e704a15124a87359ba8ab4a448e7..e800bc4576ae8d81ca1c4a37838e5ae6db2c0bf7 100644 (file)
@@ -1,6 +1,6 @@
 #include "sortlist.qh"
 
-[[eraseable]]
+ERASEABLE
 entity Sort_Spawn()
 {
        entity sort = new_pure(sortlist);
index 46b3a7fa9fb3daa5b77ddcab966ec4c38ce01982..e2c5fd4f0048d90ccbbd719fdbcf12b310bb5fe8 100644 (file)
@@ -16,7 +16,7 @@ float(int tmr) _gettime = #67;
 float(int tmr) _gettime = #519;
 #endif
 
-[[eraseable]]
+ERASEABLE
 void profile(string s)
 {
        static float g_starttime;
index 33aacebabdbd8d8eee975006f6c9c1bf4dab1c5d..b05a316c94a2a4d6b438420d000ce7242f506f19 100644 (file)
@@ -27,7 +27,7 @@
        }
 #endif
 
-[[eraseable]]
+ERASEABLE
 string seconds_tostring(float sec)
 {
        float minutes = floor(sec / 60);
@@ -35,7 +35,7 @@ string seconds_tostring(float sec)
        return sprintf("%d:%02d", minutes, sec);
 }
 
-[[eraseable]]
+ERASEABLE
 string format_time(float seconds)
 {
        seconds = floor(seconds + 0.5);
@@ -49,7 +49,7 @@ string format_time(float seconds)
        else return sprintf(_("%02d:%02d:%02d"), hours, minutes, seconds);
 }
 
-[[eraseable]]
+ERASEABLE
 string mmsss(float tenths)
 {
        tenths = floor(tenths + 0.5);
@@ -59,7 +59,7 @@ string mmsss(float tenths)
        return strcat(ftos(minutes), ":", substring(s, 1, 2), ".", substring(s, 3, 1));
 }
 
-[[eraseable]]
+ERASEABLE
 string mmssss(float hundredths)
 {
        hundredths = floor(hundredths + 0.5);
@@ -71,7 +71,7 @@ string mmssss(float hundredths)
 
 int ColorTranslateMode;
 
-[[eraseable]]
+ERASEABLE
 string ColorTranslateRGB(string s)
 {
        return (ColorTranslateMode & 1) ? strdecolorize(s) : s;
@@ -116,7 +116,7 @@ string CCR(string input)
 
 #define startsWith(haystack, needle) (strstrofs(haystack, needle, 0) == 0)
 
-[[eraseable]]
+ERASEABLE
 bool startsWithNocase(string haystack, string needle)
 {
        return strcasecmp(substring(haystack, 0, strlen(needle)), needle) == 0;
@@ -126,7 +126,7 @@ noref string _endsWith_suffix;
 #define endsWith(this, suffix) (_endsWith_suffix = suffix, substring(this, -strlen(_endsWith_suffix), -1) == _endsWith_suffix)
 
 /** unzone the string, and return it as tempstring. Safe to be called on string_null */
-[[eraseable]]
+ERASEABLE
 string fstrunzone(string s)
 {
        if (!s) return s;
@@ -136,7 +136,7 @@ string fstrunzone(string s)
 }
 
 /** returns first word */
-[[eraseable]]
+ERASEABLE
 string car(string s)
 {
        int o = strstrofs(s, " ", 0);
@@ -145,7 +145,7 @@ string car(string s)
 }
 
 /** returns all but first word */
-[[eraseable]]
+ERASEABLE
 string cdr(string s)
 {
        int o = strstrofs(s, " ", 0);
@@ -153,7 +153,7 @@ string cdr(string s)
        return substring(s, o + 1, strlen(s) - (o + 1));
 }
 
-[[eraseable]]
+ERASEABLE
 string cons(string a, string b)
 {
        if (a == "") return b;
@@ -161,13 +161,13 @@ string cons(string a, string b)
        return strcat(a, " ", b);
 }
 
-[[eraseable]]
+ERASEABLE
 string substring_range(string s, float b, float e)
 {
        return substring(s, b, e - b);
 }
 
-[[eraseable]]
+ERASEABLE
 string swapwords(string str, float i, float j)
 {
        float n;
@@ -189,13 +189,13 @@ string swapwords(string str, float i, float j)
 }
 
 string _shufflewords_str;
-[[eraseable]]
+ERASEABLE
 void _shufflewords_swapfunc(float i, float j, entity pass)
 {
        _shufflewords_str = swapwords(_shufflewords_str, i, j);
 }
 
-[[eraseable]]
+ERASEABLE
 string shufflewords(string str)
 {
        _shufflewords_str = str;
@@ -206,7 +206,7 @@ string shufflewords(string str)
        return str;
 }
 
-[[eraseable]]
+ERASEABLE
 string unescape(string in)
 {
        in = strzone(in);  // but it doesn't seem to be necessary in my tests at least
@@ -231,7 +231,7 @@ string unescape(string in)
        return str;
 }
 
-[[eraseable]]
+ERASEABLE
 string strwords(string s, int w)
 {
        int endpos = 0;
@@ -243,7 +243,7 @@ string strwords(string s, int w)
 
 #define strhasword(s, w) (strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0)
 
-[[eraseable]]
+ERASEABLE
 int u8_strsize(string s)
 {
        int l = 0;
@@ -256,7 +256,7 @@ int u8_strsize(string s)
        return l;
 }
 
-[[eraseable]]
+ERASEABLE
 bool isInvisibleString(string s)
 {
        s = strdecolorize(s);
@@ -284,7 +284,7 @@ bool isInvisibleString(string s)
 
 // Multiline text file buffers
 
-[[eraseable]]
+ERASEABLE
 int buf_load(string pFilename)
 {
        int buf = buf_create();
@@ -302,7 +302,7 @@ int buf_load(string pFilename)
        return buf;
 }
 
-[[eraseable]]
+ERASEABLE
 void buf_save(float buf, string pFilename)
 {
        int fh = fopen(pFilename, FILE_WRITE);
@@ -316,7 +316,7 @@ void buf_save(float buf, string pFilename)
 /**
  * converts a number to a string with the indicated number of decimals
  */
-[[eraseable]]
+ERASEABLE
 string ftos_decimals(float number, int decimals)
 {
        // inhibit stupid negative zero
@@ -327,7 +327,7 @@ string ftos_decimals(float number, int decimals)
 /**
  * converts a number to a string with the minimum number of decimals
  */
-[[eraseable]]
+ERASEABLE
 string ftos_mindecimals(float number)
 {
        // inhibit stupid negative zero
@@ -335,7 +335,7 @@ string ftos_mindecimals(float number)
        return sprintf("%.7g", number);
 }
 
-[[eraseable]]
+ERASEABLE
 int vercmp_recursive(string v1, string v2)
 {
        int dot1 = strstrofs(v1, ".", 0);
@@ -354,7 +354,7 @@ int vercmp_recursive(string v1, string v2)
        else return (dot2 == -1) ? 1 : vercmp_recursive(substring(v1, dot1 + 1, 999), substring(v2, dot2 + 1, 999));
 }
 
-[[eraseable]]
+ERASEABLE
 int vercmp(string v1, string v2)
 {
        if (strcasecmp(v1, v2) == 0) return 0;  // early out check
index 0997e53a4964fe1657c045ce01f4f698f1a7259b..86b0e6187010fde8175bb4040e70c60c819a0f0c 100644 (file)
@@ -6,19 +6,19 @@ bool RUN_ALL_TESTS()
        int f = TEST_RunAll_accumulated(0);
        if (f)
        {
-               LOG_INFOF("%d tests failed\n", f);
+               LOG_INFOF("%d tests failed", f);
                return true;
        }
        else
        {
-               LOG_INFO("All tests OK\n");
+               LOG_INFO("All tests OK");
                return false;
        }
 }
 
 bool TEST_Run(string s)
 {
-       LOG_INFOF("%s: testing...\n", s);
+       LOG_INFOF("%s: testing...", s);
        TEST_failed = 0;
        TEST_fatal = 0;
        TEST_ok = false;
@@ -26,12 +26,12 @@ bool TEST_Run(string s)
        if (isfunction(fn)) callfunction(fn);
        if (TEST_failed > 0)
        {
-               LOG_INFOF("%s: %d items failed.\n", s, TEST_failed);
+               LOG_INFOF("%s: %d items failed.", s, TEST_failed);
                return false;
        }
        else if (!TEST_ok)
        {
-               LOG_INFOF("%s: did not complete.\n", s);
+               LOG_INFOF("%s: did not complete.", s);
                return false;
        }
        return true;
index 9f5d3e26fe5ae88a3638b12edf23784835b20d5b..1572fec07cb2d1962870f63d7a3e3021db220841 100644 (file)
@@ -24,7 +24,7 @@ const float URL_FH_STDOUT = -2;
 entity url_fromid[NUM_URL_ID];
 int autocvar__urllib_nextslot;
 
-[[eraseable]]
+ERASEABLE
 float url_URI_Get_Callback(int id, float status, string data)
 {
        if (id < MIN_URL_ID) return 0;
@@ -35,7 +35,7 @@ float url_URI_Get_Callback(int id, float status, string data)
        if (!e) return 0;
        if (e.url_rbuf >= 0 || e.url_wbuf >= 0)
        {
-               LOG_INFOF("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
+               LOG_INFOF("WARNING: handle %d (%s) has already received data?!?", id + NUM_URL_ID, e.url_url);
                return 0;
        }
 
@@ -53,7 +53,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                e.url_rbuf = buf_create();
                if (e.url_rbuf < 0)
                {
-                       LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
+                       LOG_INFO("url_URI_Get_Callback: out of memory in buf_create");
                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                        strunzone(e.url_url);
                        delete(e);
@@ -62,7 +62,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                e.url_rbufpos = 0;
                if (e.url_rbuf < 0)
                {
-                       LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
+                       LOG_INFO("url_URI_Get_Callback: out of memory in buf_create");
                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                        strunzone(e.url_url);
                        delete(e);
@@ -83,7 +83,7 @@ float url_URI_Get_Callback(int id, float status, string data)
        }
 }
 
-[[eraseable]]
+ERASEABLE
 void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
 {
        entity e;
@@ -106,7 +106,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                e.url_wbuf = buf_create();
                                if (e.url_wbuf < 0)
                                {
-                                       LOG_INFO("url_single_fopen: out of memory in buf_create\n");
+                                       LOG_INFO("url_single_fopen: out of memory in buf_create");
                                        rdy(e, pass, URL_READY_ERROR);
                                        strunzone(e.url_url);
                                        delete(e);
@@ -131,7 +131,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                                if (url_fromid[i] == NULL) break;
                                        if (i >= autocvar__urllib_nextslot)
                                        {
-                                               LOG_INFO("url_single_fopen: too many concurrent requests\n");
+                                               LOG_INFO("url_single_fopen: too many concurrent requests");
                                                rdy(NULL, pass, URL_READY_ERROR);
                                                return;
                                        }
@@ -140,7 +140,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                // GET the data
                                if (!crypto_uri_postbuf(url, i + MIN_URL_ID, string_null, string_null, -1, 0))
                                {
-                                       LOG_INFO("url_single_fopen: failure in crypto_uri_postbuf\n");
+                                       LOG_INFO("url_single_fopen: failure in crypto_uri_postbuf");
                                        rdy(NULL, pass, URL_READY_ERROR);
                                        return;
                                }
@@ -176,7 +176,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                rdy(e, pass, URL_READY_CANWRITE);
                                break;
                        case FILE_READ:
-                               LOG_INFO("url_single_fopen: cannot open '-' for reading\n");
+                               LOG_INFO("url_single_fopen: cannot open '-' for reading");
                                rdy(NULL, pass, URL_READY_ERROR);
                                break;
                }
@@ -203,7 +203,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
 }
 
 // close a file
-[[eraseable]]
+ERASEABLE
 void url_fclose(entity e)
 {
        int i;
@@ -228,7 +228,7 @@ void url_fclose(entity e)
                                        if (url_fromid[i] == NULL) break;
                                if (i >= autocvar__urllib_nextslot)
                                {
-                                       LOG_INFO("url_fclose: too many concurrent requests\n");
+                                       LOG_INFO("url_fclose: too many concurrent requests");
                                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                                        buf_del(e.url_wbuf);
                                        strunzone(e.url_url);
@@ -240,7 +240,7 @@ void url_fclose(entity e)
                        // POST the data
                        if (!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, e.url_content_type, e.url_verb, e.url_wbuf, 0))
                        {
-                               LOG_INFO("url_fclose: failure in crypto_uri_postbuf\n");
+                               LOG_INFO("url_fclose: failure in crypto_uri_postbuf");
                                e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                                buf_del(e.url_wbuf);
                                strunzone(e.url_url);
@@ -283,7 +283,7 @@ void url_fclose(entity e)
 }
 
 // with \n (blame FRIK_FILE)
-[[eraseable]]
+ERASEABLE
 string url_fgets(entity e)
 {
        if (e.url_fh == URL_FH_CURL)
@@ -308,7 +308,7 @@ string url_fgets(entity e)
 }
 
 // without \n (blame FRIK_FILE)
-[[eraseable]]
+ERASEABLE
 void url_fputs(entity e, string s)
 {
        if (e.url_fh == URL_FH_CURL)
@@ -331,7 +331,7 @@ void url_fputs(entity e, string s)
 }
 
 // multi URL object, tries URLs separated by space in sequence
-[[eraseable]]
+ERASEABLE
 void url_multi_ready(entity fh, entity me, float status)
 {
        float n;
@@ -339,7 +339,7 @@ void url_multi_ready(entity fh, entity me, float status)
        {
                if (status == -422)  // Unprocessable Entity
                {
-                       LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing\n");
+                       LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing");
                        me.url_ready(fh, me.url_ready_pass, status);
                        strunzone(me.url_url);
                        delete(me);
@@ -360,14 +360,14 @@ void url_multi_ready(entity fh, entity me, float status)
        me.url_ready(fh, me.url_ready_pass, status);
 }
 
-[[eraseable]]
+ERASEABLE
 void url_multi_fopen(string url, int mode, url_ready_func rdy, entity pass)
 {
        float n;
        n = tokenize_console(url);
        if (n <= 0)
        {
-               LOG_INFO("url_multi_fopen: need at least one URL\n");
+               LOG_INFO("url_multi_fopen: need at least one URL");
                rdy(NULL, pass, URL_READY_ERROR);
                return;
        }
index acb4077d6a49422c9f275d0ea37910d4e05d3c9c..8918ca0a2a695df6ade44e96df9837b271adc3a4 100644 (file)
@@ -17,20 +17,20 @@ const float URL_READY_CANREAD  =  2;
 // errors: -1, or negative HTTP status code
 USING(url_ready_func, void (entity handle, entity pass, float status));
 
-[[eraseable]]
+ERASEABLE
 void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass);
-[[eraseable]]
+ERASEABLE
 void url_fclose(entity e);
-[[eraseable]]
+ERASEABLE
 string url_fgets(entity e);
-[[eraseable]]
+ERASEABLE
 void url_fputs(entity e, string s);
 
 // returns true if handled
-[[eraseable]]
+ERASEABLE
 float url_URI_Get_Callback(int id, float status, string data);
 #define MIN_URL_ID URI_GET_URLLIB
 #define NUM_URL_ID (URI_GET_URLLIB_END - URI_GET_URLLIB + 1)
 
-[[eraseable]]
+ERASEABLE
 void url_multi_fopen(string url, float mode, url_ready_func rdy, entity pass);
index 746a43d089015eec6eed881b76ea86df8eb10d87..8340381bab3aff467e543a1fdf1d1c19eacf1463 100644 (file)
@@ -25,7 +25,7 @@ noref vector _dotproduct_a, _dotproduct_b;
 #if 1
 #define cross(a, b) ((a) >< (b))
 #else
-[[eraseable]]
+ERASEABLE
 vector cross(vector a, vector b)
 {
        return
@@ -46,7 +46,7 @@ const vector eX = '1 0 0';
 const vector eY = '0 1 0';
 const vector eZ = '0 0 1';
 
-[[eraseable]]
+ERASEABLE
 vector randompos(vector m1, vector m2)
 {
        vector v;
@@ -57,19 +57,19 @@ vector randompos(vector m1, vector m2)
        return v;
 }
 
-[[eraseable]]
+ERASEABLE
 float vlen_maxnorm2d(vector v)
 {
        return max(v.x, v.y, -v.x, -v.y);
 }
 
-[[eraseable]]
+ERASEABLE
 float vlen_minnorm2d(vector v)
 {
        return min(max(v.x, -v.x), max(v.y, -v.y));
 }
 
-[[eraseable]]
+ERASEABLE
 float dist_point_line(vector p, vector l0, vector ldir)
 {
        ldir = normalize(ldir);
@@ -82,11 +82,11 @@ float dist_point_line(vector p, vector l0, vector ldir)
 }
 
 /** requires that m2>m1 in all coordinates, and that m4>m3 */
-[[eraseable]]
+ERASEABLE
 float boxesoverlap(vector m1, vector m2, vector m3, vector m4) { return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z; }
 
 /** requires the same as boxesoverlap, but is a stronger condition */
-[[eraseable]]
+ERASEABLE
 float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) { return smins.x >= bmins.x && smaxs.x <= bmaxs.x && smins.y >= bmins.y && smaxs.y <= bmaxs.y && smins.z >= bmins.z && smaxs.z <= bmaxs.z; }
 
 #define PITCH(v) ((v).x)
@@ -112,7 +112,7 @@ noref vector _vec2;
 noref vector _vec3;
 #define vec3(_x, _y, _z) (_vec3.x = (_x), _vec3.y = (_y), _vec3.z = (_z), _vec3)
 
-[[eraseable]]
+ERASEABLE
 vector Rotate(vector v, float a)
 {
        float a_sin = sin(a), a_cos = cos(a);
@@ -127,7 +127,7 @@ noref vector _yinvert;
  * @param norm the normalized normal
  * @returns dir reflected by norm
  */
-[[eraseable]]
+ERASEABLE
 vector reflect(vector dir, vector norm)
 {
        return dir - 2 * (dir * norm) * norm;
@@ -136,13 +136,13 @@ vector reflect(vector dir, vector norm)
 /**
  * clip vel along the plane defined by norm (assuming 0 distance away), bounciness determined by bounce 0..1
  */
-[[eraseable]]
+ERASEABLE
 vector vec_reflect(vector vel, vector norm, float bounce)
 {
        return vel - (1 + bounce) * (vel * norm) * norm;
 }
 
-[[eraseable]]
+ERASEABLE
 vector vec_epsilon(vector this, float eps)
 {
        if (this.x > -eps && this.x < eps) this.x = 0;
@@ -155,7 +155,7 @@ vector vec_epsilon(vector this, float eps)
        (out = vec_epsilon(vec_reflect(in, normal, (overbounce) - 1), 0.1))
 
 #ifdef GAMEQC
-       [[eraseable]]
+       ERASEABLE
        vector get_corner_position(entity box, int corner)
        {
                switch (corner)
@@ -172,7 +172,7 @@ vector vec_epsilon(vector this, float eps)
                }
        }
 
-       [[eraseable]]
+       ERASEABLE
        vector NearestPointOnBox(entity box, vector org)
        {
                vector m1 = box.mins + box.origin;
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 116ad00023ae98b1a4321c609698298a2dd46f0b..6db6122352511d9640ac75baf603103a4e96ce65 100644 (file)
@@ -114,7 +114,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
                }
                else
                {
-                       LOG_INFO("would have to put player in solid, won't do that\n");
+                       LOG_INFO("would have to put player in solid, won't do that");
                        setorigin(player, o0 - player.view_ofs);
                        return 0;
                }
@@ -348,13 +348,13 @@ float WarpZone_CheckProjectileImpact(entity player)
                return 0;
 
 #ifdef WARPZONELIB_REMOVEHACK
-       LOG_INFO("impactfilter found something - and it no longer gets handled correctly - please tell divVerent whether anything behaves broken now\n");
+       LOG_INFO("impactfilter found something - and it no longer gets handled correctly - please tell divVerent whether anything behaves broken now");
 #else
-       LOG_INFO("impactfilter found something - and it even gets handled correctly - please tell divVerent that this code apparently gets triggered again\n");
+       LOG_INFO("impactfilter found something - and it even gets handled correctly - please tell divVerent that this code apparently gets triggered again");
 #endif
-       LOG_INFO("Entity type: ", player.classname, "\n");
-       LOG_INFO("Origin: ", vtos(player.origin), "\n");
-       LOG_INFO("Velocity: ", vtos(player.velocity), "\n");
+       LOG_INFO("Entity type: ", player.classname);
+       LOG_INFO("Origin: ", vtos(player.origin));
+       LOG_INFO("Velocity: ", vtos(player.velocity));
 
 #ifdef WARPZONELIB_REMOVEHACK
        return 0;
@@ -583,7 +583,7 @@ void WarpZone_InitStep_UpdateTransform(entity this)
                point = point * (1 / (3 * area));
                if(vdist(norm, <, 0.99))
                {
-                       LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.\n");
+                       LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.");
                        area = 0; // no autofixing in this case
                }
                norm = normalize(norm);
@@ -600,15 +600,15 @@ void WarpZone_InitStep_UpdateTransform(entity this)
                        makevectors(ang);
                        if(norm * v_forward < 0)
                        {
-                               LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
+                               LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.");
                                norm = -1 * norm;
                        }
                        ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
                        ang.x = -ang.x;
                        if(norm * v_forward < 0.99)
-                               LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang), "\n");
+                               LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang));
                        if(vdist(org - this.aiment.origin, >, 0.5))
-                               LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").\n");
+                               LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").");
                }
        }
        else if(area > 0)
@@ -811,7 +811,7 @@ void WarpZone_StartFrame()
                        WarpZone_StoreProjectileData(it);
                });
        }
-               
+
 
        FOREACH_CLIENT(true,
        {
@@ -888,7 +888,7 @@ void WarpZone_PlayerPhysics_FixVAngle(entity this)
 #ifndef WARPZONE_DONT_FIX_VANGLE
        if(IS_REAL_CLIENT(this))
        if(this.v_angle.z <= 360) // if not already adjusted
-       if(time - this.ping * 0.001 < this.warpzone_teleport_time)
+       if(time - CS(this).ping * 0.001 < this.warpzone_teleport_time)
        {
                this.v_angle = WarpZone_TransformVAngles(this.warpzone_teleport_zone, this.v_angle);
                this.v_angle_z += 720; // mark as adjusted
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 72aadf6247bac401778744fe630ea81443979fba..18e5ae08123ff999f479c896f2eadc79de4972d6 100644 (file)
@@ -16,15 +16,15 @@ void _dumptree_open(entity pass, entity me)
        s = me.toString(me);
        if (s == "") s = me.classname;
        else s = strcat(me.classname, ": ", s);
-       LOG_INFO(_dumptree_space, etos(me), " (", s, ")");
+       print(_dumptree_space, etos(me), " (", s, ")");
        if (me.firstChild)
        {
-               LOG_INFO(" {\n");
+               print(" {\n");
                _dumptree_space = strcat(_dumptree_space, "  ");
        }
        else
        {
-               LOG_INFO("\n");
+               print("\n");
        }
 }
 void _dumptree_close(entity pass, entity me)
@@ -32,7 +32,7 @@ void _dumptree_close(entity pass, entity me)
        if (me.firstChild)
        {
                _dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
-               LOG_INFO(_dumptree_space, "}\n");
+               print(_dumptree_space, "}\n");
        }
 }
 
@@ -45,11 +45,11 @@ void GameCommand(string theCommand)
 
        if (argv(0) == "help" || argc == 0)
        {
-               LOG_INFO(_("Usage: menu_cmd command..., where possible commands are:\n"));
-               LOG_INFO(_("  sync - reloads all cvars on the current menu page\n"));
-               LOG_INFO(_("  directmenu ITEM - select a menu item as main item\n"));
+               LOG_INFO(_("Usage: menu_cmd command..., where possible commands are:"));
+               LOG_INFO(_("  sync - reloads all cvars on the current menu page"));
+               LOG_INFO(_("  directmenu ITEM - select a menu item as main item"));
 
-               LOG_INFO("\nGeneric commands shared by all programs:\n");
+               LOG_INFO("Generic commands shared by all programs:");
                GenericCommand_macro_help();
 
                return;
@@ -76,7 +76,7 @@ void GameCommand(string theCommand)
 
                if (argc == 1)
                {
-                       LOG_INFO(_("Available options:\n"));
+                       LOG_INFO(_("Available options:"));
 
                        FOREACH_ENTITY_ORDERED(it.name != "", {
                                if (it.classname == "vtbl") continue;
@@ -86,7 +86,7 @@ void GameCommand(string theCommand)
                                        if (!startsWith(s, filter)) continue;
                                        s = substring(s, strlen(filter), strlen(s) - strlen(filter));
                                }
-                               LOG_INFOF(" %s\n", s);
+                               LOG_INFOF(" %s", s);
                        });
                }
                else if (argc == 2 && !isdemo())     // don't allow this command in demos
@@ -125,5 +125,5 @@ void GameCommand(string theCommand)
        if(MUTATOR_CALLHOOK(Menu_ConsoleCommand, ss, argc, theCommand)) // handled by a mutator
                return;
 
-       LOG_INFO(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));
+       LOG_INFO(_("Invalid command. For a list of supported commands, try menu_cmd help."));
 }
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 f0e6646ca93d7115063ea9d36018565271229ad3..af14e0842b4dc749897a45e7fc2f18ae2dcaf6c4 100644 (file)
@@ -69,7 +69,7 @@ void m_init()
        cvar_set("_menu_prvm_language", prvm_language);
 
 #ifdef WATERMARK
-               LOG_INFOF("^4MQC Build information: ^1%s\n", WATERMARK);
+               LOG_INFOF("^4MQC Build information: ^1%s", WATERMARK);
 #endif
 
        // list all game dirs (TEST)
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)
        {
index 8feee96ed7a05a7ac74ef8a97a8eae709a503c2e..111744e9668da9e0b3909f7c97e15c8f01062e72 100644 (file)
@@ -288,7 +288,7 @@ void MapList_LoadMap(entity btn, entity me)
        m = MapInfo_BSPName_ByID(i);
        if (!m)
        {
-               LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n"));
+               LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again."));
                me.refilter(me);
                return;
        }
@@ -301,7 +301,7 @@ void MapList_LoadMap(entity btn, entity me)
        }
        else
        {
-               LOG_INFO(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n"));
+               LOG_INFO(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again."));
                me.refilter(me);
                return;
        }
index ad9e38f03a61f1a4303ae7cca83302c68351137c..5e6a567b6af907de399757b63a265675d265d340 100644 (file)
@@ -45,7 +45,7 @@ void RegisterSLCategories()
                                else \
                                { \
                                        LOG_INFOF( \
-                                               "RegisterSLCategories(): Improper override '%s' for category '%s'!\n", \
+                                               "RegisterSLCategories(): Improper override '%s' for category '%s'!", \
                                                s, \
                                                categories[i].cat_name \
                                        ); \
index 6e3f8a03377f51eb4c6e93094ac384c92079ba99..e72ca12e2409813c024fbca7dc98914a1c56da35 100644 (file)
@@ -76,7 +76,7 @@ void XonoticSkinList_getSkins(entity me)
                fh = fopen(s, FILE_READ);
                if(fh < 0)
                {
-                       LOG_INFO("Warning: can't open skinvalues.txt file\n");
+                       LOG_INFO("Warning: can't open skinvalues.txt file");
                        continue;
                }
                while((s = fgets(fh)))
index dcc2c85b06a1746bec59d3144dd7222e08cae1a9..e26076b658a8b80ab668a9fc8c675677a55c11af 100644 (file)
@@ -92,7 +92,7 @@ TEST(XonoticDecibelsSlider, SoundTest)
                float v = fromDecibelOfSquare(db, -40);
                float dbv = toDecibelOfSquare(v, -40);
                float d = dbv - db;
-               LOG_INFOF("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
+               LOG_INFOF("%f -> %f -> %f (diff: %f)", db, v, dbv, d);
                EXPECT_GT(fabs(d), 0.02);
        }
        SUCCEED();
index 7f038a85fb53efe0f28d7e02a0efbd4855bce3b1..7b381b544588ae4d9049d972ad0d74d44c7c9a23 100644 (file)
@@ -306,7 +306,7 @@ void URI_Get_Callback(float id, float status, string data)
        }
        else
        {
-               LOG_INFOF("Received HTTP request data for an invalid id %d.\n", id);
+               LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
        }
 }
 
@@ -414,7 +414,7 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data)
                {
                        // update needed
                        _Nex_ExtResponseSystem_UpdateTo = strzone(un_version);
-                       if(un_download) { LOG_INFOF(_("Update can be downloaded at:\n%s\n"), un_download); }
+                       if(un_download) { LOG_INFOF(_("Update can be downloaded at:\n%s"), un_download); }
                        if(un_url) { _Nex_ExtResponseSystem_UpdateToURL = strzone(un_url); }
                        DisableServerBackwardsCompatibility();
                }
@@ -659,7 +659,7 @@ float updateCompression()
                cvar_set("gl_texturecompression", "1");
                cvar_set("r_texture_dds_load", "1");
                if(!can_dds)
-                       LOG_INFO(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems.\n"));
+                       LOG_INFO(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems."));
                return 0;
        }
        else
@@ -830,7 +830,7 @@ void CheckSendCvars(entity me, string cvarnamestring)
 {
        if(me.sendCvars)
        {
-               LOG_INFOF("Sending cvar: %s -> %s\n", cvarnamestring, cvar_string(cvarnamestring));
+               LOG_INFOF("Sending cvar: %s -> %s", cvarnamestring, cvar_string(cvarnamestring));
                if(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))
                {
                        cmd(sprintf("\nsendcvar %s\n", cvarnamestring));
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 4e794cb3fc361e7796c98fb66d80b2daae4f4525..7173ae5970721388811a5f639476540732851b54 100644 (file)
@@ -81,8 +81,8 @@ void anticheat_physics(entity this)
                MEAN_ACCUMULATE(CS(this), anticheat_div0_evade, 0.5 - 0.5 * (CS(this).anticheat_div0_evade_forward_initial * v_forward), 1);
        }
 
-       MEAN_ACCUMULATE(CS(this), anticheat_div0_strafebot_old, movement_oddity(this.movement, CS(this).anticheat_div0_strafebot_movement_prev), 1);
-       CS(this).anticheat_div0_strafebot_movement_prev = this.movement;
+       MEAN_ACCUMULATE(CS(this), anticheat_div0_strafebot_old, movement_oddity(CS(this).movement, CS(this).anticheat_div0_strafebot_movement_prev), 1);
+       CS(this).anticheat_div0_strafebot_movement_prev = CS(this).movement;
 
        // Note: this actually tries to detect snap-aim.
        if(CS(this).anticheat_div0_strafebot_forward_prev && time > CS(this).anticheat_fixangle_endtime) {
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 ee7b5d4e37c0095628517a93ca765173f32bbd14..6cf392eed5ae1e8bd2bc125b3a19aa5b9e70d6dd 100644 (file)
@@ -8,5 +8,5 @@ void antilag_clear(entity e, entity store);
 
 .float antilag_debug;
 
-#define ANTILAG_LATENCY(e) min(0.4, e.ping * 0.001)
+#define ANTILAG_LATENCY(e) min(0.4, CS(e).ping * 0.001)
 // add one ticrate?
index 0c2c1ed4feb90f96b025792af4737a1b715f967e..f585a9a2c33db3eafb7b72168b2b3d8a50de8afd 100644 (file)
@@ -13,7 +13,7 @@ int autocvar_captureleadlimit_override;
 float autocvar_ekg;
 #define autocvar_fraglimit cvar("fraglimit")
 #define autocvar_fraglimit_override cvar("fraglimit_override")
-bool autocvar_g_allow_oldvortexbeam;
+//bool autocvar_g_allow_oldvortexbeam;
 int autocvar_g_antilag;
 float autocvar_g_antilag_nudge;
 float autocvar_g_balance_armor_blockpercent;
@@ -258,7 +258,7 @@ float autocvar_gameversion_min;
 float autocvar_gameversion_max;
 string autocvar_hostname;
 bool autocvar_lastlevel;
-int autocvar_leadlimit;
+//int autocvar_leadlimit;
 int autocvar_leadlimit_and_fraglimit;
 int autocvar_leadlimit_override;
 int autocvar_loddebug;
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 0b813dae1fd5b3be51a7828a22f5c86efefef404..8f2abb3f824b5745448a5fb4c16ab21545e5451b 100644 (file)
@@ -1,5 +1,7 @@
 #include "aim.qh"
 
+#include <server/defs.qh>
+
 #include "cvars.qh"
 
 #include "bot.qh"
@@ -157,7 +159,7 @@ void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1,
                return;
        }
        this.bot_aimtarg = e1;
-       this.bot_aimlatency = this.ping; // FIXME?  Shouldn't this be in the lag item?
+       this.bot_aimlatency = CS(this).ping; // FIXME?  Shouldn't this be in the lag item?
        //this.bot_aimorigin = v1;
        //this.bot_aimvelocity = v2;
        this.bot_aimtargorigin = v3;
@@ -305,7 +307,7 @@ float bot_aimdir(entity this, vector v, float maxfiredeviation)
        //dprint("e ", vtos(diffang), " < ", ftos(maxfiredeviation), "\n");
 
        // decide whether to fire this time
-       if ((normalize(v) * shotdir) >= cos(maxfiredeviation * DEG2RAD))
+       if (v * shotdir >= cos(maxfiredeviation * DEG2RAD))
        if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + this.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+this.bot_aggresskill)*0.05,1))
                this.bot_firetimer = time + bound(0.1, 0.5-(skill+this.bot_aggresskill)*0.05, 0.5);
        //traceline(shotorg,shotorg+shotdir*1000,false,NULL);
index 7ce4b1ab3787c898c698f49a6a25da45b1233414..0e6c87b675d577fd820cdaf8612c0bd66fd5d5e0 100644 (file)
 #include <lib/warpzone/common.qh>
 #include <lib/warpzone/util_server.qh>
 
+// TODO: remove this function! its only purpose is to update these fields since bot_setnameandstuff is called before ClientState
+void bot_setclientfields(entity this)
+{
+       CS(this).cvar_cl_accuracy_data_share = 1;  // share the bots weapon accuracy data with the world
+       CS(this).cvar_cl_accuracy_data_receive = 0;  // don't receive any weapon accuracy data
+}
+
 entity bot_spawn()
 {
        entity bot = spawnclient();
@@ -50,6 +57,7 @@ entity bot_spawn()
                currentbots = currentbots + 1;
                bot_setnameandstuff(bot);
                ClientConnect(bot);
+               bot_setclientfields(bot);
                PutClientInServer(bot);
        }
        return bot;
@@ -74,7 +82,7 @@ void bot_think(entity this)
 
        if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
        {
-               this.movement = '0 0 0';
+               CS(this).movement = '0 0 0';
                this.bot_nextthink = time + 0.5;
                return;
        }
@@ -94,7 +102,7 @@ void bot_think(entity this)
        // (simulated network latency + naturally delayed reflexes)
        //this.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
        // minimum ping 20+10 random
-       this.ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
+       CS(this).ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
        // skill 10 = ping 0.2 (adrenaline)
        // skill 0 = ping 0.7 (slightly drunk)
 
@@ -113,7 +121,7 @@ void bot_think(entity this)
        if (time < game_starttime)
        {
                // block the bot during the countdown to game start
-               this.movement = '0 0 0';
+               CS(this).movement = '0 0 0';
                this.bot_nextthink = game_starttime;
                return;
        }
@@ -121,7 +129,7 @@ void bot_think(entity this)
        // if dead, just wait until we can respawn
        if (IS_DEAD(this))
        {
-               this.movement = '0 0 0';
+               CS(this).movement = '0 0 0';
                if (this.deadflag == DEAD_DEAD)
                {
                        PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
@@ -158,7 +166,7 @@ void bot_setnameandstuff(entity this)
 
        if(file < 0)
        {
-               LOG_INFO(strcat("Error: Can not open the bot configuration file '",autocvar_bot_config_file,"'\n"));
+               LOG_INFOF("Error: Can not open the bot configuration file '%s'", autocvar_bot_config_file);
                readfile = "";
        }
        else
@@ -175,13 +183,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 +256,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
@@ -264,9 +272,6 @@ void bot_setnameandstuff(entity this)
                bot_model = strcat(bot_model, ".iqm");
        this.playermodel = this.playermodel_freeme = strzone(strcat("models/player/", bot_model));
        this.playerskin = this.playerskin_freeme = strzone(bot_skin);
-
-       this.cvar_cl_accuracy_data_share = 1;  // share the bots weapon accuracy data with the NULL
-       this.cvar_cl_accuracy_data_receive = 0;  // don't receive any weapon accuracy data
 }
 
 void bot_custom_weapon_priority_setup()
@@ -419,7 +424,10 @@ void bot_clientconnect(entity this)
        this.createdtime = this.bot_nextthink;
 
        if(!this.bot_config_loaded) // This is needed so team overrider doesn't break between matches
+       {
                bot_setnameandstuff(this);
+               bot_setclientfields(this);
+       }
 
        if(this.bot_forced_team==1)
                this.team = NUM_TEAM_1;
@@ -526,12 +534,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 +573,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 +592,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;
@@ -622,8 +630,7 @@ float bot_fixcount()
        // only add one bot per frame to avoid utter chaos
        if(time > botframe_nextthink)
        {
-               //dprint(ftos(bots), " ? ", ftos(currentbots), "\n");
-               while (currentbots < bots)
+               if (currentbots < bots)
                {
                        if (bot_spawn() == NULL)
                        {
index 42f51af8c7f279c3e1e510fd2ff3c1e56dd469d0..46acf8828774324f3790596ce465576f6c6c7b77 100644 (file)
@@ -1,5 +1,7 @@
 #include "havocbot.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../cvars.qh"
 
 #include "../aim.qh"
@@ -180,20 +182,20 @@ void havocbot_ai(entity this)
                        // we are currently holding a weapon that's not fully loaded, reload it
                        if(skill >= 2) // bots can only reload the held weapon on purpose past this skill
                        if(this.(weaponentity).clip_load < this.(weaponentity).clip_size)
-                               this.impulse = IMP_weapon_reload.impulse; // not sure if this is done right
+                               CS(this).impulse = IMP_weapon_reload.impulse; // not sure if this is done right
 
                        // if we're not reloading a weapon, switch to any weapon in our invnetory that's not fully loaded to reload it next
                        // the code above executes next frame, starting the reloading then
                        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;
                                        }
-                               ));
+                               });
                        }
                }
        }
@@ -212,7 +214,7 @@ void havocbot_keyboard_movement(entity this, vector destorg)
                                        + 0.05 / max(1, sk + this.havocbot_keyboardskill)
                                        + random() * 0.025 / max(0.00025, skill + this.havocbot_keyboardskill)
                        , time);
-               keyboard = this.movement / autocvar_sv_maxspeed;
+               keyboard = CS(this).movement / autocvar_sv_maxspeed;
 
                float trigger = autocvar_bot_ai_keyboard_threshold;
                float trigger1 = -trigger;
@@ -264,8 +266,8 @@ void havocbot_keyboard_movement(entity this, vector destorg)
 
        keyboard = this.havocbot_keyboard;
        float blend = bound(0, vlen(destorg - this.origin) / autocvar_bot_ai_keyboard_distance, 1); // When getting close move with 360 degree
-       //dprint("movement ", vtos(this.movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
-       this.movement = this.movement + (keyboard - this.movement) * blend;
+       //dprint("movement ", vtos(CS(this).movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
+       CS(this).movement = CS(this).movement + (keyboard - CS(this).movement) * blend;
 }
 
 void havocbot_bunnyhop(entity this, vector dir)
@@ -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;
                                        }
@@ -401,12 +403,12 @@ void havocbot_bunnyhop(entity this, vector dir)
                        while (deviation.y > 180) deviation.y = deviation.y - 360;
 
                        if(fabs(deviation.y)>10)
-                               this.movement_x = 0;
+                               CS(this).movement_x = 0;
 
                        if(deviation.y>10)
-                               this.movement_y = maxspeed * -1;
+                               CS(this).movement_y = maxspeed * -1;
                        else if(deviation.y<10)
-                               this.movement_y = maxspeed;
+                               CS(this).movement_y = maxspeed;
 
                }
        }
@@ -432,7 +434,7 @@ void havocbot_movetogoal(entity this)
        vector dodge;
        //if (this.goalentity)
        //      te_lightning2(this, this.origin, (this.goalentity.absmin + this.goalentity.absmax) * 0.5);
-       this.movement = '0 0 0';
+       CS(this).movement = '0 0 0';
        maxspeed = autocvar_sv_maxspeed;
 
        // Jetpack navigation
@@ -476,7 +478,7 @@ void havocbot_movetogoal(entity this)
                                // Brake
                                if(fabs(this.velocity.x)>maxspeed*0.3)
                                {
-                                       this.movement_x = dir * v_forward * -maxspeed;
+                                       CS(this).movement_x = dir * v_forward * -maxspeed;
                                        return;
                                }
                                // Switch to normal mode
@@ -498,8 +500,8 @@ void havocbot_movetogoal(entity this)
                PHYS_INPUT_BUTTON_HOOK(this) = true;
                if(this.navigation_jetpack_point.z - STAT(PL_MAX, this).z + STAT(PL_MIN, this).z < this.origin.z)
                {
-                       this.movement_x = dir * v_forward * maxspeed;
-                       this.movement_y = dir * v_right * maxspeed;
+                       CS(this).movement_x = dir * v_forward * maxspeed;
+                       CS(this).movement_y = dir * v_right * maxspeed;
                }
                return;
        }
@@ -597,8 +599,8 @@ void havocbot_movetogoal(entity this)
                                tracebox(this.origin, this.mins, this.maxs, this.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, this);
                                if(trace_fraction==1)
                                {
-                                       this.movement_x = dir * v_forward * maxspeed;
-                                       this.movement_y = dir * v_right * maxspeed;
+                                       CS(this).movement_x = dir * v_forward * maxspeed;
+                                       CS(this).movement_y = dir * v_right * maxspeed;
                                        if (skill < 10)
                                                havocbot_keyboard_movement(this, this.origin + dir * 100);
                                }
@@ -621,7 +623,7 @@ void havocbot_movetogoal(entity this)
 
                                        if(client_hasweapon(this, WEP_DEVASTATOR, weaponentity, true, false))
                                        {
-                                               this.movement_x = maxspeed;
+                                               CS(this).movement_x = maxspeed;
 
                                                if(this.rocketjumptime)
                                                {
@@ -646,7 +648,7 @@ void havocbot_movetogoal(entity this)
                {
                        // If there is no goal try to move forward
                        if(this.goalcurrent==NULL)
-                               this.movement_x = maxspeed;
+                               CS(this).movement_x = maxspeed;
                }
        }
 
@@ -662,9 +664,9 @@ void havocbot_movetogoal(entity this)
                else
                        PHYS_INPUT_BUTTON_JUMP(this) = false;
                makevectors(this.v_angle.y * '0 1 0');
-               this.movement_x = dir * v_forward * maxspeed;
-               this.movement_y = dir * v_right * maxspeed;
-               this.movement_z = dir * v_up * maxspeed;
+               CS(this).movement_x = dir * v_forward * maxspeed;
+               CS(this).movement_y = dir * v_right * maxspeed;
+               CS(this).movement_z = dir * v_up * maxspeed;
        }
 
        // if there is nowhere to go, exit
@@ -912,9 +914,9 @@ void havocbot_movetogoal(entity this)
        //dir = this.bot_dodgevector;
        //if (this.bot_dodgevector_jumpbutton)
        //      PHYS_INPUT_BUTTON_JUMP(this) = true;
-       this.movement_x = dir * v_forward * maxspeed;
-       this.movement_y = dir * v_right * maxspeed;
-       this.movement_z = dir * v_up * maxspeed;
+       CS(this).movement_x = dir * v_forward * maxspeed;
+       CS(this).movement_y = dir * v_right * maxspeed;
+       CS(this).movement_z = dir * v_up * maxspeed;
 
        // Emulate keyboard interface
        if (skill < 10)
@@ -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;
        }
 
@@ -1202,10 +1204,10 @@ void havocbot_aim(entity this)
                vector enemyvel = this.enemy.velocity;
                if (!this.enemy.waterlevel)
                        enemyvel.z = 0;
-               lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, myvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel);
+               lag_additem(this, time + CS(this).ping, 0, 0, this.enemy, this.origin, myvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel);
        }
        else
-               lag_additem(this, time + this.ping, 0, 0, NULL, this.origin, myvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0');
+               lag_additem(this, time + CS(this).ping, 0, 0, NULL, this.origin, myvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0');
 }
 
 bool havocbot_moveto_refresh_route(entity this)
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 7ba7defbac08c66d6b91869f590263e4fa584da8..e69050beb84d16e438e12f5849184139f792195c 100644 (file)
@@ -1,5 +1,7 @@
 #include "scripting.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include <common/state.qh>
@@ -130,7 +132,7 @@ entity bot_getplace(entity this, string placename)
                }
                e = find(NULL, targetname, s);
                if(!e)
-                       LOG_INFO("invalid place ", s, "\n");
+                       LOG_INFO("invalid place ", s);
                if(i < MAX_BOT_PLACES)
                {
                        this.(bot_placenames[i]) = strzone(placename);
@@ -143,7 +145,7 @@ entity bot_getplace(entity this, string placename)
        {
                e = find(NULL, targetname, placename);
                if(!e)
-                       LOG_INFO("invalid place ", placename, "\n");
+                       LOG_INFO("invalid place ", placename);
                return e;
        }
 }
@@ -292,7 +294,7 @@ float bot_decodecommand(string cmdstring)
 
                if(cmd_parm_type!=BOT_CMD_PARAMETER_NONE&&parm=="")
                {
-                       LOG_INFO("ERROR: A parameter is required for this command\n");
+                       LOG_INFO("ERROR: A parameter is required for this command");
                        return 0;
                }
 
@@ -313,7 +315,7 @@ float bot_decodecommand(string cmdstring)
                        case BOT_CMD_PARAMETER_VECTOR:
                                if(substring(parm, 0, 1) != "\'")
                                {
-                                       LOG_INFOF("ERROR: expected vector type \'x y z\', got %s\n", parm);
+                                       LOG_INFOF("ERROR: expected vector type \'x y z\', got %s", parm);
                                        return 0;
                                }
                                bot_cmd.bot_cmd_parm_vector = stov(parm);
@@ -323,7 +325,7 @@ float bot_decodecommand(string cmdstring)
                }
                return 1;
        }
-       LOG_INFO("ERROR: No such command '", cmdstring, "'\n");
+       LOG_INFO("ERROR: No such command '", cmdstring, "'");
        return 0;
 }
 
@@ -358,87 +360,90 @@ void bot_cmdhelp(string scmd)
                                break;
                }
 
-               LOG_INFO(strcat("Command: ",bot_cmd_string[i],"\nParameter: <",stype,"> \n"));
-
-               LOG_INFO("Description: ");
+               string prelude = strcat(
+                   "Command: ", bot_cmd_string[i], "\n",
+                   "Parameter: <", stype, ">", "\n",
+                   "Description: "
+        );
                switch(i)
                {
                        case BOT_CMD_PAUSE:
-                               LOG_INFO("Stops the bot completely. Any command other than 'continue' will be ignored.");
+                               LOG_INFO(prelude, "Stops the bot completely. Any command other than 'continue' will be ignored.");
                                break;
                        case BOT_CMD_CONTINUE:
-                               LOG_INFO("Disable paused status");
+                               LOG_INFO(prelude, "Disable paused status");
                                break;
                        case BOT_CMD_WAIT:
-                               LOG_INFO("Pause command parsing and bot ai for N seconds. Pressed key will remain pressed");
+                               LOG_INFO(prelude, "Pause command parsing and bot ai for N seconds. Pressed key will remain pressed");
                                break;
                        case BOT_CMD_WAIT_UNTIL:
-                               LOG_INFO("Pause command parsing and bot ai until time is N from the last barrier. Pressed key will remain pressed");
+                               LOG_INFO(prelude, "Pause command parsing and bot ai until time is N from the last barrier. Pressed key will remain pressed");
                                break;
                        case BOT_CMD_BARRIER:
-                               LOG_INFO("Waits till all bots that have a command queue reach this command. Pressed key will remain pressed");
+                               LOG_INFO(prelude, "Waits till all bots that have a command queue reach this command. Pressed key will remain pressed");
                                break;
                        case BOT_CMD_TURN:
-                               LOG_INFO("Look to the right or left N degrees. For turning to the left use positive numbers.");
+                               LOG_INFO(prelude, "Look to the right or left N degrees. For turning to the left use positive numbers.");
                                break;
                        case BOT_CMD_MOVETO:
-                               LOG_INFO("Walk to an specific coordinate on the map. Usage: moveto \'x y z\'");
+                               LOG_INFO(prelude, "Walk to an specific coordinate on the map. Usage: moveto \'x y z\'");
                                break;
                        case BOT_CMD_MOVETOTARGET:
-                               LOG_INFO("Walk to the specific target on the map");
+                               LOG_INFO(prelude, "Walk to the specific target on the map");
                                break;
                        case BOT_CMD_RESETGOAL:
-                               LOG_INFO("Resets the goal stack");
+                               LOG_INFO(prelude, "Resets the goal stack");
                                break;
                        case BOT_CMD_CC:
-                               LOG_INFO("Execute client command. Examples: cc \"say something\"; cc god; cc \"name newnickname\"; cc kill;");
+                               LOG_INFO(prelude, "Execute client command. Examples: cc \"say something\"; cc god; cc \"name newnickname\"; cc kill;");
                                break;
                        case BOT_CMD_IF:
-                               LOG_INFO("Perform simple conditional execution.\n");
-                               LOG_INFO("Syntax: \n");
-                               LOG_INFO("        sv_cmd .. if \"condition\"\n");
-                               LOG_INFO("        sv_cmd ..     <instruction if true>\n");
-                               LOG_INFO("        sv_cmd ..     <instruction if true>\n");
-                               LOG_INFO("        sv_cmd .. else\n");
-                               LOG_INFO("        sv_cmd ..     <instruction if false>\n");
-                               LOG_INFO("        sv_cmd ..     <instruction if false>\n");
-                               LOG_INFO("        sv_cmd .. fi\n");
-                               LOG_INFO("Conditions: a=b, a>b, a<b, a\t\t(spaces not allowed)\n");
-                               LOG_INFO("            Values in conditions can be numbers, cvars in the form cvar.cvar_string or special fields\n");
-                               LOG_INFO("Fields: health, speed, flagcarrier\n");
-                               LOG_INFO("Examples: if health>50; if health>cvar.g_balance_laser_primary_damage; if flagcarrier;");
+                               LOG_INFO(prelude, "Perform simple conditional execution.\n"
+                    "Syntax: \n"
+                    "        sv_cmd .. if \"condition\"\n"
+                    "        sv_cmd ..         <instruction if true>\n"
+                    "        sv_cmd ..         <instruction if true>\n"
+                    "        sv_cmd .. else\n"
+                    "        sv_cmd ..         <instruction if false>\n"
+                    "        sv_cmd ..         <instruction if false>\n"
+                    "        sv_cmd .. fi\n"
+                    "Conditions: a=b, a>b, a<b, a\t\t(spaces not allowed)\n"
+                    "            Values in conditions can be numbers, cvars in the form cvar.cvar_string or special fields\n"
+                    "Fields: health, speed, flagcarrier\n"
+                    "Examples: if health>50; if health>cvar.g_balance_laser_primary_damage; if flagcarrier;"
+                               );
                                break;
                        case BOT_CMD_RESETAIM:
-                               LOG_INFO("Points the aim to the coordinates x,y 0,0");
+                               LOG_INFO(prelude, "Points the aim to the coordinates x,y 0,0");
                                break;
                        case BOT_CMD_AIM:
-                               LOG_INFO("Move the aim x/y (horizontal/vertical) degrees relatives to the bot\n");
-                               LOG_INFO("There is a 3rd optional parameter telling in how many seconds the aim has to reach the new position\n");
-                               LOG_INFO("Examples: aim \"90 0\"        // Turn 90 degrees inmediately (positive numbers move to the left/up)\n");
-                               LOG_INFO("          aim \"0 90 2\"      // Will gradually look to the sky in the next two seconds");
+                               LOG_INFO(prelude, "Move the aim x/y (horizontal/vertical) degrees relatives to the bot\n"
+                                       "There is a 3rd optional parameter telling in how many seconds the aim has to reach the new position\n"
+                                       "Examples: aim \"90 0\" // Turn 90 degrees inmediately (positive numbers move to the left/up)\n"
+                                       "          aim \"0 90 2\"       // Will gradually look to the sky in the next two seconds"
+                               );
                                break;
                        case BOT_CMD_AIMTARGET:
-                               LOG_INFO("Points the aim to given target");
+                               LOG_INFO(prelude, "Points the aim to given target");
                                break;
                        case BOT_CMD_PRESSKEY:
-                               LOG_INFO("Press one of the following keys: forward, backward, left, right, jump, crouch, attack1, attack2, use\n");
+                               LOG_INFO(prelude, "Press one of the following keys: forward, backward, left, right, jump, crouch, attack1, attack2, use");
                                LOG_INFO("Multiple keys can be pressed at time (with many presskey calls) and it will remain pressed until the command \"releasekey\" is called");
                                LOG_INFO("Note: The script will not return the control to the bot ai until all keys are released");
                                break;
                        case BOT_CMD_RELEASEKEY:
-                               LOG_INFO("Release previoulsy used keys. Use the parameter \"all\" to release all keys");
+                               LOG_INFO(prelude, "Release previoulsy used keys. Use the parameter \"all\" to release all keys");
                                break;
                        case BOT_CMD_SOUND:
-                               LOG_INFO("play sound file at bot location");
+                               LOG_INFO(prelude, "play sound file at bot location");
                                break;
                        case BOT_CMD_DEBUG_ASSERT_CANFIRE:
-                               LOG_INFO("verify the state of the weapon entity");
+                               LOG_INFO(prelude, "verify the state of the weapon entity");
                                break;
                        default:
-                               LOG_INFO("This command has no description yet.");
+                               LOG_INFO(prelude, "This command has no description yet.");
                                break;
                }
-               LOG_INFO("\n");
        }
 }
 
@@ -450,8 +455,10 @@ void bot_list_commands()
        if(!bot_cmds_initialized)
                bot_commands_init();
 
-       LOG_INFO("List of all available commands:\n");
-       LOG_INFO("  Command - Parameter Type\n");
+       LOG_INFO(
+           "List of all available commands:\n"
+           "  Command - Parameter Type\n"
+    );
 
        for(i=1;i<BOT_CMD_COUNTER;++i)
        {
@@ -470,7 +477,7 @@ void bot_list_commands()
                                ptype = "none";
                                break;
                }
-               LOG_INFO(strcat("  ",bot_cmd_string[i]," - <",ptype,"> \n"));
+               LOG_INFO("  ", bot_cmd_string[i]," - <", ptype, ">");
        }
 }
 
@@ -485,7 +492,7 @@ float bot_cmd_cc(entity this)
 
 float bot_cmd_impulse(entity this)
 {
-       this.impulse = bot_cmd.bot_cmd_parm_float;
+       CS(this).impulse = bot_cmd.bot_cmd_parm_float;
        return CMD_STATUS_FINISHED;
 }
 
@@ -539,16 +546,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;
        }
@@ -625,7 +632,7 @@ float bot_cmd_eval(entity this, string expr)
                        return ((this.flagcarried!=NULL));
        }
 
-       LOG_INFO(strcat("ERROR: Unable to convert the expression '",expr,"' into a numeric value\n"));
+       LOG_INFO("ERROR: Unable to convert the expression '", expr, "' into a numeric value");
        return 0;
 }
 
@@ -836,7 +843,7 @@ const int BOT_CMD_KEY_CHAT          = BIT(10);
 
 bool bot_presskeys(entity this)
 {
-       this.movement = '0 0 0';
+       CS(this).movement = '0 0 0';
        PHYS_INPUT_BUTTON_JUMP(this) = false;
        PHYS_INPUT_BUTTON_CROUCH(this) = false;
        PHYS_INPUT_BUTTON_ATCK(this) = false;
@@ -849,14 +856,14 @@ bool bot_presskeys(entity this)
                return false;
 
        if(this.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
-               this.movement_x = autocvar_sv_maxspeed;
+               CS(this).movement_x = autocvar_sv_maxspeed;
        else if(this.bot_cmd_keys & BOT_CMD_KEY_BACKWARD)
-               this.movement_x = -autocvar_sv_maxspeed;
+               CS(this).movement_x = -autocvar_sv_maxspeed;
 
        if(this.bot_cmd_keys & BOT_CMD_KEY_RIGHT)
-               this.movement_y = autocvar_sv_maxspeed;
+               CS(this).movement_y = autocvar_sv_maxspeed;
        else if(this.bot_cmd_keys & BOT_CMD_KEY_LEFT)
-               this.movement_y = -autocvar_sv_maxspeed;
+               CS(this).movement_y = -autocvar_sv_maxspeed;
 
        if(this.bot_cmd_keys & BOT_CMD_KEY_JUMP)
                PHYS_INPUT_BUTTON_JUMP(this) = true;
@@ -1008,7 +1015,7 @@ float bot_cmd_pause(entity this)
        PHYS_INPUT_BUTTON_ATCK2(this) = false;
        PHYS_INPUT_BUTTON_CROUCH(this) = false;
 
-       this.movement = '0 0 0';
+       CS(this).movement = '0 0 0';
        this.bot_cmd_keys = BOT_CMD_KEY_NONE;
 
        bot_clear(this);
@@ -1075,7 +1082,7 @@ float bot_cmd_debug_assert_canfire(entity this)
                if(f)
                {
                        this.colormod = '0 8 8';
-                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by weaponentity state\n");
+                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by weaponentity state");
                }
        }
        else if(ATTACK_FINISHED(this, slot) > time)
@@ -1083,7 +1090,7 @@ float bot_cmd_debug_assert_canfire(entity this)
                if(f)
                {
                        this.colormod = '8 0 8';
-                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)\n");
+                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)");
                }
        }
        else if(this.(weaponentity).tuba_note)
@@ -1091,7 +1098,7 @@ float bot_cmd_debug_assert_canfire(entity this)
                if(f)
                {
                        this.colormod = '8 0 0';
-                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, bot still has an active tuba note\n");
+                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, bot still has an active tuba note");
                }
        }
        else
@@ -1099,7 +1106,7 @@ float bot_cmd_debug_assert_canfire(entity this)
                if(!f)
                {
                        this.colormod = '8 8 0';
-                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left\n");
+                       LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left");
                }
        }
 
@@ -1156,7 +1163,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 +1174,7 @@ void bot_resetqueues()
                        it.(bot_placenames[i]) = string_null;
                }
                it.bot_places_count = 0;
-       ));
+       });
 
        bot_barriertime = time;
 }
@@ -1196,7 +1203,7 @@ float bot_execute_commands_once(entity this)
                if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
                {
                        bot_command_executed(this, true);
-                       LOG_INFO( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
+                       LOG_INFO("WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.");
                }
                return 1;
        }
@@ -1294,12 +1301,12 @@ float bot_execute_commands_once(entity this)
                        status = bot_cmd_debug_assert_canfire(this);
                        break;
                default:
-                       LOG_INFO(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
+                       LOG_INFOF("ERROR: Invalid command on queue with id '%s'", ftos(bot_cmd.bot_cmd_type));
                        return 0;
        }
 
        if (status==CMD_STATUS_ERROR)
-               LOG_INFO(strcat("ERROR: The command '",bot_cmd_string[bot_cmd.bot_cmd_type],"' returned an error status\n"));
+               LOG_INFOF("ERROR: The command '%s' returned an error status", bot_cmd_string[bot_cmd.bot_cmd_type]);
 
        // Move execution pointer
        if(status==CMD_STATUS_EXECUTING)
index e4c227c8fa2f2491e1ce00e706e8a0215c5b31e8..b1ff75db72eb477d7942f285ac31c82b62a5c313 100644 (file)
@@ -1,5 +1,7 @@
 #include "waypoints.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
@@ -74,7 +76,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
                        {
                                if(autocvar_developer)
                                {
-                                       LOG_INFO("A generated waypoint is stuck in solid at ", vtos(w.origin), "\n");
+                                       LOG_INFO("A generated waypoint is stuck in solid at ", vtos(w.origin));
                                        backtrace("Waypoint stuck");
                                }
                        }
@@ -516,7 +518,7 @@ void waypoint_load_or_remove_links_hardwired(bool removal_mode)
                        if(!found)
                        {
                                if(!removal_mode)
-                                       LOG_INFO(strcat("NOTICE: Can not find waypoint at ", vtos(wp_from_pos), ". Path skipped\n"));
+                                       LOG_INFO("NOTICE: Can not find waypoint at ", vtos(wp_from_pos), ". Path skipped");
                                continue;
                        }
                }
@@ -538,7 +540,7 @@ void waypoint_load_or_remove_links_hardwired(bool removal_mode)
                if(!found)
                {
                        if(!removal_mode)
-                               LOG_INFO(strcat("NOTICE: Can not find waypoint at ", vtos(wp_to_pos), ". Path skipped\n"));
+                               LOG_INFO("NOTICE: Can not find waypoint at ", vtos(wp_to_pos), ". Path skipped");
                        continue;
                }
 
@@ -613,7 +615,7 @@ void waypoint_save_links()
        int file = fopen(filename, FILE_WRITE);
        if (file < 0)
        {
-               LOG_INFOF("waypoint link save to %s failed\n", filename);
+               LOG_INFOF("waypoint link save to %s failed", filename);
                return;
        }
 
@@ -634,7 +636,7 @@ void waypoint_save_links()
        fclose(file);
        botframe_cachedwaypointlinks = true;
 
-       LOG_INFOF("saved %d waypoint links to maps/%s.waypoints.cache\n", c, mapname);
+       LOG_INFOF("saved %d waypoint links to maps/%s.waypoints.cache", c, mapname);
 
        waypoint_load_links_hardwired();
 }
@@ -649,7 +651,7 @@ void waypoint_saveall()
                waypoint_save_links(); // save anyway?
                botframe_loadedforcedlinks = false;
 
-               LOG_INFOF("waypoint links: save to %s failed\n", filename);
+               LOG_INFOF("waypoint links: save to %s failed", filename);
                return;
        }
 
@@ -672,7 +674,7 @@ void waypoint_saveall()
        waypoint_save_links();
        botframe_loadedforcedlinks = false;
 
-       LOG_INFOF("saved %d waypoints to maps/%s.waypoints\n", c, mapname);
+       LOG_INFOF("saved %d waypoints to maps/%s.waypoints", c, mapname);
 }
 
 // load waypoints from file
@@ -950,7 +952,7 @@ float botframe_autowaypoints_fix_from(entity p, float walkfromwp, entity wp, .en
                });
                if(bestdist < maxdist)
                {
-                       LOG_INFO("update chain to new nearest WP ", etos(p.(fld)), "\n");
+                       LOG_INFO("update chain to new nearest WP ", etos(p.(fld)));
                        return 0;
                }
 
@@ -1029,7 +1031,7 @@ float botframe_autowaypoints_fix_from(entity p, float walkfromwp, entity wp, .en
                tmax = t;
        }
 
-       LOG_INFO("spawning a waypoint for connecting to ", etos(wp), "\n");
+       LOG_INFO("spawning a waypoint for connecting to ", etos(wp));
        botframe_autowaypoints_createwp(o, p, fld, 0);
        return 1;
 }
@@ -1045,7 +1047,7 @@ void botframe_autowaypoints_fix(entity p, float walkfromwp, .entity fld)
        if(r != -1)
                return;
 
-       LOG_INFO("emergency: got no good nearby WP to build a link from, starting a new chain\n");
+       LOG_INFO("emergency: got no good nearby WP to build a link from, starting a new chain");
        if(!botframe_autowaypoints_fixdown(p.origin))
                return; // shouldn't happen, caught above
        botframe_autowaypoints_createwp(trace_endpos, p, fld, WAYPOINTFLAG_PROTECTED);
@@ -1117,7 +1119,7 @@ LABEL(next)
 
        IL_EACH(g_waypoints, !(it.wpflags & (WAYPOINTFLAG_USEFUL | WAYPOINTFLAG_DEAD_END)),
        {
-               LOG_INFOF("Removed a waypoint at %v. Try again for more!\n", it.origin);
+               LOG_INFOF("Removed a waypoint at %v. Try again for more!", it.origin);
                te_explosion(it.origin);
                waypoint_remove(it);
                break;
@@ -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..e80769cc2783edabcca7b1952aafbb5f9b06a256 100644 (file)
@@ -1,4 +1,7 @@
 #include "campaign.qh"
+
+#include "defs.qh"
+
 #include "cheats.qh"
 #include "miscfunctions.qh"
 #include "g_world.qh"
@@ -22,7 +25,7 @@ float CampaignBailout(string s)
        cvar_string = cvar_string_normal;
        cvar_set = cvar_set_normal;
        cvar_set("g_campaign", "0");
-       LOG_INFO("^4campaign initialization failed: ", s, "\n");
+       LOG_INFO("^4campaign initialization failed: ", s);
        if(autocvar__campaign_testrun)
                error("CAMPAIGN FAIL AHAHAHAHAHAHAHAHAH))");
        return 1;
@@ -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 ded5e8409885efa1500d13237e5b2b2921bdab45..3233a141dd9e1b14b71437c49e016ed77d6acf2e 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
@@ -278,7 +282,7 @@ float CheatImpulse(entity this, int imp)
                        RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, e);
                        delete(e2);
 
-                       LOG_INFO("404 Sportsmanship not found.\n");
+                       LOG_INFO("404 Sportsmanship not found.");
                        DID_CHEAT();
                        break;
        }
@@ -780,21 +784,21 @@ float Drag(entity this, float force_allow_pick, float ischeat)
                        {
                                if(PHYS_INPUT_BUTTON_DRAG(this))
                                {
-                                       if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
+                                       if(CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18)
                                        {
                                                Drag_MoveForward(this);
-                                               this.impulse = 0;
+                                               CS(this).impulse = 0;
                                        }
-                                       else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
+                                       else if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19)
                                        {
                                                Drag_MoveBackward(this);
-                                               this.impulse = 0;
+                                               CS(this).impulse = 0;
                                        }
-                                       else if(this.impulse >= 1 && this.impulse <= 9)
+                                       else if(CS(this).impulse >= 1 && CS(this).impulse <= 9)
                                        {
-                                               Drag_SetSpeed(this, this.impulse - 1);
+                                               Drag_SetSpeed(this, CS(this).impulse - 1);
                                        }
-                                       else if(this.impulse == 14)
+                                       else if(CS(this).impulse == 14)
                                        {
                                                Drag_SetSpeed(this, 9);
                                        }
index 381373ad2bcb713d93ccc4046efa6ac2341c14ed..f1d417d6bace6987d6f1a72984f6f77260b7db0f 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"
@@ -110,20 +113,18 @@ bool ClientData_Send(entity this, entity to, int sf)
        if (IS_SPEC(e)) e = e.enemy;
 
        sf = 0;
-       if (e.race_completed)       sf |= 1; // forced scoreboard
-       if (to.spectatee_status)    sf |= 2; // spectator ent number follows
-       if (e.zoomstate)            sf |= 4; // zoomed
-       if (autocvar_sv_showspectators) sf |= 16; // show spectators
+       if (CS(e).race_completed)       sf |= BIT(0); // forced scoreboard
+       if (CS(to).spectatee_status)    sf |= BIT(1); // spectator ent number follows
+       if (CS(e).zoomstate)            sf |= BIT(2); // zoomed
+       if (autocvar_sv_showspectators) sf |= BIT(4); // show spectators
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA);
        WriteByte(MSG_ENTITY, sf);
 
-       if (sf & 2)
-       {
-               WriteByte(MSG_ENTITY, to.spectatee_status);
-       }
+       if (sf & BIT(1))
+               WriteByte(MSG_ENTITY, CS(to).spectatee_status);
 
-       if(sf & 16)
+       if(sf & BIT(4))
        {
                float specs = CountSpectators(e, to);
                WriteByte(MSG_ENTITY, specs);
@@ -135,27 +136,25 @@ bool ClientData_Send(entity this, entity to, int sf)
 
 void ClientData_Attach(entity this)
 {
-       Net_LinkEntity(this.clientdata = new_pure(clientdata), false, 0, ClientData_Send);
-       this.clientdata.drawonlytoclient = this;
-       this.clientdata.owner = this;
+       Net_LinkEntity(CS(this).clientdata = new_pure(clientdata), false, 0, ClientData_Send);
+       CS(this).clientdata.drawonlytoclient = this;
+       CS(this).clientdata.owner = this;
 }
 
 void ClientData_Detach(entity this)
 {
-       delete(this.clientdata);
-       this.clientdata = NULL;
+       delete(CS(this).clientdata);
+       CS(this).clientdata = NULL;
 }
 
 void ClientData_Touch(entity e)
 {
-       e.clientdata.SendFlags = 1;
+       CS(e).clientdata.SendFlags = 1;
 
        // make it spectatable
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(it.clientdata.SendFlags = 1));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, { CS(it).clientdata.SendFlags = 1; });
 }
 
-.string netname_previous;
-
 void SetSpectatee(entity this, entity spectatee);
 void SetSpectatee_status(entity this, int spectatee_num);
 
@@ -227,12 +226,10 @@ void PutObserverInServer(entity this)
     {
         entity spot = SelectSpawnPoint(this, true);
         if (!spot) LOG_FATAL("No spawnpoints for observers?!?");
-        this.angles = spot.angles;
-        this.angles_z = 0;
+        this.angles = vec2(spot.angles);
         this.fixangle = true;
         // offset it so that the spectator spawns higher off the ground, looks better this way
         setorigin(this, spot.origin + STAT(PL_VIEW_OFS, this));
-        this.prevorigin = this.origin;
         if (IS_REAL_CLIENT(this))
         {
             msg_entity = this;
@@ -276,22 +273,22 @@ void PutObserverInServer(entity this)
         PlayerScore_Clear(this);  // clear scores when needed
     }
 
-       if (this.killcount != FRAGS_SPECTATOR)
+       if (CS(this).killcount != FRAGS_SPECTATOR)
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, this.netname);
                if(!game_stopped)
                if(autocvar_g_chat_nospectators == 1 || (!warmup_stage && autocvar_g_chat_nospectators == 2))
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
-               if(this.just_joined == false) {
+               if(!CS(this).just_joined)
                        LogTeamchange(this.playerid, -1, 4);
-               else
-                       this.just_joined = false;
+               else
+                       CS(this).just_joined = false;
        }
 
        accuracy_resend(this);
 
-       this.spectatortime = time;
+       CS(this).spectatortime = time;
        if(this.bot_attack)
                IL_REMOVE(g_bot_targets, this);
        this.bot_attack = false;
@@ -338,7 +335,6 @@ void PutObserverInServer(entity this)
 
        this.items = 0;
        this.weapons = '0 0 0';
-       this.dual_weapons = '0 0 0';
        this.drawonlytoclient = this;
 
        this.weaponmodel = "";
@@ -347,7 +343,7 @@ void PutObserverInServer(entity this)
                this.weaponentities[slot] = NULL;
        }
        this.exteriorweaponentity = NULL;
-       this.killcount = FRAGS_SPECTATOR;
+       CS(this).killcount = FRAGS_SPECTATOR;
        this.velocity = '0 0 0';
        this.avelocity = '0 0 0';
        this.punchangle = '0 0 0';
@@ -402,7 +398,7 @@ void FixPlayermodel(entity player)
                int n = tokenize_console(defaultmodel);
                if(n > 0)
                {
-                       defaultmodel = argv(floor(n * player.model_randomizer));
+                       defaultmodel = argv(floor(n * CS(player).model_randomizer));
                        // However, do NOT randomize if the player-selected model is in the list.
                        for (int i = 0; i < n; ++i)
                                if ((argv(i) == player.playermodel && defaultskin == stof(player.playerskin)) || argv(i) == strcat(player.playermodel, ":", player.playerskin))
@@ -488,253 +484,257 @@ void FixPlayermodel(entity player)
                                setcolor(player, stof(autocvar_sv_defaultplayercolors));
 }
 
-
-/** Called when a client spawns in the server */
-void PutClientInServer(entity this)
+void PutPlayerInServer(entity this)
 {
-       if (IS_BOT_CLIENT(this)) {
-               TRANSMUTE(Player, this);
-       } else if (IS_REAL_CLIENT(this)) {
-               msg_entity = this;
-               WriteByte(MSG_ONE, SVC_SETVIEW);
-               WriteEntity(MSG_ONE, this);
+       if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
+
+       PlayerState_attach(this);
+       accuracy_resend(this);
+
+       if (this.team < 0)
+               JoinBestTeam(this, false, true);
+
+       entity spot = SelectSpawnPoint(this, false);
+       if (!spot) {
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_NOSPAWNS);
+               return; // spawn failed
        }
-       if (game_stopped)
-               TRANSMUTE(Observer, this);
 
-       SetSpectatee(this, NULL);
+       TRANSMUTE(Player, this);
 
-       // reset player keys
-       this.itemkeys = 0;
+       CS(this).wasplayer = true;
+       this.iscreature = true;
+       this.teleportable = TELEPORT_NORMAL;
+       if(!this.damagedbycontents)
+               IL_PUSH(g_damagedbycontents, this);
+       this.damagedbycontents = true;
+       set_movetype(this, MOVETYPE_WALK);
+       this.solid = SOLID_SLIDEBOX;
+       this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
+       if (autocvar_g_playerclip_collisions)
+               this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+       if (IS_BOT_CLIENT(this) && autocvar_g_botclip_collisions)
+               this.dphitcontentsmask |= DPCONTENTS_BOTCLIP;
+       this.frags = FRAGS_PLAYER;
+       if (INDEPENDENT_PLAYERS) MAKE_INDEPENDENT_PLAYER(this);
+       this.flags = FL_CLIENT | FL_PICKUPITEMS;
+       if (autocvar__notarget)
+               this.flags |= FL_NOTARGET;
+       this.takedamage = DAMAGE_AIM;
+       this.effects = EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
+       this.dmg = 2; // WTF
+
+       if (warmup_stage) {
+               this.ammo_shells = warmup_start_ammo_shells;
+               this.ammo_nails = warmup_start_ammo_nails;
+               this.ammo_rockets = warmup_start_ammo_rockets;
+               this.ammo_cells = warmup_start_ammo_cells;
+               this.ammo_plasma = warmup_start_ammo_plasma;
+               this.ammo_fuel = warmup_start_ammo_fuel;
+               this.health = warmup_start_health;
+               this.armorvalue = warmup_start_armorvalue;
+               this.weapons = WARMUP_START_WEAPONS;
+       } else {
+               this.ammo_shells = start_ammo_shells;
+               this.ammo_nails = start_ammo_nails;
+               this.ammo_rockets = start_ammo_rockets;
+               this.ammo_cells = start_ammo_cells;
+               this.ammo_plasma = start_ammo_plasma;
+               this.ammo_fuel = start_ammo_fuel;
+               this.health = start_health;
+               this.armorvalue = start_armorvalue;
+               this.weapons = start_weapons;
+       }
+       SetSpectatee_status(this, 0);
+
+       PS(this).dual_weapons = '0 0 0';
+
+       this.superweapons_finished = (this.weapons & WEPSET_SUPERWEAPONS) ? time + autocvar_g_balance_superweapons_time : 0;
+
+       this.items = start_items;
+
+       this.spawnshieldtime = time + autocvar_g_spawnshieldtime;
+       this.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot_spawn;
+       this.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot_spawn;
+       this.pauserotfuel_finished = time + autocvar_g_balance_pause_fuel_rot_spawn;
+       this.pauseregen_finished = time + autocvar_g_balance_pause_health_regen_spawn;
+       // extend the pause of rotting if client was reset at the beginning of the countdown
+       if (!autocvar_sv_ready_restart_after_countdown && time < game_starttime) { // TODO why is this cvar NOTted?
+               float f = game_starttime - time;
+               this.spawnshieldtime += f;
+               this.pauserotarmor_finished += f;
+               this.pauserothealth_finished += f;
+               this.pauseregen_finished += f;
+       }
+       this.damageforcescale = 2;
+       this.death_time = 0;
+       this.respawn_flags = 0;
+       this.respawn_time = 0;
+       this.stat_respawn_time = 0;
+       this.scale = autocvar_sv_player_scale;
+       this.fade_time = 0;
+       this.pain_frame = 0;
+       this.pain_finished = 0;
+       this.pushltime = 0;
+       setthink(this, func_null); // players have no think function
+       this.nextthink = 0;
+       this.dmg_team = 0;
+       PS(this).ballistics_density = autocvar_g_ballistics_density_player;
 
-       MUTATOR_CALLHOOK(PutClientInServer, this);
+       this.deadflag = DEAD_NO;
 
-       if (IS_OBSERVER(this)) {
-               PutObserverInServer(this);
-       } else if (IS_PLAYER(this)) {
-               if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
+       this.angles = spot.angles;
+       this.angles_z = 0; // never spawn tilted even if the spot says to
+       if (IS_BOT_CLIENT(this))
+               this.v_angle = this.angles;
+       this.fixangle = true; // turn this way immediately
+       this.oldvelocity = this.velocity = '0 0 0';
+       this.avelocity = '0 0 0';
+       this.punchangle = '0 0 0';
+       this.punchvector = '0 0 0';
 
-               PlayerState_attach(this);
-               accuracy_resend(this);
+       this.strength_finished = 0;
+       this.invincible_finished = 0;
+       this.fire_endtime = -1;
+       this.revive_progress = 0;
+       this.revival_time = 0;
+       this.air_finished = time + 12;
 
-               if (this.team < 0)
-                       JoinBestTeam(this, false, true);
+       entity spawnevent = new_pure(spawnevent);
+       spawnevent.owner = this;
+       Net_LinkEntity(spawnevent, false, 0.5, SpawnEvent_Send);
 
-               entity spot = SelectSpawnPoint(this, false);
-               if (!spot) {
-                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_NOSPAWNS);
-                       return; // spawn failed
-               }
+       // Cut off any still running player sounds.
+       stopsound(this, CH_PLAYER_SINGLE);
 
-               TRANSMUTE(Player, this);
+       this.model = "";
+       FixPlayermodel(this);
+       this.drawonlytoclient = NULL;
 
-               this.wasplayer = true;
-               this.iscreature = true;
-               this.teleportable = TELEPORT_NORMAL;
-               if(!this.damagedbycontents)
-                       IL_PUSH(g_damagedbycontents, this);
-               this.damagedbycontents = true;
-               set_movetype(this, MOVETYPE_WALK);
-               this.solid = SOLID_SLIDEBOX;
-               this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
-               if (autocvar_g_playerclip_collisions)
-                       this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
-               if (IS_BOT_CLIENT(this) && autocvar_g_botclip_collisions)
-                       this.dphitcontentsmask |= DPCONTENTS_BOTCLIP;
-               this.frags = FRAGS_PLAYER;
-               if (INDEPENDENT_PLAYERS) MAKE_INDEPENDENT_PLAYER(this);
-               this.flags = FL_CLIENT | FL_PICKUPITEMS;
-               if (autocvar__notarget)
-                       this.flags |= FL_NOTARGET;
-               this.takedamage = DAMAGE_AIM;
-               this.effects = EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
-               this.dmg = 2; // WTF
-
-               if (warmup_stage) {
-                       this.ammo_shells = warmup_start_ammo_shells;
-                       this.ammo_nails = warmup_start_ammo_nails;
-                       this.ammo_rockets = warmup_start_ammo_rockets;
-                       this.ammo_cells = warmup_start_ammo_cells;
-                       this.ammo_plasma = warmup_start_ammo_plasma;
-                       this.ammo_fuel = warmup_start_ammo_fuel;
-                       this.health = warmup_start_health;
-                       this.armorvalue = warmup_start_armorvalue;
-                       this.weapons = WARMUP_START_WEAPONS;
-               } else {
-                       this.ammo_shells = start_ammo_shells;
-                       this.ammo_nails = start_ammo_nails;
-                       this.ammo_rockets = start_ammo_rockets;
-                       this.ammo_cells = start_ammo_cells;
-                       this.ammo_plasma = start_ammo_plasma;
-                       this.ammo_fuel = start_ammo_fuel;
-                       this.health = start_health;
-                       this.armorvalue = start_armorvalue;
-                       this.weapons = start_weapons;
-               }
-               SetSpectatee_status(this, 0);
-
-               this.dual_weapons = '0 0 0';
-
-               this.superweapons_finished = (this.weapons & WEPSET_SUPERWEAPONS) ? time + autocvar_g_balance_superweapons_time : 0;
-
-               this.items = start_items;
-
-               this.spawnshieldtime = time + autocvar_g_spawnshieldtime;
-               this.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot_spawn;
-               this.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot_spawn;
-               this.pauserotfuel_finished = time + autocvar_g_balance_pause_fuel_rot_spawn;
-               this.pauseregen_finished = time + autocvar_g_balance_pause_health_regen_spawn;
-               // extend the pause of rotting if client was reset at the beginning of the countdown
-               if (!autocvar_sv_ready_restart_after_countdown && time < game_starttime) { // TODO why is this cvar NOTted?
-                       float f = game_starttime - time;
-                       this.spawnshieldtime += f;
-                       this.pauserotarmor_finished += f;
-                       this.pauserothealth_finished += f;
-                       this.pauseregen_finished += f;
-               }
-               this.damageforcescale = 2;
-               this.death_time = 0;
-               this.respawn_flags = 0;
-               this.respawn_time = 0;
-               this.stat_respawn_time = 0;
-               this.scale = autocvar_sv_player_scale;
-               this.fade_time = 0;
-               this.pain_frame = 0;
-               this.pain_finished = 0;
-               this.pushltime = 0;
-               setthink(this, func_null); // players have no think function
-               this.nextthink = 0;
-               this.dmg_team = 0;
-               this.ballistics_density = autocvar_g_ballistics_density_player;
-
-               this.deadflag = DEAD_NO;
-
-               this.angles = spot.angles;
-               this.angles_z = 0; // never spawn tilted even if the spot says to
-               if (IS_BOT_CLIENT(this))
-                       this.v_angle = this.angles;
-               this.fixangle = true; // turn this way immediately
-               this.oldvelocity = this.velocity = '0 0 0';
-               this.avelocity = '0 0 0';
-               this.punchangle = '0 0 0';
-               this.punchvector = '0 0 0';
-
-               this.strength_finished = 0;
-               this.invincible_finished = 0;
-               this.fire_endtime = -1;
-               this.revive_progress = 0;
-               this.revival_time = 0;
-               this.air_finished = time + 12;
-
-               entity spawnevent = new_pure(spawnevent);
-               spawnevent.owner = this;
-               Net_LinkEntity(spawnevent, false, 0.5, SpawnEvent_Send);
-
-               // Cut off any still running player sounds.
-               stopsound(this, CH_PLAYER_SINGLE);
-
-               this.model = "";
-               FixPlayermodel(this);
-               this.drawonlytoclient = NULL;
-
-               this.viewloc = NULL;
-
-               this.crouch = false;
-               this.view_ofs = STAT(PL_VIEW_OFS, this);
-               setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
-               this.spawnorigin = spot.origin;
-               setorigin(this, spot.origin + '0 0 1' * (1 - this.mins.z - 24));
-               // don't reset back to last position, even if new position is stuck in solid
-               this.oldorigin = this.origin;
-               this.prevorigin = this.origin;
-               this.lastteleporttime = time; // prevent insane speeds due to changing origin
-               if(this.conveyor)
-                       IL_REMOVE(g_conveyed, this);
-               this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
-               this.hud = HUD_NORMAL;
-
-               this.event_damage = PlayerDamage;
-
-               if(!this.bot_attack)
-                       IL_PUSH(g_bot_targets, this);
-               this.bot_attack = true;
-               if(!this.monster_attack)
-                       IL_PUSH(g_monster_targets, this);
-               this.monster_attack = true;
-               navigation_dynamicgoal_init(this, false);
-
-               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
-
-               if (this.killcount == FRAGS_SPECTATOR) {
-                       PlayerScore_Clear(this);
-                       this.killcount = 0;
-               }
+       this.viewloc = NULL;
 
-               for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-               {
-                       .entity weaponentity = weaponentities[slot];
-                       entity oldwep = this.(weaponentity);
-                       CL_SpawnWeaponentity(this, weaponentity);
-                       if(oldwep && oldwep.owner == this)
-                               this.(weaponentity).m_gunalign = oldwep.m_gunalign;
-               }
-               this.alpha = default_player_alpha;
-               this.colormod = '1 1 1' * autocvar_g_player_brightness;
-               this.exteriorweaponentity.alpha = default_weapon_alpha;
+       this.crouch = false;
+       this.view_ofs = STAT(PL_VIEW_OFS, this);
+       setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+       this.spawnorigin = spot.origin;
+       setorigin(this, spot.origin + '0 0 1' * (1 - this.mins.z - 24));
+       // don't reset back to last position, even if new position is stuck in solid
+       this.oldorigin = this.origin;
+       this.lastteleporttime = time; // prevent insane speeds due to changing origin
+       if(this.conveyor)
+               IL_REMOVE(g_conveyed, this);
+       this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
+       this.hud = HUD_NORMAL;
+
+       this.event_damage = PlayerDamage;
+
+       if(!this.bot_attack)
+               IL_PUSH(g_bot_targets, this);
+       this.bot_attack = true;
+       if(!this.monster_attack)
+               IL_PUSH(g_monster_targets, this);
+       this.monster_attack = true;
+       navigation_dynamicgoal_init(this, false);
+
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+
+       if (CS(this).killcount == FRAGS_SPECTATOR) {
+               PlayerScore_Clear(this);
+               CS(this).killcount = 0;
+       }
 
-               this.speedrunning = false;
+       for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               entity oldwep = this.(weaponentity);
+               CL_SpawnWeaponentity(this, weaponentity);
+               if(oldwep && oldwep.owner == this)
+                       this.(weaponentity).m_gunalign = oldwep.m_gunalign;
+       }
+       this.alpha = default_player_alpha;
+       this.colormod = '1 1 1' * autocvar_g_player_brightness;
+       this.exteriorweaponentity.alpha = default_weapon_alpha;
 
-               target_voicescript_clear(this);
+       this.speedrunning = false;
 
-               // reset fields the weapons may use
-               FOREACH(Weapons, true, LAMBDA(
-                       it.wr_resetplayer(it, this);
+       target_voicescript_clear(this);
+
+       // reset fields the weapons may use
+       FOREACH(Weapons, true, {
+               it.wr_resetplayer(it, this);
                        // reload all reloadable weapons
-                       if (it.spawnflags & WEP_FLAG_RELOADABLE) {
-                               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-                               {
-                                       .entity weaponentity = weaponentities[slot];
-                                       this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo;
-                               }
+               if (it.spawnflags & WEP_FLAG_RELOADABLE) {
+                       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+                       {
+                               .entity weaponentity = weaponentities[slot];
+                               this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo;
                        }
-               ));
-
-               {
-                       string s = spot.target;
-                       spot.target = string_null;
-                       SUB_UseTargets(spot, this, NULL);
-                       spot.target = s;
                }
+       });
 
-               Unfreeze(this);
+       {
+               string s = spot.target;
+               spot.target = string_null;
+               SUB_UseTargets(spot, this, NULL);
+               spot.target = s;
+       }
 
-               MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
+       Unfreeze(this);
 
-               if (autocvar_spawn_debug)
-               {
-                       sprint(this, strcat("spawnpoint origin:  ", vtos(spot.origin), "\n"));
-                       delete(spot); // usefull for checking if there are spawnpoints, that let drop through the floor
-               }
+       MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
 
-               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-               {
-                       .entity weaponentity = weaponentities[slot];
-                       if(slot == 0 || autocvar_g_weaponswitch_debug == 1)
-                               this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity);
-                       else
-                               this.(weaponentity).m_switchweapon = WEP_Null;
-                       this.(weaponentity).m_weapon = WEP_Null;
-                       this.(weaponentity).weaponname = "";
-                       this.(weaponentity).m_switchingweapon = WEP_Null;
-                       this.(weaponentity).cnt = -1;
-               }
+       if (autocvar_spawn_debug)
+       {
+               sprint(this, strcat("spawnpoint origin:  ", vtos(spot.origin), "\n"));
+               delete(spot); // usefull for checking if there are spawnpoints, that let drop through the floor
+       }
+
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               if(slot == 0 || autocvar_g_weaponswitch_debug == 1)
+                       this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity);
+               else
+                       this.(weaponentity).m_switchweapon = WEP_Null;
+               this.(weaponentity).m_weapon = WEP_Null;
+               this.(weaponentity).weaponname = "";
+               this.(weaponentity).m_switchingweapon = WEP_Null;
+               this.(weaponentity).cnt = -1;
+       }
 
-               MUTATOR_CALLHOOK(PlayerWeaponSelect, this);
+       MUTATOR_CALLHOOK(PlayerWeaponSelect, this);
 
-               if (!warmup_stage && !this.alivetime)
-                       this.alivetime = time;
+       if (!warmup_stage && !this.alivetime)
+               this.alivetime = time;
 
-               antilag_clear(this, CS(this));
+       antilag_clear(this, CS(this));
+}
+
+/** Called when a client spawns in the server */
+void PutClientInServer(entity this)
+{
+       if (IS_BOT_CLIENT(this)) {
+               TRANSMUTE(Player, this);
+       } else if (IS_REAL_CLIENT(this)) {
+               msg_entity = this;
+               WriteByte(MSG_ONE, SVC_SETVIEW);
+               WriteEntity(MSG_ONE, this);
+       }
+       if (game_stopped)
+               TRANSMUTE(Observer, this);
+
+       SetSpectatee(this, NULL);
+
+       // reset player keys
+       if(PS(this))
+               PS(this).itemkeys = 0;
+
+       MUTATOR_CALLHOOK(PutClientInServer, this);
+
+       if (IS_OBSERVER(this)) {
+               PutObserverInServer(this);
+       } else if (IS_PLAYER(this)) {
+               PutPlayerInServer(this);
        }
 }
 
@@ -773,6 +773,7 @@ void ClientInit_misc(entity this)
        else
                WriteString(channel, "");
        WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
+       WriteByte(channel, this.cnt * 255.0); // g_balance_damagepush_speedfactor
        WriteByte(channel, serverflags);
        WriteCoord(channel, autocvar_g_trueaim_minrange);
 }
@@ -785,6 +786,11 @@ void ClientInit_CheckUpdate(entity this)
                this.count = autocvar_g_balance_armor_blockpercent;
                this.SendFlags |= 1;
        }
+       if(this.cnt != autocvar_g_balance_damagepush_speedfactor)
+       {
+               this.cnt = autocvar_g_balance_damagepush_speedfactor;
+               this.SendFlags |= 1;
+       }
 }
 
 void ClientInit_Spawn()
@@ -817,7 +823,7 @@ SetChangeParms
 void SetChangeParms (entity this)
 {
        // save parms for level change
-       parm1 = this.parm_idlesince - time;
+       parm1 = CS(this).parm_idlesince - time;
 
        MUTATOR_CALLHOOK(SetChangeParms);
 }
@@ -830,12 +836,12 @@ DecodeLevelParms
 void DecodeLevelParms(entity this)
 {
        // load parms
-       this.parm_idlesince = parm1;
-       if (this.parm_idlesince == -(86400 * 366))
-               this.parm_idlesince = time;
+       CS(this).parm_idlesince = parm1;
+       if (CS(this).parm_idlesince == -(86400 * 366))
+               CS(this).parm_idlesince = time;
 
        // whatever happens, allow 60 seconds of idling directly after connect for map loading
-       this.parm_idlesince = max(this.parm_idlesince, time - sv_maxidle + 60);
+       CS(this).parm_idlesince = max(CS(this).parm_idlesince, time - sv_maxidle + 60);
 
        MUTATOR_CALLHOOK(DecodeLevelParms);
 }
@@ -851,19 +857,19 @@ Called when a client types 'kill' in the console
 .float clientkill_nexttime;
 void ClientKill_Now_TeamChange(entity this)
 {
-       if(this.killindicator_teamchange == -1)
+       if(CS(this).killindicator_teamchange == -1)
        {
                JoinBestTeam( this, false, true );
        }
-       else if(this.killindicator_teamchange == -2)
+       else if(CS(this).killindicator_teamchange == -2)
        {
                if(blockSpectators)
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
                PutObserverInServer(this);
        }
        else
-               SV_ChangeTeam(this, this.killindicator_teamchange - 1);
-       this.killindicator_teamchange = 0;
+               SV_ChangeTeam(this, CS(this).killindicator_teamchange - 1);
+       CS(this).killindicator_teamchange = 0;
 }
 
 void ClientKill_Now(entity this)
@@ -871,7 +877,7 @@ void ClientKill_Now(entity this)
        if(this.vehicle)
        {
            vehicles_exit(this.vehicle, VHEF_RELEASE);
-           if(!this.killindicator_teamchange)
+           if(!CS(this).killindicator_teamchange)
            {
             this.vehicle_health = -1;
             Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
@@ -883,7 +889,7 @@ void ClientKill_Now(entity this)
 
        this.killindicator = NULL;
 
-       if(this.killindicator_teamchange)
+       if(CS(this).killindicator_teamchange)
                ClientKill_Now_TeamChange(this);
 
        if(!IS_SPEC(this) && !IS_OBSERVER(this))
@@ -946,7 +952,7 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change,
        return;
     killtime = M_ARGV(1, float);
 
-       this.killindicator_teamchange = targetteam;
+       CS(this).killindicator_teamchange = targetteam;
 
     if(!this.killindicator)
        {
@@ -1049,25 +1055,41 @@ void FixClientCvars(entity e)
        MUTATOR_CALLHOOK(FixClientCvars, e);
 }
 
-float PlayerInIDList(entity p, string idlist)
+bool findinlist_abbrev(string tofind, string list)
 {
-       float n, i;
-       string s;
+       if(list == "" || tofind == "")
+               return false; // empty list or search, just return
 
+       // this function allows abbreviated strings!
+       FOREACH_WORD(list, it == substring(tofind, 0, strlen(it)),
+       {
+               return true;
+       });
+
+       return false;
+}
+
+bool PlayerInIPList(entity p, string iplist)
+{
+       // some safety checks (never allow local?)
+       if(p.netaddress == "local" || p.netaddress == "" || !IS_REAL_CLIENT(p))
+               return false;
+
+       return findinlist_abbrev(p.netaddress, iplist);
+}
+
+bool PlayerInIDList(entity p, string idlist)
+{
        // NOTE: we do NOT check crypto_idfp_signed here, an unsigned ID is fine too for this
-       if (!p.crypto_idfp)
-               return 0;
+       if(!p.crypto_idfp)
+               return false;
 
-       // this function allows abbreviated player IDs too!
-       n = tokenize_console(idlist);
-       for(i = 0; i < n; ++i)
-       {
-               s = argv(i);
-               if(s == substring(p.crypto_idfp, 0, strlen(s)))
-                       return 1;
-       }
+       return findinlist_abbrev(p.crypto_idfp, idlist);
+}
 
-       return 0;
+bool PlayerInList(entity player, string list)
+{
+       return boolean(PlayerInIDList(player, list) || PlayerInIPList(player, list));
 }
 
 #ifdef DP_EXT_PRECONNECT
@@ -1108,8 +1130,8 @@ void ClientConnect(entity this)
 #ifdef WATERMARK
        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_WATERMARK, WATERMARK);
 #endif
-       this.version_nagtime = time + 10 + random() * 10;
        TRANSMUTE(Client, this);
+       CS(this).version_nagtime = time + 10 + random() * 10;
 
        // identify the right forced team
        if (autocvar_g_campaign)
@@ -1126,10 +1148,10 @@ void ClientConnect(entity this)
                        }
                }
        }
-       else if (PlayerInIDList(this, autocvar_g_forced_team_red))    this.team_forced = NUM_TEAM_1;
-       else if (PlayerInIDList(this, autocvar_g_forced_team_blue))   this.team_forced = NUM_TEAM_2;
-       else if (PlayerInIDList(this, autocvar_g_forced_team_yellow)) this.team_forced = NUM_TEAM_3;
-       else if (PlayerInIDList(this, autocvar_g_forced_team_pink))   this.team_forced = NUM_TEAM_4;
+       else if (PlayerInList(this, autocvar_g_forced_team_red))    this.team_forced = NUM_TEAM_1;
+       else if (PlayerInList(this, autocvar_g_forced_team_blue))   this.team_forced = NUM_TEAM_2;
+       else if (PlayerInList(this, autocvar_g_forced_team_yellow)) this.team_forced = NUM_TEAM_3;
+       else if (PlayerInList(this, autocvar_g_forced_team_pink))   this.team_forced = NUM_TEAM_4;
        else switch (autocvar_g_forced_team_otherwise)
        {
                default: this.team_forced = 0; break;
@@ -1165,16 +1187,19 @@ void ClientConnect(entity this)
        PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
 
        // always track bots, don't ask for cl_allow_uidtracking
-    if (IS_BOT_CLIENT(this)) PlayerStats_GameReport_AddPlayer(this);
+       if (IS_BOT_CLIENT(this))
+               PlayerStats_GameReport_AddPlayer(this);
+       else
+               CS(this).allowed_timeouts = autocvar_sv_timeout_number;
 
        if (autocvar_sv_eventlog)
                GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false)));
 
        LogTeamchange(this.playerid, this.team, 1);
 
-       this.just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
+       CS(this).just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
 
-       this.netname_previous = strzone(this.netname);
+       CS(this).netname_previous = strzone(this.netname);
 
        if(teamplay && IS_PLAYER(this))
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_CONNECT_TEAM), this.netname);
@@ -1207,14 +1232,13 @@ void ClientConnect(entity this)
 
        bot_relinkplayerlist();
 
-       this.spectatortime = time;
+       CS(this).spectatortime = time;
        if (blockSpectators)
        {
                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
        }
 
-       this.jointime = time;
-       this.allowed_timeouts = autocvar_sv_timeout_number;
+       CS(this).jointime = time;
 
        if (IS_REAL_CLIENT(this))
        {
@@ -1231,15 +1255,13 @@ void ClientConnect(entity this)
 
        CSQCMODEL_AUTOINIT(this);
 
-       this.model_randomizer = random();
+       CS(this).model_randomizer = random();
 
        if (IS_REAL_CLIENT(this))
                sv_notice_join(this);
 
        // update physics stats (players can spawn before physics runs)
-       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
-       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed!
-       Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
+       Physics_UpdateStats(this);
 
        IL_EACH(g_initforplayer, it.init_for_player, {
                it.init_for_player(it, this);
@@ -1251,7 +1273,7 @@ void ClientConnect(entity this)
        {
                if (!autocvar_g_campaign && !IS_PLAYER(this))
                {
-                       this.motd_actived_time = -1;
+                       CS(this).motd_actived_time = -1;
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
                }
        }
@@ -1271,7 +1293,7 @@ void ClientDisconnect(entity this)
 
        PlayerStats_GameReport_FinalizePlayer(this);
        if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
-       if (this.active_minigame) part_minigame(this);
+       if (CS(this).active_minigame) part_minigame(this);
        if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
 
        if (autocvar_sv_eventlog)
@@ -1284,6 +1306,7 @@ void ClientDisconnect(entity this)
 
     MUTATOR_CALLHOOK(ClientDisconnect, this);
 
+       if (CS(this).netname_previous) strunzone(CS(this).netname_previous); // needs to be before the CS entity is removed!
        ClientState_detach(this);
 
        Portal_ClearAll(this);
@@ -1303,7 +1326,6 @@ void ClientDisconnect(entity this)
 
        bot_relinkplayerlist();
 
-       if (this.netname_previous) strunzone(this.netname_previous);
        if (this.clientstatus) strunzone(this.clientstatus);
        if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse);
        if (this.personal) delete(this.personal);
@@ -1330,7 +1352,7 @@ void ChatBubbleThink(entity this)
 
        if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
        {
-               if ( this.owner.active_minigame )
+               if ( CS(this.owner).active_minigame )
                        this.mdl = "models/sprites/minigame_busy.iqm";
                else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
                        this.mdl = "models/misc/chatbubble.spr";
@@ -1600,7 +1622,6 @@ void player_regen(entity this)
        regen_health_stable = M_ARGV(9, float);
        regen_health_rotstable = M_ARGV(10, float);
 
-
        if(!mutator_returnvalue)
        if(!STAT(FROZEN, this))
        {
@@ -1639,14 +1660,26 @@ void player_regen(entity this)
 
                this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
        }
+       // Ugly hack to make sure the health and armor don't go beyond hard limit.
+       // TODO: Remove this hack when all code uses GivePlayerHealth and
+       // GivePlayerArmor.
+       if (this.health > RESOURCE_AMOUNT_HARD_LIMIT)
+       {
+               this.health = RESOURCE_AMOUNT_HARD_LIMIT;
+       }
+       if (this.armorvalue > RESOURCE_AMOUNT_HARD_LIMIT)
+       {
+               this.armorvalue = RESOURCE_AMOUNT_HARD_LIMIT;
+       }
+       // End hack.
 }
 
 bool zoomstate_set;
 void SetZoomState(entity this, float newzoom)
 {
-       if(newzoom != this.zoomstate)
+       if(newzoom != CS(this).zoomstate)
        {
-               this.zoomstate = newzoom;
+               CS(this).zoomstate = newzoom;
                ClientData_Touch(this);
        }
        zoomstate_set = true;
@@ -1656,16 +1689,16 @@ void GetPressedKeys(entity this)
 {
        MUTATOR_CALLHOOK(GetPressedKeys, this);
        int keys = STAT(PRESSED_KEYS, this);
-       keys = BITSET(keys, KEY_FORWARD,        this.movement.x > 0);
-       keys = BITSET(keys, KEY_BACKWARD,       this.movement.x < 0);
-       keys = BITSET(keys, KEY_RIGHT,          this.movement.y > 0);
-       keys = BITSET(keys, KEY_LEFT,           this.movement.y < 0);
+       keys = BITSET(keys, KEY_FORWARD,        CS(this).movement.x > 0);
+       keys = BITSET(keys, KEY_BACKWARD,       CS(this).movement.x < 0);
+       keys = BITSET(keys, KEY_RIGHT,          CS(this).movement.y > 0);
+       keys = BITSET(keys, KEY_LEFT,           CS(this).movement.y < 0);
 
        keys = BITSET(keys, KEY_JUMP,           PHYS_INPUT_BUTTON_JUMP(this));
        keys = BITSET(keys, KEY_CROUCH,         PHYS_INPUT_BUTTON_CROUCH(this));
        keys = BITSET(keys, KEY_ATCK,           PHYS_INPUT_BUTTON_ATCK(this));
        keys = BITSET(keys, KEY_ATCK2,          PHYS_INPUT_BUTTON_ATCK2(this));
-       this.pressedkeys = keys; // store for other users
+       CS(this).pressedkeys = keys; // store for other users
 
        STAT(PRESSED_KEYS, this) = keys;
 }
@@ -1694,7 +1727,7 @@ void SpectateCopy(entity this, entity spectatee)
        this.clip_size = spectatee.clip_size;
        this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance
        this.health = spectatee.health;
-       this.impulse = 0;
+       CS(this).impulse = 0;
        this.items = spectatee.items;
        this.last_pickup = spectatee.last_pickup;
        this.hit_time = spectatee.hit_time;
@@ -1703,7 +1736,6 @@ void SpectateCopy(entity this, entity spectatee)
        this.superweapons_finished = spectatee.superweapons_finished;
        STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
        this.weapons = spectatee.weapons;
-       this.dual_weapons = spectatee.dual_weapons;
        this.vortex_charge = spectatee.vortex_charge;
        this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
        this.hagar_load = spectatee.hagar_load;
@@ -1724,7 +1756,7 @@ void SpectateCopy(entity this, entity spectatee)
                this.fixangle = true;
        setorigin(this, spectatee.origin);
        setsize(this, spectatee.mins, spectatee.maxs);
-       SetZoomState(this, spectatee.zoomstate);
+       SetZoomState(this, CS(spectatee).zoomstate);
 
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
@@ -1804,10 +1836,10 @@ bool SpectateSet(entity this)
 
 void SetSpectatee_status(entity this, int spectatee_num)
 {
-       int oldspectatee_status = this.spectatee_status;
-       this.spectatee_status = spectatee_num;
+       int oldspectatee_status = CS(this).spectatee_status;
+       CS(this).spectatee_status = spectatee_num;
 
-       if (this.spectatee_status != oldspectatee_status)
+       if (CS(this).spectatee_status != oldspectatee_status)
        {
                ClientData_Touch(this);
                if (g_race || g_cts) race_InitSpectator();
@@ -1939,7 +1971,7 @@ void ShowRespawnCountdown(entity this)
 .bool team_selected;
 bool ShowTeamSelection(entity this)
 {
-       if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
+       if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (CS(this).wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
                return false;
        stuffcmd(this, "menu_showteamselect\n");
        return true;
@@ -1991,13 +2023,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)
@@ -2025,7 +2057,7 @@ void checkSpectatorBlock(entity this)
        if(!this.caplayer)
        if(IS_REAL_CLIENT(this))
        {
-               if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
+               if( time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
                        dropclient(this);
                }
@@ -2034,46 +2066,46 @@ void checkSpectatorBlock(entity this)
 
 void PrintWelcomeMessage(entity this)
 {
-       if(this.motd_actived_time == 0)
+       if(CS(this).motd_actived_time == 0)
        {
                if (autocvar_g_campaign) {
                        if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
-                               this.motd_actived_time = time;
+                               CS(this).motd_actived_time = time;
                                Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
                        }
                } else {
                        if (PHYS_INPUT_BUTTON_INFO(this)) {
-                               this.motd_actived_time = time;
+                               CS(this).motd_actived_time = time;
                                Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
                        }
                }
        }
-       else if(this.motd_actived_time > 0) // showing MOTD or campaign message
+       else if(CS(this).motd_actived_time > 0) // showing MOTD or campaign message
        {
                if (autocvar_g_campaign) {
                        if (PHYS_INPUT_BUTTON_INFO(this))
-                               this.motd_actived_time = time;
-                       else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
-                               this.motd_actived_time = 0;
+                               CS(this).motd_actived_time = time;
+                       else if ((time - CS(this).motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
+                               CS(this).motd_actived_time = 0;
                                Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                        }
                } else {
                        if (PHYS_INPUT_BUTTON_INFO(this))
-                               this.motd_actived_time = time;
-                       else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
-                               this.motd_actived_time = 0;
+                               CS(this).motd_actived_time = time;
+                       else if (time - CS(this).motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+                               CS(this).motd_actived_time = 0;
                                Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                        }
                }
        }
-       else //if(this.motd_actived_time < 0) // just connected, motd is active
+       else //if(CS(this).motd_actived_time < 0) // just connected, motd is active
        {
                if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
-                       this.motd_actived_time = -2; // wait until BUTTON_INFO gets released
-               else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
+                       CS(this).motd_actived_time = -2; // wait until BUTTON_INFO gets released
+               else if(CS(this).motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
                {
                        // instanctly hide MOTD
-                       this.motd_actived_time = 0;
+                       CS(this).motd_actived_time = 0;
                        Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                }
        }
@@ -2081,7 +2113,7 @@ void PrintWelcomeMessage(entity this)
 
 bool joinAllowed(entity this)
 {
-       if (this.version_mismatch) return false;
+       if (CS(this).version_mismatch) return false;
        if (!nJoinAllowed(this, this)) return false;
        if (teamplay && lockteams) return false;
        if (ShowTeamSelection(this)) return false;
@@ -2089,25 +2121,208 @@ bool joinAllowed(entity this)
        return true;
 }
 
+.int items_added;
+bool PlayerThink(entity this)
+{
+       if (game_stopped || intermission_running) {
+               this.modelflags &= ~MF_ROCKET;
+               if(intermission_running)
+                       IntermissionThink(this);
+               return false;
+       }
+
+       if (timeout_status == TIMEOUT_ACTIVE) {
+        // don't allow the player to turn around while game is paused
+               // FIXME turn this into CSQC stuff
+               this.v_angle = this.lastV_angle;
+               this.angles = this.lastV_angle;
+               this.fixangle = true;
+       }
+
+       if (frametime) player_powerups(this);
+
+       if (IS_DEAD(this)) {
+               if (this.personal && g_race_qualifying) {
+                       if (time > this.respawn_time) {
+                               STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
+                               respawn(this);
+                               CS(this).impulse = CHIMPULSE_SPEEDRUN.impulse;
+                       }
+               } else {
+                       if (frametime) player_anim(this);
+
+                       if (this.respawn_flags & RESPAWN_DENY)
+                       {
+                               STAT(RESPAWN_TIME, this) = 0;
+                               return false;
+                       }
+
+                       bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
+
+                       switch(this.deadflag)
+                       {
+                               case DEAD_DYING:
+                               {
+                                       if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max))
+                                               this.deadflag = DEAD_RESPAWNING;
+                                       else if (!button_pressed || (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)))
+                                               this.deadflag = DEAD_DEAD;
+                                       break;
+                               }
+                               case DEAD_DEAD:
+                               {
+                                       if (button_pressed)
+                                               this.deadflag = DEAD_RESPAWNABLE;
+                                       else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE))
+                                               this.deadflag = DEAD_RESPAWNING;
+                                       break;
+                               }
+                               case DEAD_RESPAWNABLE:
+                               {
+                                       if (!button_pressed || (this.respawn_flags & RESPAWN_FORCE))
+                                               this.deadflag = DEAD_RESPAWNING;
+                                       break;
+                               }
+                               case DEAD_RESPAWNING:
+                               {
+                                       if (time > this.respawn_time)
+                                       {
+                                               this.respawn_time = time + 1; // only retry once a second
+                                               this.respawn_time_max = this.respawn_time;
+                                               respawn(this);
+                                       }
+                                       break;
+                               }
+                       }
+
+                       ShowRespawnCountdown(this);
+
+                       if (this.respawn_flags & RESPAWN_SILENT)
+                               STAT(RESPAWN_TIME, this) = 0;
+                       else if ((this.respawn_flags & RESPAWN_FORCE) && this.respawn_time < this.respawn_time_max)
+                       {
+                               if (time < this.respawn_time)
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time;
+                               else if (this.deadflag != DEAD_RESPAWNING)
+                                       STAT(RESPAWN_TIME, this) = -this.respawn_time_max;
+                       }
+                       else
+                               STAT(RESPAWN_TIME, this) = this.respawn_time;
+               }
+
+               // if respawning, invert stat_respawn_time to indicate this, the client translates it
+               if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
+                       STAT(RESPAWN_TIME, this) *= -1;
+
+               return false;
+       }
+
+       bool have_hook = false;
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               if(this.(weaponentity).hook.state)
+               {
+                       have_hook = true;
+                       break;
+               }
+       }
+       bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+       if (have_hook) {
+               do_crouch = false;
+       } else if (this.waterlevel >= WATERLEVEL_SWIMMING) {
+               do_crouch = false;
+       } else if (this.vehicle) {
+               do_crouch = false;
+       } else if (STAT(FROZEN, this)) {
+               do_crouch = false;
+    }
+
+       if (do_crouch) {
+               if (!this.crouch) {
+                       this.crouch = true;
+                       this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+                       setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
+                       // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
+               }
+       } else if (this.crouch) {
+        tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+        if (!trace_startsolid) {
+            this.crouch = false;
+            this.view_ofs = STAT(PL_VIEW_OFS, this);
+            setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+        }
+       }
+
+       FixPlayermodel(this);
+
+       // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
+       //if(frametime)
+       {
+               this.items &= ~this.items_added;
+
+               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       W_WeaponFrame(this, weaponentity);
+
+                       if(slot == 0)
+                       {
+                               this.clip_load = this.(weaponentity).clip_load;
+                               this.clip_size = this.(weaponentity).clip_size;
+                       }
+               }
+
+               this.items_added = 0;
+               if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || this.ammo_fuel >= 0.01))
+            this.items_added |= IT_FUEL;
+
+               this.items |= this.items_added;
+       }
+
+       player_regen(this);
+
+       // WEAPONTODO: Add a weapon request for this
+       // rot vortex charge to the charge limit
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time)
+                       this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+       }
+
+       if (frametime) player_anim(this);
+
+       // secret status
+       secrets_setstatus(this);
+
+       // monsters status
+       monsters_setstatus(this);
+
+       this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+
+       return true;
+}
+
 void ObserverThink(entity this)
 {
-       if ( this.impulse )
+       if ( CS(this).impulse )
        {
-               MinigameImpulse(this, this.impulse);
-               this.impulse = 0;
+               MinigameImpulse(this, CS(this).impulse);
+               CS(this).impulse = 0;
        }
 
        if (this.flags & FL_JUMPRELEASED) {
                if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
-               } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
+               } else if(PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch) {
                        this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext(this)) {
                                TRANSMUTE(Spectator, this);
                        }
                } else {
-                       int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+                       int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? CS(this).cvar_cl_clippedspectating : !CS(this).cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
                        set_movetype(this, preferred_movetype);
                }
        } else {
@@ -2125,15 +2340,15 @@ void ObserverThink(entity this)
 
 void SpectatorThink(entity this)
 {
-       if ( this.impulse )
+       if ( CS(this).impulse )
        {
-               if(MinigameImpulse(this, this.impulse))
-                       this.impulse = 0;
+               if(MinigameImpulse(this, CS(this).impulse))
+                       CS(this).impulse = 0;
 
-               if (this.impulse == IMP_weapon_drop.impulse)
+               if (CS(this).impulse == IMP_weapon_drop.impulse)
                {
                        STAT(CAMERA_SPECTATOR, this) = (STAT(CAMERA_SPECTATOR, this) + 1) % 3;
-                       this.impulse = 0;
+                       CS(this).impulse = 0;
                        return;
                }
        }
@@ -2142,7 +2357,7 @@ void SpectatorThink(entity this)
                if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
-               } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+               } else if(PHYS_INPUT_BUTTON_ATCK(this) || CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18 || (CS(this).impulse >= 200 && CS(this).impulse <= 209)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext(this)) {
                                TRANSMUTE(Spectator, this);
@@ -2150,8 +2365,8 @@ void SpectatorThink(entity this)
                                TRANSMUTE(Observer, this);
                                PutClientInServer(this);
                        }
-                       this.impulse = 0;
-               } else if(this.impulse == 12 || this.impulse == 16  || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+                       CS(this).impulse = 0;
+               } else if(CS(this).impulse == 12 || CS(this).impulse == 16  || CS(this).impulse == 19 || (CS(this).impulse >= 220 && CS(this).impulse <= 229)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        if(SpectatePrev(this)) {
                                TRANSMUTE(Spectator, this);
@@ -2159,7 +2374,7 @@ void SpectatorThink(entity this)
                                TRANSMUTE(Observer, this);
                                PutClientInServer(this);
                        }
-                       this.impulse = 0;
+                       CS(this).impulse = 0;
                } else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        TRANSMUTE(Observer, this);
@@ -2242,19 +2457,13 @@ PlayerPreThink
 Called every frame for each client before the physics are run
 =============
 */
-.float usekeypressed;
 .float last_vehiclecheck;
-.int items_added;
 void PlayerPreThink (entity this)
 {
-       WarpZone_PlayerPhysics_FixVAngle(this);
+       STAT(GUNALIGN, this) = CS(this).cvar_cl_gunalign; // TODO
+       STAT(MOVEVARS_CL_TRACK_CANJUMP, this) = CS(this).cvar_cl_movement_track_canjump;
 
-    STAT(GAMESTARTTIME, this) = game_starttime;
-       STAT(ROUNDSTARTTIME, this) = round_starttime;
-       STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
-       STAT(LEADLIMIT, this) = autocvar_leadlimit;
-
-       STAT(WEAPONSINMAP, this) = weaponsInMap;
+       WarpZone_PlayerPhysics_FixVAngle(this);
 
        if (frametime) {
                // physics frames: update anticheat stuff
@@ -2274,28 +2483,28 @@ void PlayerPreThink (entity this)
                this.netname = strzone(sprintf("Player#%d", this.playerid));
                // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
        }
-       if (this.netname != this.netname_previous) {
+       if (this.netname != CS(this).netname_previous) {
                if (autocvar_sv_eventlog) {
                        GameLogEcho(strcat(":name:", ftos(this.playerid), ":", playername(this, false)));
         }
-               if (this.netname_previous) strunzone(this.netname_previous);
-               this.netname_previous = strzone(this.netname);
+               if (CS(this).netname_previous) strunzone(CS(this).netname_previous);
+               CS(this).netname_previous = strzone(this.netname);
        }
 
        // version nagging
-       if (this.version_nagtime && this.cvar_g_xonoticversion && time > this.version_nagtime) {
-        this.version_nagtime = 0;
-        if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+       if (CS(this).version_nagtime && CS(this).cvar_g_xonoticversion && time > CS(this).version_nagtime) {
+        CS(this).version_nagtime = 0;
+        if (strstrofs(CS(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS(this).cvar_g_xonoticversion, "autobuild", 0) >= 0) {
             // git client
         } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
             // git server
-            Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+            Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
         } else {
-            int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+            int r = vercmp(CS(this).cvar_g_xonoticversion, autocvar_g_xonoticversion);
             if (r < 0) { // old client
-                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
             } else if (r > 0) { // old server
-                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
             }
         }
     }
@@ -2307,29 +2516,32 @@ void PlayerPreThink (entity this)
                this.max_armorvalue = 0;
        }
 
-       if (STAT(FROZEN, this) == 2)
-       {
-               this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
-               this.health = max(1, this.revive_progress * start_health);
-               this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
-
-               if (this.revive_progress >= 1)
-                       Unfreeze(this);
-       }
-       else if (STAT(FROZEN, this) == 3)
+       if(IS_PLAYER(this))
        {
-               this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
-               this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
+               if (STAT(FROZEN, this) == 2)
+               {
+                       this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+                       this.health = max(1, this.revive_progress * start_health);
+                       this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
 
-               if (this.health < 1)
+                       if (this.revive_progress >= 1)
+                               Unfreeze(this);
+               }
+               else if (STAT(FROZEN, this) == 3)
                {
-                       if (this.vehicle)
-                               vehicles_exit(this.vehicle, VHEF_RELEASE);
-                       if(this.event_damage)
-                               this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
+                       this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+                       this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
+
+                       if (this.health < 1)
+                       {
+                               if (this.vehicle)
+                                       vehicles_exit(this.vehicle, VHEF_RELEASE);
+                               if(this.event_damage)
+                                       this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
+                       }
+                       else if (this.revive_progress <= 0)
+                               Unfreeze(this);
                }
-               else if (this.revive_progress <= 0)
-                       Unfreeze(this);
        }
 
        MUTATOR_CALLHOOK(PlayerPreThink, this);
@@ -2356,197 +2568,19 @@ void PlayerPreThink (entity this)
                this.last_vehiclecheck = time + 1;
        }
 
-       if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+       if(!CS(this).cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
        {
-               if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed)
+               if(PHYS_INPUT_BUTTON_USE(this) && !CS(this).usekeypressed)
                        PlayerUseKey(this);
-               this.usekeypressed = PHYS_INPUT_BUTTON_USE(this);
+               CS(this).usekeypressed = PHYS_INPUT_BUTTON_USE(this);
        }
 
        if (IS_REAL_CLIENT(this))
                PrintWelcomeMessage(this);
 
        if (IS_PLAYER(this)) {
-               CheckRules_Player(this);
-
-               if (game_stopped || intermission_running) {
-                       this.modelflags &= ~MF_ROCKET;
-                       if(intermission_running)
-                               IntermissionThink(this);
+               if(!PlayerThink(this))
                        return;
-               }
-
-               if (timeout_status == TIMEOUT_ACTIVE) {
-            // don't allow the player to turn around while game is paused
-                       // FIXME turn this into CSQC stuff
-                       this.v_angle = this.lastV_angle;
-                       this.angles = this.lastV_angle;
-                       this.fixangle = true;
-               }
-
-               if (frametime) player_powerups(this);
-
-               if (IS_DEAD(this)) {
-                       if (this.personal && g_race_qualifying) {
-                               if (time > this.respawn_time) {
-                                       STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
-                                       respawn(this);
-                                       this.impulse = CHIMPULSE_SPEEDRUN.impulse;
-                               }
-                       } else {
-                               if (frametime) player_anim(this);
-
-                               if (this.respawn_flags & RESPAWN_DENY)
-                               {
-                                       STAT(RESPAWN_TIME, this) = 0;
-                                       return;
-                               }
-
-                               bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
-
-                               switch(this.deadflag)
-                               {
-                                       case DEAD_DYING:
-                                       {
-                                               if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max))
-                                                       this.deadflag = DEAD_RESPAWNING;
-                                               else if (!button_pressed || (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)))
-                                                       this.deadflag = DEAD_DEAD;
-                                               break;
-                                       }
-                                       case DEAD_DEAD:
-                                       {
-                                               if (button_pressed)
-                                                       this.deadflag = DEAD_RESPAWNABLE;
-                                               else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE))
-                                                       this.deadflag = DEAD_RESPAWNING;
-                                               break;
-                                       }
-                                       case DEAD_RESPAWNABLE:
-                                       {
-                                               if (!button_pressed || (this.respawn_flags & RESPAWN_FORCE))
-                                                       this.deadflag = DEAD_RESPAWNING;
-                                               break;
-                                       }
-                                       case DEAD_RESPAWNING:
-                                       {
-                                               if (time > this.respawn_time)
-                                               {
-                                                       this.respawn_time = time + 1; // only retry once a second
-                                                       this.respawn_time_max = this.respawn_time;
-                                                       respawn(this);
-                                               }
-                                               break;
-                                       }
-                               }
-
-                               ShowRespawnCountdown(this);
-
-                               if (this.respawn_flags & RESPAWN_SILENT)
-                                       STAT(RESPAWN_TIME, this) = 0;
-                               else if ((this.respawn_flags & RESPAWN_FORCE) && this.respawn_time < this.respawn_time_max)
-                               {
-                                       if (time < this.respawn_time)
-                                               STAT(RESPAWN_TIME, this) = this.respawn_time;
-                                       else if (this.deadflag != DEAD_RESPAWNING)
-                                               STAT(RESPAWN_TIME, this) = -this.respawn_time_max;
-                               }
-                               else
-                                       STAT(RESPAWN_TIME, this) = this.respawn_time;
-                       }
-
-                       // if respawning, invert stat_respawn_time to indicate this, the client translates it
-                       if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
-                               STAT(RESPAWN_TIME, this) *= -1;
-
-                       return;
-               }
-
-               this.prevorigin = this.origin;
-
-               bool have_hook = false;
-               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-               {
-                       .entity weaponentity = weaponentities[slot];
-                       if(this.(weaponentity).hook.state)
-                       {
-                               have_hook = true;
-                               break;
-                       }
-               }
-               bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
-               if (have_hook) {
-                       do_crouch = false;
-               } else if (this.waterlevel >= WATERLEVEL_SWIMMING) {
-                       do_crouch = false;
-               } else if (this.vehicle) {
-                       do_crouch = false;
-               } else if (STAT(FROZEN, this)) {
-                       do_crouch = false;
-        }
-
-               if (do_crouch) {
-                       if (!this.crouch) {
-                               this.crouch = true;
-                               this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
-                               setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
-                               // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
-                       }
-               } else if (this.crouch) {
-            tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
-            if (!trace_startsolid) {
-                this.crouch = false;
-                this.view_ofs = STAT(PL_VIEW_OFS, this);
-                setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
-            }
-               }
-
-               FixPlayermodel(this);
-
-               // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
-               //if(frametime)
-               {
-                       this.items &= ~this.items_added;
-
-                       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-                       {
-                               .entity weaponentity = weaponentities[slot];
-                               W_WeaponFrame(this, weaponentity);
-
-                               if(slot == 0)
-                               {
-                                       this.clip_load = this.(weaponentity).clip_load;
-                                       this.clip_size = this.(weaponentity).clip_size;
-                               }
-                       }
-
-                       this.items_added = 0;
-                       if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))
-                this.items_added |= IT_FUEL;
-
-                       this.items |= this.items_added;
-               }
-
-               player_regen(this);
-
-               // WEAPONTODO: Add a weapon request for this
-               // rot vortex charge to the charge limit
-               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-               {
-                       .entity weaponentity = weaponentities[slot];
-                       if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time)
-                               this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
-               }
-
-               if (frametime) player_anim(this);
-
-               // secret status
-               secrets_setstatus(this);
-
-               // monsters status
-               monsters_setstatus(this);
-
-               this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
        }
        else if (game_stopped || intermission_running) {
                if(intermission_running)
@@ -2573,19 +2607,19 @@ void PlayerPreThink (entity this)
                SetZoomState(this, PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this) || wep_zoomed);
     }
 
-       if (this.teamkill_soundtime && time > this.teamkill_soundtime)
+       if (CS(this).teamkill_soundtime && time > CS(this).teamkill_soundtime)
        {
-               this.teamkill_soundtime = 0;
+               CS(this).teamkill_soundtime = 0;
 
-               entity e = this.teamkill_soundsource;
+               entity e = CS(this).teamkill_soundsource;
                entity oldpusher = e.pusher;
                e.pusher = this;
                PlayerSound(e, playersound_teamshoot, CH_VOICE, VOL_BASEVOICE, VOICETYPE_LASTATTACKER_ONLY);
                e.pusher = oldpusher;
        }
 
-       if (this.taunt_soundtime && time > this.taunt_soundtime) {
-               this.taunt_soundtime = 0;
+       if (CS(this).taunt_soundtime && time > CS(this).taunt_soundtime) {
+               CS(this).taunt_soundtime = 0;
                PlayerSound(this, playersound_taunt, CH_VOICE, VOL_BASEVOICE, VOICETYPE_AUTOTAUNT);
        }
 
@@ -2632,12 +2666,12 @@ void Player_Physics(entity this)
        if(!this.move_qcphysics)
                return;
 
-       if(!frametime && !this.pm_frametime)
+       if(!frametime && !CS(this).pm_frametime)
                return;
 
-       Movetype_Physics_NoMatchTicrate(this, this.pm_frametime, true);
+       Movetype_Physics_NoMatchTicrate(this, CS(this).pm_frametime, true);
 
-       this.pm_frametime = 0;
+       CS(this).pm_frametime = 0;
 }
 
 /*
@@ -2647,7 +2681,6 @@ PlayerPostThink
 Called every frame for each client after the physics are run
 =============
 */
-.float idlekick_lasttimeleft;
 void PlayerPostThink (entity this)
 {
        Player_Physics(this);
@@ -2668,19 +2701,19 @@ void PlayerPostThink (entity this)
 
                if (sv_maxidle_slots > 0 && (maxclients - totalClients) > sv_maxidle_slots)
                { /* do nothing */ }
-               else if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
+               else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
-                       if (this.idlekick_lasttimeleft)
+                       if (CS(this).idlekick_lasttimeleft)
                        {
-                               this.idlekick_lasttimeleft = 0;
+                               CS(this).idlekick_lasttimeleft = 0;
                                Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
                        }
                }
                else
                {
-                       float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+                       float timeleft = ceil(sv_maxidle - (time - CS(this).parm_idlesince));
                        if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
-                               if (!this.idlekick_lasttimeleft)
+                               if (!CS(this).idlekick_lasttimeleft)
                                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
                        }
                        if (timeleft <= 0) {
@@ -2689,17 +2722,16 @@ void PlayerPostThink (entity this)
                                return;
                        }
                        else if (timeleft <= 10) {
-                               if (timeleft != this.idlekick_lasttimeleft) {
+                               if (timeleft != CS(this).idlekick_lasttimeleft) {
                                    Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
                 }
-                               this.idlekick_lasttimeleft = timeleft;
+                               CS(this).idlekick_lasttimeleft = timeleft;
                        }
                }
        }
 
        CheatFrame(this);
 
-       //CheckPlayerJump();
        if (game_stopped)
        {
                this.solid = SOLID_NOT;
@@ -2709,9 +2741,8 @@ void PlayerPostThink (entity this)
 
        if (IS_PLAYER(this)) {
                DrownPlayer(this);
-               CheckRules_Player(this);
                UpdateChatBubble(this);
-               if (this.impulse) ImpulseCommands(this);
+               if (CS(this).impulse) ImpulseCommands(this);
                if (game_stopped)
                {
                        CSQCMODEL_AUTOUPDATE(this);
@@ -2729,3 +2760,43 @@ void PlayerPostThink (entity this)
 
        CSQCMODEL_AUTOUPDATE(this);
 }
+
+// hack to copy the button fields from the client entity to the Client State
+void PM_UpdateButtons(entity this, entity store)
+{
+       if(this.impulse)
+               store.impulse = this.impulse;
+       this.impulse = 0;
+
+       store.button0 = this.button0;
+       store.button2 = this.button2;
+       store.button3 = this.button3;
+       store.button4 = this.button4;
+       store.button5 = this.button5;
+       store.button6 = this.button6;
+       store.button7 = this.button7;
+       store.button8 = this.button8;
+       store.button9 = this.button9;
+       store.button10 = this.button10;
+       store.button11 = this.button11;
+       store.button12 = this.button12;
+       store.button13 = this.button13;
+       store.button14 = this.button14;
+       store.button15 = this.button15;
+       store.button16 = this.button16;
+       store.buttonuse = this.buttonuse;
+       store.buttonchat = this.buttonchat;
+
+       store.cursor_active = this.cursor_active;
+       store.cursor_screen = this.cursor_screen;
+       store.cursor_trace_start = this.cursor_trace_start;
+       store.cursor_trace_endpos = this.cursor_trace_endpos;
+       store.cursor_trace_ent = this.cursor_trace_ent;
+
+       store.ping = this.ping;
+       store.ping_packetloss = this.ping_packetloss;
+       store.ping_movementloss = this.ping_movementloss;
+
+       store.v_angle = this.v_angle;
+       store.movement = this.movement;
+}
index 37e5eeb94d59bf8f8b7d05b184cb9de84298af15..9674872c0faa42bd6bc0c1a466204a0c166d9b08 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include "utils.qh"
+#include <common/sounds/all.qh>
+
 void ClientState_attach(entity this);
 
 IntrusiveList g_players;
@@ -29,10 +32,118 @@ CLASS(Client, Object)
     /** the string "HMAC-SHA256" if signing, and string_null if plaintext */
     ATTRIB(Client, crypto_signmethod, string, this.crypto_signmethod);
 
+    // engine client fields
+    ATTRIB(Client, impulse, int, this.impulse);
+
+    ATTRIB(Client, button0, int, this.button0);
+    ATTRIB(Client, button2, int, this.button2);
+    ATTRIB(Client, button3, int, this.button3);
+    ATTRIB(Client, button4, int, this.button4);
+    ATTRIB(Client, button5, int, this.button5);
+    ATTRIB(Client, button6, int, this.button6);
+    ATTRIB(Client, button7, int, this.button7);
+    ATTRIB(Client, button8, int, this.button8);
+    ATTRIB(Client, button9, int, this.button9);
+    ATTRIB(Client, button10, int, this.button10);
+    ATTRIB(Client, button11, int, this.button11);
+    ATTRIB(Client, button12, int, this.button12);
+    ATTRIB(Client, button13, int, this.button13);
+    ATTRIB(Client, button14, int, this.button14);
+    ATTRIB(Client, button15, int, this.button15);
+    ATTRIB(Client, button16, int, this.button16);
+    ATTRIB(Client, buttonuse, int, this.buttonuse);
+    ATTRIB(Client, buttonchat, int, this.buttonchat);
+
+    ATTRIB(Client, cursor_active, int, this.cursor_active);
+    ATTRIB(Client, cursor_screen, vector, this.cursor_screen);
+    ATTRIB(Client, cursor_trace_start, vector, this.cursor_trace_start);
+    ATTRIB(Client, cursor_trace_endpos, vector, this.cursor_trace_endpos);
+    ATTRIB(Client, cursor_trace_ent, entity, this.cursor_trace_ent);
+
+    ATTRIB(Client, ping, float, this.ping);
+    ATTRIB(Client, ping_packetloss, float, this.ping_packetloss);
+    ATTRIB(Client, ping_movementloss, float, this.ping_movementloss);
+
+    ATTRIB(Client, v_angle, vector, this.v_angle);
+    ATTRIB(Client, movement, vector, this.movement);
+
     // custom
 
     ATTRIB(Client, playerid, int, this.playerid);
 
+    ATTRIB(Client, parm_idlesince, int, this.parm_idlesince);
+    ATTRIB(Client, muted, bool, this.muted);
+    ATTRIB(Client, killindicator_teamchange, int, this.killindicator_teamchange);
+    ATTRIB(Client, idlekick_lasttimeleft, float, this.idlekick_lasttimeleft);
+    ATTRIB(Client, pm_frametime, float, this.pm_frametime);
+    ATTRIB(Client, pressedkeys, int, this.pressedkeys);
+    ATTRIB(Client, movement_old, vector, this.movement_old);
+    ATTRIB(Client, buttons_old, int, this.buttons_old);
+    ATTRIB(Client, teamkill_complain, float, this.teamkill_complain);
+    ATTRIB(Client, teamkill_soundtime, float, this.teamkill_soundtime);
+    ATTRIB(Client, teamkill_soundsource, entity, this.teamkill_soundsource);
+    ATTRIB(Client, usekeypressed, bool, this.usekeypressed);
+    ATTRIB(Client, motd_actived_time, float, this.motd_actived_time);
+    ATTRIB(Client, jointime, float, this.jointime);
+    ATTRIB(Client, spectatortime, float, this.spectatortime);
+    ATTRIB(Client, version_nagtime, float, this.version_nagtime);
+    ATTRIB(Client, netname_previous, string, this.netname_previous);
+    ATTRIB(Client, allowed_timeouts, int, this.allowed_timeouts);
+    ATTRIB(Client, active_minigame, entity, this.active_minigame);
+    ATTRIB(Client, taunt_soundtime, float, this.taunt_soundtime);
+    ATTRIB(Client, killcount, int, this.killcount);
+    ATTRIB(Client, version_mismatch, bool, this.version_mismatch);
+    ATTRIB(Client, version, int, this.version);
+    ATTRIB(Client, spectatee_status, int, this.spectatee_status);
+    ATTRIB(Client, zoomstate, bool, this.zoomstate);
+    ATTRIB(Client, just_joined, bool, this.just_joined);
+    ATTRIB(Client, race_completed, bool, this.race_completed);
+    ATTRIBARRAY(Client, msg_choice_choices, int, 50); // TODO: actually NOTIF_CHOICE_MAX
+    ATTRIB(Client, latency_sum, float, this.latency_sum);
+    ATTRIB(Client, latency_cnt, int, this.latency_cnt);
+    ATTRIB(Client, latency_time, float, this.latency_time);
+    ATTRIB(Client, v_angle_old, vector, this.v_angle_old);
+    ATTRIB(Client, model_randomizer, float, this.model_randomizer);
+    ATTRIB(Client, accuracy, entity, this.accuracy);
+    ATTRIB(Client, hasweapon_complain_spam, float, this.hasweapon_complain_spam);
+    ATTRIB(Client, scorekeeper, entity, this.scorekeeper);
+    ATTRIB(Client, specialcommand_pos, int, this.specialcommand_pos);
+    ATTRIB(Client, hitplotfh, int, this.hitplotfh);
+    ATTRIB(Client, clientdata, entity, this.clientdata);
+    ATTRIB(Client, cmd_floodcount, int, this.cmd_floodcount);
+    ATTRIB(Client, cmd_floodtime, float, this.cmd_floodtime);
+    ATTRIB(Client, wasplayer, bool, this.wasplayer);
+
+    // networked cvars
+
+    ATTRIB(Client, cvar_cl_allow_uid2name, int, this.cvar_cl_allow_uid2name);
+    ATTRIB(Client, cvar_cl_allow_uidtracking, int, this.cvar_cl_allow_uidtracking);
+    ATTRIB(Client, cvar_cl_autotaunt, float, this.cvar_cl_autotaunt);
+    ATTRIB(Client, cvar_cl_voice_directional, int, this.cvar_cl_voice_directional);
+    ATTRIB(Client, cvar_cl_voice_directional_taunt_attenuation, float, this.cvar_cl_voice_directional_taunt_attenuation);
+    ATTRIB(Client, cvar_cl_physics, string, this.cvar_cl_physics);
+    ATTRIB(Client, cvar_cl_buffs_autoreplace, bool, this.cvar_cl_buffs_autoreplace);
+    ATTRIB(Client, cvar_cl_nade_type, int, this.cvar_cl_nade_type);
+    ATTRIB(Client, cvar_cl_pokenade_type, string, this.cvar_cl_pokenade_type);
+    ATTRIB(Client, cvar_cl_spawn_near_teammate, bool, this.cvar_cl_spawn_near_teammate);
+    ATTRIB(Client, cvar_cl_gunalign, int, this.cvar_cl_gunalign);
+    ATTRIB(Client, cvar_cl_handicap, float, this.cvar_cl_handicap);
+    ATTRIB(Client, cvar_cl_clippedspectating, bool, this.cvar_cl_clippedspectating);
+    ATTRIB(Client, cvar_cl_autoscreenshot, int, this.cvar_cl_autoscreenshot);
+    ATTRIB(Client, cvar_cl_jetpack_jump, bool, this.cvar_cl_jetpack_jump);
+    ATTRIB(Client, cvar_cl_newusekeysupported, bool, this.cvar_cl_newusekeysupported);
+    ATTRIB(Client, cvar_cl_noantilag, bool, this.cvar_cl_noantilag);
+    ATTRIB(Client, cvar_cl_movement_track_canjump, bool, this.cvar_cl_movement_track_canjump);
+    ATTRIB(Client, cvar_cl_weaponimpulsemode, int, this.cvar_cl_weaponimpulsemode);
+    ATTRIB(Client, cvar_g_xonoticversion, string, this.cvar_g_xonoticversion);
+    ATTRIB(Client, autoswitch, bool, this.autoswitch);
+    ATTRIB(Client, cvar_cl_dodging_timeout, float, this.cvar_cl_dodging_timeout);
+    ATTRIB(Client, cvar_cl_multijump, bool, this.cvar_cl_multijump);
+    ATTRIB(Client, cvar_cl_accuracy_data_share, bool, this.cvar_cl_accuracy_data_share);
+    ATTRIB(Client, cvar_cl_accuracy_data_receive, bool, this.cvar_cl_accuracy_data_receive);
+    ATTRIBARRAY(Client, cvar_cl_weaponpriorities, string, 10);
+    ATTRIB(Client, cvar_cl_weaponpriority, string, this.cvar_cl_weaponpriority);
+
     METHOD(Client, m_unwind, bool(Client this));
 
     STATIC_METHOD(Client, Add, void(Client this, int _team));
@@ -72,6 +183,16 @@ CLASS(Spectator, Client)
 ENDCLASS(Spectator)
 
 CLASS(Player, Client)
+
+    // custom
+
+    ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
+    ATTRIB(Player, itemkeys, int, this.itemkeys);
+    ATTRIB(Player, ballistics_density, float, this.ballistics_density);
+    ATTRIB(Player, prevstrengthsound, float, this.prevstrengthsound);
+    ATTRIB(Player, prevstrengthsoundattempt, float, this.prevstrengthsoundattempt);
+    ATTRIB(Player, buff_shield, float, this.buff_shield);
+
     INIT(Player) {
         this.classname = STR_PLAYER;
         IL_PUSH(g_players, this);
index 8a35bec2925c2f89658dfe7145308e56dabb0c2a..da495f7962f89210697c4dead7802da99df03d78 100644 (file)
@@ -1,4 +1,8 @@
 #include "banning.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/state.qh>
 #include <common/command/_mod.qh>
 #include "banning.qh"
 
@@ -37,14 +41,14 @@ void BanCommand_ban(float request, float argc, string command)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2ban^7\n");
+                       LOG_INFO("Incorrect parameters for ^2ban^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd ban address [bantime] [reason]\n");
-                       LOG_INFO("  'address' is the IP address or range of the player to ban,\n");
-                       LOG_INFO("  'bantime' is the amount of time that the ban is active (default if not provided),\n");
-                       LOG_INFO("  and 'reason' is the string to label the ban with as reason for banning.\n");
-                       LOG_INFO("See also: ^2banlist, kickban, unban^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd ban address [bantime] [reason]");
+                       LOG_INFO("  'address' is the IP address or range of the player to ban,");
+                       LOG_INFO("  'bantime' is the amount of time that the ban is active (default if not provided),");
+                       LOG_INFO("  and 'reason' is the string to label the ban with as reason for banning.");
+                       LOG_INFO("See also: ^2banlist, kickban, unban^7");
                        return;
                }
        }
@@ -63,9 +67,9 @@ void BanCommand_banlist(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd banlist\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2ban, kickban, unban^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd banlist");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2ban, kickban, unban^7");
                        return;
                }
        }
@@ -98,21 +102,21 @@ void BanCommand_kickban(float request, float argc, string command)
                                }
                                else
                                {
-                                       LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), ".\n");
+                                       LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), ".");
                                }
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2kickban^7\n");
+                       LOG_INFO("Incorrect parameters for ^2kickban^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd kickban client [bantime] [masksize] [reason]\n");
-                       LOG_INFO("  'client' is the entity number or name of the player to ban,\n");
-                       LOG_INFO("  'bantime' is the amount of time that the ban is active (default if not provided),\n");
-                       LOG_INFO("  'masksize' is the range of the IP address (1-thru-4, default if not provided),\n");
-                       LOG_INFO("  and 'reason' is the string to label the ban with as reason for banning.\n");
-                       LOG_INFO("See also: ^2ban, banlist, unban^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd kickban client [bantime] [masksize] [reason]");
+                       LOG_INFO("  'client' is the entity number or name of the player to ban,");
+                       LOG_INFO("  'bantime' is the amount of time that the ban is active (default if not provided),");
+                       LOG_INFO("  'masksize' is the range of the IP address (1-thru-4, default if not provided),");
+                       LOG_INFO("  and 'reason' is the string to label the ban with as reason for banning.");
+                       LOG_INFO("See also: ^2ban, banlist, unban^7");
                        return;
                }
        }
@@ -131,23 +135,23 @@ void BanCommand_mute(float request, float argc, string command)  // TODO: Add a
 
                                if (accepted > 0)
                                {
-                                       client.muted = true;
+                                       CS(client).muted = true;
                                        return;
                                }
                                else
                                {
-                                       LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), ".\n");
+                                       LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), ".");
                                }
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2mute^7\n");
+                       LOG_INFO("Incorrect parameters for ^2mute^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd mute client\n");
-                       LOG_INFO("  'client' is the entity number or name of the player to mute.\n");
-                       LOG_INFO("See also: ^2unmute^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd mute client");
+                       LOG_INFO("  'client' is the entity number or name of the player to mute.");
+                       LOG_INFO("See also: ^2unmute^7");
                        return;
                }
        }
@@ -191,9 +195,9 @@ void BanCommand_unban(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd unban banid\n");
-                       LOG_INFO("  Where 'banid' is the ID of the ban of which to remove.\n");
-                       LOG_INFO("See also: ^2ban, banlist, kickban^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd unban banid");
+                       LOG_INFO("  Where 'banid' is the ID of the ban of which to remove.");
+                       LOG_INFO("See also: ^2ban, banlist, kickban^7");
                        return;
                }
        }
@@ -212,23 +216,23 @@ void BanCommand_unmute(float request, float argc)
 
                                if (accepted > 0)
                                {
-                                       client.muted = false;
+                                       CS(client).muted = false;
                                        return;
                                }
                                else
                                {
-                                       LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), ".\n");
+                                       LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), ".");
                                }
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2mute^7\n");
+                       LOG_INFO("Incorrect parameters for ^2mute^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd unmute client\n");
-                       LOG_INFO("  'client' is the entity number or name of the player to unmute.\n");
-                       LOG_INFO("See also: ^2mute^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd unmute client");
+                       LOG_INFO("  'client' is the entity number or name of the player to unmute.");
+                       LOG_INFO("See also: ^2mute^7");
                        return;
                }
        }
@@ -275,7 +279,7 @@ void BanCommand_(float request)
 void BanCommand_macro_help()
 {
        #define BAN_COMMAND(name, function, description) \
-               { if (strtolower(description) != "") { LOG_INFO("  ^2", name, "^7: ", description, "\n"); } }
+               { if (strtolower(description) != "") { LOG_INFO("  ^2", name, "^7: ", description); } }
 
        BAN_COMMANDS(0, 0, "");
 #undef BAN_COMMAND
index da9fd8621f171b34aed6ab9ca144b3e0a563fa37..a2c037c5d2d198573a8c5eb63eb7e388560df8bf 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"
@@ -45,17 +49,19 @@ void ClientKill_TeamChange(entity this, float targetteam);  // 0 = don't change,
 
 bool SV_ParseClientCommand_floodcheck(entity this)
 {
+       entity store = IS_CLIENT(this) ? CS(this) : this; // unfortunately, we need to store these on the client initially
+
        if (!timeout_status)  // not while paused
        {
-               if (time <= (this.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
+               if (time <= (store.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
                {
-                       this.cmd_floodcount += 1;
-                       if (this.cmd_floodcount > autocvar_sv_clientcommand_antispam_count)   return false;  // too much spam, halt
+                       store.cmd_floodcount += 1;
+                       if (store.cmd_floodcount > autocvar_sv_clientcommand_antispam_count)   return false;  // too much spam, halt
                }
                else
                {
-                       this.cmd_floodtime = time;
-                       this.cmd_floodcount = 1;
+                       store.cmd_floodtime = time;
+                       store.cmd_floodcount = 1;
                }
        }
        return true;  // continue, as we're not flooding yet
@@ -74,8 +80,8 @@ void ClientCommand_autoswitch(entity caller, float request, float argc)
                {
                        if (argv(1) != "")
                        {
-                               caller.autoswitch = InterpretBoolean(argv(1));
-                               sprint(caller, strcat("^1autoswitch is currently turned ", (caller.autoswitch ? "on" : "off"), ".\n"));
+                               CS(caller).autoswitch = InterpretBoolean(argv(1));
+                               sprint(caller, strcat("^1autoswitch is currently turned ", (CS(caller).autoswitch ? "on" : "off"), ".\n"));
                                return;
                        }
                }
@@ -101,11 +107,11 @@ void ClientCommand_clientversion(entity caller, float request, float argc)  // i
                        {
                                if (IS_CLIENT(caller))
                                {
-                                       caller.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
+                                       CS(caller).version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
 
-                                       if (caller.version < autocvar_gameversion_min || caller.version > autocvar_gameversion_max)
+                                       if (CS(caller).version < autocvar_gameversion_min || CS(caller).version > autocvar_gameversion_max)
                                        {
-                                               caller.version_mismatch = 1;
+                                               CS(caller).version_mismatch = true;
                                                ClientKill_TeamChange(caller, -2);  // observe
                                        }
                                        else if (autocvar_g_campaign || autocvar_g_balance_teams)
@@ -214,7 +220,7 @@ void ClientCommand_physics(entity caller, float request, float argc)
                }
 
                default:
-                       sprint(caller, strcat("Current physics set: ^3", caller.cvar_cl_physics, "\n"));
+                       sprint(caller, strcat("Current physics set: ^3", CS(caller).cvar_cl_physics, "\n"));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd physics <physics>\n");
@@ -354,7 +360,7 @@ void ClientCommand_selectteam(entity caller, float request, float argc)
                                                                        {
                                                                                sprint(caller, "^7You already are on that team.\n");
                                                                        }
-                                                                       else if (caller.wasplayer && autocvar_g_changeteam_banned)
+                                                                       else if (CS(caller).wasplayer && autocvar_g_changeteam_banned)
                                                                        {
                                                                                sprint(caller, "^1You cannot change team, forbidden by the server.\n");
                                                                        }
@@ -448,7 +454,7 @@ void ClientCommand_sentcvar(entity caller, float request, float argc, string com
                                        tokenize_console(s);
                                }
 
-                               GetCvars(caller, 1);
+                               GetCvars(caller, CS(caller), 1);
 
                                return;
                        }
index 9f3a200dac51a17e0e8af00956644b5d5fdd42fd..46d1d2b6f86fd1c888b3b730593179552625f2d3 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;
@@ -175,7 +179,7 @@ float GetFilteredNumber(string input)
 void print_to(entity to, string input)
 {
        if (to) sprint(to, strcat(input, "\n"));
-       else LOG_INFO(input, "\n");
+       else print(input, "\n");
 }
 
 // ==========================================
@@ -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
                        }
@@ -433,7 +437,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                case "butcher":
                                {
                                        if (caller) { print_to(caller, "This command is not available to players"); return; }
-                                       if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string), "\n"); return; }
+                                       if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFOF("%s", M_ARGV(0, string)); return; }
 
                                        int tmp_remcount = 0;
 
@@ -721,7 +725,7 @@ void CommonCommand_timeout(float request, entity caller)  // DEAR GOD THIS COMMA
                                {
                                        print_to(caller, "^7Error: You can not call a timeout while the map is being restarted.");
                                }
-                               else if (caller && (caller.allowed_timeouts < 1))
+                               else if (caller && (CS(caller).allowed_timeouts < 1))
                                {
                                        print_to(caller, "^7Error: You already used all your timeout calls for this map.");
                                }
@@ -736,9 +740,9 @@ void CommonCommand_timeout(float request, entity caller)  // DEAR GOD THIS COMMA
 
                                else  // everything should be okay, proceed with starting the timeout
                                {
-                                       if (caller)   caller.allowed_timeouts -= 1;
+                                       if (caller)   CS(caller).allowed_timeouts -= 1;
                                        // write a bprint who started the timeout (and how many they have left)
-                                       bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(caller.allowed_timeouts), " timeout(s) left)") : ""), "!\n");
+                                       bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(CS(caller).allowed_timeouts), " timeout(s) left)") : ""), "!\n");
 
                                        timeout_status = TIMEOUT_LEADTIME;
                                        timeout_caller = caller;
@@ -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)
@@ -806,14 +810,14 @@ void CommonCommand_who(float request, entity caller, float argc)
                                print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
                                        etof(it),
                                        it.netname,
-                                       it.ping,
-                                       it.ping_packetloss,
-                                       process_time(1, time - it.jointime),
+                                       CS(it).ping,
+                                       CS(it).ping_packetloss,
+                                       process_time(1, time - CS(it).jointime),
                                        tmp_netaddress,
                                        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..6c31af72c853d54cdef08fd5d723940efe6baecf 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"
@@ -231,7 +230,7 @@ void RadarMap_Think(entity this)
                this.maxs_x = (mi_picmax.x - mi_picmin.x) / this.size.x;
                this.maxs_y = (mi_picmax.y - mi_picmin.y) / this.size.y;
                this.maxs_z = mi_max.z - mi_min.z;
-               LOG_INFO("Picture mins/maxs: ", ftos(this.maxs.x), " and ", ftos(this.maxs.y), " should match\n");
+               LOG_INFO("Picture mins/maxs: ", ftos(this.maxs.x), " and ", ftos(this.maxs.y), " should match");
                this.netname = strzone(strcat("gfx/", mi_shortname, "_radar.xpm"));
                if (!(this.count & 1))
                {
@@ -246,7 +245,7 @@ void RadarMap_Think(entity this)
                        {
                                fclose(this.cnt);
 
-                               LOG_INFO(this.netname, " already exists, aborting (you may want to specify --force)\n");
+                               LOG_INFO(this.netname, " already exists, aborting (you may want to specify --force)");
                                RadarMap_Next();
                                return;
                        }
@@ -254,12 +253,12 @@ void RadarMap_Think(entity this)
                this.cnt = fopen(this.netname, FILE_WRITE);
                if (this.cnt < 0)
                {
-                       LOG_INFO("Error writing ", this.netname, "\n");
+                       LOG_INFO("Error writing ", this.netname);
                        delete(this);
                        radarmapper = NULL;
                        return;
                }
-               LOG_INFO("Writing to ", this.netname, "...\n");
+               LOG_INFO("Writing to ", this.netname, "...");
                fputs(this.cnt, "/* XPM */\n");
                fputs(this.cnt, "static char *RadarMap[] = {\n");
                fputs(this.cnt, "/* columns rows colors chars-per-pixel */\n");
@@ -329,7 +328,7 @@ void RadarMap_Think(entity this)
                        else
                        {
                                fputs(this.cnt, "\",\n");
-                               LOG_INFO(ftos(this.size.y - this.frame), " lines left\n");
+                               LOG_INFO(ftos(this.size.y - this.frame), " lines left");
                        }
                }
 
@@ -351,7 +350,7 @@ void RadarMap_Think(entity this)
                        else
                        {
                                fputs(this.cnt, "\",\n");
-                               LOG_INFO(ftos(this.size.y - this.frame), " lines left\n");
+                               LOG_INFO(ftos(this.size.y - this.frame), " lines left");
                        }
                }
 
@@ -363,7 +362,7 @@ void RadarMap_Think(entity this)
                // close the file
                fputs(this.cnt, "};\n");
                fclose(this.cnt);
-               LOG_INFO("Finished. Please edit data/", this.netname, " with an image editing application and place it in the TGA format in the gfx folder.\n");
+               LOG_INFO("Finished. Please edit data/", this.netname, " with an image editing application and place it in the TGA format in the gfx folder.");
                RadarMap_Next();
        }
 }
@@ -449,7 +448,7 @@ bool RadarMap_Make(float argc)
 
                if (radarmapper)  // after doing the arguments, see if we successfully went forward.
                {
-                       LOG_INFO("Radarmap entity spawned.\n");
+                       LOG_INFO("Radarmap entity spawned.");
                        return true;  // if so, don't print usage.
                }
        }
index 520884b32b5239e703b6121b4b79c312077f0b66..ffa82e5c02e09131efb74f5fd150fba0b4e601ec 100644 (file)
@@ -1,6 +1,6 @@
 #pragma once
 #ifndef RADARMAP
-bool RadarMap_Make(float argc) { LOG_INFO("radarmap is disabled, compile with -DRADARMAP to enable it.\n"); return true; }
+bool RadarMap_Make(float argc) { LOG_INFO("radarmap is disabled, compile with -DRADARMAP to enable it."); return true; }
 #else
 
 // ===========================================
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 145e75952a81f9fd9e555292f26f666ee43473f8..2bb0f1365c3b71aa353be44d6bc7522438344293 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"
@@ -41,7 +43,7 @@ void make_mapinfo_Think(entity this)
 {
        if (_MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1))
        {
-               LOG_INFO("Done rebuiling mapinfos.\n");
+               LOG_INFO("Done rebuiling mapinfos.");
                MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
                delete(this);
        }
@@ -123,7 +125,7 @@ void GameCommand_adminmsg(float request, float argc)
 
                                        if (accepted <= 0)
                                        {
-                                               LOG_INFO("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
+                                               LOG_INFO("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : "."));
                                                continue;
                                        }
 
@@ -144,22 +146,22 @@ void GameCommand_adminmsg(float request, float argc)
                                }
 
                                if (successful) bprint("Successfully sent message '", admin_message, "' to ", successful, ".\n");
-                               else LOG_INFO("No players given (", original_targets, ") could receive the message.\n");
+                               else LOG_INFO("No players given (", original_targets, ") could receive the message.");
 
                                return;
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2adminmsg^7\n");
+                       LOG_INFO("Incorrect parameters for ^2adminmsg^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd adminmsg clients \"message\" [infobartime]\n");
-                       LOG_INFO("  'clients' is a list (separated by commas) of player entity ID's or nicknames\n");
-                       LOG_INFO("  If infobartime is provided, the message will be sent to infobar.\n");
-                       LOG_INFO("  Otherwise, it will just be sent as a centerprint message.\n");
-                       LOG_INFO("Examples: adminmsg 2,4 \"this infomessage will last for ten seconds\" 10\n");
-                       LOG_INFO("          adminmsg 2,5 \"this message will be a centerprint\"\n");
+                       LOG_INFO("Usage:^3 sv_cmd adminmsg clients \"message\" [infobartime]");
+                       LOG_INFO("  'clients' is a list (separated by commas) of player entity ID's or nicknames");
+                       LOG_INFO("  If infobartime is provided, the message will be sent to infobar.");
+                       LOG_INFO("  Otherwise, it will just be sent as a centerprint message.");
+                       LOG_INFO("Examples: adminmsg 2,4 \"this infomessage will last for ten seconds\" 10");
+                       LOG_INFO("          adminmsg 2,5 \"this message will be a centerprint\"");
                        return;
                }
        }
@@ -178,8 +180,8 @@ void GameCommand_allready(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd allready\n");
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 sv_cmd allready");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
@@ -193,22 +195,22 @@ 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");
+                       else   LOG_INFO("No players found to spectate.");
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd allspec [reason]\n");
-                       LOG_INFO("  Where 'reason' is an optional argument for explanation of allspec command.\n");
-                       LOG_INFO("See also: ^2moveplayer, shuffleteams^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd allspec [reason]");
+                       LOG_INFO("  Where 'reason' is an optional argument for explanation of allspec command.");
+                       LOG_INFO("See also: ^2moveplayer, shuffleteams^7");
                        return;
                }
        }
@@ -230,16 +232,16 @@ void GameCommand_anticheat(float request, float argc)
                        }
                        else
                        {
-                               LOG_INFO("anticheat: ", GetClientErrorString(accepted, argv(1)), ".\n");
+                               LOG_INFO("anticheat: ", GetClientErrorString(accepted, argv(1)), ".");
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2anticheat^7\n");
+                       LOG_INFO("Incorrect parameters for ^2anticheat^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd anticheat client\n");
-                       LOG_INFO("  'client' is the entity number or name of the player.\n");
+                       LOG_INFO("Usage:^3 sv_cmd anticheat client");
+                       LOG_INFO("  'client' is the entity number or name of the player.");
                        return;
                }
        }
@@ -301,18 +303,18 @@ void GameCommand_bbox(float request)
                                NULL);
                        size_max.z = (trace_startsolid) ? world.absmax.z : trace_endpos.z;
 
-                       LOG_INFOF("Original size: %v %v\n", world.absmin, world.absmax);
-                       LOG_INFOF("Currently set size: %v %v\n", world.mins, world.maxs);
-                       LOG_INFOF("Solid bounding box size: %v %v\n", size_min, size_max);
+                       LOG_INFOF("Original size: %v %v", world.absmin, world.absmax);
+                       LOG_INFOF("Currently set size: %v %v", world.mins, world.maxs);
+                       LOG_INFOF("Solid bounding box size: %v %v", size_min, size_max);
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd bbox\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2gettaginfo, trace^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd bbox");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2gettaginfo, trace^7");
                        return;
                }
        }
@@ -338,7 +340,7 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                cvar_settemp("bot_number", "0");
                                bot_fixcount();
                                cvar_settemp("bot_number", argv(2));
-                               if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count\n");
+                               if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count");
                                return;
                        }
                        else if (argv(1) == "load" && argc == 3)
@@ -348,7 +350,7 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                fh = fopen(argv(2), FILE_READ);
                                if (fh < 0)
                                {
-                                       LOG_INFO("cannot open the file\n");
+                                       LOG_INFO("cannot open the file");
                                        return;
                                }
 
@@ -370,7 +372,7 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                                        cvar_settemp("bot_number", "0");
                                                        bot_fixcount();
                                                        cvar_settemp("bot_number", argv(3));
-                                                       if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count\n");
+                                                       if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count");
                                                }
                                                else
                                                {
@@ -393,7 +395,7 @@ void GameCommand_bot_cmd(float request, float argc, string command)
 
                                        ++i;
                                }
-                               LOG_INFO(ftos(i), " commands read\n");
+                               LOG_INFO(ftos(i), " commands read");
                                fclose(fh);
                                return;
                        }
@@ -413,7 +415,7 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                                bot_num++;
                                        });
                                        if(bot_num)
-                                               LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to all bots (", ftos(bot_num), ")\n"));
+                                               LOG_INFO("Command '", substring(command, argv_start_index(2), -1), "' sent to all bots (", ftos(bot_num), ")");
                                        return;
                                }
                                else
@@ -422,29 +424,29 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                        if (bot == NULL) bot = find_bot_by_name(argv(1));
                                        if (bot)
                                        {
-                                               LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname, "\n"));
+                                               LOG_INFO("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname);
                                                bot_queuecommand(bot, substring(command, argv_start_index(2), -1));
                                                return;
                                        }
                                        else
                                        {
-                                               LOG_INFO(strcat("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?\n"));  // don't return so that usage is shown
+                                               LOG_INFO("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?");  // don't return so that usage is shown
                                        }
                                }
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2bot_cmd^7\n");
+                       LOG_INFO("Incorrect parameters for ^2bot_cmd^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd bot_cmd client command [argument]\n");
-                       LOG_INFO("  'client' can be either the name of the bot or a progressive number (not the entity number!)\n");
-                       LOG_INFO("           can also be '*' or 'all' to allow sending the command to all the bots\n");
-                       LOG_INFO("  For full list of commands, see bot_cmd help [command].\n");
-                       LOG_INFO("Examples: sv_cmd bot_cmd 1 cc \"say something\"\n");
-                       LOG_INFO("          sv_cmd bot_cmd 1 presskey jump\n");
-                       LOG_INFO("          sv_cmd bot_cmd * pause\n");
+                       LOG_INFO("Usage:^3 sv_cmd bot_cmd client command [argument]");
+                       LOG_INFO("  'client' can be either the name of the bot or a progressive number (not the entity number!)");
+                       LOG_INFO("           can also be '*' or 'all' to allow sending the command to all the bots");
+                       LOG_INFO("  For full list of commands, see bot_cmd help [command].");
+                       LOG_INFO("Examples: sv_cmd bot_cmd 1 cc \"say something\"");
+                       LOG_INFO("          sv_cmd bot_cmd 1 presskey jump");
+                       LOG_INFO("          sv_cmd bot_cmd * pause");
                        return;
                }
        }
@@ -467,8 +469,8 @@ void GameCommand_cointoss(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd cointoss [result1 result2]\n");
-                       LOG_INFO("  Where 'result1' and 'result2' are user created options.\n");
+                       LOG_INFO("Usage:^3 sv_cmd cointoss [result1 result2]");
+                       LOG_INFO("  Where 'result1' and 'result2' are user created options.");
                        return;
                }
        }
@@ -485,33 +487,33 @@ void GameCommand_database(float request, float argc)
                                if (argv(1) == "save")
                                {
                                        db_save(ServerProgsDB, argv(2));
-                                       LOG_INFO(strcat("Copied serverprogs database to '", argv(2), "' in the data directory.\n"));
+                                       LOG_INFO("Copied serverprogs database to '", argv(2), "' in the data directory.");
                                        return;
                                }
                                else if (argv(1) == "dump")
                                {
                                        db_dump(ServerProgsDB, argv(2));
-                                       LOG_INFO("DB dumped.\n");  // wtf does this do?
+                                       LOG_INFO("DB dumped.");  // wtf does this do?
                                        return;
                                }
                                else if (argv(1) == "load")
                                {
                                        db_close(ServerProgsDB);
                                        ServerProgsDB = db_load(argv(2));
-                                       LOG_INFO(strcat("Loaded '", argv(2), "' as new serverprogs database.\n"));
+                                       LOG_INFO("Loaded '", argv(2), "' as new serverprogs database.");
                                        return;
                                }
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2database^7\n");
+                       LOG_INFO("Incorrect parameters for ^2database^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd database action filename\n");
-                       LOG_INFO("  Where 'action' is the command to complete,\n");
-                       LOG_INFO("  and 'filename' is what it acts upon.\n");
-                       LOG_INFO("  Full list of commands here: \"save, dump, load.\"\n");
+                       LOG_INFO("Usage:^3 sv_cmd database action filename");
+                       LOG_INFO("  Where 'action' is the command to complete,");
+                       LOG_INFO("  and 'filename' is what it acts upon.");
+                       LOG_INFO("  Full list of commands here: \"save, dump, load.\"");
                        return;
                }
        }
@@ -534,21 +536,21 @@ void GameCommand_defer_clear(float request, float argc)
                                if (accepted > 0)
                                {
                                        stuffcmd(client, "defer clear\n");
-                                       LOG_INFO("defer clear stuffed to ", playername(client, false), "\n");
+                                       LOG_INFO("defer clear stuffed to ", playername(client, false));
                                }
-                               else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); }
+                               else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), "."); }
 
                                return;
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2defer_clear^7\n");
+                       LOG_INFO("Incorrect parameters for ^2defer_clear^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd defer_clear client\n");
-                       LOG_INFO("  'client' is the entity number or name of the player.\n");
-                       LOG_INFO("See also: ^2defer_clear_all^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd defer_clear client");
+                       LOG_INFO("  'client' is the entity number or name of the player.");
+                       LOG_INFO("See also: ^2defer_clear_all^7");
                        return;
                }
        }
@@ -563,21 +565,21 @@ 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?
+                       });
+                       if (n)   LOG_INFO("Successfully stuffed defer clear to all clients (", ftos(n), ")");  // should a message be added if no players were found?
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd defer_clear_all\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2defer_clear^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd defer_clear_all");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2defer_clear^7");
                        return;
                }
        }
@@ -598,13 +600,13 @@ void GameCommand_delrec(float request, float argc)  // perhaps merge later with
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2delrec^7\n");
+                       LOG_INFO("Incorrect parameters for ^2delrec^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd delrec ranking [map]\n");
-                       LOG_INFO("  'ranking' is which ranking level to clear up to, \n");
-                       LOG_INFO("  it will clear all records up to nth place.\n");
-                       LOG_INFO("  if 'map' is not provided it will use current map.\n");
+                       LOG_INFO("Usage:^3 sv_cmd delrec ranking [map]");
+                       LOG_INFO("  'ranking' is which ranking level to clear up to, ");
+                       LOG_INFO("  it will clear all records up to nth place.");
+                       LOG_INFO("  if 'map' is not provided it will use current map.");
                        return;
                }
        }
@@ -620,79 +622,79 @@ void GameCommand_effectindexdump(float request)
                        string s;
 
                        d = db_create();
-                       LOG_INFO("begin of effects list\n");
+                       LOG_INFO("begin of effects list");
                        db_put(d, "TE_GUNSHOT", "1");
-                       LOG_INFO("effect TE_GUNSHOT is ", ftos(_particleeffectnum("TE_GUNSHOT")), "\n");
+                       LOG_INFO("effect TE_GUNSHOT is ", ftos(_particleeffectnum("TE_GUNSHOT")));
                        db_put(d, "TE_GUNSHOTQUAD", "1");
-                       LOG_INFO("effect TE_GUNSHOTQUAD is ", ftos(_particleeffectnum("TE_GUNSHOTQUAD")), "\n");
+                       LOG_INFO("effect TE_GUNSHOTQUAD is ", ftos(_particleeffectnum("TE_GUNSHOTQUAD")));
                        db_put(d, "TE_SPIKE", "1");
-                       LOG_INFO("effect TE_SPIKE is ", ftos(_particleeffectnum("TE_SPIKE")), "\n");
+                       LOG_INFO("effect TE_SPIKE is ", ftos(_particleeffectnum("TE_SPIKE")));
                        db_put(d, "TE_SPIKEQUAD", "1");
-                       LOG_INFO("effect TE_SPIKEQUAD is ", ftos(_particleeffectnum("TE_SPIKEQUAD")), "\n");
+                       LOG_INFO("effect TE_SPIKEQUAD is ", ftos(_particleeffectnum("TE_SPIKEQUAD")));
                        db_put(d, "TE_SUPERSPIKE", "1");
-                       LOG_INFO("effect TE_SUPERSPIKE is ", ftos(_particleeffectnum("TE_SUPERSPIKE")), "\n");
+                       LOG_INFO("effect TE_SUPERSPIKE is ", ftos(_particleeffectnum("TE_SUPERSPIKE")));
                        db_put(d, "TE_SUPERSPIKEQUAD", "1");
-                       LOG_INFO("effect TE_SUPERSPIKEQUAD is ", ftos(_particleeffectnum("TE_SUPERSPIKEQUAD")), "\n");
+                       LOG_INFO("effect TE_SUPERSPIKEQUAD is ", ftos(_particleeffectnum("TE_SUPERSPIKEQUAD")));
                        db_put(d, "TE_WIZSPIKE", "1");
-                       LOG_INFO("effect TE_WIZSPIKE is ", ftos(_particleeffectnum("TE_WIZSPIKE")), "\n");
+                       LOG_INFO("effect TE_WIZSPIKE is ", ftos(_particleeffectnum("TE_WIZSPIKE")));
                        db_put(d, "TE_KNIGHTSPIKE", "1");
-                       LOG_INFO("effect TE_KNIGHTSPIKE is ", ftos(_particleeffectnum("TE_KNIGHTSPIKE")), "\n");
+                       LOG_INFO("effect TE_KNIGHTSPIKE is ", ftos(_particleeffectnum("TE_KNIGHTSPIKE")));
                        db_put(d, "TE_EXPLOSION", "1");
-                       LOG_INFO("effect TE_EXPLOSION is ", ftos(_particleeffectnum("TE_EXPLOSION")), "\n");
+                       LOG_INFO("effect TE_EXPLOSION is ", ftos(_particleeffectnum("TE_EXPLOSION")));
                        db_put(d, "TE_EXPLOSIONQUAD", "1");
-                       LOG_INFO("effect TE_EXPLOSIONQUAD is ", ftos(_particleeffectnum("TE_EXPLOSIONQUAD")), "\n");
+                       LOG_INFO("effect TE_EXPLOSIONQUAD is ", ftos(_particleeffectnum("TE_EXPLOSIONQUAD")));
                        db_put(d, "TE_TAREXPLOSION", "1");
-                       LOG_INFO("effect TE_TAREXPLOSION is ", ftos(_particleeffectnum("TE_TAREXPLOSION")), "\n");
+                       LOG_INFO("effect TE_TAREXPLOSION is ", ftos(_particleeffectnum("TE_TAREXPLOSION")));
                        db_put(d, "TE_TELEPORT", "1");
-                       LOG_INFO("effect TE_TELEPORT is ", ftos(_particleeffectnum("TE_TELEPORT")), "\n");
+                       LOG_INFO("effect TE_TELEPORT is ", ftos(_particleeffectnum("TE_TELEPORT")));
                        db_put(d, "TE_LAVASPLASH", "1");
-                       LOG_INFO("effect TE_LAVASPLASH is ", ftos(_particleeffectnum("TE_LAVASPLASH")), "\n");
+                       LOG_INFO("effect TE_LAVASPLASH is ", ftos(_particleeffectnum("TE_LAVASPLASH")));
                        db_put(d, "TE_SMALLFLASH", "1");
-                       LOG_INFO("effect TE_SMALLFLASH is ", ftos(_particleeffectnum("TE_SMALLFLASH")), "\n");
+                       LOG_INFO("effect TE_SMALLFLASH is ", ftos(_particleeffectnum("TE_SMALLFLASH")));
                        db_put(d, "TE_FLAMEJET", "1");
-                       LOG_INFO("effect TE_FLAMEJET is ", ftos(_particleeffectnum("TE_FLAMEJET")), "\n");
+                       LOG_INFO("effect TE_FLAMEJET is ", ftos(_particleeffectnum("TE_FLAMEJET")));
                        db_put(d, "EF_FLAME", "1");
-                       LOG_INFO("effect EF_FLAME is ", ftos(_particleeffectnum("EF_FLAME")), "\n");
+                       LOG_INFO("effect EF_FLAME is ", ftos(_particleeffectnum("EF_FLAME")));
                        db_put(d, "TE_BLOOD", "1");
-                       LOG_INFO("effect TE_BLOOD is ", ftos(_particleeffectnum("TE_BLOOD")), "\n");
+                       LOG_INFO("effect TE_BLOOD is ", ftos(_particleeffectnum("TE_BLOOD")));
                        db_put(d, "TE_SPARK", "1");
-                       LOG_INFO("effect TE_SPARK is ", ftos(_particleeffectnum("TE_SPARK")), "\n");
+                       LOG_INFO("effect TE_SPARK is ", ftos(_particleeffectnum("TE_SPARK")));
                        db_put(d, "TE_PLASMABURN", "1");
-                       LOG_INFO("effect TE_PLASMABURN is ", ftos(_particleeffectnum("TE_PLASMABURN")), "\n");
+                       LOG_INFO("effect TE_PLASMABURN is ", ftos(_particleeffectnum("TE_PLASMABURN")));
                        db_put(d, "TE_TEI_G3", "1");
-                       LOG_INFO("effect TE_TEI_G3 is ", ftos(_particleeffectnum("TE_TEI_G3")), "\n");
+                       LOG_INFO("effect TE_TEI_G3 is ", ftos(_particleeffectnum("TE_TEI_G3")));
                        db_put(d, "TE_TEI_SMOKE", "1");
-                       LOG_INFO("effect TE_TEI_SMOKE is ", ftos(_particleeffectnum("TE_TEI_SMOKE")), "\n");
+                       LOG_INFO("effect TE_TEI_SMOKE is ", ftos(_particleeffectnum("TE_TEI_SMOKE")));
                        db_put(d, "TE_TEI_BIGEXPLOSION", "1");
-                       LOG_INFO("effect TE_TEI_BIGEXPLOSION is ", ftos(_particleeffectnum("TE_TEI_BIGEXPLOSION")), "\n");
+                       LOG_INFO("effect TE_TEI_BIGEXPLOSION is ", ftos(_particleeffectnum("TE_TEI_BIGEXPLOSION")));
                        db_put(d, "TE_TEI_PLASMAHIT", "1");
-                       LOG_INFO("effect TE_TEI_PLASMAHIT is ", ftos(_particleeffectnum("TE_TEI_PLASMAHIT")), "\n");
+                       LOG_INFO("effect TE_TEI_PLASMAHIT is ", ftos(_particleeffectnum("TE_TEI_PLASMAHIT")));
                        db_put(d, "EF_STARDUST", "1");
-                       LOG_INFO("effect EF_STARDUST is ", ftos(_particleeffectnum("EF_STARDUST")), "\n");
+                       LOG_INFO("effect EF_STARDUST is ", ftos(_particleeffectnum("EF_STARDUST")));
                        db_put(d, "TR_ROCKET", "1");
-                       LOG_INFO("effect TR_ROCKET is ", ftos(_particleeffectnum("TR_ROCKET")), "\n");
+                       LOG_INFO("effect TR_ROCKET is ", ftos(_particleeffectnum("TR_ROCKET")));
                        db_put(d, "TR_GRENADE", "1");
-                       LOG_INFO("effect TR_GRENADE is ", ftos(_particleeffectnum("TR_GRENADE")), "\n");
+                       LOG_INFO("effect TR_GRENADE is ", ftos(_particleeffectnum("TR_GRENADE")));
                        db_put(d, "TR_BLOOD", "1");
-                       LOG_INFO("effect TR_BLOOD is ", ftos(_particleeffectnum("TR_BLOOD")), "\n");
+                       LOG_INFO("effect TR_BLOOD is ", ftos(_particleeffectnum("TR_BLOOD")));
                        db_put(d, "TR_WIZSPIKE", "1");
-                       LOG_INFO("effect TR_WIZSPIKE is ", ftos(_particleeffectnum("TR_WIZSPIKE")), "\n");
+                       LOG_INFO("effect TR_WIZSPIKE is ", ftos(_particleeffectnum("TR_WIZSPIKE")));
                        db_put(d, "TR_SLIGHTBLOOD", "1");
-                       LOG_INFO("effect TR_SLIGHTBLOOD is ", ftos(_particleeffectnum("TR_SLIGHTBLOOD")), "\n");
+                       LOG_INFO("effect TR_SLIGHTBLOOD is ", ftos(_particleeffectnum("TR_SLIGHTBLOOD")));
                        db_put(d, "TR_KNIGHTSPIKE", "1");
-                       LOG_INFO("effect TR_KNIGHTSPIKE is ", ftos(_particleeffectnum("TR_KNIGHTSPIKE")), "\n");
+                       LOG_INFO("effect TR_KNIGHTSPIKE is ", ftos(_particleeffectnum("TR_KNIGHTSPIKE")));
                        db_put(d, "TR_VORESPIKE", "1");
-                       LOG_INFO("effect TR_VORESPIKE is ", ftos(_particleeffectnum("TR_VORESPIKE")), "\n");
+                       LOG_INFO("effect TR_VORESPIKE is ", ftos(_particleeffectnum("TR_VORESPIKE")));
                        db_put(d, "TR_NEHAHRASMOKE", "1");
-                       LOG_INFO("effect TR_NEHAHRASMOKE is ", ftos(_particleeffectnum("TR_NEHAHRASMOKE")), "\n");
+                       LOG_INFO("effect TR_NEHAHRASMOKE is ", ftos(_particleeffectnum("TR_NEHAHRASMOKE")));
                        db_put(d, "TR_NEXUIZPLASMA", "1");
-                       LOG_INFO("effect TR_NEXUIZPLASMA is ", ftos(_particleeffectnum("TR_NEXUIZPLASMA")), "\n");
+                       LOG_INFO("effect TR_NEXUIZPLASMA is ", ftos(_particleeffectnum("TR_NEXUIZPLASMA")));
                        db_put(d, "TR_GLOWTRAIL", "1");
-                       LOG_INFO("effect TR_GLOWTRAIL is ", ftos(_particleeffectnum("TR_GLOWTRAIL")), "\n");
+                       LOG_INFO("effect TR_GLOWTRAIL is ", ftos(_particleeffectnum("TR_GLOWTRAIL")));
                        db_put(d, "TR_SEEKER", "1");
-                       LOG_INFO("effect TR_SEEKER is ", ftos(_particleeffectnum("TR_SEEKER")), "\n");
+                       LOG_INFO("effect TR_SEEKER is ", ftos(_particleeffectnum("TR_SEEKER")));
                        db_put(d, "SVC_PARTICLE", "1");
-                       LOG_INFO("effect SVC_PARTICLE is ", ftos(_particleeffectnum("SVC_PARTICLE")), "\n");
+                       LOG_INFO("effect SVC_PARTICLE is ", ftos(_particleeffectnum("SVC_PARTICLE")));
 
                        fh = fopen("effectinfo.txt", FILE_READ);
                        while ((s = fgets(fh)))
@@ -703,12 +705,12 @@ void GameCommand_effectindexdump(float request)
                                        if (db_get(d, argv(1)) != "1")
                                        {
                                                int i = _particleeffectnum(argv(1));
-                                               if (i >= 0) LOG_INFO("effect ", argv(1), " is ", ftos(i), "\n");
+                                               if (i >= 0) LOG_INFO("effect ", argv(1), " is ", ftos(i));
                                                db_put(d, argv(1), "1");
                                        }
                                }
                        }
-                       LOG_INFO("end of effects list\n");
+                       LOG_INFO("end of effects list");
 
                        db_close(d);
                        return;
@@ -717,8 +719,8 @@ void GameCommand_effectindexdump(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd effectindexdump\n");
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 sv_cmd effectindexdump");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
@@ -737,9 +739,9 @@ void GameCommand_extendmatchtime(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd extendmatchtime\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2reducematchtime^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd extendmatchtime");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2reducematchtime^7");
                        return;
                }
        }
@@ -784,12 +786,12 @@ void GameCommand_gametype(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gametype^7\n");
+                       LOG_INFO("Incorrect parameters for ^2gametype^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd gametype mode\n");
-                       LOG_INFO("  Where 'mode' is the gametype mode to switch to.\n");
-                       LOG_INFO("See also: ^2gotomap^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd gametype mode");
+                       LOG_INFO("  Where 'mode' is the gametype mode to switch to.");
+                       LOG_INFO("See also: ^2gotomap^7");
                        return;
                }
        }
@@ -824,13 +826,15 @@ void GameCommand_gettaginfo(float request, float argc)
                                if (i)
                                {
                                        v = gettaginfo(tmp_entity, i);
-                                       LOG_INFO("model ", tmp_entity.model, " frame ", ftos(tmp_entity.frame), " tag ", gettaginfo_name);
-                                       LOG_INFO(" index ", ftos(i), " parent ", ftos(gettaginfo_parent), "\n");
-                                       LOG_INFO(" vector = ", ftos(v.x), " ", ftos(v.y), " ", ftos(v.z), "\n");
-                                       LOG_INFO(" offset = ", ftos(gettaginfo_offset.x), " ", ftos(gettaginfo_offset.y), " ", ftos(gettaginfo_offset.z), "\n");
-                                       LOG_INFO(" forward = ", ftos(gettaginfo_forward.x), " ", ftos(gettaginfo_forward.y), " ", ftos(gettaginfo_forward.z), "\n");
-                                       LOG_INFO(" right = ", ftos(gettaginfo_right.x), " ", ftos(gettaginfo_right.y), " ", ftos(gettaginfo_right.z), "\n");
-                                       LOG_INFO(" up = ", ftos(gettaginfo_up.x), " ", ftos(gettaginfo_up.y), " ", ftos(gettaginfo_up.z), "\n");
+                                       LOG_INFOF(
+                                           "model %s frame %s tag %s index %s parent %s",
+                                           tmp_entity.model, ftos(tmp_entity.frame), gettaginfo_name, ftos(i), ftos(gettaginfo_parent)
+                                       );
+                                       LOG_INFOF(" vector = %s %s %s", ftos(v.x), ftos(v.y), ftos(v.z));
+                                       LOG_INFOF(" offset = %s %s %s", ftos(gettaginfo_offset.x), ftos(gettaginfo_offset.y), ftos(gettaginfo_offset.z));
+                                       LOG_INFOF(" forward = %s %s %s", ftos(gettaginfo_forward.x), ftos(gettaginfo_forward.y), ftos(gettaginfo_forward.z));
+                                       LOG_INFOF(" right = %s %s %s", ftos(gettaginfo_right.x), ftos(gettaginfo_right.y), ftos(gettaginfo_right.z));
+                                       LOG_INFOF(" up = %s %s %s", ftos(gettaginfo_up.x), ftos(gettaginfo_up.y), ftos(gettaginfo_up.z));
                                        if (argc >= 6)
                                        {
                                                v.y = -v.y;
@@ -839,7 +843,7 @@ void GameCommand_gettaginfo(float request, float argc)
                                }
                                else
                                {
-                                       LOG_INFO("bone not found\n");
+                                       LOG_INFO("bone not found");
                                }
 
                                delete(tmp_entity);
@@ -848,11 +852,11 @@ void GameCommand_gettaginfo(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gettaginfo^7\n");
+                       LOG_INFO("Incorrect parameters for ^2gettaginfo^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd gettaginfo model frame index [command one] [command two]\n");
-                       LOG_INFO("See also: ^2bbox, trace^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd gettaginfo model frame index [command one] [command two]");
+                       LOG_INFO("See also: ^2bbox, trace^7");
                        return;
                }
        }
@@ -898,8 +902,8 @@ void GameCommand_animbench(float request, float argc)
                                        t2 += gettime(GETTIME_HIRES) - t0;
                                        n += 1;
                                }
-                               LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f1), " animtime ", ftos(n / t1), "/s\n");
-                               LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f2), " animtime ", ftos(n / t2), "/s\n");
+                               LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f1), " animtime ", ftos(n / t1), "/s");
+                               LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f2), " animtime ", ftos(n / t2), "/s");
 
                                delete(tmp_entity);
                                return;
@@ -907,11 +911,11 @@ void GameCommand_animbench(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gettaginfo^7\n");
+                       LOG_INFO("Incorrect parameters for ^2gettaginfo^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd gettaginfo model frame index [command one] [command two]\n");
-                       LOG_INFO("See also: ^2bbox, trace^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd gettaginfo model frame index [command one] [command two]");
+                       LOG_INFO("See also: ^2bbox, trace^7");
                        return;
                }
        }
@@ -925,18 +929,18 @@ void GameCommand_gotomap(float request, float argc)
                {
                        if (argv(1))
                        {
-                               LOG_INFO(GotoMap(argv(1)), "\n");
+                               LOG_INFO(GotoMap(argv(1)));
                                return;
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gotomap^7\n");
+                       LOG_INFO("Incorrect parameters for ^2gotomap^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd gotomap map\n");
-                       LOG_INFO("  Where 'map' is the *.bsp file to change to.\n");
-                       LOG_INFO("See also: ^2gametype^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd gotomap map");
+                       LOG_INFO("  Where 'map' is the *.bsp file to change to.");
+                       LOG_INFO("See also: ^2gametype^7");
                        return;
                }
        }
@@ -963,9 +967,9 @@ void GameCommand_lockteams(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd lockteams\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2unlockteams^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd lockteams");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2unlockteams^7");
                        return;
                }
        }
@@ -989,9 +993,9 @@ void GameCommand_make_mapinfo(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd make_mapinfo\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2radarmap^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd make_mapinfo");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2radarmap^7");
                        return;
                }
        }
@@ -1027,7 +1031,7 @@ void GameCommand_moveplayer(float request, float argc)
 
                                        if (accepted <= 0)
                                        {
-                                               LOG_INFO("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
+                                               LOG_INFO("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : "."));
                                                continue;
                                        }
 
@@ -1043,7 +1047,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                }
                                                else
                                                {
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.\n");
+                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.");
                                                }
                                                continue;
                                        }
@@ -1063,7 +1067,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                                if (team_id == client.team)  // already on the destination team
                                                                {
                                                                        // keep the forcing undone
-                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
+                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7."));
                                                                        continue;
                                                                }
                                                                else if (team_id == 0)  // auto team
@@ -1080,12 +1084,12 @@ void GameCommand_moveplayer(float request, float argc)
                                                                // Check to see if the destination team is even available
                                                                switch (team_id)
                                                                {
-                                                                       case NUM_TEAM_1: if (c1 == -1) { LOG_INFO("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
-                                                                       case NUM_TEAM_2: if (c2 == -1) { LOG_INFO("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
-                                                                       case NUM_TEAM_3: if (c3 == -1) { LOG_INFO("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
-                                                                       case NUM_TEAM_4: if (c4 == -1) { LOG_INFO("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
+                                                                       case NUM_TEAM_1: if (c1 == -1) { LOG_INFO("Sorry, can't move player to red team if it doesn't exist."); return; } break;
+                                                                       case NUM_TEAM_2: if (c2 == -1) { LOG_INFO("Sorry, can't move player to blue team if it doesn't exist."); return; } break;
+                                                                       case NUM_TEAM_3: if (c3 == -1) { LOG_INFO("Sorry, can't move player to yellow team if it doesn't exist."); return; } break;
+                                                                       case NUM_TEAM_4: if (c4 == -1) { LOG_INFO("Sorry, can't move player to pink team if it doesn't exist."); return; } break;
 
-                                                                       default: LOG_INFO("Sorry, can't move player here if team ", destination, " doesn't exist.\n");
+                                                                       default: LOG_INFO("Sorry, can't move player here if team ", destination, " doesn't exist.");
                                                                                return;
                                                                }
 
@@ -1093,41 +1097,41 @@ void GameCommand_moveplayer(float request, float argc)
                                                                client.team_forced = 0;
                                                                MoveToTeam(client, team_id, 6);
                                                                successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
-                                                               LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
+                                                               LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.");
                                                                continue;
                                                        }
                                                        else
                                                        {
-                                                               LOG_INFO("Can't change teams when currently not playing a team game.\n");
+                                                               LOG_INFO("Can't change teams when currently not playing a team game.");
                                                                return;
                                                        }
                                                }
                                                else
                                                {
-                                                       LOG_INFO("Can't change teams if the player isn't in the game.\n");  // well technically we could, but should we allow that? :P
+                                                       LOG_INFO("Can't change teams if the player isn't in the game.");  // well technically we could, but should we allow that? :P
                                                        return;
                                                }
                                        }
                                }
 
                                if (successful) bprint("Successfully moved players ", successful, " to destination ", destination, ".\n");
-                               else LOG_INFO("No players given (", original_targets, ") are able to move.\n");
+                               else LOG_INFO("No players given (", original_targets, ") are able to move.");
 
                                return;  // still correct parameters so return to avoid usage print
                        }
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2moveplayer^7\n");
+                       LOG_INFO("Incorrect parameters for ^2moveplayer^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd moveplayer clients destination\n");
-                       LOG_INFO("  'clients' is a list (separated by commas) of player entity ID's or nicknames\n");
-                       LOG_INFO("  'destination' is what to send the player to, be it team or spectating\n");
-                       LOG_INFO("  Full list of destinations here: \"spec, spectator, red, blue, yellow, pink, auto.\"\n");
-                       LOG_INFO("Examples: sv_cmd moveplayer 1,3,5 red 3\n");
-                       LOG_INFO("          sv_cmd moveplayer 2 spec \n");
-                       LOG_INFO("See also: ^2allspec, shuffleteams^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd moveplayer clients destination");
+                       LOG_INFO("  'clients' is a list (separated by commas) of player entity ID's or nicknames");
+                       LOG_INFO("  'destination' is what to send the player to, be it team or spectating");
+                       LOG_INFO("  Full list of destinations here: \"spec, spectator, red, blue, yellow, pink, auto.\"");
+                       LOG_INFO("Examples: sv_cmd moveplayer 1,3,5 red 3");
+                       LOG_INFO("          sv_cmd moveplayer 2 spec ");
+                       LOG_INFO("See also: ^2allspec, shuffleteams^7");
                        return;
                }
        }
@@ -1141,13 +1145,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)
                                {
-                                       it.spectatortime = time;
+                                       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;
                }
@@ -1155,8 +1159,8 @@ void GameCommand_nospectators(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd nospectators\n");
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 sv_cmd nospectators");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
@@ -1182,7 +1186,7 @@ void GameCommand_playerdemo(float request, float argc)
 
                                                if (accepted <= 0)
                                                {
-                                                       LOG_INFO("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n");
+                                                       LOG_INFO("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".");
                                                        return;
                                                }
 
@@ -1197,7 +1201,7 @@ void GameCommand_playerdemo(float request, float argc)
 
                                                if (accepted <= 0)
                                                {
-                                                       LOG_INFO("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n");
+                                                       LOG_INFO("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".");
                                                        return;
                                                }
 
@@ -1232,11 +1236,11 @@ void GameCommand_playerdemo(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2playerdemo^7\n");
+                       LOG_INFO("Incorrect parameters for ^2playerdemo^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd playerdemo command (entitynumber filename | entitynumber botnumber)\n");
-                       LOG_INFO("  Full list of commands here: \"read, write, auto_read_and_write, auto_read.\"\n");
+                       LOG_INFO("Usage:^3 sv_cmd playerdemo command (entitynumber filename | entitynumber botnumber)");
+                       LOG_INFO("  Full list of commands here: \"read, write, auto_read_and_write, auto_read.\"");
                        return;
                }
        }
@@ -1249,15 +1253,15 @@ void GameCommand_printstats(float request)
                case CMD_REQUEST_COMMAND:
                {
                        DumpStats(false);
-                       LOG_INFO("stats dumped.\n");
+                       LOG_INFO("stats dumped.");
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd printstats\n");
-                       LOG_INFO("  No arguments required.\n");
+                       LOG_INFO("Usage:^3 sv_cmd printstats");
+                       LOG_INFO("  No arguments required.");
                        return;
                }
        }
@@ -1273,13 +1277,13 @@ void GameCommand_radarmap(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2radarmap^7\n");
+                       LOG_INFO("Incorrect parameters for ^2radarmap^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd radarmap [--force] [--loop] [--quit] [--block | --trace | --sample | --lineblock] [--sharpen N] [--res W H] [--qual Q]\n");
-                       LOG_INFO("  The quality factor Q is roughly proportional to the time taken.\n");
-                       LOG_INFO("  trace supports no quality factor; its result should look like --block with infinite quality factor.\n");
-                       LOG_INFO("See also: ^2make_mapinfo^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd radarmap [--force] [--loop] [--quit] [--block | --trace | --sample | --lineblock] [--sharpen N] [--res W H] [--qual Q]");
+                       LOG_INFO("  The quality factor Q is roughly proportional to the time taken.");
+                       LOG_INFO("  trace supports no quality factor; its result should look like --block with infinite quality factor.");
+                       LOG_INFO("See also: ^2make_mapinfo^7");
                        return;
                }
        }
@@ -1298,9 +1302,9 @@ void GameCommand_reducematchtime(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd reducematchtime\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2extendmatchtime^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd reducematchtime");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2extendmatchtime^7");
                        return;
                }
        }
@@ -1322,12 +1326,12 @@ void GameCommand_setbots(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2setbots^7\n");
+                       LOG_INFO("Incorrect parameters for ^2setbots^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd setbots botnumber\n");
-                       LOG_INFO("  Where 'botnumber' is the amount of bots to set bot_number cvar to.\n");
-                       LOG_INFO("See also: ^2bot_cmd^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd setbots botnumber");
+                       LOG_INFO("  Where 'botnumber' is the amount of bots to set bot_number cvar to.");
+                       LOG_INFO("See also: ^2bot_cmd^7");
                        return;
                }
        }
@@ -1341,19 +1345,19 @@ void GameCommand_shuffleteams(float request)
                {
                        if (!teamplay)
                        {
-                               LOG_INFO("Can't shuffle teams when currently not playing a team game.\n");
+                               LOG_INFO("Can't shuffle teams when currently not playing a team game.");
                                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
                                        // either all players or none are gonna have forced teams
-                                       LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
+                                       LOG_INFO("Can't shuffle teams because at least one player has a forced team.");
                                        return;
                                }
-                       ));
+                       });
 
                        int number_of_teams = 0;
                        CheckAllowedTeams(NULL);
@@ -1363,11 +1367,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;
@@ -1376,9 +1380,9 @@ void GameCommand_shuffleteams(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd shuffleteams\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2moveplayer, allspec^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd shuffleteams");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2moveplayer, allspec^7");
                        return;
                }
        }
@@ -1403,11 +1407,11 @@ void GameCommand_stuffto(float request, float argc)
                                        if (accepted > 0)
                                        {
                                                stuffcmd(client, strcat("\n", argv(next_token), "\n"));
-                                               LOG_INFO(strcat("Command: \"", argv(next_token), "\" sent to ", GetCallerName(client), " (", argv(1), ").\n"));
+                                               LOG_INFO("Command: \"", argv(next_token), "\" sent to ", GetCallerName(client), " (", argv(1), ").");
                                        }
                                        else
                                        {
-                                               LOG_INFO("stuffto: ", GetClientErrorString(accepted, argv(1)), ".\n");
+                                               LOG_INFO("stuffto: ", GetClientErrorString(accepted, argv(1)), ".");
                                        }
 
                                        return;
@@ -1415,19 +1419,19 @@ void GameCommand_stuffto(float request, float argc)
                        }
 
                        default:
-                               LOG_INFO("Incorrect parameters for ^2stuffto^7\n");
+                               LOG_INFO("Incorrect parameters for ^2stuffto^7");
                        case CMD_REQUEST_USAGE:
                        {
-                               LOG_INFO("\nUsage:^3 sv_cmd stuffto client \"command\"\n");
-                               LOG_INFO("  'client' is the entity number or name of the player,\n");
-                               LOG_INFO("  and 'command' is the command to be sent to that player.\n");
+                               LOG_INFO("Usage:^3 sv_cmd stuffto client \"command\"");
+                               LOG_INFO("  'client' is the entity number or name of the player,");
+                               LOG_INFO("  and 'command' is the command to be sent to that player.");
                                return;
                        }
                }
 #else
                if (request)
                {
-                       LOG_INFO("stuffto command is not enabled on this server.\n");
+                       LOG_INFO("stuffto command is not enabled on this server.");
                        return;
                }
 #endif
@@ -1448,7 +1452,7 @@ void GameCommand_trace(float request, float argc)
                                case "debug":
                                {
                                        float hitcount = 0;
-                                       LOG_INFO("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.\n");
+                                       LOG_INFO("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.");
                                        float worst_endpos_bug = 0;
                                        for ( ; ; )
                                        {
@@ -1495,12 +1499,12 @@ void GameCommand_trace(float request, float argc)
                                                                        }
                                                                }
 
-                                                               LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n");
-                                                               LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n");
+                                                               LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu");
+                                                               LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu");
 
                                                                tracebox(p, PL_MIN_CONST + '0.1 0.1 0.1', PL_MAX_CONST - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, NULL);
-                                                               if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
-                                                               else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
+                                                               if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p));
+                                                               else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p));
                                                                if (++hitcount >= 10) break;
                                                        }
                                                        else
@@ -1521,8 +1525,8 @@ void GameCommand_trace(float request, float argc)
                                                                if (dq > worst_endpos_bug)
                                                                {
                                                                        worst_endpos_bug = dq;
-                                                                       LOG_INFO("trace_endpos still before solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
-                                                                       LOG_INFO("could go ", ftos(dq), " units further to ", vtos(q), "\n");
+                                                                       LOG_INFO("trace_endpos still before solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p));
+                                                                       LOG_INFO("could go ", ftos(dq), " units further to ", vtos(q));
                                                                        if (++hitcount >= 10) break;
                                                                }
                                                        }
@@ -1538,7 +1542,7 @@ void GameCommand_trace(float request, float argc)
                                        vv = trace_endpos;
                                        if (trace_fraction == 1)
                                        {
-                                               LOG_INFO("not above ground, aborting\n");
+                                               LOG_INFO("not above ground, aborting");
                                                return;
                                        }
                                        f = 0;
@@ -1547,18 +1551,18 @@ void GameCommand_trace(float request, float argc)
                                                dv = randomvec();
                                                if (dv.z > 0) dv = -1 * dv;
                                                tracebox(vv, e.mins, e.maxs, vv + dv, MOVE_NORMAL, e);
-                                               if (trace_startsolid) LOG_INFO("bug 1\n");
+                                               if (trace_startsolid) LOG_INFO("bug 1");
                                                if (trace_fraction == 1)
                                                {
                                                        if (dv.z < f)
                                                        {
                                                                LOG_INFO("bug 2: ", ftos(dv.x), " ", ftos(dv.y), " ", ftos(dv.z));
-                                                               LOG_INFO(" (", ftos(asin(dv.z / vlen(dv)) * 180 / M_PI), " degrees)\n");
+                                                               LOG_INFO(" (", ftos(asin(dv.z / vlen(dv)) * 180 / M_PI), " degrees)");
                                                                f = dv.z;
                                                        }
                                                }
                                        }
-                                       LOG_INFO("highest possible dist: ", ftos(f), "\n");
+                                       LOG_INFO("highest possible dist: ", ftos(f));
                                        return;
                                }
 
@@ -1567,8 +1571,8 @@ void GameCommand_trace(float request, float argc)
                                        if (argc == 4)
                                        {
                                                e = nextent(NULL);
-                                               if (tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), MOVE_NORMAL)) LOG_INFO("can walk\n");
-                                               else LOG_INFO("cannot walk\n");
+                                               if (tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), MOVE_NORMAL)) LOG_INFO("can walk");
+                                               else LOG_INFO("cannot walk");
                                                return;
                                        }
                                }
@@ -1591,12 +1595,12 @@ void GameCommand_trace(float request, float argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2trace^7\n");
+                       LOG_INFO("Incorrect parameters for ^2trace^7");
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd trace command (startpos endpos)\n");
-                       LOG_INFO("  Full list of commands here: \"debug, debug2, walk, showline.\"\n");
-                       LOG_INFO("See also: ^2bbox, gettaginfo^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd trace command (startpos endpos)");
+                       LOG_INFO("  Full list of commands here: \"debug, debug2, walk, showline.\"");
+                       LOG_INFO("See also: ^2bbox, gettaginfo^7");
                        return;
                }
        }
@@ -1623,9 +1627,9 @@ void GameCommand_unlockteams(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd unlockteams\n");
-                       LOG_INFO("  No arguments required.\n");
-                       LOG_INFO("See also: ^2lockteams^7\n");
+                       LOG_INFO("Usage:^3 sv_cmd unlockteams");
+                       LOG_INFO("  No arguments required.");
+                       LOG_INFO("See also: ^2lockteams^7");
                        return;
                }
        }
@@ -1642,17 +1646,17 @@ void GameCommand_warp(float request, float argc)
                                if (argc >= 2)
                                {
                                        CampaignLevelWarp(stof(argv(1)));
-                                       LOG_INFO("Successfully warped to campaign level ", argv(1), ".\n");
+                                       LOG_INFO("Successfully warped to campaign level ", argv(1), ".");
                                }
                                else
                                {
                                        CampaignLevelWarp(-1);
-                                       LOG_INFO("Successfully warped to next campaign level.\n");
+                                       LOG_INFO("Successfully warped to next campaign level.");
                                }
                        }
                        else
                        {
-                               LOG_INFO("Not in campaign, can't level warp\n");
+                               LOG_INFO("Not in campaign, can't level warp");
                        }
                        return;
                }
@@ -1660,9 +1664,9 @@ void GameCommand_warp(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("\nUsage:^3 sv_cmd warp [level]\n");
-                       LOG_INFO("  'level' is the level to change campaign mode to.\n");
-                       LOG_INFO("  if 'level' is not provided it will change to the next level.\n");
+                       LOG_INFO("Usage:^3 sv_cmd warp [level]");
+                       LOG_INFO("  'level' is the level to change campaign mode to.");
+                       LOG_INFO("  if 'level' is not provided it will change to the next level.");
                        return;
                }
        }
@@ -1731,32 +1735,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", 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); });
 }
 
 
@@ -1778,20 +1782,22 @@ void GameCommand(string command)
        {
                if (argc == 1)
                {
-                       LOG_INFO("\nServer console commands:\n");
+                       LOG_INFO("Server console commands:");
                        GameCommand_macro_help();
 
-                       LOG_INFO("\nBanning commands:\n");
+                       LOG_INFO("\nBanning commands:");
                        BanCommand_macro_help();
 
-                       LOG_INFO("\nCommon networked commands:\n");
+                       LOG_INFO("\nCommon networked commands:");
                        CommonCommand_macro_help(NULL);
 
-                       LOG_INFO("\nGeneric commands shared by all programs:\n");
+                       LOG_INFO("\nGeneric commands shared by all programs:");
                        GenericCommand_macro_help();
 
-                       LOG_INFO("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are listed above.\n");
-                       LOG_INFO("For help about a specific command, type sv_cmd help COMMAND\n");
+                       LOG_INFO(
+                           "\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are listed above.\n"
+                "For help about a specific command, type sv_cmd help COMMAND"
+            );
 
                        return;
                }
@@ -1834,5 +1840,5 @@ void GameCommand(string command)
        }
 
        // nothing above caught the command, must be invalid
-       LOG_INFO(((command != "") ? strcat("Unknown server command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try sv_cmd help.\n");
+       LOG_INFO(((command != "") ? strcat("Unknown server command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try sv_cmd help.");
 }
index bc75fd1453e821751dea4feedb6009c3026cdbbd..8cfed5bae4bb06e1c15e15ead247605aaa08481f 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
@@ -382,11 +386,11 @@ void reset_map(bool dorespawn)
                                        */
                                        // NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
                                        // PlayerScore_Clear(it);
-                                       it.killcount = 0;
+                                       CS(it).killcount = 0;
                                        // stop the player from moving so that he stands still once he gets respawned
                                        it.velocity = '0 0 0';
                                        it.avelocity = '0 0 0';
-                                       it.movement = '0 0 0';
+                                       CS(it).movement = '0 0 0';
                                        PutClientInServer(it);
                                });
                        }
@@ -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;
-               it.killcount = 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(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;
 
@@ -579,7 +583,7 @@ float VoteCommand_checkargs(float startpos, float argc)
        if(cvar_type(cvarname) & CVAR_TYPEFLAG_EXISTS)
                cmdrestriction = cvar_string(cvarname);
        else
-               LOG_INFO("NOTE: ", cvarname, " does not exist, no restrictions will be applied.\n");
+               LOG_INFO("NOTE: ", cvarname, " does not exist, no restrictions will be applied.");
 
        if (cmdrestriction == "") return true;
 
@@ -642,7 +646,7 @@ float VoteCommand_checkargs(float startpos, float argc)
        return true;
 }
 
-float VoteCommand_parse(entity caller, string vote_command, string vote_list, float startpos, float argc)
+int VoteCommand_parse(entity caller, string vote_command, string vote_list, float startpos, float argc)
 {
        string first_command;
 
@@ -657,11 +661,11 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
            (autocvar_sv_vote_limit > 0)
            &&
            (strlen(substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos))) > autocvar_sv_vote_limit)
-          )   return false;
+          )   return 0;
 
-       if (!VoteCommand_checkinlist(first_command, vote_list)) return false;
+       if (!VoteCommand_checkinlist(first_command, vote_list)) return 0;
 
-       if (!VoteCommand_checkargs(startpos, argc)) return false;
+       if (!VoteCommand_checkargs(startpos, argc)) return 0;
 
        switch (first_command) // now go through and parse the proper commands to adjust as needed.
        {
@@ -682,7 +686,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                                vote_parsed_command = strcat(first_command, " # ", ftos(etof(victim)), " ", command_arguments);
                                vote_parsed_display = strcat("^1", vote_command, " (^7", victim.netname, "^1): ", reason);
                        }
-                       else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return false; }
+                       else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return 0; }
 
                        break;
                }
@@ -692,7 +696,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                case "gotomap":  // re-direct all map selection commands to gotomap
                {
                        vote_command = ValidateMap(argv(startpos + 1), caller);
-                       if (!vote_command)   return false;
+                       if (!vote_command)  return -1;
                        vote_parsed_command = strcat("gotomap ", vote_command);
                        vote_parsed_display = strzone(strcat("^1", vote_parsed_command));
 
@@ -708,7 +712,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                }
        }
 
-       return true;
+       return 1;
 }
 
 
@@ -755,6 +759,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                case CMD_REQUEST_COMMAND:
                {
                        float tmp_playercount = 0;
+                       int parse_error;
 
                        vote_command = VoteCommand_extractcommand(vote_command, 2, argc);
 
@@ -787,9 +792,10 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                        {
                                print_to(caller, "^1Syntax error in command, see 'vhelp' for more info.");
                        }
-                       else if (!VoteCommand_parse(caller, vote_command, autocvar_sv_vote_commands, 2, argc))
+                       else if ((parse_error = VoteCommand_parse(caller, vote_command, autocvar_sv_vote_commands, 2, argc)) <= 0)
                        {
-                               print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info.");
+                               if(parse_error == 0)
+                                       print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info.");
                        }
 
                        else  // everything went okay, continue with calling the vote
@@ -808,7 +814,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");
@@ -844,6 +850,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                {
                                        case "do":
                                        {
+                                               int parse_error;
                                                vote_command = VoteCommand_extractcommand(vote_command, 3, argc);
 
                                                if (!caller.vote_master) { print_to(caller, "^1You do not have vote master privelages."); }
@@ -851,9 +858,10 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                                {
                                                        print_to(caller, "^1Syntax error in command, see 'vhelp' for more info.");
                                                }
-                                               else if (!VoteCommand_parse(caller, vote_command, strcat(autocvar_sv_vote_commands, " ", autocvar_sv_vote_master_commands), 3, argc))
+                                               else if ((parse_error = VoteCommand_parse(caller, vote_command, strcat(autocvar_sv_vote_commands, " ", autocvar_sv_vote_master_commands), 3, argc)) <= 0)
                                                {
-                                                       print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info.");
+                                                       if(parse_error == 0)
+                                                               print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info.");
                                                }
 
                                                else  // everything went okay, proceed with command
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..2e2301d0bdec150704ae2b6f297beddbda5870a2 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);
@@ -116,35 +118,23 @@ void target_give_init(entity this)
        {
                if (it.classname == "weapon_rocketlauncher" || it.classname == "weapon_devastator") {
                        this.ammo_rockets += it.count * WEP_CVAR(devastator, ammo);
-                       this.netname = "devastator";
+                       this.netname = cons(this.netname, "devastator");
                }
                else if (it.classname == "weapon_lightning") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(electro, ammo); // WEAPONTODO
-                       if(this.netname == "")
-                               this.netname = "electro";
-                       else
-                               this.netname = strcat(this.netname, " electro");
+                       this.netname = cons(this.netname, "electro");
                }
                else if (it.classname == "weapon_plasmagun") {
                        this.ammo_rockets += it.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
-                       if(this.netname == "")
-                               this.netname = "hagar";
-                       else
-                               this.netname = strcat(this.netname, " hagar");
+                       this.netname = cons(this.netname, "hagar");
                }
                else if (it.classname == "weapon_bfg") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(crylink, ammo);
-                       if(this.netname == "")
-                               this.netname = "crylink";
-                       else
-                               this.netname = strcat(this.netname, " crylink");
+                       this.netname = cons(this.netname, "crylink");
                }
                else if (it.classname == "weapon_grenadelauncher" || it.classname == "weapon_mortar") {
                        this.ammo_rockets += it.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
-                       if(this.netname == "")
-                               this.netname = "mortar";
-                       else
-                               this.netname = strcat(this.netname, " mortar");
+                       this.netname = cons(this.netname, "mortar");
                }
                else if (it.classname == "item_armor_body")
                        this.armorvalue = 100;
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 a6ca911bdc64fe4d5cbe29ae4d8bb149348b349e..4c3b1d221ea4ae73be7f0ff7cc7b7ed5d7b9000f 100644 (file)
@@ -53,7 +53,6 @@ float server_is_dedicated;
 .float count;
 //.float cnt2;
 
-.float play_time;
 .int respawn_flags;
 .float respawn_time;
 .float respawn_time_max;
@@ -131,8 +130,6 @@ float intermission_running;
 float intermission_exittime;
 float alreadychangedlevel;
 
-.float version;
-
 // footstep interval
 .float nextstep;
 
@@ -165,7 +162,7 @@ float default_weapon_alpha;
 .float cvar_cl_clippedspectating;
 .float cvar_cl_autoscreenshot;
 .float cvar_cl_jetpack_jump;
-.float cvar_cl_movement_track_canjump = _STAT(MOVEVARS_CL_TRACK_CANJUMP);
+.float cvar_cl_movement_track_canjump;
 .float cvar_cl_newusekeysupported;
 
 .string cvar_g_xonoticversion;
@@ -179,8 +176,6 @@ float default_weapon_alpha;
 .float cvar_cl_allow_uidtracking;
 .string stored_netname;
 
-.float version_nagtime;
-
 string gamemode_name;
 
 float startitem_failed;
@@ -191,7 +186,7 @@ void FixIntermissionClient(entity e);
 void FixClientCvars(entity e);
 
 // WEAPONTODO: remove this
-WepSet weaponsInMap;
+//WepSet weaponsInMap;
 
 #define weapons _STAT(WEAPONS)
 
@@ -226,13 +221,11 @@ int have_team_spawns_forteams; // if Xth bit is 1 then team X has spawns else it
 
 // set when showing a kill countdown
 .entity killindicator;
-.float killindicator_teamchange;
 
 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
 float lockteams;
 
-.float parm_idlesince;
 float sv_maxidle;
 float sv_maxidle_spectatorsareidle;
 int sv_maxidle_slots;
@@ -247,8 +240,6 @@ float next_pingtime;
 .float cvar_cl_voice_directional;
 .float cvar_cl_voice_directional_taunt_attenuation;
 
-.float version_mismatch;
-
 int autocvar__independent_players;
 bool independent_players;
 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
@@ -265,8 +256,8 @@ string cvar_changes;
 string cvar_purechanges;
 float cvar_purechanges_count;
 
-float game_starttime; //point in time when the countdown to game start is over
-float round_starttime; //point in time when the countdown to round start is over
+//float game_starttime; //point in time when the countdown to game start is over
+//float round_starttime; //point in time when the countdown to round start is over
 
 void W_Porto_Remove (entity p);
 
@@ -279,7 +270,6 @@ void W_Porto_Remove (entity p);
 .float bulletcounter;
 
 // Nexball
-.entity ballcarried; // Also used for keepaway
 float g_nexball_meter_period;
 
 void SUB_DontUseTargets(entity this, entity actor, entity trigger);
@@ -292,14 +282,12 @@ void ClientData_Touch(entity e);
 
 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
 
-.float wasplayer;
+.bool wasplayer;
 
 float servertime, serverprevtime, serverframetime;
 
 .float ammo_fuel;
 
-.vector prevorigin;
-
 //flood fields
 .float nickspamtime; // time of last nick change
 .float nickspamcount;
index 4f428ab1b84defe579d00ae8f5afe84f36f91fa7..8a0223804d473e8d1f3288f235f546bdb7dab84c 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"
@@ -27,7 +28,7 @@
 
 void UpdateFrags(entity player, int f)
 {
-       PlayerTeamScore_AddScore(player, f);
+       GameRules_scoring_add_team(player, SCORE, f);
 }
 
 void GiveFrags (entity attacker, entity targ, float f, int deathtype)
@@ -40,23 +41,23 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
                if(targ == attacker)
                {
                        // suicide
-                       PlayerScore_Add(attacker, SP_SUICIDES, 1);
+                       GameRules_scoring_add(attacker, SUICIDES, 1);
                }
                else
                {
                        // teamkill
-                       PlayerScore_Add(attacker, SP_KILLS, -1); // or maybe add a teamkills field?
+                       GameRules_scoring_add(attacker, KILLS, -1); // or maybe add a teamkills field?
                }
        }
        else
        {
                // regular frag
-               PlayerScore_Add(attacker, SP_KILLS, 1);
+               GameRules_scoring_add(attacker, KILLS, 1);
                if(targ.playerid)
                        PS_GR_P_ADDVAL(attacker, sprintf("kills-%d", targ.playerid), 1);
        }
 
-       PlayerScore_Add(targ, SP_DEATHS, 1);
+       GameRules_scoring_add(targ, DEATHS, 1);
 
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
 
@@ -273,8 +274,8 @@ bool frag_centermessage_override(entity attacker, entity targ, int deathtype, in
 {
        if(deathtype == DEATH_FIRE.m_id)
        {
-               Send_Notification(NOTIF_ONE, attacker, MSG_CHOICE, CHOICE_FRAG_FIRE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? -1 : targ.ping));
-               Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping));
+               Send_Notification(NOTIF_ONE, attacker, MSG_CHOICE, CHOICE_FRAG_FIRE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? -1 : CS(targ).ping));
+               Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping));
                return true;
        }
 
@@ -326,19 +327,19 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                {
                                        case DEATH_MIRRORDAMAGE:
                                        {
-                                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
+                                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
                                                break;
                                        }
 
                                        default:
                                        {
-                                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
+                                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
                                                break;
                                        }
                                }
                        }
                }
-               else if (!Obituary_WeaponDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0))
+               else if (!Obituary_WeaponDeath(targ, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0))
                {
                        backtrace("SUICIDE: what the hell happened here?\n");
                        return;
@@ -358,11 +359,11 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                        LogDeath("tk", deathtype, attacker, targ);
                        GiveFrags(attacker, targ, -1, deathtype);
 
-                       attacker.killcount = 0;
+                       CS(attacker).killcount = 0;
 
                        Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAG, targ.netname);
                        Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAGGED, attacker.netname);
-                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(targ.team, INFO_DEATH_TEAMKILL), targ.netname, attacker.netname, deathlocation, targ.killcount);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(targ.team, INFO_DEATH_TEAMKILL), targ.netname, attacker.netname, deathlocation, CS(targ).killcount);
 
                        // In this case, the death message will ALWAYS be "foo was betrayed by bar"
                        // No need for specific death/weapon messages...
@@ -372,8 +373,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                        LogDeath("frag", deathtype, attacker, targ);
                        GiveFrags(attacker, targ, 1, deathtype);
 
-                       attacker.taunt_soundtime = time + 1;
-                       attacker.killcount = attacker.killcount + 1;
+                       CS(attacker).taunt_soundtime = time + 1;
+                       CS(attacker).killcount = CS(attacker).killcount + 1;
 
                        attacker.killsound += 1;
 
@@ -384,7 +385,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_##counta, 1); \
                                        break; \
                                }
-                       switch(attacker.killcount)
+                       switch(CS(attacker).killcount)
                        {
                                KILL_SPREE_LIST
                                default: break;
@@ -404,7 +405,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                        }
                        else
                        {
-                               kill_count_to_attacker = attacker.killcount;
+                               kill_count_to_attacker = CS(attacker).killcount;
                                kill_count_to_target = 0;
                        }
 
@@ -417,7 +418,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        CHOICE_TYPEFRAG,
                                        targ.netname,
                                        kill_count_to_attacker,
-                                       (IS_BOT_CLIENT(targ) ? -1 : targ.ping)
+                                       (IS_BOT_CLIENT(targ) ? -1 : CS(targ).ping)
                                );
                                Send_Notification(
                                        NOTIF_ONE,
@@ -428,7 +429,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        kill_count_to_target,
                                        attacker.health,
                                        attacker.armorvalue,
-                                       (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping)
+                                       (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
                                );
                        }
                        else if(!frag_centermessage_override(attacker, targ, deathtype, kill_count_to_attacker, kill_count_to_target))
@@ -440,7 +441,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        CHOICE_FRAG,
                                        targ.netname,
                                        kill_count_to_attacker,
-                                       (IS_BOT_CLIENT(targ) ? -1 : targ.ping)
+                                       (IS_BOT_CLIENT(targ) ? -1 : CS(targ).ping)
                                );
                                Send_Notification(
                                        NOTIF_ONE,
@@ -451,7 +452,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        kill_count_to_target,
                                        attacker.health,
                                        attacker.armorvalue,
-                                       (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping)
+                                       (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
                                );
                        }
 
@@ -459,8 +460,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                        if(deathtype == DEATH_BUFF.m_id)
                                f3 = buff_FirstFromFlags(attacker.buffs).m_id;
 
-                       if (!Obituary_WeaponDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker))
-                               Obituary_SpecialDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker, f3);
+                       if (!Obituary_WeaponDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, CS(targ).killcount, kill_count_to_attacker))
+                               Obituary_SpecialDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, CS(targ).killcount, kill_count_to_attacker, f3);
                }
        }
 
@@ -480,7 +481,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        targ.netname,
                                        inflictor.message,
                                        deathlocation,
-                                       targ.killcount,
+                                       CS(targ).killcount,
                                        0,
                                        0);
                                break;
@@ -492,7 +493,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                                        targ.netname,
                                        ((strstrofs(deathmessage, "%", 0) < 0) ? strcat("%s ", deathmessage) : deathmessage),
                                        deathlocation,
-                                       targ.killcount,
+                                       CS(targ).killcount,
                                        0,
                                        0);
                                break;
@@ -500,7 +501,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
 
                        default:
                        {
-                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
+                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
                                break;
                        }
                }
@@ -508,7 +509,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                LogDeath("accident", deathtype, targ, targ);
                GiveFrags(targ, targ, -1, deathtype);
 
-               if(PlayerScore_Add(targ, SP_SCORE, 0) == -5)
+               if(GameRules_scoring_add(targ, SCORE, 0) == -5)
                {
                        Send_Notification(NOTIF_ONE, targ, MSG_ANNCE, ANNCE_ACHIEVEMENT_BOTLIKE);
                        PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1);
@@ -516,7 +517,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
        }
 
        // reset target kill count
-       if(targ.killcount) { targ.killcount = 0; }
+       CS(targ).killcount = 0;
 }
 
 void Ice_Think(entity this)
@@ -622,7 +623,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        float mirrordamage = 0;
        float mirrorforce = 0;
 
-       if (game_stopped || targ.killcount == FRAGS_SPECTATOR)
+       if (game_stopped || (IS_CLIENT(targ) && CS(targ).killcount == FRAGS_SPECTATOR))
                return;
 
        entity attacker_save = attacker;
@@ -785,7 +786,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                                setorigin(targ, spot.origin + '0 0 1' * (1 - targ.mins.z - 24));
                                // don't reset back to last position, even if new position is stuck in solid
                                targ.oldorigin = targ.origin;
-                               targ.prevorigin = targ.origin;
 
                                Send_Effect(EFFECT_TELEPORT, targ.origin, '0 0 0', 1);
                        }
@@ -854,18 +854,18 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                                                }
                                        }
                                }
-                               else
+                               else if(IS_PLAYER(attacker))
                                {
                                        if(deathtype != DEATH_FIRE.m_id)
                                        {
                                                attacker.typehitsound += 1;
                                        }
                                        if(complainteamdamage > 0)
-                                               if(time > attacker.teamkill_complain)
+                                               if(time > CS(attacker).teamkill_complain)
                                                {
-                                                       attacker.teamkill_complain = time + 5;
-                                                       attacker.teamkill_soundtime = time + 0.4;
-                                                       attacker.teamkill_soundsource = targ;
+                                                       CS(attacker).teamkill_complain = time + 5;
+                                                       CS(attacker).teamkill_soundtime = time + 0.4;
+                                                       CS(attacker).teamkill_soundsource = targ;
                                                }
                                }
                        }
@@ -1064,7 +1064,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                                                force = force * a;
 
                                                if(autocvar_g_throughfloor_debug)
-                                                       LOG_INFOF(" D=%f F=%f\n", finaldmg, vlen(force));
+                                                       LOG_INFOF(" D=%f F=%f", finaldmg, vlen(force));
                                        }
 
                                        //if (targ == attacker)
@@ -1267,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))
@@ -1276,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..713577fad17beb0c5d46932b7d845cea4b18cd7e 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"
@@ -83,13 +85,15 @@ void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst
 }
 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
 }
 void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
 {
-       if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false);
 }
@@ -99,13 +103,15 @@ void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, floa
 }
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        WarpZone_traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
 }
 void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
 {
-       if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true);
 }
index 5ad783bbf0f2e157307dfdd1933cf520937374a4..64aa03b5026d5b62f0e24df6fc731389a8b637e9 100644 (file)
@@ -53,21 +53,21 @@ void PingPLReport_Think(entity this)
        this.nextthink = time + delta;
 
        e = edict_num(this.cnt + 1);
-       if(IS_REAL_CLIENT(e))
+       if(IS_CLIENT(e) && IS_REAL_CLIENT(e))
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
                WriteByte(MSG_BROADCAST, this.cnt);
-               WriteShort(MSG_BROADCAST, bound(1, e.ping, 65535));
-               WriteByte(MSG_BROADCAST, min(ceil(e.ping_packetloss * 255), 255));
-               WriteByte(MSG_BROADCAST, min(ceil(e.ping_movementloss * 255), 255));
+               WriteShort(MSG_BROADCAST, bound(1, CS(e).ping, 65535));
+               WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_packetloss * 255), 255));
+               WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_movementloss * 255), 255));
 
                // record latency times for clients throughout the match so we can report it to playerstats
-               if(time > (e.latency_time + LATENCY_THINKRATE))
+               if(time > (CS(e).latency_time + LATENCY_THINKRATE))
                {
-                       e.latency_sum += e.ping;
-                       e.latency_cnt += 1;
-                       e.latency_time = time;
-                       //print("sum: ", ftos(e.latency_sum), ", cnt: ", ftos(e.latency_cnt), ", avg: ", ftos(e.latency_sum / e.latency_cnt), ".\n");
+                       CS(e).latency_sum += CS(e).ping;
+                       CS(e).latency_cnt += 1;
+                       CS(e).latency_time = time;
+                       //print("sum: ", ftos(CS(e).latency_sum), ", cnt: ", ftos(CS(e).latency_cnt), ", avg: ", ftos(CS(e).latency_sum / CS(e).latency_cnt), ".\n");
                }
        }
        else
@@ -135,7 +135,7 @@ void GotoFirstMap(entity this)
        else
        {
                this.nextthink = time + 1;
-               LOG_INFO("Waiting for _sv_init being set to 1 by initialization scripts...\n");
+               LOG_INFO("Waiting for _sv_init being set to 1 by initialization scripts...");
        }
 }
 
@@ -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");
@@ -270,6 +272,7 @@ void cvar_changes_init()
                BADCVAR("g_freezetag");
                BADCVAR("g_freezetag_teams");
                BADCVAR("g_invasion_teams");
+               BADCVAR("g_invasion_type");
                BADCVAR("g_jailbreak");
                BADCVAR("g_jailbreak_teams");
                BADCVAR("g_keepaway");
@@ -529,7 +532,7 @@ void detect_maptype()
                        tracebox(o, '-1 -1 -1' * i, '1 1 1' * i, o - '0 0 32768', MOVE_WORLDONLY, NULL);
        if(trace_fraction == 1)
                continue;
-                       LOG_INFO(ftos(i), " -> ", vtos(trace_endpos), "\n");
+                       LOG_INFO(ftos(i), " -> ", vtos(trace_endpos));
                }
 
                break;
@@ -594,18 +597,6 @@ void __init_dedicated_server_shutdown() {
        MapInfo_Shutdown();
 }
 
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override)
-{
-       if(!autocvar_g_campaign)
-       {
-               if(fraglimit_override >= 0) cvar_set("fraglimit", ftos(fraglimit_override));
-               if(timelimit_override >= 0) cvar_set("timelimit", ftos(timelimit_override));
-               if(leadlimit_override >= 0) cvar_set("leadlimit", ftos(leadlimit_override));
-               if(qualifying_override >= 0) cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override));
-       }
-       limits_are_set = true;
-}
-
 void Map_MarkAsRecent(string m);
 float world_already_spawned;
 void Nagger_Init();
@@ -650,7 +641,7 @@ spawnfunc(worldspawn)
                                fclose(sentinel);
                                if (switchversion != "" && switchversion != WATERMARK)
                                {
-                                       LOG_INFOF("Switching progs: " WATERMARK " -> %s\n", switchversion);
+                                       LOG_INFOF("Switching progs: " WATERMARK " -> %s", switchversion);
                                        // if it doesn't exist, assume either:
                                        //   a) the current program was overwritten
                                        //   b) this is a client only update
@@ -671,7 +662,7 @@ spawnfunc(worldspawn)
                }
                if (wantrestart)
                {
-                       LOG_INFOF("Restart requested\n");
+                       LOG_INFOF("Restart requested");
                        changelevel(mapname);
                        // let initialization continue, shutdown depends on it
                }
@@ -756,8 +747,7 @@ spawnfunc(worldspawn)
        readlevelcvars();
        GrappleHookInit();
 
-       if(!limits_are_set)
-               SetLimits(autocvar_fraglimit_override, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
+    GameRules_limit_fallbacks();
 
        if(warmup_limit == 0)
                warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
@@ -843,23 +833,23 @@ spawnfunc(worldspawn)
                                        continue;
                                if(argv(0) == "cd")
                                {
-                                       LOG_INFO("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n");
-                                       LOG_INFO("  cdtrack ", argv(2), "\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:");
+                                       LOG_INFO("  cdtrack ", argv(2));
                                }
                                else if(argv(0) == "fog")
                                {
-                                       LOG_INFO("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n");
-                                       LOG_INFO("  \"fog\" \"", s, "\"\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:");
+                                       LOG_INFO("  \"fog\" \"", s, "\"");
                                }
                                else if(argv(0) == "set")
                                {
-                                       LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
-                                       LOG_INFO("  clientsettemp_for_type all ", argv(1), " ", argv(2), "\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:");
+                                       LOG_INFO("  clientsettemp_for_type all ", argv(1), " ", argv(2));
                                }
                                else if(argv(0) != "//")
                                {
-                                       LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
-                                       LOG_INFO("  clientsettemp_for_type all ", argv(0), " ", argv(1), "\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:");
+                                       LOG_INFO("  clientsettemp_for_type all ", argv(0), " ", argv(1));
                                }
                        }
                        fclose(fd);
@@ -1328,8 +1318,8 @@ void IntermissionThink(entity this)
 {
        FixIntermissionClient(this);
 
-       float server_screenshot = (autocvar_sv_autoscreenshot && this.cvar_cl_autoscreenshot);
-       float client_screenshot = (this.cvar_cl_autoscreenshot == 2);
+       float server_screenshot = (autocvar_sv_autoscreenshot && CS(this).cvar_cl_autoscreenshot);
+       float client_screenshot = (CS(this).cvar_cl_autoscreenshot == 2);
 
        if( (server_screenshot || client_screenshot)
                && ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) )
@@ -1435,7 +1425,7 @@ void DumpStats(float final)
        s = strcat(s, GetGametype(), "_", GetMapname(), ":", ftos(rint(time)));
 
        if(to_console)
-               LOG_INFO(s, "\n");
+               LOG_INFO(s);
        if(to_eventlog)
                GameLogEcho(s);
 
@@ -1451,33 +1441,33 @@ void DumpStats(float final)
 
        s = strcat(":labels:player:", GetPlayerScoreString(NULL, 0));
        if(to_console)
-               LOG_INFO(s, "\n");
+               LOG_INFO(s);
        if(to_eventlog)
                GameLogEcho(s);
        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 - it.jointime)), ":");
+               s = strcat(s, ftos(rint(time - CS(it).jointime)), ":");
                if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
                        s = strcat(s, ftos(it.team), ":");
                else
                        s = strcat(s, "spectator:");
 
                if(to_console)
-                       LOG_INFO(s, playername(it, false), "\n");
+                       LOG_INFO(s, playername(it, false));
                if(to_eventlog)
                        GameLogEcho(strcat(s, ftos(it.playerid), ":", playername(it, false)));
                if(to_file)
                        fputs(file, strcat(s, playername(it, false), "\n"));
-       ));
+       });
 
        if(teamplay)
        {
                s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
                if(to_console)
-                       LOG_INFO(s, "\n");
+                       LOG_INFO(s);
                if(to_eventlog)
                        GameLogEcho(s);
                if(to_file)
@@ -1488,7 +1478,7 @@ void DumpStats(float final)
                        s = strcat(":teamscores:see-labels:", GetTeamScoreString(i, 0));
                        s = strcat(s, ":", ftos(i));
                        if(to_console)
-                               LOG_INFO(s, "\n");
+                               LOG_INFO(s);
                        if(to_eventlog)
                                GameLogEcho(s);
                        if(to_file)
@@ -1497,7 +1487,7 @@ void DumpStats(float final)
        }
 
        if(to_console)
-               LOG_INFO(":end\n");
+               LOG_INFO(":end");
        if(to_eventlog)
                GameLogEcho(":end");
        if(to_file)
@@ -1528,9 +1518,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 +1570,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();
 
@@ -1596,25 +1586,6 @@ void NextLevel()
        localcmd("\nsv_hook_gameend\n");
 }
 
-/*
-============
-CheckRules_Player
-
-Exit deathmatch games upon conditions
-============
-*/
-void CheckRules_Player(entity this)
-{
-       if (game_stopped) // someone else quit the game already
-               return;
-
-       if(!IS_DEAD(this))
-               this.play_time += frametime;
-
-       // fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
-       //   (div0: and that in CheckRules_World please)
-}
-
 
 float InitiateSuddenDeath()
 {
@@ -1677,22 +1648,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()
@@ -1785,7 +1756,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;
@@ -1793,7 +1764,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,
        {
@@ -1919,13 +1890,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))
+                                       if(GameRules_scoring_add(it, 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
@@ -2145,17 +2116,17 @@ 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");
+               LOG_INFO("Redirecting: sending connect command to ", it.netname);
                if(redirection_target == "self")
                        stuffcmd(it, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
                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");
+       LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.");
 
        if(time > redirection_timeout || clients_found == 0)
                localcmd("\nwait; wait; wait; quit\n");
@@ -2220,7 +2191,7 @@ void Shutdown()
        }
        else if(world_initialized == 0)
        {
-               LOG_INFO("NOTE: crashed before even initializing the world, not saving persistent data\n");
+               LOG_INFO("NOTE: crashed before even initializing the world, not saving persistent data");
        }
        else
        {
index e408974bbe04d3b295b2329c912815b89cb4c1f2..034407bc1f0f135722602b3ba8224e70ca98ea00 100644 (file)
@@ -10,12 +10,8 @@ const int WINNING_YES = 1; // winner found
 const int WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
 const int WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
 
-bool limits_are_set = false;
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
-
 float WinningCondition_Scores(float limit, float leadlimit);
 void SetWinners(.float field, float value);
-void CheckRules_Player(entity this);
 void IntermissionThink(entity this);
 void GotoNextMap(float reinit);
 void ReadyRestart();
index c6e3911a199237277a36ca7377de842c7788c815..56ea478ae2624ed9e766e77e2a8a318412d6a106 100644 (file)
@@ -97,7 +97,7 @@ X(0)
                for(int wepslot = 0; wepslot < MAX_WEAPONSLOTS; ++wepslot) \
                { \
                        .entity weaponentity = weaponentities[wepslot]; \
-                       W_CycleWeapon(this, this.cvar_cl_weaponpriorities[slot], dir, weaponentity); \
+                       W_CycleWeapon(this, CS(this).cvar_cl_weaponpriorities[slot], dir, weaponentity); \
                        if(wepslot == 0 && autocvar_g_weaponswitch_debug != 1) \
                                break; \
                } \
@@ -352,9 +352,9 @@ void ImpulseCommands(entity this)
 {
        if (game_stopped) return;
 
-       int imp = this.impulse;
+       int imp = CS(this).impulse;
        if (!imp) return;
-       this.impulse = 0;
+       CS(this).impulse = 0;
 
        if (MinigameImpulse(this, imp)) return;
 
@@ -652,7 +652,7 @@ IMPULSE(navwaypoint_remove)
 
        if (e.wphardwired)
        {
-               LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired\n");
+               LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired");
                return;
        }
 
@@ -710,27 +710,27 @@ IMPULSE(navwaypoint_unreachable)
        m = 0;
        IL_EACH(g_waypoints, it.wpcost >= 10000000,
        {
-               LOG_INFO("unreachable: ", etos(it), " ", vtos(it.origin), "\n");
+               LOG_INFO("unreachable: ", etos(it), " ", vtos(it.origin));
                it.colormod_z = 8;
                it.effects |= EF_NODEPTHTEST | EF_BLUE;
                ++j;
                ++m;
        });
-       if (j) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)\n", j);
+       if (j) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)", j);
        navigation_markroutes_inverted(e2);
 
        j = 0;
        IL_EACH(g_waypoints, it.wpcost >= 10000000,
        {
-               LOG_INFO("cannot reach me: ", etos(it), " ", vtos(it.origin), "\n");
+               LOG_INFO("cannot reach me: ", etos(it), " ", vtos(it.origin));
                it.colormod_x = 8;
                if (!(it.effects & EF_NODEPTHTEST))  // not already reported before
                        ++m;
                it.effects |= EF_NODEPTHTEST | EF_RED;
                ++j;
        });
-       if (j) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)\n", j);
-       if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
+       if (j) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)", j);
+       if (m) LOG_INFOF("%d waypoints have been marked total", m);
 
        j = 0;
        IL_EACH(g_spawnpoints, true,
@@ -747,7 +747,7 @@ IMPULSE(navwaypoint_unreachable)
                else
                {
                        setorigin(it, org);
-                       LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+                       LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin));
                        it.effects |= EF_NODEPTHTEST;
                        _setmodel(it, this.model);
                        it.frame = this.frame;
@@ -757,7 +757,7 @@ IMPULSE(navwaypoint_unreachable)
                        ++j;
                }
        });
-       if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", j);
+       if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)", j);
 
        j = 0;
        IL_EACH(g_items, true,
@@ -768,21 +768,21 @@ IMPULSE(navwaypoint_unreachable)
        IL_EACH(g_items, true,
        {
                if (navigation_findnearestwaypoint(it, false)) continue;
-               LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+               LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin));
                it.effects |= EF_NODEPTHTEST | EF_RED;
                it.colormod_x = 8;
                ++j;
        });
-       if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", j);
+       if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)", j);
 
        j = 0;
        IL_EACH(g_items, true,
        {
                if (navigation_findnearestwaypoint(it, true)) continue;
-               LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+               LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin));
                it.effects |= EF_NODEPTHTEST | EF_BLUE;
                it.colormod_z = 8;
                ++j;
        });
-       if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)\n", j);
+       if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)", j);
 }
index 50c258f927a8295766d6317d92b6dc138ef2d35d..98dbf5c55b748d5a4d106f8dadec8fc3e29b412f 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"
@@ -91,18 +93,18 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
 
        if(id >= MAX_IPBAN_URIS)
        {
-               LOG_INFO("Received ban list for invalid ID\n");
+               LOG_INFO("Received ban list for invalid ID");
                return;
        }
 
        tokenize_console(autocvar_g_ban_sync_uri);
        uri = argv(id);
 
-       LOG_INFO("Received ban list from ", uri, ": ");
+       string prelude = strcat("Received ban list from ", uri, ": ");
 
        if(OnlineBanList_RequestWaiting[id] == 0)
        {
-               LOG_INFO("rejected (unexpected)\n");
+               LOG_INFO(prelude, "rejected (unexpected)");
                return;
        }
 
@@ -110,14 +112,14 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
 
        if(time > OnlineBanList_Timeout)
        {
-               LOG_INFO("rejected (too late)\n");
+               LOG_INFO(prelude, "rejected (too late)");
                return;
        }
 
        syncinterval = autocvar_g_ban_sync_interval;
        if(syncinterval == 0)
        {
-               LOG_INFO("rejected (syncing disabled)\n");
+               LOG_INFO(prelude, "rejected (syncing disabled)");
                return;
        }
        if(syncinterval > 0)
@@ -125,19 +127,19 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
 
        if(status != 0)
        {
-               LOG_INFO("error: status is ", ftos(status), "\n");
+               LOG_INFO(prelude, "error: status is ", ftos(status));
                return;
        }
 
        if(substring(data, 0, 1) == "<")
        {
-               LOG_INFO("error: received HTML instead of a ban list\n");
+               LOG_INFO(prelude, "error: received HTML instead of a ban list");
                return;
        }
 
        if(strstrofs(data, "\r", 0) != -1)
        {
-               LOG_INFO("error: received carriage returns\n");
+               LOG_INFO(prelude, "error: received carriage returns");
                return;
        }
 
@@ -148,11 +150,11 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
 
        if((n % 4) != 0)
        {
-               LOG_INFO("error: received invalid item count: ", ftos(n), "\n");
+               LOG_INFO(prelude, "error: received invalid item count: ", ftos(n));
                return;
        }
 
-       LOG_INFO("OK, ", ftos(n / 4), " items\n");
+       LOG_INFO(prelude, "OK, ", ftos(n / 4), " items");
 
        for(i = 0; i < n; i += 4)
        {
@@ -175,7 +177,7 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
                        for(j = 0; j < l; ++j)
                                if(strstrofs("0123456789.", substring(ip, j, 1), 0) == -1)
                                {
-                                       LOG_INFO("Invalid character ", substring(ip, j, 1), " in IP address ", ip, ". Skipping this ban.\n");
+                                       LOG_INFO("Invalid character ", substring(ip, j, 1), " in IP address ", ip, ". Skipping this ban.");
                                        goto skip;
                                }
                }
@@ -189,8 +191,7 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
                        // the ban will be prolonged on the next sync
                        // or expire 5 seconds after the next timeout
                Ban_Insert(ip, timeleft, strcat("ban synced from ", serverip, " at ", uri), 0);
-               LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ");
-               LOG_INFO(reason, "\n");
+               LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ", reason);
 
 LABEL(skip)
        }
@@ -328,7 +329,7 @@ void Ban_View()
        float i, n;
        string msg;
 
-       LOG_INFO("^2Listing all existing active bans:\n");
+       LOG_INFO("^2Listing all existing active bans:");
 
        n = 0;
        for(i = 0; i < ban_count; ++i)
@@ -342,10 +343,10 @@ void Ban_View()
                msg = strcat(msg, ban_ip[i], " is still banned for ");
                msg = strcat(msg, ftos(ban_expire[i] - time), " seconds");
 
-               LOG_INFO("  ", msg, "\n");
+               LOG_INFO("  ", msg);
        }
 
-       LOG_INFO("^2Done listing all active (", ftos(n), ") bans.\n");
+       LOG_INFO("^2Done listing all active (", ftos(n), ") bans.");
 }
 
 float Ban_GetClientIP(entity client)
@@ -547,7 +548,7 @@ float Ban_Insert(string ip, float bantime, string reason, float dosync)
        if(i < ban_count)
        if(ban_expire[i] > time + bantime)
        {
-               LOG_INFO(ip, " could not get banned due to no free ban slot\n");
+               LOG_INFO(ip, " could not get banned due to no free ban slot");
                return false;
        }
        // okay, insert our new victim as i
index d33fe87c2e1a477189000119b501b52c6f69c88e..c645c7facdce7515e3021c441bb586fdbfd1375a 100644 (file)
@@ -17,10 +17,10 @@ TODO:
 
 bool item_keys_usekey(entity l, entity p)
 {
-       float valid = l.itemkeys & p.itemkeys;
+       int valid = l.itemkeys & PS(p).itemkeys;
 
        if (!valid) {
-               // other has none of the needed keys
+               // player has none of the needed keys
                return false;
        } else if (l.itemkeys == valid) {
                // ALL needed keys were given
@@ -74,10 +74,10 @@ void item_key_touch(entity this, entity toucher)
                return;
 
        // player already picked up this key
-       if (toucher.itemkeys & this.itemkeys)
+       if (PS(toucher).itemkeys & this.itemkeys)
                return;
 
-       toucher.itemkeys |= this.itemkeys;
+       PS(toucher).itemkeys |= this.itemkeys;
        play2(toucher, this.noise);
 
        centerprint(toucher, this.message);
index 638b40f65e52f18580b46c5ab890e2e3a4fc118b..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"
@@ -7,6 +9,7 @@
 #include <common/net_linked.qh>
 #include "../common/mapinfo.qh"
 #include "../common/playerstats.qh"
+#include <common/state.qh>
 #include "../common/util.qh"
 
 
@@ -99,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()
@@ -453,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)
        {
@@ -594,12 +597,12 @@ 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)
                {
                        it.health = 2342;
-                       it.impulse = 0;
+                       CS(it).impulse = 0;
 
                        msg_entity = it;
                        WriteByte(MSG_ONE, SVC_FINALE);
@@ -610,17 +613,17 @@ void MapVote_Tick()
                if ( !(mapvote_maps_flags[it.mapvote-1] & GTV_AVAILABLE) )
                        it.mapvote = 0;
                // use impulses as new vote
-               if(it.impulse >= 1 && it.impulse <= mapvote_count)
-                       if( mapvote_maps_flags[it.impulse - 1] & GTV_AVAILABLE )
+               if(CS(it).impulse >= 1 && CS(it).impulse <= mapvote_count)
+                       if( mapvote_maps_flags[CS(it).impulse - 1] & GTV_AVAILABLE )
                        {
-                               it.mapvote = it.impulse;
+                               it.mapvote = CS(it).impulse;
                                MapVote_TouchVotes(it);
                        }
-               it.impulse = 0;
+               CS(it).impulse = 0;
 
                if(it.mapvote)
                        ++totalvotes;
-       ));
+       });
 
        MapVote_CheckRules_1(); // just count
 }
index 24f16c487678c3c032ab1ab9ff5dfea0178716b0..7bb8e922d5902a7f03ac9c67b0da27284eb17f12 100644 (file)
@@ -1,4 +1,5 @@
 #include "miscfunctions.qh"
+
 #include "antilag.qh"
 #include "command/common.qh"
 #include "constants.qh"
@@ -33,7 +34,7 @@
 
 void crosshair_trace(entity pl)
 {
-       traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+       traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
 .bool ctrace_solidchanged;
 void crosshair_trace_plusvisibletriggers(entity pl)
@@ -60,7 +61,7 @@ void crosshair_trace_plusvisibletriggers(entity pl)
 }
 void WarpZone_crosshair_trace(entity pl)
 {
-       WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+       WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
 
 
@@ -291,41 +292,41 @@ Called with:
   0:  sends the request
   >0: receives a cvar from name=argv(f) value=argv(f+1)
 */
-void GetCvars_handleString(entity this, string thisname, float f, .string field, string name)
+void GetCvars_handleString(entity this, entity store, string thisname, float f, .string field, string name)
 {
        if (f < 0)
        {
-               if (this.(field))
-                       strunzone(this.(field));
-               this.(field) = string_null;
+               if (store.(field))
+                       strunzone(store.(field));
+               store.(field) = string_null;
        }
        else if (f > 0)
        {
                if (thisname == name)
                {
-                       if (this.(field))
-                               strunzone(this.(field));
-                       this.(field) = strzone(argv(f + 1));
+                       if (store.(field))
+                               strunzone(store.(field));
+                       store.(field) = strzone(argv(f + 1));
                }
        }
        else
                stuffcmd(this, strcat("cl_cmd sendcvar ", name, "\n"));
 }
-void GetCvars_handleString_Fixup(entity this, string thisname, float f, .string field, string name, string(entity, string) func)
+void GetCvars_handleString_Fixup(entity this, entity store, string thisname, float f, .string field, string name, string(entity, string) func)
 {
-       GetCvars_handleString(this, thisname, f, field, name);
+       GetCvars_handleString(this, store, thisname, f, field, name);
        if (f >= 0) // also initialize to the fitting value for "" when sending cvars out
                if (thisname == name)
                {
-                       string s = func(this, strcat1(this.(field)));
-                       if (s != this.(field))
+                       string s = func(this, strcat1(store.(field)));
+                       if (s != store.(field))
                        {
-                               strunzone(this.(field));
-                               this.(field) = strzone(s);
+                               strunzone(store.(field));
+                               store.(field) = strzone(s);
                        }
                }
 }
-void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name)
+void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name)
 {
        if (f < 0)
        {
@@ -333,12 +334,12 @@ void GetCvars_handleFloat(entity this, string thisname, float f, .float field, s
        else if (f > 0)
        {
                if (thisname == name)
-                       this.(field) = stof(argv(f + 1));
+                       store.(field) = stof(argv(f + 1));
        }
        else
                stuffcmd(this, strcat("cl_cmd sendcvar ", name, "\n"));
 }
-void GetCvars_handleFloatOnce(entity this, string thisname, float f, .float field, string name)
+void GetCvars_handleFloatOnce(entity this, entity store, string thisname, float f, .float field, string name)
 {
        if (f < 0)
        {
@@ -347,17 +348,17 @@ void GetCvars_handleFloatOnce(entity this, string thisname, float f, .float fiel
        {
                if (thisname == name)
                {
-                       if (!this.(field))
+                       if (!store.(field))
                        {
-                               this.(field) = stof(argv(f + 1));
-                               if (!this.(field))
-                                       this.(field) = -1;
+                               store.(field) = stof(argv(f + 1));
+                               if (!store.(field))
+                                       store.(field) = -1;
                        }
                }
        }
        else
        {
-               if (!this.(field))
+               if (!store.(field))
                        stuffcmd(this, strcat("cl_cmd sendcvar ", name, "\n"));
        }
 }
@@ -407,7 +408,7 @@ REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
 /**
  * @param f -1: cleanup, 0: request, 1: receive
  */
-void GetCvars(entity this, int f)
+void GetCvars(entity this, entity store, int f)
 {
        string s = string_null;
 
@@ -420,21 +421,21 @@ void GetCvars(entity this, int f)
 
        Notification_GetCvars(this);
 
-       ReplicateVars(this, s, f);
+       ReplicateVars(this, store, s, f);
 
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[2], "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[3], "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[4], "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[5], "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[6], "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[2], "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[3], "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[4], "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[5], "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[6], "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
+       GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
 
-       GetCvars_handleFloat(this, s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
+       GetCvars_handleFloat(this, store, s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
 
        // fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
        if (f > 0)
@@ -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()
@@ -1124,7 +1125,7 @@ void URI_Get_Callback(float id, float status, string data)
        }
        else
        {
-               LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".\n");
+               LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".");
        }
 }
 
index 33d5c14f315020e1aedb5baf860663380a9c9886..1c01a573797713c4fe39345da3f895e60717aad9 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <server/defs.qh>
+
 #include <common/t_items.qh>
 
 #include "mutators/events.qh"
@@ -38,11 +40,11 @@ void play2all(string samp);
 
 void play2team(float t, string filename);
 
-void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name);
+void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name);
 
 float spamsound(entity e, float chan, Sound samp, float vol, float _atten);
 
-void GetCvars_handleString(entity this, string thisname, float f, .string field, string name);
+void GetCvars_handleString(entity this, entity store, string thisname, float f, .string field, string name);
 
 void precache_all_playermodels(string pattern);
 
@@ -73,7 +75,7 @@ void GameLogInit();
 
 void GameLogClose();
 
-void GetCvars(entity this, float f);
+void GetCvars(entity this, entity store, int f);
 
 string GetMapname();
 
@@ -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..5de2a656a927b299c8c691a46b872fbabb74af71 100644 (file)
@@ -1,10 +1,12 @@
 #pragma once
 
+#include <server/miscfunctions.qh>
 #include <server/g_world.qh>
 #include <server/round_handler.qh>
 #include <server/scores.qh>
 #include <server/scores_rules.qh>
 #include <server/teamplay.qh>
+#include <common/gamemodes/rules.qh>
 
 #include "mutator.qh"
 
@@ -90,7 +92,7 @@
 #include <server/weapons/weaponsystem.qh>
 
 #include <common/physics/player.qh>
-#include <common/effects/qc/all.qh>
+#include <common/effects/qc/_mod.qh>
 #include <common/deathtypes/all.qh>
 #include <common/notifications/all.qh>
 #include <common/triggers/teleporters.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..affa033de1da73e3082bd12b1c8925cf7ac85330 100644 (file)
@@ -55,17 +55,17 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
        {
                if(this.enemy.health - this.dmg > 0.5)
                {
-                       PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, this.dmg);
+                       GameRules_scoring_add_team(actor, SCORE, this.dmg);
                        this.enemy.health = this.enemy.health - this.dmg;
                }
                else
                {
-                       PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, this.enemy.health);
-                       PlayerTeamScore_Add(actor, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
+                       GameRules_scoring_add_team(actor, SCORE, this.enemy.health);
+                       GameRules_scoring_add_team(actor, ASSAULT_OBJECTIVES, 1);
                        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);
                }
@@ -429,8 +429,8 @@ void havocbot_goalrating_ast_targets(entity this, float ratingscale)
 
                        this.havocbot_attack_time = 0;
 
-                       if(checkpvs(this.view_ofs,it))
-                       if(checkpvs(this.view_ofs,best))
+                       if(checkpvs(this.origin + this.view_ofs, it))
+                       if(checkpvs(this.origin + this.view_ofs, best))
                        {
                        //      dprint("increasing attack time for this target\n");
                                this.havocbot_attack_time = time + 2;
@@ -614,16 +614,3 @@ MUTATOR_HOOKFUNCTION(as, ReadyRestart_Deny)
        // readyrestart not supported (yet)
        return true;
 }
-
-// scoreboard setup
-void assault_ScoreRules()
-{
-       int teams = 0;
-       teams |= BIT(0);
-       teams |= BIT(1); // always red vs blue
-
-       ScoreRules_basics(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, true);
-       ScoreInfo_SetLabel_TeamScore(  ST_ASSAULT_OBJECTIVES,    "objectives",      SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_ASSAULT_OBJECTIVES,    "objectives",      SFL_SORT_PRIO_PRIMARY);
-       ScoreRules_basics_end();
-}
index 8fd40748543bbcdf5a708845720791f6e6ac5f37..f437d98b52c837c6db59520c37d840660ece1003 100644 (file)
@@ -2,33 +2,20 @@
 
 #include "../gamemode.qh"
 
-void assault_ScoreRules();
+const int ST_ASSAULT_OBJECTIVES = 1;
 
 REGISTER_MUTATOR(as, false)
 {
-       ActivateTeamplay();
-       have_team_spawns = -1; // request team spawns
-
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               assault_ScoreRules();
+        GameRules_teams(true);
+        int teams = BITS(2); // always red vs blue
+        GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, {
+            field_team(ST_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
+            field(SP_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
+        });
        }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back assault_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
        return 0;
 }
 
@@ -55,8 +42,5 @@ void(entity bot) havocbot_ast_reset_role;
 void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
 void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
 
-// scoreboard stuff
-const float ST_ASSAULT_OBJECTIVES = 1;
-
 // predefined spawnfuncs
 void target_objective_decrease_activate(entity this);
index fc06e50e29d73501a0e29d1c35d082325064fec3..159df8a7818edbf5348a6d9ab184fb1227dbaefe 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;
 }
@@ -188,7 +188,7 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
        if (!allowed_to_spawn && IS_PLAYER(player)) // this is true even when player is trying to join
        {
                TRANSMUTE(Observer, player);
-               if (player.jointime != time && !player.caplayer) // not when connecting
+               if (CS(player).jointime != time && !player.caplayer) // not when connecting
                {
                        player.caplayer = 0.5;
                        Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_CA_JOIN_LATE);
@@ -199,7 +199,7 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
 MUTATOR_HOOKFUNCTION(ca, reset_map_players)
 {
        FOREACH_CLIENT(true, {
-               it.killcount = 0;
+               CS(it).killcount = 0;
                if (!it.caplayer && IS_BOT_CLIENT(it))
                {
                        it.team = -1;
@@ -289,7 +289,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
 
        if (!IS_DEAD(player))
                ca_LastPlayerForTeam_Notify(player);
-       if (player.killindicator_teamchange == -2) // player wants to spectate
+       if (CS(player).killindicator_teamchange == -2) // player wants to spectate
                player.caplayer = 0;
        if (player.caplayer)
                player.frags = FRAGS_LMS_LOSER;
@@ -366,7 +366,7 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDamage_SplitHealthArmor)
        float excess = max(0, frag_damage - damage_take - damage_save);
 
        if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
-               PlayerTeamScore_Add(frag_attacker, SP_SCORE, ST_SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
+               GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
 }
 
 MUTATOR_HOOKFUNCTION(ca, PlayerRegen)
index 5aba748fd5348207e81b7dacdbde39288fbde814..0982fcca8fb35e34fd71152cc81815b0282f6b7a 100644 (file)
@@ -21,52 +21,30 @@ bool CA_CheckWinner();
 void CA_RoundStart();
 bool ca_isEliminated(entity e);
 
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
-
 REGISTER_MUTATOR(ca, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               // game loads at time 1
-               if (time > 1) error("This is a game type and it cannot be added at runtime.");
-
-               allowed_to_spawn = true;
+               GameRules_teams(true);
+        GameRules_spawning_teams(autocvar_g_ca_team_spawns);
+        GameRules_limit_score(autocvar_g_ca_point_limit);
+        GameRules_limit_lead(autocvar_g_ca_point_leadlimit);
 
                ca_teams = autocvar_g_ca_teams_override;
                if (ca_teams < 2)
                        ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
-               ca_teams = bound(2, ca_teams, 4);
-
-               int teams = 0;
-               if(ca_teams >= 1) teams |= BIT(0);
-               if(ca_teams >= 2) teams |= BIT(1);
-               if(ca_teams >= 3) teams |= BIT(2);
-               if(ca_teams >= 4) teams |= BIT(3);
 
-               ca_teams = teams; // now set it?
-
-        ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
-        ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
-        ScoreRules_basics_end();
+               ca_teams = BITS(bound(2, ca_teams, 4));
+        GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, {
+            field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
+        });
 
+               allowed_to_spawn = true;
                round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
                round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
-
                EliminatedPlayers_Init(ca_isEliminated);
-
-               ActivateTeamplay();
-               SetLimits(autocvar_g_ca_point_limit, autocvar_g_ca_point_leadlimit, autocvar_timelimit_override, -1);
-
-               if (autocvar_g_ca_team_spawns)
-                       have_team_spawns = -1; // request team spawns
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
        }
-
        return 0;
 }
 
index 595671882b496d0980f500e1e9008847de4cf923..3cf560ebedf752c3fc99b33cfc2aa3248bcaad2b 100644 (file)
@@ -1,42 +1,8 @@
 #include "gamemode_ctf.qh"
 
-#ifndef CSQC
-void ctf_Initialize();
-
-REGISTER_MUTATOR(ctf, false)
-{
-       MUTATOR_ONADD
-       {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               ctf_Initialize();
-
-               ActivateTeamplay();
-               SetLimits(autocvar_capturelimit_override, autocvar_captureleadlimit_override, autocvar_timelimit_override, -1);
-               have_team_spawns = -1; // request team spawns
-       }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back ctf_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
-       return 0;
-}
-#endif
-
-#ifdef SVQC
+#include <common/effects/all.qh>
 #include <common/vehicles/all.qh>
 #include <server/teamplay.qh>
-#endif
 
 #include <lib/warpzone/common.qh>
 
@@ -139,11 +105,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 +118,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)
@@ -277,10 +243,10 @@ bool ctf_CaptureShield_CheckStatus(entity p)
        if(ctf_captureshield_max_ratio <= 0)
                return false;
 
-       s  = PlayerScore_Add(p, SP_CTF_CAPS,    0);
-       s2 = PlayerScore_Add(p, SP_CTF_PICKUPS, 0);
-       s3 = PlayerScore_Add(p, SP_CTF_RETURNS, 0);
-       s4 = PlayerScore_Add(p, SP_CTF_FCKILLS, 0);
+       s  = GameRules_scoring_add(p, CTF_CAPS, 0);
+       s2 = GameRules_scoring_add(p, CTF_PICKUPS, 0);
+       s3 = GameRules_scoring_add(p, CTF_RETURNS, 0);
+       s4 = GameRules_scoring_add(p, CTF_FCKILLS, 0);
 
        sr = ((s - s2) + (s3 + s4));
 
@@ -288,20 +254,20 @@ 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);
-               se2 = PlayerScore_Add(it, SP_CTF_PICKUPS, 0);
-               se3 = PlayerScore_Add(it, SP_CTF_RETURNS, 0);
-               se4 = PlayerScore_Add(it, SP_CTF_FCKILLS, 0);
+               se  = GameRules_scoring_add(it, CTF_CAPS, 0);
+               se2 = GameRules_scoring_add(it, CTF_PICKUPS, 0);
+               se3 = GameRules_scoring_add(it, CTF_RETURNS, 0);
+               se4 = GameRules_scoring_add(it, CTF_FCKILLS, 0);
 
                ser = ((se - se2) + (se3 + se4));
 
                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
@@ -386,8 +352,8 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype)
        ctf_EventLog("dropped", player.team, player);
 
        // scoring
-       PlayerTeamScore_AddScore(player, -((flag.score_drop) ? flag.score_drop : autocvar_g_ctf_score_penalty_drop));
-       PlayerScore_Add(player, SP_CTF_DROPS, 1);
+       GameRules_scoring_add_team(player, SCORE, -((flag.score_drop) ? flag.score_drop : autocvar_g_ctf_score_penalty_drop));
+       GameRules_scoring_add(player, CTF_DROPS, 1);
 
        // waypoints
        if(autocvar_g_ctf_flag_dropped_waypoint) {
@@ -418,6 +384,7 @@ void ctf_Handle_Retrieve(entity flag, entity player)
        // transfer flag to player
        flag.owner = player;
        flag.owner.flagcarried = flag;
+       GameRules_scoring_vip(player, true);
 
        // reset flag
        if(player.vehicle)
@@ -441,14 +408,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);
@@ -475,6 +442,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype)
        setattachment(flag, NULL, "");
        setorigin(flag, player.origin + FLAG_DROP_OFFSET);
        flag.owner.flagcarried = NULL;
+       GameRules_scoring_vip(flag.owner, false);
        flag.owner = NULL;
        flag.solid = SOLID_TRIGGER;
        flag.ctf_dropper = player;
@@ -601,16 +569,16 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
        float pscore = 0;
        if(enemy_flag.score_capture || flag.score_capture)
                pscore = floor((max(1, enemy_flag.score_capture) + max(1, flag.score_capture)) * 0.5);
-       PlayerTeamScore_AddScore(player, ((pscore) ? pscore : autocvar_g_ctf_score_capture));
+       GameRules_scoring_add_team(player, SCORE, ((pscore) ? pscore : autocvar_g_ctf_score_capture));
        float capscore = 0;
        if(enemy_flag.score_team_capture || flag.score_team_capture)
                capscore = floor((max(1, enemy_flag.score_team_capture) + max(1, flag.score_team_capture)) * 0.5);
-       PlayerTeamScore_Add(player, SP_CTF_CAPS, ST_CTF_CAPS, ((capscore) ? capscore : 1));
+       GameRules_scoring_add_team(player, CTF_CAPS, ((capscore) ? capscore : 1));
 
-       old_time = PlayerScore_Add(player, SP_CTF_CAPTIME, 0);
+       old_time = GameRules_scoring_add(player, CTF_CAPTIME, 0);
        new_time = TIME_ENCODE(time - enemy_flag.ctf_pickuptime);
        if(!old_time || new_time < old_time)
-               PlayerScore_Add(player, SP_CTF_CAPTIME, new_time - old_time);
+               GameRules_scoring_add(player, CTF_CAPTIME, new_time - old_time);
 
        // effects
        Send_Effect_(flag.capeffect, flag.origin, '0 0 0', 1);
@@ -623,7 +591,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
                if(flag.speedrunning) { ctf_FakeTimeLimit(player, -1); }
 
                if((enemy_flag.ctf_dropper) && (player != enemy_flag.ctf_dropper))
-                       { PlayerTeamScore_AddScore(enemy_flag.ctf_dropper, ((enemy_flag.score_assist) ? enemy_flag.score_assist : autocvar_g_ctf_score_capture_assist)); }
+                       { GameRules_scoring_add_team(enemy_flag.ctf_dropper, SCORE, ((enemy_flag.score_assist) ? enemy_flag.score_assist : autocvar_g_ctf_score_capture_assist)); }
        }
 
        // reset the flag
@@ -649,8 +617,8 @@ void ctf_Handle_Return(entity flag, entity player)
        // scoring
        if(IS_PLAYER(player))
        {
-               PlayerTeamScore_AddScore(player, ((flag.score_return) ? flag.score_return : autocvar_g_ctf_score_return)); // reward for return
-               PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns
+               GameRules_scoring_add_team(player, SCORE, ((flag.score_return) ? flag.score_return : autocvar_g_ctf_score_return)); // reward for return
+               GameRules_scoring_add(player, CTF_RETURNS, 1); // add to count of returns
 
                nades_GiveBonus(player,autocvar_g_nades_bonus_score_medium);
        }
@@ -659,7 +627,7 @@ void ctf_Handle_Return(entity flag, entity player)
 
        if(flag.ctf_dropper)
        {
-               PlayerScore_Add(flag.ctf_dropper, SP_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the player who dropped the flag
+               GameRules_scoring_add(flag.ctf_dropper, SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the player who dropped the flag
                ctf_CaptureShield_Update(flag.ctf_dropper, 0); // shield player from picking up flag
                flag.ctf_dropper.next_take_time = time + autocvar_g_ctf_flag_collect_delay; // set next take time
        }
@@ -680,6 +648,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        // attach the flag to the player
        flag.owner = player;
        player.flagcarried = flag;
+       GameRules_scoring_vip(player, true);
        if(player.vehicle)
        {
                setattachment(flag, player.vehicle, "");
@@ -720,27 +689,27 @@ 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);
 
        // scoring
-       PlayerScore_Add(player, SP_CTF_PICKUPS, 1);
+       GameRules_scoring_add(player, CTF_PICKUPS, 1);
        nades_GiveBonus(player, autocvar_g_nades_bonus_score_minor);
        switch(pickuptype)
        {
                case PICKUP_BASE:
                {
-                       PlayerTeamScore_AddScore(player, ((flag.score_pickup) ? flag.score_pickup : autocvar_g_ctf_score_pickup_base));
+                       GameRules_scoring_add_team(player, SCORE, ((flag.score_pickup) ? flag.score_pickup : autocvar_g_ctf_score_pickup_base));
                        ctf_EventLog("steal", flag.team, player);
                        break;
                }
@@ -750,7 +719,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
                        pickup_dropped_score = (autocvar_g_ctf_flag_return_time ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_return_time) - time) / autocvar_g_ctf_flag_return_time, 1) : 1);
                        pickup_dropped_score = floor((autocvar_g_ctf_score_pickup_dropped_late * (1 - pickup_dropped_score) + autocvar_g_ctf_score_pickup_dropped_early * pickup_dropped_score) + 0.5);
                        LOG_TRACE("pickup_dropped_score is ", ftos(pickup_dropped_score));
-                       PlayerTeamScore_AddScore(player, pickup_dropped_score);
+                       GameRules_scoring_add_team(player, SCORE, pickup_dropped_score);
                        ctf_EventLog("pickup", flag.team, player);
                        break;
                }
@@ -795,7 +764,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 +850,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 +888,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
@@ -994,7 +963,7 @@ void ctf_FlagThink(entity this)
                                this.health = 0;
                                ctf_CheckFlagReturn(this, RETURN_SPEEDRUN);
 
-                               this.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
+                               CS(this.owner).impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
                                ImpulseCommands(this.owner);
                        }
                        if(autocvar_g_ctf_stalemate)
@@ -1166,6 +1135,7 @@ void ctf_RespawnFlag(entity flag)
                WaypointSprite_Kill(flag.wps_flagcarrier);
 
                flag.owner.flagcarried = NULL;
+               GameRules_scoring_vip(flag.owner, false);
 
                if(flag.speedrunning)
                        ctf_FakeTimeLimit(flag.owner, -1);
@@ -1458,13 +1428,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 +1613,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 +1968,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))
@@ -2169,8 +2139,8 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerDies)
 
        if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)) && (frag_target.flagcarried))
        {
-               PlayerTeamScore_AddScore(frag_attacker, ((SAME_TEAM(frag_attacker, frag_target)) ? -autocvar_g_ctf_score_kill : autocvar_g_ctf_score_kill));
-               PlayerScore_Add(frag_attacker, SP_CTF_FCKILLS, 1);
+               GameRules_scoring_add_team(frag_attacker, SCORE, ((SAME_TEAM(frag_attacker, frag_target)) ? -autocvar_g_ctf_score_kill : autocvar_g_ctf_score_kill));
+               GameRules_scoring_add(frag_attacker, CTF_FCKILLS, 1);
        }
 
        if(frag_target.flagcarried)
@@ -2237,7 +2207,7 @@ MUTATOR_HOOKFUNCTION(ctf, GetPressedKeys)
 
        entity player = M_ARGV(0, entity);
 
-       if(player.cvar_cl_allow_uidtracking == 1 && player.cvar_cl_allow_uid2name == 1)
+       if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
        {
                if (!player.stored_netname)
                        player.stored_netname = strzone(uid2name(player.crypto_idfp));
@@ -2525,7 +2495,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 +2503,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);
@@ -2689,15 +2659,15 @@ spawnfunc(team_CTL_bluelolly)  { spawnfunc_item_flag_team2(this);    }
 void ctf_ScoreRules(int teams)
 {
        CheckAllowedTeams(NULL);
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
-       ScoreInfo_SetLabel_TeamScore  (ST_CTF_CAPS,     "caps",      SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPS,    "caps",      SFL_SORT_PRIO_SECONDARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPTIME, "captime",   SFL_LOWER_IS_BETTER | SFL_TIME);
-       ScoreInfo_SetLabel_PlayerScore(SP_CTF_PICKUPS, "pickups",   0);
-       ScoreInfo_SetLabel_PlayerScore(SP_CTF_FCKILLS, "fckills",   0);
-       ScoreInfo_SetLabel_PlayerScore(SP_CTF_RETURNS, "returns",   0);
-       ScoreInfo_SetLabel_PlayerScore(SP_CTF_DROPS,   "drops",     SFL_LOWER_IS_BETTER);
-       ScoreRules_basics_end();
+       GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+        field_team(ST_CTF_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
+        field(SP_CTF_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+        field(SP_CTF_CAPTIME, "captime", SFL_LOWER_IS_BETTER | SFL_TIME);
+        field(SP_CTF_PICKUPS, "pickups", 0);
+        field(SP_CTF_FCKILLS, "fckills", 0);
+        field(SP_CTF_RETURNS, "returns", 0);
+        field(SP_CTF_DROPS, "drops", SFL_LOWER_IS_BETTER);
+       });
 }
 
 // code from here on is just to support maps that don't have flag and team entities
index 8ef860846e45d08077bbcc14259f77484dab207c..0b86a57f809936604fd51a5514b899108558dcac 100644 (file)
@@ -3,6 +3,23 @@
 #ifdef SVQC
 
 #include "../gamemode.qh"
+
+void ctf_Initialize();
+
+REGISTER_MUTATOR(ctf, false)
+{
+    MUTATOR_STATIC();
+    MUTATOR_ONADD
+    {
+        GameRules_teams(true);
+        GameRules_limit_score(autocvar_capturelimit_override);
+        GameRules_limit_lead(autocvar_captureleadlimit_override);
+
+        ctf_Initialize();
+    }
+    return 0;
+}
+
 // used in cheats.qc
 void ctf_RespawnFlag(entity flag);
 
index ee8c221e5b9184fdbfab1ad2c38f5acd80a36cb3..20f4b383d11296c1c2265dd5e65e9550762ea954 100644 (file)
@@ -32,18 +32,16 @@ void havocbot_role_cts(entity this)
 
 void cts_ScoreRules()
 {
-       ScoreRules_basics(0, 0, 0, false);
-       if(g_race_qualifying)
-       {
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
-       }
-       else
-       {
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME,    "time",      SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_LOWER_IS_BETTER | SFL_TIME);
-       }
-       ScoreRules_basics_end();
+    GameRules_score_enabled(false);
+    GameRules_scoring(0, 0, 0, {
+        if (g_race_qualifying) {
+            field(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+        } else {
+            field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+            field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+            field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
+        }
+    });
 }
 
 void cts_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
@@ -98,8 +96,8 @@ MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
-       wishvel.x = fabs(player.movement.x);
-       wishvel.y = fabs(player.movement.y);
+       wishvel.x = fabs(CS(player).movement.x);
+       wishvel.y = fabs(CS(player).movement.y);
        if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
                wishvel.z = 0;
@@ -107,32 +105,32 @@ MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
                if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
-                       if(player.movement.x > 0)
-                               player.movement_x = wishspeed;
+                       if(CS(player).movement.x > 0)
+                               CS(player).movement_x = wishspeed;
                        else
-                               player.movement_x = -wishspeed;
-                       player.movement_y = 0;
+                               CS(player).movement_x = -wishspeed;
+                       CS(player).movement_y = 0;
                }
                else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
-                       player.movement_x = 0;
-                       if(player.movement.y > 0)
-                               player.movement_y = wishspeed;
+                       CS(player).movement_x = 0;
+                       if(CS(player).movement.y > 0)
+                               CS(player).movement_y = wishspeed;
                        else
-                               player.movement_y = -wishspeed;
+                               CS(player).movement_y = -wishspeed;
                }
                else
                {
                        // diagonal
-                       if(player.movement.x > 0)
-                               player.movement_x = M_SQRT1_2 * wishspeed;
+                       if(CS(player).movement.x > 0)
+                               CS(player).movement_x = M_SQRT1_2 * wishspeed;
                        else
-                               player.movement_x = -M_SQRT1_2 * wishspeed;
-                       if(player.movement.y > 0)
-                               player.movement_y = M_SQRT1_2 * wishspeed;
+                               CS(player).movement_x = -M_SQRT1_2 * wishspeed;
+                       if(CS(player).movement.y > 0)
+                               CS(player).movement_y = M_SQRT1_2 * wishspeed;
                        else
-                               player.movement_y = -M_SQRT1_2 * wishspeed;
+                               CS(player).movement_y = -M_SQRT1_2 * wishspeed;
                }
        }
 }
@@ -146,15 +144,15 @@ 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);
+                       s = GameRules_scoring_add(it, RACE_FASTEST, 0);
                        if(!s)
                                it.race_place = 0;
                }
                cts_EventLog(ftos(it.race_place), it);
-       ));
+       });
 
        if(g_race_qualifying == 2)
        {
@@ -206,7 +204,7 @@ MUTATOR_HOOKFUNCTION(cts, MakePlayerObserver)
 {
        entity player = M_ARGV(0, entity);
 
-       if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+       if(GameRules_scoring_add(player, RACE_FASTEST, 0))
                player.frags = FRAGS_LMS_LOSER;
        else
                player.frags = FRAGS_SPECTATOR;
@@ -238,7 +236,7 @@ MUTATOR_HOOKFUNCTION(cts, PutClientInServer)
        if(IS_PLAYER(player))
        if(!game_stopped)
        {
-               if(player.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
+               if(CS(player).killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
                        race_PreparePlayer(player);
                else // respawn
                        race_RetractPlayer(player);
@@ -267,7 +265,7 @@ MUTATOR_HOOKFUNCTION(cts, GetPressedKeys)
 {
        entity player = M_ARGV(0, entity);
 
-       if(player.cvar_cl_allow_uidtracking == 1 && player.cvar_cl_allow_uid2name == 1)
+       if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
        {
                if (!player.stored_netname)
                        player.stored_netname = strzone(uid2name(player.crypto_idfp));
index 2a18fe915d4ad85f8999022d834452fb9ef0ff60..c90919e6f4e7ed176c2740a63c6a4bb9c10575c8 100644 (file)
@@ -7,31 +7,16 @@ void cts_Initialize();
 
 REGISTER_MUTATOR(cts, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-
                g_race_qualifying = true;
                independent_players = 1;
-               SetLimits(0, 0, autocvar_timelimit_override, -1);
+        GameRules_limit_score(0);
+        GameRules_limit_lead(0);
 
                cts_Initialize();
        }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back cts_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
        return 0;
 }
 
index d3cc197eafd40efd5ed884c50713e23f746223a8..f45b0800f39d8cfefb0f30ed49f59ab81256d46c 100644 (file)
@@ -4,24 +4,6 @@
 
 REGISTER_MUTATOR(dm, false)
 {
-       MUTATOR_ONADD
-       {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-       }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back dm_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               error("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
+    MUTATOR_STATIC();
        return 0;
 }
index cffb60cb122f51a7eb0ddb22a36c3c3e1bea742c..be38553c9588bcd4ba1bfd79042432f79aebd583 100644 (file)
@@ -64,7 +64,7 @@ void dompoint_captured(entity this)
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, this.message, points, wait_time);
 
        if(this.enemy.playerid == this.enemy_playerid)
-               PlayerScore_Add(this.enemy, SP_DOM_TAKES, 1);
+               GameRules_scoring_add(this.enemy, DOM_TAKES, 1);
        else
                this.enemy = NULL;
 
@@ -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)
@@ -176,8 +176,8 @@ void dompointthink(entity this)
                // give credit to the individual player, if he is still there
                if (this.enemy.playerid == this.enemy_playerid)
                {
-                       PlayerScore_Add(this.enemy, SP_SCORE, fragamt);
-                       PlayerScore_Add(this.enemy, SP_DOM_TICKS, fragamt);
+                       GameRules_scoring_add(this.enemy, SCORE, fragamt);
+                       GameRules_scoring_add(this.enemy, DOM_TICKS, fragamt);
                }
                else
                        this.enemy = NULL;
@@ -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;
 }
 
@@ -559,10 +559,10 @@ void ScoreRules_dom(int teams)
 {
        if(domination_roundbased)
        {
-               ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
-               ScoreInfo_SetLabel_TeamScore  (ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
-               ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
-               ScoreRules_basics_end();
+           GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+            field_team(ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
+            field(SP_DOM_TAKES, "takes", 0);
+           });
        }
        else
        {
@@ -572,11 +572,11 @@ void ScoreRules_dom(int teams)
                        sp_domticks = SFL_SORT_PRIO_PRIMARY;
                else
                        sp_score = SFL_SORT_PRIO_PRIMARY;
-               ScoreRules_basics(teams, sp_score, sp_score, true);
-               ScoreInfo_SetLabel_TeamScore  (ST_DOM_TICKS,    "ticks",     sp_domticks);
-               ScoreInfo_SetLabel_PlayerScore(SP_DOM_TICKS,    "ticks",     sp_domticks);
-               ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES,    "takes",     0);
-               ScoreRules_basics_end();
+               GameRules_scoring(teams, sp_score, sp_score, {
+            field_team(ST_DOM_TICKS, "ticks", sp_domticks);
+            field(SP_DOM_TICKS, "ticks", sp_domticks);
+            field(SP_DOM_TAKES, "takes", 0);
+               });
        }
 }
 
index 609fcfd0d9f01c91afbe25566948f75f96626219..cf5e54f6d53d00946779e981aee6db592cc83c0e 100644 (file)
@@ -11,27 +11,19 @@ void dom_Initialize();
 
 REGISTER_MUTATOR(dom, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               dom_Initialize();
-
                int fraglimit_override = autocvar_g_domination_point_limit;
                if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
                        fraglimit_override = autocvar_g_domination_roundbased_point_limit;
 
-               ActivateTeamplay();
-               SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, autocvar_timelimit_override, -1);
-               have_team_spawns = -1; // request team spawns
-       }
+               GameRules_teams(true);
+        GameRules_limit_score(fraglimit_override);
+        GameRules_limit_lead(autocvar_g_domination_point_leadlimit);
 
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               dom_Initialize();
        }
-
        return 0;
 }
 
index 1d6e1c1ff63129fdad35064ea91021e2b4534af0..88afaa755d7b9f995419411e912d431b7d4ec166 100644 (file)
@@ -7,17 +7,10 @@ float autocvar_g_freezetag_round_timelimit;
 int autocvar_g_freezetag_teams_override;
 float autocvar_g_freezetag_warmup;
 
-void freezetag_ScoreRules(int teams)
-{
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true); // SFL_SORT_PRIO_PRIMARY
-       ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS, "revivals", 0);
-       ScoreRules_basics_end();
-}
-
 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 +18,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 +99,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 +124,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 +137,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 +145,7 @@ entity freezetag_LastPlayerForTeam(entity this)
                        last_pl = it;
                else
                        return NULL;
-       ));
+       });
        return last_pl;
 }
 
@@ -173,14 +166,14 @@ void freezetag_Add_Score(entity targ, entity attacker)
        {
                // you froze your own dumb targ
                // counted as "suicide" already
-               PlayerScore_Add(targ, SP_SCORE, -1);
+               GameRules_scoring_add(targ, SCORE, -1);
        }
        else if(IS_PLAYER(attacker))
        {
                // got frozen by an enemy
                // counted as "kill" and "death" already
-               PlayerScore_Add(targ, SP_SCORE, -1);
-               PlayerScore_Add(attacker, SP_SCORE, +1);
+               GameRules_scoring_add(targ, SCORE, -1);
+               GameRules_scoring_add(attacker, SCORE, +1);
        }
        // else nothing - got frozen by the game type rules themselves
 }
@@ -226,7 +219,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 +233,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 +246,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 +409,12 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(ft, reset_map_players)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-               it.killcount = 0;
+       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 +447,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 +459,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
                                        it.reviving = true;
                                ++n;
                        }
-               ));
+               });
 
        }
 
@@ -488,21 +481,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(
-                               PlayerScore_Add(it, SP_FREEZETAG_REVIVALS, +1);
-                               PlayerScore_Add(it, SP_SCORE, +1);
+                       FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
+                               GameRules_scoring_add(it, FREEZETAG_REVIVALS, +1);
+                               GameRules_scoring_add(it, 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
        {
@@ -568,8 +561,8 @@ MUTATOR_HOOKFUNCTION(ft, FragCenterMessage)
        if(STAT(FROZEN, frag_target))
                return; // target was already frozen, so this is just pushing them off the cliff
 
-       Send_Notification(NOTIF_ONE, frag_attacker, MSG_CHOICE, CHOICE_FRAG_FREEZE, frag_target.netname, kill_count_to_attacker, (IS_BOT_CLIENT(frag_target) ? -1 : frag_target.ping));
-       Send_Notification(NOTIF_ONE, frag_target, MSG_CHOICE, CHOICE_FRAGGED_FREEZE, frag_attacker.netname, kill_count_to_target, frag_attacker.health, frag_attacker.armorvalue, (IS_BOT_CLIENT(frag_attacker) ? -1 : frag_attacker.ping));
+       Send_Notification(NOTIF_ONE, frag_attacker, MSG_CHOICE, CHOICE_FRAG_FREEZE, frag_target.netname, kill_count_to_attacker, (IS_BOT_CLIENT(frag_target) ? -1 : CS(frag_target).ping));
+       Send_Notification(NOTIF_ONE, frag_target, MSG_CHOICE, CHOICE_FRAGGED_FREEZE, frag_attacker.netname, kill_count_to_target, frag_attacker.health, frag_attacker.armorvalue, (IS_BOT_CLIENT(frag_attacker) ? -1 : CS(frag_attacker).ping));
 
        return true;
 }
@@ -579,16 +572,11 @@ void freezetag_Initialize()
        freezetag_teams = autocvar_g_freezetag_teams_override;
        if(freezetag_teams < 2)
                freezetag_teams = cvar("g_freezetag_teams"); // read the cvar directly as it gets written earlier in the same frame
-       freezetag_teams = bound(2, freezetag_teams, 4);
-
-       int teams = 0;
-       if(freezetag_teams >= 1) teams |= BIT(0);
-       if(freezetag_teams >= 2) teams |= BIT(1);
-       if(freezetag_teams >= 3) teams |= BIT(2);
-       if(freezetag_teams >= 4) teams |= BIT(3);
 
-       freezetag_teams = teams; // now set it?
-       freezetag_ScoreRules(freezetag_teams);
+       freezetag_teams = BITS(bound(2, freezetag_teams, 4));
+       GameRules_scoring(freezetag_teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {
+           field(SP_FREEZETAG_REVIVALS, "revivals", 0);
+       });
 
        round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
        round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
index fda0737dd92e1ced1bb5b32923197628fa62dadb..a258d82eab508576040c5e27f1b8431657772d8b 100644 (file)
@@ -9,32 +9,16 @@ void freezetag_Initialize();
 
 REGISTER_MUTATOR(ft, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               freezetag_Initialize();
-
-               ActivateTeamplay();
-               SetLimits(autocvar_g_freezetag_point_limit, autocvar_g_freezetag_point_leadlimit, autocvar_timelimit_override, -1);
-
-               if (autocvar_g_freezetag_team_spawns)
-                       have_team_spawns = -1; // request team spawns
-       }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back freezetag_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
+               GameRules_teams(true);
+        GameRules_spawning_teams(autocvar_g_freezetag_team_spawns);
+        GameRules_limit_score(autocvar_g_freezetag_point_limit);
+        GameRules_limit_lead(autocvar_g_freezetag_point_leadlimit);
 
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               freezetag_Initialize();
        }
-
        return 0;
 }
 
index 05a89c75df6e23a2ce7d3e059a1bb637bfc4efcc..1b8b77ae078158e566fb34a87c754701436175d3 100644 (file)
@@ -5,6 +5,9 @@
 
 #include <server/teamplay.qh>
 
+IntrusiveList g_invasion_roundends;
+STATIC_INIT(g_invasion_roundends) { g_invasion_roundends = IL_NEW(); }
+
 IntrusiveList g_invasion_waves;
 STATIC_INIT(g_invasion_waves) { g_invasion_waves = IL_NEW(); }
 
@@ -18,10 +21,46 @@ int autocvar_g_invasion_monster_count;
 bool autocvar_g_invasion_zombies_only;
 float autocvar_g_invasion_spawn_delay;
 
+bool victent_present;
+.bool inv_endreached;
+
 bool inv_warning_shown; // spammy
 
 .string spawnmob;
 
+void target_invasion_roundend_use(entity this, entity actor, entity trigger)
+{
+       if(!IS_PLAYER(actor)) { return; }
+
+       actor.inv_endreached = true;
+
+       int plnum = 0;
+       int realplnum = 0;
+       // let's not count bots
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
+               ++realplnum;
+               if(it.inv_endreached)
+                       ++plnum;
+       });
+       if(plnum < ceil(realplnum * min(1, this.count))) // 70% of players
+               return;
+
+       this.winning = true;
+}
+
+spawnfunc(target_invasion_roundend)
+{
+       if(!g_invasion) { delete(this); return; }
+
+       victent_present = true; // a victory entity is present, we don't need to rely on monster count TODO: merge this with the intrusive list (can check empty)
+
+       if(!this.count) { this.count = 0.7; } // require at least 70% of the players to reach the end before triggering victory
+
+       this.use = target_invasion_roundend_use;
+
+       IL_PUSH(g_invasion_roundends, this);
+}
+
 spawnfunc(invasion_wave)
 {
        if(!g_invasion) { delete(this); return; }
@@ -37,6 +76,60 @@ spawnfunc(invasion_spawnpoint)
        IL_PUSH(g_invasion_spawns, this);
 }
 
+void ClearWinners();
+
+// Invasion stage mode winning condition: If the attackers triggered a round end (by fulfilling all objectives)
+// they win.
+int WinningCondition_Invasion()
+{
+       WinningConditionHelper(NULL); // set worldstatus
+
+       int status = WINNING_NO;
+
+       if(autocvar_g_invasion_type == INV_TYPE_STAGE)
+       {
+               SetWinners(inv_endreached, true);
+
+               int found = 0;
+               IL_EACH(g_invasion_roundends, true,
+               {
+                       ++found;
+                       if(it.winning)
+                       {
+                               bprint("Invasion: round completed.\n");
+                               // winners already set (TODO: teamplay support)
+
+                               status = WINNING_YES;
+                               break;
+                       }
+               });
+
+               if(!found)
+                       status = WINNING_YES; // just end it? TODO: should warn mapper!
+       }
+       else if(autocvar_g_invasion_type == INV_TYPE_HUNT)
+       {
+               ClearWinners();
+
+               int found = 0; // NOTE: this ends the round if no monsters are placed
+               IL_EACH(g_monsters, !(it.spawnflags & MONSTERFLAG_RESPAWNED),
+               {
+                       ++found;
+               });
+
+               if(found <= 0)
+               {
+                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it),
+                       {
+                               it.winning = true;
+                       });
+                       status = WINNING_YES;
+               }
+       }
+
+       return status;
+}
+
 Monster invasion_PickMonster(int supermonster_count)
 {
        RandomSelection_Init();
@@ -252,14 +345,14 @@ bool Invasion_CheckWinner()
        }
        else
        {
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-                       float cs = PlayerScore_Add(it, SP_KILLS, 0);
+               FOREACH_CLIENT(IS_PLAYER(it), {
+                       float cs = GameRules_scoring_add(it, KILLS, 0);
                        if(cs > winning_score)
                        {
                                winning_score = cs;
                                winner = it;
                        }
-               ));
+               });
        }
 
        IL_EACH(g_monsters, true,
@@ -295,10 +388,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
@@ -328,16 +421,19 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies)
 
        if(!(frag_target.spawnflags & MONSTERFLAG_RESPAWNED))
        {
-               inv_numkilled += 1;
-               inv_maxcurrent -= 1;
+               if(autocvar_g_invasion_type == INV_TYPE_ROUND)
+               {
+                       inv_numkilled += 1;
+                       inv_maxcurrent -= 1;
+               }
                if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; }
 
                if(IS_PLAYER(frag_attacker))
                if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
-                       PlayerScore_Add(frag_attacker, SP_KILLS, -1);
+                       GameRules_scoring_add(frag_attacker, KILLS, -1);
                else
                {
-                       PlayerScore_Add(frag_attacker, SP_KILLS, +1);
+                       GameRules_scoring_add(frag_attacker, KILLS, +1);
                        if(teamplay)
                                TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1);
                }
@@ -347,6 +443,10 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies)
 MUTATOR_HOOKFUNCTION(inv, MonsterSpawn)
 {
        entity mon = M_ARGV(0, entity);
+       mon.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
+
+       if(autocvar_g_invasion_type == INV_TYPE_HUNT)
+               return false; // allowed
 
        if(!(mon.spawnflags & MONSTERFLAG_SPAWNED))
                return true;
@@ -361,29 +461,20 @@ MUTATOR_HOOKFUNCTION(inv, MonsterSpawn)
 
        if((get_monsterinfo(mon.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, mon.monster_name);
-
-       mon.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
-}
-
-MUTATOR_HOOKFUNCTION(inv, OnEntityPreSpawn)
-{
-       entity ent = M_ARGV(0, entity);
-
-       // TODO: allow these as "rogues" or something
-       if(startsWith(ent.classname, "monster_"))
-       if(!(ent.spawnflags & MONSTERFLAG_SPAWNED))
-               return true;
 }
 
 MUTATOR_HOOKFUNCTION(inv, SV_StartFrame)
 {
+       if(autocvar_g_invasion_type != INV_TYPE_ROUND)
+               return; // uses map spawned monsters
+
        monsters_total = inv_maxspawned; // TODO: make sure numspawned never exceeds maxspawned
        monsters_killed = inv_numkilled;
 }
 
 MUTATOR_HOOKFUNCTION(inv, PlayerRegen)
 {
-       // no regeneration in invasion
+       // no regeneration in invasion, regardless of the game type
        return true;
 }
 
@@ -413,28 +504,6 @@ MUTATOR_HOOKFUNCTION(inv, Damage_Calculate)
        }
 }
 
-MUTATOR_HOOKFUNCTION(inv, SV_ParseClientCommand)
-{
-       if(MUTATOR_RETURNVALUE) // command was already handled?
-               return;
-
-       entity player = M_ARGV(0, entity);
-       string cmd_name = M_ARGV(1, string);
-
-       if(cmd_name == "debuginvasion")
-       {
-               sprint(player, strcat("inv_maxspawned = ", ftos(inv_maxspawned), "\n"));
-               sprint(player, strcat("inv_numspawned = ", ftos(inv_numspawned), "\n"));
-               sprint(player, strcat("inv_numkilled = ", ftos(inv_numkilled), "\n"));
-               sprint(player, strcat("inv_roundcnt = ", ftos(inv_roundcnt), "\n"));
-               sprint(player, strcat("monsters_total = ", ftos(monsters_total), "\n"));
-               sprint(player, strcat("monsters_killed = ", ftos(monsters_killed), "\n"));
-               sprint(player, strcat("inv_monsterskill = ", ftos(inv_monsterskill), "\n"));
-
-               return true;
-       }
-}
-
 MUTATOR_HOOKFUNCTION(inv, BotShouldAttack)
 {
        entity targ = M_ARGV(1, entity);
@@ -445,8 +514,11 @@ MUTATOR_HOOKFUNCTION(inv, BotShouldAttack)
 
 MUTATOR_HOOKFUNCTION(inv, SetStartItems)
 {
-       start_health = 200;
-       start_armorvalue = 200;
+       if(autocvar_g_invasion_type == INV_TYPE_ROUND)
+       {
+               start_health = 200;
+               start_armorvalue = 200;
+       }
 }
 
 MUTATOR_HOOKFUNCTION(inv, AccuracyTargetValid)
@@ -465,6 +537,15 @@ MUTATOR_HOOKFUNCTION(inv, AllowMobSpawning)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(inv, CheckRules_World)
+{
+       if(autocvar_g_invasion_type == INV_TYPE_ROUND)
+               return false;
+
+       M_ARGV(0, float) = WinningCondition_Invasion();
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(inv, CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
 {
        M_ARGV(0, float) = invasion_teams;
@@ -479,24 +560,23 @@ MUTATOR_HOOKFUNCTION(inv, AllowMobButcher)
 void invasion_ScoreRules(int inv_teams)
 {
        if(inv_teams) { CheckAllowedTeams(NULL); }
-       ScoreRules_basics(inv_teams, 0, 0, false);
-       if(inv_teams) ScoreInfo_SetLabel_TeamScore(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
-       ScoreRules_basics_end();
+       GameRules_score_enabled(false);
+       GameRules_scoring(inv_teams, 0, 0, {
+           if (inv_teams) {
+            field_team(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
+           }
+           field(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
+       });
 }
 
 void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
+       if(autocvar_g_invasion_type == INV_TYPE_HUNT || autocvar_g_invasion_type == INV_TYPE_STAGE)
+               cvar_set("fraglimit", "0");
+
        if(autocvar_g_invasion_teams)
        {
-               invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
-               int teams = 0;
-               if(invasion_teams >= 1) teams |= BIT(0);
-               if(invasion_teams >= 2) teams |= BIT(1);
-               if(invasion_teams >= 3) teams |= BIT(2);
-               if(invasion_teams >= 4) teams |= BIT(3);
-
-               invasion_teams = teams; // now set it?
+               invasion_teams = BITS(bound(2, autocvar_g_invasion_teams, 4));
        }
        else
                invasion_teams = 0;
@@ -507,11 +587,14 @@ void invasion_DelayedInit(entity this) // Do this check with a delay so we can w
 
        independent_players = 0;
 
-       round_handler_Spawn(Invasion_CheckPlayers, Invasion_CheckWinner, Invasion_RoundStart);
-       round_handler_Init(5, autocvar_g_invasion_warmup, autocvar_g_invasion_round_timelimit);
+       if(autocvar_g_invasion_type == INV_TYPE_ROUND)
+       {
+               round_handler_Spawn(Invasion_CheckPlayers, Invasion_CheckWinner, Invasion_RoundStart);
+               round_handler_Init(5, autocvar_g_invasion_warmup, autocvar_g_invasion_round_timelimit);
 
-       inv_roundcnt = 0;
-       inv_maxrounds = 15; // 15?
+               inv_roundcnt = 0;
+               inv_maxrounds = 15; // 15?
+       }
 }
 
 void invasion_Initialize()
index e934f8745a4e29bfbcee542ee2c9b1793ea815df..0ea0e82c4c8266ad31bff1db48f2ceeb6be03416 100644 (file)
@@ -4,43 +4,26 @@
 
 #define autocvar_g_invasion_point_limit cvar("g_invasion_point_limit")
 int autocvar_g_invasion_teams;
+int autocvar_g_invasion_type;
 bool autocvar_g_invasion_team_spawns;
 bool g_invasion;
 void invasion_Initialize();
 
 REGISTER_MUTATOR(inv, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               g_invasion = true;
-               invasion_Initialize();
-
-               cvar_settemp("g_monsters", "1");
-
-               SetLimits(autocvar_g_invasion_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
-               if (autocvar_g_invasion_teams >= 2)
-               {
-                       ActivateTeamplay();
-                       if (autocvar_g_invasion_team_spawns)
-                               have_team_spawns = -1; // request team spawns
+               if (autocvar_g_invasion_teams >= 2) {
+                       GameRules_teams(true);
+                       GameRules_spawning_teams(autocvar_g_invasion_team_spawns);
                }
-       }
+        GameRules_limit_score(autocvar_g_invasion_point_limit);
 
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back invasion_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               g_invasion = true;
+               cvar_settemp("g_monsters", "1");
+               invasion_Initialize();
        }
-
        return 0;
 }
 
@@ -58,3 +41,7 @@ float inv_monsters_perteam[17];
 float inv_monsterskill;
 
 const float ST_INV_KILLS = 1;
+
+const int INV_TYPE_ROUND = 0; // round-based waves of enemies
+const int INV_TYPE_HUNT = 1; // clear the map of placed enemies
+const int INV_TYPE_STAGE = 2; // reach the end of the level
index 0b4bd54aaa21c554d4fbaf8b0800e683a3c8c0f2..7b33bea6f374dd585755e6a31f572830b514b73d 100644 (file)
@@ -1,5 +1,9 @@
 #include "gamemode_keepaway.qh"
 
+#include <common/effects/all.qh>
+
+.entity ballcarried;
+
 int autocvar_g_keepaway_ballcarrier_effects;
 float autocvar_g_keepaway_ballcarrier_damage;
 float autocvar_g_keepaway_ballcarrier_force;
@@ -74,9 +78,9 @@ void ka_TimeScoring(entity this)
        if(this.owner.ballcarried)
        { // add points for holding the ball after a certain amount of time
                if(autocvar_g_keepaway_score_timepoints)
-                       PlayerScore_Add(this.owner, SP_SCORE, autocvar_g_keepaway_score_timepoints);
+                       GameRules_scoring_add(this.owner, SCORE, autocvar_g_keepaway_score_timepoints);
 
-               PlayerScore_Add(this.owner, SP_KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds"
+               GameRules_scoring_add(this.owner, KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds"
                this.nextthink = time + autocvar_g_keepaway_score_timeinterval;
        }
 }
@@ -103,6 +107,7 @@ void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball c
        // attach the ball to the player
        this.owner = toucher;
        toucher.ballcarried = this;
+       GameRules_scoring_vip(toucher, true);
        setattachment(this, toucher, "");
        setorigin(this, '0 0 0');
 
@@ -129,7 +134,7 @@ void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball c
        sound(this.owner, CH_TRIGGER, SND_KA_PICKEDUP, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 
        // scoring
-       PlayerScore_Add(toucher, SP_KEEPAWAY_PICKUPS, 1);
+       GameRules_scoring_add(toucher, KEEPAWAY_PICKUPS, 1);
 
        // waypoints
        WaypointSprite_AttachCarrier(WP_KaBallCarrier, toucher, RADARICON_FLAGCARRIER);
@@ -157,8 +162,9 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.effects &= ~EF_NODRAW;
        setorigin(ball, plyr.origin + '0 0 10');
        ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
-       ball.owner.ballcarried = world; // I hope nothing checks to see if the world has the ball in the rest of my code :P
-       ball.owner = NULL;
+       entity e = ball.owner; ball.owner = NULL;
+       e.ballcarried = NULL;
+       GameRules_scoring_vip(e, false);
        navigation_dynamicgoal_set(ball);
 
        // reset the player effects
@@ -172,7 +178,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        sound(NULL, CH_TRIGGER, SND_KA_DROPPED, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 
        // scoring
-       // PlayerScore_Add(plyr, SP_KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless.
+       // GameRules_scoring_add(plyr, KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless.
 
        // waypoints
        WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
@@ -280,16 +286,16 @@ MUTATOR_HOOKFUNCTION(ka, PlayerDies)
        if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)))
        {
                if(frag_target.ballcarried) { // add to amount of times killing carrier
-                       PlayerScore_Add(frag_attacker, SP_KEEPAWAY_CARRIERKILLS, 1);
+                       GameRules_scoring_add(frag_attacker, KEEPAWAY_CARRIERKILLS, 1);
                        if(autocvar_g_keepaway_score_bckill) // add bckills to the score
-                               PlayerScore_Add(frag_attacker, SP_SCORE, autocvar_g_keepaway_score_bckill);
+                               GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_bckill);
                }
                else if(!frag_attacker.ballcarried)
                        if(autocvar_g_keepaway_noncarrier_warn)
                                Send_Notification(NOTIF_ONE_ONLY, frag_attacker, MSG_CENTER, CENTER_KEEPAWAY_WARN);
 
                if(frag_attacker.ballcarried) // add to amount of kills while ballcarrier
-                       PlayerScore_Add(frag_attacker, SP_SCORE, autocvar_g_keepaway_score_killac);
+                       GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_killac);
        }
 
        if(frag_target.ballcarried) { ka_DropEvent(frag_target); } // a player with the ball has died, drop it
@@ -439,12 +445,12 @@ MUTATOR_HOOKFUNCTION(ka, DropSpecialItems)
 // Initialization
 // ==============
 
+MODEL(KA_BALL, "models/orbs/orbblue.md3");
+
 void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
 {
        entity e = new(keepawayball);
-       e.model = "models/orbs/orbblue.md3";
-       precache_model(e.model);
-       _setmodel(e, e.model);
+       setmodel(e, MDL_KA_BALL);
        setsize(e, '-16 -16 -20', '16 16 20'); // 20 20 20 was too big, player is only 16 16 24... gotta cheat with the Z (20) axis so that the particle isn't cut off
        e.damageforcescale = autocvar_g_keepawayball_damageforcescale;
        e.takedamage = DAMAGE_YES;
@@ -464,17 +470,7 @@ void ka_SpawnBall() // loads various values for the ball, runs only once at star
        InitializeEntity(e, ka_RespawnBall, INITPRIO_SETLOCATION); // is this the right priority? Neh, I have no idea.. Well-- it works! So.
 }
 
-void ka_ScoreRules()
-{
-       ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, 0, true); // SFL_SORT_PRIO_PRIMARY
-       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_PICKUPS,             "pickups",              0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_CARRIERKILLS,   "bckills",           0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_BCTIME,                  "bctime",           SFL_SORT_PRIO_SECONDARY);
-       ScoreRules_basics_end();
-}
-
 void ka_Initialize() // run at the start of a match, initiates game mode
 {
-       ka_ScoreRules();
        ka_SpawnBall();
 }
index a13ab83a555089681bd43974e221421980665c14..abbabbd5bbf16202cc68a23ab69d5fc65af4a584 100644 (file)
@@ -6,26 +6,17 @@ void ka_Initialize();
 
 REGISTER_MUTATOR(ka, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               ka_Initialize();
-       }
-
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back ka_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
+           GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, {
+            field(SP_KEEPAWAY_PICKUPS, "pickups", 0);
+            field(SP_KEEPAWAY_CARRIERKILLS, "bckills", 0);
+            field(SP_KEEPAWAY_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY);
+        });
 
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               ka_Initialize();
        }
-
        return false;
 }
 
index 52daeb796393f6a8ff96ee493c36be5449b62828..15b6e0f4a6251d81a94d9501858abca0ee0ae602 100644 (file)
@@ -85,18 +85,18 @@ int kh_key_dropped, kh_key_carried;
 
 int kh_Key_AllOwnedByWhichTeam();
 
-const float ST_KH_CAPS = 1;
+const int ST_KH_CAPS = 1;
 void kh_ScoreRules(int teams)
 {
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
-       ScoreInfo_SetLabel_TeamScore(  ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_KH_PUSHES,    "pushes",    0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KH_DESTROYS,  "destroyed", SFL_LOWER_IS_BETTER);
-       ScoreInfo_SetLabel_PlayerScore(SP_KH_PICKUPS,   "pickups",   0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KH_KCKILLS,   "kckills",   0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KH_LOSSES,    "losses",    SFL_LOWER_IS_BETTER);
-       ScoreRules_basics_end();
+       GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {
+        field_team(ST_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+        field(SP_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+        field(SP_KH_PUSHES, "pushes", 0);
+        field(SP_KH_DESTROYS, "destroyed", SFL_LOWER_IS_BETTER);
+        field(SP_KH_PICKUPS, "pickups", 0);
+        field(SP_KH_KCKILLS, "kckills", 0);
+        field(SP_KH_LOSSES, "losses", SFL_LOWER_IS_BETTER);
+       });
 }
 
 bool kh_KeyCarrier_waypointsprite_visible_for_player(entity this, entity player, entity view)  // runs all the time
@@ -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);
                        }
                }
@@ -441,7 +441,7 @@ void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped ke
        if(key.kh_dropperteam != player.team)
        {
                kh_Scores_Event(player, key, "collect", autocvar_g_balance_keyhunt_score_collect, 0);
-               PlayerScore_Add(player, SP_KH_PICKUPS, 1);
+               GameRules_scoring_add(player, KH_PICKUPS, 1);
        }
        key.kh_dropperteam = 0;
        int realteam = kh_Team_ByID(key.count);
@@ -534,7 +534,7 @@ void kh_WinnerTeam(int winner_team)  // runs when a team wins
        {
                float f = DistributeEvenly_Get(1);
                kh_Scores_Event(key.owner, key, "capture", f, 0);
-               PlayerTeamScore_Add(key.owner, SP_KH_CAPS, ST_KH_CAPS, 1);
+               GameRules_scoring_add_team(key.owner, KH_CAPS, 1);
                nades_GiveBonus(key.owner, autocvar_g_nades_bonus_score_high);
        }
 
@@ -593,7 +593,7 @@ void kh_LoserTeam(int loser_team, entity lostkey)  // runs when a player pushes
                        kh_Scores_Event(lostkey.kh_previous_owner, NULL, "pushed", 0, -autocvar_g_balance_keyhunt_score_push);
                        // don't actually GIVE him the -nn points, just log
                kh_Scores_Event(attacker, NULL, "push", autocvar_g_balance_keyhunt_score_push, 0);
-               PlayerScore_Add(attacker, SP_KH_PUSHES, 1);
+               GameRules_scoring_add(attacker, KH_PUSHES, 1);
                //centerprint(attacker, "Your push is the best!"); // does this really need to exist?
        }
        else
@@ -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;
@@ -614,7 +614,7 @@ void kh_LoserTeam(int loser_team, entity lostkey)  // runs when a player pushes
                        // don't actually GIVE him the -nn points, just log
 
                if(lostkey.kh_previous_owner.playerid == lostkey.kh_previous_owner_playerid)
-                       PlayerScore_Add(lostkey.kh_previous_owner, SP_KH_DESTROYS, 1);
+                       GameRules_scoring_add(lostkey.kh_previous_owner, KH_DESTROYS, 1);
 
                DistributeEvenly_Init(autocvar_g_balance_keyhunt_score_destroyed, keys * of + players);
 
@@ -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;
@@ -809,7 +809,7 @@ void kh_Key_DropOne(entity key)
        key.enemy = player;
 
        kh_Scores_Event(player, key, "dropkey", 0, 0);
-       PlayerScore_Add(player, SP_KH_LOSSES, 1);
+       GameRules_scoring_add(player, KH_LOSSES, 1);
        int realteam = kh_Team_ByID(key.count);
        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DROP), player.netname);
 
@@ -836,7 +836,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
                while((key = player.kh_next))
                {
                        kh_Scores_Event(player, key, "losekey", 0, 0);
-                       PlayerScore_Add(player, SP_KH_LOSSES, 1);
+                       GameRules_scoring_add(player, KH_LOSSES, 1);
                        int realteam = kh_Team_ByID(key.count);
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_LOST), player.netname);
                        kh_Key_AssignTo(key, NULL);
@@ -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);
        }
 
@@ -972,7 +972,7 @@ float kh_HandleFrags(entity attacker, entity targ, float f)  // adds to the play
                else
                {
                        kh_Scores_Event(attacker, targ.kh_next, "carrierfrag", autocvar_g_balance_keyhunt_score_carrierfrag-1, 0);
-                       PlayerScore_Add(attacker, SP_KH_KCKILLS, 1);
+                       GameRules_scoring_add(attacker, KH_KCKILLS, 1);
                        // the frag gets added later
                }
        }
@@ -986,15 +986,7 @@ void kh_Initialize()  // sets up th KH environment
        kh_teams = autocvar_g_keyhunt_teams_override;
        if(kh_teams < 2)
                kh_teams = cvar("g_keyhunt_teams"); // read the cvar directly as it gets written earlier in the same frame
-       kh_teams = bound(2, kh_teams, 4);
-
-       int teams = 0;
-       if(kh_teams >= 1) teams |= BIT(0);
-       if(kh_teams >= 2) teams |= BIT(1);
-       if(kh_teams >= 3) teams |= BIT(2);
-       if(kh_teams >= 4) teams |= BIT(3);
-
-       kh_teams = teams; // now set it?
+       kh_teams = BITS(bound(2, kh_teams, 4));
 
        // make a KH entity for controlling the game
        kh_controller = spawn();
index d0fb5f95bc2ff0c455a96da9900932b586e75e8f..77d7c06fcf055fa1e5d83da36767e23a10688746 100644 (file)
@@ -9,31 +9,16 @@ void kh_Initialize();
 
 REGISTER_MUTATOR(kh, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               kh_Initialize();
-
-               ActivateTeamplay();
-               SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, autocvar_timelimit_override, -1);
-               if (autocvar_g_keyhunt_team_spawns)
-                       have_team_spawns = -1; // request team spawns
-       }
+               GameRules_teams(true);
+        GameRules_spawning_teams(autocvar_g_keyhunt_team_spawns);
+        GameRules_limit_score(autocvar_g_keyhunt_point_limit);
+        GameRules_limit_lead(autocvar_g_keyhunt_point_leadlimit);
 
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back kh_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               kh_Initialize();
        }
-
        return 0;
 }
 
index c3c24559e34bc76e112a3c001383df57f7e54407..4d6f70438583b0f805b40070754e303b1a3f4726 100644 (file)
@@ -71,7 +71,7 @@ int WinningCondition_LMS()
                        {
                                // a winner!
                                // and assign him his first place
-                               PlayerScore_Add(head, SP_LMS_RANK, 1);
+                               GameRules_scoring_add(head, LMS_RANK, 1);
                                if(warmup_stage)
                                        return WINNING_NO;
                                else
@@ -120,7 +120,7 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_players)
        FOREACH_CLIENT(true, {
                TRANSMUTE(Player, it);
                it.frags = FRAGS_PLAYER;
-               PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives());
+               GameRules_scoring_add(it, LMS_LIVES, LMS_NewPlayerLives());
                PutClientInServer(it);
        });
 }
@@ -133,13 +133,13 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
                TRANSMUTE(Observer, player);
        else
        {
-               float tl = PlayerScore_Add(player, SP_LMS_LIVES, 0);
+               float tl = GameRules_scoring_add(player, LMS_LIVES, 0);
                if(tl < lms_lowest_lives)
                        lms_lowest_lives = tl;
                if(tl <= 0)
                        TRANSMUTE(Observer, player);
                if(warmup_stage)
-                       PlayerScore_Add(player, SP_LMS_RANK, -PlayerScore_Add(player, SP_LMS_RANK, 0));
+                       GameRules_scoring_add(player, LMS_RANK, -GameRules_scoring_add(player, LMS_RANK, 0));
        }
 }
 
@@ -151,7 +151,7 @@ MUTATOR_HOOKFUNCTION(lms, ForbidSpawn)
                return false;
        if(player.frags == FRAGS_SPECTATOR)
                return true;
-       if(PlayerScore_Add(player, SP_LMS_LIVES, 0) <= 0)
+       if(GameRules_scoring_add(player, LMS_LIVES, 0) <= 0)
        {
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
                return true;
@@ -169,7 +169,7 @@ MUTATOR_HOOKFUNCTION(lms, PlayerDies)
 void lms_RemovePlayer(entity player)
 {
        static int quitters = 0;
-       float player_rank = PlayerScore_Add(player, SP_LMS_RANK, 0);
+       float player_rank = GameRules_scoring_add(player, LMS_RANK, 0);
        if (!player_rank)
        {
                int pl_cnt = 0;
@@ -179,7 +179,7 @@ void lms_RemovePlayer(entity player)
                        if(IS_BOT_CLIENT(player))
                                bot_clear(player);
                        player.frags = FRAGS_LMS_LOSER;
-                       PlayerScore_Add(player, SP_LMS_RANK, pl_cnt + 1);
+                       GameRules_scoring_add(player, LMS_RANK, pl_cnt + 1);
                }
                else
                {
@@ -187,22 +187,22 @@ void lms_RemovePlayer(entity player)
                        FOREACH_CLIENT(true, {
                                if (it.frags == FRAGS_LMS_LOSER)
                                {
-                                       float it_rank = PlayerScore_Add(it, SP_LMS_RANK, 0);
+                                       float it_rank = GameRules_scoring_add(it, LMS_RANK, 0);
                                        if (it_rank > player_rank && it_rank <= 256)
-                                               PlayerScore_Add(it, SP_LMS_RANK, -1);
+                                               GameRules_scoring_add(it, LMS_RANK, -1);
                                        lms_lowest_lives = 0;
                                }
                                else if (it.frags != FRAGS_SPECTATOR)
                                {
-                                       float tl = PlayerScore_Add(it, SP_LMS_LIVES, 0);
+                                       float tl = GameRules_scoring_add(it, LMS_LIVES, 0);
                                        if(tl < lms_lowest_lives)
                                                lms_lowest_lives = tl;
                                }
                        });
-                       PlayerScore_Add(player, SP_LMS_RANK, 665 - quitters); // different from 666
+                       GameRules_scoring_add(player, LMS_RANK, 665 - quitters); // different from 666
                        if(!warmup_stage)
                        {
-                               PlayerScore_Add(player, SP_LMS_LIVES, -PlayerScore_Add(player, SP_LMS_LIVES, 0));
+                               GameRules_scoring_add(player, LMS_LIVES, -GameRules_scoring_add(player, LMS_LIVES, 0));
                                ++quitters;
                        }
                        player.frags = FRAGS_LMS_LOSER;
@@ -212,8 +212,8 @@ void lms_RemovePlayer(entity player)
                        lms_lowest_lives = 0; // end the game now!
        }
 
-       if(player.killcount != FRAGS_SPECTATOR)
-               if(PlayerScore_Add(player, SP_LMS_RANK, 0) > 0 && player.lms_spectate_warning != 2)
+       if(CS(player).killcount != FRAGS_SPECTATOR)
+               if(GameRules_scoring_add(player, LMS_RANK, 0) > 0 && player.lms_spectate_warning != 2)
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_NOLIVES, player.netname);
                else
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_FORFEIT, player.netname);
@@ -241,9 +241,9 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect)
        TRANSMUTE(Player, player);
        campaign_bots_may_start = true;
 
-       if(PlayerScore_Add(player, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
+       if(GameRules_scoring_add(player, LMS_LIVES, LMS_NewPlayerLives()) <= 0)
        {
-               PlayerScore_Add(player, SP_LMS_RANK, 666); // mark as forced spectator for the hud code
+               GameRules_scoring_add(player, LMS_RANK, 666); // mark as forced spectator for the hud code
                player.frags = FRAGS_SPECTATOR;
        }
 }
@@ -276,7 +276,7 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
        if (!warmup_stage)
        {
                // remove a life
-               int tl = PlayerScore_Add(frag_target, SP_LMS_LIVES, -1);
+               int tl = GameRules_scoring_add(frag_target, LMS_LIVES, -1);
                if(tl < lms_lowest_lives)
                        lms_lowest_lives = tl;
                if(tl <= 0)
@@ -286,7 +286,7 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
                        if(IS_BOT_CLIENT(frag_target))
                                bot_clear(frag_target);
                        frag_target.frags = FRAGS_LMS_LOSER;
-                       PlayerScore_Add(frag_target, SP_LMS_RANK, pl_cnt);
+                       GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt);
                }
        }
        M_ARGV(2, float) = 0; // frag score
@@ -358,7 +358,7 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch)
        if(item.itemdef == ITEM_ExtraLife)
        {
                Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
-               PlayerScore_Add(toucher, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
+               GameRules_scoring_add(toucher, LMS_LIVES, autocvar_g_lms_extra_lives);
                return MUT_ITEMTOUCH_PICKUP;
        }
 
@@ -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;
 }
@@ -419,18 +419,7 @@ MUTATOR_HOOKFUNCTION(lms, AddPlayerScore)
                return true; // allow writing to this field in intermission as it is needed for newly joining players
 }
 
-// scoreboard stuff
-void lms_ScoreRules()
-{
-       ScoreRules_basics(0, 0, 0, false);
-       ScoreInfo_SetLabel_PlayerScore(SP_LMS_LIVES,    "lives",     SFL_SORT_PRIO_SECONDARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_LMS_RANK,     "rank",      SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE);
-       ScoreRules_basics_end();
-}
-
 void lms_Initialize()
 {
        lms_lowest_lives = 9999;
-
-       lms_ScoreRules();
 }
index 1f1d2d4c3419654509a7d402f42fe41cbbdaa3ea..c69113a0c2188b0d711d19cf4f52f875b7456427 100644 (file)
@@ -8,28 +8,19 @@ void lms_Initialize();
 
 REGISTER_MUTATOR(lms, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               lms_Initialize();
-
-               SetLimits(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override), 0, autocvar_timelimit_override, -1);
-       }
+        GameRules_limit_score(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override));
+        GameRules_limit_lead(0);
+        GameRules_score_enabled(false);
+        GameRules_scoring(0, 0, 0, {
+            field(SP_LMS_LIVES, "lives", SFL_SORT_PRIO_SECONDARY);
+            field(SP_LMS_RANK, "rank", SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE);
+        });
 
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back lms_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               lms_Initialize();
        }
-
        return 0;
 }
 
index c4c8f087e495d388dfc360ca3cc895724894b771..2f581d8c433af0c6b8047e71ab7571825eb7ceba 100644 (file)
@@ -37,25 +37,21 @@ void havocbot_role_race(entity this)
 
 void race_ScoreRules()
 {
-       ScoreRules_basics(race_teams, 0, 0, false);
-       if(race_teams)
-       {
-               ScoreInfo_SetLabel_TeamScore(  ST_RACE_LAPS,    "laps",       SFL_SORT_PRIO_PRIMARY);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME,    "time",      SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_LOWER_IS_BETTER | SFL_TIME);
-       }
-       else if(g_race_qualifying)
-       {
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
-       }
-       else
-       {
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME,    "time",      SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
-               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_LOWER_IS_BETTER | SFL_TIME);
-       }
-       ScoreRules_basics_end();
+    GameRules_score_enabled(false);
+       GameRules_scoring(race_teams, 0, 0, {
+        if (race_teams) {
+            field_team(ST_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+            field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+            field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+            field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
+        } else if (g_race_qualifying) {
+            field(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+        } else {
+            field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+            field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+            field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
+        }
+       });
 }
 
 void race_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
@@ -71,11 +67,11 @@ float WinningCondition_Race(float fraglimit)
 
        n = 0;
        c = 0;
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                ++n;
-               if(it.race_completed)
+               if(CS(it).race_completed)
                        ++c;
-       ));
+       });
        if(n && (n == c))
                return WINNING_YES;
        wc = WinningCondition_Scores(fraglimit, 0);
@@ -150,8 +146,8 @@ MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
-       wishvel.x = fabs(player.movement.x);
-       wishvel.y = fabs(player.movement.y);
+       wishvel.x = fabs(CS(player).movement.x);
+       wishvel.y = fabs(CS(player).movement.y);
        if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
                wishvel.z = 0;
@@ -159,32 +155,32 @@ MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
                if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
-                       if(player.movement.x > 0)
-                               player.movement_x = wishspeed;
+                       if(CS(player).movement.x > 0)
+                               CS(player).movement_x = wishspeed;
                        else
-                               player.movement_x = -wishspeed;
-                       player.movement_y = 0;
+                               CS(player).movement_x = -wishspeed;
+                       CS(player).movement_y = 0;
                }
                else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
-                       player.movement_x = 0;
-                       if(player.movement.y > 0)
-                               player.movement_y = wishspeed;
+                       CS(player).movement_x = 0;
+                       if(CS(player).movement.y > 0)
+                               CS(player).movement_y = wishspeed;
                        else
-                               player.movement_y = -wishspeed;
+                               CS(player).movement_y = -wishspeed;
                }
                else
                {
                        // diagonal
-                       if(player.movement.x > 0)
-                               player.movement_x = M_SQRT1_2 * wishspeed;
+                       if(CS(player).movement.x > 0)
+                               CS(player).movement_x = M_SQRT1_2 * wishspeed;
                        else
-                               player.movement_x = -M_SQRT1_2 * wishspeed;
-                       if(player.movement.y > 0)
-                               player.movement_y = M_SQRT1_2 * wishspeed;
+                               CS(player).movement_x = -M_SQRT1_2 * wishspeed;
+                       if(CS(player).movement.y > 0)
+                               CS(player).movement_y = M_SQRT1_2 * wishspeed;
                        else
-                               player.movement_y = -M_SQRT1_2 * wishspeed;
+                               CS(player).movement_y = -M_SQRT1_2 * wishspeed;
                }
        }
 }
@@ -198,15 +194,15 @@ 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);
+                       s = GameRules_scoring_add(it, RACE_FASTEST, 0);
                        if(!s)
                                it.race_place = 0;
                }
                race_EventLog(ftos(it.race_place), it);
-       ));
+       });
 
        if(g_race_qualifying == 2)
        {
@@ -251,7 +247,7 @@ MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver)
        entity player = M_ARGV(0, entity);
 
        if(g_race_qualifying)
-       if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+       if(GameRules_scoring_add(player, RACE_FASTEST, 0))
                player.frags = FRAGS_LMS_LOSER;
        else
                player.frags = FRAGS_SPECTATOR;
@@ -283,7 +279,7 @@ MUTATOR_HOOKFUNCTION(rc, PutClientInServer)
        if(IS_PLAYER(player))
        if(!game_stopped)
        {
-               if(player.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
+               if(CS(player).killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
                        race_PreparePlayer(player);
                else // respawn
                        race_RetractPlayer(player);
@@ -312,7 +308,7 @@ MUTATOR_HOOKFUNCTION(rc, GetPressedKeys)
 {
        entity player = M_ARGV(0, entity);
 
-       if(player.cvar_cl_allow_uidtracking == 1 && player.cvar_cl_allow_uid2name == 1)
+       if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
        {
                if (!player.stored_netname)
                        player.stored_netname = strzone(uid2name(player.crypto_idfp));
@@ -443,17 +439,8 @@ void rc_SetLimits()
 
        if(autocvar_g_race_teams)
        {
-               ActivateTeamplay();
-               race_teams = bound(2, autocvar_g_race_teams, 4);
-               int teams = 0;
-               if(race_teams >= 1) teams |= BIT(0);
-               if(race_teams >= 2) teams |= BIT(1);
-               if(race_teams >= 3) teams |= BIT(2);
-               if(race_teams >= 4) teams |= BIT(3);
-
-               race_teams = teams; // now set it?
-
-               have_team_spawns = -1; // request team spawns
+               GameRules_teams(true);
+               race_teams = BITS(bound(2, autocvar_g_race_teams, 4));
        }
        else
                race_teams = 0;
@@ -484,5 +471,8 @@ void rc_SetLimits()
        }
        else
                g_race_qualifying = 0;
-       SetLimits(fraglimit_override, leadlimit_override, timelimit_override, qualifying_override);
+    GameRules_limit_score(fraglimit_override);
+    GameRules_limit_lead(leadlimit_override);
+    GameRules_limit_time(timelimit_override);
+    GameRules_limit_time_qualifying(qualifying_override);
 }
index ec71a62d178483d2277228801751f147d721504d..1e475e3ce6f76988ba28f50f1e74e6afb92049de 100644 (file)
@@ -7,27 +7,12 @@ void race_Initialize();
 
 REGISTER_MUTATOR(rc, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-
                rc_SetLimits();
-               race_Initialize();
-       }
 
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back race_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               race_Initialize();
        }
-
        return 0;
 }
index 101f57fcc4d6efb96ecd5d2ed5157b0065c29060..aad31932884556dff7b4a7b6f1a186dcbf15e44c 100644 (file)
@@ -36,16 +36,9 @@ void tdm_DelayedInit(entity this)
                LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.");
 
                int numteams = autocvar_g_tdm_teams_override;
-
                if(numteams < 2) { numteams = autocvar_g_tdm_teams; }
-               numteams = bound(2, numteams, 4);
-
-               int teams = 0;
-               if(numteams >= 1) teams |= BIT(0);
-               if(numteams >= 2) teams |= BIT(1);
-               if(numteams >= 3) teams |= BIT(2);
-               if(numteams >= 4) teams |= BIT(3);
 
+               int teams = BITS(bound(2, numteams, 4));
                if(teams & BIT(0))
                        tdm_SpawnTeam("Red", NUM_TEAM_1);
                if(teams & BIT(1))
index e7efbae7f5b13a9930a3a0523f61dc9d5fe0b6b6..c163962faf1b71c1cad060af1b9d7f8554ffec02 100644 (file)
@@ -9,30 +9,15 @@ void tdm_DelayedInit(entity this);
 
 REGISTER_MUTATOR(tdm, false)
 {
+    MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               if (time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
-
-               ActivateTeamplay();
-               SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, autocvar_timelimit_override, -1);
-               if (autocvar_g_tdm_team_spawns)
-                       have_team_spawns = -1; // request team spawns
-       }
+               GameRules_teams(true);
+        GameRules_spawning_teams(autocvar_g_tdm_team_spawns);
+               GameRules_limit_score(autocvar_g_tdm_point_limit);
+        GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
 
-       MUTATOR_ONROLLBACK_OR_REMOVE
-       {
-               // we actually cannot roll back tdm_Initialize here
-               // BUT: we don't need to! If this gets called, adding always
-               // succeeds.
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
+               InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
        }
-
        return 0;
 }
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 0ca9cb8491d3084d309b3a5d92be39303c8448f8..44a877791b19673f539ac4dd065ffe5eaafa032f 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"
@@ -21,7 +22,7 @@
 #include "../common/minigames/sv_minigames.qh"
 
 #include "../common/physics/player.qh"
-#include "../common/effects/qc/all.qh"
+#include "../common/effects/qc/_mod.qh"
 #include "../common/mutators/mutator/waypoints/waypointsprites.qh"
 #include "../common/triggers/include.qh"
 #include "../common/wepent.qh"
@@ -97,7 +98,6 @@ void CopyBody(entity this, float keepvelocity)
        clone.move_qcphysics = false; // don't run gamecode logic on clones, too many
        set_movetype(clone, this.move_movetype);
        clone.solid = this.solid;
-       clone.ballistics_density = this.ballistics_density;
        clone.takedamage = this.takedamage;
        setcefc(clone, getcefc(this));
        clone.uncustomizeentityforclient = this.uncustomizeentityforclient;
@@ -111,7 +111,6 @@ void CopyBody(entity this, float keepvelocity)
        //clone.weapon = this.weapon;
        setorigin(clone, this.origin);
        setsize(clone, this.mins, this.maxs);
-       clone.prevorigin = this.origin;
        clone.reset = SUB_Remove;
        clone._ps = this._ps;
 
@@ -237,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)
@@ -248,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))
@@ -318,9 +317,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
        if(!DEATH_ISSPECIAL(deathtype))
        {
-               damage *= bound(1.0, this.cvar_cl_handicap, 10.0);
-               if(this != attacker)
-                       damage /= bound(1.0, attacker.cvar_cl_handicap, 10.0);
+               damage *= bound(1.0, CS(this).cvar_cl_handicap, 10.0);
+               if(this != attacker && IS_PLAYER(attacker))
+                       damage /= bound(1.0, CS(attacker).cvar_cl_handicap, 10.0);
        }
 
        if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
@@ -473,10 +472,10 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        if (this != attacker) {
                float realdmg = damage - excess;
                if (IS_PLAYER(attacker)) {
-                       PlayerScore_Add(attacker, SP_DMG, realdmg);
+                       GameRules_scoring_add(attacker, DMG, realdmg);
                }
                if (IS_PLAYER(this)) {
-                       PlayerScore_Add(this, SP_DMGTAKEN, realdmg);
+                       GameRules_scoring_add(this, DMGTAKEN, realdmg);
                }
        }
 
@@ -536,7 +535,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                {
                        delete(this.killindicator);
                        this.killindicator = NULL;
-                       if(this.killindicator_teamchange)
+                       if(CS(this).killindicator_teamchange)
                                defer_ClientKill_Now_TeamChange = true;
 
                        if(this.classname == "body")
@@ -554,7 +553,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
         // increment frag counter for used weapon type
         Weapon w = DEATH_WEAPONOF(deathtype);
                if(w != WEP_Null && accuracy_isgooddamage(attacker, this))
-                       attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1;
+                       CS(attacker).accuracy.(accuracy_frags[w.m_id-1]) += 1;
 
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype, damage);
                damage = M_ARGV(4, float);
@@ -611,12 +610,14 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                set_movetype(this, MOVETYPE_TOSS);
                // shootable corpse
                this.solid = SOLID_CORPSE;
-               this.ballistics_density = autocvar_g_ballistics_density_corpse;
+               PS(this).ballistics_density = autocvar_g_ballistics_density_corpse;
                // don't stick to the floor
                UNSET_ONGROUND(this);
                // dying animation
                this.deadflag = DEAD_DYING;
 
+               STAT(MOVEVARS_SPECIALCOMMAND, this) = false; // sweet release
+
                // when to allow respawn
                calculate_player_respawn_time(this);
 
@@ -744,7 +745,8 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
        if (!teamsay && !privatesay && substring(msgin, 0, 1) == " ")
         msgin = substring(msgin, 1, -1); // work around DP say bug (say_team does not have this!)
 
-       msgin = formatmessage(source, msgin);
+    if(source)
+               msgin = formatmessage(source, msgin);
 
     string colorstr;
        if (!IS_PLAYER(source))
@@ -837,7 +839,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
        // FLOOD CONTROL
        int flood = 0;
        var .float flood_field = floodcontrol_chat;
-       if(floodcontrol)
+       if(floodcontrol && source)
        {
                float flood_spl;
                float flood_burst;
@@ -937,14 +939,14 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
        }
 
        if(flood)
-               LOG_INFO("NOTE: ", playername(source, true), "^7 is flooding.\n");
+               LOG_INFO("NOTE: ", playername(source, true), "^7 is flooding.");
 
        // build sourcemsgstr by cutting off a prefix and replacing it by the other one
        if(privatesay)
                sourcemsgstr = strcat(privatemsgprefix, substring(sourcemsgstr, privatemsgprefixlen, -1));
 
     int ret;
-       if(source.muted)
+       if(source && CS(source).muted)
        {
                // always fake the message
                ret = -1;
@@ -993,11 +995,11 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                                        centerprint(privatesay, cmsgstr);
                        }
                }
-               else if ( teamsay && source.active_minigame )
+               else if ( teamsay && CS(source).active_minigame )
                {
                        sprint(source, sourcemsgstr);
                        dedicated_print(msgstr); // send to server console too
-                       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && it.active_minigame == source.active_minigame && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr));
+                       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && CS(it).active_minigame == CS(source).active_minigame && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr));
                }
                else if(teamsay > 0) // team message, only sent to team mates
                {
index b9a5fa928835208119144e2d7749149c7685af4e..1834bb865ffbb668801e525eb40b7e90f5afa341 100644 (file)
@@ -73,6 +73,4 @@ void MoveToTeam(entity client, float team_colour, float type);
 
 void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
-/** to be used by `prvm_edictset server playernumber muted 1` */
-.float muted;
 int Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol);
index 34c886fa10ebc67029ab433831117ccecb1e2fcb..411d826a87c1f7fb3d309b64f144a50c0f584a0e 100644 (file)
@@ -4,6 +4,7 @@
 #elif defined(SVQC)
     #include "defs.qh"
     #include "playerdemo.qh"
+       #include <common/state.qh>
 #endif
 
 .float playerdemo_fh;
@@ -21,7 +22,7 @@ void playerdemo_shutdown(entity this)
 {
        if(this.playerdemo_mode != PLAYERDEMO_MODE_OFF)
        {
-               LOG_INFO("playerdemo: ", this.netname, " closed\n");
+               LOG_INFO("playerdemo: ", this.netname, " closed");
                fclose(this.playerdemo_fh);
        }
        this.playerdemo_mode = 0;
@@ -35,7 +36,7 @@ void playerdemo_open_read(entity this, string f)
        this.playerdemo_time = stof(fgets(this.playerdemo_fh));
        this.playerdemo_time += this.playerdemo_starttime;
        set_movetype(this, MOVETYPE_NONE);
-       LOG_INFO("playerdemo: ", this.netname, " reading from ", f, "\n");
+       LOG_INFO("playerdemo: ", this.netname, " reading from ", f);
 }
 void playerdemo_open_write(entity this, string f)
 {
@@ -43,8 +44,8 @@ void playerdemo_open_write(entity this, string f)
        this.playerdemo_mode = PLAYERDEMO_MODE_WRITING;
        this.playerdemo_fh = fopen(f, FILE_WRITE);
        this.playerdemo_starttime = time - 1;
-       LOG_INFO("playerdemo: ", this.netname, " writing to ", f, "\n");
-       LOG_INFO("WARNING: playerdemo file format is incomplete and not stable yet. DO NOT RELY ON IT!\n");
+       LOG_INFO("playerdemo: ", this.netname, " writing to ", f);
+       LOG_INFO("WARNING: playerdemo file format is incomplete and not stable yet. DO NOT RELY ON IT!");
 }
 #define PLAYERDEMO_FIELD(ent,func,t,f) func##t(ent,f,#f);
 #define PLAYERDEMO_FIELDS(ent,func) \
@@ -60,11 +61,11 @@ void playerdemo_open_write(entity this, string f)
        PLAYERDEMO_FIELD(ent,func,float,frame) \
        PLAYERDEMO_FIELD(ent,func,float,effects) \
        /* PLAYERDEMO_FIELD(ent,func,float,switchweapon) */ \
-       PLAYERDEMO_FIELD(ent,func,float,button0) /* TODO: PHYS_INPUT_BUTTON_ATCK */ \
-       PLAYERDEMO_FIELD(ent,func,float,button3) /* TODO: PHYS_INPUT_BUTTON_ATCK2 */ \
-       PLAYERDEMO_FIELD(ent,func,float,button5) /* TODO: PHYS_INPUT_BUTTON_CROUCH */ \
-       PLAYERDEMO_FIELD(ent,func,float,button6) /* TODO: PHYS_INPUT_BUTTON_HOOK */ \
-       PLAYERDEMO_FIELD(ent,func,float,buttonuse) /* TODO: PHYS_INPUT_BUTTON_USE */ \
+       PLAYERDEMO_FIELD(CS(ent),func,float,button0) /* TODO: PHYS_INPUT_BUTTON_ATCK */ \
+       PLAYERDEMO_FIELD(CS(ent),func,float,button3) /* TODO: PHYS_INPUT_BUTTON_ATCK2 */ \
+       PLAYERDEMO_FIELD(CS(ent),func,float,button5) /* TODO: PHYS_INPUT_BUTTON_CROUCH */ \
+       PLAYERDEMO_FIELD(CS(ent),func,float,button6) /* TODO: PHYS_INPUT_BUTTON_HOOK */ \
+       PLAYERDEMO_FIELD(CS(ent),func,float,buttonuse) /* TODO: PHYS_INPUT_BUTTON_USE */ \
        PLAYERDEMO_FIELD(ent,func,float,flags) \
        // end of list
 
@@ -160,6 +161,10 @@ float playerdemo_read(entity this)
                this.playerdemo_time += this.playerdemo_starttime;
        }
        this.velocity = '0 0 0';
+       CS(this).movement = '0 0 0';
+       this.dmg_take = 0; // so screen doesn't stay blurry
+       this.dmg_save = 0;
+       this.dmg_inflictor = NULL;
        time = t;
        return 1;
 }
index 99125a1a30c502d58e736cefbdfb59033d02a05a..20039cfcc8205c83f784012c01a286cdfc531e50 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"
@@ -148,7 +149,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player)
        tracebox(safe, player.mins - SAFENUDGE, player.maxs + SAFENUDGE, step, MOVE_NOMONSTERS, player);
        if(trace_startsolid)
        {
-               LOG_INFO("'safe' teleport location is not safe!\n");
+               LOG_INFO("'safe' teleport location is not safe!");
                // FAIL TODO why does this happen?
                return 0;
        }
@@ -156,7 +157,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player)
        tracebox(safe, player.mins - SAFENUDGE, player.maxs + SAFENUDGE, to, MOVE_NOMONSTERS, player);
        if(trace_startsolid)
        {
-               LOG_INFO("trace_endpos in solid, this can't be!\n");
+               LOG_INFO("trace_endpos in solid, this can't be!");
                // FAIL TODO why does this happen? (reported by MrBougo)
                return 0;
        }
@@ -215,7 +216,7 @@ float Portal_FindSafeOrigin(entity portal)
        if(!move_out_of_solid(portal))
        {
 #ifdef DEBUG
-               LOG_INFO("NO SAFE ORIGIN\n");
+               LOG_INFO("NO SAFE ORIGIN");
 #endif
                return 0;
        }
@@ -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..fd0b0c99e2d60dc5f382747a860548a706b12017 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/_mod.inc>
+
+#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 80023e76ada42a67139ba3aeeaa1644aeda14db5..6fc828dc9459ec85cd59d32ee04ac54656196da4 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"
@@ -9,7 +11,9 @@
 #include "../common/deathtypes/all.qh"
 #include "../common/notifications/all.qh"
 #include "../common/mapinfo.qh"
+#include <common/gamemodes/rules.qh>
 #include <common/net_linked.qh>
+#include <common/state.qh>
 #include "../common/triggers/subs.qh"
 #include "../lib/warpzone/util_server.qh"
 #include "../lib/warpzone/common.qh"
@@ -165,6 +169,7 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only
 
        int cp = e.race_checkpoint;
        float recordtime = race_checkpoint_records[cp];
+       float myrecordtime = e.race_checkpoint_record[cp];
        string recordholder = race_checkpoint_recordholders[cp];
        if(recordholder == e.netname)
                recordholder = "";
@@ -172,7 +177,7 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only
        if(!IS_REAL_CLIENT(e))
                return;
 
-       if(!spec && !e.cvar_cl_race_cptimes_onlyself) // don't show spectators the player's personal time
+       if(!spec)
                msg_entity = e;
        WRITESPECTATABLE_MSG_ONE(msg_entity, {
                WriteHeader(MSG_ONE, TE_CSQC_RACE);
@@ -186,20 +191,10 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only
                        WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_NEXT_QUALIFYING);
                WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player will be at next
                WriteInt24_t(MSG_ONE, recordtime);
+               if(!spec)
+                       WriteInt24_t(MSG_ONE, myrecordtime);
                WriteString(MSG_ONE, recordholder);
        });
-
-       if(!spec && e.cvar_cl_race_cptimes_onlyself) // don't send to spectators!
-       {
-               recordtime = e.race_checkpoint_record[cp];
-
-               // not spectatable
-               msg_entity = e;
-               WriteHeader(MSG_ONE, TE_CSQC_RACE);
-               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_NEXT_SELF_QUALIFYING);
-               WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player will be at next
-               WriteInt24_t(MSG_ONE, recordtime);
-       }
 }
 
 void race_send_recordtime(float msg)
@@ -387,25 +382,25 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
        if(tvalid)
        if(cp == race_timed_checkpoint) // finish line
-       if (!e.race_completed)
+       if (!CS(e).race_completed)
        {
                float s;
                if(g_race_qualifying)
                {
-                       s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+                       s = GameRules_scoring_add(e, RACE_FASTEST, 0);
                        if(!s || t < s)
-                               PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+                               GameRules_scoring_add(e, RACE_FASTEST, t - s);
                }
                else
                {
-                       s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+                       s = GameRules_scoring_add(e, RACE_FASTEST, 0);
                        if(!s || t < s)
-                               PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+                               GameRules_scoring_add(e, RACE_FASTEST, t - s);
 
-                       s = PlayerScore_Add(e, SP_RACE_TIME, 0);
+                       s = GameRules_scoring_add(e, RACE_TIME, 0);
                        snew = TIME_ENCODE(time - game_starttime);
-                       PlayerScore_Add(e, SP_RACE_TIME, snew - s);
-                       l = PlayerTeamScore_Add(e, SP_RACE_LAPS, ST_RACE_LAPS, 1);
+                       GameRules_scoring_add(e, RACE_TIME, snew - s);
+                       l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
 
                        if(autocvar_fraglimit)
                                if(l >= autocvar_fraglimit)
@@ -413,7 +408,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
                        if(race_completing)
                        {
-                               e.race_completed = 1;
+                               CS(e).race_completed = 1;
                                MAKE_INDEPENDENT_PLAYER(e);
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_RACE_FINISHED, e.netname);
                                ClientData_Touch(e);
@@ -424,13 +419,12 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
        if(g_race_qualifying)
        {
                float recordtime;
-               float myrecordtime;
                string recordholder;
 
                if(tvalid)
                {
                        recordtime = race_checkpoint_records[cp];
-                       myrecordtime = e.race_checkpoint_record[cp];
+                       float myrecordtime = e.race_checkpoint_record[cp];
                        recordholder = strcat1(race_checkpoint_recordholders[cp]); // make a tempstring copy, as we'll possibly strunzone it!
                        if(recordholder == e.netname)
                                recordholder = "";
@@ -442,6 +436,9 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                                        race_setTime(GetMapname(), t, e.crypto_idfp, e.netname, e, true);
                                        MUTATOR_CALLHOOK(Race_FinalCheckpoint, e);
                                }
+                               if(t < myrecordtime || myrecordtime == 0)
+                                       e.race_checkpoint_record[cp] = t; // resending done below
+
                                if(t < recordtime || recordtime == 0)
                                {
                                        race_checkpoint_records[cp] = t;
@@ -449,11 +446,9 @@ 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); });
                                }
 
-                               if(t < myrecordtime || myrecordtime == 0)
-                                       e.race_checkpoint_record[cp] = t; // resending done below
                        }
                }
                else
@@ -461,35 +456,27 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                        // dummies
                        t = 0;
                        recordtime = 0;
-                       myrecordtime = 0;
                        recordholder = "";
                }
 
                if(IS_REAL_CLIENT(e))
                {
-                       msg_entity = e;
                        if(g_race_qualifying)
                        {
-                               WRITESPECTATABLE_MSG_ONE(e, {
-                                       if(it == e && e.cvar_cl_race_cptimes_onlyself)
-                                               continue;
-                                       WriteHeader(MSG_ONE, TE_CSQC_RACE);
-                                       WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
-                                       WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
-                                       WriteInt24_t(MSG_ONE, t); // time to that intermediate
-                                       WriteInt24_t(MSG_ONE, recordtime); // previously best time
-                                       WriteString(MSG_ONE, recordholder); // record holder
-                               });
-
-                               if(e.cvar_cl_race_cptimes_onlyself)
+                               FOREACH_CLIENT(IS_REAL_CLIENT(it),
                                {
-                                       msg_entity = e;
-                                       WriteHeader(MSG_ONE, TE_CSQC_RACE);
-                                       WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_SELF_QUALIFYING);
-                                       WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
-                                       WriteInt24_t(MSG_ONE, t); // time to that intermediate
-                                       WriteInt24_t(MSG_ONE, myrecordtime); // previously best time
-                               }
+                                       if(it == e || (IS_SPEC(it) && it.enemy == e))
+                                       {
+                                               msg_entity = it;
+                                               WriteHeader(MSG_ONE, TE_CSQC_RACE);
+                                               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
+                                               WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
+                                               WriteInt24_t(MSG_ONE, t); // time to that intermediate
+                                               WriteInt24_t(MSG_ONE, recordtime); // previously best time
+                                               WriteInt24_t(MSG_ONE, ((tvalid) ? it.race_checkpoint_record[cp] : 0)); // previously best time
+                                               WriteString(MSG_ONE, recordholder); // record holder
+                                       }
+                               });
                        }
                }
        }
@@ -499,7 +486,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                entity oth = race_checkpoint_lastplayers[cp];
                if(oth)
                {
-                       mylaps = PlayerScore_Add(e, SP_RACE_LAPS, 0);
+                       mylaps = GameRules_scoring_add(e, RACE_LAPS, 0);
                        lother = race_checkpoint_lastlaps[cp];
                        othtime = race_checkpoint_lasttimes[cp];
                }
@@ -828,8 +815,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,
                {
@@ -846,12 +835,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") {
@@ -1047,9 +1039,9 @@ spawnfunc(target_stopTimer) { spawnfunc_target_checkpoint(this); }
 
 void race_AbandonRaceCheck(entity p)
 {
-       if(race_completing && !p.race_completed)
+       if(race_completing && !CS(p).race_completed)
        {
-               p.race_completed = 1;
+               CS(p).race_completed = 1;
                MAKE_INDEPENDENT_PLAYER(p);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_RACE_ABANDONED, p.netname);
                ClientData_Touch(p);
@@ -1059,7 +1051,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)
@@ -1094,21 +1086,19 @@ spawnfunc(info_player_race)
 
 void race_ClearRecords()
 {
-       float i;
-
-       for(i = 0; i < MAX_CHECKPOINTS; ++i)
+       for(int j = 0; j < MAX_CHECKPOINTS; ++j)
        {
-               race_checkpoint_records[i] = 0;
-               if(race_checkpoint_recordholders[i])
-                       strunzone(race_checkpoint_recordholders[i]);
-               race_checkpoint_recordholders[i] = string_null;
+               race_checkpoint_records[j] = 0;
+               if(race_checkpoint_recordholders[j])
+                       strunzone(race_checkpoint_recordholders[j]);
+               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)
@@ -1188,8 +1178,8 @@ float race_GetFractionalLapCount(entity e)
        // links on CP entities)
 
        float l;
-       l = PlayerScore_Add(e, SP_RACE_LAPS, 0);
-       if(e.race_completed)
+       l = GameRules_scoring_add(e, RACE_LAPS, 0);
+       if(CS(e).race_completed)
                return l; // not fractional
 
        vector o0, o1;
index 7f6a194f291748213ba4e91e46124d15ce488168..472827efa4a81d13a014ae84d998f1b88d62628f 100644 (file)
@@ -66,7 +66,3 @@ void race_SendRankings(float pos, float prevpos, float del, float msg);
 void race_RetractPlayer(entity this);
 
 void race_InitSpectator();
-
-.bool cvar_cl_race_cptimes_onlyself;
-
-REPLICATE(cvar_cl_race_cptimes_onlyself, bool, "cl_race_cptimes_onlyself");
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 6bfb09cc97a2978be06048928dbf4366a675a6c2..266f7734b660bae45bad90f29514a869ef182b46 100644 (file)
@@ -262,7 +262,7 @@ float PlayerScore_Clear(entity player)
 
        if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
 
-       sk = player.scorekeeper;
+       sk = CS(player).scorekeeper;
        FOREACH(Scores, true, {
                if(sk.(scores(it)) != 0)
                        if(scores_label(it) != "")
@@ -279,7 +279,7 @@ void Score_ClearAll()
        entity sk;
        float t;
        FOREACH_CLIENTSLOT(true, {
-               sk = it.scorekeeper;
+               sk = CS(it).scorekeeper;
                if (!sk) continue;
                FOREACH(Scores, true, {
                        if(sk.(scores(it)) != 0)
@@ -306,20 +306,20 @@ void Score_ClearAll()
 
 void PlayerScore_Attach(entity player)
 {
-       if(player.scorekeeper)
+       if(CS(player).scorekeeper)
                error("player already has a scorekeeper");
        entity sk = new_pure(scorekeeper);
        sk.owner = player;
        Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
-       player.scorekeeper = sk;
+       CS(player).scorekeeper = sk;
 }
 
 void PlayerScore_Detach(entity player)
 {
-       if(!player.scorekeeper)
+       if(!CS(player).scorekeeper)
                error("player has no scorekeeper");
-       delete(player.scorekeeper);
-       player.scorekeeper = NULL;
+       delete(CS(player).scorekeeper);
+       CS(player).scorekeeper = NULL;
 }
 
 float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
@@ -332,7 +332,7 @@ float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
                score = 0;
 
        if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
-       entity s = player.scorekeeper;
+       entity s = CS(player).scorekeeper;
        if(!s)
        {
                if(game_stopped)
@@ -454,8 +454,8 @@ void WinningConditionHelper(entity this)
                WinningConditionHelper_second = NULL;
                winnerscorekeeper = NULL;
                secondscorekeeper = NULL;
-               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-                       sk = it.scorekeeper;
+               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)
@@ -589,7 +589,7 @@ string GetPlayerScoreString(entity pl, float shortString)
         });
                out = substring(out, 0, strlen(out) - 1);
        }
-       else if((sk = pl.scorekeeper))
+       else if((sk = CS(pl).scorekeeper))
        {
                FOREACH(Scores, true, {
                        if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
@@ -684,7 +684,7 @@ float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
                        return 0;
        }
 
-       return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
+       return PlayerScore_Compare(CS(p1).scorekeeper, CS(p2).scorekeeper, strict);
 }
 
 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
@@ -694,9 +694,9 @@ 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(it.scorekeeper,
+       FOREACH_CLIENT(CS(it).scorekeeper,
        {
                if(nospectators)
                        if(it.frags == FRAGS_SPECTATOR)
@@ -828,7 +828,7 @@ void Score_NicePrint_Player(entity to, entity p, float w)
        float fl, sc;
        s = "  ";
 
-       sk = p.scorekeeper;
+       sk = CS(p).scorekeeper;
 
        s = strcat(s, playername(p, false));
        for (;;)
@@ -894,17 +894,17 @@ 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)
 {
-       entity s = p.scorekeeper;
+       entity s = CS(p).scorekeeper;
        FOREACH(Scores, true, {
                if(s.(scores(it)) != 0)
                        if(scores_label(it) != "")
index fc4c19602727a34b54454836aa720c9294e8a5e4..79b65299f41e1bfa2c01d5a09e528011d5a560cd 100644 (file)
@@ -65,11 +65,6 @@ float TeamScore_GetCompareValue(float t);
  */
 float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score);
 
-/**
- * Adds to the generic score fields for both the player and the team.
- */
-#define PlayerTeamScore_AddScore(p, s) PlayerTeamScore_Add(p, SP_SCORE, ST_SCORE, s)
-
 /**
  * Set the label of a team score item, as well as the scoring flags.
  */
index 9c416472f40a207b0870c9bc5be4fc416502d48b..2b539c999668bbcc5acca5304ef53100f7e37285 100644 (file)
@@ -1,7 +1,10 @@
 #include "scores_rules.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "client.qh"
 #include "scores.qh"
+#include <common/gamemodes/rules.qh>
 
 int ScoreRules_teams;
 
@@ -55,17 +58,13 @@ void ScoreRules_basics_end()
 }
 void ScoreRules_generic()
 {
-       if(teamplay)
-       {
+    int teams = 0;
+       if (teamplay) {
                CheckAllowedTeams(NULL);
-               int teams = 0;
-               if(c1 >= 0) teams |= BIT(0);
-               if(c2 >= 0) teams |= BIT(1);
-               if(c3 >= 0) teams |= BIT(2);
-               if(c4 >= 0) teams |= BIT(3);
-               ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
+               if (c1 >= 0) teams |= BIT(0);
+               if (c2 >= 0) teams |= BIT(1);
+               if (c3 >= 0) teams |= BIT(2);
+               if (c4 >= 0) teams |= BIT(3);
        }
-       else
-               ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
-       ScoreRules_basics_end();
+       GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {});
 }
index bdb9cdab787a8c4f19f26ff222930b5368bbbdc8..cd393b64196a1cbab9f0128623f3ef8be7adc612 100644 (file)
@@ -83,14 +83,15 @@ void relocate_spawnpoint(entity this)
         this.maxs = PL_MAX_CONST;
         if (!move_out_of_solid(this))
             objerror(this, "could not get out of solid at all!");
-        LOG_INFO("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1'));
-        LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
-        LOG_INFO(" ", ftos(this.origin.y - o.y));
-        LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n");
+        LOG_INFOF(
+            "^1NOTE: this map needs FIXING. Spawnpoint at %s needs to be moved out of solid, e.g. by %s",
+            vtos(o - '0 0 1'),
+            vtos(this.origin - o)
+        );
         if (autocvar_g_spawnpoints_auto_move_out_of_solid)
         {
             if (!spawnpoint_nag)
-                LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)\n");
+                LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)");
             spawnpoint_nag = 1;
         }
         else
@@ -241,11 +242,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..1a5c8e5511420bbd00c066e37f9a641660f4ad69 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);
 }
@@ -184,18 +184,19 @@ void StartFrame()
        if(time > client_cefc_accumulatortime + 1)
        {
                float t = client_cefc_accumulator / (time - client_cefc_accumulatortime);
-               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");
-
+               });
+               LOG_INFO(
+                   "CEFC time: ", ftos(t * 1000), "ms; ",
+            "CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ",
+            "CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0')
+        );
                client_cefc_accumulatortime = time;
                client_cefc_accumulator = 0;
        }
index d8bf72cd6b2a87bc27cc3700053716840c3bd8b3..e93a03201a9ddf4233b229126b69d15bca035de6 100644 (file)
@@ -37,13 +37,6 @@ void default_delayedinit(entity this)
                ScoreRules_generic();
 }
 
-void ActivateTeamplay()
-{
-       serverflags |= SERVERFLAG_TEAMPLAY;
-       teamplay = 1;
-       cvar_set("teamplay", "2");  // DP needs this for sending proper getstatus replies.
-}
-
 void InitGameplayMode()
 {
        VoteReset();
@@ -59,13 +52,11 @@ void InitGameplayMode()
        max_shot_distance = min(230000, vlen(world.maxs - world.mins));
 
        MapInfo_LoadMapSettings(mapname);
-       serverflags &= ~SERVERFLAG_TEAMPLAY;
-       teamplay = 0;
-       cvar_set("teamplay", "0");  // DP needs this for sending proper getstatus replies.
+       GameRules_teams(false);
 
        if (!cvar_value_issafe(world.fog))
        {
-               LOG_INFO("The current map contains a potentially harmful fog setting, ignored\n");
+               LOG_INFO("The current map contains a potentially harmful fog setting, ignored");
                world.fog = string_null;
        }
        if(MapInfo_Map_fog != "")
@@ -87,8 +78,8 @@ void InitGameplayMode()
 
 string GetClientVersionMessage(entity this)
 {
-       if (this.version_mismatch) {
-               if(this.version < autocvar_gameversion) {
+       if (CS(this).version_mismatch) {
+               if(CS(this).version < autocvar_gameversion) {
                        return strcat("This is Xonotic ", autocvar_g_xonoticversion,
                                "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8");
                } else {
@@ -328,7 +319,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;
@@ -351,7 +342,7 @@ void GetTeamCounts(entity ignore)
                                        cb1 = cb1 + bvalue;
                                }
                        }
-                       if(t == NUM_TEAM_2)
+                       else if(t == NUM_TEAM_2)
                        {
                                if(c2 >= 0)
                                {
@@ -359,7 +350,7 @@ void GetTeamCounts(entity ignore)
                                        cb2 = cb2 + bvalue;
                                }
                        }
-                       if(t == NUM_TEAM_3)
+                       else if(t == NUM_TEAM_3)
                        {
                                if(c3 >= 0)
                                {
@@ -367,7 +358,7 @@ void GetTeamCounts(entity ignore)
                                        cb3 = cb3 + bvalue;
                                }
                        }
-                       if(t == NUM_TEAM_4)
+                       else if(t == NUM_TEAM_4)
                        {
                                if(c4 >= 0)
                                {
@@ -376,7 +367,7 @@ void GetTeamCounts(entity ignore)
                                }
                        }
                }
-       ));
+       });
 
        // if the player who has a forced team has not joined yet, reserve the spot
        if(autocvar_g_campaign)
@@ -650,7 +641,7 @@ void SV_ChangeTeam(entity this, float _color)
                return;
        }
 
-       if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && this.wasplayer)) {
+       if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && CS(this).wasplayer)) {
                Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
                return; // changing teams is not allowed
        }
@@ -737,7 +728,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 +745,7 @@ void ShufflePlayerOutOfTeam (float source_team)
                                lowest_player_score = it.totalfrags;
                        }
                }
-       ));
+       });
 
        // prefers to move a bot...
        if(lowest_bot != NULL)
index 127ac7a6d30caffc887e9571c40104148813eadb..8d0ea9cb8ae6d846c326fd59b66732295bf7ee6e 100644 (file)
@@ -18,8 +18,6 @@ void LogTeamchange(float player_id, float team_number, float type);
 
 void default_delayedinit(entity this);
 
-void ActivateTeamplay();
-
 void InitGameplayMode();
 
 string GetClientVersionMessage(entity this);
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 7cc06da3e6dc05b32595b85556ff43d4ecb11225..0d6ecf066f70637deeb0f94ef64e47c079204427 100644 (file)
@@ -20,10 +20,10 @@ bool accuracy_send(entity this, entity to, int sf)
 
        entity a = this.owner;
        if (IS_SPEC(a)) a = a.enemy;
-       a = a.accuracy;
+       a = CS(a).accuracy;
 
        if (to != a.owner)
-               if (!autocvar_sv_accuracy_data_share && !a.owner.cvar_cl_accuracy_data_share)
+               if (!autocvar_sv_accuracy_data_share && !CS(a.owner).cvar_cl_accuracy_data_share)
                        sf = 0;
        // note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
        WriteInt24_t(MSG_ENTITY, sf);
@@ -40,7 +40,7 @@ bool accuracy_send(entity this, entity to, int sf)
 // init/free
 void accuracy_init(entity e)
 {
-       entity a = e.accuracy = new_pure(accuracy);
+       entity a = CS(e).accuracy = new_pure(accuracy);
        a.owner = e;
        a.drawonlytoclient = e;
        Net_LinkEntity(a, false, 0, accuracy_send);
@@ -48,13 +48,13 @@ void accuracy_init(entity e)
 
 void accuracy_free(entity e)
 {
-       delete(e.accuracy);
+       delete(CS(e).accuracy);
 }
 
 // force a resend of a player's accuracy stats
 void accuracy_resend(entity e)
 {
-       e.accuracy.SendFlags = 0xFFFFFF;
+       CS(e).accuracy.SendFlags = 0xFFFFFF;
 }
 
 // update accuracy stats
@@ -64,7 +64,7 @@ void accuracy_resend(entity e)
 void accuracy_add(entity this, int w, int fired, int hit)
 {
        if (IS_INDEPENDENT_PLAYER(this)) return;
-       entity a = this.accuracy;
+       entity a = CS(this).accuracy;
        if (!a) return;
        if (!hit && !fired) return;
        w -= WEP_FIRST;
@@ -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(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 6d163755067def2224a973db9bc311f1dcb60770..f69faa03a324de3e93d3136610a2835d9bbc781e 100644 (file)
@@ -1,10 +1,13 @@
 #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>
 #include <common/deathtypes/all.qh>
 #include <common/notifications/all.qh>
+#include <common/state.qh>
 #include <common/util.qh>
 #include <common/weapons/_all.qh>
 #include <common/items/_mod.qh>
@@ -20,16 +23,18 @@ void W_GiveWeapon(entity e, int wep)
     }
 }
 
-void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
+void W_PlayStrengthSound(entity player)
 {
+       entity store = IS_PLAYER(player) ? PS(player) : player; // because non-player entities can fire, but can they have items? TODO
+
        if((player.items & ITEM_Strength.m_itemid)
-               && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
-               || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+               && ((time > store.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+               || (time > store.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
                {
                        sound(player, CH_TRIGGER, SND_STRENGTH_FIRE, VOL_BASE, ATTEN_NORM);
-                       player.prevstrengthsound = time;
+                       store.prevstrengthsound = time;
                }
-               player.prevstrengthsoundattempt = time;
+               store.prevstrengthsoundattempt = time;
 }
 
 float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
@@ -79,14 +84,14 @@ void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this)
        this.takedamage = DAMAGE_NO;
        this.event_damage = func_null;
 
+       MUTATOR_CALLHOOK(PrepareExplosionByDamage, this, attacker);
+
        if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
        {
                this.owner = attacker;
                this.realowner = attacker;
        }
 
-       MUTATOR_CALLHOOK(PrepareExplosionByDamage, this, attacker);
-
        // do not explode NOW but in the NEXT FRAME!
        // because recursive calls to RadiusDamage are not allowed
        this.nextthink = time;
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 2a0fad7dee0c832e086d8feb2ff85ea347d7f3d3..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>
@@ -54,27 +56,23 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw
 
 void W_HitPlotAnalysis(entity player, .entity weaponentity, vector screenforward, vector screenright, vector screenup)
 {
-       vector hitplot;
-       vector org;
-       float lag;
-
-       if(player.hitplotfh >= 0)
+       if(CS(player).hitplotfh >= 0)
        {
-               lag = ANTILAG_LATENCY(player);
+               float lag = ANTILAG_LATENCY(player);
                if(lag < 0.001)
                        lag = 0;
                if(!IS_REAL_CLIENT(player))
                        lag = 0; // only antilag for clients
 
-               org = player.origin + player.view_ofs;
+               vector org = player.origin + player.view_ofs;
                traceline_antilag_force(player, org, org + screenforward * max_shot_distance, MOVE_NORMAL, player, lag);
                if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
                {
                    entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
                        antilag_takeback(trace_ent, store, time - lag);
-                       hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
+                       vector hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
                        antilag_restore(trace_ent, store);
-                       fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.(weaponentity).m_switchweapon.m_id), "\n"));
+                       fputs(CS(player).hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.(weaponentity).m_switchweapon.m_id), "\n"));
                        //print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
                }
        }
@@ -84,17 +82,17 @@ void W_HitPlotOpen(entity player)
 {
        if(autocvar_g_hitplots || strhasword(autocvar_g_hitplots_individuals, player.netaddress))
        {
-               player.hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE);
-               fputs(player.hitplotfh, strcat("#name ", playername(player, false), "\n"));
+               CS(player).hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE);
+               fputs(CS(player).hitplotfh, strcat("#name ", playername(player, false), "\n"));
        }
-       else { player.hitplotfh = -1; }
+       else { CS(player).hitplotfh = -1; }
 }
 
 void W_HitPlotClose(entity player)
 {
-       if(player.hitplotfh >= 0)
+       if(CS(player).hitplotfh >= 0)
        {
-               fclose(player.hitplotfh);
-               player.hitplotfh = -1;
+               fclose(CS(player).hitplotfh);
+               CS(player).hitplotfh = -1;
        }
 }
index 895c65ae29b0ab7def236c753c9fce930c3288b4..776d8d8d0f43800999a3b10829cb3c9c20cc2d93 100644 (file)
@@ -44,7 +44,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 {
        float f = 0;
 
-       if (time < this.hasweapon_complain_spam)
+       if (time < CS(this).hasweapon_complain_spam)
                complain = 0;
 
        // ignore hook button when using other offhand equipment
@@ -53,7 +53,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
            complain = 0;
 
        if (complain)
-               this.hasweapon_complain_spam = time + 0.2;
+               CS(this).hasweapon_complain_spam = time + 0.2;
 
        if (wpn == WEP_Null)
        {
@@ -61,7 +61,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
                        sprint(this, "Invalid weapon\n");
                return false;
        }
-       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(this.dual_weapons & wpn.m_wepset))
+       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(PS(this).dual_weapons & wpn.m_wepset))
                return false; // no complaints needed
        if (this.weapons & WepSet_FromWeapon(wpn))
        {
@@ -290,7 +290,7 @@ void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponent
 void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity)
 {
        float w;
-       w = W_GetCycleWeapon(this, this.cvar_cl_weaponpriority, +1, imp, 1, (this.cvar_cl_weaponimpulsemode == 0), weaponentity);
+       w = W_GetCycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, imp, 1, (CS(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
        if(w > 0)
                W_SwitchWeapon(this, Weapons_from(w), weaponentity);
 }
@@ -303,7 +303,7 @@ void W_NextWeapon(entity this, int list, .entity weaponentity)
        else if(list == 1)
                W_CycleWeapon(this, this.weaponorder_byimpulse, -1, weaponentity);
        else if(list == 2)
-               W_CycleWeapon(this, this.cvar_cl_weaponpriority, -1, weaponentity);
+               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, -1, weaponentity);
 }
 
 // prev weapon
@@ -314,7 +314,7 @@ void W_PreviousWeapon(entity this, float list, .entity weaponentity)
        else if(list == 1)
                W_CycleWeapon(this, this.weaponorder_byimpulse, +1, weaponentity);
        else if(list == 2)
-               W_CycleWeapon(this, this.cvar_cl_weaponpriority, +1, weaponentity);
+               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, weaponentity);
 }
 
 // previously used if exists and has ammo, (second) best otherwise
index 071a0fea8bcb73fb1b2ebad279b7d26cbdcf3f83..eea33ddb7b98e71c762a7fc09f9d7f41856c7558 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);
 
@@ -9,7 +12,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 .int weaponcomplainindex;
 float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, float complain, float skipmissing, .entity weaponentity);
 
-#define w_getbestweapon(ent,wepent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true, wepent))
+#define w_getbestweapon(ent,wepent) Weapons_from(W_GetCycleWeapon(ent, CS(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
 
 void W_SwitchWeapon_Force(Player this, Weapon w, .entity weaponentity);
 
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 8e4f88b8cd3d8c4fcf957b1a154e815a4d5158a8..bf272a01a94e02d75041436a36b2c7ce1846ddad 100644 (file)
@@ -1,5 +1,7 @@
 #include "tracing.qh"
 
+#include <common/effects/all.qh>
+
 #include "accuracy.qh"
 #include "common.qh"
 #include "hitplot.qh"
@@ -25,10 +27,10 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
 {
        TC(Sound, snd);
        float nudge = 1; // added to traceline target and subtracted from result  TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
-       float oldsolid;
-       vector vecs, dv;
-       oldsolid = ent.dphitcontentsmask;
-       if (IS_PLAYER(ent) && ent.(weaponentity).m_weapon == WEP_RIFLE)
+       float oldsolid = ent.dphitcontentsmask;
+       if(!IS_CLIENT(ent))
+               antilag = false; // no antilag for non-clients!
+       if (IS_PLAYER(ent) && (ent.(weaponentity).m_weapon.spawnflags & WEP_FLAG_PENETRATEWALLS))
                ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
        else
                ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
@@ -60,12 +62,9 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
                W_HitPlotAnalysis(ent, weaponentity, v_forward, v_right, v_up);
 
        vector md = ent.(weaponentity).movedir;
-       if(md.x > 0)
-               vecs = md;
-       else
-               vecs = '0 0 0';
+       vector vecs = ((md.x > 0) ? md : '0 0 0');
 
-       dv = v_right * -vecs.y + v_up * vecs.z;
+       vector dv = v_right * -vecs.y + v_up * vecs.z;
        w_shotorg = ent.origin + ent.view_ofs + dv;
 
        // now move the shotorg forward as much as requested if possible
@@ -87,7 +86,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
        //vector prevend = w_shotend;
 
        if (antilag)
-       if (!ent.cvar_cl_noantilag)
+       if (!CS(ent).cvar_cl_noantilag)
        {
                if (autocvar_g_antilag == 1) // switch to "ghost" if not hitting original
                {
@@ -108,10 +107,10 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
                else if(autocvar_g_antilag == 3) // client side hitscan
                {
                        // this part MUST use prydon cursor
-                       if (ent.cursor_trace_ent)                 // client was aiming at someone
-                       if (ent.cursor_trace_ent != ent)         // just to make sure
-                       if (ent.cursor_trace_ent.takedamage)      // and that person is killable
-                       if (IS_PLAYER(ent.cursor_trace_ent)) // and actually a player
+                       if (CS(ent).cursor_trace_ent)                 // client was aiming at someone
+                       if (CS(ent).cursor_trace_ent != ent)         // just to make sure
+                       if (CS(ent).cursor_trace_ent.takedamage)      // and that person is killable
+                       if (IS_PLAYER(CS(ent).cursor_trace_ent)) // and actually a player
                        {
                                // verify that the shot would miss without antilag
                                // (avoids an issue where guns would always shoot at their origin)
@@ -119,11 +118,11 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
                                if (!trace_ent.takedamage)
                                {
                                        // verify that the shot would hit if altered
-                                       traceline(w_shotorg, ent.cursor_trace_ent.origin, MOVE_NORMAL, ent);
-                                       if (trace_ent == ent.cursor_trace_ent)
-                                               w_shotdir = normalize(ent.cursor_trace_ent.origin - w_shotorg);
+                                       traceline(w_shotorg, CS(ent).cursor_trace_ent.origin, MOVE_NORMAL, ent);
+                                       if (trace_ent == CS(ent).cursor_trace_ent)
+                                               w_shotdir = normalize(CS(ent).cursor_trace_ent.origin - w_shotorg);
                                        else
-                                               LOG_INFO("antilag fail\n");
+                                               LOG_INFO("antilag fail");
                                }
                        }
                }
@@ -186,7 +185,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
        #if 0
        mspercallsum += gettime(GETTIME_HIRES);
        mspercallcount += 1;
-       LOG_INFO("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n");
+       LOG_INFO("avg: ", ftos(mspercallcount / mspercallsum), " per sec");
        #endif
 
        proj.velocity = W_CalculateProjectileVelocity(proj.owner, proj.owner.velocity, pSpeed * dir, forceAbsolute);
@@ -265,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))
                        {
@@ -281,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);
@@ -351,12 +350,11 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
        else
                fireBullet_trace_callback_eff = EFFECT_BULLET;
 
-       float lag = ANTILAG_LATENCY(this);
+       float lag = ((IS_REAL_CLIENT(this)) ? ANTILAG_LATENCY(this) : 0);
        if(lag < 0.001)
                lag = 0;
-       if (!IS_REAL_CLIENT(this))
-               lag = 0;
-       if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
+       bool noantilag = ((IS_CLIENT(this)) ? CS(this).cvar_cl_noantilag : false);
+       if(autocvar_g_antilag == 0 || noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
        {
@@ -443,16 +441,17 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
                        break;
 
                float maxdist;
+               entity hitstore = IS_PLAYER(hit) ? PS(hit) : hit;
                if(max_solid_penetration < 0)
                        break;
-               else if(hit.ballistics_density < -1)
+               else if(hitstore.ballistics_density < -1)
                        break; // -2: no solid penetration, ever
-               else if(hit.ballistics_density < 0)
+               else if(hitstore.ballistics_density < 0)
                        maxdist = vlen(hit.maxs - hit.mins) + 1; // -1: infinite travel distance
-               else if(hit.ballistics_density == 0)
+               else if(hitstore.ballistics_density == 0)
                        maxdist = max_solid_penetration * solid_penetration_left;
                else
-                       maxdist = max_solid_penetration * solid_penetration_left * hit.ballistics_density;
+                       maxdist = max_solid_penetration * solid_penetration_left * hitstore.ballistics_density;
 
                if(maxdist <= autocvar_g_ballistics_mindistance)
                        break;
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..296d10fa6bd0bef9b26f857c6e86ed4db684b9f7 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>
@@ -47,21 +49,21 @@ void WeaponStats_ready(entity fh, entity pass, float status)
                case URL_READY_CANREAD:
                        // url_fclose is processing, we got a response for writing the data
                        // this must come from HTTP
-                       LOG_INFO("Got response from weapon stats server:\n");
+                       LOG_INFO("Got response from weapon stats server:");
                        while((s = url_fgets(fh)))
-                               LOG_INFO("  ", s, "\n");
-                       LOG_INFO("End of response.\n");
+                               LOG_INFO("  ", s);
+                       LOG_INFO("End of response.");
                        url_fclose(fh);
                        break;
                case URL_READY_CLOSED:
                        // url_fclose has finished
-                       LOG_INFO("Weapon stats written\n");
+                       LOG_INFO("Weapon stats written");
                        buf_del(weaponstats_buffer);
                        weaponstats_buffer = -1;
                        break;
                case URL_READY_ERROR:
                default:
-                       LOG_INFO("Weapon stats writing failed: ", ftos(status), "\n");
+                       LOG_INFO("Weapon stats writing failed: ", ftos(status));
                        buf_del(weaponstats_buffer);
                        weaponstats_buffer = -1;
                        break;
index 2e4e160b3e16f1727a810cf3418a8d41b1a81b1e..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)
@@ -457,7 +457,8 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                .entity wepe1 = weaponentities[0];
                entity wep1 = actor.(wepe1);
                this.m_switchweapon = wep1.m_switchweapon;
-               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(actor.dual_weapons & wep1.m_switchweapon.m_wepset))
+               entity store = IS_PLAYER(actor) ? PS(actor) : actor;
+               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(store.dual_weapons & wep1.m_switchweapon.m_wepset))
                {
                        this.m_weapon = WEP_Null;
                        this.m_switchingweapon = WEP_Null;
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 ebb232105f51a66d03770486c0afe3950c44f7fb..e835fa67135e5145c0c8bd97ace8512c05492b4f 100755 (executable)
@@ -2,6 +2,25 @@
 set -eu
 cd ${0%/*}
 
+# This script attempts to build the codebase in every possible header configuration,
+# to check that all files #include what they need, so that we can eventually move away
+# from a unity build and into incremental compilation.
+
+# If these files exist from previous compilation, `./all compile` will stop
+# detecting changes after running this script so delete them to trigger
+# a recompile next time.
+if [ -f ../../csprogs.dat ]; then
+    rm ../../csprogs.dat
+fi
+
+if [ -f ../../menu.dat ]; then
+    rm ../../menu.dat
+fi
+
+if [ -f ../../progs.dat ]; then
+    rm ../../progs.dat
+fi
+
 WORKDIR=../.tmp
 
 CPP="cc -xc -E"
@@ -11,6 +30,9 @@ declare -a QCCDEFS=(
     -DNDEBUG=1
     -DXONOTIC=1
     -DWATERMARK="\"$(git describe --tags --dirty='~')\""
+    -DENABLE_EFFECTINFO=0
+    -DENABLE_DEBUGDRAW=0
+    -DENABLE_DEBUGTRACE=0
 )
 QCCDEFS="${QCCDEFS[@]}"
 
@@ -37,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
index de047606960e58d730efcd8b8913232a4551b7de..930a0e7b1d2c12f89149645d2bb646e7ba8c5904 100644 (file)
@@ -4,4 +4,4 @@ mod_q3bsp_sRGBlightmaps 0
 r_hdr_scenebrightness 1
 r_ambient 4
 
-menu_cmd sync
+menu_sync
index a8ff4ccff2b774c7603678a83862b65f23aecb14..107fdd50c23c289f53b3349fd62d7c34b0abc1ff 100644 (file)
@@ -4,4 +4,4 @@ mod_q3bsp_sRGBlightmaps 1
 r_hdr_scenebrightness 1
 r_ambient 0.25
 
-menu_cmd sync
+menu_sync
index 130bee7ab023805d72fd02799e399012692b277b..a538eafbb59c29b0ee036b4a1813626abb52c2f1 100644 (file)
@@ -2,7 +2,6 @@ models/ok_nade_counter/ok_nade_counter_01
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_01"
                blendfunc add
@@ -12,7 +11,6 @@ models/ok_nade_counter/ok_nade_counter_02
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_02"
                blendfunc add
@@ -22,7 +20,6 @@ models/ok_nade_counter/ok_nade_counter_03
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_03"
                blendfunc add
@@ -32,7 +29,6 @@ models/ok_nade_counter/ok_nade_counter_04
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_04"
                blendfunc add
@@ -42,7 +38,6 @@ models/ok_nade_counter/ok_nade_counter_05
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_05"
                blendfunc add
@@ -52,7 +47,6 @@ models/ok_nade_counter/ok_nade_counter_06
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_06"
                blendfunc add
@@ -62,7 +56,6 @@ models/ok_nade_counter/ok_nade_counter_07
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_07"
                blendfunc add
@@ -72,7 +65,6 @@ models/ok_nade_counter/ok_nade_counter_08
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_08"
                blendfunc add
@@ -82,9 +74,8 @@ models/ok_nade_counter/ok_nade_counter_09
 {
        dpnoshadow
        deformVertexes autosprite
-       dppolygonoffset -6000
        {
                map "models/ok_nade_counter/ok_nade_counter_09"
                blendfunc add
        }
-}
\ No newline at end of file
+}