]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into DefaultUser/trigger_cleanup
authorMario <mario@smbclan.net>
Wed, 25 Apr 2018 12:26:45 +0000 (22:26 +1000)
committerMario <mario@smbclan.net>
Wed, 25 Apr 2018 12:26:45 +0000 (22:26 +1000)
# Conflicts:
# qcsrc/common/triggers/func/pointparticles.qc
# qcsrc/common/triggers/misc/laser.qc
# qcsrc/common/triggers/target/music.qc

212 files changed:
.gitlab-ci.yml
.tx/merge-base
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-overkill.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
bal-wep-xpm.cfg
cmake/qcc.sh
common.kw.po
common.pl.po
common.pt.po
common.ru.po
gfx/hud/default/nade_veil.tga [new file with mode: 0644]
gfx/hud/luma/nade_veil.tga [new file with mode: 0644]
mutators.cfg
qcsrc/client/bgmscript.qc
qcsrc/client/bgmscript.qh
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/chat.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/vote.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/main.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/mutators/events.qh
qcsrc/client/player_skeleton.qc
qcsrc/client/player_skeleton.qh
qcsrc/client/shownames.qh
qcsrc/client/teamradar.qh
qcsrc/client/view.qc
qcsrc/client/wall.qc
qcsrc/client/wall.qh
qcsrc/client/weapons/projectile.qh
qcsrc/common/campaign_file.qc
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/debug.qh
qcsrc/common/effects/effectinfo.qc
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/effects/qc/modeleffects.qc
qcsrc/common/effects/qc/rubble.qh
qcsrc/common/ent_cs.qc
qcsrc/common/items/item.qh
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/c4.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/minigame/pp.qc
qcsrc/common/minigames/minigame/ps.qc
qcsrc/common/minigames/minigame/ttt.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/models/model.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_spawn.qc
qcsrc/common/mutators/base.qh
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc
qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc
qcsrc/common/mutators/mutator/instagib/_mod.qh
qcsrc/common/mutators/mutator/instagib/sv_items.qc
qcsrc/common/mutators/mutator/instagib/sv_items.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/kick_teamkiller/_mod.qh
qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qc
qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc
qcsrc/common/mutators/mutator/nades/nades.inc
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/offhand_blaster/_mod.qh
qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc
qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/pinata/sv_pinata.qc
qcsrc/common/mutators/mutator/random_items/sv_random_items.qc
qcsrc/common/mutators/mutator/random_items/sv_random_items.qh
qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc
qcsrc/common/mutators/mutator/vampire/sv_vampire.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
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/sound.qh
qcsrc/common/stats.qh
qcsrc/common/t_items.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/misc/corner.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/misc/teleport_dest.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/music.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/keylock.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/turret/plasma.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/turrets/turret/plasma_dual.qh
qcsrc/common/util.qc
qcsrc/common/viewloc.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/tuba.qh
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vaporizer.qh
qcsrc/ecs/systems/sv_physics.qc
qcsrc/lib/_all.inc
qcsrc/lib/accumulate.qh
qcsrc/lib/color.qh
qcsrc/lib/compiler.qh
qcsrc/lib/cvar.qh
qcsrc/lib/defer.qh
qcsrc/lib/math.qh
qcsrc/lib/matrix/command.qc
qcsrc/lib/matrix/matrix.qc
qcsrc/lib/misc.qh
qcsrc/lib/net.qh
qcsrc/lib/noise.qh
qcsrc/lib/oo.qh
qcsrc/lib/registry.qh
qcsrc/lib/replicate.qh
qcsrc/lib/self.qh
qcsrc/lib/sortlist.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/static.qh
qcsrc/lib/stats.qh
qcsrc/lib/string.qh
qcsrc/lib/test.qh
qcsrc/lib/urllib.qc
qcsrc/lib/warpzone/mathlib.qc
qcsrc/menu/item/inputbox.qc
qcsrc/menu/item/label.qc
qcsrc/menu/menu.qc
qcsrc/menu/mutators/events.qh
qcsrc/menu/xonotic/campaign.qc
qcsrc/menu/xonotic/crosshairpreview.qc
qcsrc/menu/xonotic/cvarlist.qc
qcsrc/menu/xonotic/demolist.qc
qcsrc/menu/xonotic/dialog_multiplayer_create.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qc
qcsrc/menu/xonotic/hudskinlist.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/maplist.qc
qcsrc/menu/xonotic/playermodel.qc
qcsrc/menu/xonotic/screenshotimage.qc
qcsrc/menu/xonotic/screenshotlist.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/serverlist.qh
qcsrc/menu/xonotic/soundlist.qc
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/weaponarenacheckbox.qc
qcsrc/server/autocvars.qh
qcsrc/server/bot/default/aim.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/bot/default/cvars.qh
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/campaign.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_models.qc
qcsrc/server/g_world.qc
qcsrc/server/ipban.qc
qcsrc/server/items.qc
qcsrc/server/items.qh
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/race.qc
qcsrc/server/resources.qc
qcsrc/server/scores.qc
qcsrc/server/teamplay.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/tools/qcc.sh
ruleset-nexuiz.cfg [new file with mode: 0644]
xonotic-server.cfg

index 6a842143433c4aad65a2cdaae25dd6aca2212806..c58eb15a10ed96944d5b46e5d9c0f6413a26e235 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=eb10d49149a894afd1c3e8af610dc98f
+    - EXPECT=b1292901bb00a3586142f1ab2b205c70
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index f60d2b8f88b73fa9b90c0e97acacb0922b866b6e..53527f3c728703d8d1aa6e9f5fc126198c7d0dbf 100644 (file)
@@ -1 +1 @@
-Mon Mar  5 07:23:48 CET 2018
+Fri Apr 20 07:23:54 CEST 2018
index 57d5d745df29da9d5b3dfc3cd8f0a7611bbeeeb5..4c0eebfaec10477bb9453657b376beb88efa0376 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
index f7d912ca773649743831610ab52209ee3704dee3..f10275919ea0e7b31fe5378fbaedb7b549775b04 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage -1
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
index 9cfffed10b02114e478653d4ea7ea117ad744c0e..317c8a9f8a870f65ad07a3221f7d4a6a63cc7ec9 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
index b3ec457a8af5ae1f8b4a62c3656d146d3af33fda..295756779b58dc5875e3ae8cb685c1264441e5cb 100644 (file)
@@ -502,6 +502,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
index cc8936c3381c9a3a0f1c1eb055071a558525227c..fc9a1ddf83775c9144a93251589083a022c96363 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
index 2fb8464099e82c71738711fcd5d834ad7a883058..9048f383d739951b288bcf314a6c744d06a26eb6 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
@@ -750,7 +751,7 @@ set g_balance_arc_beam_heat 0
 set g_balance_arc_burst_heat 5
 set g_balance_arc_beam_maxangle 10
 set g_balance_arc_beam_nonplayerdamage 80
-set g_balance_arc_beam_range 4000
+set g_balance_arc_beam_range 2000
 set g_balance_arc_beam_refire 0.25
 set g_balance_arc_beam_returnspeed 8
 set g_balance_arc_beam_tightness 0.95
index ac5be34f3783b822759d7b26922629c1adedd52b..2a391a202dd703a1e9eb6c66607037769a728f91 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_porto_weaponthrowable 1
 set g_balance_vaporizer_primary_ammo 10
 set g_balance_vaporizer_primary_animtime 0.3
 set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_force 800
 set g_balance_vaporizer_primary_refire 1
 set g_balance_vaporizer_reload_ammo 0
 set g_balance_vaporizer_reload_time 0
index b7c77fd563a35a24ca2b4c1c1b5a4319861b5d52..a6038dd59131c5df736e0862c8b29086f6833162 100755 (executable)
@@ -3,7 +3,16 @@ CPP=${CPP:-cpp}
 QCC=${QCC:-$PWD/../../gmqcc/gmqcc${CMAKE_EXECUTABLE_SUFFIX}}
 case $1 in
     compile)
-        ${CPP} ${@:3} | sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' > $2
+        for var in "$@"; do case "$var" in
+            -I*)
+                home=${var:2}
+                break
+                ;;
+        esac; done
+        ${CPP} ${@:3} \
+            | sed -E "s|${home}|~|g" \
+            | sed -E 's/^#(line)? ([[:digit:]]+) "(.*)".*/'$'\\\n''#pragma file(\3)'$'\\\n''#pragma line(\2)/g' \
+            > $2
     ;;
     link)
         ${QCC} \
index 33fbaf5be42b6257b4e7a8dd963119c9d8036ff7..9c550db7c1d0f57b30022d4c1c18f8bab346812f 100644 (file)
@@ -3,7 +3,8 @@
 # This file is distributed under the same license as the PACKAGE package.
 #
 # Translators:
-# Nicky Rowe <nickyrowe@gmail.com>, 2016
+# Nicky Rowe <nickyrowe688@gmail.com>, 2016
+# Nicky Rowe <nickyrowe688@gmail.com>, 2016
 msgid ""
 msgstr ""
 "Project-Id-Version: Xonotic\n"
index f8c5ab3bb4e145ab0637ed0f6d8413168984aa90..0b40453da5c9aa0dc5cfe785e3add14ea5e6ba47 100644 (file)
 # Kriss Chr <kriss7475@gmail.com>, 2017
 # Piotr Kozica <koza91@gmail.com>, 2016
 # Rafał Szymański <okavasly@gmail.com>, 2017
-# Robert Wolniak <robert.wolniak@gmail.com>, 2015
+# Robert Wolniak <robert.wolniak@gmail.com>, 2015,2018
 # Sertomas, 2014
 msgid ""
 msgstr ""
 "Project-Id-Version: Xonotic\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-07-09 00:35+0200\n"
-"PO-Revision-Date: 2017-09-20 00:10+0000\n"
-"Last-Translator: Rafał Szymański <okavasly@gmail.com>\n"
+"PO-Revision-Date: 2018-04-19 09:01+0000\n"
+"Last-Translator: Robert Wolniak <robert.wolniak@gmail.com>\n"
 "Language-Team: Polish (http://www.transifex.com/team-xonotic/xonotic/"
 "language/pl/)\n"
 "Language: pl\n"
@@ -1158,7 +1158,7 @@ msgstr ""
 
 #: qcsrc/common/gamemodes/gamemode/nexball/weapon.qh:7
 msgid "Ball Stealer"
-msgstr ""
+msgstr "Złodziej Kuli"
 
 #: qcsrc/common/items/item/armor.qh:111
 msgid "Big armor"
@@ -1310,6 +1310,8 @@ msgid ""
 "Kill enemies to freeze them, stand next to frozen teammates to revive them; "
 "freeze all enemies to win"
 msgstr ""
+"Zabijaj przeciwników by ich zamrozić i stój obok członków swojej drużyny by "
+"ich wskrzesić; aby wygrać, zamroź wszystkich wrogów"
 
 #: qcsrc/common/mapinfo.qh:446
 msgid "Hold the ball to get points for kills"
@@ -1468,6 +1470,8 @@ msgid ""
 "You lost the game!\n"
 "Select \"^1Next Match^7\" on the menu for a rematch!"
 msgstr ""
+"Przegrana meczu!\n"
+"Wybierz w menu opcję \"^1Następny Mecz^7\" po rewanż!"
 
 #: qcsrc/common/minigames/minigame/pp.qc:444
 #: qcsrc/common/minigames/minigame/ttt.qc:325
@@ -1475,16 +1479,18 @@ msgid ""
 "You win!\n"
 "Select \"^1Next Match^7\" on the menu to start a new match!"
 msgstr ""
+"Wygrana!\n"
+"Wybierz w menu opcję \"^1Następny Mecz^7\" by rozpocząć nową grę!"
 
 #: qcsrc/common/minigames/minigame/pp.qc:450
 #: qcsrc/common/minigames/minigame/ttt.qc:331
 msgid "Select \"^1Next Match^7\" on the menu to start a new match!"
-msgstr ""
+msgstr "Wybierz w menu opcję \"^1Następny Mecz^7\" by rozpocząć nową grę!"
 
 #: qcsrc/common/minigames/minigame/pp.qc:451
 #: qcsrc/common/minigames/minigame/ttt.qc:332
 msgid "Wait for your opponent to confirm the rematch"
-msgstr ""
+msgstr "Poczekaj aż twój przeciwnik potwierdzi rewanż."
 
 #: qcsrc/common/minigames/minigame/pp.qc:582
 #: qcsrc/common/minigames/minigame/ttt.qc:665
index ec526d5e35b64187d305a117a1b2087a16b86cc5..c7f46b867abaea8e99456dd866004e98d4522777 100644 (file)
@@ -4,7 +4,7 @@
 #
 # Translators:
 # Ivan Paulos Tomé <greylica@gmail.com>, 2016
-# Jean Trindade Pereira <jean_trindade2@hotmail.com>, 2015-2017
+# Jean Trindade Pereira <jean_trindade2@hotmail.com>, 2015-2018
 # Mirio <opivy@hotmail.de>, 2017
 # NotThatPrivate Yes <henriqueferreira2009@gmail.com>, 2015
 # Ricardo Manuel da Cruz Coelho da Silva <ricardo.mccs@gmail.com>, 2015
@@ -13,7 +13,7 @@ msgstr ""
 "Project-Id-Version: Xonotic\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-07-09 00:35+0200\n"
-"PO-Revision-Date: 2017-12-21 15:23+0000\n"
+"PO-Revision-Date: 2018-04-17 20:43+0000\n"
 "Last-Translator: Jean Trindade Pereira <jean_trindade2@hotmail.com>\n"
 "Language-Team: Portuguese (http://www.transifex.com/team-xonotic/xonotic/"
 "language/pt/)\n"
@@ -765,16 +765,16 @@ msgid ""
 "^3caps^7                     How often a flag (CTF) or a key (KeyHunt) was "
 "captured\n"
 msgstr ""
-"^3capturas^7 Quão frequente uma bandeira (CTF) ou uma chave (KeyHunt) foi "
-"capturada\n"
+"^3capturas^7 Quão frequente uma bandeira (CTF) ou uma chave (Caça a Chaves) "
+"foi capturada\n"
 
 #: qcsrc/client/hud/panel/scoreboard.qc:317
 msgid ""
 "^3pickups^7                  How often a flag (CTF) or a key (KeyHunt) or a "
 "ball (Keepaway) was picked up\n"
 msgstr ""
-"^3coletas^7. Quão frequente uma bandeira (CTF), uma chave (KeyHunt) ou uma "
-"bola (Keepaway) foi coletada\n"
+"^3coletas^7. Quão frequente uma bandeira (CTF), uma chave (Caça a Chaves) ou "
+"uma bola (Keepaway) foi coletada\n"
 
 #: qcsrc/client/hud/panel/scoreboard.qc:318
 msgid "^3captime^7                  Time of fastest cap (CTF)\n"
@@ -1207,7 +1207,7 @@ msgstr "Consiga o máximo de execuções que puder"
 
 #: qcsrc/common/mapinfo.qh:111
 msgid "Last Man Standing"
-msgstr "Last Man Standing"
+msgstr "Último Homem de Pé"
 
 #: qcsrc/common/mapinfo.qh:111
 msgid "Survive and kill until the enemies have no lives left"
@@ -1251,7 +1251,7 @@ msgstr ""
 
 #: qcsrc/common/mapinfo.qh:249
 msgid "Clan Arena"
-msgstr "Clan Arena"
+msgstr "Clã Arena"
 
 #: qcsrc/common/mapinfo.qh:249
 msgid "Kill all enemy teammates to win the round"
@@ -1263,7 +1263,7 @@ msgstr "Capture e defenda todos os pontos de controle para vencer"
 
 #: qcsrc/common/mapinfo.qh:287
 msgid "Domination"
-msgstr "Domination"
+msgstr "Dominação"
 
 #: qcsrc/common/mapinfo.qh:319
 msgid "Gather all the keys to win the round"
@@ -1271,11 +1271,11 @@ msgstr "Colete todas as chaves para vencer a rodada"
 
 #: qcsrc/common/mapinfo.qh:319
 msgid "Key Hunt"
-msgstr "Key Hunt"
+msgstr "Caça a Chaves"
 
 #: qcsrc/common/mapinfo.qh:353
 msgid "Assault"
-msgstr "Assault"
+msgstr "Assalto"
 
 #: qcsrc/common/mapinfo.qh:353
 msgid ""
@@ -1291,11 +1291,11 @@ msgstr "Capture pontos de controle para alcançar e destruir o gerador inimigo"
 
 #: qcsrc/common/mapinfo.qh:371
 msgid "Onslaught"
-msgstr "Onslaught"
+msgstr "Massacre"
 
 #: qcsrc/common/mapinfo.qh:387
 msgid "Nexball"
-msgstr "Nexball"
+msgstr "Bola Nex"
 
 #: qcsrc/common/mapinfo.qh:387
 msgid "Shoot and kick the ball into the enemies goal, keep your goal clean"
@@ -1303,7 +1303,7 @@ msgstr "Atire e chute a bola no gol inimigo e mantenha seu gol limpo"
 
 #: qcsrc/common/mapinfo.qh:408
 msgid "Freeze Tag"
-msgstr "Freeze Tag"
+msgstr "Congela"
 
 #: qcsrc/common/mapinfo.qh:408
 msgid ""
@@ -1323,7 +1323,7 @@ msgstr "Keepaway"
 
 #: qcsrc/common/mapinfo.qh:461
 msgid "Invasion"
-msgstr "Invasion"
+msgstr "Invasão"
 
 #: qcsrc/common/mapinfo.qh:461
 msgid "Survive against waves of monsters"
@@ -5217,7 +5217,7 @@ msgstr "Tempo de desaparecimento:"
 
 #: qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc:25
 msgid "Flip messages order"
-msgstr "Trocar ordem de notificações"
+msgstr "Trocar ordem de mensagens"
 
 #: qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc:27
 #: qcsrc/menu/xonotic/dialog_hudpanel_quickmenu.qc:15
@@ -5704,7 +5704,7 @@ msgstr "Exibir munições"
 
 #: qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc:68
 msgid "Ammo bar alpha:"
-msgstr "Cor da barra de munições:"
+msgstr "Transparência da barra de munições:"
 
 #: qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc:74
 msgid "Ammo bar color:"
@@ -6327,7 +6327,7 @@ msgstr "Modificadores de armas e itens:"
 
 #: qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc:204
 msgid "Grappling hook"
-msgstr "Gancho (grappling hook)"
+msgstr "Gancho de escalada"
 
 #: qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc:205
 msgid "Players spawn with the grappling hook"
index 6d72e0a5fb673c3f388f65d134311021610138d6..06e1922ae77fc612fb754d24eb30aba42d40dd4f 100644 (file)
@@ -18,7 +18,7 @@ msgstr ""
 "Project-Id-Version: Xonotic\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-07-09 00:35+0200\n"
-"PO-Revision-Date: 2018-03-04 20:57+0000\n"
+"PO-Revision-Date: 2018-03-16 06:43+0000\n"
 "Last-Translator: Andrei Stepanov\n"
 "Language-Team: Russian (http://www.transifex.com/team-xonotic/xonotic/"
 "language/ru/)\n"
@@ -8360,11 +8360,11 @@ msgstr "Беречь время процессора для других при
 
 #: qcsrc/menu/xonotic/dialog_settings_misc.qc:129
 msgid "Show frames per second"
-msgstr "Показывать кол-во кадров в секунду (FPS)"
+msgstr "Показывать счётчик кадров (FPS)"
 
 #: qcsrc/menu/xonotic/dialog_settings_misc.qc:130
 msgid "Show your rendered frames per second"
-msgstr "Показывать кол-во отрисованных кадров в секунду"
+msgstr "Показывать количество отрисованных кадров в секунду"
 
 #: qcsrc/menu/xonotic/dialog_settings_misc.qc:135
 msgid "Menu tooltips:"
diff --git a/gfx/hud/default/nade_veil.tga b/gfx/hud/default/nade_veil.tga
new file mode 100644 (file)
index 0000000..3134d1b
Binary files /dev/null and b/gfx/hud/default/nade_veil.tga differ
diff --git a/gfx/hud/luma/nade_veil.tga b/gfx/hud/luma/nade_veil.tga
new file mode 100644 (file)
index 0000000..edb66b5
Binary files /dev/null and b/gfx/hud/luma/nade_veil.tga differ
index ff5cf3223d1050efcb6a8e2b194297b6ae234206..c997a807f459574846fc3de6b11af14ddbe7447b 100644 (file)
@@ -198,7 +198,7 @@ set g_nades_nade_edgedamage 90
 set g_nades_nade_radius 300
 set g_nades_nade_force 650
 set g_nades_nade_newton_style 0 "0 is absolute, 1 is relative (takes into account player speed), 2 is something in between"
-set g_nades_nade_type 1 "Type of the off-hand grenade. 1:normal 2:napalm 3:ice 4:translocate 5:spawn 6:heal 7:pokenade 8:entrap"
+set g_nades_nade_type 1 "Type of the off-hand grenade. 1:normal 2:napalm 3:ice 4:translocate 5:spawn 6:heal 7:pokenade 8:entrap 9:veil"
 
 seta cl_nade_timer 1 "show a visual timer for nades, 1 = only circle, 2 = circle with text"
 seta cl_nade_type 3
@@ -216,7 +216,7 @@ seta cl_pokenade_type "zombie"
 //
 set g_nades_bonus 0 "Enable bonus grenades"
 set g_nades_bonus_client_select 0 "Allow client side selection of bonus nade type"
-set g_nades_bonus_type 2 "Type of the bonus grenade. 1:normal 2:napalm 3:ice 4:translocate 5:spawn 6:heal 7:pokenade 8:entrap"
+set g_nades_bonus_type 2 "Type of the bonus grenade. 1:normal 2:napalm 3:ice 4:translocate 5:spawn 6:heal 7:pokenade 8:entrap 9:veil"
 set g_nades_bonus_onstrength 1 "Always give bonus grenades to players that have the strength powerup"
 set g_nades_bonus_max 3 "Maximum number of bonus grenades"
 set g_nades_bonus_only 0 "Disallow regular nades, only bonus nades can be used"
@@ -274,6 +274,10 @@ set g_nades_entrap_speed 0.5 "Running speed while entrapped"
 set g_nades_entrap_time 10 "Life time of the orb"
 set g_nades_entrap_radius 500
 
+// Veil (9)
+set g_nades_veil_time 8 "Life time of the orb"
+set g_nades_veil_radius 200
+
 
 // ============
 //  camp check
index 2db9e54cf1af01dfd8bf9e0348a204f11d9e4f47..02739194a858b799752f06dca40e36b8aade1bae 100644 (file)
@@ -11,12 +11,12 @@ float bgmscriptbuf;
 float bgmscriptbufsize;
 float bgmscriptbufloaded;
 
-class(BGMScript) .float bgmscriptline;
-class(BGMScript) .float bgmscriptline0;
-class(BGMScript) .float bgmscriptvolume;
-class(BGMScript) .float bgmscripttime;
-class(BGMScript) .float bgmscriptstate;
-class(BGMScript) .float bgmscriptstatetime;
+classfield(BGMScript) .float bgmscriptline;
+classfield(BGMScript) .float bgmscriptline0;
+classfield(BGMScript) .float bgmscriptvolume;
+classfield(BGMScript) .float bgmscripttime;
+classfield(BGMScript) .float bgmscriptstate;
+classfield(BGMScript) .float bgmscriptstatetime;
 
 float GetAttackDecaySustainAmplitude(float a, float d, float s, float t)
 {
@@ -139,8 +139,7 @@ void BGMScript_InitEntity(entity e)
                if(i >= bgmscriptbufsize)
                {
                        LOG_INFOF("ERROR: bgmscript does not define %s", e.bgmscript);
-                       strunzone(e.bgmscript);
-                       e.bgmscript = string_null;
+                       strfree(e.bgmscript);
                }
        }
 }
index 18b0d5ee4231c5c9e95998fdad5be86331b0b1e8..a3044d537cd3200bedd070f38be867b801456e9e 100644 (file)
@@ -1,13 +1,13 @@
 #pragma once
 
 entityclass(BGMScript);
-class(BGMScript) .string bgmscript;
-class(BGMScript) .float bgmscriptattack;
-class(BGMScript) .float bgmscriptdecay;
-class(BGMScript) .float bgmscriptsustain;
-class(BGMScript) .float bgmscriptrelease;
+classfield(BGMScript) .string bgmscript;
+classfield(BGMScript) .float bgmscriptattack;
+classfield(BGMScript) .float bgmscriptdecay;
+classfield(BGMScript) .float bgmscriptsustain;
+classfield(BGMScript) .float bgmscriptrelease;
 
-class(BGMScript) .float just_toggled;
+classfield(BGMScript) .float just_toggled;
 
 #ifdef CSQC
 void BGMScript_InitEntity(entity e);
index 8faf0f387b6ccd33103cbfd825dec2692a7ac760..8eea240d40f4da8ebdd79bb9dee4a30b364e19b2 100644 (file)
@@ -418,7 +418,7 @@ void LocalCommand_sendcvar(int request, int argc)
                        if (argv(1))
                        {
                                // W_FixWeaponOrder will trash argv, so save what we need.
-                               string thiscvar = strzone(argv(1));
+                               string thiscvar = string_null; strcpy(thiscvar, argv(1));
                                string s = cvar_string(thiscvar);
 
                                if (thiscvar == "cl_weaponpriority")
@@ -427,7 +427,7 @@ void LocalCommand_sendcvar(int request, int argc)
                                        s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0);
 
                                localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n");
-                               strunzone(thiscvar);
+                               strfree(thiscvar);
                                return;
                        }
                }
index 9bcdd3d6624422a18a245423dc2f44589d6a090c..01799caccc7d307e5c99daabde9263750e24b232 100644 (file)
@@ -579,12 +579,8 @@ void HUD_Main()
        // Drawing stuff
        if (hud_skin_prev != autocvar_hud_skin)
        {
-               if (hud_skin_path)
-                       strunzone(hud_skin_path);
-               hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
-               if (hud_skin_prev)
-                       strunzone(hud_skin_prev);
-               hud_skin_prev = strzone(autocvar_hud_skin);
+               strcpy(hud_skin_path, strcat("gfx/hud/", autocvar_hud_skin));
+               strcpy(hud_skin_prev, autocvar_hud_skin);
        }
 
        // draw the dock
@@ -659,9 +655,7 @@ void HUD_Main()
                        LOG_TRACE("Automatically fixed wrong/missing panel numbers in _hud_panelorder");
 
                cvar_set("_hud_panelorder", s);
-               if(hud_panelorder_prev)
-                       strunzone(hud_panelorder_prev);
-               hud_panelorder_prev = strzone(s);
+               strcpy(hud_panelorder_prev, s);
 
                //now properly set panel_order
                tokenize_console(s);
index d070dce380d3b4877f5ac6457a9993a388717957..496d775efe4f3ad39c0a1a26196753bfb089b82a 100644 (file)
@@ -120,18 +120,18 @@ vector panel_size_copied;
 
 entity panel;
 entityclass(HUDPanel);
-class(HUDPanel) .string panel_name;
-class(HUDPanel) .int panel_id;
-class(HUDPanel) .vector current_panel_pos;
-class(HUDPanel) .vector current_panel_size;
-class(HUDPanel) .string current_panel_bg;
-class(HUDPanel) .float current_panel_bg_alpha;
-class(HUDPanel) .float current_panel_bg_border;
-class(HUDPanel) .vector current_panel_bg_color;
-class(HUDPanel) .float current_panel_bg_color_team;
-class(HUDPanel) .float current_panel_bg_padding;
-class(HUDPanel) .float current_panel_fg_alpha;
-class(HUDPanel) .float update_time;
+classfield(HUDPanel) .string panel_name;
+classfield(HUDPanel) .int panel_id;
+classfield(HUDPanel) .vector current_panel_pos;
+classfield(HUDPanel) .vector current_panel_size;
+classfield(HUDPanel) .string current_panel_bg;
+classfield(HUDPanel) .float current_panel_bg_alpha;
+classfield(HUDPanel) .float current_panel_bg_border;
+classfield(HUDPanel) .vector current_panel_bg_color;
+classfield(HUDPanel) .float current_panel_bg_color_team;
+classfield(HUDPanel) .float current_panel_bg_padding;
+classfield(HUDPanel) .float current_panel_fg_alpha;
+classfield(HUDPanel) .float update_time;
 float panel_enabled;
 vector panel_pos;
 vector panel_size;
@@ -148,7 +148,7 @@ string panel_bg_border_str;
 float panel_bg_padding;
 string panel_bg_padding_str;
 
-class(HUDPanel) .void() panel_draw;
+classfield(HUDPanel) .void() panel_draw;
 
 // chat panel can be reduced / moved while the mapvote is active
 // let know the mapvote panel about chat pos and size
@@ -264,9 +264,7 @@ REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    PANEL_CONFIG_NO
                        }                                                                                                       \
                }                                                                                                           \
        }                                                                                                               \
-       if (panel.current_panel_bg)                                                                                     \
-               strunzone(panel.current_panel_bg);                                                                          \
-       panel.current_panel_bg = strzone(panel_bg);                                                                     \
+       strcpy(panel.current_panel_bg, panel_bg);                                                                       \
 } MACRO_END
 
 // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
index ec07ee4095a30e3c1c462f25fae034882e87b123..3c93a6d64ca1b5723817c94eaa4287a16c28e745 100644 (file)
@@ -1029,9 +1029,7 @@ void HUD_Panel_FirstInDrawQ(float id)
                s = strcat(s, ftos(panel_order[i]), " ");
        }
        cvar_set("_hud_panelorder", s);
-       if(hud_panelorder_prev)
-               strunzone(hud_panelorder_prev);
-       hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
+       strcpy(hud_panelorder_prev, autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
 }
 
 void HUD_Panel_Highlight(float allow_move)
index a92bdc69234a1dac1f90762cd8a74243f986c17d..f8f70c8189e671de3cb01fd3d4c4a8aab3e7745a 100644 (file)
@@ -75,9 +75,7 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun
                        cpm_index = CENTERPRINT_MAX_MSGS - 1;
                j = cpm_index;
        }
-       if(centerprint_messages[j])
-               strunzone(centerprint_messages[j]);
-       centerprint_messages[j] = strzone(strMessage);
+       strcpy(centerprint_messages[j], strMessage);
        centerprint_msgID[j] = new_id;
        if (duration < 0)
        {
@@ -112,9 +110,7 @@ void reset_centerprint_messages()
                centerprint_expire_time[i] = 0;
                centerprint_time[i] = 1;
                centerprint_msgID[i] = 0;
-               if(centerprint_messages[i])
-                       strunzone(centerprint_messages[i]);
-               centerprint_messages[i] = string_null;
+               strfree(centerprint_messages[i]);
        }
 }
 float hud_configure_cp_generation_time;
index 74d4b6d0f49462f522298e276770244dc54e278a..5f309d0b0224bd4c019f9f4d51b29a9f851368a9 100644 (file)
@@ -48,9 +48,7 @@ void HUD_Chat()
                        panel_bg = strcat(hud_skin_path, "/border_default");
                        if(precache_pic(panel_bg) == "")
                                panel_bg = "gfx/hud/default/border_default";
-                       if(panel.current_panel_bg)
-                               strunzone(panel.current_panel_bg);
-                       panel.current_panel_bg = strzone(panel_bg);
+                       strcpy(panel.current_panel_bg, panel_bg);
                        chat_panel_modified = true;
                }
                panel_bg_alpha = max(0.75, panel_bg_alpha);
index 65682b3ec7d27006a653449ad69e7b725ba69516..0bbcb41484a85db250f8655e03ec4f16149c1b10 100644 (file)
@@ -583,9 +583,7 @@ void HUD_Mod_Race(vector pos, vector mySize)
        if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
                race_status_time = time + 5;
                race_status_prev = race_status;
-               if (race_status_name_prev)
-                       strunzone(race_status_name_prev);
-               race_status_name_prev = strzone(race_status_name);
+               strcpy(race_status_name_prev, race_status_name);
        }
 
        // race "awards"
@@ -621,12 +619,8 @@ void HUD_Mod_Race(vector pos, vector mySize)
        if (race_status_time - time <= 0) {
                race_status_prev = -1;
                race_status = -1;
-               if(race_status_name)
-                       strunzone(race_status_name);
-               race_status_name = string_null;
-               if(race_status_name_prev)
-                       strunzone(race_status_name_prev);
-               race_status_name_prev = string_null;
+               strfree(race_status_name);
+               strfree(race_status_name_prev);
        }
 }
 
index 9af8673dab8941adc2ad73decdd4834ba6ddce63..b84066b84f4de86723d9944b6de302d2711e23f3 100644 (file)
@@ -44,24 +44,16 @@ float QuickMenu_TimeOut;
 void QuickMenu_Page_LoadEntry(int i, string s, string s1)
 {
     TC(int, i);
-       //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
-       if (QuickMenu_Page_Description[i])
-               strunzone(QuickMenu_Page_Description[i]);
-       QuickMenu_Page_Description[i] = strzone(s);
-       if (QuickMenu_Page_Command[i])
-               strunzone(QuickMenu_Page_Command[i]);
-       QuickMenu_Page_Command[i] = strzone(s1);
+       //LOG_INFOF("^xc80 entry %d: %s, %s\n", i, s, s1);
+       strcpy(QuickMenu_Page_Description[i], s);
+       strcpy(QuickMenu_Page_Command[i], s1);
 }
 
 void QuickMenu_Page_ClearEntry(int i)
 {
     TC(int, i);
-       if (QuickMenu_Page_Description[i])
-               strunzone(QuickMenu_Page_Description[i]);
-       QuickMenu_Page_Description[i] = string_null;
-       if (QuickMenu_Page_Command[i])
-               strunzone(QuickMenu_Page_Command[i]);
-       QuickMenu_Page_Command[i] = string_null;
+       strfree(QuickMenu_Page_Description[i]);
+       strfree(QuickMenu_Page_Command[i]);
        QuickMenu_Page_Command_Type[i] = 0;
 }
 
@@ -197,9 +189,7 @@ void QuickMenu_Buffer_Close()
 
 void QuickMenu_Close()
 {
-       if (QuickMenu_CurrentSubMenu)
-               strunzone(QuickMenu_CurrentSubMenu);
-       QuickMenu_CurrentSubMenu = string_null;
+       strfree(QuickMenu_CurrentSubMenu);
        int i;
        for (i = 0; i < QUICKMENU_MAXLINES; ++i)
                QuickMenu_Page_ClearEntry(i);
@@ -217,18 +207,17 @@ void QuickMenu_Close()
 // It assumes submenu open tag is already detected
 void QuickMenu_skip_submenu(string submenu)
 {
-       string s, z_submenu;
-       z_submenu = strzone(submenu);
+       string z_submenu = string_null; strcpy(z_submenu, submenu);
        for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
        {
-               s = QuickMenu_Buffer_Get();
+               string s = QuickMenu_Buffer_Get();
                if(substring(s, 0, 1) != QM_TAG_SUBMENU)
                        continue;
                if(substring(s, 1, -1) == z_submenu) // submenu end
                        break;
                QuickMenu_skip_submenu(substring(s, 1, -1));
        }
-       strunzone(z_submenu);
+       strfree(z_submenu);
 }
 
 bool QuickMenu_IsOpened()
@@ -273,9 +262,7 @@ bool QuickMenu_Page_Load(string target_submenu, bool new_page)
                ++QuickMenu_Page;
 
        z_submenu = strzone(target_submenu);
-       if (QuickMenu_CurrentSubMenu)
-               strunzone(QuickMenu_CurrentSubMenu);
-       QuickMenu_CurrentSubMenu = strzone(z_submenu);
+       strcpy(QuickMenu_CurrentSubMenu, z_submenu);
 
        QuickMenu_IsLastPage = true;
        QuickMenu_Page_Entries = 0;
@@ -289,11 +276,11 @@ bool QuickMenu_Page_Load(string target_submenu, bool new_page)
                        s = QuickMenu_Buffer_Get();
                        if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
                        {
-                               // printf("^3 beginning of %s\n", z_submenu);
+                               //LOG_INFOF("^3 beginning of %s\n", z_submenu);
                                ++QuickMenu_Buffer_Index;
                                break; // target_submenu found!
                        }
-                       // printf("^1 skipping %s\n", s);
+                       //LOG_INFOF("^1 skipping %s\n", s);
                }
                if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
                        LOG_WARNF("Couldn't find submenu \"%s\"", z_submenu);
@@ -310,7 +297,7 @@ bool QuickMenu_Page_Load(string target_submenu, bool new_page)
 
                if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
                {
-                       // printf("^3 end of %s\n", z_submenu);
+                       //LOG_INFOF("^3 end of %s\n", z_submenu);
                        break;
                }
 
@@ -335,28 +322,32 @@ bool QuickMenu_Page_Load(string target_submenu, bool new_page)
                                QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
                        QuickMenu_skip_submenu(substring(s, 1, -1));
                }
-               else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
+               else if(substring(s, 0, 1) == QM_TAG_TITLE)
                {
                        ++QuickMenu_Buffer_Index;
-                       cmd = QuickMenu_Buffer_Get();
-                       string command_code = substring(cmd, 0, 1);
-                       if(command_code == QM_TAG_COMMAND)
-                               cmd = substring(cmd, 1, -1);
-                       else if(command_code == QM_TAG_PLCOMMAND)
+                       if(entry_num >= first_entry)
                        {
-                               // throw away the current quickmenu buffer and load a new one
-                               cmd = substring(cmd, 1, -1);
-                               strunzone(z_submenu);
-                               if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
-                                       return QuickMenu_Page_Load("", 0);
-                               QuickMenu_Close();
-                               return false;
-                       }
+                               cmd = QuickMenu_Buffer_Get();
+                               string command_code = substring(cmd, 0, 1);
+                               if(command_code == QM_TAG_COMMAND)
+                                       cmd = substring(cmd, 1, -1);
+                               else if(command_code == QM_TAG_PLCOMMAND)
+                               {
+                                       // throw away the current quickmenu buffer and load a new one
+                                       cmd = substring(cmd, 1, -1);
+                                       strunzone(z_submenu);
+                                       if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
+                                               return QuickMenu_Page_Load("", 0);
+                                       QuickMenu_Close();
+                                       return false;
+                               }
+
+                               tokenize_console(cmd);
+                               QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
 
-                       tokenize_console(cmd);
-                       QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
+                               QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
+                       }
 
-                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
                }
 
                ++entry_num;
@@ -519,10 +510,10 @@ void QuickMenu_Mouse()
 
        if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
        {
-               float entry_num;
-               entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
+               int entry_num = min(QuickMenu_Page_Entries - 1, floor((mousepos.y - first_entry_pos) / fontsize.y));
                if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
                {
+                       // recycling panel_pos as entry_pos
                        panel_pos.y = first_entry_pos + entry_num * fontsize.y;
                        vector color;
                        if(mouseClicked & S_MOUSE1)
@@ -798,6 +789,8 @@ void QuickMenu_Default(string target_submenu)
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
+               if(prvm_language != "en")
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Send in English")), "toggle hud_panel_quickmenu_translatecommands 0 1; quickmenu; wait; quickmenu default Chat")
        QUICKMENU_SMENU(_("Chat"), "Chat")
 
        if(teamplay)
@@ -858,8 +851,6 @@ void QuickMenu_Default(string target_submenu)
                }
 
                QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
-               if(prvm_language != "en")
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
        QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
 
        QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
@@ -876,9 +867,9 @@ void QuickMenu_Default(string target_submenu)
 
        if(target_submenu != "" && !target_submenu_found)
        {
-               LOG_WARNF("Couldn't find submenu \"%s\"", target_submenu);
+               LOG_INFOF("Couldn't find submenu \"%s\"", target_submenu);
                if(prvm_language != "en")
-                       LOG_WARNF("^3Warning: submenu must be in English", target_submenu);
+                       LOG_INFOF("^3Warning: submenu title must be in English", target_submenu);
                QuickMenu_Buffer_Size = 0;
        }
 }
index b1cc222ccf1a5dab7f70fa08373a41dd184cbe68..f0ec01c9e7b1847e68734896348da82b7658ad0f 100644 (file)
@@ -214,9 +214,7 @@ void HUD_Radar()
                        panel_bg = "gfx/hud/default/border_default"; // fallback
                if(!radar_panel_modified && panel_bg != panel.current_panel_bg)
                        radar_panel_modified = true;
-               if(panel.current_panel_bg)
-                       strunzone(panel.current_panel_bg);
-               panel.current_panel_bg = strzone(panel_bg);
+               strcpy(panel.current_panel_bg, panel_bg);
 
                switch(hud_panel_radar_maximized_zoommode)
                {
index f914df7dde266da81b331c964f871183c8e9030c..96d30aa52ce8559e6c4cc7dc234d74a44f2e9a99 100644 (file)
@@ -297,62 +297,65 @@ void Scoreboard_UpdateTeamPos(entity Team)
 void Cmd_Scoreboard_Help()
 {
        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 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(_("The following field names are recognized (case insensitive):"));
        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(_("^3fps^7                      Player FPS"));
-       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(_("^3teamkills^7                Number of teamkills"));
-       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(strcat("^3name^7                     ", _("Name of a player")));
+       LOG_INFO(strcat("^3nick^7                     ", _("Name of a player")));
+       LOG_INFO(strcat("^3ping^7                     ", _("Ping time")));
+       LOG_INFO(strcat("^3pl^7                       ", _("Packet loss")));
+       LOG_INFO(strcat("^3elo^7                      ", _("Player ELO")));
+       LOG_INFO(strcat("^3fps^7                      ", _("Player FPS")));
+       LOG_INFO(strcat("^3kills^7                    ", _("Number of kills")));
+       LOG_INFO(strcat("^3deaths^7                   ", _("Number of deaths")));
+       LOG_INFO(strcat("^3suicides^7                 ", _("Number of suicides")));
+       LOG_INFO(strcat("^3frags^7                    ", _("kills - suicides")));
+       LOG_INFO(strcat("^3teamkills^7                ", _("Number of teamkills")));
+       LOG_INFO(strcat("^3kd^7                       ", _("The kill-death ratio")));
+       LOG_INFO(strcat("^3dmg^7                      ", _("The total damage done")));
+       LOG_INFO(strcat("^3dmgtaken^7                 ", _("The total damage taken")));
+       LOG_INFO(strcat("^3sum^7                      ", _("kills - deaths")));
+       LOG_INFO(strcat("^3caps^7                     ", _("How often a flag (CTF) or a key (KeyHunt) was captured")));
+       LOG_INFO(strcat("^3pickups^7                  ", _("How often a flag (CTF) or a key (KeyHunt) or a ball (Keepaway) was picked up")));
+       LOG_INFO(strcat("^3captime^7                  ", _("Time of fastest cap (CTF)")));
+       LOG_INFO(strcat("^3fckills^7                  ", _("Number of flag carrier kills")));
+       LOG_INFO(strcat("^3returns^7                  ", _("Number of flag returns")));
+       LOG_INFO(strcat("^3drops^7                    ", _("Number of flag drops")));
+       LOG_INFO(strcat("^3lives^7                    ", _("Number of lives (LMS)")));
+       LOG_INFO(strcat("^3rank^7                     ", _("Player rank")));
+       LOG_INFO(strcat("^3pushes^7                   ", _("Number of players pushed into void")));
+       LOG_INFO(strcat("^3destroyed^7                ", _("Number of keys destroyed by pushing them into void")));
+       LOG_INFO(strcat("^3kckills^7                  ", _("Number of keys carrier kills")));
+       LOG_INFO(strcat("^3losses^7                   ", _("Number of times a key was lost")));
+       LOG_INFO(strcat("^3laps^7                     ", _("Number of laps finished (race/cts)")));
+       LOG_INFO(strcat("^3time^7                     ", _("Total time raced (race/cts)")));
+       LOG_INFO(strcat("^3fastest^7                  ", _("Time of fastest lap (race/cts)")));
+       LOG_INFO(strcat("^3ticks^7                    ", _("Number of ticks (DOM)")));
+       LOG_INFO(strcat("^3takes^7                    ", _("Number of domination points taken (DOM)")));
+       LOG_INFO(strcat("^3bckills^7                  ", _("Number of ball carrier kills")));
+       LOG_INFO(strcat("^3bctime^7                   ", _("Total amount of time holding the ball in Keepaway")));
+       LOG_INFO(strcat("^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"
                "or in all but these game types. You can also specify 'all' as a\n"
-               "field to show all fields available for the current game mode.\n\n"));
+               "field to show all fields available for the current game mode."));
+       LOG_INFO("");
 
        LOG_INFO(_("The special game type names 'teams' and 'noteams' can be used to\n"
-               "include/exclude ALL teams/noteams game modes.\n\n"));
+               "include/exclude ALL teams/noteams game modes."));
+       LOG_INFO("");
 
        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\nother gamemodes except DM.\n"));
+       LOG_INFO(_("will display name, ping and pl aligned to the left, and the fields\n"
+               "right of the vertical bar aligned to the right."));
+       LOG_INFO(_("'field3' will only be shown in CTF, and 'field4' will be shown in all\n"
+                       "other gamemodes except DM."));
 }
 
 // NOTE: adding a gametype with ? to not warn for an optional field
@@ -406,8 +409,7 @@ void Cmd_Scoreboard_SetFields(int argc)
                        argc = tokenizebyseparator(strcat("0 1 ", SCOREBOARD_DEFAULT_COLUMNS), " ");
                else if(argv(2) == "all")
                {
-                       string s;
-                       s = "ping pl name |";
+                       string s = "ping pl name |"; // scores without a label
                        FOREACH(Scores, true, {
                                if(it != ps_primary)
                                if(it != ps_secondary)
@@ -428,10 +430,8 @@ void Cmd_Scoreboard_SetFields(int argc)
 
        for(i = 1; i < argc - 1; ++i)
        {
-               float nocomplain;
                str = argv(i+1);
-
-               nocomplain = false;
+               bool nocomplain = false;
                if(substring(str, 0, 1) == "?")
                {
                        nocomplain = true;
@@ -448,8 +448,7 @@ void Cmd_Scoreboard_SetFields(int argc)
                                continue;
                }
 
-               strunzone(sbt_field_title[sbt_num_fields]);
-               sbt_field_title[sbt_num_fields] = strzone(TranslateScoresLabel(str));
+               strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(str));
                sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
                str = strtolower(str);
 
@@ -540,8 +539,7 @@ LABEL(found)
                }
                else if(!have_separator)
                {
-                       strunzone(sbt_field_title[sbt_num_fields]);
-                       sbt_field_title[sbt_num_fields] = strzone("|");
+                       strcpy(sbt_field_title[sbt_num_fields], "|");
                        sbt_field_size[sbt_num_fields] = stringwidth("|", false, hud_fontsize);
                        sbt_field[sbt_num_fields] = SP_SEPARATOR;
                        ++sbt_num_fields;
@@ -549,8 +547,7 @@ LABEL(found)
                }
                if(!have_secondary)
                {
-                       strunzone(sbt_field_title[sbt_num_fields]);
-                       sbt_field_title[sbt_num_fields] = strzone(TranslateScoresLabel(scores_label(ps_secondary)));
+                       strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(scores_label(ps_secondary)));
                        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;
@@ -558,8 +555,7 @@ LABEL(found)
                }
                if(!have_primary)
                {
-                       strunzone(sbt_field_title[sbt_num_fields]);
-                       sbt_field_title[sbt_num_fields] = strzone(TranslateScoresLabel(scores_label(ps_primary)));
+                       strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(scores_label(ps_primary)));
                        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;
@@ -1489,9 +1485,7 @@ void Scoreboard_Draw()
                        {
                                hud_fontsize = HUD_GetFontsize("hud_fontsize");
                                Scoreboard_initFieldSizes();
-                               if(hud_fontsize_str)
-                                       strunzone(hud_fontsize_str);
-                               hud_fontsize_str = strzone(autocvar_hud_fontsize);
+                               strcpy(hud_fontsize_str, autocvar_hud_fontsize);
                        }
                }
                else {
index 15e18e8f445a2b86f7ed9af851c332a856b99e4c..57b32039dc50fdf401d4da978413c0e4192a800f 100644 (file)
@@ -27,9 +27,7 @@ void HUD_Vote()
                        LOG_INFO(_("^1You must answer before entering hud configure mode"));
                        cvar_set("_hud_configure", "0");
                }
-               if(vote_called_vote)
-                       strunzone(vote_called_vote);
-               vote_called_vote = strzone(_("^2Name ^7instead of \"^1Anonymous player^7\" in stats"));
+               strcpy(vote_called_vote, _("^2Name ^7instead of \"^1Anonymous player^7\" in stats"));
                uid2name_dialog = 1;
        }
 
index cebd8f5d65c162b6e3d15d90a5e7a496bbbc0858..4506f69a0c591b603d41ca4fa5f6a497581c071f 100644 (file)
@@ -30,7 +30,7 @@ int weaponorder_cmp(int i, int j, entity pass)
        int nHidden = 0; \
        FOREACH(Weapons, it != WEP_Null, { \
                if (weapons_stat & WepSet_FromWeapon(it)) continue; \
-               if (it.spawnflags & WEP_FLAG_HIDDEN || it.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1; \
+               if ((it.spawnflags & WEP_FLAG_HIDDEN) || (it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) nHidden += 1; \
        }); \
        vector table_size = HUD_GetTableSize_BestItemAR((Weapons_COUNT - 1) - nHidden, panel_size, aspect); \
        columns = table_size.x; \
@@ -94,13 +94,8 @@ void HUD_Weapons()
        if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
        {
                int weapon_cnt;
-               if(weaponorder_bypriority)
-                       strunzone(weaponorder_bypriority);
-               if(weaponorder_byimpulse)
-                       strunzone(weaponorder_byimpulse);
-
-               weaponorder_bypriority = strzone(autocvar_cl_weaponpriority);
-               weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority))));
+               strcpy(weaponorder_bypriority, autocvar_cl_weaponpriority);
+               strcpy(weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority))));
                weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
 
                weapon_cnt = 0;
@@ -407,7 +402,7 @@ void HUD_Weapons()
                }
                else
                {
-                       if (it.spawnflags & WEP_FLAG_MUTATORBLOCKED && !(weapons_stat & WepSet_FromWeapon(it)))
+                       if (((it.spawnflags & WEP_FLAG_HIDDEN) || (it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) && !(weapons_stat & WepSet_FromWeapon(it)))
                                continue;
                }
 
index 9c146c09bd9115091c24585fc02c323558b75d19..37027d25cd35570419c819179b207311580f157e 100644 (file)
@@ -555,9 +555,7 @@ NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew)
 
        if(!(nags & BIT(2)))
        {
-               if(vote_called_vote)
-                       strunzone(vote_called_vote);
-               vote_called_vote = string_null;
+               strfree(vote_called_vote);
                vote_active = 0;
        }
        else
@@ -575,9 +573,7 @@ NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew)
 
        if(nags & BIT(7))
        {
-               if(vote_called_vote)
-                       strunzone(vote_called_vote);
-               vote_called_vote = strzone(ReadString());
+               strcpy(vote_called_vote, ReadString());
        }
 
        if(nags & 1)
@@ -959,14 +955,12 @@ NET_HANDLE(ENT_CLIENT_SCORES_INFO, bool isnew)
        teamplay = _MapInfo_GetTeamPlayBool(gametype);
        HUD_ModIcons_SetFunc();
        FOREACH(Scores, true, {
-               if (scores_label(it)) strunzone(scores_label(it));
-               scores_label(it) = strzone(ReadString());
+               strcpy(scores_label(it), ReadString());
                scores_flags(it) = ReadByte();
        });
        for (int i = 0; i < MAX_TEAMSCORE; ++i)
        {
-               if (teamscores_label(i)) strunzone(teamscores_label(i));
-               teamscores_label(i) = strzone(ReadString());
+               strcpy(teamscores_label(i), ReadString());
                teamscores_flags(i) = ReadByte();
        }
        return = true;
@@ -987,8 +981,7 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
        arc_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
        arc_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
 
-       if (forcefog) strunzone(forcefog);
-       forcefog = strzone(ReadString());
+       strcpy(forcefog, ReadString());
 
        armorblockpercent = ReadByte() / 255.0;
        damagepush_speedfactor = ReadByte() / 255.0;
@@ -1051,17 +1044,15 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_time = ReadInt24_t();
                        race_previousbesttime = ReadInt24_t();
                        race_mypreviousbesttime = ReadInt24_t();
-                       if(race_previousbestname)
-                               strunzone(race_previousbestname);
                        string pbestname = ReadString();
                        if(autocvar_cl_race_cptimes_onlyself)
                        {
                                race_previousbesttime = race_mypreviousbesttime;
                                race_mypreviousbesttime = 0;
-                               race_previousbestname = strzone("");
+                               strcpy(race_previousbestname, "");
                        }
                        else
-                               race_previousbestname = strzone(pbestname);
+                               strcpy(race_previousbestname, pbestname);
 
                        race_checkpointtime = time;
 
@@ -1087,17 +1078,15 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        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);
                        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("");
+                               strcpy(race_nextbestname, "");
                        }
                        else
-                               race_nextbestname = strzone(newname);
+                               strcpy(race_nextbestname, newname);
                        break;
 
                case RACE_NET_CHECKPOINT_HIT_RACE:
@@ -1107,13 +1096,11 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_mycheckpointlapsdelta = ReadByte();
                        if(race_mycheckpointlapsdelta >= 128)
                                race_mycheckpointlapsdelta -= 256;
-                       if(race_mycheckpointenemy)
-                               strunzone(race_mycheckpointenemy);
                        int who = ReadByte();
                        if(who)
-                               race_mycheckpointenemy = strzone(entcs_GetName(who - 1));
+                               strcpy(race_mycheckpointenemy, entcs_GetName(who - 1));
                        else
-                               race_mycheckpointenemy = strzone(""); // TODO: maybe string_null works fine here?
+                               strcpy(race_mycheckpointenemy, ""); // TODO: maybe string_null works fine here?
                        break;
 
                case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
@@ -1123,31 +1110,25 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_othercheckpointlapsdelta = ReadByte();
                        if(race_othercheckpointlapsdelta >= 128)
                                race_othercheckpointlapsdelta -= 256;
-                       if(race_othercheckpointenemy)
-                               strunzone(race_othercheckpointenemy);
                        int what = ReadByte();
                        if(what)
-                               race_othercheckpointenemy = strzone(entcs_GetName(what - 1));
+                               strcpy(race_othercheckpointenemy, entcs_GetName(what - 1));
                        else
-                               race_othercheckpointenemy = strzone(""); // TODO: maybe string_null works fine here?
+                               strcpy(race_othercheckpointenemy, ""); // TODO: maybe string_null works fine here?
                        break;
 
                case RACE_NET_PENALTY_RACE:
                        race_penaltyeventtime = time;
                        race_penaltytime = ReadShort();
                        //race_penaltyaccumulator += race_penaltytime;
-                       if(race_penaltyreason)
-                               strunzone(race_penaltyreason);
-                       race_penaltyreason = strzone(ReadString());
+                       strcpy(race_penaltyreason, ReadString());
                        break;
 
                case RACE_NET_PENALTY_QUALIFYING:
                        race_penaltyeventtime = time;
                        race_penaltytime = ReadShort();
                        race_penaltyaccumulator += race_penaltytime;
-                       if(race_penaltyreason)
-                               strunzone(race_penaltyreason);
-                       race_penaltyreason = strzone(ReadString());
+                       strcpy(race_penaltyreason, ReadString());
                        break;
 
                case RACE_NET_SERVER_RECORD:
@@ -1155,21 +1136,13 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        break;
                case RACE_NET_SPEED_AWARD:
                        race_speedaward = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
-                       if(race_speedaward_holder)
-                               strunzone(race_speedaward_holder);
-                       race_speedaward_holder = strzone(ReadString());
-                       if(race_speedaward_unit)
-                               strunzone(race_speedaward_unit);
-                       race_speedaward_unit = strzone(GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
+                       strcpy(race_speedaward_holder, ReadString());
+                       strcpy(race_speedaward_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
                        break;
                case RACE_NET_SPEED_AWARD_BEST:
                        race_speedaward_alltimebest = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
-                       if(race_speedaward_alltimebest_holder)
-                               strunzone(race_speedaward_alltimebest_holder);
-                       race_speedaward_alltimebest_holder = strzone(ReadString());
-                       if(race_speedaward_alltimebest_unit)
-                               strunzone(race_speedaward_alltimebest_unit);
-                       race_speedaward_alltimebest_unit = strzone(GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
+                       strcpy(race_speedaward_alltimebest_holder, ReadString());
+                       strcpy(race_speedaward_alltimebest_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
                        break;
                case RACE_NET_SERVER_RANKINGS:
                        float prevpos, del;
@@ -1182,47 +1155,35 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        if (prevpos) {
                                for (i=prevpos-1;i>pos-1;--i) {
                                        grecordtime[i] = grecordtime[i-1];
-                                       if(grecordholder[i])
-                                               strunzone(grecordholder[i]);
-                                       grecordholder[i] = strzone(grecordholder[i-1]);
+                                       strcpy(grecordholder[i], grecordholder[i-1]);
                                }
                        } else if (del) { // a record has been deleted by the admin
                                for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
                                        if (i == RANKINGS_CNT-1) { // clear out last record
                                                grecordtime[i] = 0;
-                                               if (grecordholder[i])
-                                                       strunzone(grecordholder[i]);
-                                               grecordholder[i] = string_null;
+                                               strfree(grecordholder[i]);
                                        }
                                        else {
                                                grecordtime[i] = grecordtime[i+1];
-                                               if (grecordholder[i])
-                                                       strunzone(grecordholder[i]);
-                                               grecordholder[i] = strzone(grecordholder[i+1]);
+                                               strcpy(grecordholder[i], grecordholder[i+1]);
                                        }
                                }
                        } else { // player has no ranked record yet
                                for (i=RANKINGS_CNT-1;i>pos-1;--i) {
                                        grecordtime[i] = grecordtime[i-1];
-                                       if(grecordholder[i])
-                                               strunzone(grecordholder[i]);
-                                       grecordholder[i] = strzone(grecordholder[i-1]);
+                                       strcpy(grecordholder[i], grecordholder[i-1]);
                                }
                        }
 
                        // store new ranking
-                       if(grecordholder[pos-1] != "")
-                               strunzone(grecordholder[pos-1]);
-                       grecordholder[pos-1] = strzone(ReadString());
+                       strcpy(grecordholder[pos-1], ReadString());
                        grecordtime[pos-1] = ReadInt24_t();
                        if(strdecolorize(grecordholder[pos-1]) == strdecolorize(entcs_GetName(player_localnum)))
                                race_myrank = pos;
                        break;
                case RACE_NET_SERVER_STATUS:
                        race_status = ReadShort();
-                       if(race_status_name)
-                               strunzone(race_status_name);
-                       race_status_name = strzone(ReadString());
+                       strcpy(race_status_name, ReadString());
        }
        return true;
 }
index fd1647ddcce350abe5a7af8ea85b2e2fe70f1630..01409280a4a4c9f535cf18e6c0f7f21b2eb1d8b0 100644 (file)
@@ -577,9 +577,7 @@ void Accuracy_LoadLevels()
 {
        if(autocvar_accuracy_color_levels != acc_color_levels)
        {
-               if(acc_color_levels)
-                       strunzone(acc_color_levels);
-               acc_color_levels = strzone(autocvar_accuracy_color_levels);
+               strcpy(acc_color_levels, autocvar_accuracy_color_levels);
                acc_levels = tokenize_console(acc_color_levels);
                if(acc_levels > MAX_ACCURACY_LEVELS)
                        acc_levels = MAX_ACCURACY_LEVELS;
index 24d634ce8213e05759f7afed13f2f0b011be5146..cc6fced9b820a2885cf932118997f0bcfe44588b 100644 (file)
@@ -2,6 +2,11 @@
 
 #include <common/mutators/base.qh>
 
+// register all possible hooks here
+
+// to use a hook, first register your mutator using REGISTER_MUTATOR
+// then create your function using MUTATOR_HOOKFUNCTION
+
 /**
  * Called when a client command is parsed
  * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
index 55e54d8ac2c641ad49b10bf03a979f0603eff9d3..220b9c6127ef958dd0b07c6312b44842240ac6e5 100644 (file)
@@ -8,13 +8,13 @@
 
 .float v_angle_save_x;
 
-class(Skeleton) .float skeleton_info_modelindex;
-class(Skeleton) .float skeleton_info_skin;
+classfield(Skeleton) .float skeleton_info_modelindex;
+classfield(Skeleton) .float skeleton_info_skin;
 const int BONETYPE_LOWER = 0;
 const int BONETYPE_UPPER = 1;
 const int MAX_BONES = 128;
-class(Skeleton) .float skeleton_bonetype[MAX_BONES];
-class(Skeleton) .float skeleton_numbones;
+classfield(Skeleton) .float skeleton_bonetype[MAX_BONES];
+classfield(Skeleton) .float skeleton_numbones;
 
 void skeleton_loadinfo(entity e)
 {
index 8c5969b09fb4db0ae068b7aa50338215be07b2dd..082335e4b0f61bedbdd39a62b6bc16f8376c9870 100644 (file)
@@ -7,8 +7,8 @@ void skeleton_from_frames(entity e, float is_dead);
 void skeleton_loadinfo(entity e);
 
 entityclass(Skeleton);
-class(Skeleton) .float bone_upperbody;
-class(Skeleton) .int bone_weapon;
-class(Skeleton) .float bone_aim[MAX_AIM_BONES];
-class(Skeleton) .float bone_aimweight[MAX_AIM_BONES];
-class(Skeleton) .float fixbone;
+classfield(Skeleton) .float bone_upperbody;
+classfield(Skeleton) .int bone_weapon;
+classfield(Skeleton) .float bone_aim[MAX_AIM_BONES];
+classfield(Skeleton) .float bone_aimweight[MAX_AIM_BONES];
+classfield(Skeleton) .float fixbone;
index 24f6568d26629396ff7322bfae3b97695f545d3d..a05ca701d03ab2abfc08495fffc6afb469d7f149 100644 (file)
@@ -1,10 +1,10 @@
 #pragma once
 
 entityclass(ShowNames);
-class(ShowNames) .float healthvalue;
-class(ShowNames) .float armorvalue;
-class(ShowNames) .float sameteam;
-class(ShowNames) .float fadedelay;
-class(ShowNames) .float pointtime;
+classfield(ShowNames) .float healthvalue;
+classfield(ShowNames) .float armorvalue;
+classfield(ShowNames) .float sameteam;
+classfield(ShowNames) .float fadedelay;
+classfield(ShowNames) .float pointtime;
 
 void Draw_ShowNames_All();
index 251c1a53f12a9185f0c5274839479066a4d7e759..41c7d46c564465924e272e585f249db640639b23 100644 (file)
@@ -4,10 +4,10 @@ const int MAX_TEAMRADAR_TIMES = 32;
 
 entityclass(TeamRadar);
 // to make entities have dots on the team radar
-class(TeamRadar) .float teamradar_icon;
-class(TeamRadar) .float teamradar_times[MAX_TEAMRADAR_TIMES];
-class(TeamRadar) .int teamradar_time_index;
-class(TeamRadar) .vector teamradar_color;
+classfield(TeamRadar) .float teamradar_icon;
+classfield(TeamRadar) .float teamradar_times[MAX_TEAMRADAR_TIMES];
+classfield(TeamRadar) .int teamradar_time_index;
+classfield(TeamRadar) .vector teamradar_color;
 
 float teamradar_angle; // player yaw angle
 vector teamradar_origin3d_in_texcoord; // player origin
index dd184bee9bbeb7d8dfcf3f5eb75abf7337d330b5..42a8820e761be63bcfed9abec1676438434f4a72 100644 (file)
@@ -1375,12 +1375,8 @@ void HUD_Crosshair(entity this)
                wcross_scale_goal_prev = 0;
                wcross_alpha_goal_prev = 0;
                wcross_changedonetime = 0;
-               if(wcross_name_goal_prev)
-                       strunzone(wcross_name_goal_prev);
-               wcross_name_goal_prev = string_null;
-               if(wcross_name_goal_prev_prev)
-                       strunzone(wcross_name_goal_prev_prev);
-               wcross_name_goal_prev_prev = string_null;
+               strfree(wcross_name_goal_prev);
+               strfree(wcross_name_goal_prev_prev);
                wcross_name_changestarttime = 0;
                wcross_name_changedonetime = 0;
                wcross_name_alpha_goal_prev = 0;
index b5728095485406213273f68f387c6096761de206..600bf5fa8fc9f13330d260895ca00d3066a0e026 100644 (file)
@@ -111,9 +111,7 @@ void Ent_Wall_Draw(entity this)
 
 void Ent_Wall_Remove(entity this)
 {
-       if(this.bgmscript)
-               strunzone(this.bgmscript);
-       this.bgmscript = string_null;
+       strfree(this.bgmscript);
 }
 
 NET_HANDLE(ENT_CLIENT_WALL, bool isnew)
@@ -186,17 +184,15 @@ NET_HANDLE(ENT_CLIENT_WALL, bool isnew)
                        this.mins = this.maxs = '0 0 0';
                setsize(this, this.mins, this.maxs);
 
-               if(this.bgmscript)
-                       strunzone(this.bgmscript);
-               this.bgmscript = ReadString();
-               if(substring(this.bgmscript, 0, 1) == "<")
+               string s = ReadString();
+               if(substring(s, 0, 1) == "<")
                {
-                       this.bgmscript = strzone(substring(this.bgmscript, 1, -1));
+                       strcpy(this.bgmscript, substring(s, 1, -1));
                        this.bgmscriptangular = 1;
                }
                else
                {
-                       this.bgmscript = strzone(this.bgmscript);
+                       strcpy(this.bgmscript, s);
                        this.bgmscriptangular = 0;
                }
                if(this.bgmscript != "")
index 11aebd0ed5e25df349f6fa12a8288e345e47f27f..e55bc489b3e7d6c1ac66c6936dc306ddd7d2e067 100644 (file)
@@ -1,11 +1,11 @@
 #pragma once
 
 entityclass(Wall);
-class(Wall) .float lip;
-class(Wall) .float bgmscriptangular;
-class(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2;
-class(Wall) .float loddistance1, loddistance2;
-class(Wall) .vector saved;
+classfield(Wall) .float lip;
+classfield(Wall) .float bgmscriptangular;
+classfield(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2;
+classfield(Wall) .float loddistance1, loddistance2;
+classfield(Wall) .vector saved;
 
 // Needed for interactive clientwalls
 .float inactive; // Clientwall disappears when inactive
index a6ae463477d51162d7364c55e35a4646d1ce20a5..eaa80d05f0a6ae2b9b6d5ebefb0c6041473b6488 100644 (file)
@@ -3,20 +3,20 @@
 #include <common/sounds/sound.qh>
 
 entityclass(Projectile);
-class(Projectile).int traileffect;
-
-class(Projectile).vector iorigin1, iorigin2;
-class(Projectile).float spawntime;
-class(Projectile).vector trail_oldorigin;
-class(Projectile).float trail_oldtime;
-class(Projectile).float fade_time, fade_rate;
-
-class(Projectile).float alphamod;
-class(Projectile).int count; // set if clientside projectile
-class(Projectile).int cnt;   // sound index
-class(Projectile).float gravity;
-class(Projectile).int snd_looping;
-class(Projectile).bool silent;
+classfield(Projectile).int traileffect;
+
+classfield(Projectile).vector iorigin1, iorigin2;
+classfield(Projectile).float spawntime;
+classfield(Projectile).vector trail_oldorigin;
+classfield(Projectile).float trail_oldtime;
+classfield(Projectile).float fade_time, fade_rate;
+
+classfield(Projectile).float alphamod;
+classfield(Projectile).int count; // set if clientside projectile
+classfield(Projectile).int cnt;   // sound index
+classfield(Projectile).float gravity;
+classfield(Projectile).int snd_looping;
+classfield(Projectile).bool silent;
 
 void SUB_Stop(entity this, entity toucher);
 
index d3efe77e844a498365a55ce6c264c5a554df0dd7..bc26203399bf44aace75bcff27b303f2caa738b0 100644 (file)
@@ -88,16 +88,15 @@ void CampaignFile_Unload()
 {
        if(campaign_title)
        {
-               strunzone(campaign_title);
+               strfree(campaign_title);
                for(int i = 0; i < campaign_entries; ++i)
                {
-                       strunzone(campaign_gametype[i]);
-                       strunzone(campaign_mapname[i]);
-                       strunzone(campaign_mutators[i]);
-                       strunzone(campaign_shortdesc[i]);
-                       strunzone(campaign_longdesc[i]);
+                       strfree(campaign_gametype[i]);
+                       strfree(campaign_mapname[i]);
+                       strfree(campaign_mutators[i]);
+                       strfree(campaign_shortdesc[i]);
+                       strfree(campaign_longdesc[i]);
                }
                campaign_entries = 0;
-               campaign_title = string_null;
        }
 }
index 836c3983ccb0581703d2ff9a0de2df119a28a5c8..7c5a218b21f15e34ba6ba43ee0d13b4a2b0a801f 100644 (file)
@@ -56,7 +56,7 @@
        CSQCMODEL_ENDIF \
        CSQCMODEL_PROPERTY(BIT(10), float, ReadAngle, WriteAngle, v_angle_x) \
        CSQCMODEL_PROPERTY(BIT(11), int, ReadByte, WriteByte, traileffect) \
-       CSQCMODEL_PROPERTY_SCALED(BIT(12), float, ReadByte, WriteByte, scale, 16, 0, 255) \
+       CSQCMODEL_PROPERTY(BIT(12), float, ReadCoord, WriteCoord, scale) \
        CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
        CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \
        CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, multijump_count) \
index 7144bf3da5ed6bb4166c3cc5b3f8f4895d416a7f..983b073b406c8cfb93de92a31002d5dd1359fa56 100644 (file)
@@ -411,7 +411,7 @@ CLASS(DebugText3d, Object)
        }
 
        DESTRUCTOR(DebugText3d) {
-               strunzone(this.message);
+               strfree(this.message);
        }
 
        void DebugText3d_draw2d(DebugText3d this) {
@@ -459,13 +459,13 @@ NET_HANDLE(debug_text_3d, bool is_new) {
 #define debug_text_3d_5(pos, msg, align, dur, vel) debug_text_3d_fn(pos, msg, align, dur, vel)
 
 ERASEABLE
-void debug_text_3d_fn(vector pos, string msg, float align, float duration, vector velocity) {
+void debug_text_3d_fn(vector pos, string msg, float align, float duration, vector vel) {
        WriteHeader(MSG_BROADCAST, debug_text_3d);
        WriteVector(MSG_BROADCAST, pos);
        WriteString(MSG_BROADCAST, msg);
        WriteFloat(MSG_BROADCAST, align);
        WriteFloat(MSG_BROADCAST, duration);
-       WriteVector(MSG_BROADCAST, velocity);
+       WriteVector(MSG_BROADCAST, vel);
 }
 
 #endif // SVQC
index 71260eb3d04fa49ae2ffaeaca9c5b001ec8f8070..a1b27873053917e1ba6613d9939bc36d39f0395d 100644 (file)
@@ -327,7 +327,7 @@ REGISTRY(EffectInfos, BITS(9))
 #define EffectInfos_from(i) _EffectInfos_from(i, NULL)
 REGISTER_REGISTRY(EffectInfos)
 #define EFFECTINFO(name) \
-    [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { } \
+    ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { } \
     REGISTER(EffectInfos, EFFECTINFO, name, m_id, NEW(EffectInfoGroup)) { \
         effectinfo_##name(this, NULL); \
     }
@@ -335,8 +335,8 @@ REGISTER_REGISTRY(EffectInfos)
 #define MY(f) this.effectinfo_##f
 #define DEF(name) EFFECTINFO(name)
 #define SUB(name) \
-    [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { parent = EFFECTINFO_##name; parent.children[parent.children_count++] = this = NEW(EffectInfo, #name); } \
-    [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this)
+    ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { parent = EFFECTINFO_##name; parent.children[parent.children_count++] = this = NEW(EffectInfo, #name); } \
+    ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this)
 #include "effectinfo.inc"
 #undef MY
 #undef DEF
index 2abf2122c26553b86634a85eb7be3bd3ef1a5a3f..d225b337bc70bfd46d5dd55445d2ba6668b3bd7e 100644 (file)
@@ -30,10 +30,10 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran
 
 #ifdef CSQC
 entityclass(Casing);
-class(Casing) .float alpha;
-class(Casing) .bool silent;
-class(Casing) .int state;
-class(Casing) .float cnt;
+classfield(Casing) .float alpha;
+classfield(Casing) .bool silent;
+classfield(Casing) .int state;
+classfield(Casing) .float cnt;
 
 void Casing_Delete(entity this)
 {
index 4875a40ee98c4682b1d7cdf4f4c8818bce87ca39..8c0dfd5080312fda7d1ed4d10a66a108bdd34075 100644 (file)
                                .string fld = it.m_playersoundfld;
                                if (this.(fld))
                                {
-                                       strunzone(this.(fld));
-                                       this.(fld) = string_null;
+                                       strfree(this.(fld));
                                }
                        });
                }
                                }
                                string file = argv(1);
                                string variants = argv(2);
-                               if (this.(field)) strunzone(this.(field));
-                               this.(field) = strzone(strcat(file, " ", variants));
+                               strcpy(this.(field), strcat(file, " ", variants));
                        }
                        fclose(fh);
                        return true;
                void UpdatePlayerSounds(entity this)
                {
                        if (this.model == this.model_for_playersound && this.skin == this.skin_for_playersound) return;
-                       if (this.model_for_playersound) strunzone(this.model_for_playersound);
-                       this.model_for_playersound = strzone(this.model);
+                       strcpy(this.model_for_playersound, this.model);
                        this.skin_for_playersound = this.skin;
                        ClearPlayerSounds(this);
                        LoadPlayerSounds(this, "sound/player/default.sounds", true);
index 26b3ec9f5285744b9f21d72abd82cab86669c5c0..9849b5be73f8ebf3d1aef3ff5b1e61ec4dfea2d0 100644 (file)
@@ -80,10 +80,10 @@ void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector an
 #ifdef CSQC
 
 entityclass(ModelEffect);
-class(ModelEffect) .float frame1time;
-class(ModelEffect) .float lifetime, fadetime;
-class(ModelEffect) .float teleport_time;
-class(ModelEffect) .float scale1, scale2;
+classfield(ModelEffect) .float frame1time;
+classfield(ModelEffect) .float lifetime, fadetime;
+classfield(ModelEffect) .float teleport_time;
+classfield(ModelEffect) .float scale1, scale2;
 
 .float cnt;
 .float scale;
index dd3785b68ea2cf65af3fb5ecc5c77f86c0b102e0..6eda9b15ef29d2b5c60a7b48e3651fcb5a538485 100644 (file)
@@ -3,7 +3,7 @@
 #ifdef CSQC
 
 entityclass(Rubble);
-class(Rubble).float creationtime;
+classfield(Rubble).float creationtime;
 
 IntrusiveList g_rubble;
 STATIC_INIT(g_rubble) { g_rubble = IL_NEW(); }
index 12abc21b18a255a29821912a00f8968ac1588ff9..0eeddc349bce72d747f55d2b1f3b8b3251ca7d50 100644 (file)
@@ -39,8 +39,7 @@ MACRO_END
 
 /** the engine player name strings are mutable! */
 #define ENTCS_SET_MUTABLE_STRING(var, x) MACRO_BEGIN \
-       if (var) strunzone(var); \
-       var = strzone(x); \
+       strcpy(var, x); \
 MACRO_END
 
 ENTCS_PROP(ENTNUM, false, sv_entnum, ENTCS_SET_NORMAL, {}, {}) /* sentinel */
@@ -63,11 +62,11 @@ ENTCS_PROP(ARMOR, false, armorvalue, ENTCS_SET_NORMAL,
 
 ENTCS_PROP(NAME, true, netname, ENTCS_SET_MUTABLE_STRING,
        { WriteString(chan, ent.netname); },
-       { if (ent.netname) strunzone(ent.netname); ent.netname = strzone(ReadString()); })
+       { strcpy(ent.netname, ReadString()); })
 
 ENTCS_PROP(MODEL, true, model, ENTCS_SET_NORMAL,
        { WriteString(chan, ent.model); },
-       { if (ent.model) strunzone(ent.model); ent.model = strzone(ReadString()); })
+       { strcpy(ent.model, ReadString()); })
 
 ENTCS_PROP(SKIN, true, skin, ENTCS_SET_NORMAL,
        { WriteByte(chan, ent.skin); },
@@ -168,10 +167,8 @@ ENTCS_PROP(FRAGS, true, frags, ENTCS_SET_NORMAL,
                int n = this.sv_entnum;
                entity e = entcs_receiver(n);
                entcs_receiver(n, NULL);
-               if (e.netname) strunzone(e.netname);
-               e.netname = string_null;
-               if (e.model) strunzone(e.model);
-               e.model = string_null;
+               strfree(e.netname);
+               strfree(e.model);
                if (e != this) delete(e);
        }
 
@@ -188,8 +185,7 @@ ENTCS_PROP(FRAGS, true, frags, ENTCS_SET_NORMAL,
                // `cl_forceplayermodels 1` sounds will be wrong until the player has been in the PVS, but so be it
                if (this.model != e.model)
                {
-                       if (this.model) strunzone(this.model);
-                       this.model = strzone(e.model);
+                       strcpy(this.model, e.model);
                }
        }
 
index b7fc933e8b5dbaf35dde8a37fca1762c51a4e08a..e59152076b754552eb266411710fdbab1e4efcbb 100644 (file)
@@ -7,6 +7,10 @@
 #include <common/stats.qh>
 #endif
 
+#ifdef SVQC
+#include <server/items.qh>
+#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.
 
@@ -48,7 +52,16 @@ const int IT_PICKUPMASK                      = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU
 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
 
 #define SPAWNFUNC_ITEM(name, item) \
-    spawnfunc(name) { StartItem(this, item); }
+    spawnfunc(name) \
+       { \
+               if (!Item_IsDefinitionAllowed(item)) \
+               { \
+                       startitem_failed = true; \
+                       delete(this); \
+                       return; \
+               } \
+               StartItem(this, item); \
+       }
 
 #else
 
index 4790f1f1f785eaba2d48eb66a07fbb932a1d8f3f..b4195c05774eec2f08d780de5b4ddbff6cc687c5 100644 (file)
@@ -309,8 +309,7 @@ bool bd_move_dozer(entity minigame, entity dozer)
                                case BD_TILE_BRICK1: return false;
                        }
 
-                       if(hit.netname) { strunzone(hit.netname); }
-                       hit.netname = strzone(testpos);
+                       strcpy(hit.netname, testpos);
                        minigame_server_sendflags(hit,MINIG_SF_UPDATE);
                        break;
                }
@@ -330,8 +329,7 @@ bool bd_move_dozer(entity minigame, entity dozer)
                case BD_TILE_BRICK1: return false;
        }
 
-       if(dozer.netname) { strunzone(dozer.netname); }
-       dozer.netname = strzone(newpos);
+       strcpy(dozer.netname, newpos);
 
        return true;
 }
@@ -422,7 +420,7 @@ void bd_editor_place(entity minigame, entity player, string pos, int thetile, st
                                if(!piece)
                                        return; // how?!
 
-                               if(piece.netname) { strunzone(piece.netname); }
+                               strfree(piece.netname);
                                delete(piece);
                                minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
                                return;
@@ -488,12 +486,12 @@ void bd_unfill_recurse(entity minigame, entity player, int thetype, int letter,
 
        if(targ && thetype == targ.bd_tiletype)
        {
-               if(targ.netname) { strunzone(targ.netname); }
+               strfree(targ.netname);
                delete(targ);
        }
        else if(piece && thetype == piece.bd_tiletype)
        {
-               if(piece.netname) { strunzone(piece.netname); }
+               strfree(piece.netname);
                delete(piece);
        }
        else return;
@@ -568,7 +566,7 @@ void bd_setup_pieces(entity minigame)
        while( (e = findentity(e, owner, minigame)) )
                if(e.classname == "minigame_board_piece")
                {
-                       if(e.netname) { strunzone(e.netname); }
+                       strfree(e.netname);
                        delete(e);
                }
        e = NULL;
@@ -598,8 +596,7 @@ void bd_do_next_match(entity minigame, entity player)
 
        if(minigame.bd_nextlevel && minigame.bd_nextlevel != "")
        {
-               if(minigame.bd_levelname) { strunzone(minigame.bd_levelname); }
-               minigame.bd_levelname = strzone(minigame.bd_nextlevel);
+               strcpy(minigame.bd_levelname, minigame.bd_nextlevel);
        }
 
        bd_setup_pieces(minigame);
@@ -609,8 +606,7 @@ void bd_do_next_match(entity minigame, entity player)
 
 void bd_set_next_match(entity minigame, string next)
 {
-       if(minigame.bd_nextlevel) { strunzone(minigame.bd_nextlevel); }
-       minigame.bd_nextlevel = strzone(next);
+       strcpy(minigame.bd_nextlevel, next);
 }
 
 void bd_next_match(entity minigame, entity player, string next)
@@ -678,8 +674,7 @@ void bd_set_nextlevel(entity minigame, string s)
 {
        tokenize_console(s);
 
-       if(minigame.bd_nextlevel) { strunzone(minigame.bd_nextlevel); }
-       minigame.bd_nextlevel = strzone(argv(2));
+       strcpy(minigame.bd_nextlevel, argv(2));
 }
 
 int bd_fix_dir(vector dir)
@@ -854,8 +849,7 @@ int bd_server_event(entity minigame, string event, ...)
        {
                case "start":
                {
-                       if(minigame.bd_levelname) { strunzone(minigame.bd_levelname); }
-                       minigame.bd_levelname = strzone(autocvar_sv_minigames_bulldozer_startlevel);
+                       strcpy(minigame.bd_levelname, autocvar_sv_minigames_bulldozer_startlevel);
                        bd_setup_pieces(minigame);
                        minigame.minigame_flags = BD_TURN_MOVE;
 
@@ -867,7 +861,7 @@ int bd_server_event(entity minigame, string event, ...)
                        while( (e = findentity(e, owner, minigame)) )
                        if(e.classname == "minigame_board_piece")
                        {
-                               if(e.netname) { strunzone(e.netname); }
+                               strfree(e.netname);
                                delete(e);
                        }
                        e = NULL;
@@ -877,8 +871,8 @@ int bd_server_event(entity minigame, string event, ...)
                                delete(e);
                        }
 
-                       if(minigame.bd_nextlevel) { strunzone(minigame.bd_nextlevel); }
-                       if(minigame.bd_levelname) { strunzone(minigame.bd_levelname); }
+                       strfree(minigame.bd_nextlevel);
+                       strfree(minigame.bd_levelname);
                        return false;
                }
                case "join":
@@ -1209,8 +1203,7 @@ void bd_editor_fill(entity minigame)
 
 void bd_set_curr_pos(string s)
 {
-       if ( bd_curr_pos )
-               strunzone(bd_curr_pos);
+       strfree(bd_curr_pos);
        if ( s )
                s = strzone(s);
        bd_curr_pos = s;
@@ -1386,8 +1379,7 @@ int bd_client_event(entity minigame, string event, ...)
                                {
                                        int letter = ReadByte();
                                        int number = ReadByte();
-                                       if(sent.netname) { strunzone(sent.netname); }
-                                       sent.netname = strzone(minigame_tile_buildname(letter, number));
+                                       strcpy(sent.netname, minigame_tile_buildname(letter, number));
 
                                        sent.bd_tiletype = ReadByte();
 
index b3f5885c22380c9404284b610094090b1dad0ac1..c8f8184f5b0bd019862d1b73ecc631faea5084f1 100644 (file)
@@ -201,7 +201,7 @@ int c4_server_event(entity minigame, string event, ...)
                        while( (e = findentity(e, owner, minigame)) )
                        if(e.classname == "minigame_board_piece")
                        {
-                               if(e.netname) { strunzone(e.netname); }
+                               strfree(e.netname);
                                delete(e);
                        }
                        return false;
@@ -399,8 +399,7 @@ void c4_make_move(entity minigame)
 
 void c4_set_curr_pos(string s)
 {
-       if ( c4_curr_pos )
-               strunzone(c4_curr_pos);
+       strfree(c4_curr_pos);
        if ( s )
                s = strzone(s);
        c4_curr_pos = s;
index 82e09c324ab3982966ea7a08dc33f81527e50467..65ac9dee01db2940a47d53fc9e8ebf37eb55483c 100644 (file)
@@ -126,9 +126,9 @@ void nmm_kill_tiles(entity minig)
        while ( ( e = findentity(e,owner,minig) ) )
                if ( e.classname == "minigame_nmm_tile" )
                {
-                       strunzone(e.netname);
-                       strunzone(e.nmm_tile_hmill);
-                       strunzone(e.nmm_tile_vmill);
+                       strfree(e.netname);
+                       strfree(e.nmm_tile_hmill);
+                       strfree(e.nmm_tile_vmill);
                        delete(e);
                }
 }
index 40ddcca08b84c06e251a8165de2fe1e17c8051d7..0b1d74344e93f09fbe00877ecc2c8e6818c328ed 100644 (file)
@@ -121,7 +121,7 @@ void pp_move(entity minigame, entity player, string pos )
 
                        if(existing)
                        {
-                               if(existing.netname) { strunzone(existing.netname); }
+                               strfree(existing.netname);
                                delete(existing);
                        }
 
@@ -215,7 +215,7 @@ int pp_server_event(entity minigame, string event, ...)
                        while( (e = findentity(e, owner, minigame)) )
                        if(e.classname == "minigame_board_piece")
                        {
-                               if(e.netname) { strunzone(e.netname); }
+                               strfree(e.netname);
                                delete(e);
                        }
                        return false;
@@ -471,8 +471,7 @@ void pp_make_move(entity minigame)
 
 void pp_set_curr_pos(string s)
 {
-       if ( pp_curr_pos )
-               strunzone(pp_curr_pos);
+       strfree(pp_curr_pos);
        if ( s )
                s = strzone(s);
        pp_curr_pos = s;
index cd5c001e7adf95a30802b03bf468f857692bc9df..c8851f2ac4bad90e9f437751a20482182736050c 100644 (file)
@@ -139,11 +139,10 @@ bool ps_move_piece(entity minigame, entity piece, string pos, int leti, int numb
        if(!middle)
                return false;
 
-       if(middle.netname) { strunzone(middle.netname); }
+       strfree(middle.netname);
        delete(middle);
 
-       if(piece.netname) { strunzone(piece.netname); }
-       piece.netname = strzone(pos);
+       strcpy(piece.netname, pos);
 
        minigame_server_sendflags(piece,MINIG_SF_ALL);
 
@@ -232,7 +231,7 @@ int ps_server_event(entity minigame, string event, ...)
                        while( (e = findentity(e, owner, minigame)) )
                        if(e.classname == "minigame_board_piece")
                        {
-                               if(e.netname) { strunzone(e.netname); }
+                               strfree(e.netname);
                                delete(e);
                        }
                        return false;
@@ -514,8 +513,7 @@ void ps_make_move(entity minigame)
 
 void ps_set_curr_pos(string s)
 {
-       if ( ps_curr_pos )
-               strunzone(ps_curr_pos);
+       strfree(ps_curr_pos);
        if ( s )
                s = strzone(s);
        ps_curr_pos = s;
index c5a658054fe0d1e55192363b7e12cfd0abe9112b..a6cc50237736f010c2dab9500fa552426d974829 100644 (file)
@@ -147,7 +147,7 @@ int ttt_server_event(entity minigame, string event, ...)
                        while( (e = findentity(e, owner, minigame)) )
                        if(e.classname == "minigame_board_piece")
                        {
-                               if(e.netname) { strunzone(e.netname); }
+                               strfree(e.netname);
                                delete(e);
                        }
                        return false;
@@ -540,8 +540,7 @@ void ttt_make_move(entity minigame)
 
 void ttt_set_curr_pos(string s)
 {
-       if ( ttt_curr_pos )
-               strunzone(ttt_curr_pos);
+       strfree(ttt_curr_pos);
        if ( s )
                s = strzone(s);
        ttt_curr_pos = s;
index 415417b465f627ec1f3420e6c35e7291d08e401b..5c6af26615dc5f71363dfb9286eab23da294a859 100644 (file)
@@ -248,7 +248,7 @@ void end_minigame(entity minigame_session)
                delete(e);
        }
 
-       strunzone(minigame_session.netname);
+       strfree(minigame_session.netname);
        delete(minigame_session);
 }
 
index 7a1e7d73c2a471c802a1cf496d9a68e15c0d49e9..38aa4e33ada8d62930db4634610e5f2cb8610221 100644 (file)
@@ -1,10 +1,9 @@
 #pragma once
 
-#define setmodel(e, m) _setmodel((e), (m).model_str())
-
 CLASS(Model, Object)
     ATTRIB(Model, m_id, int, 0);
     ATTRIB(Model, model_str, string());
+    ATTRIB(Model, model_str_, string);
     CONSTRUCTOR(Model, string() path)
     {
         CONSTRUCT(Model);
@@ -20,5 +19,12 @@ CLASS(Model, Object)
         }
         profile(sprintf("precache_model(\"%s\")", s));
         precache_model(s);
+        strcpy(this.model_str_, s);
     }
 ENDCLASS(Model)
+
+#define setmodel(this, m) MACRO_BEGIN \
+    Model _setmodel_model = (m); \
+    string _setmodel_cached = _setmodel_model.model_str_; \
+    _setmodel((this), _setmodel_cached ? _setmodel_cached : _setmodel_model.model_str()); \
+MACRO_END
index beab98f0ac157a65f65a42898180f8226d4d9033..82b7d273c23458fb9f333e7bf090c5949f99a453 100644 (file)
@@ -118,7 +118,7 @@ void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity)
        this.realowner.mage_spike = NULL;
 
        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), 
+       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, DMG_NOWEP, directhitentity);
 
        delete(this);
@@ -272,7 +272,7 @@ void M_Mage_Defend_Heal(entity this)
 void M_Mage_Attack_Push(entity this)
 {
        sound(this, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
-       RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), 
+       RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius),
                                                NULL, NULL, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, this.enemy);
        Send_Effect(EFFECT_TE_EXPLOSION, this.origin, '0 0 0', 1);
 
index d596d7d33bf29cda76bc76d72cf855a75d70bc88..0a52e61090e553a140817abc3536a9429a0fd425 100644 (file)
@@ -71,7 +71,7 @@ void M_Wyvern_Attack_Fireball_Explode(entity this)
 
        entity own = this.realowner;
 
-       RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, 
+       RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force,
                                                NULL, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL);
 
        FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM,
index 1197c261346eae99235f85e5c33580a0f5835f04..ccd10ee4532dcc911ad001862fa0866178f886fc 100644 (file)
@@ -82,6 +82,7 @@ bool Monster_ValidTarget(entity this, entity targ)
        || (IS_VEHICLE(targ) && !((Monsters_from(this.monsterid)).spawnflags & MON_FLAG_RANGED)) // melee vs vehicle is useless
        || (time < game_starttime) // monsters do nothing before match has started
        || (targ.takedamage == DAMAGE_NO)
+       || (game_stopped)
        || (targ.items & IT_INVISIBILITY)
        || (IS_SPEC(targ) || IS_OBSERVER(targ)) // don't attack spectators
        || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || targ.health <= 0 || this.health <= 0))
@@ -275,7 +276,7 @@ void Monster_Sounds_Precache(entity this)
 
 void Monster_Sounds_Clear(entity this)
 {
-#define _MSOUND(m) if(this.monstersound_##m) { strunzone(this.monstersound_##m); this.monstersound_##m = string_null; }
+#define _MSOUND(m) strfree(this.monstersound_##m);
        ALLMONSTERSOUNDS
 #undef _MSOUND
 }
@@ -310,9 +311,7 @@ bool Monster_Sounds_Load(entity this, string f, int first)
                field = Monster_Sound_SampleField(argv(0));
                if(GetMonsterSoundSampleField_notFound)
                        continue;
-               if (this.(field))
-                       strunzone(this.(field));
-               this.(field) = strzone(strcat(argv(1), " ", argv(2)));
+               strcpy(this.(field), strcat(argv(1), " ", argv(2)));
        }
        fclose(fh);
        return true;
index d6989ad31839d52229cc8f612879fd6c83ab8686..d456282d429ee6fbc6c5113f90b7f57484b8fcff 100644 (file)
@@ -21,7 +21,7 @@ entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby,
        if(monster == "random" || allow_any)
        {
                RandomSelection_Init();
-               FOREACH(Monsters, it != MON_Null && (allow_any || (!(it.spawnflags & MONSTER_TYPE_PASSIVE) && !(it.spawnflags & MON_FLAG_HIDDEN))),
+               FOREACH(Monsters, it != MON_Null && (allow_any || !(it.spawnflags & MON_FLAG_HIDDEN)) && !(it.spawnflags & MONSTER_TYPE_PASSIVE),
                {
                        RandomSelection_AddEnt(it, 1, 1);
                });
index 4f940c42b3c016f3e9131e0c6d3b213bc4d5497a..565e39998d7d4186d20ef3937f60ceddc9d53830 100644 (file)
@@ -135,7 +135,7 @@ void RegisterCallbacks() {};
         params(_MUTATOR_HANDLE_NOP,     _MUTATOR_HANDLE_POPOUT) \
         return ret; \
     } \
-    [[accumulate]] void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); }
+    ACCUMULATE void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); }
 
 #define MUTATOR_CALLHOOK(id, ...) _MUTATOR_CALLHOOK(id, __VA_ARGS__)
 #ifdef __STDC__
@@ -265,7 +265,7 @@ void Mutator_Remove(Mutator mut)
     bool MUTATOR_##id##_check() { return dependence; } \
     REGISTER(Mutators, MUTATOR, id, m_id, NEW(Mutator, #id, MUTATORFUNCTION_##id)) \
     { this.mutatorcheck = MUTATOR_##id##_check; } \
-    [[accumulate]] bool MUTATORFUNCTION_##id(int mode)
+    ACCUMULATE bool MUTATORFUNCTION_##id(int mode)
 
 STATIC_INIT(Mutators) {
     RegisterHooks();
@@ -301,7 +301,7 @@ STATIC_INIT_LATE(Mutators) {
 #define _MUTATOR_CALLBACK(name, func) \
     Callback CALLBACK_##name; \
     bool func(); \
-    [[accumulate]] void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); }
+    ACCUMULATE void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); }
 
 #define MUTATOR_HOOKFUNCTION(...) \
     EVAL_MUTATOR_HOOKFUNCTION(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__))
@@ -312,9 +312,9 @@ STATIC_INIT_LATE(Mutators) {
 
 #define MUTATOR_HOOKFUNCTION_3(mut, cb, order) \
     _MUTATOR_CALLBACK(mut##_##cb, mut##_##cb) \
-    [[accumulate]] bool MUTATORFUNCTION_##mut##_hooks(int mode) { MUTATOR_HOOK(cb, mut##_##cb, order); } \
+    ACCUMULATE bool MUTATORFUNCTION_##mut##_hooks(int mode) { MUTATOR_HOOK(cb, mut##_##cb, order); } \
     bool mut##_##cb() { return = false; } \
-    [[accumulate]] bool mut##_##cb()
+    ACCUMULATE bool mut##_##cb()
 
 #define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN {                     \
     MUTATOR_ONADD {                                                     \
index 937f4cbde4ba00c19395d58c45dd7e6add6aba03..4a54d8117d24ba4ae80bf772e792d1ec1286464f 100644 (file)
@@ -926,7 +926,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 
                BUFF_ONADD(BUFF_INVISIBLE)
                {
-                       if(time < player.strength_finished && g_instagib)
+                       if(time < player.strength_finished && autocvar_g_instagib)
                                player.buff_invisible_prev_alpha = default_player_alpha; // we don't want to save the powerup's alpha, as player may lose the powerup while holding the buff
                        else
                                player.buff_invisible_prev_alpha = player.alpha;
@@ -935,7 +935,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 
                BUFF_ONREM(BUFF_INVISIBLE)
                {
-                       if(time < player.strength_finished && g_instagib)
+                       if(time < player.strength_finished && autocvar_g_instagib)
                                player.alpha = autocvar_g_instagib_invis_alpha;
                        else
                                player.alpha = player.buff_invisible_prev_alpha;
index a1fe27a877c3e46e5e4dfe59a15239c583930f0a..5f9de3b7cbfd906461a58d55d5edace06b9f71e6 100644 (file)
@@ -1,7 +1,7 @@
 #include "sv_cloaked.qh"
 
-string autocvar_g_cloaked;
-REGISTER_MUTATOR(cloaked, expr_evaluate(autocvar_g_cloaked));
+//string autocvar_g_cloaked;
+REGISTER_MUTATOR(cloaked, expr_evaluate(cvar_string("g_cloaked")));
 
 float autocvar_g_balance_cloaked_alpha;
 
index 0977b62cebe380b5172e0ef03c6d11f38546da54..5f8d8e68230623cb7fad6700b059895c72b5ff49 100644 (file)
@@ -155,8 +155,7 @@ CLASS(DamageText, Object)
             );
         }
 
-        if (this.text) strunzone(this.text);
-        this.text = strzone(s);
+        strcpy(this.text, s);
 
         this.m_size = map_bound_ranges(potential,
             autocvar_cl_damagetext_size_min_damage, autocvar_cl_damagetext_size_max_damage,
@@ -180,7 +179,7 @@ CLASS(DamageText, Object)
     }
 
     DESTRUCTOR(DamageText) {
-        if (this.text) strunzone(this.text);
+        strfree(this.text);
         if (this == DamageText_screen_first) {
             // start from 0 offset again, hopefully, others (if any) will have faded away by now
             DamageText_screen_first = NULL;
index 7097eaf390dac022c2840f7db4d9dc6ee7028368..9989d8e3f3313193763276e3652ea16ed013c6e2 100644 (file)
@@ -1,5 +1,8 @@
 // generated file; do not modify
 #include <common/mutators/mutator/instagib/items.qh>
+#ifdef SVQC
+    #include <common/mutators/mutator/instagib/sv_items.qh>
+#endif
 #ifdef SVQC
     #include <common/mutators/mutator/instagib/sv_instagib.qh>
 #endif
index ffd9bfb0ca1fd2c7ac37b5fc72e55249a233da1d..5c0d29dd321327c73ba6452bee95598065e3a3c1 100644 (file)
@@ -1,3 +1,5 @@
+#include "sv_items.qh"
+
 #include "items.qh"
 
 /// \brief Time of ivisibility powerup in seconds.
diff --git a/qcsrc/common/mutators/mutator/instagib/sv_items.qh b/qcsrc/common/mutators/mutator/instagib/sv_items.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 98fb4815c1ce28cc699a429537ea75c2643b4487..0144c3147c85433ceb1d005e7188a83b62c9208b 100644 (file)
@@ -1 +1,4 @@
 // generated file; do not modify
+#ifdef SVQC
+    #include <common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qh>
+#endif
index a3b028f1c6c0c9573b8eb7b10765a34a4db9b71c..d91546af5711fcfa9b9848202cc7c775c3aca151 100644 (file)
@@ -1,3 +1,4 @@
+#include "sv_kick_teamkiller.qh"
 
 float autocvar_g_kick_teamkiller_rate;
 float autocvar_g_kick_teamkiller_lower_limit;
@@ -24,7 +25,7 @@ MUTATOR_HOOKFUNCTION(kick_teamkiller, PlayerDies)
        // use the players actual playtime
        float playtime = time - CS(attacker).startplaytime;
        // rate is in teamkills/minutes, playtime in seconds
-       if (teamkills >= autocvar_g_kick_teamkiller_lower_limit && 
+       if (teamkills >= autocvar_g_kick_teamkiller_lower_limit &&
            teamkills >= autocvar_g_kick_teamkiller_rate*playtime/60.0)
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_TEAMKILL, attacker.netname);
diff --git a/qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qh b/qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index d6796fc0590e0581be335989330a384934bee600..2f8b45a99b46f09450ab44c93867b236b4ef4639 100644 (file)
@@ -1,7 +1,7 @@
 #include "sv_melee_only.qh"
 
 string autocvar_g_melee_only;
-REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
+REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !autocvar_g_instagib && !cvar("g_overkill") && !g_nexball);
 
 MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
 {
@@ -25,11 +25,11 @@ MUTATOR_HOOKFUNCTION(melee_only, ForbidThrowCurrentWeapon)
        return true;
 }
 
-MUTATOR_HOOKFUNCTION(melee_only, FilterItem)
+MUTATOR_HOOKFUNCTION(melee_only, FilterItemDefinition)
 {
-       entity item = M_ARGV(0, entity);
+       entity definition = M_ARGV(0, entity);
 
-       switch (item.itemdef)
+       switch (definition)
        {
                case ITEM_HealthSmall:
                case ITEM_ArmorSmall:
index bcdbe0cd920973e256c142f27d1d216ef8e90f02..0245cee640f1e9437af91804340e9f0fbb737ba3 100644 (file)
@@ -68,3 +68,12 @@ REGISTER_NADE(ENTRAP) {
     NADE_PROJECTILE(0, PROJECTILE_NADE_ENTRAP, EFFECT_NADE_TRAIL_YELLOW);
     NADE_PROJECTILE(1, PROJECTILE_NADE_ENTRAP_BURN, EFFECT_NADE_TRAIL_BURN_YELLOW);
 }
+
+REGISTER_NADE(VEIL) {
+    this.m_color = '0.65 0.85 0.65';
+    this.m_name = _("Veil grenade");
+    this.m_icon = "nade_veil";
+    this.m_alpha = 0.45;
+    NADE_PROJECTILE(0, PROJECTILE_NADE_VEIL, EFFECT_NADE_TRAIL_NEUTRAL);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_VEIL_BURN, EFFECT_NADE_TRAIL_BURN_NEUTRAL);
+}
index 24149ad7fce9430ca89000e777d20a3939f25fe6..1ffce5daed8986b7b5c420d8d40dfb88b3b9cd29 100644 (file)
@@ -36,6 +36,7 @@ entity Nade_TrailEffect(int proj, int nade_team)
 REGISTER_MUTATOR(cl_nades, true);
 MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
 {
+       // TODO: make a common orb state!
        if (STAT(HEALING_ORB) > time)
        {
                M_ARGV(0, vector) = NADE_TYPE_HEAL.m_color;
@@ -48,6 +49,12 @@ MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
                M_ARGV(1, float) = STAT(ENTRAP_ORB_ALPHA);
                return true;
        }
+       if (STAT(VEIL_ORB) > time)
+       {
+               M_ARGV(0, vector) = NADE_TYPE_VEIL.m_color;
+               M_ARGV(1, float) = STAT(VEIL_ORB_ALPHA);
+               return true;
+       }
        return false;
 }
 MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
@@ -96,6 +103,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
        settouch(proj, func_null);
        proj.scale = 1.5;
        proj.avelocity = randomvec() * 720;
+       proj.alphamod = nade_type.m_alpha;
 
        if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN)
                proj.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
@@ -665,6 +673,35 @@ void nade_monster_boom(entity this)
        e.monster_skill = MONSTER_SKILL_INSANE;
 }
 
+void nade_veil_touch(entity this, entity toucher)
+{
+       if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) )
+       {
+               entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
+
+               float tint_alpha = 0.75;
+               if(SAME_TEAM(toucher, this.realowner))
+               {
+                       tint_alpha = 0.45;
+                       if(!STAT(VEIL_ORB, show_tint))
+                       {
+                               toucher.nade_veil_prevalpha = toucher.alpha;
+                               toucher.alpha = -1;
+                       }
+               }
+               STAT(VEIL_ORB, show_tint) = time + 0.1;
+               STAT(VEIL_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime;
+       }
+}
+
+void nade_veil_boom(entity this)
+{
+       entity orb = nades_spawn_orb(this.owner, this.realowner, this.origin, autocvar_g_nades_veil_time, autocvar_g_nades_veil_radius);
+
+       settouch(orb, nade_veil_touch);
+       orb.colormod = NADE_TYPE_VEIL.m_color;
+}
+
 void nade_boom(entity this)
 {
        entity expef = NULL;
@@ -705,6 +742,11 @@ void nade_boom(entity this)
                        expef = EFFECT_SPAWN_YELLOW;
                        break;
 
+               case NADE_TYPE_VEIL:
+                       nade_blast = false;
+                       expef = EFFECT_SPAWN_NEUTRAL;
+                       break;
+
                default:
                case NADE_TYPE_NORMAL:
                        expef = EFFECT_NADE_EXPLODE(this.realowner.team);
@@ -736,6 +778,7 @@ void nade_boom(entity this)
                case NADE_TYPE_HEAL: nade_heal_boom(this); break;
                case NADE_TYPE_MONSTER: nade_monster_boom(this); break;
                case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break;
+               case NADE_TYPE_VEIL: nade_veil_boom(this); break;
        }
 
        IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
@@ -1056,6 +1099,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        n.projectiledeathtype = DEATH_NADE.m_id;
        n.weaponentity_fld = weaponentity;
        n.nade_lifetime = ntime;
+       n.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
 
        setmodel(fn, MDL_NADE_VIEW);
        setattachment(fn, player.(weaponentity), "");
@@ -1066,6 +1110,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        setthink(fn, SUB_Remove);
        fn.nextthink = n.wait;
        fn.weaponentity_fld = weaponentity;
+       fn.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
 
        player.nade = n;
        player.fake_nade = fn;
@@ -1271,6 +1316,15 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                {
                        STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
                }
+
+               if(STAT(VEIL_ORB, player) && STAT(VEIL_ORB, player) <= time)
+               {
+                       STAT(VEIL_ORB, player) = 0;
+                       if(player.vehicle)
+                               player.vehicle.alpha = player.vehicle.nade_veil_prevalpha;
+                       else
+                               player.alpha = player.nade_veil_prevalpha;
+               }
        }
 
        int n = 0;
@@ -1331,6 +1385,12 @@ MUTATOR_HOOKFUNCTION(nades, MonsterMove)
                M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed
                M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed
        }
+
+       if (STAT(VEIL_ORB, mon) && STAT(VEIL_ORB, mon) <= time)
+       {
+               mon.alpha = mon.nade_veil_prevalpha;
+               STAT(VEIL_ORB, mon) = 0;
+       }
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
@@ -1404,10 +1464,7 @@ MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
        entity frag_target = M_ARGV(2, entity);
        float frag_deathtype = M_ARGV(3, float);
 
-       if(STAT(FROZEN, frag_target))
-       if(autocvar_g_freezetag_revive_nade)
-       if(frag_attacker == frag_target)
-       if(frag_deathtype == DEATH_NADE.m_id)
+       if(autocvar_g_freezetag_revive_nade && STAT(FROZEN, frag_target) && frag_attacker == frag_target && frag_deathtype == DEATH_NADE.m_id)
        if(time - frag_inflictor.toss_time <= 0.1)
        {
                Unfreeze(frag_target);
@@ -1469,6 +1526,8 @@ MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
        STAT(HEALING_ORB_ALPHA, client) = STAT(HEALING_ORB_ALPHA, spectatee);
        STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee);
        STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee);
+       STAT(VEIL_ORB, client) = STAT(VEIL_ORB, spectatee);
+       STAT(VEIL_ORB_ALPHA, client) = STAT(VEIL_ORB_ALPHA, spectatee);
 }
 
 REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
index c5a1967e0b53ffa14bd4e0e756070cf7fb584802..e109fa7a35ddbddab0f90e18357a8a72daccbc30 100644 (file)
@@ -18,6 +18,8 @@ const int PROJECTILE_NADE_MONSTER = 82;
 const int PROJECTILE_NADE_MONSTER_BURN = 83;
 const int PROJECTILE_NADE_ENTRAP = 84;
 const int PROJECTILE_NADE_ENTRAP_BURN = 85;
+const int PROJECTILE_NADE_VEIL = 86;
+const int PROJECTILE_NADE_VEIL_BURN = 87;
 
 REGISTRY(Nades, BITS(4))
 #define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
@@ -31,6 +33,7 @@ CLASS(Nade, Object)
     ATTRIB(Nade, m_color, vector, '0 0 0');
     ATTRIB(Nade, m_name, string, _("Grenade"));
     ATTRIB(Nade, m_icon, string, "nade_normal");
+    ATTRIB(Nade, m_alpha, float, 1);
     ATTRIBARRAY(Nade, m_projectile, int, 2);
     ATTRIBARRAY(Nade, m_trail, entity, 2);
     METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
@@ -72,6 +75,7 @@ Nade Nade_FromProjectile(int proj)
 .string cvar_cl_pokenade_type;
 .float toss_time;
 .float nade_show_particles;
+.float nade_veil_prevalpha;
 
 bool orb_send(entity this, entity to, int sf);
 
index ec2593215a09b5187abd522608e07dc6f978e141..3ac652d7807df5d1ee4797dad9f16134b25dd756 100644 (file)
@@ -70,11 +70,11 @@ roflsound "New toys, new toys!" sound.
 
 */
 
-string autocvar_g_new_toys;
+//string autocvar_g_new_toys;
 
 bool nt_IsNewToy(int w);
 
-REGISTER_MUTATOR(nt, expr_evaluate(autocvar_g_new_toys) && !cvar("g_instagib") && !cvar("g_overkill"))
+REGISTER_MUTATOR(nt, expr_evaluate(cvar_string("g_new_toys")) && !autocvar_g_instagib && !cvar("g_overkill"))
 {
        MUTATOR_ONADD
        {
index c174b530f0a48e94cb20d6661fd069ecb0e2ecc4..e88ff9b552984feb7a083932173d64939709ab52 100644 (file)
@@ -1,6 +1,6 @@
 #include "sv_nix.qh"
 
-string autocvar_g_nix;
+//string autocvar_g_nix;
 int autocvar_g_balance_nix_ammo_cells;
 int autocvar_g_balance_nix_ammo_plasma;
 int autocvar_g_balance_nix_ammo_fuel;
@@ -36,7 +36,7 @@ float nix_nextweapon;
 
 bool NIX_CanChooseWeapon(int wpn);
 
-REGISTER_MUTATOR(nix, expr_evaluate(autocvar_g_nix) && !cvar("g_instagib") && !cvar("g_overkill"))
+REGISTER_MUTATOR(nix, expr_evaluate(cvar_string("g_nix")) && !autocvar_g_instagib && !cvar("g_overkill"))
 {
        MUTATOR_ONADD
        {
@@ -244,15 +244,15 @@ MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString)
        M_ARGV(0, string) = strcat(M_ARGV(0, string), ", NIX");
 }
 
-MUTATOR_HOOKFUNCTION(nix, FilterItem)
+MUTATOR_HOOKFUNCTION(nix, FilterItemDefinition)
 {
-       entity item = M_ARGV(0, entity);
+       entity definition = M_ARGV(0, entity);
 
-       if(item.itemdef.instanceOfHealth || item.itemdef.instanceOfArmor)
+       if (definition.instanceOfHealth || definition.instanceOfArmor)
        {
                return !autocvar_g_nix_with_healtharmor;
        }
-       else if(item.itemdef.instanceOfPowerup)
+       else if (definition.instanceOfPowerup)
        {
                return !autocvar_g_nix_with_powerups;
        }
index 98fb4815c1ce28cc699a429537ea75c2643b4487..5e11096a532644d671eb7bd409b0519e08d3c3bd 100644 (file)
@@ -1 +1,4 @@
 // generated file; do not modify
+#ifdef SVQC
+    #include <common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qh>
+#endif
index b25175aea5ad9055355fd508b0ba238fad97673a..3a10055fe5419e0f52c855f91edb0066ba170718 100644 (file)
@@ -1,3 +1,5 @@
+#include "sv_offhand_blaster.qh"
+
 string autocvar_g_offhand_blaster = "0";
 
 REGISTER_MUTATOR(offhand_blaster, expr_evaluate(autocvar_g_offhand_blaster));
diff --git a/qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qh b/qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index e9106239467ffc7432cda21fa887481db192a6cc..582a8d35bcb9cfcd42182f8064312ef4fd3dc449 100644 (file)
@@ -11,7 +11,7 @@ bool autocvar_g_overkill_itemwaypoints = true;
 
 .Weapon ok_lastwep[MAX_WEAPONSLOTS];
 
-REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill")
+REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !autocvar_g_instagib && !g_nexball && cvar_string("g_mod_balance") == "Overkill")
 {
        MUTATOR_ONADD
        {
index 1084ff77895aa079e2dd9104ffe1159551f54db2..c5bf2262eb35e37523c3ac83caa559d4ef1e8d6d 100644 (file)
@@ -1,7 +1,7 @@
 #include "sv_pinata.qh"
 
 string autocvar_g_pinata;
-REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) && !cvar("g_instagib") && !cvar("g_overkill"));
+REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) && !autocvar_g_instagib && !cvar("g_overkill"));
 
 MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
 {
index 3d305746269e1a29cbfb718ceb536175d04693af..553dcf582ffccbd27d2ff23adc95e238d49bcb5d 100644 (file)
@@ -7,15 +7,6 @@
 
 //============================ Constants ======================================
 
-enum
-{
-       RANDOM_ITEM_TYPE_HEALTH = 1,
-       RANDOM_ITEM_TYPE_ARMOR,
-       RANDOM_ITEM_TYPE_RESOURCE,
-       RANDOM_ITEM_TYPE_WEAPON,
-       RANDOM_ITEM_TYPE_POWERUP
-};
-
 //======================= Global variables ====================================
 
 // Replace cvars
@@ -72,99 +63,137 @@ string RandomItems_GetRandomItemClassName(string prefix)
        {
                return RandomItems_GetRandomOverkillItemClassName(prefix);
        }
-       return RandomItems_GetRandomVanillaItemClassName(prefix);
+       return RandomItems_GetRandomVanillaItemClassName(prefix,
+               RANDOM_ITEM_TYPE_ALL);
 }
 
-string RandomItems_GetRandomVanillaItemClassName(string prefix)
+string RandomItems_GetRandomVanillaItemClassName(string prefix, int types)
 {
-       RandomSelection_Init();
-       string cvar_name = sprintf("g_%s_health_probability", prefix);
-       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
-       {
-               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
-       }
-       else
-       {
-               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_HEALTH, cvar(cvar_name), 1);
-       }
-       cvar_name = sprintf("g_%s_armor_probability", prefix);
-       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
-       {
-               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
-       }
-       else
+       if (types == 0)
        {
-               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_ARMOR, cvar(cvar_name), 1);
-       }
-       cvar_name = sprintf("g_%s_resource_probability", prefix);
-       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
-       {
-               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
-       }
-       else
-       {
-               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_RESOURCE, cvar(cvar_name), 1);
-       }
-       cvar_name = sprintf("g_%s_weapon_probability", prefix);
-       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
-       {
-               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
-       }
-       else
-       {
-               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_WEAPON, cvar(cvar_name), 1);
-       }
-       cvar_name = sprintf("g_%s_powerup_probability", prefix);
-       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
-       {
-               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
-       }
-       else
-       {
-               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_POWERUP, cvar(cvar_name), 1);
+               return "";
        }
-       int item_type = RandomSelection_chosen_float;
-       switch (item_type)
+       while (types != 0)
        {
-               case RANDOM_ITEM_TYPE_HEALTH:
+               string cvar_name;
+               RandomSelection_Init();
+               if (types & RANDOM_ITEM_TYPE_HEALTH)
                {
-                       return RandomItems_GetRandomItemClassNameWithProperty(prefix,
-                               instanceOfHealth);
+                       cvar_name = sprintf("g_%s_health_probability", prefix);
+                       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                       {
+                               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
+                       }
+                       else
+                       {
+                               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_HEALTH,
+                                       cvar(cvar_name), 1);
+                       }
                }
-               case RANDOM_ITEM_TYPE_ARMOR:
+               if (types & RANDOM_ITEM_TYPE_ARMOR)
                {
-                       return RandomItems_GetRandomItemClassNameWithProperty(prefix,
-                               instanceOfArmor);
+                       cvar_name = sprintf("g_%s_armor_probability", prefix);
+                       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                       {
+                               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
+                       }
+                       else
+                       {
+                               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_ARMOR,
+                                       cvar(cvar_name), 1);
+                       }
                }
-               case RANDOM_ITEM_TYPE_RESOURCE:
+               if (types & RANDOM_ITEM_TYPE_RESOURCE)
                {
-                       return RandomItems_GetRandomItemClassNameWithProperty(prefix,
-                               instanceOfAmmo);
+                       cvar_name = sprintf("g_%s_resource_probability", prefix);
+                       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                       {
+                               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
+                       }
+                       else
+                       {
+                               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_RESOURCE,
+                                       cvar(cvar_name), 1);
+                       }
+               }
+               if (types & RANDOM_ITEM_TYPE_WEAPON)
+               {
+                       cvar_name = sprintf("g_%s_weapon_probability", prefix);
+                       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                       {
+                               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
+                       }
+                       else
+                       {
+                               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_WEAPON, cvar(cvar_name), 1);
+                       }
+               }
+               if (types & RANDOM_ITEM_TYPE_POWERUP)
+               {
+                       cvar_name = sprintf("g_%s_powerup_probability", prefix);
+                       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                       {
+                               LOG_WARNF("Random items: cvar %s doesn't exist.", cvar_name);
+                       }
+                       else
+                       {
+                               RandomSelection_AddFloat(RANDOM_ITEM_TYPE_POWERUP, cvar(cvar_name), 1);
+                       }
                }
-               case RANDOM_ITEM_TYPE_WEAPON:
+               int item_type = RandomSelection_chosen_float;
+               string class_name = "";
+               switch (item_type)
                {
-                       RandomSelection_Init();
-                       FOREACH(Weapons, it != WEP_Null &&
-                               !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED),
+                       case RANDOM_ITEM_TYPE_HEALTH:
+                       {
+                               class_name = RandomItems_GetRandomItemClassNameWithProperty(
+                                       prefix, instanceOfHealth);
+                               break;
+                       }
+                       case RANDOM_ITEM_TYPE_ARMOR:
+                       {
+                               class_name = RandomItems_GetRandomItemClassNameWithProperty(
+                                       prefix, instanceOfArmor);
+                               break;
+                       }
+                       case RANDOM_ITEM_TYPE_RESOURCE:
                        {
-                               cvar_name = sprintf("g_%s_%s_probability", prefix,
-                                       it.m_canonical_spawnfunc);
-                               if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                               class_name = RandomItems_GetRandomItemClassNameWithProperty(
+                                       prefix, instanceOfAmmo);
+                               break;
+                       }
+                       case RANDOM_ITEM_TYPE_WEAPON:
+                       {
+                               RandomSelection_Init();
+                               FOREACH(Weapons, it != WEP_Null &&
+                                       !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED),
                                {
-                                       LOG_WARNF("Random items: cvar %s doesn't exist.",
-                                               cvar_name);
-                                       continue;
-                               }
-                               RandomSelection_AddString(it.m_canonical_spawnfunc,
-                                       cvar(cvar_name), 1);
-                       });
-                       return RandomSelection_chosen_string;
+                                       cvar_name = sprintf("g_%s_%s_probability", prefix,
+                                               it.m_canonical_spawnfunc);
+                                       if (!(cvar_type(cvar_name) & CVAR_TYPEFLAG_EXISTS))
+                                       {
+                                               LOG_WARNF("Random items: cvar %s doesn't exist.",
+                                                       cvar_name);
+                                               continue;
+                                       }
+                                       RandomSelection_AddString(it.m_canonical_spawnfunc,
+                                               cvar(cvar_name), 1);
+                               });
+                               class_name = RandomSelection_chosen_string;
+                               break;
+                       }
+                       case RANDOM_ITEM_TYPE_POWERUP:
+                       {
+                               class_name = RandomItems_GetRandomItemClassNameWithProperty(
+                                       prefix, instanceOfPowerup);
+                               break;
+                       }
                }
-               case RANDOM_ITEM_TYPE_POWERUP:
+               if (class_name != "")
                {
-                       return RandomItems_GetRandomItemClassNameWithProperty(prefix,
-                               instanceOfPowerup);
+                       return class_name;
                }
+               types &= ~item_type;
        }
        return "";
 }
@@ -172,7 +201,8 @@ string RandomItems_GetRandomVanillaItemClassName(string prefix)
 string RandomItems_GetRandomInstagibItemClassName(string prefix)
 {
        RandomSelection_Init();
-       FOREACH(Items, it.spawnflags & ITEM_FLAG_INSTAGIB,
+       FOREACH(Items, it.spawnflags & ITEM_FLAG_INSTAGIB &&
+               Item_IsDefinitionAllowed(it),
        {
                string cvar_name = sprintf("g_%s_%s_probability", prefix,
                        it.m_canonical_spawnfunc);
@@ -190,7 +220,8 @@ string RandomItems_GetRandomOverkillItemClassName(string prefix)
 {
        RandomSelection_Init();
        FOREACH(Items, (it.spawnflags & ITEM_FLAG_OVERKILL) &&
-               !(it.spawnflags & ITEM_FLAG_MUTATORBLOCKED),
+               !(it.spawnflags & ITEM_FLAG_MUTATORBLOCKED) &&
+               Item_IsDefinitionAllowed(it),
        {
                string cvar_name = sprintf("g_%s_overkill_%s_probability", prefix,
                        it.m_canonical_spawnfunc);
@@ -242,7 +273,8 @@ string RandomItems_GetRandomItemClassNameWithProperty(string prefix,
        .bool item_property)
 {
        RandomSelection_Init();
-       FOREACH(Items, it.item_property && (it.spawnflags & ITEM_FLAG_NORMAL),
+       FOREACH(Items, it.item_property && (it.spawnflags & ITEM_FLAG_NORMAL) &&
+               Item_IsDefinitionAllowed(it),
        {
                string cvar_name = sprintf("g_%s_%s_probability", prefix,
                        it.m_canonical_spawnfunc);
index c9b4dbb9011ca91cd905d0c7221e3f089f4745b0..9ac738ca68ede11020c348c1a681d0b65a0eb7ca 100644 (file)
@@ -7,6 +7,16 @@
 
 bool autocvar_g_random_items; ///< Whether to enable random items.
 
+enum
+{
+       RANDOM_ITEM_TYPE_HEALTH = BIT(0),
+       RANDOM_ITEM_TYPE_ARMOR = BIT(1),
+       RANDOM_ITEM_TYPE_RESOURCE = BIT(2),
+       RANDOM_ITEM_TYPE_WEAPON = BIT(3),
+       RANDOM_ITEM_TYPE_POWERUP = BIT(4),
+       RANDOM_ITEM_TYPE_ALL = BITS(5)
+};
+
 /// \brief Returns a random classname of the item.
 /// \param[in] prefix Prefix of the cvars that hold probabilities.
 /// \return Random classname of the item.
@@ -16,10 +26,11 @@ string RandomItems_GetRandomItemClassName(string prefix);
 
 /// \brief Returns a random classname of the vanilla item.
 /// \param[in] prefix Prefix of the cvars that hold probabilities.
+/// \param[in] types Bitmask of the types. See RANDOM_ITEM_TYPE constants.
 /// \return Random classname of the vanilla item.
 /// \note This includes mutator items that don't change gameplay a lot such as
 /// jetpack and new toys.
-string RandomItems_GetRandomVanillaItemClassName(string prefix);
+string RandomItems_GetRandomVanillaItemClassName(string prefix, int types);
 
 /// \brief Returns a random classname of the instagib item.
 /// \param[in] prefix Prefix of the cvars that hold probabilities.
index 7edef9813de0fd3c13ca1d79d6593674202c32c1..c6def68e1b61f6ddb56f76bdac458ad3ef5db931 100644 (file)
@@ -3,7 +3,7 @@
 #include <common/deathtypes/all.qh>
 #include <server/round_handler.qh>
 
-REGISTER_MUTATOR(rm, cvar("g_instagib"));
+REGISTER_MUTATOR(rm, autocvar_g_instagib);
 
 MUTATOR_HOOKFUNCTION(rm, Damage_Calculate)
 {
index d121cf1094685ac9263f55143b59da831cf37610..d80b21d5a6e0cec3b4a59f5c403b948eece5cd85 100644 (file)
@@ -212,11 +212,11 @@ void sandbox_ObjectRemove(entity e)
        // 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, { 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;    }
-       if(e.netname)   {       strunzone(e.netname);   e.netname = string_null;        }
-       if(e.message)   {       strunzone(e.message);   e.message = string_null;        }
-       if(e.message2)  {       strunzone(e.message2);  e.message2 = string_null;       }
+       strfree(e.material);
+       strfree(e.crypto_idfp);
+       strfree(e.netname);
+       strfree(e.message);
+       strfree(e.message2);
        delete(e);
        e = NULL;
 
@@ -357,14 +357,14 @@ entity sandbox_ObjectPort_Load(entity this, string s, float database)
                e.old_movetype = stof(argv(argv_num));  ++argv_num;
                set_movetype(e, e.old_movetype);
                e.damageforcescale = stof(argv(argv_num));      ++argv_num;
-               if(e.material)  strunzone(e.material);  if(argv(argv_num) != "")        e.material = strzone(argv(argv_num));   else    e.material = string_null;       ++argv_num;
+               strfree(e.material);    if(argv(argv_num) != "")        e.material = strzone(argv(argv_num));   else    e.material = string_null;       ++argv_num;
                if(database)
                {
                        // properties stored only for the database
-                       if(e.crypto_idfp)       strunzone(e.crypto_idfp);       if(argv(argv_num) != "")        e.crypto_idfp = strzone(argv(argv_num));        else    e.crypto_idfp = string_null;    ++argv_num;
-                       if(e.netname)   strunzone(e.netname);   e.netname = strzone(argv(argv_num));    ++argv_num;
-                       if(e.message)   strunzone(e.message);   e.message = strzone(argv(argv_num));    ++argv_num;
-                       if(e.message2)  strunzone(e.message2);  e.message2 = strzone(argv(argv_num));   ++argv_num;
+                       strfree(e.crypto_idfp); if(argv(argv_num) != "")        e.crypto_idfp = strzone(argv(argv_num));        else    e.crypto_idfp = string_null;    ++argv_num;
+                       strcpy(e.netname, argv(argv_num));      ++argv_num;
+                       strcpy(e.message, argv(argv_num));      ++argv_num;
+                       strcpy(e.message2, argv(argv_num));     ++argv_num;
                }
 
                // attach last
@@ -702,7 +702,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                                        e.damageforcescale = stof(argv(3));
                                                        break;
                                                case "material":
-                                                       if(e.material)  strunzone(e.material);
+                                                       strfree(e.material);
                                                        if(argv(3))
                                                        {
                                                                for (j = 1; j <= 5; j++) // precache material sounds, 5 in total
@@ -718,8 +718,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                        }
 
                                        // update last editing time
-                                       if(e.message2)  strunzone(e.message2);
-                                       e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S"));
+                                       strcpy(e.message2, strftime(true, "%d-%m-%Y %H:%M:%S"));
 
                                        if(autocvar_g_sandbox_info > 1)
                                                LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin));
@@ -745,8 +744,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                        // also update the player's nickname if he changed it (but has the same player UID)
                                        if(e.netname != player.netname)
                                        {
-                                               if(e.netname)   strunzone(e.netname);
-                                               e.netname = strzone(player.netname);
+                                               strcpy(e.netname, player.netname);
                                                print_to(player, "^2SANDBOX - INFO: ^7Object owner name updated");
                                        }
 
@@ -756,8 +754,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand)
                                                return true;
                                        }
 
-                                       if(e.crypto_idfp)       strunzone(e.crypto_idfp);
-                                       e.crypto_idfp = strzone(player.crypto_idfp);
+                                       strcpy(e.crypto_idfp, player.crypto_idfp);
 
                                        print_to(player, "^2SANDBOX - INFO: ^7Object claimed successfully");
                                }
index 199b4e202a7351a9b2d25bfb4364ec02119a259d..b599805a45774f6d971087191a259ebffef342c1 100644 (file)
@@ -1,7 +1,7 @@
 #include "sv_vampire.qh"
 
 string autocvar_g_vampire;
-REGISTER_MUTATOR(vampire, expr_evaluate(autocvar_g_vampire) && !cvar("g_instagib"));
+REGISTER_MUTATOR(vampire, expr_evaluate(autocvar_g_vampire) && !autocvar_g_instagib);
 
 MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
 {
index be5b40c14c40c99301f8e91a7d54e08a017f9f65..0faf7068cf396d2320c56353c49bf2025ce54882 100644 (file)
@@ -106,9 +106,9 @@ NET_HANDLE(waypointsprites, bool isnew) {
 
 void Ent_RemoveWaypointSprite(entity this)
 {
-    if (this.netname) strunzone(this.netname);
-    if (this.netname2) strunzone(this.netname2);
-    if (this.netname3) strunzone(this.netname3);
+    strfree(this.netname);
+    strfree(this.netname2);
+    strfree(this.netname3);
 }
 
 /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
@@ -169,23 +169,17 @@ void Ent_WaypointSprite(entity this, bool isnew)
 
     if (sendflags & 2)
     {
-        if (this.netname)
-            strunzone(this.netname);
-        this.netname = strzone(ReadString());
+        strcpy(this.netname, ReadString());
     }
 
     if (sendflags & 4)
     {
-        if (this.netname2)
-            strunzone(this.netname2);
-        this.netname2 = strzone(ReadString());
+        strcpy(this.netname2, ReadString());
     }
 
     if (sendflags & 8)
     {
-        if (this.netname3)
-            strunzone(this.netname3);
-        this.netname3 = strzone(ReadString());
+        strcpy(this.netname3, ReadString());
     }
 
     if (sendflags & 16)
index 95b8890ccce07b10765c5dae8218d9d265b223bc..94d735a1f6096b2f3a77a0b712e4124912bb0aa3 100644 (file)
@@ -11,21 +11,21 @@ const int SPRITERULE_SPECTATOR = 2;
 
 #ifdef CSQC
 entityclass(WaypointSprite);
-class(WaypointSprite) .float helpme;
-class(WaypointSprite) .float rule;
-class(WaypointSprite) .string netname; // primary picture
-class(WaypointSprite) .string netname2; // secondary picture
-class(WaypointSprite) .string netname3; // tertiary picture
-class(WaypointSprite) .int team; // team that gets netname2
-class(WaypointSprite) .float lifetime;
-class(WaypointSprite) .float fadetime;
-class(WaypointSprite) .float maxdistance;
-class(WaypointSprite) .int hideflags;
-class(WaypointSprite) .float spawntime;
-class(WaypointSprite) .float health;
-class(WaypointSprite) .float build_started;
-class(WaypointSprite) .float build_starthealth;
-class(WaypointSprite) .float build_finished;
+classfield(WaypointSprite) .float helpme;
+classfield(WaypointSprite) .float rule;
+classfield(WaypointSprite) .string netname; // primary picture
+classfield(WaypointSprite) .string netname2; // secondary picture
+classfield(WaypointSprite) .string netname3; // tertiary picture
+classfield(WaypointSprite) .int team; // team that gets netname2
+classfield(WaypointSprite) .float lifetime;
+classfield(WaypointSprite) .float fadetime;
+classfield(WaypointSprite) .float maxdistance;
+classfield(WaypointSprite) .int hideflags;
+classfield(WaypointSprite) .float spawntime;
+classfield(WaypointSprite) .float health;
+classfield(WaypointSprite) .float build_started;
+classfield(WaypointSprite) .float build_starthealth;
+classfield(WaypointSprite) .float build_finished;
 
 float autocvar_g_waypointsprite_alpha;
 float autocvar_g_waypointsprite_crosshairfadealpha;
index b9350758a115fb6ab3558c86e867a5e62d549c73..644d049d38e8d92c6f86ad49c8e3487fd5092380 100644 (file)
@@ -1063,8 +1063,7 @@ void Local_Notification_sound(int soundchannel, string soundfile, float soundvol
 
                _sound(NULL, soundchannel, AnnouncerFilename(soundfile), soundvolume, soundposition);
 
-               if (prev_soundfile) strunzone(prev_soundfile);
-               prev_soundfile = strzone(soundfile);
+               strcpy(prev_soundfile, soundfile);
                prev_soundtime = time;
        }
        else
@@ -1467,7 +1466,7 @@ void Net_Notification_Remove(entity this)
                this.owner.nent_name
        ));
        #endif
-       for (int i = 0; i < this.nent_stringcount; ++i) { if (this.nent_strings[i]) strunzone(this.nent_strings[i]); }
+       for (int i = 0; i < this.nent_stringcount; ++i) { strfree(this.nent_strings[i]); }
        delete(this);
 }
 
index 1721303ab526a6d2fc93d5a406d99b5ad1973d43..12bd3b68395a519a2281d236fffb324e7a83e5e7 100644 (file)
@@ -676,7 +676,8 @@ string notif_arg_spree_inf(float type, string input, string player, float spree)
 
 REGISTRY(Notifications, BITS(11))
 REGISTER_REGISTRY(Notifications)
-REGISTRY_SORT(Notifications); STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); }
+REGISTRY_SORT(Notifications);
+STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); }
 REGISTRY_CHECK(Notifications)
 
 const int NOTIF_CHOICE_MAX = 50;
index 351725bc14698fe92da40c5aa533947e5a7e0381..1b80655026dcf4b2fdc00a7cf79b4bd5e628d7ed 100644 (file)
@@ -98,42 +98,51 @@ float GeomLerp(float a, float _lerp, float b)
 
 void PM_ClientMovement_UpdateStatus(entity this)
 {
-#ifdef CSQC
        if(!IS_PLAYER(this))
                return;
 
-       // set crouched
-       bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+       bool have_hook = false;
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
-               entity wep = viewmodels[slot];
-               if(wep.hook && !wasfreed(wep.hook))
+       #if defined(CSQC)
+               entity wepent = viewmodels[slot];
+       #elif defined(SVQC)
+               .entity weaponentity = weaponentities[slot];
+               entity wepent = this.(weaponentity);
+       #endif
+               if(wepent.hook && !wasfreed(wepent.hook))
                {
-                       do_crouch = false;
-                       break; // don't bother checking the others
+                       have_hook = true;
+                       break;
                }
        }
-       //if(this.waterlevel >= WATERLEVEL_SWIMMING)
+       bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+       if (have_hook) {
+               do_crouch = false;
+       //} else if (this.waterlevel >= WATERLEVEL_SWIMMING) {
                //do_crouch = false;
-       if(hud != HUD_NORMAL)
+       } else if (PHYS_INVEHICLE(this)) {
                do_crouch = false;
-       if(STAT(FROZEN, this))
+       } else if (STAT(FROZEN, this)) {
                do_crouch = false;
+    }
 
-       if (do_crouch)
-       {
-               // wants to crouch, this always works
-               if (!IS_DUCKED(this)) SET_DUCKED(this);
-       }
-       else
-       {
-               // wants to stand, if currently crouching we need to check for a low ceiling first
-               if (IS_DUCKED(this))
-               {
-                       tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, MOVE_NORMAL, this);
-                       if (!trace_startsolid) UNSET_DUCKED(this);
+       if (do_crouch) {
+               if (!IS_DUCKED(this)) {
+                       SET_DUCKED(this);
+                       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 (IS_DUCKED(this)) {
+        tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+        if (!trace_startsolid) {
+            UNSET_DUCKED(this);
+            this.view_ofs = STAT(PL_VIEW_OFS, this);
+            setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+        }
        }
+#ifdef CSQC
 
        if (IS_ONGROUND(this) || this.velocity.z <= 0 || PHYS_WATERJUMP_TIME(this) <= 0)
                PHYS_WATERJUMP_TIME(this) = 0;
index 4b2ffc55f90595c9eb3efc3cbb65db7a5858da48..da48fa698c2086e34049c7fc1ffeb0f9599d5a87 100644 (file)
@@ -101,15 +101,6 @@ bool IsFlying(entity a);
 #define PHYS_INPUT_BUTTON_ZOOM(s)           PHYS_INPUT_BUTTON_BUTTON4(s)
 #define PHYS_INPUT_BUTTON_CROUCH(s)         PHYS_INPUT_BUTTON_BUTTON5(s)
 #define PHYS_INPUT_BUTTON_HOOK(s)           PHYS_INPUT_BUTTON_BUTTON6(s)
-
-#ifdef CSQC
-STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
-{
-       localcmd("alias +hook +button6\n");
-       localcmd("alias -hook -button6\n");
-}
-#endif
-
 #define PHYS_INPUT_BUTTON_INFO(s)           PHYS_INPUT_BUTTON_BUTTON7(s)
 #define PHYS_INPUT_BUTTON_DRAG(s)           PHYS_INPUT_BUTTON_BUTTON8(s)
 #define PHYS_INPUT_BUTTON_USE(s)            PHYS_INPUT_BUTTON_BUTTON_USE(s)
@@ -120,16 +111,16 @@ STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
 #define PHYS_INPUT_BUTTON_DODGE(s)                     PHYS_INPUT_BUTTON_BUTTON11(s)
 
 #ifdef CSQC
-STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
+STATIC_INIT(PHYS_INPUT_BUTTON)
 {
+       localcmd("alias +hook +button6\n");
+       localcmd("alias -hook -button6\n");
+
        localcmd("alias +jetpack +button10\n");
-    localcmd("alias -jetpack -button10\n");
-}
+       localcmd("alias -jetpack -button10\n");
 
-STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
-{
-    localcmd("alias +dodge +button11\n");
-    localcmd("alias -dodge -button11\n");
+       localcmd("alias +dodge +button11\n");
+       localcmd("alias -dodge -button11\n");
 }
 #endif
 
@@ -240,6 +231,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define SET_DUCKED(s)                       ((s).flags |= FL_DUCKED)
        #define UNSET_DUCKED(s)                     ((s).flags &= ~FL_DUCKED)
 
+       #define PHYS_INVEHICLE(s)                                       (boolean(hud != HUD_NORMAL))
+
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_cl_jumpspeedcap_min
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_cl_jumpspeedcap_max
 
@@ -292,6 +285,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define SET_DUCKED(s)                       ((s).crouch = true)
        #define UNSET_DUCKED(s)                     ((s).crouch = false)
 
+       #define PHYS_INVEHICLE(s)                                       (boolean((s).vehicle != NULL))
+
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_sv_jumpspeedcap_min
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_sv_jumpspeedcap_max
 
index 0fcd70dfc08fd8e7afd9bdc2cd2b31c063331c79..cde6a519028093268ef95fc568e91184a40d3368 100644 (file)
@@ -154,8 +154,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
                }
        }
 
-       strunzone(p.playerstats_id);
-       p.playerstats_id = string_null;
+       strfree(p.playerstats_id);
 }
 
 void PlayerStats_GameReport(float finished)
index a22e0e70ee45f81fbb003b5edbcf73b99bacb63f..d46ac9eafc7c36cccbeb07c7d302fe9b25f250d3 100644 (file)
@@ -92,40 +92,55 @@ const float VOL_MUFFLED = 0.35;
                } \
        } MACRO_END
 
+string _Sound_fixpath(string base)
+{
+       if (base == "") return string_null;
+#ifdef SVQC
+       return strcat(base, ".wav");  // let the client engine decide
+#else
+#define extensions(x) \
+       x(wav) \
+       x(ogg) \
+       x(flac) \
+       /**/
+#define tryext(ext) { \
+               string s = strcat(base, "." #ext); \
+               if (fexists(strcat("sound/", s))) { \
+                       return s; \
+               } \
+       }
+       extensions(tryext);
+       LOG_WARNF("Missing sound: \"%s\"", strcat("sound/", base));
+#undef tryext
+#undef extensions
+       return string_null;
+#endif
+}
+
 CLASS(Sound, Object)
        ATTRIB(Sound, m_id, int, 0);
        ATTRIB(Sound, sound_str, string());
+       ATTRIB(Sound, sound_str_, string);
        CONSTRUCTOR(Sound, string() path)
        {
                CONSTRUCT(Sound);
                this.sound_str = path;
        }
-       #define Sound_fixpath(this) _Sound_fixpath((this).sound_str())
-       string _Sound_fixpath(string base)
-       {
-               if (base == "") return string_null;
-#ifdef SVQC
-               return strcat(base, ".wav");  // let the client engine decide
-#else
-               #define extensions(x) \
-                       x(wav) \
-                       x(ogg) \
-                       x(flac) \
-                       /**/
-               #define tryext(ext) { string s = strcat(base, "." #ext); if (fexists(strcat("sound/", s))) return s; }
-               extensions(tryext);
-               LOG_WARNF("Missing sound: \"%s\"", strcat("sound/", base));
-               #undef tryext
-               #undef extensions
-               return string_null;
-#endif
-       }
        METHOD(Sound, sound_precache, void(Sound this))
        {
            TC(Sound, this);
-               string s = Sound_fixpath(this);
+               string s = _Sound_fixpath(this.sound_str());
                if (!s) return;
                profile(sprintf("precache_sound(\"%s\")", s));
                precache_sound(s);
+               strcpy(this.sound_str_, s);
        }
 ENDCLASS(Sound)
+
+entity _Sound_fixpath_this;
+string _Sound_fixpath_cached;
+#define Sound_fixpath(this) ( \
+       _Sound_fixpath_this = (this), \
+       _Sound_fixpath_cached = _Sound_fixpath_this.sound_str_, \
+       _Sound_fixpath_cached ? _Sound_fixpath_cached : _Sound_fixpath(_Sound_fixpath_this.sound_str()) \
+)
index 648ef60e844b8f316662ea633e5c6ac3ca2a12dc..9b8f04041780fd55f707331540c74ab99b0e8e88 100644 (file)
@@ -120,6 +120,8 @@ REGISTER_STAT(ENTRAP_ORB, float)
 REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
 REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
 REGISTER_STAT(KILL_TIME, float)
+REGISTER_STAT(VEIL_ORB, float)
+REGISTER_STAT(VEIL_ORB_ALPHA, float)
 
 #ifdef SVQC
 float autocvar_sv_showfps = 5;
index 249615d2d392b8b5fe828e531c11586921ca3737..039d27da351f284a3766d9684a6bbf2c45838b72 100644 (file)
@@ -148,8 +148,17 @@ void Item_PreDraw(entity this)
 
 void ItemRemove(entity this)
 {
-       if(this.mdl)
-               strunzone(this.mdl);
+       strfree(this.mdl);
+}
+
+HashMap ENT_CLIENT_ITEM_simple;
+STATIC_INIT(ENT_CLIENT_ITEM_simple)
+{
+       HM_NEW(ENT_CLIENT_ITEM_simple);
+}
+SHUTDOWN(ENT_CLIENT_ITEM_simple)
+{
+       HM_DELETE(ENT_CLIENT_ITEM_simple);
 }
 
 NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
@@ -211,10 +220,8 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
         if(!warpzone_warpzones_exist && this.fade_start && !autocvar_cl_items_nofade)
                setpredraw(this, Item_PreDraw);
 
-        if(this.mdl)
-            strunzone(this.mdl);
+               strfree(this.mdl);
 
-        this.mdl = "";
         string _fn = ReadString();
         this.item_simple = false; // reset it!
 
@@ -223,27 +230,37 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
             string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
             this.item_simple = true;
 
-            if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".md3")))
-                this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".md3"));
-            else if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".dpm")))
-                this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".dpm"));
-            else if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".iqm")))
-                this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".iqm"));
-            else if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".mdl")))
-                this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".mdl"));
-            else
-            {
-                this.item_simple = false;
-                LOG_TRACE("Simple item requested for ", _fn, " but no model exists for it");
-            }
+                       #define extensions(x) \
+                               x(md3) \
+                               x(dpm) \
+                               x(iqm) \
+                               x(mdl) \
+                               /**/
+                       #define tryext(ext) { \
+                               string s = strcat(_fn2, autocvar_cl_simpleitems_postfix, "." #ext); \
+                               string cached = HM_gets(ENT_CLIENT_ITEM_simple, s); \
+                               if (cached == "") { \
+                                       HM_sets(ENT_CLIENT_ITEM_simple, s, cached = fexists(s) ? "1" : "0"); \
+                               } \
+                               if (cached != "0") { \
+                                       strcpy(this.mdl, s); \
+                                       break; \
+                               } \
+                       }
+                       do {
+                               extensions(tryext);
+                               this.item_simple = false;
+                LOG_TRACEF("Simple item requested for %s but no model exists for it", _fn);
+                       } while (0);
+                       #undef tryext
+                       #undef extensions
         }
 
         if(!this.item_simple)
-            this.mdl = strzone(_fn);
-
+            strcpy(this.mdl, _fn);
 
         if(this.mdl == "")
-            LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, ", tell tZork about this!");
+            LOG_WARNF("this.mdl is unset for item %s", this.classname);
 
         precache_model(this.mdl);
         _setmodel(this, this.mdl);
@@ -663,8 +680,6 @@ void Item_ScheduleRespawn(entity e)
 AUTOCVAR(g_pickup_respawntime_initial_random, int, 1,
        "For items that don't start spawned: 0: spawn after their normal respawntime; 1: spawn after `random * respawntime` with the *same* random; 2: same as 1 but each item has separate random");
 
-float shared_random;
-STATIC_INIT(shared_random) { shared_random = random(); }
 void Item_ScheduleInitialRespawn(entity e)
 {
        Item_Show(e, 0);
@@ -675,18 +690,26 @@ void Item_ScheduleInitialRespawn(entity e)
                // range: respawntime .. respawntime + respawntimejitter
                spawn_in = e.respawntime + random() * e.respawntimejitter;
        }
-       else if (autocvar_g_pickup_respawntime_initial_random == 1)
+       else
        {
+               float rnd;
+               if (autocvar_g_pickup_respawntime_initial_random == 1)
+               {
+                       static float shared_random = 0;
+                       // NOTE this code works only if items are scheduled at the same time (normal case)
+                       // NOTE2 random() can't return exactly 1 so this check always work as intended
+                       if (!shared_random || floor(time) > shared_random)
+                               shared_random = floor(time) + random();
+                       rnd = shared_random - floor(time);
+               }
+               else
+                       rnd = random();
+
                // range:
                // if respawntime >= ITEM_RESPAWN_TICKS: ITEM_RESPAWN_TICKS .. respawntime + respawntimejitter
                // else: 0 .. ITEM_RESPAWN_TICKS
                // this is to prevent powerups spawning unexpectedly without waypoints
-               spawn_in = ITEM_RESPAWN_TICKS + shared_random * (e.respawntime + e.respawntimejitter - ITEM_RESPAWN_TICKS);
-       }
-       else
-       {
-               // range: same as 1
-               spawn_in = ITEM_RESPAWN_TICKS + random() * (e.respawntime + e.respawntimejitter - ITEM_RESPAWN_TICKS);
+               spawn_in = ITEM_RESPAWN_TICKS + rnd * (e.respawntime + e.respawntimejitter - ITEM_RESPAWN_TICKS);
        }
 
        Item_ScheduleRespawnIn(e, max(0, game_starttime - time) + ((e.respawntimestart) ? e.respawntimestart : spawn_in));
index d31c5a464b416f56ea268b87238963f67ea4ea14..c19041aa0b1b7ad2269597caa1ea93040a26afa6 100644 (file)
@@ -56,21 +56,19 @@ void door_blocked(entity this, entity blocker)
                        if (this.wait >= 0)
                        {
                                if (this.state == STATE_DOWN)
-                       if (this.classname == "door")
-                       {
-                               door_go_up (this, NULL, NULL);
-                       } else
-                       {
-                               door_rotating_go_up(this, blocker);
-                       }
+                               {
+                                       if (this.classname == "door")
+                                               door_go_up(this, NULL, NULL);
+                                       else
+                                               door_rotating_go_up(this, blocker);
+                               }
                                else
-                       if (this.classname == "door")
-                       {
-                               door_go_down (this);
-                       } else
-                       {
-                               door_rotating_go_down (this);
-                       }
+                               {
+                                       if (this.classname == "door")
+                                               door_go_down(this);
+                                       else
+                                               door_rotating_go_down(this);
+                               }
                        }
                }
 #ifdef SVQC
index 92f361a145c098c56efa037cc3b9ede05b3a9a4f..020ecca0855beb2260ad48608fd77bf917286b39 100644 (file)
@@ -126,8 +126,7 @@ spawnfunc(func_water)
 
 void func_ladder_remove(entity this)
 {
-       if(this.classname) { strunzone(this.classname); }
-       this.classname = string_null;
+       strfree(this.classname);
 }
 
 NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
index 18d3c30e8d774478102c28344bd894bc4681cb6c..7de5a03ef8171e905ea0d7eff538580ad7e22f5e 100644 (file)
@@ -149,17 +149,17 @@ spawnfunc(func_sparks)
 .int dphitcontentsmask;
 
 entityclass(PointParticles);
-class(PointParticles) .int cnt; // effect number
-class(PointParticles) .vector velocity; // particle velocity
-class(PointParticles) .float waterlevel; // direction jitter
-class(PointParticles) .int count; // count multiplier
-class(PointParticles) .int impulse; // density
-class(PointParticles) .string noise; // sound
-class(PointParticles) .float atten;
-class(PointParticles) .float volume;
-class(PointParticles) .int absolute; // 1 = count per second is absolute, ABSOLUTE_ONLY_SPAWN_AT_TOGGLE = only spawn at toggle
-class(PointParticles) .vector movedir; // trace direction
-class(PointParticles) .float glow_color; // palette index
+classfield(PointParticles) .int cnt; // effect number
+classfield(PointParticles) .vector velocity; // particle velocity
+classfield(PointParticles) .float waterlevel; // direction jitter
+classfield(PointParticles) .int count; // count multiplier
+classfield(PointParticles) .int impulse; // density
+classfield(PointParticles) .string noise; // sound
+classfield(PointParticles) .float atten;
+classfield(PointParticles) .float volume;
+classfield(PointParticles) .float absolute; // 1 = count per second is absolute, ABSOLUTE_ONLY_SPAWN_AT_TOGGLE = only spawn at toggle
+classfield(PointParticles) .vector movedir; // trace direction
+classfield(PointParticles) .float glow_color; // palette index
 
 const int ABSOLUTE_ONLY_SPAWN_AT_TOGGLE = 2;
 
@@ -235,15 +235,9 @@ void Draw_PointParticles(entity this)
 
 void Ent_PointParticles_Remove(entity this)
 {
-       if(this.noise)
-               strunzone(this.noise);
-       this.noise = string_null;
-       if(this.bgmscript)
-               strunzone(this.bgmscript);
-       this.bgmscript = string_null;
-       if(this.mdl)
-               strunzone(this.mdl);
-       this.mdl = string_null;
+    strfree(this.noise);
+    strfree(this.bgmscript);
+    strfree(this.mdl);
 }
 
 NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
@@ -305,17 +299,13 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
                        this.waterlevel = 0;
                        this.count = 1;
                }
-               if(this.noise)
-                       strunzone(this.noise);
-               if(this.bgmscript)
-                       strunzone(this.bgmscript);
-               this.noise = strzone(ReadString());
+               strcpy(this.noise, ReadString());
                if(this.noise != "")
                {
                        this.atten = ReadByte() / 64.0;
                        this.volume = ReadByte() / 255.0;
                }
-               this.bgmscript = strzone(ReadString());
+               strcpy(this.bgmscript, ReadString());
                if(this.bgmscript != "")
                {
                        this.bgmscriptattack = ReadByte() / 64.0;
index 6c9093318f6bf827abfe5caf01b254a2115ee50a..a0f67b759b9981c72d7e2e27a5394479c111a275 100644 (file)
@@ -39,23 +39,12 @@ spawnfunc(path_corner)
 
 void corner_remove(entity this)
 {
-       if(this.target) { strunzone(this.target); }
-       this.target = string_null;
-
-       if(this.target2) { strunzone(this.target2); }
-       this.target2 = string_null;
-
-       if(this.target3) { strunzone(this.target3); }
-       this.target3 = string_null;
-
-       if(this.target4) { strunzone(this.target4); }
-       this.target4 = string_null;
-
-       if(this.targetname) { strunzone(this.targetname); }
-       this.targetname = string_null;
-
-       if(this.platmovetype) { strunzone(this.platmovetype); }
-       this.platmovetype = string_null;
+       strfree(this.target);
+       strfree(this.target2);
+       strfree(this.target3);
+       strfree(this.target4);
+       strfree(this.targetname);
+       strfree(this.platmovetype);
 }
 
 NET_HANDLE(ENT_CLIENT_CORNER, bool isnew)
index 12b67c3715368b7df38a7897736f1cd3e52d944d..df88b750f245dbc7000deccd0a6785bf5ae1a300 100644 (file)
@@ -295,14 +295,14 @@ spawnfunc(misc_laser)
 // it has color 'beam_color'
 // and stops when something is in the way
 entityclass(Laser);
-class(Laser) .int cnt; // end effect
-class(Laser) .vector beam_color;
-class(Laser) .int active; // on-off
-class(Laser) .int count; // flags for the laser
-class(Laser) .vector velocity; // laser endpoint if it is FINITE
-class(Laser) .float alpha;
-class(Laser) .float scale; // scaling factor of the thickness
-class(Laser) .float modelscale; // scaling factor of the dlight
+classfield(Laser) .int cnt; // end effect
+classfield(Laser) .vector colormod;
+classfield(Laser) .int state; // on-off
+classfield(Laser) .int count; // flags for the laser
+classfield(Laser) .vector velocity; // laser endpoint if it is FINITE
+classfield(Laser) .float alpha;
+classfield(Laser) .float scale; // scaling factor of the thickness
+classfield(Laser) .float modelscale; // scaling factor of the dlight
 
 void Draw_Laser(entity this)
 {
index 012412678481c3d0fa16e1bcc8dce779ad74361b..126a20ea26ec08e254c1ee6e9d9473479b084dda 100644 (file)
@@ -57,13 +57,8 @@ spawnfunc(misc_teleporter_dest)
 
 void teleport_dest_remove(entity this)
 {
-       //if(this.classname)
-               //strunzone(this.classname);
-       //this.classname = string_null;
-
-       if(this.targetname)
-               strunzone(this.targetname);
-       this.targetname = string_null;
+    // strfree(this.classname);
+    strfree(this.targetname);
 }
 
 NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew)
index 24951b42b3b6a40427f2edb310a9976fbeb008fb..5a63872dbd6c46b6742b3534be7b4531c0d38ef2 100644 (file)
@@ -237,16 +237,13 @@ void Net_TargetMusic()
        }
        if(e.noise != noi)
        {
-               if(e.noise)
-                       strunzone(e.noise);
-               e.noise = strzone(noi);
+               strcpy(e.noise, noi);
                precache_sound(e.noise);
                _sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
                if(getsoundtime(e, CH_BGM_SINGLE) < 0)
                {
                        LOG_TRACEF("Cannot initialize sound %s", e.noise);
-                       strunzone(e.noise);
-                       e.noise = string_null;
+                       strfree(e.noise);
                }
        }
        e.volume = vol;
@@ -288,9 +285,7 @@ void Ent_TriggerMusic_Think(entity this)
 
 void Ent_TriggerMusic_Remove(entity this)
 {
-       if(this.noise)
-               strunzone(this.noise);
-       this.noise = string_null;
+    strfree(this.noise);
 }
 
 NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
@@ -318,9 +313,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
                this.fade_time = ReadByte() / 16.0;
                this.fade_rate = ReadByte() / 16.0;
                string s = this.noise;
-               if(this.noise)
-                       strunzone(this.noise);
-               this.noise = strzone(ReadString());
+               strcpy(this.noise, ReadString());
                if(this.noise != s)
                {
                        precache_sound(this.noise);
@@ -328,8 +321,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
                        if(getsoundtime(this, CH_BGM_SINGLE) < 0)
                        {
                                LOG_WARNF("Cannot initialize sound %s", this.noise);
-                               strunzone(this.noise);
-                               this.noise = string_null;
+                               strfree(this.noise);
                        }
                }
        }
index fd8855eafb99563751bc8d2ef7ba3e899427d288..ccf3f674e6f069394ec256b6a086df3eb1076aee 100644 (file)
@@ -12,8 +12,8 @@ entity music_trigger;
 // FIXME also control bgmvolume here, to not require a target_music for the default track.
 
 entityclass(TargetMusic);
-class(TargetMusic) .int state;
-class(TargetMusic) .float lastvol;
+classfield(TargetMusic) .int state;
+classfield(TargetMusic) .float lastvol;
 
 void TargetMusic_Advance();
 
index 198e3bf6ebc4c17426e6685e538f558adc08668b..f80d36097401e6314d916f9dc5ee3e08c92892b8 100644 (file)
@@ -619,13 +619,8 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
 
 void target_push_remove(entity this)
 {
-       //if(this.classname)
-               //strunzone(this.classname);
-       //this.classname = string_null;
-
-       if(this.targetname)
-               strunzone(this.targetname);
-       this.targetname = string_null;
+       // strfree(this.classname);
+       strfree(this.targetname);
 }
 
 NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
index bf20d1e9732e4dfe133ed4fc5473ae50b5021bd9..67db14421662c2d0c40483b328ee3dd30ee6babe 100644 (file)
@@ -164,23 +164,12 @@ spawnfunc(trigger_keylock)
 #elif defined(CSQC)
 void keylock_remove(entity this)
 {
-       if(this.target) { strunzone(this.target); }
-       this.target = string_null;
-
-       if(this.target2) { strunzone(this.target2); }
-       this.target2 = string_null;
-
-       if(this.target3) { strunzone(this.target3); }
-       this.target3 = string_null;
-
-       if(this.target4) { strunzone(this.target4); }
-       this.target4 = string_null;
-
-       if(this.killtarget) { strunzone(this.killtarget); }
-       this.killtarget = string_null;
-
-       if(this.targetname) { strunzone(this.targetname); }
-       this.targetname = string_null;
+       strfree(this.target);
+       strfree(this.target2);
+       strfree(this.target3);
+       strfree(this.target4);
+       strfree(this.killtarget);
+       strfree(this.targetname);
 }
 
 NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew)
index 144f6bfb0de01681ce70239f3645b3f0d237b488..9db38a10b9478a6f9b53272ed21d2dc6e7353dc4 100644 (file)
@@ -173,12 +173,12 @@ void trigger_common_read(entity this, bool withtarget)
 
        if(withtarget)
        {
-               if(this.target) { strunzone(this.target); }
-               if(this.target2) { strunzone(this.target2); }
-               if(this.target3) { strunzone(this.target3); }
-               if(this.target4) { strunzone(this.target4); }
-               if(this.targetname) { strunzone(this.targetname); }
-               if(this.killtarget) { strunzone(this.killtarget); }
+               strfree(this.target);
+               strfree(this.target2);
+               strfree(this.target3);
+               strfree(this.target4);
+               strfree(this.targetname);
+               strfree(this.killtarget);
 
                int targbits = ReadByte();
 
@@ -215,23 +215,12 @@ void trigger_common_read(entity this, bool withtarget)
 
 void trigger_remove_generic(entity this)
 {
-       if(this.target) { strunzone(this.target); }
-       this.target = string_null;
-
-       if(this.target2) { strunzone(this.target2); }
-       this.target2 = string_null;
-
-       if(this.target3) { strunzone(this.target3); }
-       this.target3 = string_null;
-
-       if(this.target4) { strunzone(this.target4); }
-       this.target4 = string_null;
-
-       if(this.targetname) { strunzone(this.targetname); }
-       this.target = string_null;
-
-       if(this.killtarget) { strunzone(this.killtarget); }
-       this.killtarget = string_null;
+       strfree(this.target);
+       strfree(this.target2);
+       strfree(this.target3);
+       strfree(this.target4);
+       strfree(this.targetname);
+       strfree(this.killtarget);
 }
 #endif
 
index 96fa81f8eee98cdbbf72ce9761e2f5eaf2c1c717..c4e50a7e71f058be20cd74201a619a5878e20777 100644 (file)
@@ -6,7 +6,7 @@ spawnfunc(turret_plasma) { if (!turret_initialize(this, TUR_PLASMA)) delete(this
 
 METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it))
 {
-    if(g_instagib)
+    if(autocvar_g_instagib)
     {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
         FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
index 2a6f997cf3f009f533858d9099c0fb3492e2b7c3..8d20da5b6eed40b3c9f66eddffbe3b0c780b228a 100644 (file)
@@ -6,7 +6,7 @@ spawnfunc(turret_plasma_dual) { if (!turret_initialize(this, TUR_PLASMA_DUAL)) d
 
 METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it))
 {
-    if (g_instagib) {
+    if (autocvar_g_instagib) {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
         FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
index 04436c47f8c728af20a160318ce5456999aa3b53..6fdfd32e70cd51c05a1fa6a8a067c7a9d60b8905 100644 (file)
@@ -3,6 +3,7 @@
 #include "plasma_weapon.qh"
 
 CLASS(PlasmaDualAttack, PlasmaAttack)
+/* flags     */ ATTRIB(PlasmaDualAttack, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
 /* refname   */ ATTRIB(PlasmaDualAttack, netname, string, "turret_plasma_dual");
 /* wepname   */ ATTRIB(PlasmaDualAttack, m_name, string, _("Dual plasma"));
 ENDCLASS(PlasmaDualAttack)
index deba86c289dc8f4966407fa6dd6f7c4f9e308ed8..35ec9b2c58f96de0ac3aba803b52641394ada62c 100644 (file)
@@ -453,14 +453,12 @@ void get_mi_min_max(float mode)
 {
        vector mi, ma;
 
-       if(mi_shortname)
-               strunzone(mi_shortname);
-       mi_shortname = mapname;
-       if(!strcasecmp(substring(mi_shortname, 0, 5), "maps/"))
-               mi_shortname = substring(mi_shortname, 5, strlen(mi_shortname) - 5);
-       if(!strcasecmp(substring(mi_shortname, strlen(mi_shortname) - 4, 4), ".bsp"))
-               mi_shortname = substring(mi_shortname, 0, strlen(mi_shortname) - 4);
-       mi_shortname = strzone(mi_shortname);
+       string s = mapname;
+       if(!strcasecmp(substring(s, 0, 5), "maps/"))
+               s = substring(s, 5, strlen(s) - 5);
+       if(!strcasecmp(substring(s, strlen(s) - 4, 4), ".bsp"))
+               s = substring(s, 0, strlen(s) - 4);
+       strcpy(mi_shortname, s);
 
 #ifdef CSQC
        mi = world.mins;
@@ -1397,8 +1395,7 @@ void execute_next_frame()
        if(to_execute_next_frame)
        {
                localcmd("\n", to_execute_next_frame, "\n");
-               strunzone(to_execute_next_frame);
-               to_execute_next_frame = string_null;
+               strfree(to_execute_next_frame);
        }
 }
 void queue_to_execute_next_frame(string s)
@@ -1406,9 +1403,8 @@ void queue_to_execute_next_frame(string s)
        if(to_execute_next_frame)
        {
                s = strcat(s, "\n", to_execute_next_frame);
-               strunzone(to_execute_next_frame);
        }
-       to_execute_next_frame = strzone(s);
+       strcpy(to_execute_next_frame, s);
 }
 
 .float FindConnectedComponent_processing;
index e4e5ba991bec4fafa3dfc4bfbe278d69f4e2214c..f2dab7bfd22cd7c8620f3b69e7c10d9f37ece242 100644 (file)
@@ -199,4 +199,10 @@ void viewloc_SetViewLocation()
        }
 }
 
+STATIC_INIT_LATE(viewloc_cursor)
+{
+       // fix the mouse position on init so it isn't in the corner
+       viewloc_mousepos = '0.5 0 0' * autocvar_vid_conwidth + '0 0.5 0' * autocvar_vid_conheight;
+}
+
 #endif
index 2710768668bdf525eab03fede68542cb530b061f..5a41666bdb74ba1a58b4a09eae9adf341e2a7d8a 100644 (file)
@@ -247,7 +247,7 @@ void W_Crylink_Touch(entity this, entity toucher)
        if(a)
                f *= a;
 
-       float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), 
+       float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius),
                                                                                NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, this.weaponentity_fld, toucher);
 
        if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius)))))
index 49ad1c7394cc7e99d7b70cfc6b47e2b8c3477382..8f501653869caad8908a2723ad435dbfd70ff243 100644 (file)
@@ -12,7 +12,7 @@ void W_HLAC_Touch(entity this, entity toucher)
 
        isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY);
 
-       RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), 
+       RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius),
                                                NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, this.weaponentity_fld, toucher);
 
        delete(this);
index 8d569d04e253f798debe0b17747233432166bf92..985d2ae59ef3faabdd7fce020d09d0310ddfb3a0 100644 (file)
@@ -261,11 +261,11 @@ float autocvar_cl_grapplehook_alpha = 1;
 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg);
 
 entityclass(Hook);
-class(Hook) .entity HookType; // ENT_CLIENT_*
-class(Hook) .vector origin;
-class(Hook) .vector velocity;
-class(Hook) .float HookSilent;
-class(Hook) .float HookRange;
+classfield(Hook) .entity HookType; // ENT_CLIENT_*
+classfield(Hook) .vector origin;
+classfield(Hook) .vector velocity;
+classfield(Hook) .float HookSilent;
+classfield(Hook) .float HookRange;
 
 string Draw_GrapplingHook_trace_callback_tex;
 float Draw_GrapplingHook_trace_callback_rnd;
@@ -281,7 +281,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
        Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
 }
 
-class(Hook) .float teleport_time;
+classfield(Hook) .float teleport_time;
 void Draw_GrapplingHook(entity this)
 {
        vector a, b, atrans;
index 25bad729fded903ae27d5b5ee86bd2faaaa997e5..d8075c9fe4d167cf127b4411252bb7cdd75f58db 100644 (file)
@@ -96,7 +96,7 @@ void W_MineLayer_DoRemoteExplode(entity this)
        if(this.move_movetype == MOVETYPE_NONE || this.move_movetype == MOVETYPE_FOLLOW)
                this.velocity = this.mine_orientation; // particle fx and decals need .velocity
 
-       RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), 
+       RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius),
                                                NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL);
 
        .entity weaponentity = this.weaponentity_fld;
index ffa1dd6e2dd5589e5623611655bce63a87bf4042..d932d98bd16f6d7554c32fb7f447ca9419be3c15 100644 (file)
@@ -45,9 +45,9 @@ SPAWNFUNC_WEAPON(weapon_tuba, WEP_TUBA)
 
 #ifdef CSQC
 entityclass(Tuba);
-class(Tuba) .int note;
-class(Tuba) .bool tuba_attenuate;
-class(Tuba) .float tuba_volume;
-class(Tuba) .float tuba_volume_initial;
-class(Tuba) .int tuba_instrument;
+classfield(Tuba) .int note;
+classfield(Tuba) .bool tuba_attenuate;
+classfield(Tuba) .float tuba_volume;
+classfield(Tuba) .float tuba_volume_initial;
+classfield(Tuba) .int tuba_instrument;
 #endif
index 06562f68a8c5c5e071096d8490347449458ba47b..c3baa12127b6c3b39a947aa8fec40524362a1443 100644 (file)
@@ -125,7 +125,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        yoda = 0;
        damage_goodhits = 0;
-       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
+       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, WEP_CVAR_PRI(vaporizer, force), 0, 0, 0, 0, WEP_VAPORIZER.m_id);
 
        // do this now, as goodhits is disabled below
        SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
@@ -144,7 +144,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
                W_RocketMinsta_Explosion(actor, weaponentity, trace_endpos);
 
-       W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity);
+       W_DecreaseAmmo(thiswep, actor, ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity);
 }
 
 void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity)
@@ -288,7 +288,7 @@ METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor, .entity weaponentit
 }
 METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
-    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
     // if the laser uses load, we also consider its ammo for reloading
     if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
@@ -349,7 +349,7 @@ METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor, .entity weaponent
 }
 METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
     float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= vaporizer_ammo;
     ammo_amount += actor.(weaponentity).(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
     return ammo_amount;
@@ -368,7 +368,7 @@ METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
 }
 METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
     float used_ammo;
     if(WEP_CVAR_SEC(vaporizer, ammo))
         used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
index ea9f8dd2ba60db6a8452b088e424e5ed0d976046..9bbc5e9bdded6c4098a31020e9da6139b1795b07 100644 (file)
@@ -22,7 +22,8 @@ CLASS(Vaporizer, Weapon)
        BEGIN(class) \
                P(class, prefix, ammo, float, PRI) \
        P(class, prefix, animtime, float, PRI) \
-       P(class, prefix, damage, float, PRI) \
+        P(class, prefix, damage, float, PRI) \
+       P(class, prefix, force, float, PRI) \
        P(class, prefix, refire, float, PRI) \
        P(class, prefix, ammo, float, SEC) \
        P(class, prefix, animtime, float, SEC) \
index 5ae47c394da75d90665680af45cb8fccbfa9f71a..c3594c0136cfff9cfca75c0573cbfd1349ed2d8e 100644 (file)
@@ -4,6 +4,7 @@ void sys_phys_fix(entity this, float dt)
 {
        WarpZone_PlayerPhysics_FixVAngle(this);
        Physics_UpdateStats(this);
+       PM_ClientMovement_UpdateStatus(this);
 }
 
 bool sys_phys_override(entity this, float dt)
index d44c5e89cdda2acacbd1b615bfbc55dc8bb93b9f..d45dc208e0149d24c195bc5bc71bcf5271bad793 100644 (file)
        #define bool float
 #endif
 
+#ifndef QCC_SUPPORT_ACCUMULATE
+       #warning "QCC does not support accumulate, may not compile correctly"
+       #define ACCUMULATE
+#else
+       #define ACCUMULATE [[accumulate]]
+#endif
+
 #ifndef QCC_SUPPORT_ERASEABLE
        #define ERASEABLE
 #else
        #define ERASEABLE [[eraseable]]
 #endif
 
+#ifndef QCC_SUPPORT_ALIAS
+    #warning "QCC does not support alias, may not compile correctly"
+    #define ALIAS(var)
+#else
+    #define ALIAS(var) [[alias(var)]]
+#endif
+
 #include <dpdefs/pre.qh>
 
 #if defined(CSQC)
 
 #include <dpdefs/post.qh>
 
+#ifndef QCC_SUPPORT_POW
+    #define pow(a, b) pow(a, b)
+#else
+    #define pow(a, b) (a ** b)
+#endif
+
 #include "self.qh"
 
 #define USING(name, T) typedef T name
index c265325f8f6c75d20de492fcf1c81211195e5849..2d1e40212fba3c9cd2d9f28216a5a3c2071c3d7e 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifdef QCC_SUPPORT_ACCUMULATE
        #define ACCUMULATE_FUNCTION(func, otherfunc) \
-               [[accumulate]] void func() \
+               ACCUMULATE void func() \
                { \
                        otherfunc(); \
                }
index 5f9297f2dab1f5be24887ff2fead30390ee59fd6..6f7a7326de41f5cce1953dc26a5ac27aa933296d 100644 (file)
@@ -25,13 +25,13 @@ vector colormapPaletteColor_(int c, bool isPants, float t)
                case 14: return '1.000000 0.666667 0.000000';
                case 15:
                        if (isPants)
-                               return '1 0 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 0.0000000000))
-                                      + '0 1 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 2.0943951024))
-                                      + '0 0 1' * (0.502 + 0.498 * sin(t / 2.7182818285 + 4.1887902048));
+                               return '1 0 0' * (0.502 + 0.498 * sin(t / M_E + 0))
+                                       + '0 1 0' * (0.502 + 0.498 * sin(t / M_E + M_PI * 2 / 3))
+                                       + '0 0 1' * (0.502 + 0.498 * sin(t / M_E + M_PI * 4 / 3));
                        else
-                               return '1 0 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 5.2359877560))
-                                      + '0 1 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 3.1415926536))
-                                      + '0 0 1' * (0.502 + 0.498 * sin(t / 3.1415926536 + 1.0471975512));
+                               return '1 0 0' * (0.502 + 0.498 * sin(t / M_PI + M_PI * 5 / 3))
+                                       + '0 1 0' * (0.502 + 0.498 * sin(t / M_PI + M_PI))
+                                       + '0 0 1' * (0.502 + 0.498 * sin(t / M_PI + M_PI * 1 / 3));
                default: return '0.000 0.000 0.000';
        }
 }
index d1bdc4fe5b55e609bc4d02b32dc0f55b0761f21a..5ca0ed56525ee33886c46a0a7c27ecfd7763068b 100644 (file)
        #endif
 #endif
 
+#ifndef QCC_SUPPORT_ALIAS
+       #ifdef GMQCC
+               #define QCC_SUPPORT_ALIAS
+       #endif
+#endif
+
+#ifndef QCC_SUPPORT_POW
+    #ifdef GMQCC
+        #define QCC_SUPPORT_POW
+    #endif
+#endif
+
 #ifdef GMQCC
     #define LABEL(id) :id
 #else
index a17f2bad72397d55a470fc32bb64851cfcbe5152..e8e2c54880a1a29eed6c48d50a6ac0cd44c016ff 100644 (file)
@@ -87,7 +87,7 @@ const noref vector default_vector = '0 0 0';
 //  e.g.: AUTOCVAR(mycvar, float, 2.5, "cvar description")
 
 #define __AUTOCVAR(file, archive, var, type, desc, default) \
-       [[accumulate]] void RegisterCvars(void(string, string, string, bool, string) f) \
+       ACCUMULATE void RegisterCvars(void(string, string, string, bool, string) f) \
        { \
                f( #var, repr_cvar_##type(default), desc, archive, file); \
        } \
index 4f34bb4853ade7f0149274ebdb3c325d4468147a..5d6473080a60d9b470856efb27fc1344056764c3 100644 (file)
@@ -6,8 +6,8 @@
        #include "self.qh"
 
        entityclass(Defer);
-       class(Defer).entity owner;
-       class(Defer).void(entity) defer_func;
+       classfield(Defer).entity owner;
+       classfield(Defer).void(entity) defer_func;
 
        /** Remove entity */
        void SUB_Remove(entity this)
index f20b1c66e5bf120be7748737dabe8b9e8dec9f88..d8f19906a3eb26b1d9003e74f4493450f4b018d8 100644 (file)
@@ -324,9 +324,9 @@ vector solve_quadratic(float a, float b, float c)
 }
 
 /// Maps values between the src and dest range: src_min to dest_min, src_max to dest_max, values between them
-/// to the curresponding values between and extrapolates for values outside the range.
+/// to the corresponding values between and extrapolates for values outside the range.
 ///
-/// src_min and src_max must not be the same or division by zero accurs.
+/// src_min and src_max must not be the same or division by zero occurs.
 ///
 /// dest_max can be smaller than dest_min if you want the resulting range to be inverted, all values can be negative.
 ERASEABLE
index 449aa373b31885d5aa3a5958d7855c94c4fd3d6c..1b58eb1b9fcf75d0ddd7196843a6cb5be402d695 100644 (file)
@@ -5,12 +5,10 @@
 GENERIC_COMMAND(mx, "Send a matrix command") {
     switch (argv(1)) {
         case "user":
-            if (matrix_user) strunzone(matrix_user);
-            matrix_user = strzone(substring(command, argv_start_index(2), -1));
+            strcpy(matrix_user, substring(command, argv_start_index(2), -1));
             break;
         case "token":
-            if (matrix_access_token) strunzone(matrix_access_token);
-            matrix_access_token = strzone(substring(command, argv_start_index(2), -1));
+            strcpy(matrix_access_token, substring(command, argv_start_index(2), -1));
             break;
         case "messages":
             MX_Messages(string_null);
index c399c2aa6cf86e2d9a9ba910667c8cd1c926ba43..57754d04e4334d05da4a3701217d7bf6e17d7cb4 100644 (file)
@@ -204,7 +204,8 @@ void MX_Say_(entity fh, entity pass, int status)
             fh.url_verb = "PUT";
             fh.url_content_type = "application/json";
             url_fputs(fh, sprintf("{\"msgtype\": \"m.text\", \"body\": \"%s\"}", pass.message));
-            strunzone(pass.message); delete(pass);
+            strfree(pass.message);
+            delete(pass);
             url_fclose(fh);
             break;
         }
index 6c29a4b88dd100f74ded51a0fe91ad82179c7d25..cbb1079244d2ef5a6806f94387a8826380dc9589 100644 (file)
 
        #include "p99.qh"
        #define OVERLOAD(F, ...) P99_IF_EMPTY(__VA_ARGS__)(P99_PASTE2(F, _00)())(P99_PASTE3(F, _, P00_NARG(__VA_ARGS__))(__VA_ARGS__))
-       /** for use within a macro */
+       /** for use within macros */
        #define OVERLOAD_(F, ...) P99_IF_EMPTY(__VA_ARGS__)(P99_PASTE2(F, _00)())(P99_PASTE3(F, _, P00_NARG(__VA_ARGS__))(__VA_ARGS__))
+       #define OVERLOAD__(F, ...) P99_IF_EMPTY(__VA_ARGS__)(P99_PASTE2(F, _00)())(P99_PASTE3(F, _, P00_NARG(__VA_ARGS__))(__VA_ARGS__))
 #else
        #define EVAL(...) __VA_ARGS__
 
-       #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
        #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+       #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+       #define OVERLOAD__(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
 #endif
 
 #if defined(CSQC)
index a9c28dab3ecbc0b44b9a868a0ebab34bcf1a6410..7b3f581b38f059cd4e4252905ae0dcf243983209 100644 (file)
@@ -50,7 +50,7 @@ STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id
 
 #ifdef CSQC
        #define REGISTER_NET_LINKED(id) \
-               [[accumulate]] NET_HANDLE(id, bool isnew) \
+               ACCUMULATE NET_HANDLE(id, bool isnew) \
                { \
                        this = __self; \
                        this.sourceLoc = __FILE__ ":" STR(__LINE__); \
@@ -201,8 +201,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
        {
                if (g_buf == "") return;
                localcmd("\ncmd c2s \"", strreplace("$", "$$", g_buf), "\"\n");
-               strunzone(g_buf);
-               g_buf = string_null;
+               strfree(g_buf);
        }
 #endif
 
@@ -300,8 +299,7 @@ MACRO_END
                string s = string_null;
                yenc_single(b, s);
                string tmp = strcat(g_buf, s);
-               if (g_buf) strunzone(g_buf);
-               g_buf = strzone(tmp);
+               strcpy(g_buf, tmp);
        }
        void WriteShort(int to, int b)
        {
index 782798c9fe5c492799d0892f4f1f5cc3f155731d..5ef9cf8b6b17708b6bed1bb664b593d049496e53 100644 (file)
@@ -2,11 +2,11 @@
 
 // noises "usually" start in the range -1..1
 entityclass(Noise);
-class(Noise).float noise_baccum;
-class(Noise).float noise_paccum;
-class(Noise).float noise_paccum2;
-class(Noise).float noise_paccum3;
-class(Noise).float noise_bstate;
+classfield(Noise).float noise_baccum;
+classfield(Noise).float noise_paccum;
+classfield(Noise).float noise_paccum2;
+classfield(Noise).float noise_paccum3;
+classfield(Noise).float noise_bstate;
 
 ERASEABLE
 float Noise_Brown(entity e, float dt)
index f57bf8e909c4e7d1a594a0e36f2415b715483fda..b22ff791501c9a990c93e5d9c7f3dabc2c35f661 100644 (file)
@@ -5,19 +5,16 @@
 #include "static.qh"
 
 .vector origin;
+
 .bool pure_data;
-/** @deprecated use new_pure or NEW(class) */
-#define make_pure(e) \
-       MACRO_BEGIN \
-       { \
-               (e).pure_data = true; \
-       } MACRO_END
-#define make_impure(e) \
-       MACRO_BEGIN \
-       { \
-               (e).pure_data = false; \
-       } MACRO_END
 #define is_pure(e) ((e).pure_data)
+/** @deprecated use new_pure or NEW(class) */
+#define make_pure(e) MACRO_BEGIN \
+       (e).pure_data = true; \
+MACRO_END
+#define make_impure(e) MACRO_BEGIN \
+       (e).pure_data = false; \
+MACRO_END
 
 .string classname;
 /** Location entity was spawned from in source */
@@ -58,11 +55,11 @@ entity __spawn(string _classname, string _sourceLoc, bool pure)
 #define entityclass_1(name) entityclass_2(name, Object)
 #ifndef QCC_SUPPORT_ENTITYCLASS
        #define entityclass_2(name, base) USING(name, entity)
-       #define class(name)
+       #define classfield(name)
        #define _new(class, pure) __spawn( #class, __FILE__ ":" STR(__LINE__), pure)
 #else
        #define entityclass_2(name, base) entityclass name : base {}
-       #define class(name) [[class(name)]]
+       #define classfield(name) [[class(name)]]
        #define _new(class, pure) ((class) __spawn( #class, __FILE__ ":" STR(__LINE__), pure))
 #endif
 /** entities you care about seeing (.origin works) */
@@ -71,12 +68,13 @@ entity __spawn(string _classname, string _sourceLoc, bool pure)
 #define new_pure(class) _new(class, true)
 #define spawn() __spawn("entity", __FILE__ ":" STR(__LINE__), false)
 
-[[accumulate]] void ONREMOVE(entity this) {}
+ACCUMULATE void ONREMOVE(entity this) {}
 
 #ifndef SVQC
        #define delete_fn builtin_remove
 #endif
 
+.void(entity this) dtor;
 #define delete(this) MACRO_BEGIN { \
     entity _this = (this); \
     void(entity) _dtor = _this.dtor; \
@@ -104,7 +102,7 @@ void clearentity(entity e)
 }
 
 // Classes have a `spawn##cname(entity)` constructor
-// The parameter is used across [[accumulate]] functions
+// The parameter is used across ACCUMULATE functions
 
 .bool transmute;
 
@@ -138,12 +136,149 @@ void clearentity(entity e)
     } \
     MACRO_END
 
-#define CONSTRUCTOR(cname, ...) \
-       cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \
-       { \
-               return = this; \
-       } \
-       [[accumulate]] cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)
+#define CLASS(...) EVAL_CLASS(OVERLOAD__(CLASS, __VA_ARGS__))
+#define EVAL_CLASS(...) __VA_ARGS__
+
+#define ATTRIB(...) EVAL_ATTRIB(OVERLOAD_(ATTRIB, __VA_ARGS__))
+#define EVAL_ATTRIB(...) __VA_ARGS__
+
+#ifdef QCC_SUPPORT_CLASS
+
+#warning "QCC_SUPPORT_CLASS not implemented"
+
+#define CLASS_1(name)                               CLASS_2(name, entity)
+#define CLASS_2(name, base)                         class name : base {
+
+#define INIT(class)                                     void class::class()
+#define CONSTRUCTOR(class, ...)                         void class::class(__VA_ARGS__)
+#define DESTRUCTOR(class)                               class::~class()
+
+#define SUPER(class)                                    super
+
+#define ATTRIB_3(class, name, T)                        T name
+#define ATTRIB_4(class, name, T, val)                   ATTRIB_3(class, name, T) = val
+#define STATIC_ATTRIB(class, name, T, val)              static T name = val
+
+#define ATTRIB_STRZONE(class, name, T, val)             T name = val
+#define STATIC_ATTRIB_STRZONE(class, name, T, val)      static T name = val
+
+#define ATTRIBARRAY(class, name, T, val)                T name[val]
+
+#define METHOD(class, name, prototype)                  virtual void class::name()
+#define STATIC_METHOD(class, name, prototype)           static void class::name()
+
+#define ENDCLASS(class)                             };
+
+#else
+
+#define CLASS_1(cname) CLASS_2(cname, )
+#define CLASS_2(cname, base)                                                                       \
+       entityclass(cname, base);                                                                      \
+       classfield(cname).bool instanceOf##cname;                                                      \
+       DEBUG_STUFF(cname)                                                                             \
+       VTBL(cname, base)                                                                              \
+       _INIT_STATIC(cname)                                                                            \
+       {                                                                                              \
+               if (cname##_vtbl && !this.transmute)                                                       \
+               {                                                                                          \
+                       copyentity(cname##_vtbl, this);                                                        \
+                       return;                                                                                \
+               }                                                                                          \
+               spawn##base##_static(this);                                                                \
+               this.instanceOf##cname = true;                                                             \
+       }                                                                                              \
+       INIT(cname)                                                                                    \
+       {                                                                                              \
+               /* Only statically initialize the current class, it contains everything it inherits */     \
+               if (cname##_vtbl.vtblname == this.classname)                                               \
+               {                                                                                          \
+                       spawn##cname##_static(this);                                                           \
+                       this.transmute = false;                                                                \
+                       this.classname = #cname;                                                               \
+                       this.vtblname = string_null;                                                           \
+                       this.vtblbase = cname##_vtbl;                                                          \
+               }                                                                                          \
+               spawn##base##_1(this);                                                                     \
+       }
+
+#define INIT(cname)                                                                                \
+       ACCUMULATE cname spawn##cname##_1(cname this)
+
+#define CONSTRUCTOR(cname, ...)                                                                    \
+       cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)                                          \
+       {                                                                                              \
+               return = this;                                                                             \
+       }                                                                                              \
+       ACCUMULATE cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)
+
+#define DESTRUCTOR(cname)                                                                          \
+       STATIC_METHOD(cname, dtorimpl, void(cname this));                                              \
+    METHOD(cname, dtor, void(cname this))                                                          \
+    {                                                                                              \
+        METHOD_REFERENCE(cname, dtorimpl)(this);                                                   \
+        this.instanceOf##cname = false;                                                            \
+        entity super = SUPER(cname);                                                               \
+        if (super != cname##_vtbl) super.dtor(this);                                               \
+    }                                                                                              \
+       STATIC_METHOD(cname, dtorimpl, void(cname this))
+
+#define SUPER(cname) (cname##_vtbl.vtblbase)
+
+#define ATTRIB_3(cname, name, type) classfield(cname) .type name
+#define ATTRIB_4(cname, name, type, val)                                                           \
+       ATTRIB_3(cname, name, type);                                                                   \
+       INIT(cname)                                                                                    \
+       {                                                                                              \
+               noref bool strzone; /* Error on strzone() calls. */                                        \
+               this.name = val;                                                                           \
+       }                                                                                              \
+       ATTRIB_3(cname, name, type)
+
+#define STATIC_ATTRIB(cname, name, type, val)                                                      \
+       type cname##_##name;                                                                           \
+       _INIT_STATIC(cname)                                                                            \
+       {                                                                                              \
+               noref bool strzone; /* Error on strzone() calls. */                                        \
+               cname##_##name = val;                                                                      \
+       }
+
+// cleanup potentially zoned strings from base classes
+#define ATTRIB_STRZONE(cname, name, type, val)                                                     \
+       classfield(cname).type name;                                                                   \
+       INIT(cname)                                                                                    \
+       {                                                                                              \
+               strcpy(this.name, val);                                                                    \
+       }
+
+#define STATIC_ATTRIB_STRZONE(cname, name, type, val)                                              \
+       type cname##_##name;                                                                           \
+       _INIT_STATIC(cname)                                                                            \
+       {                                                                                              \
+               strcpy(cname##_##name, val);                                                               \
+       }
+
+#define ATTRIBARRAY(cname, name, type, cnt)                                                        \
+       classfield(cname) .type name[cnt]
+
+#define METHOD(cname, name, prototype)                                                             \
+       STATIC_METHOD(cname, name, prototype);                                                         \
+       classfield(cname) .prototype name;                                                             \
+       _INIT_STATIC(cname)                                                                            \
+       {                                                                                              \
+               this.name = METHOD_REFERENCE(cname, name);                                                 \
+       }                                                                                              \
+       STATIC_METHOD(cname, name, prototype)
+
+#define STATIC_METHOD(cname, name, prototype)                                                      \
+       prototype METHOD_REFERENCE(cname, name)
+
+#define ENDCLASS(cname)                                                                            \
+       INIT(cname)                                                                                    \
+       {                                                                                              \
+               return this;                                                                               \
+       }
+
+// impl
 
 .string vtblname;
 .entity vtblbase;
@@ -168,128 +303,25 @@ STATIC_INIT(RegisterClasses)
        } \
        ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
 
-#define _INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
-#define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this)
+#define _INIT_STATIC(cname) ACCUMULATE void spawn##cname##_static(cname this)
 
 #if NDEBUG
        #define DEBUG_STUFF(cname)
 #else
        #define DEBUG_STUFF(cname) \
-               bool is_##cname(entity e) { return e.instanceOf##cname; } \
-               void isnt_##cname(entity e) { eprint(e); }
+               ERASEABLE bool is_##cname(entity e) { return e.instanceOf##cname; } \
+               ERASEABLE void isnt_##cname(entity e) { eprint(e); }
 #endif
 
-
-#define CLASS(cname, base)                  \
-       entityclass(cname, base);               \
-       class(cname).bool instanceOf##cname;    \
-       DEBUG_STUFF(cname)                      \
-       VTBL(cname, base)                       \
-       _INIT_STATIC(cname)                     \
-       {                                       \
-               if (cname##_vtbl && !this.transmute)\
-               {                                   \
-                       copyentity(cname##_vtbl, this); \
-                       return;                         \
-               }                                   \
-               spawn##base##_static(this);         \
-               this.instanceOf##cname = true;      \
-       }                                       \
-       INIT(cname)                             \
-       {                                       \
-               /* Only statically initialize the current class, it contains everything it inherits */ \
-               if (cname##_vtbl.vtblname == this.classname) \
-               {                                   \
-                       spawn##cname##_static(this);    \
-                       this.transmute = false;         \
-                       this.classname = #cname;        \
-                       this.vtblname = string_null;    \
-                       this.vtblbase = cname##_vtbl;   \
-               }                                   \
-               spawn##base##_1(this);              \
-       }
-
 #define METHOD_REFERENCE(cname, name) \
        cname##_##name
 
-#define STATIC_METHOD(cname, name, prototype) \
-       prototype METHOD_REFERENCE(cname, name)
-
-#define METHOD(cname, name, prototype) \
-       STATIC_METHOD(cname, name, prototype); \
-       class(cname) .prototype name; \
-       _INIT_STATIC(cname) \
-       { \
-               this.name = METHOD_REFERENCE(cname, name); \
-       } \
-       STATIC_METHOD(cname, name, prototype)
-
-#define DESTRUCTOR(cname) \
-       STATIC_METHOD(cname, dtorimpl, void(cname this)); \
-    METHOD(cname, dtor, void(cname this)) \
-    { \
-        METHOD_REFERENCE(cname, dtorimpl)(this); \
-        this.instanceOf##cname = false; \
-        entity super = SUPER(cname); \
-        if (super != cname##_vtbl) super.dtor(this); \
-    } \
-       STATIC_METHOD(cname, dtorimpl, void(cname this))
-
-#define ATTRIB(...) EVAL_ATTRIB(OVERLOAD_(ATTRIB, __VA_ARGS__))
-#define EVAL_ATTRIB(...) __VA_ARGS__
-#define ATTRIB_3(cname, name, type) INIT(cname) {} class(cname) .type name
-#define ATTRIB_4(cname, name, type, val) \
-       ATTRIB_3(cname, name, type); \
-       INIT(cname) \
-       { \
-               noref bool strzone; /* Error on strzone() calls. */ \
-               this.name = val; \
-       } \
-       ATTRIB_3(cname, name, type)
-
-#define STATIC_ATTRIB(cname, name, type, val) \
-       type cname##_##name; \
-       _INIT_STATIC(cname) \
-       { \
-               noref bool strzone; /* Error on strzone() calls. */ \
-               cname##_##name = val; \
-       }
-
-// cleanup potentially zoned strings from base classes
-
-#define ATTRIB_STRZONE(cname, name, type, val)      \
-       class(cname).type name;                \
-       INIT(cname) \
-       { \
-               if (this.name) \
-                       strunzone(this.name); \
-               this.name = strzone(val); \
-       }
-
-#define STATIC_ATTRIB_STRZONE(cname, name, type, val) \
-       type cname##_##name; \
-       _INIT_STATIC(cname) \
-       { \
-        if (cname##_##name) \
-            strunzone(cname##_##name); \
-               cname##_##name = val; \
-       }
-
-#define ATTRIBARRAY(cname, name, type, cnt) \
-       class(cname) .type name[cnt]
-
-#define ENDCLASS(cname) \
-       INIT(cname) \
-       { \
-               return this; \
-       }
-
-#define SUPER(cname) (cname##_vtbl.vtblbase)
+#endif
 
 #define spawn_static(this)
 #define spawn_1(this)
 #define _vtbl NULL
-CLASS(Object, );
+CLASS(Object)
     DESTRUCTOR(Object) { builtin_remove(this); }
     #define remove(this) delete(this)
        METHOD(Object, describe, string(Object this))
index 2d41e5d431b3ba9c7b63ccbb87268a4b96615267..d8f18a02c96e4ab98b749530dd5f1f58550609b5 100644 (file)
@@ -22,9 +22,9 @@
  */
 #define REGISTRY(id, max) \
        void Register##id(); \
-       [[accumulate]] void REGISTRY_DEPENDS_(id) {} \
-       [[accumulate]] REGISTRY_BEGIN(id) {} \
-       [[accumulate]] REGISTRY_END(id) {} \
+       ACCUMULATE void REGISTRY_DEPENDS_(id) {} \
+       REGISTRY_BEGIN(id) {} \
+       REGISTRY_END(id) {} \
        void _Register##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); } \
 #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) ACCUMULATE void REGISTRY_BEGIN_(id) { noref void() f = Register##id; } void REGISTRY_BEGIN_(id)
 #define REGISTRY_BEGIN_(id) Register##id##_First()
 
 /** Called after initializing a registry. */
-#define REGISTRY_END(id) [[accumulate]] void REGISTRY_END_(id) { noref void() f = Register##id; } void REGISTRY_END_(id)
+#define REGISTRY_END(id) ACCUMULATE void REGISTRY_END_(id) { noref void() f = Register##id; } void REGISTRY_END_(id)
 #define REGISTRY_END_(id) Register##id##_Done()
 
 REGISTRY(Registries, BITS(8))
@@ -104,7 +104,7 @@ REGISTRY(Registries, BITS(8))
        REGISTRY_PUSH(registry, fld, e); \
 } MACRO_END
 
-#define REGISTER_INIT(id) [[accumulate]] void Register_##id##_init(entity this)
+#define REGISTER_INIT(id) ACCUMULATE void Register_##id##_init(entity this)
 
 /** internal next pointer */
 #define REGISTRY_NEXT enemy
@@ -147,9 +147,9 @@ REGISTRY(Registries, BITS(8))
 #define REGISTRY_HASH(id) Registry_hash_##id
 
 ERASEABLE
-[[accumulate]] void Registry_check(string r, string server) { }
+ACCUMULATE void Registry_check(string r, string server) { }
 ERASEABLE
-[[accumulate]] void Registry_send_all() { }
+ACCUMULATE void Registry_send_all() { }
 
 #ifdef SVQC
 void Registry_send(string id, string hash);
index c7a42042deac253dc3172aeaf929a80ba2958b18..656989782672e60c948199c0b8deb94f2f10b0a6 100644 (file)
        #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__))
        #define EVAL_REPLICATE(...) __VA_ARGS__
 
-       [[accumulate]] void ReplicateVars(entity this, entity store, 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)
        #define REPLICATE_string(fld, var, func) \
                REPLICATE_7(fld, string, var, , \
-       { if (field) strunzone(field); field = strzone(it); }, \
-       { if (field) strunzone(field); field = string_null; }, \
+       { strcpy(field, it); }, \
+       { strfree(field); }, \
        { \
                /* also initialize to the default value of func when requesting cvars */ \
                string s = func(field); \
                if (s != field) \
                { \
-                   strunzone(field); \
-                   field = strzone(s); \
+                   strcpy(field, s); \
                } \
        })
        #define REPLICATE_float(fld, var, func) REPLICATE_7(fld, float, var, func,  { field = stof(it); },          , )
index 0a61cc003dfdc9046acf24dc7b33b057115732e8..4299c19cd3674a286d3b5eea310a0754f3db0ad1 100644 (file)
@@ -12,7 +12,7 @@
 // Step 2: const self
 #if 1
     #define self (RVALUE, self)
-    [[alias("self")]] entity __self;
+    ALIAS("self") entity __self;
     #define setself(s) (__self = s)
     #define WITHSELF(value, block) WITH(entity, __self, value, (RVALUE, block))
 #endif
index af4b47ab8058ad35a8f8b6405538cc3f4ed32a31..8c362d4305cd98721075bfe84aa8a7a1ab0c4910 100644 (file)
@@ -2,7 +2,7 @@
 
 entityclass(Sort);
 // .float(entity,entity) sort_cmp;
-class(Sort).entity chain, sort_next, sort_prev;
+classfield(Sort).entity chain, sort_next, sort_prev;
 
 entity Sort_Spawn();
 
index 119d095e24432b54e153523378fae266eec6e2d8..d3198b3ce4c7666bf986564916b9d9678b3dc097 100644 (file)
@@ -19,13 +19,13 @@ noref bool require_spawnfunc_prefix;
        }
 
        #define _spawnfunc_checktypes(fld) \
-               if (fieldname == #fld) \
-                       if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted", fieldname);
+               if (s == #fld) \
+                       if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted", s);
 #else
        #define _spawnfunc_checktypes(fld)
 #endif
        #define _spawnfunc_check(fld) \
-               if (fieldname == #fld) continue;
+               if (s == #fld) continue;
 
        noref int __spawnfunc_expecting;
        noref entity __spawnfunc_expect;
@@ -86,7 +86,7 @@ noref bool require_spawnfunc_prefix;
        #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
        #define spawnfunc_2(id, whitelist) \
                void __spawnfunc_##id(entity this); \
-               [[accumulate]] void spawnfunc_##id(entity this) \
+               ACCUMULATE void spawnfunc_##id(entity this) \
                { \
                    if (!__spawnfunc_first) { \
                 __spawnfunc_first = true; \
@@ -111,13 +111,13 @@ noref bool require_spawnfunc_prefix;
                        if (!this.spawnfunc_checked) { \
                                for (int i = 0, n = numentityfields(); i < n; ++i) { \
                                        string value = getentityfieldstring(i, this); \
-                                       string fieldname = entityfieldname(i); \
+                                       string s = entityfieldname(i); \
                                        whitelist(_spawnfunc_checktypes) \
                                        if (value == "") continue; \
-                                       if (fieldname == "") continue; \
+                                       if (s == "") continue; \
                                        FIELDS_COMMON(_spawnfunc_check) \
                                        whitelist(_spawnfunc_check) \
-                                       LOG_WARNF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue."), #id, fieldname, value); \
+                                       LOG_WARNF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue."), #id, s, value); \
                                } \
                                this.spawnfunc_checked = true; \
                                if (this) { \
@@ -268,7 +268,6 @@ noref bool require_spawnfunc_prefix;
                FIELD_VEC(fld, color) \
                FIELD_VEC(fld, mangle) \
                FIELD_VEC(fld, maxs) \
-               FIELD_VEC(fld, maxs) \
                FIELD_VEC(fld, mins) \
                FIELD_VEC(fld, modelscale_vec) \
                FIELD_VEC(fld, velocity) \
index 6f511fcecfa1c9c1f2ef842ad5fe47ac44fbd7ef..e0ec96b8ec0c43872992e12523329c0be74e8f5d 100644 (file)
@@ -17,7 +17,9 @@ void profile(string s)
 }
 
 #define _STATIC_INIT(func, where) \
-       [[accumulate]] void _static_##func() { profile(#func); } \
+       ACCUMULATE void _static_##func##profile() { profile(#func); } \
+       ACCUMULATE_FUNCTION(where, _static_##func##profile) \
+       ACCUMULATE void _static_##func(); \
        ACCUMULATE_FUNCTION(where, _static_##func) \
        void _static_##func()
 
index 1100c474cb9eb49074cd85d08431fd0f0ba61012..03bd34b813af0714b0380c0aa3ea423713b86bd3 100644 (file)
@@ -53,7 +53,7 @@ int g_magic_stats_hole = 0;
                                REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \
                        } \
                } \
-               [[accumulate]] void stats_get() \
+               ACCUMULATE void stats_get() \
                { \
                        T it = getstat_##T(STAT_##id.m_id); \
                        /* if (it != CAT(_STAT(id), _prev)) \
@@ -111,7 +111,7 @@ int g_magic_stats_hole = 0;
                                REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \
                        } \
                } \
-               [[accumulate]] void stats_add() \
+               ACCUMULATE void stats_add() \
                { \
                        .T fld = _STAT(id); \
                        addstat_##T(STAT_##id.m_id, fld); \
@@ -120,7 +120,7 @@ int g_magic_stats_hole = 0;
     /** TODO: do we want the global copy to update? */
     #define REGISTER_STAT_3(id, T, expr) \
        REGISTER_STAT_2(id, T); \
-       [[accumulate]] void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \
+       ACCUMULATE void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \
        STATIC_INIT(worldstat_##id) { entity this = STATS; STAT(id, this) = (expr); }
 #else
        #define REGISTER_STAT_2(id, type)
index 812eb72c8424bf2ab19f3d04fc30bf01522f3213..96e8a3a276258d568380219e0b1d8218ac9b7cf5 100644 (file)
@@ -4,6 +4,25 @@
 #include "sort.qh"
 #include "oo.qh"
 
+// string logic
+//
+// true: is truthy
+// == "": is equal to ""
+// is "": has the same string index as the string constant ""
+// strunzone: can be strunzoned
+//
+// |              | true | == "" | is "" | strunzone |
+// | :----------: | :--: | :---: | :---: | :-------: |
+// | nil          |      | yes   |       |           |
+// | strcat(nil)  | yes  | yes   |       |           |
+// | strzone(nil) | yes  | yes   |       | yes       |
+// | ""           | yes  | yes   | yes   |           |
+// | strcat("")   | yes  | yes   |       |           |
+// | strzone("")  | yes  | yes   |       | yes       |
+// | "s"          | yes  |       |       |           |
+// | strcat("s")  | yes  |       |       |           |
+// | strzone("s") | yes  |       |       | yes       |
+
 #ifdef CSQC
        float stringwidth_colors(string s, vector theSize)
        {
        }
 #endif
 
+#define strcpy(this, s) MACRO_BEGIN \
+       if (this) { \
+               strunzone(this); \
+       } \
+       this = strzone(s); \
+MACRO_END
+
+#define strfree(this) MACRO_BEGIN \
+       if (this) { \
+               strunzone(this); \
+       } \
+       this = string_null; \
+MACRO_END
+
 ERASEABLE
 string seconds_tostring(float sec)
 {
index ff6f2d23d5b52f1e00d75ba699c6552031ba8f5b..8d8de76ec6119abecd88093b0bd52bd8e1bb08e3 100644 (file)
@@ -5,7 +5,7 @@
 /** Use UpperCamelCase for suite and test only */
 #define TEST(suite, test) \
        void _TEST_##suite##_##test(); \
-       [[accumulate]] int TEST_RunAll_accumulated(int f) { \
+       ACCUMULATE int TEST_RunAll_accumulated(int f) { \
                if (!TEST_Run(#suite "_" #test)) ++f; \
                return = f; \
        } \
index 1572fec07cb2d1962870f63d7a3e3021db220841..2ad7bda2464b6842daa52fb70b2889c1835ab02c 100644 (file)
@@ -55,7 +55,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                {
                        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);
+                       strfree(e.url_url);
                        delete(e);
                        return 1;
                }
@@ -64,7 +64,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                {
                        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);
+                       strfree(e.url_url);
                        delete(e);
                        return 1;
                }
@@ -77,7 +77,7 @@ float url_URI_Get_Callback(int id, float status, string data)
        {
                // an ERROR
                e.url_ready(e, e.url_ready_pass, -fabs(status));
-               strunzone(e.url_url);
+               strfree(e.url_url);
                delete(e);
                return 1;
        }
@@ -108,7 +108,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                {
                                        LOG_INFO("url_single_fopen: out of memory in buf_create");
                                        rdy(e, pass, URL_READY_ERROR);
-                                       strunzone(e.url_url);
+                                       strfree(e.url_url);
                                        delete(e);
                                        return;
                                }
@@ -231,7 +231,7 @@ void url_fclose(entity e)
                                        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);
+                                       strfree(e.url_url);
                                        delete(e);
                                        return;
                                }
@@ -243,7 +243,7 @@ void url_fclose(entity e)
                                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);
+                               strfree(e.url_url);
                                delete(e);
                                return;
                        }
@@ -264,7 +264,7 @@ void url_fclose(entity e)
                        // we have READ all data, just close
                        e.url_ready(e, e.url_ready_pass, URL_READY_CLOSED);
                        buf_del(e.url_rbuf);
-                       strunzone(e.url_url);
+                       strfree(e.url_url);
                        delete(e);
                }
        }
@@ -341,7 +341,7 @@ void url_multi_ready(entity fh, entity me, float status)
                {
                        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);
+                       strfree(me.url_url);
                        delete(me);
                        return;
                }
@@ -350,7 +350,7 @@ void url_multi_ready(entity fh, entity me, float status)
                if (n <= me.url_attempt)
                {
                        me.url_ready(fh, me.url_ready_pass, status);
-                       strunzone(me.url_url);
+                       strfree(me.url_url);
                        delete(me);
                        return;
                }
index acbc1c61d4dda0f69cb0d256467f16bc2808cb07..4a7c8861069f7eb8420ec819b9525d606ffbe2d2 100644 (file)
@@ -63,11 +63,11 @@ float tanh(float e)
 
 float exp(float e)
 {
-       return (M_E ** e);
+       return pow(M_E, e);
 }
 float exp2(float e)
 {
-       return (2 ** e);
+       return pow(2, e);
 }
 float expm1(float e)
 {
@@ -79,16 +79,16 @@ vector frexp(float e)
        vector v;
        v.z = 0;
        v.y = ilogb(e) + 1;
-       v.x = e / (2 ** v.y);
+       v.x = e / pow(2, v.y);
        return v;
 }
 int ilogb(float e)
 {
        return floor(log2(fabs(e)));
 }
-float ldexp(float e, int e)
+float ldexp(float x, int e)
 {
-       return e * (2 ** e);
+       return x * pow(2, e);
 }
 float logn(float e, float base)
 {
@@ -117,12 +117,12 @@ vector modf(float f)
 
 float scalbn(float e, int n)
 {
-       return e * (2 ** n);
+       return e * pow(2, n);
 }
 
 float cbrt(float e)
 {
-       return copysign((fabs(e) ** (1.0/3.0)), e);
+       return copysign(pow(fabs(e), (1.0/3.0)), e);
 }
 float hypot(float e, float f)
 {
index a418dc2ce0fffa7b761fff860ebe8f950dbb09bf..d02f4661f5cd84bf891af26a6c1bef694244f463 100644 (file)
@@ -22,7 +22,7 @@
 
        void InputBox_setText(entity me, string txt)
        {
-               if (me.text) strunzone(me.text);
+               strfree(me.text);
                SUPER(InputBox).setText(me, strzone(txt));
        }
 
index d21b5676bd597d32da93d61b3f3a850d15d5af7b..f7a782dabbf877a3b0bcef5adee11db333d8edc0 100644 (file)
@@ -9,8 +9,7 @@
                me.text = txt;
                if (txt != me.currentText)
                {
-                       if (me.currentText) strunzone(me.currentText);
-                       me.currentText = strzone(txt);
+                       strcpy(me.currentText, txt);
                        me.recalcPos = 1;
                }
        }
                        t = me.textEntity.toString(me.textEntity);
                        if (t != me.currentText)
                        {
-                               if (me.currentText) strunzone(me.currentText);
-                               me.currentText = strzone(t);
+                               strcpy(me.currentText, t);
                                me.recalcPos = 1;
                        }
                }
index af14e0842b4dc749897a45e7fc2f18ae2dcaf6c4..fb6c4aeeda60a612cbe47ffe4c6804022b315c23 100644 (file)
@@ -217,8 +217,7 @@ void m_init_delayed()
        if (m_goto_buffer)
        {
                m_goto(m_goto_buffer);
-               strunzone(m_goto_buffer);
-               m_goto_buffer = string_null;
+               strfree(m_goto_buffer);
        }
 
        if (Menu_Active) m_display();  // delayed menu display
@@ -550,8 +549,7 @@ void m_tooltip(vector pos)
                        {
                                // fade out if tooltip of a certain item has changed
                                menuTooltipState = 3;
-                               if (prev_tooltip) strunzone(prev_tooltip);
-                               prev_tooltip = strzone(it.tooltip);
+                               strcpy(prev_tooltip, it.tooltip);
                        }
                        else if (menuTooltipItem && !m_testmousetooltipbox(pos))
                        {
@@ -584,8 +582,7 @@ void m_tooltip(vector pos)
 
                                        menuTooltipOrigin.x = -1;  // unallocated
 
-                                       if (menuTooltipText) strunzone(menuTooltipText);
-                                       menuTooltipText = strzone(gettooltip());
+                                       strcpy(menuTooltipText, gettooltip());
 
                                        int i = 0;
                                        float w = 0;
@@ -635,11 +632,7 @@ void m_tooltip(vector pos)
 
        if (menuTooltipItem == NULL)
        {
-               if (menuTooltipText)
-               {
-                       strunzone(menuTooltipText);
-                       menuTooltipText = string_null;
-               }
+               strfree(menuTooltipText);
                return;
        }
        else
@@ -953,8 +946,7 @@ void m_goto(string itemname)
 {
        if (!menuInitialized)
        {
-               if (m_goto_buffer) strunzone(m_goto_buffer);
-               m_goto_buffer = strzone(itemname);
+               strcpy(m_goto_buffer, itemname);
                return;
        }
        if (itemname == "")  // this can be called by GameCommand
index 1df38f5af09c571df07e280b3c9691ec192f837b..af1b7f6324ffaae82ade9eab7002e640aa63ce0e 100644 (file)
@@ -2,6 +2,11 @@
 
 #include <common/mutators/base.qh>
 
+// register all possible hooks here
+
+// to use a hook, first register your mutator using REGISTER_MUTATOR
+// then create your function using MUTATOR_HOOKFUNCTION
+
 // globals
 
 string cmd_name;
index cb418a4e1834fcce6076672f337e818fef681ca5..9f953f66f542f9a8b9238d65e813a6b5cdf777c7 100644 (file)
@@ -14,8 +14,7 @@ void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
        for(i = 0; i < campaign_entries; ++i)
        {
                l = l0;
-               if(campaign_longdesc_wrapped[i])
-                       strunzone(campaign_longdesc_wrapped[i]);
+               strfree(campaign_longdesc_wrapped[i]);
                n = tokenizebyseparator(campaign_longdesc[i], "\n");
                r = "";
                for(j = 0; j < n; ++j)
@@ -70,12 +69,8 @@ void XonoticCampaignList_destroy(entity me)
 void XonoticCampaignList_loadCvars(entity me)
 {
        // read campaign cvars
-       if(campaign_name)
-               strunzone(campaign_name);
-       if(me.cvarName)
-               strunzone(me.cvarName);
-       campaign_name = strzone(cvar_string("g_campaign_name"));
-       me.cvarName = strzone(strcat("g_campaign", campaign_name, "_index"));
+       strcpy(campaign_name, cvar_string("g_campaign_name"));
+       strcpy(me.cvarName, strcat("g_campaign", campaign_name, "_index"));
        registercvar(me.cvarName, "", 0); // saved by server QC anyway
        CampaignFile_Unload();
        CampaignFile_Load(0, CAMPAIGN_MAX_ENTRIES);
index e11d7dcc0f04d4f9401edbb4d16273b823162542..f3c3fe24fa48ee237b2be4c277b5a0a912f1254f 100644 (file)
@@ -25,9 +25,7 @@ void XonoticCrosshairPreview_draw(entity me)
        float a;
        rgb = stov(cvar_string("crosshair_color"));
        a = cvar("crosshair_alpha");
-       if(me.src)
-               strunzone(me.src);
-       me.src = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
+       strcpy(me.src, strcat("/gfx/crosshair", cvar_string("crosshair")));
 
        sz = draw_PictureSize(me.src);
        sz = globalToBoxSize(sz, me.size);
index 12bb2810ba87282e54d9df9c43b7df5e1dba38c1..9587d5432d83c7ebc80dcbac53a26dfc0af370e8 100644 (file)
@@ -107,17 +107,10 @@ void XonoticCvarList_setSelected(entity me, float i)
        if(me.nItems == 0)
                return;
 
-       if(me.cvarName)
-               strunzone(me.cvarName);
-       if(me.cvarDescription)
-               strunzone(me.cvarDescription);
-       if(me.cvarType)
-               strunzone(me.cvarType);
-       if(me.cvarDefault)
-               strunzone(me.cvarDefault);
-       me.cvarName = strzone(bufstr_get(me.handle, me.selectedItem));
-       me.cvarDescription = strzone(cvar_description(me.cvarName));
-       me.cvarDefault = strzone(cvar_defstring(me.cvarName));
+       strfree(me.cvarType);
+       strcpy(me.cvarName, bufstr_get(me.handle, me.selectedItem));
+       strcpy(me.cvarDescription, cvar_description(me.cvarName));
+       strcpy(me.cvarDefault, cvar_defstring(me.cvarName));
        me.cvarNameBox.setText(me.cvarNameBox, me.cvarName);
        me.cvarDescriptionBox.setText(me.cvarDescriptionBox, me.cvarDescription);
        float needsForcing = me.updateCvarType(me);
index b527542a5965b1408ed6e299c856ccb414b846df..16d5370f5d7beeef0487001e7aae4c7ad76bb77c 100644 (file)
@@ -129,8 +129,7 @@ void DemoList_Refresh_Click(entity btn, entity me)
 
 void DemoList_Filter_Change(entity box, entity me)
 {
-       if(me.filterString)
-               strunzone(me.filterString);
+       strfree(me.filterString);
 
        if(box.text != "")
        {
index 481914200a99f625338e4be2466d158a1e5bcd34..2a2144598bbfecd56097c0a8efea20b4918228fd 100644 (file)
@@ -27,16 +27,8 @@ void GameType_ConfigureSliders(entity me, string pLabel, float pMin, float pMax,
        // clear old values
        for(i = 0; i < e.nValues; ++i);
        {
-               if(e.(valueStrings[i]))
-               {
-                       strunzone(e.(valueStrings[i]));
-                       e.(valueStrings[i]) = string_null;
-               }
-               if(e.(valueIdentifiers[i]))
-               {
-                       strunzone(e.(valueIdentifiers[i]));
-                       e.(valueIdentifiers[i]) = string_null;
-               }
+               strfree(e.(valueStrings[i]));
+               strfree(e.(valueIdentifiers[i]));
        }
        e.clearValues(e);
 
index 2f2ab901a84239a9c37c21866552b449f7089ed6..87ffadf3831d8015641eb7b3b9e50e7d8e95ecc7 100644 (file)
@@ -12,19 +12,11 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
        me.startButton.onClickEntity = mlb;
        MapInfo_Get_ByID(i);
 
-       if(me.currentMapBSPName)
-       {
-               strunzone(me.currentMapBSPName);
-               strunzone(me.currentMapTitle);
-               strunzone(me.currentMapAuthor);
-               strunzone(me.currentMapDescription);
-               strunzone(me.currentMapPreviewImage);
-       }
-       me.currentMapBSPName = strzone(MapInfo_Map_bspname);
-       me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title));
-       me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author));
-       me.currentMapDescription = strzone(MapInfo_Map_description);
-       me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
+       strcpy(me.currentMapBSPName, MapInfo_Map_bspname);
+       strcpy(me.currentMapTitle, strdecolorize(MapInfo_Map_title));
+       strcpy(me.currentMapAuthor, strdecolorize(MapInfo_Map_author));
+       strcpy(me.currentMapDescription, MapInfo_Map_description);
+       strcpy(me.currentMapPreviewImage, strcat("/maps/", MapInfo_Map_bspname));
 
        me.frame.setText(me.frame, me.currentMapBSPName);
        me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
index f8bf895c2467b55c5ba80c4a84771aa271851826..994c5a7c95cc3f44ff03e6e842aad3ff864a7f2c 100644 (file)
@@ -30,12 +30,8 @@ string WeaponArenaString()
                return _("Most Weapons Arena");
        if(s == weaponarenastring_cvar)
                return weaponarenastring;
-       if(weaponarenastring)
-               strunzone(weaponarenastring);
-       if(weaponarenastring_cvar)
-               strunzone(weaponarenastring_cvar);
 
-       weaponarenastring_cvar = strzone(s);
+       strcpy(weaponarenastring_cvar, s);
 
        n = tokenize_console(s);
        s = "";
@@ -48,63 +44,66 @@ string WeaponArenaString()
        }
        s = sprintf(_("%s Arena"), s);
 
-       weaponarenastring = strzone(s);
+       strcpy(weaponarenastring, s);
 
        return weaponarenastring;
 }
 
 string XonoticMutatorsDialog_toString(entity me)
 {
-       string s;
-       s = "";
+       string s = "";
        if(cvar("g_dodging"))
-               s = strcat(s, ", ", _("Dodging"));
+               s = cons_mid(s, ", ", _("Dodging"));
        if(cvar("g_instagib"))
-               s = strcat(s, ", ", _("InstaGib"));
+               s = cons_mid(s, ", ", _("InstaGib"));
        if(cvar("g_new_toys"))
-               s = strcat(s, ", ", _("New Toys"));
+               s = cons_mid(s, ", ", _("New Toys"));
        if(cvar("g_nix"))
-               s = strcat(s, ", ", _("NIX"));
+               s = cons_mid(s, ", ", _("NIX"));
        if(cvar("g_rocket_flying"))
-               s = strcat(s, ", ", _("Rocket Flying"));
+               s = cons_mid(s, ", ", _("Rocket Flying"));
        if(cvar("g_invincible_projectiles"))
-               s = strcat(s, ", ", _("Invincible Projectiles"));
+               s = cons_mid(s, ", ", _("Invincible Projectiles"));
        if(cvar_string("g_weaponarena") != "0")
-               s = strcat(s, ", ", WeaponArenaString());
+               s = cons_mid(s, ", ", WeaponArenaString());
        else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
-               s = strcat(s, ", ", _("No start weapons"));
+               s = cons_mid(s, ", ", _("No start weapons"));
        if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
-               s = strcat(s, ", ", _("Low gravity"));
+               s = cons_mid(s, ", ", _("Low gravity"));
        if(cvar("g_cloaked"))
-               s = strcat(s, ", ", _("Cloaked"));
+               s = cons_mid(s, ", ", _("Cloaked"));
        if(cvar("g_grappling_hook"))
-               s = strcat(s, ", ", _("Hook"));
+               s = cons_mid(s, ", ", _("Hook"));
        if(cvar("g_midair"))
-               s = strcat(s, ", ", _("Midair"));
+               s = cons_mid(s, ", ", _("Midair"));
+       if(cvar("g_melee_only"))
+               s = cons_mid(s, ", ", _("Melee only"));
        if(cvar("g_vampire"))
-               s = strcat(s, ", ", _("Vampire"));
+               s = cons_mid(s, ", ", _("Vampire"));
        if(cvar("g_pinata"))
-               s = strcat(s, ", ", _("Piñata"));
+               s = cons_mid(s, ", ", _("Piñata"));
        if(cvar("g_weapon_stay"))
-               s = strcat(s, ", ", _("Weapons stay"));
+               s = cons_mid(s, ", ", _("Weapons stay"));
        if(cvar("g_bloodloss") > 0)
-               s = strcat(s, ", ", _("Blood loss"));
+               s = cons_mid(s, ", ", _("Blood loss"));
        if(cvar("g_jetpack"))
-               s = strcat(s, ", ", _("Jet pack"));
+               s = cons_mid(s, ", ", _("Jet pack"));
        if(cvar("g_buffs") > 0)
-               s = strcat(s, ", ", _("Buffs"));
+               s = cons_mid(s, ", ", _("Buffs"));
        if(cvar("g_overkill"))
-               s = strcat(s, ", ", _("Overkill"));
+               s = cons_mid(s, ", ", _("Overkill"));
        if(cvar("g_powerups") == 0)
-               s = strcat(s, ", ", _("No powerups"));
+               s = cons_mid(s, ", ", _("No powerups"));
        if(cvar("g_powerups") > 0)
-               s = strcat(s, ", ", _("Powerups"));
+               s = cons_mid(s, ", ", _("Powerups"));
        if(cvar("g_touchexplode") > 0)
-               s = strcat(s, ", ", _("Touch explode"));
+               s = cons_mid(s, ", ", _("Touch explode"));
+       if(cvar("g_walljump"))
+               s = cons_mid(s, ", ", _("Wall jumping"));
        if(s == "")
                return ZCTX(_("MUT^None"));
        else
-               return substring(s, 2, strlen(s) - 2);
+               return s;
 }
 
 float checkCompatibility_pinata(entity me)
@@ -113,6 +112,10 @@ float checkCompatibility_pinata(entity me)
                return 0;
        if(cvar("g_nix"))
                return 0;
+       if(cvar("g_overkill"))
+               return 0;
+       if(cvar("g_melee_only"))
+               return 0;
        if(cvar_string("g_weaponarena") != "0")
                return 0;
        return 1;
@@ -168,10 +171,11 @@ void XonoticMutatorsDialog_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
+                       e.cvarOffValue = "-1"; // TODO: make this a radio button?
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
-                       _("Only possible to inflict damage on your enemy while he's airborne")));
+                       _("Only possible to inflict damage on your enemy while they're airborne")));
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
@@ -233,32 +237,40 @@ void XonoticMutatorsDialog_fill(entity me)
 
        me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
+       string weaponarena_tooltip = strzone(_("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups"));
        me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:"),
-                       _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
+               me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
                        e.cvarValueIsAnotherCvar = true;
                        e.cvarOffValue = "0";
+
+               me.TDempty(me, 0.1); // fix initial position
        for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
        {
                w = Weapons_from(i);
                if(w.spawnflags & WEP_FLAG_HIDDEN)
                        continue;
                if((j & 1) == 0)
+                       me.TDempty(me, 0.2);
+               else
+               {
                        me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
+                       me.TDempty(me, 0.4);
+               }
+               me.TD(me, 1, 1.7, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
                        setDependentWeird(e, checkCompatibility_weaponarena_weapon);
                ++j;
        }
+
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"),
-                       _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
                        e.cvarOffValue = "0";
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"),
-                       _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
                        e.cvarOffValue = "0";
        me.TR(me);
                me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
index baeb9a51bcbf127d14f8dc89acb36b6814ab5901..5745ce072e044940ddadd3d2e19dd41875e65dbb 100644 (file)
@@ -16,61 +16,21 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
        // ====================================
        //  First clear and unzone the strings
        // ====================================
-       if(me.currentServerName)
-               strunzone(me.currentServerName);
-       me.currentServerName = string_null;
-
-       if(me.currentServerCName)
-               strunzone(me.currentServerCName);
-       me.currentServerCName = string_null;
-
-       if(me.currentServerType)
-               strunzone(me.currentServerType);
-       me.currentServerType = string_null;
-
-       if(me.currentServerMap)
-               strunzone(me.currentServerMap);
-       me.currentServerMap = string_null;
-
-       if(me.currentServerPlayers)
-               strunzone(me.currentServerPlayers);
-       me.currentServerPlayers = string_null;
-
-       if(me.currentServerNumPlayers)
-               strunzone(me.currentServerNumPlayers);
-       me.currentServerNumPlayers = string_null;
-
-       if(me.currentServerNumBots)
-               strunzone(me.currentServerNumBots);
-       me.currentServerNumBots = string_null;
-
-       if(me.currentServerNumFreeSlots)
-               strunzone(me.currentServerNumFreeSlots);
-       me.currentServerNumFreeSlots = string_null;
-
-       if(me.currentServerMod)
-               strunzone(me.currentServerMod);
-       me.currentServerMod = string_null;
-
-       if(me.currentServerVersion)
-               strunzone(me.currentServerVersion);
-       me.currentServerVersion = string_null;
-
+       strfree(me.currentServerName);
+       strfree(me.currentServerCName);
+       strfree(me.currentServerType);
+       strfree(me.currentServerMap);
+       strfree(me.currentServerPlayers);
+       strfree(me.currentServerNumPlayers);
+       strfree(me.currentServerNumBots);
+       strfree(me.currentServerNumFreeSlots);
+       strfree(me.currentServerMod);
+       strfree(me.currentServerVersion);
        // not zoned!
-       //if(me.currentServerEncrypt)
-       //      strunzone(me.currentServerEncrypt);
-       //me.currentServerEncrypt = string_null;
-       if(me.currentServerPure)
-               strunzone(me.currentServerPure);
-       me.currentServerPure = string_null;
-
-       if(me.currentServerKey)
-               strunzone(me.currentServerKey);
-       me.currentServerKey = string_null;
-
-       if(me.currentServerID)
-               strunzone(me.currentServerID);
-       me.currentServerID = string_null;
+       //      strfree(me.currentServerEncrypt);
+       strfree(me.currentServerPure);
+       strfree(me.currentServerKey);
+       strfree(me.currentServerID);
 
        // ==========================
        //  Now, fill in the strings
index 1229be714491116f7348641b47f7d31fd2310126..afde0914a48b981db347492f8db456e31ae4da64 100644 (file)
@@ -19,9 +19,7 @@ void XonoticScreenshotBrowserTab_loadPreviewScreenshot(entity me, string scrImag
 {
        if (me.currentScrPath == scrImage)
                return;
-       if (me.currentScrPath)
-               strunzone(me.currentScrPath);
-       me.currentScrPath = strzone(scrImage);
+       strcpy(me.currentScrPath, scrImage);
        me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
 }
 void XonoticScreenshotBrowserTab_fill(entity me)
index d6d545eeeaf00b939ce5b8ad35b6243bd8e66868..57dd75679e03b3d272432dbe79088261220e4c87 100644 (file)
@@ -24,9 +24,7 @@ void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
 
        if (me.currentScrPath == scrImage)
                return;
-       if (me.currentScrPath)
-               strunzone(me.currentScrPath);
-       me.currentScrPath = strzone(scrImage);
+       strcpy(me.currentScrPath, scrImage);
        me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
        me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
 }
index 66c96046d88e9e4a2b156b2ed2d149188613ab22..d97d7131a473b36c0a46e8935b1efba6078c51d9 100644 (file)
@@ -188,19 +188,15 @@ void HUDSkinList_Refresh_Click(entity btn, entity me)
 
 void HUDSkinList_SavedName_Change(entity box, entity me)
 {
-       if(me.savedName)
-               strunzone(me.savedName);
+       strfree(me.savedName);
 
        if(box.text != "")
                me.savedName = strzone(box.text);
-       else
-               me.savedName = string_null;
 }
 
 void HUDSkinList_Filter_Change(entity box, entity me)
 {
-       if(me.filterString)
-               strunzone(me.filterString);
+       strfree(me.filterString);
 
        if(box.text != "")
        {
@@ -209,8 +205,6 @@ void HUDSkinList_Filter_Change(entity box, entity me)
                else
                        me.filterString = strzone(strcat("*", box.text, "*"));
        }
-       else
-               me.filterString = string_null;
 
        me.getHUDSkins(me);
 }
index 1f28a1bdfede23aa181f110ca297596457a85976..cde80d693d422a6a44b1664cd06f29fa7ceee87d 100644 (file)
@@ -246,12 +246,8 @@ void XonoticKeyBinder_destroy(entity me)
 
        for(int i = 0; i < MAX_KEYBINDS; ++i)
        {
-               if(Xonotic_KeyBinds_Functions[i])
-                       strunzone(Xonotic_KeyBinds_Functions[i]);
-               Xonotic_KeyBinds_Functions[i] = string_null;
-               if(Xonotic_KeyBinds_Descriptions[i])
-                       strunzone(Xonotic_KeyBinds_Descriptions[i]);
-               Xonotic_KeyBinds_Descriptions[i] = string_null;
+               strfree(Xonotic_KeyBinds_Functions[i]);
+               strfree(Xonotic_KeyBinds_Descriptions[i]);
        }
        Xonotic_KeyBinds_Count = 0;
 }
index 111744e9668da9e0b3909f7c97e15c8f01062e72..73ef8a32ae8cfd738852859b0ccb47fa5bf6bbd0 100644 (file)
@@ -181,8 +181,6 @@ void XonoticMapList_refilter(entity me)
 
        for(i = 0; i < MapInfo_count; ++i)
                draw_PreloadPicture(strcat("/maps/", MapInfo_BSPName_ByID(i)));
-       if(me.g_maplistCache)
-               strunzone(me.g_maplistCache);
        s = "0";
        for(i = 1; i < MapInfo_count; i *= 2)
                s = strcat(s, s);
@@ -201,7 +199,7 @@ void XonoticMapList_refilter(entity me)
                                );
                }
        }
-       me.g_maplistCache = strzone(s);
+       strcpy(me.g_maplistCache, s);
        if(gt != me.lastGametype || f != me.lastFeatures)
        {
                me.lastGametype = gt;
@@ -217,12 +215,9 @@ void XonoticMapList_refilterCallback(entity me, entity cb)
 
 void MapList_StringFilterBox_Change(entity box, entity me)
 {
-       if(me.stringFilter)
-               strunzone(me.stringFilter);
+       strfree(me.stringFilter);
        if(box.text != "")
                me.stringFilter = strzone(box.text);
-       else
-               me.stringFilter = string_null;
 
        me.refilter(me);
 }
@@ -345,9 +340,7 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
                if(time < me.typeToSearchTime)
                {
                        save = substring(me.typeToSearchString, 0, strlen(me.typeToSearchString) - 1);
-                       if(me.typeToSearchString)
-                               strunzone(me.typeToSearchString);
-                       me.typeToSearchString = strzone(save);
+                       strcpy(me.typeToSearchString, save);
                        me.typeToSearchTime = time + 0.5;
                        if(strlen(me.typeToSearchString))
                        {
@@ -364,9 +357,7 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
                        save = ch;
                else
                        save = strcat(me.typeToSearchString, ch);
-               if(me.typeToSearchString)
-                       strunzone(me.typeToSearchString);
-               me.typeToSearchString = strzone(save);
+               strcpy(me.typeToSearchString, save);
                me.typeToSearchTime = time + 0.5;
                MapInfo_FindName(me.typeToSearchString);
                if(MapInfo_FindName_firstResult >= 0)
index c679d4449d7177598dc649228f7e4cc96b11be76..1ad651bdb5a5824deef0e972601fd469fadb7fb4 100644 (file)
@@ -113,21 +113,12 @@ void XonoticPlayerModelSelector_go(entity me, float d)
 {
        me.idxModels = mod(me.idxModels + d + me.numModels, me.numModels);
 
-       if(me.currentModel)
-               strunzone(me.currentModel);
-       if(me.currentModelTitle)
-               strunzone(me.currentModelTitle);
-       if(me.currentModelImage)
-               strunzone(me.currentModelImage);
-       if(me.currentModelDescription)
-               strunzone(me.currentModelDescription);
-
        // select model #i!
-       me.currentModelTitle = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_TITLE));
-       me.currentModelImage = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_IMAGE));
+       strcpy(me.currentModelTitle, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_TITLE));
+       strcpy(me.currentModelImage, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_IMAGE));
        me.currentSkin = stof(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_SKIN));
-       me.currentModel = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_MODEL));
-       me.currentModelDescription = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC));
+       strcpy(me.currentModel, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_MODEL));
+       strcpy(me.currentModelDescription, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC));
 
        // fix the image
        if(draw_PictureSize(me.currentModelImage) == '0 0 0')
index 8e8f3ccf738bd4f32de72be843b87510b558d8d8..af987e7b58c9ab78491ef7829a8e57a1885842f5 100644 (file)
@@ -19,9 +19,7 @@ void XonoticScreenshotImage_load(entity me, string theImage)
 {
        me.screenshotTime = time;
        me.src = theImage;
-       if (me.screenshotTitle)
-               strunzone(me.screenshotTitle);
-       me.screenshotTitle = strzone(substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
+       strcpy(me.screenshotTitle, substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
 
        me.initZoom(me); // this image may have a different size
        me.setZoom(me, 0, 0);
index a948ce86f842dfb79d7bf85c631835fcc6bf751b..de0adc793815796c0e175f32bf1e6e473b2709e1 100644 (file)
@@ -153,8 +153,7 @@ void ScreenshotList_Refresh_Click(entity btn, entity me)
 
 void ScreenshotList_Filter_Change(entity box, entity me)
 {
-       if(me.filterString)
-               strunzone(me.filterString);
+       strfree(me.filterString);
 
        if(box.text != "")
        {
@@ -163,8 +162,6 @@ void ScreenshotList_Filter_Change(entity box, entity me)
                else
                        me.filterString = strzone(strcat("*", box.text, "*"));
        }
-       else
-               me.filterString = string_null;
 
        ScreenshotList_Refresh_Click(NULL, me);
 }
index 5e6a567b6af907de399757b63a265675d265d340..503a975c326fe09ba82aab79ac0b5131d6cb41a5 100644 (file)
@@ -37,8 +37,7 @@ void RegisterSLCategories()
                                } } \
                                if(catnum) \
                                { \
-                                       strunzone(categories[i].override_string); \
-                                       categories[i].override_string = string_null; \
+                                       strfree(categories[i].override_string); \
                                        categories[i].override_field = catnum; \
                                        continue; \
                                } \
@@ -51,8 +50,7 @@ void RegisterSLCategories()
                                        ); \
                                } \
                        } \
-                       strunzone(categories[i].override_string); \
-                       categories[i].override_string = string_null; \
+                       strfree(categories[i].override_string); \
                        categories[i].override_field = 0; \
                }
        PROCESS_OVERRIDE(cat_enoverride_string, cat_enoverride)
@@ -308,9 +306,7 @@ void XonoticServerList_setSelected(entity me, int i)
        if(gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT) != me.nItems)
                return; // sorry, it would be wrong
 
-       if(me.selectedServer)
-               strunzone(me.selectedServer);
-       me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+       strcpy(me.selectedServer, gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
 
        me.ipAddressBox.setText(me.ipAddressBox, me.selectedServer);
        me.ipAddressBox.cursorPos = strlen(me.selectedServer);
@@ -549,9 +545,9 @@ void XonoticServerList_draw(entity me)
        }
        else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
 
-       me.connectButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
-       me.infoButton.disabled = ((me.nItems == 0) || !owned);
-       me.favoriteButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
+       me.connectButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+       me.infoButton.disabled = (me.lockedSelectedItem || me.nItems == 0 || !owned);
+       me.favoriteButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
 
        if(me.lockedSelectedItem)
        {
@@ -559,9 +555,7 @@ void XonoticServerList_draw(entity me)
                {
                        if(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem) != me.selectedServer)
                        {
-                               if(me.selectedServer)
-                                       strunzone(me.selectedServer);
-                               me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+                               strcpy(me.selectedServer, gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
                        }
                        found = true;
                }
@@ -586,9 +580,7 @@ void XonoticServerList_draw(entity me)
                        // selected server disappeared, select the last server (scrolling to it)
                        if(me.selectedItem >= me.nItems)
                                SUPER(XonoticServerList).setSelected(me, me.nItems - 1);
-                       if(me.selectedServer)
-                               strunzone(me.selectedServer);
-                       me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+                       strcpy(me.selectedServer, gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
                }
        }
 
@@ -666,12 +658,9 @@ void ServerList_TypeSort_Click(entity btn, entity me)
 }
 void ServerList_Filter_Change(entity box, entity me)
 {
-       if(me.filterString)
-               strunzone(me.filterString);
+       strfree(me.filterString);
        if(box.text != "")
                me.filterString = strzone(box.text);
-       else
-               me.filterString = string_null;
        me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
 
        me.ipAddressBox.setText(me.ipAddressBox, "");
@@ -717,9 +706,7 @@ void XonoticServerList_setSortOrder(entity me, int fld, int direction)
        me.sortButton4.forcePressed = 0;
        me.sortButton5.forcePressed = (fld == SLIST_FIELD_NUMHUMANS);
        me.selectedItem = 0;
-       if(me.selectedServer)
-               strunzone(me.selectedServer);
-       me.selectedServer = string_null;
+       strfree(me.selectedServer);
        me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
 }
 void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin, float theSize, string theTitle, void(entity, entity) theFunc)
@@ -775,11 +762,10 @@ void XonoticServerList_resizeNotify(entity me, vector relOrigin, vector relSize,
 }
 void ServerList_Connect_Click(entity btn, entity me)
 {
-       localcmd(sprintf("connect %s\n",
-               ((me.ipAddressBox.text != "") ?
-                       me.ipAddressBox.text : me.selectedServer
-               )
-       ));
+       if (me.lockedSelectedItem)
+               return;
+       string sv = (me.ipAddressBox.text != "") ? me.ipAddressBox.text : me.selectedServer;
+       localcmd(sprintf("connect %s\n", sv));
 }
 void ServerList_Favorite_Click(entity btn, entity this)
 {
@@ -857,7 +843,7 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is
                }
        }
 
-       if(isSelected)
+       if(isSelected && !me.lockedSelectedItem)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
        else if(isFocused)
        {
index e45abfda33b528cce9e9e72035dd4ab1807d47c5..32359ad2b22edf9abf652201b8e8c6a6b199c217 100644 (file)
@@ -30,7 +30,7 @@ CLASS(XonoticServerList, XonoticListBox)
        ATTRIB(XonoticServerList, columnTypeSize, float, 0);
        ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0);
        ATTRIB(XonoticServerList, columnPlayersSize, float, 0);
-       ATTRIB(XonoticServerList, lockedSelectedItem, bool, true);      // initially keep selected the first item of the list, avoiding an unwanted scrolling
+       ATTRIB(XonoticServerList, lockedSelectedItem, bool, true); // initially keep selected the first item of the list to avoid unwanted scrolling
 
        ATTRIB(XonoticServerList, selectedServer, string); // to restore selected server when needed
        METHOD(XonoticServerList, setSelected, void(entity, float));
index 13e6ba34c03395f74fbe2f7f6fccfa3c26fd16f6..6d77e1adf929c1e94f2aa964c7edb7bff88837da 100644 (file)
@@ -104,13 +104,10 @@ void SoundList_Menu_Track_Reset(entity box, entity me)
 
 void SoundList_Filter_Change(entity box, entity me)
 {
-       if(me.filterString)
-               strunzone(me.filterString);
+       strfree(me.filterString);
 
        if(box.text != "")
                me.filterString = strzone(box.text);
-       else
-               me.filterString = string_null;
 
        me.getSounds(me);
 }
index 602862820b114f93a4ef00bd28ceb07a4e453e1f..c9cd001ba9f9fcd4ec2fdc79727b31e8c6684e7b 100644 (file)
@@ -267,8 +267,7 @@ void setZonedTooltip(entity e, string theTooltip, string theCvar)
                theTooltip = string_null;
        }
 
-       if(e.tooltip)
-               strunzone(e.tooltip);
+       strfree(e.tooltip);
        e.tooltip = (theTooltip != "") ? strzone(theTooltip) : string_null;
 }
 
@@ -612,8 +611,7 @@ void preMenuDraw()
        }
        else
        {
-               strunzone(campaign_name_previous);
-               campaign_name_previous = strzone(campaign_name);
+               strcpy(campaign_name_previous, campaign_name);
                campaign_won_previous = cvar(strcat("g_campaign", campaign_name, "_won"));
        }
 }
index fd4f51385bb898cf74fd498b1bc13b3673c02805..695b2d7873144974af98443e14ca3f36dd680141 100644 (file)
@@ -21,9 +21,8 @@ void XonoticWeaponarenaCheckBox_setChecked(entity me, float foo)
 }
 void XonoticWeaponarenaCheckBox_loadCvars(entity me)
 {
-       float n = tokenize_console(cvar_string("menu_weaponarena"));
-       float i;
-       for(i=0; i<n; ++i)
+       int n = tokenize_console(cvar_string("menu_weaponarena"));
+       for (int i = 0; i < n; i++)
        {
                if(argv(i) == me.netname)
                {
index a2f9ab49b4f9c48497e8599806adc6ff7cd247a2..2842a54311cdda2630c883c69978d915559c474c 100644 (file)
@@ -167,7 +167,7 @@ int autocvar_g_maxplayers;
 float autocvar_g_maxplayers_spectator_blocktime;
 float autocvar_g_maxpushtime;
 float autocvar_g_maxspeed;
-bool autocvar_g_instagib;
+#define autocvar_g_instagib cvar("g_instagib")
 #define autocvar_g_mirrordamage cvar("g_mirrordamage")
 #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual")
 bool autocvar_g_mirrordamage_onlyweapons;
@@ -470,6 +470,8 @@ float autocvar_g_nades_entrap_strength = 0.01;
 float autocvar_g_nades_entrap_speed = 0.5;
 float autocvar_g_nades_entrap_radius = 500;
 float autocvar_g_nades_entrap_time = 10;
+float autocvar_g_nades_veil_time = 8;
+float autocvar_g_nades_veil_radius = 300;
 string autocvar_g_nades_pokenade_monster_type;
 float autocvar_g_nades_pokenade_monster_lifetime;
 bool autocvar_g_jump_grunt;
index 5ad1295f990f0b3d16be6b989e3263e4b17b3466..fde4c0154a6199ebf4174ca23611c21cb7a2e650 100644 (file)
@@ -139,7 +139,7 @@ bool bot_shouldattack(entity this, entity targ)
                return false;
        if (IS_DEAD(targ))
                return false;
-       if (PHYS_INPUT_BUTTON_CHAT(targ))
+       if (PHYS_INPUT_BUTTON_CHAT(targ) && !autocvar_bot_typefrag)
                return false;
        if(targ.flags & FL_NOTARGET)
                return false;
index a605fc0689e73259ba266cd41047ca573bb252ad..b4272e3e0648224f6de70f8a1e2bd8f871bb0b5c 100644 (file)
@@ -396,18 +396,10 @@ void bot_clientdisconnect(entity this)
        if (!IS_BOT_CLIENT(this))
                return;
        bot_clearqueue(this);
-       if(this.cleanname)
-               strunzone(this.cleanname);
-       if(this.netname_freeme)
-               strunzone(this.netname_freeme);
-       if(this.playermodel_freeme)
-               strunzone(this.playermodel_freeme);
-       if(this.playerskin_freeme)
-               strunzone(this.playerskin_freeme);
-       this.cleanname = string_null;
-       this.netname_freeme = string_null;
-       this.playermodel_freeme = string_null;
-       this.playerskin_freeme = string_null;
+       strfree(this.cleanname);
+       strfree(this.netname_freeme);
+       strfree(this.playermodel_freeme);
+       strfree(this.playerskin_freeme);
        if(this.bot_cmd_current)
                delete(this.bot_cmd_current);
        if(bot_waypoint_queue_owner == this)
index 16b2aaf4312367da99abc30e2d9427f23c1d2402..aea112d9edf75d126ded64b3907ad1c6dcfa1097 100644 (file)
@@ -54,6 +54,7 @@ bool autocvar_bot_usemodelnames;
 bool autocvar_bot_debug_tracewalk;
 bool autocvar_bot_debug_goalstack;
 bool autocvar_bot_wander_enable;
+bool autocvar_bot_typefrag;
 bool autocvar_g_debug_bot_commands;
 int autocvar_g_waypointeditor_auto;
 float autocvar_skill_auto;
index 2a0d0c8503f005c17d2156fd2871ebf216ac932d..7ce6efa45fc63af8e3bd50991b1bdac3dcf1336c 100644 (file)
@@ -885,17 +885,17 @@ void havocbot_movetogoal(entity this)
 
        diff = destorg - this.origin;
 
-       if (fabs(diff.x) < 10 && fabs(diff.y) < 10
-               && this.goalcurrent == this.goalentity && time < this.goalentity_lock_timeout)
+       // 1. stop if too close to target player (even if frozen)
+       // 2. stop if the locked goal has been reached
+       if ((IS_PLAYER(this.goalcurrent) && vdist(diff, <, 80))
+               || (this.goalcurrent == this.goalentity && time < this.goalentity_lock_timeout && vdist(diff, <, 10)))
        {
                destorg = this.origin;
-               diff.x = 0;
-               diff.y = 0;
+               diff = '0 0 0';
        }
 
        dir = normalize(diff);
-       flatdir = diff;flatdir.z = 0;
-       flatdir = normalize(flatdir);
+       flatdir = (diff.z == 0) ? dir : normalize(vec2(diff));
 
        //if (this.bot_dodgevector_time < time)
        {
index 7b80a1a6f27cfd790fb59f325f8eda9404dfbcf9..c79ed40a4304cac996f80b84b2917d94ec44ee0e 100644 (file)
@@ -1573,7 +1573,7 @@ void navigation_shortenpath(entity this)
                if (trace_ent == this || tracewalk(this, this.origin, this.mins, this.maxs,
                        tracewalk_dest, tracewalk_dest_height, bot_navigation_movemode))
                {
-                       LOG_DEBUG("path optimized for ", this.netname, ", removed a goal from the queue"); 
+                       LOG_DEBUG("path optimized for ", this.netname, ", removed a goal from the queue");
                        navigation_poproute(this);
                }
        }
index e69050beb84d16e438e12f5849184139f792195c..82d82cb590f3835dbc0691ae7b17840176adfd00 100644 (file)
@@ -308,9 +308,7 @@ float bot_decodecommand(string cmdstring)
                                bot_cmd.bot_cmd_parm_float = stof(parm);
                                break;
                        case BOT_CMD_PARAMETER_STRING:
-                               if(bot_cmd.bot_cmd_parm_string)
-                                       strunzone(bot_cmd.bot_cmd_parm_string);
-                               bot_cmd.bot_cmd_parm_string = strzone(parm);
+                               strcpy(bot_cmd.bot_cmd_parm_string, parm);
                                break;
                        case BOT_CMD_PARAMETER_VECTOR:
                                if(substring(parm, 0, 1) != "\'")
@@ -1170,8 +1168,7 @@ void bot_resetqueues()
                it.bot_barrier = 0;
                for(int i = 0; i < it.bot_places_count; ++i)
                {
-                       strunzone(it.(bot_placenames[i]));
-                       it.(bot_placenames[i]) = string_null;
+                       strfree(it.(bot_placenames[i]));
                }
                it.bot_places_count = 0;
        });
index e80769cc2783edabcca7b1952aafbb5f9b06a256..e90d6660352a28d0f62415cdd2d769110e8495d7 100644 (file)
@@ -52,8 +52,7 @@ void cvar_set_campaignwrapper(string theCvar, string theValue)
 {
        if(cvar_string_campaignwrapper(theCvar) == theValue)
                return;
-       string s;
-       s = cvar_campaignwrapper_list;
+       string s = cvar_campaignwrapper_list;
        cvar_campaignwrapper_list = strzone(strcat("; ", theCvar, " ", theValue, s));
        strunzone(s);
        //print(cvar_campaignwrapper_list, "\n");
index 7a4f82fc5b2c33d317204992b5973e987dc9181d..d374876d0456441bc59fdf69fe683a643bb8d42a 100644 (file)
@@ -1352,8 +1352,8 @@ 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!
-       if (CS(this).weaponorder_byimpulse) strunzone(CS(this).weaponorder_byimpulse);
+       strfree(CS(this).netname_previous); // needs to be before the CS entity is removed!
+       strfree(CS(this).weaponorder_byimpulse);
        ClientState_detach(this);
 
        Portal_ClearAll(this);
@@ -1373,7 +1373,7 @@ void ClientDisconnect(entity this)
 
        bot_relinkplayerlist();
 
-       if (this.clientstatus) strunzone(this.clientstatus);
+       strfree(this.clientstatus);
        if (this.personal) delete(this.personal);
 
        this.playerid = 0;
@@ -1496,7 +1496,7 @@ void player_powerups(entity this)
        Fire_ApplyDamage(this);
        Fire_ApplyEffect(this);
 
-       if (!g_instagib)
+       if (!autocvar_g_instagib)
        {
                if (this.items & ITEM_Strength.m_itemid)
                {
@@ -2246,43 +2246,6 @@ bool PlayerThink(entity this)
                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);
 
        if (this.shootfromfixedorigin != autocvar_g_shootfromfixedorigin) {
@@ -2518,8 +2481,7 @@ void PlayerPreThink (entity this)
                }
                if (!assume_unchanged && autocvar_sv_eventlog)
                        GameLogEcho(strcat(":name:", ftos(this.playerid), ":", playername(this, false)));
-               if (CS(this).netname_previous) strunzone(CS(this).netname_previous);
-               CS(this).netname_previous = strzone(this.netname);
+               strcpy(CS(this).netname_previous, this.netname);
        }
 
        // version nagging
@@ -2805,11 +2767,14 @@ void PM_UpdateButtons(entity this, entity store)
                store.impulse = this.impulse;
        this.impulse = 0;
 
-       store.button0 = this.button0;
-       store.button2 = this.button2;
-       store.button3 = this.button3;
+       bool typing = this.buttonchat;
+
+       store.button0 = (typing) ? 0 : this.button0;
+       //button1?!
+       store.button2 = (typing) ? 0 : this.button2;
+       store.button3 = (typing) ? 0 : this.button3;
        store.button4 = this.button4;
-       store.button5 = this.button5;
+       store.button5 = (typing) ? 0 : this.button5;
        store.button6 = this.button6;
        store.button7 = this.button7;
        store.button8 = this.button8;
@@ -2835,7 +2800,7 @@ void PM_UpdateButtons(entity this, entity store)
        store.ping_movementloss = this.ping_movementloss;
 
        store.v_angle = this.v_angle;
-       store.movement = this.movement;
+       store.movement = (typing) ? '0 0 0' : this.movement;
 }
 
 NET_HANDLE(fpsreport, bool)
index 48d42da0092d2f8cf059d1f2037e8aace3bbc372..7499ee8ddfac0e0fbbd299ab4de285b53c62ea83 100644 (file)
@@ -231,5 +231,5 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re
 
 bool Spectate(entity this, entity pl);
 
-#define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee)
+#define SPECTATE_COPY() ACCUMULATE void SpectateCopy(entity this, entity spectatee)
 #define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); }
index 088925f100f2f3f47499a4be5a72bcac7861bf15..47e94f52034bf8b1a0255c8ca76b419d9772d891 100644 (file)
@@ -614,8 +614,10 @@ void ClientCommand_voice(entity caller, float request, float argc, string comman
                                        sprint(caller, sprintf("Invalid voice. Use one of: %s\n", allvoicesamples));
                                        return;
                                }
-                               if (argc >= 3) VoiceMessage(caller, e, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
-                               else VoiceMessage(caller, e, "");
+                               string msg = "";
+                               if (argc >= 3)
+                                       msg = substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
+                               VoiceMessage(caller, e, msg);
 
                                return;
                        }
index 2f7467eab7bac87ff6191a004bac3c568d4efa70..db822eb71f7ea45e2536677da8f50aab4d071bcf 100644 (file)
@@ -391,7 +391,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                                break;
                                        });
 
-                                       if (!found && arg_lower != "random") { print_to(caller, "Invalid monster"); return; }
+                                       if (!found && arg_lower != "random" && arg_lower != "anyrandom") { print_to(caller, "Invalid monster"); return; }
 
                                        totalspawned += 1;
                                        WarpZone_TraceBox(CENTER_OR_VIEWOFS(caller), caller.mins, caller.maxs, CENTER_OR_VIEWOFS(caller) + v_forward * 150, true, caller);
index 6d037473dd39907726f7eca7615610838f6b4f19..638dbb1565eabf86df69239c58be3c40f77e9516 100644 (file)
@@ -128,19 +128,15 @@ void VoteReset()
 
        if (vote_called)
        {
-               strunzone(vote_called_command);
-               strunzone(vote_called_display);
-               strunzone(vote_caller_name);
+               strfree(vote_called_command);
+               strfree(vote_called_display);
+               strfree(vote_caller_name);
        }
 
        vote_called = VOTE_NULL;
        vote_caller = NULL;
-       vote_caller_name = string_null;
        vote_endtime = 0;
 
-       vote_called_command = string_null;
-       vote_called_display = string_null;
-
        vote_parsed_command = string_null;
        vote_parsed_display = string_null;
 
@@ -660,6 +656,14 @@ int VoteCommand_parse(entity caller, string vote_command, string vote_list, floa
 
        if (!VoteCommand_checkargs(startpos, argc)) return 0;
 
+       switch (MUTATOR_CALLHOOK(VoteCommand_Parse, caller, first_command, vote_command, startpos, argc))
+       {
+               case MUT_VOTEPARSE_CONTINUE: { break; }
+               case MUT_VOTEPARSE_SUCCESS: { return 1; }
+               case MUT_VOTEPARSE_INVALID: { return -1; }
+               case MUT_VOTEPARSE_UNACCEPTABLE: { return 0; }
+       }
+
        switch (first_command) // now go through and parse the proper commands to adjust as needed.
        {
                case "kick":
index 4b600e3fceeab8743b14388eae44ba48c55c0d09..e005d0ca844eca9c9bcbfd0b15db6dd27ad820d2 100644 (file)
@@ -7,7 +7,7 @@
 
 // Globals
 
-float g_footsteps, g_grappling_hook, g_instagib;
+float g_footsteps, g_grappling_hook;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;
 float warmup_stage;
@@ -182,8 +182,6 @@ float default_weapon_alpha;
 
 string gamemode_name;
 
-float startitem_failed;
-
 string W_Apply_Weaponreplace(string in);
 
 void FixIntermissionClient(entity e);
@@ -408,67 +406,43 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 .WepSet dual_weapons;
 
 IntrusiveList g_monsters;
-STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); }
-
 IntrusiveList g_waypoints;
-STATIC_INIT(g_waypoints) { g_waypoints = IL_NEW(); }
-
 IntrusiveList g_vehicles;
-STATIC_INIT(g_vehicles) { g_vehicles = IL_NEW(); }
-
 IntrusiveList g_turrets;
-STATIC_INIT(g_turrets) { g_turrets = IL_NEW(); }
-
 IntrusiveList g_mines;
-STATIC_INIT(g_mines) { g_mines = IL_NEW(); }
-
 IntrusiveList g_projectiles;
-STATIC_INIT(g_projectiles) { g_projectiles = IL_NEW(); }
-
 IntrusiveList g_items;
-STATIC_INIT(g_items) { g_items = IL_NEW(); }
-
 IntrusiveList g_initforplayer;
-STATIC_INIT(g_initforplayer) { g_initforplayer = IL_NEW(); }
-
 IntrusiveList g_clones;
-STATIC_INIT(g_clones) { g_clones = IL_NEW(); }
-
-IntrusiveList g_assault_destructibles;
-STATIC_INIT(g_assault_destructibles) { g_assault_destructibles = IL_NEW(); }
-
-IntrusiveList g_assault_objectivedecreasers;
-STATIC_INIT(g_assault_objectivedecreasers) { g_assault_objectivedecreasers = IL_NEW(); }
-
-IntrusiveList g_assault_objectives;
-STATIC_INIT(g_assault_objectives) { g_assault_objectives = IL_NEW(); }
-
 IntrusiveList g_spawnpoints;
-STATIC_INIT(g_spawnpoints) { g_spawnpoints = IL_NEW(); }
-
 IntrusiveList g_bot_targets;
-STATIC_INIT(g_bot_targets) { g_bot_targets = IL_NEW(); }
-
 IntrusiveList g_bot_dodge;
-STATIC_INIT(g_bot_dodge) { g_bot_dodge = IL_NEW(); }
-
 IntrusiveList g_damagedbycontents;
-STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); }
-
 IntrusiveList g_railgunhit;
-STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); }
-
 IntrusiveList g_ladders;
-STATIC_INIT(g_ladders) { g_ladders = IL_NEW(); }
-
 IntrusiveList g_locations;
-STATIC_INIT(g_locations) { g_locations = IL_NEW(); }
-
 IntrusiveList g_saved_team;
-STATIC_INIT(g_saved_team) { g_saved_team = IL_NEW(); }
-
 IntrusiveList g_monster_targets;
-STATIC_INIT(g_monster_targets) { g_monster_targets = IL_NEW(); }
-
 IntrusiveList g_pathlib_nodes;
-STATIC_INIT(g_pathlib_nodes) { g_pathlib_nodes = IL_NEW(); }
+STATIC_INIT(defs)
+{
+       g_monsters = IL_NEW();
+       g_waypoints = IL_NEW();
+       g_vehicles = IL_NEW();
+       g_turrets = IL_NEW();
+       g_mines = IL_NEW();
+       g_projectiles = IL_NEW();
+       g_items = IL_NEW();
+       g_initforplayer = IL_NEW();
+       g_clones = IL_NEW();
+       g_spawnpoints = IL_NEW();
+       g_bot_targets = IL_NEW();
+       g_bot_dodge = IL_NEW();
+       g_damagedbycontents = IL_NEW();
+       g_railgunhit = IL_NEW();
+       g_ladders = IL_NEW();
+       g_locations = IL_NEW();
+       g_saved_team = IL_NEW();
+       g_monster_targets = IL_NEW();
+       g_pathlib_nodes = IL_NEW();
+}
index 3fb000e708072a5af331a984f1d0563ef5afac99..b36cfc95ac9c4bcf43318ac35d955dc6bb6e90fe 100644 (file)
@@ -779,7 +779,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                        }
                }
 
-               if(!g_instagib)
+               if(!autocvar_g_instagib)
                {
                        // apply strength multiplier
                        if (attacker.items & ITEM_Strength.m_itemid)
@@ -907,7 +907,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        }
 }
 
-float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, 
+float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe,
                                                                float inflictorselfdamage, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity)
        // Returns total damage applies to creatures
 {
index 1026e3aa7a2dfaa6b0a139c3ad75eca12e141f94..c8f85247c8aa775cd3c63d9d3d2c980800db807f 100644 (file)
@@ -8,11 +8,11 @@
 #include "../common/triggers/triggers.qh"
 
 entityclass(BGMScript);
-class(BGMScript) .string bgmscript;
-class(BGMScript) .float bgmscriptattack;
-class(BGMScript) .float bgmscriptdecay;
-class(BGMScript) .float bgmscriptsustain;
-class(BGMScript) .float bgmscriptrelease;
+classfield(BGMScript) .string bgmscript;
+classfield(BGMScript) .float bgmscriptattack;
+classfield(BGMScript) .float bgmscriptdecay;
+classfield(BGMScript) .float bgmscriptsustain;
+classfield(BGMScript) .float bgmscriptrelease;
 
 #include "../common/constants.qh"
 #include "../lib/csqcmodel/sv_model.qh"
index a3bb6eb216e8677b4ae7add94f76dbee46188034..b9c62643163739a9badeb1d2390a458c543c8a28 100644 (file)
@@ -145,12 +145,8 @@ void cvar_changes_init()
        string k, v, d;
        float n, i, adding, pureadding;
 
-       if(cvar_changes)
-               strunzone(cvar_changes);
-       cvar_changes = string_null;
-       if(cvar_purechanges)
-               strunzone(cvar_purechanges);
-       cvar_purechanges = string_null;
+       strfree(cvar_changes);
+       strfree(cvar_purechanges);
        cvar_purechanges_count = 0;
 
        h = buf_create();
@@ -1199,9 +1195,7 @@ void Maplist_Init()
                error("empty maplist, cannot select a new map");
        Map_Current = bound(0, GetMaplistPosition(), Map_Count - 1);
 
-       if(Map_Current_Name)
-               strunzone(Map_Current_Name);
-       Map_Current_Name = strzone(argv(Map_Current)); // will be automatically freed on exit thanks to DP
+       strcpy(Map_Current_Name, argv(Map_Current)); // will be automatically freed on exit thanks to DP
        // this may or may not be correct, but who cares, in the worst case a map
        // isn't chosen in the first pass that should have been
 }
index 98dbf5c55b748d5a4d106f8dadec8fc3e29b412f..cf0eb13b77b7e22a94e598937a24cc5b74b75a59 100644 (file)
@@ -211,12 +211,8 @@ void OnlineBanList_Think(entity this)
        if(argc == 0)
                goto killme;
 
-       if(OnlineBanList_Servers)
-               strunzone(OnlineBanList_Servers);
-       OnlineBanList_Servers = argv(0);
-       for(i = 1; i < argc; ++i)
-               OnlineBanList_Servers = strcat(OnlineBanList_Servers, ";", argv(i));
-       OnlineBanList_Servers = strzone(OnlineBanList_Servers);
+       string s = argv(0); for(i = 1; i < argc; ++i) s = strcat(s, ";", argv(i));
+       strcpy(OnlineBanList_Servers, s);
 
        uri = strcat(     "action=list&hostname=", uri_escape(autocvar_hostname));
        uri = strcat(uri, "&servers=", uri_escape(OnlineBanList_Servers));
index 7d248834f72566af97313317a42a3a50c226f637..04b0ba41d596e05d1c40addc88b06a3e8c2640c2 100644 (file)
@@ -6,6 +6,7 @@
 /// \copyright GNU GPLv2 or any later version.
 
 #include "g_subs.qh"
+#include "mutators/events.qh"
 #include <common/weapons/all.qh>
 
 .bool m_isloot; ///< Holds whether item is loot.
 /// this item is on the ground.
 .bool m_isexpiring;
 
+entity Item_FindDefinition(string class_name)
+{
+       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+       {
+               return it;
+       });
+       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+       {
+               return it.m_pickup;
+       });
+       return NULL;
+}
+
+bool Item_IsAllowed(string class_name)
+{
+       entity definition = Item_FindDefinition(class_name);
+       if (definition == NULL)
+       {
+               return false;
+       }
+       return Item_IsDefinitionAllowed(definition);
+}
+
+bool Item_IsDefinitionAllowed(entity definition)
+{
+       return !MUTATOR_CALLHOOK(FilterItemDefinition, definition);
+}
+
 entity Item_Create(string class_name, vector position, bool no_align)
 {
        entity item = spawn();
index 1abcf64e0879442a3b8ade446bc724ca8250e503..b52449e7158dffab62269d6b17d32a6a7cdcc439 100644 (file)
@@ -4,6 +4,28 @@
 /// \brief Header file that describes the functions related to game items.
 /// \copyright GNU GPLv2 or any later version.
 
+bool startitem_failed;
+
+/// \brief Returns the item definition corresponding to the given class name.
+/// \param[in] class_name Class name to search for.
+/// \return Item definition corresponding to the given class name or NULL is not
+/// found.
+entity Item_FindDefinition(string class_name);
+
+/// \brief Checks whether the items with the specified class name are allowed to
+/// spawn.
+/// \param[in] class_name Item class name to check.
+/// \return True items with the specified class name are allowed to spawn, false
+/// otherwise.
+bool Item_IsAllowed(string class_name);
+
+/// \brief Checks whether the items with the specified definition are allowed to
+/// spawn.
+/// \param[in] definition Item definition to check.
+/// \return True items with the specified definition are allowed to spawn, false
+/// otherwise.
+bool Item_IsDefinitionAllowed(entity definition);
+
 /// \brief Creates a new item.
 /// \param[in] class_name Class name of the item.
 /// \param[in] position Position of the item.
@@ -12,7 +34,7 @@
 /// \return Item on success, NULL otherwise.
 entity Item_Create(string class_name, vector position, bool no_align);
 
-/// \brief Initializes the item according to classname.
+/// \brief Initializes the item according to class name.
 /// \param[in,out] item Item to initialize.
 /// \param[in] class_name Class name to use.
 /// \return No return.
index 209ac7af98085daf7bdffed0fc335eacba721141..816945d2ab0bc9bbdcb50ef78f11b6f813a50597 100644 (file)
@@ -109,16 +109,8 @@ void MapVote_UnzoneStrings()
 {
        for(int j = 0; j < mapvote_count; ++j)
        {
-               if ( mapvote_maps[j] )
-               {
-                       strunzone(mapvote_maps[j]);
-                       mapvote_maps[j] = string_null;
-               }
-               if ( mapvote_maps_pakfile[j] )
-               {
-                       strunzone(mapvote_maps_pakfile[j]);
-                       mapvote_maps_pakfile[j] = string_null;
-               }
+               strfree(mapvote_maps[j]);
+               strfree(mapvote_maps_pakfile[j]);
        }
 }
 
index ff762e9046fd51d89046dbb196a258d3ef02acec..bbbefd5a88f11cbb32e959a313366da154c3de74 100644 (file)
@@ -298,17 +298,13 @@ void GetCvars_handleString(entity this, entity store, string thisname, float f,
 {
        if (f < 0)
        {
-               if (store.(field))
-                       strunzone(store.(field));
-               store.(field) = string_null;
+               strfree(store.(field));
        }
        else if (f > 0)
        {
                if (thisname == name)
                {
-                       if (store.(field))
-                               strunzone(store.(field));
-                       store.(field) = strzone(argv(f + 1));
+                       strcpy(store.(field), argv(f + 1));
                }
        }
        else
@@ -323,8 +319,7 @@ void GetCvars_handleString_Fixup(entity this, entity store, string thisname, flo
                        string s = func(this, strcat1(store.(field)));
                        if (s != store.(field))
                        {
-                               strunzone(store.(field));
-                               store.(field) = strzone(s);
+                               strcpy(store.(field), s);
                        }
                }
 }
@@ -366,14 +361,8 @@ void GetCvars_handleFloatOnce(entity this, entity store, string thisname, float
 }
 string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
 {
-       string o;
-       o = W_FixWeaponOrder_ForceComplete(wo);
-       if(CS(this).weaponorder_byimpulse)
-       {
-               strunzone(CS(this).weaponorder_byimpulse);
-               CS(this).weaponorder_byimpulse = string_null;
-       }
-       CS(this).weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o));
+       string o = W_FixWeaponOrder_ForceComplete(wo);
+       strcpy(CS(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
        return o;
 }
 
index 5538a574428cb4b8cbc5dbbe01dec2aa0f5264c8..41e725946a96cb43c1cd5febd0a04f76deb79359 100644 (file)
@@ -222,8 +222,6 @@ void readlevelcvars()
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
 
-       g_instagib = cvar("g_instagib");
-
        sv_clones = cvar("sv_clones");
        sv_foginterval = cvar("sv_foginterval");
        g_footsteps = cvar("g_footsteps");
index 6853c04a15641dc69bd6e52f7da39615a41610a4..c101be0ccf4b8aa9a53497268e922c3270613192 100644 (file)
@@ -4,6 +4,9 @@
 
 // register all possible hooks here
 
+// to use a hook, first register your mutator using REGISTER_MUTATOR
+// then create your function using MUTATOR_HOOKFUNCTION
+
 /** called when a player becomes observer, after shared setup */
 #define EV_MakePlayerObserver(i, o) \
     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
@@ -229,6 +232,14 @@ MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
     /**/
 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
 
+/** Check if items having the given definition are allowed to spawn.
+ *  Return true to disallow spawning.
+ */
+#define EV_FilterItemDefinition(i, o) \
+    /** item        */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
+
 /**
  * checks if the current item may be spawned (.items and .weapons may be read and written to, as well as the ammo_ fields)
  * return error to request removal
@@ -424,6 +435,8 @@ MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
 #define EV_W_DecreaseAmmo(i, o) \
     /** actor */            i(entity, MUTATOR_ARGV_0_entity) \
     /** weapon entity */    i(entity, MUTATOR_ARGV_1_entity) \
+    /** ammo to take */     i(float, MUTATOR_ARGV_2_float) \
+    /**/                    o(float, MUTATOR_ARGV_2_float) \
     /**/
 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
 
@@ -679,6 +692,26 @@ constants for resource types. Return true to forbid the change. */
        /**/
 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
 
+/** Called after the amount of resource of an entity has changed. See RESOURCE_*
+constants for resource types. Amount wasted is the amount of resource that is
+above resource limit so it was not given. */
+#define EV_ResourceAmountChanged(i, o) \
+       /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
+       /** resource type */  i(int, MUTATOR_ARGV_1_int) \
+       /** amount */         i(float, MUTATOR_ARGV_2_float) \
+       /**/
+MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
+
+/** Called when there was an attempt to set entity resources higher than their
+limit. See RESOURCE_* constants for resource types. Amount wasted is the amount
+of resource that is above resource limit so it was not given. */
+#define EV_ResourceWasted(i, o) \
+       /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
+       /** resource type */  i(int, MUTATOR_ARGV_1_int) \
+       /** amount wasted */  i(float, MUTATOR_ARGV_2_float) \
+       /**/
+MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
+
 /** Called when entity is being given some resource. See RESOURCE_* constants
 for resource types. Return true to forbid giving. */
 #define EV_GiveResource(i, o) \
@@ -690,6 +723,19 @@ for resource types. Return true to forbid giving. */
        /**/
 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
 
+/** Called when entity is being given some resource with specified limit. See
+RESOURCE_* constants for resource types. Return true to forbid giving. */
+#define EV_GiveResourceWithLimit(i, o) \
+       /** receiver */      i(entity, MUTATOR_ARGV_0_entity) \
+       /** resource type */ i(int, MUTATOR_ARGV_1_int) \
+       /**/                 o(int, MUTATOR_ARGV_1_int) \
+       /** amount */        i(float, MUTATOR_ARGV_2_float) \
+       /**/                 o(float, MUTATOR_ARGV_2_float) \
+       /** limit */         i(float, MUTATOR_ARGV_3_float) \
+       /**/                 o(float, MUTATOR_ARGV_3_float) \
+       /**/
+MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
+
 /** called at when a player connect */
 #define EV_ClientConnect(i, o) \
     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
@@ -1071,3 +1117,20 @@ MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
+
+/** called when parsing a vote command. */
+#define EV_VoteCommand_Parse(i, o) \
+    /** caller */                           i(entity, MUTATOR_ARGV_0_entity) \
+    /** first command */                    i(string, MUTATOR_ARGV_1_string) \
+    /** vote command */                     i(string, MUTATOR_ARGV_2_string) \
+    /** start position of vote command */   i(float, MUTATOR_ARGV_3_float) \
+    /** argument count */                   i(float, MUTATOR_ARGV_4_float) \
+    /**/
+MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
+
+enum {
+    MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
+    MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
+    MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
+    MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)
+};
index 70e2669184bb30d3e852f9e7c7bed02478c470a1..d43dc99993adb3474c5cce5baed9baa8cb4d87f7 100644 (file)
@@ -5,6 +5,16 @@
 .entity sprite;
 #define AS_ROUND_DELAY 5
 
+IntrusiveList g_assault_destructibles;
+IntrusiveList g_assault_objectivedecreasers;
+IntrusiveList g_assault_objectives;
+STATIC_INIT(g_assault)
+{
+       g_assault_destructibles = IL_NEW();
+       g_assault_objectivedecreasers = IL_NEW();
+       g_assault_objectives = IL_NEW();
+}
+
 // random functions
 void assault_objective_use(entity this, entity actor, entity trigger)
 {
index b34e3f59f51fe58ac3f5cccb5828b68fae45f242..e0d25e9e8f494c829c8fbf3156f15c92f168cddf 100644 (file)
@@ -2249,8 +2249,7 @@ MUTATOR_HOOKFUNCTION(ctf, GetPressedKeys)
                if(player.stored_netname != player.netname)
                {
                        db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname);
-                       strunzone(player.stored_netname);
-                       player.stored_netname = strzone(player.netname);
+                       strcpy(player.stored_netname, player.netname);
                }
        }
 }
index daaf8a969592e810af3531a1cdcded327b46a8fc..1363411aa9e75c7f388aad0439b6e7ef1abc2371 100644 (file)
@@ -286,8 +286,7 @@ MUTATOR_HOOKFUNCTION(cts, GetPressedKeys)
                if(player.stored_netname != player.netname)
                {
                        db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname);
-                       strunzone(player.stored_netname);
-                       player.stored_netname = strzone(player.netname);
+                       strcpy(player.stored_netname, player.netname);
                }
        }
 
index 1b8b77ae078158e566fb34a87c754701436175d3..777b1b1e97f68bbed062d9f05dcc888523d2a079 100644 (file)
@@ -6,13 +6,14 @@
 #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(); }
-
 IntrusiveList g_invasion_spawns;
-STATIC_INIT(g_invasion_spawns) { g_invasion_spawns = IL_NEW(); }
+STATIC_INIT(g_invasion)
+{
+       g_invasion_roundends = IL_NEW();
+       g_invasion_waves = IL_NEW();
+       g_invasion_spawns = IL_NEW();
+}
 
 float autocvar_g_invasion_round_timelimit;
 float autocvar_g_invasion_spawnpoint_spawn_delay;
index 94c4a998c2cc616b4d3f1f64487eb4b5fb98e42e..a57b2ae2d07ab150bfd494492935da44e421e221 100644 (file)
@@ -317,14 +317,14 @@ MUTATOR_HOOKFUNCTION(lms, ForbidPlayerScore_Clear)
        return true;
 }
 
-MUTATOR_HOOKFUNCTION(lms, FilterItem)
+MUTATOR_HOOKFUNCTION(lms, FilterItemDefinition)
 {
-       entity item = M_ARGV(0, entity);
+       entity definition = M_ARGV(0, entity);
 
-       if(autocvar_g_lms_extra_lives)
-       if(item.itemdef == ITEM_ExtraLife)
+       if (autocvar_g_lms_extra_lives && definition == ITEM_ExtraLife)
+       {
                return false;
-
+       }
        return true;
 }
 
index aa6d12a83e063166da288364d0314e521d3c9970..e4109b72a8523e84bd913951409a50339866ed50 100644 (file)
@@ -325,8 +325,7 @@ MUTATOR_HOOKFUNCTION(rc, GetPressedKeys)
                if(player.stored_netname != player.netname)
                {
                        db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname);
-                       strunzone(player.stored_netname);
-                       player.stored_netname = strzone(player.netname);
+                       strcpy(player.stored_netname, player.netname);
                }
        }
 
index 8804063dc6e5c918cb64e1b2912c2a27e99b8771..743d02d03c0acc1af8d95a94c460131e6a398f94 100644 (file)
@@ -316,9 +316,7 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e,
        }
 
        race_SendRankings(newpos, player_prevpos, 0, MSG_ALL);
-       if(rankings_reply)
-               strunzone(rankings_reply);
-       rankings_reply = strzone(getrankings());
+       strcpy(rankings_reply, getrankings());
 
        if(newpos == player_prevpos)
        {
@@ -366,9 +364,7 @@ void race_deleteTime(string map, float pos)
        if(pos == 1)
                race_send_recordtime(MSG_ALL);
 
-       if(rankings_reply)
-               strunzone(rankings_reply);
-       rankings_reply = strzone(getrankings());
+       strcpy(rankings_reply, getrankings());
 }
 
 void race_SendTime(entity e, float cp, float t, float tvalid)
@@ -442,9 +438,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                                if(t < recordtime || recordtime == 0)
                                {
                                        race_checkpoint_records[cp] = t;
-                                       if(race_checkpoint_recordholders[cp])
-                                               strunzone(race_checkpoint_recordholders[cp]);
-                                       race_checkpoint_recordholders[cp] = strzone(e.netname);
+                                       strcpy(race_checkpoint_recordholders[cp], e.netname);
                                        if(g_race_qualifying)
                                                FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); });
                                }
@@ -1089,9 +1083,7 @@ void race_ClearRecords()
        for(int j = 0; j < MAX_CHECKPOINTS; ++j)
        {
                race_checkpoint_records[j] = 0;
-               if(race_checkpoint_recordholders[j])
-                       strunzone(race_checkpoint_recordholders[j]);
-               race_checkpoint_recordholders[j] = string_null;
+               strfree(race_checkpoint_recordholders[j]);
        }
 
        FOREACH_CLIENT(true, {
index a2a1358b97856196366b7dc95c909c620f2152ec..4ad66bb98ed2169380e7074ea23147a503e652cf 100644 (file)
@@ -83,17 +83,24 @@ void SetResourceAmount(entity e, int resource_type, float amount)
        }
        resource_type = M_ARGV(1, int);
        amount = M_ARGV(2, float);
-       .float resource_field = GetResourceField(resource_type);
-       if (e.(resource_field) == amount)
-       {
-               return;
-       }
        float max_amount = GetResourceLimit(e, resource_type);
+       float amount_wasted = 0;
        if (amount > max_amount)
        {
+               amount_wasted = amount - max_amount;
                amount = max_amount;
        }
-       e.(resource_field) = amount;
+       .float resource_field = GetResourceField(resource_type);
+       if (e.(resource_field) != amount)
+       {
+               e.(resource_field) = amount;
+               MUTATOR_CALLHOOK(ResourceAmountChanged, e, resource_type, amount);
+       }
+       if (amount_wasted == 0)
+       {
+               return;
+       }
+       MUTATOR_CALLHOOK(ResourceWasted, e, resource_type, amount_wasted);
 }
 
 void GiveResource(entity receiver, int resource_type, float amount)
@@ -144,6 +151,19 @@ void GiveResource(entity receiver, int resource_type, float amount)
 void GiveResourceWithLimit(entity receiver, int resource_type, float amount,
        float limit)
 {
+       if (amount == 0)
+       {
+               return;
+       }
+       bool forbid = MUTATOR_CALLHOOK(GiveResourceWithLimit, receiver,
+               resource_type, amount, limit);
+       if (forbid)
+       {
+               return;
+       }
+       resource_type = M_ARGV(1, int);
+       amount = M_ARGV(2, float);
+       limit = M_ARGV(3, float);
        if (amount == 0)
        {
                return;
index 3f1db42903ddd010c209febba24f608cba1c1840..67c115c8a56ff7dfc2135e973c693f6476762efa 100644 (file)
@@ -535,9 +535,7 @@ void WinningConditionHelper(entity this)
                }
        }
 
-       if(worldstatus)
-               strunzone(worldstatus);
-       worldstatus = strzone(s);
+       strcpy(worldstatus, s);
 
        FOREACH_CLIENT(true, {
                string s = "";
@@ -556,9 +554,7 @@ void WinningConditionHelper(entity this)
                                s = "-666";
                }
 
-               if(it.clientstatus)
-                       strunzone(it.clientstatus);
-               it.clientstatus = strzone(s);
+               strcpy(it.clientstatus, s);
        });
 }
 
index cf21de4bfd3978ac2942e03eb0e7ccafa6234318..43aa4a26bd24e61d362d64dce55f33090ee88c9a 100644 (file)
@@ -131,12 +131,8 @@ string getwelcomemessage(entity this)
 
        if(cache_lastmutatormsg != autocvar_g_mutatormsg)
        {
-               if(cache_lastmutatormsg)
-                       strunzone(cache_lastmutatormsg);
-               if(cache_mutatormsg)
-                       strunzone(cache_mutatormsg);
-               cache_lastmutatormsg = strzone(autocvar_g_mutatormsg);
-               cache_mutatormsg = strzone(cache_lastmutatormsg);
+               strcpy(cache_lastmutatormsg, autocvar_g_mutatormsg);
+               strcpy(cache_mutatormsg, cache_lastmutatormsg);
        }
 
        if (cache_mutatormsg != "") {
index d47351cb37a727aab87f100d2ccb61ddd98a5824..17f2ddeeee2bb567271f1f689c8376494168a5a6 100644 (file)
@@ -88,6 +88,13 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                }
        }
 
+       if (!Item_IsDefinitionAllowed(wpn.m_pickup))
+       {
+               delete(this);
+               startitem_failed = true;
+               return;
+       }
+
        if (!this.respawntime)
        {
                if (wpn.spawnflags & WEP_FLAG_SUPERWEAPON)
index 809db42710815711c3da5177035c0a1cc1affe2c..8bfcbb79cfb37d58734f12493f2e3f922d844ea7 100644 (file)
@@ -576,7 +576,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                                key_pressed = false;
 
                        Weapon off = actor.offhand;
-                       if (off && !(actor.weapons & WEPSET(HOOK)))
+                       if (off && (!(actor.weapons & WEPSET(HOOK)) || off != OFFHAND_HOOK))
                        {
                                if (off.offhand_think) off.offhand_think(off, actor, key_pressed);
                        }
@@ -660,9 +660,11 @@ void W_AttachToShotorg(entity actor, .entity weaponentity, entity flash, vector
 
 void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponentity)
 {
-       if (MUTATOR_CALLHOOK(W_DecreaseAmmo, actor, actor.(weaponentity))) return;
+       if (MUTATOR_CALLHOOK(W_DecreaseAmmo, actor, actor.(weaponentity), ammo_use)) return;
        if ((actor.items & IT_UNLIMITED_WEAPON_AMMO) && !wep.reloading_ammo) return;
 
+       ammo_use = M_ARGV(2, float);
+
        entity w_ent = actor.(weaponentity);
 
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
@@ -741,8 +743,7 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen
        this.reload_ammo_min = sent_ammo_min;
        this.reload_ammo_amount = e.reloading_ammo;
        this.reload_time = e.reloading_time;
-       if (actor.reload_sound) strunzone(actor.reload_sound);
-       actor.reload_sound = strzone(Sound_fixpath(sent_sound));
+       strcpy(actor.reload_sound, Sound_fixpath(sent_sound));
 
        // don't reload weapons that don't have the RELOADABLE flag
        if (!(e.spawnflags & WEP_FLAG_RELOADABLE))
index 15cbfc4aab5a222f8a06da9091884057c5f84fe3..865e6e592ca48c037932fa643ec80e9dd1b20f83 100755 (executable)
@@ -32,7 +32,7 @@ function qpp() {
     err=$?
     set -e
     if [ ${err} -ne 0 ]; then return ${err}; fi
-    sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' "${WORKDIR}/${MODE}.txt"
+    sed -E 's/^#(line)? ([[:digit:]]+) "(.*)".*/'$'\\\n''#pragma file(\3)'$'\\\n''#pragma line(\2)/g' "${WORKDIR}/${MODE}.txt"
 }
 
 function qcc() {
diff --git a/ruleset-nexuiz.cfg b/ruleset-nexuiz.cfg
new file mode 100644 (file)
index 0000000..7441942
--- /dev/null
@@ -0,0 +1,11 @@
+exec xonotic-server.cfg
+
+exec balance-nexuiz25.cfg
+exec physicsNexuiz26.cfg
+
+sv_gameplayfix_delayprojectiles 1
+
+// new toys to restore the weapons
+g_new_toys 1
+g_new_toys_autoreplace 0
+g_new_toys_use_pickupsound 0
index 8f1457a034a07e6d4caf2edfdea024d68d55079a..6a56fac3c26c2e002446c9465cd4c8fee4737cfd 100644 (file)
@@ -116,6 +116,7 @@ set skill_auto 0    "when 1, \"skill\" gets adjusted to match the best player on th
 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."
+set bot_typefrag 0 "Allow bots to shoot players while they're typing"
 // general bot AI cvars
 set bot_ai_thinkinterval 0.05
 set bot_ai_strategyinterval 7 "How often a new objective is chosen"
@@ -178,7 +179,7 @@ set bot_vs_human 0  "Bots and humans play in different teams when set. positive v
 
 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 2        "AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2 = server side hit scan in the past)"
 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"