]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/menu_optimization
authorterencehill <piuntn@gmail.com>
Sun, 13 Dec 2015 23:51:54 +0000 (00:51 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 13 Dec 2015 23:51:54 +0000 (00:51 +0100)
172 files changed:
defaultXonotic.cfg
minigames/bulldozer/storage_level6.txt
minigames/bulldozer/storage_level7.txt [new file with mode: 0644]
minigames/bulldozer/storage_level8.txt [new file with mode: 0644]
minigames/bulldozer/storage_level9.txt [new file with mode: 0644]
models/ok_nade_counter/ok_nade_counter.md3_9.skin
models/weapons/overkillbullet.tga [deleted file]
models/weapons/overkillbullet_gloss.tga [deleted file]
models/weapons/overkillbullet_reflect.tga [deleted file]
qcsrc/Makefile
qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/defs.qh
qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/client/miscfunctions.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/progs.inc
qcsrc/client/progs.src [deleted file]
qcsrc/client/scoreboard.qc
qcsrc/client/view.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/animdecide.qc
qcsrc/common/animdecide.qh
qcsrc/common/command/all.qh
qcsrc/common/command/command.qh
qcsrc/common/command/generic.qc
qcsrc/common/debug.qh
qcsrc/common/effects/effectinfo.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/effects/qc/globalsound.qh
qcsrc/common/ent_cs.qh
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/impulses/all.qc [new file with mode: 0644]
qcsrc/common/impulses/all.qh [new file with mode: 0644]
qcsrc/common/mapinfo.qc
qcsrc/common/minigames/cl_minigames.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/minigames/sv_minigames.qh
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/mutators/base.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/nades/nades.inc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/new_toys/new_toys.qc
qcsrc/common/mutators/mutator/nix/nix.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/pinata/pinata.qc
qcsrc/common/net_notice.qc
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/common/physics.qc
qcsrc/common/sounds/all.qc
qcsrc/common/sounds/sound.qh
qcsrc/common/state.qh [new file with mode: 0644]
qcsrc/common/stats.qh
qcsrc/common/teams.qh
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/util.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/config.qh
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/_all.inc
qcsrc/lib/arraylist.qh
qcsrc/lib/csqcmodel/cl_player.qc
qcsrc/lib/i18n.qh
qcsrc/lib/iter.qh
qcsrc/lib/linkedlist.qh
qcsrc/lib/log.qh
qcsrc/lib/macro.qh [new file with mode: 0644]
qcsrc/lib/misc.qh
qcsrc/lib/net.qh
qcsrc/lib/oo.qh
qcsrc/lib/registry.qh
qcsrc/lib/sort.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/stats.qh
qcsrc/lib/string.qh
qcsrc/lib/test.qh
qcsrc/lib/unsafe.qh
qcsrc/lib/vector.qh
qcsrc/menu/draw.qh
qcsrc/menu/menu.qc
qcsrc/menu/progs.src [deleted file]
qcsrc/menu/xonotic/credits.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/skinlist.qc
qcsrc/server/_all.qh
qcsrc/server/autocvars.qh
qcsrc/server/bot/aim.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/cheats.qc
qcsrc/server/cheats.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_impulse.qh
qcsrc/server/cl_player.qc
qcsrc/server/command/all.qh
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qc
qcsrc/server/playerdemo.qc
qcsrc/server/progs.inc
qcsrc/server/progs.src [deleted file]
qcsrc/server/scores.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/weaponsystem.qc
textures/overkillbullet.tga [new file with mode: 0644]
textures/overkillbullet_gloss.tga [new file with mode: 0644]
textures/overkillbullet_reflect.tga [new file with mode: 0644]
xonotic-credits.txt [deleted file]

index 5bd49b8ff4af75e2ece339e0d1e1f7eafa2966da..b132da40bd9478b0b9404b02cc6dc14209db7b38 100644 (file)
@@ -1008,16 +1008,16 @@ set g_jump_grunt 0      "Do you make a grunting noise every time you jump? Is it the
 
 seta cl_weaponpriority "vaporizer vortex fireball mortar machinegun hagar rifle arc electro devastator crylink minelayer shotgun hlac tuba blaster porto seeker hook" "weapon priority list"
 seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wheel makes use of the weapon priority list (the special value 2 uses the weapon ID list for cycling)"
-seta cl_weaponpriority0 "devastator mortar hagar seeker fireball" "use impulse 200 for prev gun from this list, 210 for best gun, 220 for next gun.  Default value: explosives"
-seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave"             "use impulse 201 for prev gun from this list, 211 for best gun, 221 for next gun.  Default value: energy"
-seta cl_weaponpriority2 "vaporizer vortex rifle"                           "use impulse 202 for prev gun from this list, 212 for best gun, 222 for next gun.  Default value: hitscan exact"
-seta cl_weaponpriority3 "vaporizer vortex rifle machinegun shotgun"               "use impulse 203 for prev gun from this list, 213 for best gun, 223 for next gun.  Default value: hitscan all"
-seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun"    "use impulse 204 for prev gun from this list, 214 for best gun, 224 for next gun.  Default value: spam weapons"
-seta cl_weaponpriority5 "blaster shockwave hook porto"                                     "use impulse 205 for prev gun from this list, 215 for best gun, 225 for next gun.  Default value: weapons for moving"
-seta cl_weaponpriority6 "" "use impulse 206 for prev gun from this list, 216 for best gun, 226 for next gun"
-seta cl_weaponpriority7 "" "use impulse 207 for prev gun from this list, 217 for best gun, 227 for next gun"
-seta cl_weaponpriority8 "" "use impulse 208 for prev gun from this list, 218 for best gun, 228 for next gun"
-seta cl_weaponpriority9 "" "use impulse 209 for prev gun from this list, 219 for best gun, 229 for next gun"
+seta cl_weaponpriority0 "devastator mortar hagar seeker fireball"                       "use weapon_priority_0_prev for prev gun from this list, weapon_priority_0_best for best gun, weapon_priority_0_next for next gun.  Default value: explosives"
+seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave"   "use weapon_priority_1_prev for prev gun from this list, weapon_priority_1_best for best gun, weapon_priority_1_next for next gun.  Default value: energy"
+seta cl_weaponpriority2 "vaporizer vortex rifle"                                        "use weapon_priority_2_prev for prev gun from this list, weapon_priority_2_best for best gun, weapon_priority_2_next for next gun.  Default value: hitscan exact"
+seta cl_weaponpriority3 "vaporizer vortex rifle machinegun shotgun"                     "use weapon_priority_3_prev for prev gun from this list, weapon_priority_3_best for best gun, weapon_priority_3_next for next gun.  Default value: hitscan all"
+seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun"            "use weapon_priority_4_prev for prev gun from this list, weapon_priority_4_best for best gun, weapon_priority_4_next for next gun.  Default value: spam weapons"
+seta cl_weaponpriority5 "blaster shockwave hook porto"                                  "use weapon_priority_5_prev for prev gun from this list, weapon_priority_5_best for best gun, weapon_priority_5_next for next gun.  Default value: weapons for moving"
+seta cl_weaponpriority6 ""                                                              "use weapon_priority_6_prev for prev gun from this list, weapon_priority_6_best for best gun, weapon_priority_6_next for next gun"
+seta cl_weaponpriority7 ""                                                              "use weapon_priority_7_prev for prev gun from this list, weapon_priority_7_best for best gun, weapon_priority_7_next for next gun"
+seta cl_weaponpriority8 ""                                                              "use weapon_priority_8_prev for prev gun from this list, weapon_priority_8_best for best gun, weapon_priority_8_next for next gun"
+seta cl_weaponpriority9 ""                                                              "use weapon_priority_9_prev for prev gun from this list, weapon_priority_9_best for best gun, weapon_priority_9_next for next gun"
 seta cl_weaponimpulsemode 0 "0: only cycle between currently usable weapons in weapon priority order; 1: cycle between all possible weapons on a key in weapon priority order"
 
 set g_maplist_allow_hidden 0           "allow hidden maps to be, e.g., voted for and in the maplist"
index 42e3186cd7aecdd591bc90aa3841efe4a1a33398..44a8137f4b00630343ada72d38b9ed465eca00cf 100644 (file)
-// bulldozer storage "level4" last updated 16-11-2015 04:16:07
-nextlevel = "level1"
-"e15" 3 "0 0 0"
-"f14" 3 "0 0 0"
-"g13" 3 "0 0 0"
-"k13" 3 "0 0 0"
-"b14" 4 "0 0 0"
-"a14" 4 "0 0 0"
-"a13" 4 "0 0 0"
-"b13" 4 "0 0 0"
-"i13" 3 "0 0 0"
-"m13" 3 "0 0 0"
-"n14" 3 "0 0 0"
-"o15" 3 "0 0 0"
-"h17" 2 "0 0 0"
-"l17" 2 "0 0 0"
-"c12" 2 "0 0 0"
-"c13" 2 "0 0 0"
-"c14" 2 "0 0 0"
-"r14" 2 "0 0 0"
-"r13" 2 "0 0 0"
-"r12" 2 "0 0 0"
-"j15" 1 "0 -1 0"
-"s13" 4 "0 0 0"
-"t13" 4 "0 0 0"
-"t12" 4 "0 0 0"
-"s12" 4 "0 0 0"
-"b12" 4 "0 0 0"
-"a12" 4 "0 0 0"
-"a11" 4 "0 0 0"
-"b11" 4 "0 0 0"
-"c11" 4 "0 0 0"
-"d11" 4 "0 0 0"
-"e11" 4 "0 0 0"
-"f11" 4 "0 0 0"
-"g11" 4 "0 0 0"
-"h11" 4 "0 0 0"
-"i11" 4 "0 0 0"
-"j11" 4 "0 0 0"
-"k11" 4 "0 0 0"
-"l11" 4 "0 0 0"
-"m11" 4 "0 0 0"
-"n11" 4 "0 0 0"
-"o11" 4 "0 0 0"
-"p11" 4 "0 0 0"
-"q11" 4 "0 0 0"
-"r11" 4 "0 0 0"
-"s11" 4 "0 0 0"
-"t11" 4 "0 0 0"
-"t6" 6 "0 0 0"
-"s10" 4 "0 0 0"
-"r10" 4 "0 0 0"
-"q10" 4 "0 0 0"
-"b10" 6 "0 0 0"
-"o10" 4 "0 0 0"
-"c10" 6 "0 0 0"
-"d10" 6 "0 0 0"
-"e6" 4 "0 0 0"
-"b9" 6 "0 0 0"
-"b8" 6 "0 0 0"
-"c7" 4 "0 0 0"
-"b7" 6 "0 0 0"
-"b6" 6 "0 0 0"
-"c6" 6 "0 0 0"
-"d6" 6 "0 0 0"
-"f10" 6 "0 0 0"
-"g10" 6 "0 0 0"
-"h10" 6 "0 0 0"
-"a10" 4 "0 0 0"
-"a9" 4 "0 0 0"
-"h9" 4 "0 0 0"
-"c9" 4 "0 0 0"
-"d9" 4 "0 0 0"
-"h8" 4 "0 0 0"
-"h7" 4 "0 0 0"
-"i10" 6 "0 0 0"
-"i9" 6 "0 0 0"
-"j7" 4 "0 0 0"
-"j6" 4 "0 0 0"
-"j10" 4 "0 0 0"
-"i8" 6 "0 0 0"
-"m9" 4 "0 0 0"
-"i7" 6 "0 0 0"
-"o9" 4 "0 0 0"
-"i6" 6 "0 0 0"
-"q9" 4 "0 0 0"
-"r9" 4 "0 0 0"
-"s9" 4 "0 0 0"
-"h6" 6 "0 0 0"
-"g6" 6 "0 0 0"
-"s8" 4 "0 0 0"
-"r8" 4 "0 0 0"
-"q8" 4 "0 0 0"
-"f6" 6 "0 0 0"
-"o8" 4 "0 0 0"
-"f7" 6 "0 0 0"
-"m8" 4 "0 0 0"
-"f8" 6 "0 0 0"
-"f9" 6 "0 0 0"
-"k10" 6 "0 0 0"
-"e10" 4 "0 0 0"
-"d7" 4 "0 0 0"
-"e9" 4 "0 0 0"
-"e8" 4 "0 0 0"
-"e7" 4 "0 0 0"
-"l10" 6 "0 0 0"
-"c8" 4 "0 0 0"
-"m10" 6 "0 0 0"
-"a8" 4 "0 0 0"
-"a7" 4 "0 0 0"
-"g7" 4 "0 0 0"
-"g8" 4 "0 0 0"
-"g9" 4 "0 0 0"
-"n10" 6 "0 0 0"
-"n9" 6 "0 0 0"
-"n8" 6 "0 0 0"
-"d8" 4 "0 0 0"
-"n7" 6 "0 0 0"
-"n6" 6 "0 0 0"
-"m6" 6 "0 0 0"
-"l6" 6 "0 0 0"
-"m7" 4 "0 0 0"
-"k6" 6 "0 0 0"
-"o7" 4 "0 0 0"
-"k7" 6 "0 0 0"
-"q7" 4 "0 0 0"
-"r7" 4 "0 0 0"
-"s7" 4 "0 0 0"
-"k8" 6 "0 0 0"
-"k9" 6 "0 0 0"
-"s6" 4 "0 0 0"
-"p9" 6 "0 0 0"
-"p8" 6 "0 0 0"
-"p7" 6 "0 0 0"
-"o6" 4 "0 0 0"
-"p6" 6 "0 0 0"
-"q6" 6 "0 0 0"
-"r6" 6 "0 0 0"
-"p10" 6 "0 0 0"
-"j9" 4 "0 0 0"
-"j8" 4 "0 0 0"
-"t10" 6 "0 0 0"
-"t9" 6 "0 0 0"
-"t8" 6 "0 0 0"
-"l7" 4 "0 0 0"
-"l8" 4 "0 0 0"
-"l9" 4 "0 0 0"
-"t7" 4 "0 0 0"
-"a6" 4 "0 0 0"
-"a5" 4 "0 0 0"
-"b5" 4 "0 0 0"
-"c5" 4 "0 0 0"
-"d5" 4 "0 0 0"
-"e5" 4 "0 0 0"
-"f5" 4 "0 0 0"
-"g5" 4 "0 0 0"
-"h5" 4 "0 0 0"
-"i5" 4 "0 0 0"
-"j5" 4 "0 0 0"
-"k5" 4 "0 0 0"
-"l5" 4 "0 0 0"
-"m5" 4 "0 0 0"
-"n5" 4 "0 0 0"
-"o5" 4 "0 0 0"
-"p5" 4 "0 0 0"
-"q5" 4 "0 0 0"
-"r5" 4 "0 0 0"
-"s5" 4 "0 0 0"
-"t5" 4 "0 0 0"
-"t4" 4 "0 0 0"
-"s4" 4 "0 0 0"
-"r4" 4 "0 0 0"
-"q4" 4 "0 0 0"
-"p4" 4 "0 0 0"
-"o4" 4 "0 0 0"
-"n4" 4 "0 0 0"
-"m4" 4 "0 0 0"
-"l4" 4 "0 0 0"
-"k4" 4 "0 0 0"
-"j4" 4 "0 0 0"
-"i4" 4 "0 0 0"
-"h4" 4 "0 0 0"
-"g4" 4 "0 0 0"
-"f4" 4 "0 0 0"
-"e4" 4 "0 0 0"
-"d4" 4 "0 0 0"
-"c4" 4 "0 0 0"
-"b4" 4 "0 0 0"
-"a4" 4 "0 0 0"
-"a3" 4 "0 0 0"
-"b3" 4 "0 0 0"
-"c3" 4 "0 0 0"
-"d3" 4 "0 0 0"
-"e3" 4 "0 0 0"
-"f3" 4 "0 0 0"
-"g3" 4 "0 0 0"
-"h3" 4 "0 0 0"
-"i3" 4 "0 0 0"
-"j3" 4 "0 0 0"
-"k3" 4 "0 0 0"
-"l3" 4 "0 0 0"
-"m3" 4 "0 0 0"
-"n3" 4 "0 0 0"
-"o3" 4 "0 0 0"
-"p3" 4 "0 0 0"
-"q3" 4 "0 0 0"
-"r3" 4 "0 0 0"
-"s3" 4 "0 0 0"
-"t3" 4 "0 0 0"
-"t2" 4 "0 0 0"
-"s2" 4 "0 0 0"
-"r2" 4 "0 0 0"
-"q2" 4 "0 0 0"
-"p2" 4 "0 0 0"
-"o2" 4 "0 0 0"
-"n2" 4 "0 0 0"
-"m2" 4 "0 0 0"
-"l2" 4 "0 0 0"
-"k2" 4 "0 0 0"
-"j2" 4 "0 0 0"
-"i2" 4 "0 0 0"
-"h2" 4 "0 0 0"
-"g2" 4 "0 0 0"
-"f2" 4 "0 0 0"
-"e2" 4 "0 0 0"
-"d2" 4 "0 0 0"
-"c2" 4 "0 0 0"
-"b2" 4 "0 0 0"
-"a2" 4 "0 0 0"
-"a1" 4 "0 0 0"
-"b1" 4 "0 0 0"
-"c1" 4 "0 0 0"
-"d1" 4 "0 0 0"
-"e1" 4 "0 0 0"
-"f1" 4 "0 0 0"
-"g1" 4 "0 0 0"
-"h1" 4 "0 0 0"
-"i1" 4 "0 0 0"
-"j1" 4 "0 0 0"
-"k1" 4 "0 0 0"
-"l1" 4 "0 0 0"
-"m1" 4 "0 0 0"
-"n1" 4 "0 0 0"
-"o1" 4 "0 0 0"
-"p1" 4 "0 0 0"
-"q1" 4 "0 0 0"
-"r1" 4 "0 0 0"
-"s1" 4 "0 0 0"
-"t1" 4 "0 0 0"
-"t14" 4 "0 0 0"
-"s14" 4 "0 0 0"
-"b15" 4 "0 0 0"
-"a15" 4 "0 0 0"
-"a16" 4 "0 0 0"
-"b16" 4 "0 0 0"
-"s16" 4 "0 0 0"
-"t16" 4 "0 0 0"
-"t15" 4 "0 0 0"
-"s15" 4 "0 0 0"
-"t17" 4 "0 0 0"
-"s17" 4 "0 0 0"
-"b17" 4 "0 0 0"
-"a17" 4 "0 0 0"
-"a18" 4 "0 0 0"
-"b18" 4 "0 0 0"
-"s18" 4 "0 0 0"
-"t18" 4 "0 0 0"
-"t19" 4 "0 0 0"
-"s19" 4 "0 0 0"
-"r19" 4 "0 0 0"
-"q19" 4 "0 0 0"
-"p19" 4 "0 0 0"
-"o19" 4 "0 0 0"
-"n19" 4 "0 0 0"
-"m19" 4 "0 0 0"
-"l19" 4 "0 0 0"
-"k19" 4 "0 0 0"
-"j19" 4 "0 0 0"
-"i19" 4 "0 0 0"
-"h19" 4 "0 0 0"
-"g19" 4 "0 0 0"
-"f19" 4 "0 0 0"
-"e19" 4 "0 0 0"
-"d19" 4 "0 0 0"
-"c19" 4 "0 0 0"
-"b19" 4 "0 0 0"
-"a19" 4 "0 0 0"
-"a20" 4 "0 0 0"
-"b20" 4 "0 0 0"
-"c20" 4 "0 0 0"
-"d20" 4 "0 0 0"
-"e20" 4 "0 0 0"
-"f20" 4 "0 0 0"
-"g20" 4 "0 0 0"
-"h20" 4 "0 0 0"
-"i20" 4 "0 0 0"
-"j20" 4 "0 0 0"
-"k20" 4 "0 0 0"
-"l20" 4 "0 0 0"
-"m20" 4 "0 0 0"
-"n20" 4 "0 0 0"
-"o20" 4 "0 0 0"
-"p20" 4 "0 0 0"
-"q20" 4 "0 0 0"
-"r20" 4 "0 0 0"
-"s20" 4 "0 0 0"
-"t20" 4 "0 0 0"
+// bulldozer storage "level6" last updated 06-12-2015 16:11:35
+nextlevel = "level7"
+"g13" 5 "0 -1 0"
+"f13" 5 "0 -1 0"
+"f12" 5 "0 -1 0"
+"f11" 5 "0 -1 0"
+"f10" 5 "0 -1 0"
+"g10" 5 "0 -1 0"
+"i9" 5 "0 -1 0"
+"g9" 5 "0 -1 0"
+"h9" 5 "0 -1 0"
+"j9" 5 "0 -1 0"
+"k9" 5 "0 -1 0"
+"l9" 5 "0 -1 0"
+"m9" 5 "0 -1 0"
+"n9" 5 "0 -1 0"
+"n10" 5 "0 -1 0"
+"o12" 5 "0 -1 0"
+"n11" 5 "0 -1 0"
+"o11" 5 "0 -1 0"
+"n14" 5 "0 -1 0"
+"o13" 5 "0 -1 0"
+"o14" 5 "0 -1 0"
+"m14" 5 "0 -1 0"
+"l15" 5 "0 -1 0"
+"m15" 5 "0 -1 0"
+"g14" 5 "0 -1 0"
+"g15" 5 "0 -1 0"
+"h15" 5 "0 -1 0"
+"i15" 5 "0 -1 0"
+"j15" 5 "0 -1 0"
+"k15" 5 "0 -1 0"
+"i13" 5 "0 -1 0"
+"j13" 5 "0 -1 0"
+"k13" 5 "0 -1 0"
+"j10" 5 "0 -1 0"
+"j11" 5 "0 -1 0"
+"h10" 2 "0 -1 0"
+"i10" 2 "0 -1 0"
+"h11" 2 "0 -1 0"
+"i11" 2 "0 -1 0"
+"g12" 1 "0 -1 0"
+"h13" 3 "0 -1 0"
+"j12" 3 "0 -1 0"
+"l11" 3 "0 -1 0"
+"m12" 3 "0 -1 0"
+"b2" 4 "0 -1 0"
+"b3" 4 "0 -1 0"
+"c3" 4 "0 -1 0"
+"c2" 4 "0 -1 0"
+"b19" 4 "0 -1 0"
+"b18" 4 "0 -1 0"
+"c18" 4 "0 -1 0"
+"c19" 4 "0 -1 0"
+"r19" 4 "0 -1 0"
+"r18" 4 "0 -1 0"
+"s18" 4 "0 -1 0"
+"s19" 4 "0 -1 0"
+"r2" 4 "0 -1 0"
+"r3" 4 "0 -1 0"
+"s3" 4 "0 -1 0"
+"s2" 4 "0 -1 0"
+"f5" 6 "0 -1 0"
+"e5" 6 "0 -1 0"
+"d5" 6 "0 -1 0"
+"c5" 6 "0 -1 0"
+"b5" 6 "0 -1 0"
+"a5" 6 "0 -1 0"
+"a4" 6 "0 -1 0"
+"b4" 6 "0 -1 0"
+"c4" 6 "0 -1 0"
+"d4" 6 "0 -1 0"
+"e4" 6 "0 -1 0"
+"f4" 6 "0 -1 0"
+"g4" 6 "0 -1 0"
+"h4" 6 "0 -1 0"
+"i4" 6 "0 -1 0"
+"j4" 6 "0 -1 0"
+"k4" 6 "0 -1 0"
+"l4" 6 "0 -1 0"
+"m4" 6 "0 -1 0"
+"n4" 6 "0 -1 0"
+"o4" 6 "0 -1 0"
+"p4" 6 "0 -1 0"
+"q4" 6 "0 -1 0"
+"r4" 6 "0 -1 0"
+"s4" 6 "0 -1 0"
+"t4" 6 "0 -1 0"
+"t3" 6 "0 -1 0"
+"t2" 6 "0 -1 0"
+"t1" 6 "0 -1 0"
+"s1" 6 "0 -1 0"
+"r1" 6 "0 -1 0"
+"q1" 6 "0 -1 0"
+"p1" 6 "0 -1 0"
+"o1" 6 "0 -1 0"
+"n1" 6 "0 -1 0"
+"m1" 6 "0 -1 0"
+"l1" 6 "0 -1 0"
+"k1" 6 "0 -1 0"
+"j1" 6 "0 -1 0"
+"i1" 6 "0 -1 0"
+"h1" 6 "0 -1 0"
+"g1" 6 "0 -1 0"
+"f1" 6 "0 -1 0"
+"e1" 6 "0 -1 0"
+"d1" 6 "0 -1 0"
+"c1" 6 "0 -1 0"
+"b1" 6 "0 -1 0"
+"a1" 6 "0 -1 0"
+"a2" 6 "0 -1 0"
+"a3" 6 "0 -1 0"
+"d2" 6 "0 -1 0"
+"e2" 6 "0 -1 0"
+"f2" 6 "0 -1 0"
+"g2" 6 "0 -1 0"
+"h2" 6 "0 -1 0"
+"i2" 6 "0 -1 0"
+"j2" 6 "0 -1 0"
+"k2" 6 "0 -1 0"
+"l2" 6 "0 -1 0"
+"m2" 6 "0 -1 0"
+"n2" 6 "0 -1 0"
+"o2" 6 "0 -1 0"
+"p2" 6 "0 -1 0"
+"q2" 6 "0 -1 0"
+"q3" 6 "0 -1 0"
+"p3" 6 "0 -1 0"
+"o3" 6 "0 -1 0"
+"n3" 6 "0 -1 0"
+"m3" 6 "0 -1 0"
+"l3" 6 "0 -1 0"
+"k3" 6 "0 -1 0"
+"j3" 6 "0 -1 0"
+"i3" 6 "0 -1 0"
+"h3" 6 "0 -1 0"
+"g3" 6 "0 -1 0"
+"f3" 6 "0 -1 0"
+"e3" 6 "0 -1 0"
+"d3" 6 "0 -1 0"
+"t5" 6 "0 -1 0"
+"s5" 6 "0 -1 0"
+"r5" 6 "0 -1 0"
+"q5" 6 "0 -1 0"
+"p5" 6 "0 -1 0"
+"o5" 6 "0 -1 0"
+"n5" 6 "0 -1 0"
+"m5" 6 "0 -1 0"
+"l5" 6 "0 -1 0"
+"k5" 6 "0 -1 0"
+"j5" 6 "0 -1 0"
+"i5" 6 "0 -1 0"
+"h5" 6 "0 -1 0"
+"g5" 6 "0 -1 0"
+"g6" 6 "0 -1 0"
+"f6" 6 "0 -1 0"
+"e6" 6 "0 -1 0"
+"d6" 6 "0 -1 0"
+"c6" 6 "0 -1 0"
+"b6" 6 "0 -1 0"
+"a6" 6 "0 -1 0"
+"a7" 6 "0 -1 0"
+"b7" 6 "0 -1 0"
+"c7" 6 "0 -1 0"
+"d7" 6 "0 -1 0"
+"e7" 6 "0 -1 0"
+"f7" 6 "0 -1 0"
+"g7" 6 "0 -1 0"
+"h7" 6 "0 -1 0"
+"i7" 6 "0 -1 0"
+"j7" 6 "0 -1 0"
+"k7" 6 "0 -1 0"
+"l7" 6 "0 -1 0"
+"m7" 6 "0 -1 0"
+"n7" 6 "0 -1 0"
+"o7" 6 "0 -1 0"
+"p7" 6 "0 -1 0"
+"q7" 6 "0 -1 0"
+"r7" 6 "0 -1 0"
+"s7" 6 "0 -1 0"
+"t7" 6 "0 -1 0"
+"t6" 6 "0 -1 0"
+"s6" 6 "0 -1 0"
+"r6" 6 "0 -1 0"
+"q6" 6 "0 -1 0"
+"p6" 6 "0 -1 0"
+"o6" 6 "0 -1 0"
+"n6" 6 "0 -1 0"
+"m6" 6 "0 -1 0"
+"l6" 6 "0 -1 0"
+"k6" 6 "0 -1 0"
+"j6" 6 "0 -1 0"
+"i6" 6 "0 -1 0"
+"h6" 6 "0 -1 0"
+"t8" 6 "0 -1 0"
+"s8" 6 "0 -1 0"
+"r8" 6 "0 -1 0"
+"q8" 6 "0 -1 0"
+"p8" 6 "0 -1 0"
+"o8" 6 "0 -1 0"
+"n8" 6 "0 -1 0"
+"m8" 6 "0 -1 0"
+"l8" 6 "0 -1 0"
+"k8" 6 "0 -1 0"
+"j8" 6 "0 -1 0"
+"i8" 6 "0 -1 0"
+"h8" 6 "0 -1 0"
+"g8" 6 "0 -1 0"
+"f8" 6 "0 -1 0"
+"e8" 6 "0 -1 0"
+"d8" 6 "0 -1 0"
+"c8" 6 "0 -1 0"
+"b8" 6 "0 -1 0"
+"a8" 6 "0 -1 0"
+"a9" 6 "0 -1 0"
+"b9" 6 "0 -1 0"
+"c9" 6 "0 -1 0"
+"d9" 6 "0 -1 0"
+"e9" 6 "0 -1 0"
+"f9" 6 "0 -1 0"
+"e10" 6 "0 -1 0"
+"d10" 6 "0 -1 0"
+"c10" 6 "0 -1 0"
+"b10" 6 "0 -1 0"
+"a10" 6 "0 -1 0"
+"a11" 6 "0 -1 0"
+"b11" 6 "0 -1 0"
+"c11" 6 "0 -1 0"
+"d11" 6 "0 -1 0"
+"e11" 6 "0 -1 0"
+"e12" 6 "0 -1 0"
+"d12" 6 "0 -1 0"
+"c12" 6 "0 -1 0"
+"b12" 6 "0 -1 0"
+"a12" 6 "0 -1 0"
+"a13" 6 "0 -1 0"
+"b13" 6 "0 -1 0"
+"c13" 6 "0 -1 0"
+"d13" 6 "0 -1 0"
+"e13" 6 "0 -1 0"
+"e14" 6 "0 -1 0"
+"d14" 6 "0 -1 0"
+"c14" 6 "0 -1 0"
+"b14" 6 "0 -1 0"
+"a14" 6 "0 -1 0"
+"a15" 6 "0 -1 0"
+"b15" 6 "0 -1 0"
+"c15" 6 "0 -1 0"
+"d15" 6 "0 -1 0"
+"e15" 6 "0 -1 0"
+"f15" 6 "0 -1 0"
+"f14" 6 "0 -1 0"
+"f16" 6 "0 -1 0"
+"e16" 6 "0 -1 0"
+"d16" 6 "0 -1 0"
+"c16" 6 "0 -1 0"
+"b16" 6 "0 -1 0"
+"a16" 6 "0 -1 0"
+"a17" 6 "0 -1 0"
+"b17" 6 "0 -1 0"
+"c17" 6 "0 -1 0"
+"d17" 6 "0 -1 0"
+"e17" 6 "0 -1 0"
+"f17" 6 "0 -1 0"
+"g17" 6 "0 -1 0"
+"h17" 6 "0 -1 0"
+"i17" 6 "0 -1 0"
+"j17" 6 "0 -1 0"
+"k17" 6 "0 -1 0"
+"l17" 6 "0 -1 0"
+"m17" 6 "0 -1 0"
+"n17" 6 "0 -1 0"
+"o17" 6 "0 -1 0"
+"p17" 6 "0 -1 0"
+"q17" 6 "0 -1 0"
+"r17" 6 "0 -1 0"
+"s17" 6 "0 -1 0"
+"t17" 6 "0 -1 0"
+"t16" 6 "0 -1 0"
+"s16" 6 "0 -1 0"
+"r16" 6 "0 -1 0"
+"q16" 6 "0 -1 0"
+"p16" 6 "0 -1 0"
+"o16" 6 "0 -1 0"
+"n16" 6 "0 -1 0"
+"m16" 6 "0 -1 0"
+"l16" 6 "0 -1 0"
+"k16" 6 "0 -1 0"
+"j16" 6 "0 -1 0"
+"i16" 6 "0 -1 0"
+"h16" 6 "0 -1 0"
+"g16" 6 "0 -1 0"
+"n15" 6 "0 -1 0"
+"o15" 6 "0 -1 0"
+"p15" 6 "0 -1 0"
+"q15" 6 "0 -1 0"
+"r15" 6 "0 -1 0"
+"s15" 6 "0 -1 0"
+"t15" 6 "0 -1 0"
+"t14" 6 "0 -1 0"
+"s14" 6 "0 -1 0"
+"r14" 6 "0 -1 0"
+"q14" 6 "0 -1 0"
+"p14" 6 "0 -1 0"
+"p13" 6 "0 -1 0"
+"q13" 6 "0 -1 0"
+"r13" 6 "0 -1 0"
+"s13" 6 "0 -1 0"
+"t13" 6 "0 -1 0"
+"t12" 6 "0 -1 0"
+"s12" 6 "0 -1 0"
+"r12" 6 "0 -1 0"
+"q12" 6 "0 -1 0"
+"p12" 6 "0 -1 0"
+"p11" 6 "0 -1 0"
+"q11" 6 "0 -1 0"
+"r11" 6 "0 -1 0"
+"s11" 6 "0 -1 0"
+"t11" 6 "0 -1 0"
+"t10" 6 "0 -1 0"
+"s10" 6 "0 -1 0"
+"r10" 6 "0 -1 0"
+"q10" 6 "0 -1 0"
+"p10" 6 "0 -1 0"
+"o10" 6 "0 -1 0"
+"o9" 6 "0 -1 0"
+"p9" 6 "0 -1 0"
+"q9" 6 "0 -1 0"
+"r9" 6 "0 -1 0"
+"s9" 6 "0 -1 0"
+"t9" 6 "0 -1 0"
+"t18" 6 "0 -1 0"
+"t19" 6 "0 -1 0"
+"t20" 6 "0 -1 0"
+"s20" 6 "0 -1 0"
+"r20" 6 "0 -1 0"
+"q20" 6 "0 -1 0"
+"p20" 6 "0 -1 0"
+"o20" 6 "0 -1 0"
+"n20" 6 "0 -1 0"
+"m20" 6 "0 -1 0"
+"l20" 6 "0 -1 0"
+"k20" 6 "0 -1 0"
+"j20" 6 "0 -1 0"
+"i20" 6 "0 -1 0"
+"h20" 6 "0 -1 0"
+"g20" 6 "0 -1 0"
+"f20" 6 "0 -1 0"
+"e20" 6 "0 -1 0"
+"d20" 6 "0 -1 0"
+"c20" 6 "0 -1 0"
+"b20" 6 "0 -1 0"
+"a20" 6 "0 -1 0"
+"a19" 6 "0 -1 0"
+"a18" 6 "0 -1 0"
+"d19" 6 "0 -1 0"
+"e19" 6 "0 -1 0"
+"f19" 6 "0 -1 0"
+"g19" 6 "0 -1 0"
+"h19" 6 "0 -1 0"
+"i19" 6 "0 -1 0"
+"j19" 6 "0 -1 0"
+"k19" 6 "0 -1 0"
+"l19" 6 "0 -1 0"
+"m19" 6 "0 -1 0"
+"n19" 6 "0 -1 0"
+"o19" 6 "0 -1 0"
+"p19" 6 "0 -1 0"
+"q19" 6 "0 -1 0"
+"q18" 6 "0 -1 0"
+"p18" 6 "0 -1 0"
+"o18" 6 "0 -1 0"
+"n18" 6 "0 -1 0"
+"m18" 6 "0 -1 0"
+"l18" 6 "0 -1 0"
+"k18" 6 "0 -1 0"
+"j18" 6 "0 -1 0"
+"i18" 6 "0 -1 0"
+"h18" 6 "0 -1 0"
+"g18" 6 "0 -1 0"
+"f18" 6 "0 -1 0"
+"e18" 6 "0 -1 0"
+"d18" 6 "0 -1 0"
diff --git a/minigames/bulldozer/storage_level7.txt b/minigames/bulldozer/storage_level7.txt
new file mode 100644 (file)
index 0000000..5f351c6
--- /dev/null
@@ -0,0 +1,386 @@
+// bulldozer storage "level7" last updated 06-12-2015 16:19:03
+nextlevel = "level8"
+"g10" 5 "0 -1 0"
+"g9" 5 "0 -1 0"
+"g8" 5 "0 -1 0"
+"g11" 5 "0 -1 0"
+"g12" 5 "0 -1 0"
+"h8" 5 "0 -1 0"
+"i8" 5 "0 -1 0"
+"j8" 5 "0 -1 0"
+"l8" 5 "0 -1 0"
+"k8" 5 "0 -1 0"
+"m8" 5 "0 -1 0"
+"n8" 5 "0 -1 0"
+"n9" 5 "0 -1 0"
+"n10" 5 "0 -1 0"
+"n11" 5 "0 -1 0"
+"n12" 5 "0 -1 0"
+"m12" 5 "0 -1 0"
+"m13" 5 "0 -1 0"
+"m14" 5 "0 -1 0"
+"h12" 5 "0 -1 0"
+"h13" 5 "0 -1 0"
+"h14" 5 "0 -1 0"
+"h15" 5 "0 -1 0"
+"i15" 5 "0 -1 0"
+"j15" 5 "0 -1 0"
+"k15" 5 "0 -1 0"
+"k14" 5 "0 -1 0"
+"l14" 5 "0 -1 0"
+"k12" 5 "0 -1 0"
+"k11" 5 "0 -1 0"
+"i12" 5 "0 -1 0"
+"i11" 5 "0 -1 0"
+"l10" 5 "0 -1 0"
+"j14" 1 "0 -1 0"
+"j13" 3 "0 -1 0"
+"i10" 3 "0 -1 0"
+"l9" 3 "0 -1 0"
+"h11" 2 "0 -1 0"
+"h10" 2 "0 -1 0"
+"h9" 2 "0 -1 0"
+"a19" 6 "0 -1 0"
+"b20" 6 "0 -1 0"
+"b18" 6 "0 -1 0"
+"a17" 6 "0 -1 0"
+"b16" 6 "0 -1 0"
+"a15" 6 "0 -1 0"
+"b14" 6 "0 -1 0"
+"a13" 6 "0 -1 0"
+"b12" 6 "0 -1 0"
+"a10" 11 "0 -1 0"
+"b10" 6 "0 -1 0"
+"a7" 6 "0 -1 0"
+"a9" 6 "0 -1 0"
+"b8" 6 "0 -1 0"
+"b6" 6 "0 -1 0"
+"a5" 6 "0 -1 0"
+"b4" 6 "0 -1 0"
+"a3" 6 "0 -1 0"
+"b2" 6 "0 -1 0"
+"a1" 6 "0 -1 0"
+"c1" 6 "0 -1 0"
+"d2" 6 "0 -1 0"
+"e1" 6 "0 -1 0"
+"c3" 6 "0 -1 0"
+"c5" 6 "0 -1 0"
+"c7" 6 "0 -1 0"
+"c9" 6 "0 -1 0"
+"c11" 6 "0 -1 0"
+"c13" 6 "0 -1 0"
+"c15" 6 "0 -1 0"
+"c17" 6 "0 -1 0"
+"c19" 6 "0 -1 0"
+"d20" 6 "0 -1 0"
+"d18" 6 "0 -1 0"
+"d16" 6 "0 -1 0"
+"d14" 6 "0 -1 0"
+"d12" 6 "0 -1 0"
+"d10" 6 "0 -1 0"
+"d8" 6 "0 -1 0"
+"d6" 6 "0 -1 0"
+"d4" 6 "0 -1 0"
+"e3" 6 "0 -1 0"
+"e9" 6 "0 -1 0"
+"e5" 6 "0 -1 0"
+"e7" 6 "0 -1 0"
+"e11" 6 "0 -1 0"
+"e13" 6 "0 -1 0"
+"e15" 6 "0 -1 0"
+"e17" 6 "0 -1 0"
+"e19" 6 "0 -1 0"
+"a20" 11 "0 -1 0"
+"b19" 11 "0 -1 0"
+"a18" 11 "0 -1 0"
+"a16" 11 "0 -1 0"
+"a14" 11 "0 -1 0"
+"a12" 11 "0 -1 0"
+"a8" 11 "0 -1 0"
+"a6" 11 "0 -1 0"
+"a4" 11 "0 -1 0"
+"a2" 11 "0 -1 0"
+"b1" 11 "0 -1 0"
+"b3" 11 "0 -1 0"
+"b5" 11 "0 -1 0"
+"b7" 11 "0 -1 0"
+"b9" 11 "0 -1 0"
+"b11" 11 "0 -1 0"
+"b13" 11 "0 -1 0"
+"b15" 11 "0 -1 0"
+"b17" 11 "0 -1 0"
+"c20" 11 "0 -1 0"
+"c18" 11 "0 -1 0"
+"c16" 11 "0 -1 0"
+"c14" 11 "0 -1 0"
+"c12" 11 "0 -1 0"
+"c10" 11 "0 -1 0"
+"c8" 11 "0 -1 0"
+"c6" 11 "0 -1 0"
+"c4" 11 "0 -1 0"
+"c2" 11 "0 -1 0"
+"d1" 11 "0 -1 0"
+"d3" 11 "0 -1 0"
+"d5" 11 "0 -1 0"
+"d7" 11 "0 -1 0"
+"d9" 11 "0 -1 0"
+"d11" 11 "0 -1 0"
+"d13" 11 "0 -1 0"
+"d15" 11 "0 -1 0"
+"d17" 11 "0 -1 0"
+"d19" 11 "0 -1 0"
+"e20" 11 "0 -1 0"
+"e18" 11 "0 -1 0"
+"e16" 11 "0 -1 0"
+"e14" 11 "0 -1 0"
+"e12" 11 "0 -1 0"
+"e10" 11 "0 -1 0"
+"e8" 11 "0 -1 0"
+"e6" 11 "0 -1 0"
+"e4" 11 "0 -1 0"
+"e2" 11 "0 -1 0"
+"a11" 6 "0 -1 0"
+"p1" 6 "0 -1 0"
+"p3" 6 "0 -1 0"
+"p5" 6 "0 -1 0"
+"p7" 6 "0 -1 0"
+"p9" 6 "0 -1 0"
+"p15" 6 "0 -1 0"
+"p11" 6 "0 -1 0"
+"p13" 6 "0 -1 0"
+"q20" 6 "0 -1 0"
+"p17" 6 "0 -1 0"
+"p19" 6 "0 -1 0"
+"q18" 6 "0 -1 0"
+"q16" 6 "0 -1 0"
+"q14" 6 "0 -1 0"
+"q12" 6 "0 -1 0"
+"q10" 6 "0 -1 0"
+"q8" 6 "0 -1 0"
+"q6" 6 "0 -1 0"
+"q4" 6 "0 -1 0"
+"q2" 6 "0 -1 0"
+"r1" 6 "0 -1 0"
+"r3" 6 "0 -1 0"
+"r5" 6 "0 -1 0"
+"r7" 6 "0 -1 0"
+"r9" 6 "0 -1 0"
+"r11" 6 "0 -1 0"
+"r13" 6 "0 -1 0"
+"r15" 6 "0 -1 0"
+"r17" 6 "0 -1 0"
+"r19" 6 "0 -1 0"
+"s20" 6 "0 -1 0"
+"s18" 6 "0 -1 0"
+"s16" 6 "0 -1 0"
+"s14" 6 "0 -1 0"
+"s12" 6 "0 -1 0"
+"s10" 6 "0 -1 0"
+"s8" 6 "0 -1 0"
+"s6" 6 "0 -1 0"
+"s4" 6 "0 -1 0"
+"s2" 6 "0 -1 0"
+"t1" 6 "0 -1 0"
+"t3" 6 "0 -1 0"
+"t5" 6 "0 -1 0"
+"t7" 6 "0 -1 0"
+"t9" 6 "0 -1 0"
+"t11" 6 "0 -1 0"
+"t13" 6 "0 -1 0"
+"t14" 11 "0 -1 0"
+"t17" 6 "0 -1 0"
+"t19" 6 "0 -1 0"
+"p20" 11 "0 -1 0"
+"p18" 11 "0 -1 0"
+"p16" 11 "0 -1 0"
+"p14" 11 "0 -1 0"
+"p12" 11 "0 -1 0"
+"p10" 11 "0 -1 0"
+"p8" 11 "0 -1 0"
+"p6" 11 "0 -1 0"
+"p4" 11 "0 -1 0"
+"p2" 11 "0 -1 0"
+"q1" 11 "0 -1 0"
+"q3" 11 "0 -1 0"
+"q5" 11 "0 -1 0"
+"q7" 11 "0 -1 0"
+"q9" 11 "0 -1 0"
+"q11" 11 "0 -1 0"
+"q13" 11 "0 -1 0"
+"q15" 11 "0 -1 0"
+"q17" 11 "0 -1 0"
+"q19" 11 "0 -1 0"
+"r20" 11 "0 -1 0"
+"r18" 11 "0 -1 0"
+"r16" 11 "0 -1 0"
+"r14" 11 "0 -1 0"
+"r12" 11 "0 -1 0"
+"r10" 11 "0 -1 0"
+"r8" 11 "0 -1 0"
+"r6" 11 "0 -1 0"
+"r4" 11 "0 -1 0"
+"r2" 11 "0 -1 0"
+"s1" 11 "0 -1 0"
+"s3" 11 "0 -1 0"
+"s5" 11 "0 -1 0"
+"s7" 11 "0 -1 0"
+"s9" 11 "0 -1 0"
+"s11" 11 "0 -1 0"
+"s13" 11 "0 -1 0"
+"s15" 11 "0 -1 0"
+"s17" 11 "0 -1 0"
+"s19" 11 "0 -1 0"
+"t20" 11 "0 -1 0"
+"t18" 11 "0 -1 0"
+"t16" 11 "0 -1 0"
+"t10" 11 "0 -1 0"
+"t12" 11 "0 -1 0"
+"t8" 11 "0 -1 0"
+"t6" 11 "0 -1 0"
+"t4" 11 "0 -1 0"
+"t2" 11 "0 -1 0"
+"t15" 6 "0 -1 0"
+"h18" 4 "0 -1 0"
+"g18" 4 "0 -1 0"
+"f18" 4 "0 -1 0"
+"f17" 4 "0 -1 0"
+"g17" 4 "0 -1 0"
+"h17" 4 "0 -1 0"
+"i17" 4 "0 -1 0"
+"j17" 4 "0 -1 0"
+"k17" 4 "0 -1 0"
+"l17" 4 "0 -1 0"
+"m17" 4 "0 -1 0"
+"n17" 4 "0 -1 0"
+"o17" 4 "0 -1 0"
+"o16" 4 "0 -1 0"
+"n16" 4 "0 -1 0"
+"m16" 4 "0 -1 0"
+"l16" 4 "0 -1 0"
+"k16" 4 "0 -1 0"
+"j16" 4 "0 -1 0"
+"i16" 4 "0 -1 0"
+"h16" 4 "0 -1 0"
+"g16" 4 "0 -1 0"
+"f16" 4 "0 -1 0"
+"f15" 4 "0 -1 0"
+"g15" 4 "0 -1 0"
+"g14" 4 "0 -1 0"
+"f14" 4 "0 -1 0"
+"f13" 4 "0 -1 0"
+"g13" 4 "0 -1 0"
+"f12" 4 "0 -1 0"
+"f11" 4 "0 -1 0"
+"f10" 4 "0 -1 0"
+"f9" 4 "0 -1 0"
+"f8" 4 "0 -1 0"
+"f7" 4 "0 -1 0"
+"g7" 4 "0 -1 0"
+"h7" 4 "0 -1 0"
+"i7" 4 "0 -1 0"
+"j7" 4 "0 -1 0"
+"k7" 4 "0 -1 0"
+"l7" 4 "0 -1 0"
+"m7" 4 "0 -1 0"
+"n7" 4 "0 -1 0"
+"o7" 4 "0 -1 0"
+"o6" 4 "0 -1 0"
+"n6" 4 "0 -1 0"
+"m6" 4 "0 -1 0"
+"l6" 4 "0 -1 0"
+"k6" 4 "0 -1 0"
+"j6" 4 "0 -1 0"
+"i6" 4 "0 -1 0"
+"h6" 4 "0 -1 0"
+"g6" 4 "0 -1 0"
+"f6" 4 "0 -1 0"
+"f5" 4 "0 -1 0"
+"g5" 4 "0 -1 0"
+"h5" 4 "0 -1 0"
+"i5" 4 "0 -1 0"
+"j5" 4 "0 -1 0"
+"k5" 4 "0 -1 0"
+"l5" 4 "0 -1 0"
+"m5" 4 "0 -1 0"
+"n5" 4 "0 -1 0"
+"o5" 4 "0 -1 0"
+"o4" 4 "0 -1 0"
+"n4" 4 "0 -1 0"
+"m4" 4 "0 -1 0"
+"l4" 4 "0 -1 0"
+"k4" 4 "0 -1 0"
+"j4" 4 "0 -1 0"
+"i4" 4 "0 -1 0"
+"h4" 4 "0 -1 0"
+"g4" 4 "0 -1 0"
+"f4" 4 "0 -1 0"
+"f3" 4 "0 -1 0"
+"g3" 4 "0 -1 0"
+"h3" 4 "0 -1 0"
+"i3" 4 "0 -1 0"
+"j3" 4 "0 -1 0"
+"k3" 4 "0 -1 0"
+"l3" 4 "0 -1 0"
+"m3" 4 "0 -1 0"
+"n3" 4 "0 -1 0"
+"o3" 4 "0 -1 0"
+"o2" 4 "0 -1 0"
+"n2" 4 "0 -1 0"
+"m2" 4 "0 -1 0"
+"l2" 4 "0 -1 0"
+"k2" 4 "0 -1 0"
+"j2" 4 "0 -1 0"
+"i2" 4 "0 -1 0"
+"h2" 4 "0 -1 0"
+"g2" 4 "0 -1 0"
+"f2" 4 "0 -1 0"
+"f1" 4 "0 -1 0"
+"g1" 4 "0 -1 0"
+"h1" 4 "0 -1 0"
+"i1" 4 "0 -1 0"
+"j1" 4 "0 -1 0"
+"k1" 4 "0 -1 0"
+"l1" 4 "0 -1 0"
+"m1" 4 "0 -1 0"
+"n1" 4 "0 -1 0"
+"o1" 4 "0 -1 0"
+"o8" 4 "0 -1 0"
+"o9" 4 "0 -1 0"
+"o10" 4 "0 -1 0"
+"o11" 4 "0 -1 0"
+"o12" 4 "0 -1 0"
+"o13" 4 "0 -1 0"
+"n13" 4 "0 -1 0"
+"n14" 4 "0 -1 0"
+"o14" 4 "0 -1 0"
+"o15" 4 "0 -1 0"
+"n15" 4 "0 -1 0"
+"m15" 4 "0 -1 0"
+"l15" 4 "0 -1 0"
+"o18" 4 "0 -1 0"
+"n18" 4 "0 -1 0"
+"m18" 4 "0 -1 0"
+"l18" 4 "0 -1 0"
+"k18" 4 "0 -1 0"
+"j18" 4 "0 -1 0"
+"i18" 4 "0 -1 0"
+"i19" 4 "0 -1 0"
+"h19" 4 "0 -1 0"
+"g19" 4 "0 -1 0"
+"f19" 4 "0 -1 0"
+"f20" 4 "0 -1 0"
+"g20" 4 "0 -1 0"
+"h20" 4 "0 -1 0"
+"i20" 4 "0 -1 0"
+"j20" 4 "0 -1 0"
+"k20" 4 "0 -1 0"
+"l20" 4 "0 -1 0"
+"m20" 4 "0 -1 0"
+"n20" 4 "0 -1 0"
+"o20" 4 "0 -1 0"
+"o19" 4 "0 -1 0"
+"n19" 4 "0 -1 0"
+"m19" 4 "0 -1 0"
+"l19" 4 "0 -1 0"
+"k19" 4 "0 -1 0"
+"j19" 4 "0 -1 0"
diff --git a/minigames/bulldozer/storage_level8.txt b/minigames/bulldozer/storage_level8.txt
new file mode 100644 (file)
index 0000000..2d461a0
--- /dev/null
@@ -0,0 +1,383 @@
+// bulldozer storage "level8" last updated 06-12-2015 16:23:34
+nextlevel = "level9"
+"e13" 5 "0 -1 0"
+"e12" 5 "0 -1 0"
+"e11" 5 "0 -1 0"
+"e10" 5 "0 -1 0"
+"e9" 5 "0 -1 0"
+"f9" 5 "0 -1 0"
+"g9" 5 "0 -1 0"
+"h9" 5 "0 -1 0"
+"i10" 5 "0 -1 0"
+"i9" 5 "0 -1 0"
+"i11" 5 "0 -1 0"
+"j11" 5 "0 -1 0"
+"k11" 5 "0 -1 0"
+"l11" 5 "0 -1 0"
+"l10" 5 "0 -1 0"
+"l9" 5 "0 -1 0"
+"n9" 5 "0 -1 0"
+"m9" 5 "0 -1 0"
+"o9" 5 "0 -1 0"
+"o10" 5 "0 -1 0"
+"p10" 5 "0 -1 0"
+"p11" 5 "0 -1 0"
+"p12" 5 "0 -1 0"
+"o13" 5 "0 -1 0"
+"p13" 5 "0 -1 0"
+"o14" 5 "0 -1 0"
+"n14" 5 "0 -1 0"
+"l14" 5 "0 -1 0"
+"f14" 5 "0 -1 0"
+"g14" 5 "0 -1 0"
+"h14" 5 "0 -1 0"
+"i14" 5 "0 -1 0"
+"j14" 5 "0 -1 0"
+"m14" 5 "0 -1 0"
+"k14" 5 "0 -1 0"
+"f13" 5 "0 -1 0"
+"j13" 5 "0 -1 0"
+"i12" 2 "0 -1 0"
+"l12" 2 "0 -1 0"
+"j12" 2 "0 -1 0"
+"k12" 2 "0 -1 0"
+"h13" 1 "0 -1 0"
+"g12" 3 "0 -1 0"
+"h11" 3 "0 -1 0"
+"m12" 3 "0 -1 0"
+"n11" 3 "0 -1 0"
+"d13" 8 "0 -1 0"
+"d15" 8 "0 -1 0"
+"b16" 8 "0 -1 0"
+"b14" 8 "0 -1 0"
+"b12" 8 "0 -1 0"
+"b10" 8 "0 -1 0"
+"b8" 8 "0 -1 0"
+"d11" 8 "0 -1 0"
+"d9" 8 "0 -1 0"
+"d7" 8 "0 -1 0"
+"q10" 8 "0 -1 0"
+"q8" 8 "0 -1 0"
+"s15" 8 "0 -1 0"
+"s7" 8 "0 -1 0"
+"s9" 8 "0 -1 0"
+"s11" 8 "0 -1 0"
+"s13" 8 "0 -1 0"
+"q12" 8 "0 -1 0"
+"q14" 8 "0 -1 0"
+"q16" 8 "0 -1 0"
+"h17" 4 "0 -1 0"
+"g17" 4 "0 -1 0"
+"f17" 4 "0 -1 0"
+"e17" 4 "0 -1 0"
+"d17" 4 "0 -1 0"
+"c17" 4 "0 -1 0"
+"b17" 4 "0 -1 0"
+"a17" 4 "0 -1 0"
+"a16" 4 "0 -1 0"
+"a15" 4 "0 -1 0"
+"b15" 4 "0 -1 0"
+"c15" 4 "0 -1 0"
+"c14" 4 "0 -1 0"
+"d14" 4 "0 -1 0"
+"e14" 4 "0 -1 0"
+"e15" 4 "0 -1 0"
+"f15" 4 "0 -1 0"
+"g15" 4 "0 -1 0"
+"h15" 4 "0 -1 0"
+"i15" 4 "0 -1 0"
+"j15" 4 "0 -1 0"
+"k15" 4 "0 -1 0"
+"l15" 4 "0 -1 0"
+"m15" 4 "0 -1 0"
+"n15" 4 "0 -1 0"
+"o15" 4 "0 -1 0"
+"p15" 4 "0 -1 0"
+"q15" 4 "0 -1 0"
+"r15" 4 "0 -1 0"
+"r14" 4 "0 -1 0"
+"s14" 4 "0 -1 0"
+"t14" 4 "0 -1 0"
+"t13" 4 "0 -1 0"
+"t12" 4 "0 -1 0"
+"s12" 4 "0 -1 0"
+"r12" 4 "0 -1 0"
+"r11" 4 "0 -1 0"
+"q11" 4 "0 -1 0"
+"r10" 4 "0 -1 0"
+"s10" 4 "0 -1 0"
+"t10" 4 "0 -1 0"
+"t9" 4 "0 -1 0"
+"t8" 4 "0 -1 0"
+"s8" 4 "0 -1 0"
+"r8" 4 "0 -1 0"
+"r7" 4 "0 -1 0"
+"q7" 4 "0 -1 0"
+"p7" 4 "0 -1 0"
+"o7" 4 "0 -1 0"
+"n7" 4 "0 -1 0"
+"m7" 4 "0 -1 0"
+"l7" 4 "0 -1 0"
+"k7" 4 "0 -1 0"
+"j7" 4 "0 -1 0"
+"i7" 4 "0 -1 0"
+"h7" 4 "0 -1 0"
+"g7" 4 "0 -1 0"
+"f7" 4 "0 -1 0"
+"e7" 4 "0 -1 0"
+"e6" 4 "0 -1 0"
+"d6" 4 "0 -1 0"
+"c6" 4 "0 -1 0"
+"b6" 4 "0 -1 0"
+"a6" 4 "0 -1 0"
+"a5" 4 "0 -1 0"
+"b5" 4 "0 -1 0"
+"c5" 4 "0 -1 0"
+"d5" 4 "0 -1 0"
+"e5" 4 "0 -1 0"
+"f5" 4 "0 -1 0"
+"g5" 4 "0 -1 0"
+"h5" 4 "0 -1 0"
+"i5" 4 "0 -1 0"
+"j5" 4 "0 -1 0"
+"k5" 4 "0 -1 0"
+"l5" 4 "0 -1 0"
+"m5" 4 "0 -1 0"
+"n5" 4 "0 -1 0"
+"o5" 4 "0 -1 0"
+"p5" 4 "0 -1 0"
+"q5" 4 "0 -1 0"
+"r5" 4 "0 -1 0"
+"s5" 4 "0 -1 0"
+"t5" 4 "0 -1 0"
+"t4" 4 "0 -1 0"
+"s4" 4 "0 -1 0"
+"r4" 4 "0 -1 0"
+"q4" 4 "0 -1 0"
+"p4" 4 "0 -1 0"
+"o4" 4 "0 -1 0"
+"n4" 4 "0 -1 0"
+"m4" 4 "0 -1 0"
+"l4" 4 "0 -1 0"
+"k4" 4 "0 -1 0"
+"j4" 4 "0 -1 0"
+"i4" 4 "0 -1 0"
+"h4" 4 "0 -1 0"
+"g4" 4 "0 -1 0"
+"f4" 4 "0 -1 0"
+"e4" 4 "0 -1 0"
+"d4" 4 "0 -1 0"
+"c4" 4 "0 -1 0"
+"b4" 4 "0 -1 0"
+"a4" 4 "0 -1 0"
+"a3" 4 "0 -1 0"
+"b3" 4 "0 -1 0"
+"c3" 4 "0 -1 0"
+"d3" 4 "0 -1 0"
+"e3" 4 "0 -1 0"
+"f3" 4 "0 -1 0"
+"g3" 4 "0 -1 0"
+"h3" 4 "0 -1 0"
+"i3" 4 "0 -1 0"
+"j3" 4 "0 -1 0"
+"k3" 4 "0 -1 0"
+"l3" 4 "0 -1 0"
+"m3" 4 "0 -1 0"
+"n3" 4 "0 -1 0"
+"o3" 4 "0 -1 0"
+"p3" 4 "0 -1 0"
+"q3" 4 "0 -1 0"
+"r3" 4 "0 -1 0"
+"s3" 4 "0 -1 0"
+"t3" 4 "0 -1 0"
+"t2" 4 "0 -1 0"
+"s2" 4 "0 -1 0"
+"r2" 4 "0 -1 0"
+"q2" 4 "0 -1 0"
+"p2" 4 "0 -1 0"
+"o2" 4 "0 -1 0"
+"n2" 4 "0 -1 0"
+"m2" 4 "0 -1 0"
+"l2" 4 "0 -1 0"
+"k2" 4 "0 -1 0"
+"j2" 4 "0 -1 0"
+"i2" 4 "0 -1 0"
+"h2" 4 "0 -1 0"
+"g2" 4 "0 -1 0"
+"f2" 4 "0 -1 0"
+"e2" 4 "0 -1 0"
+"d2" 4 "0 -1 0"
+"c2" 4 "0 -1 0"
+"b2" 4 "0 -1 0"
+"a2" 4 "0 -1 0"
+"a1" 4 "0 -1 0"
+"b1" 4 "0 -1 0"
+"c1" 4 "0 -1 0"
+"d1" 4 "0 -1 0"
+"e1" 4 "0 -1 0"
+"f1" 4 "0 -1 0"
+"g1" 4 "0 -1 0"
+"h1" 4 "0 -1 0"
+"i1" 4 "0 -1 0"
+"j1" 4 "0 -1 0"
+"k1" 4 "0 -1 0"
+"l1" 4 "0 -1 0"
+"m1" 4 "0 -1 0"
+"n1" 4 "0 -1 0"
+"o1" 4 "0 -1 0"
+"p1" 4 "0 -1 0"
+"q1" 4 "0 -1 0"
+"r1" 4 "0 -1 0"
+"s1" 4 "0 -1 0"
+"t1" 4 "0 -1 0"
+"t6" 4 "0 -1 0"
+"s6" 4 "0 -1 0"
+"r6" 4 "0 -1 0"
+"q6" 4 "0 -1 0"
+"p6" 4 "0 -1 0"
+"o6" 4 "0 -1 0"
+"n6" 4 "0 -1 0"
+"m6" 4 "0 -1 0"
+"l6" 4 "0 -1 0"
+"k6" 4 "0 -1 0"
+"j6" 4 "0 -1 0"
+"i6" 4 "0 -1 0"
+"h6" 4 "0 -1 0"
+"g6" 4 "0 -1 0"
+"f6" 4 "0 -1 0"
+"t7" 4 "0 -1 0"
+"a7" 4 "0 -1 0"
+"b7" 4 "0 -1 0"
+"c7" 4 "0 -1 0"
+"c8" 4 "0 -1 0"
+"d8" 4 "0 -1 0"
+"e8" 4 "0 -1 0"
+"f8" 4 "0 -1 0"
+"g8" 4 "0 -1 0"
+"h8" 4 "0 -1 0"
+"i8" 4 "0 -1 0"
+"j8" 4 "0 -1 0"
+"k8" 4 "0 -1 0"
+"l8" 4 "0 -1 0"
+"m8" 4 "0 -1 0"
+"n8" 4 "0 -1 0"
+"o8" 4 "0 -1 0"
+"p8" 4 "0 -1 0"
+"p9" 4 "0 -1 0"
+"q9" 4 "0 -1 0"
+"r9" 4 "0 -1 0"
+"k9" 4 "0 -1 0"
+"j9" 4 "0 -1 0"
+"j10" 4 "0 -1 0"
+"k10" 4 "0 -1 0"
+"c9" 4 "0 -1 0"
+"b9" 4 "0 -1 0"
+"a9" 4 "0 -1 0"
+"a8" 4 "0 -1 0"
+"a10" 4 "0 -1 0"
+"a11" 4 "0 -1 0"
+"b11" 4 "0 -1 0"
+"c11" 4 "0 -1 0"
+"c10" 4 "0 -1 0"
+"d10" 4 "0 -1 0"
+"c12" 4 "0 -1 0"
+"d12" 4 "0 -1 0"
+"c13" 4 "0 -1 0"
+"b13" 4 "0 -1 0"
+"a13" 4 "0 -1 0"
+"a12" 4 "0 -1 0"
+"a14" 4 "0 -1 0"
+"t11" 4 "0 -1 0"
+"r13" 4 "0 -1 0"
+"q13" 4 "0 -1 0"
+"t15" 4 "0 -1 0"
+"t16" 4 "0 -1 0"
+"s16" 4 "0 -1 0"
+"r16" 4 "0 -1 0"
+"r17" 4 "0 -1 0"
+"q17" 4 "0 -1 0"
+"p17" 4 "0 -1 0"
+"o17" 4 "0 -1 0"
+"n17" 4 "0 -1 0"
+"m17" 4 "0 -1 0"
+"l17" 4 "0 -1 0"
+"k17" 4 "0 -1 0"
+"j17" 4 "0 -1 0"
+"i17" 4 "0 -1 0"
+"i16" 4 "0 -1 0"
+"h16" 4 "0 -1 0"
+"g16" 4 "0 -1 0"
+"f16" 4 "0 -1 0"
+"e16" 4 "0 -1 0"
+"d16" 4 "0 -1 0"
+"c16" 4 "0 -1 0"
+"j16" 4 "0 -1 0"
+"k16" 4 "0 -1 0"
+"l16" 4 "0 -1 0"
+"m16" 4 "0 -1 0"
+"n16" 4 "0 -1 0"
+"o16" 4 "0 -1 0"
+"p16" 4 "0 -1 0"
+"i18" 4 "0 -1 0"
+"h18" 4 "0 -1 0"
+"g18" 4 "0 -1 0"
+"f18" 4 "0 -1 0"
+"e18" 4 "0 -1 0"
+"d18" 4 "0 -1 0"
+"c18" 4 "0 -1 0"
+"b18" 4 "0 -1 0"
+"a18" 4 "0 -1 0"
+"a19" 4 "0 -1 0"
+"b19" 4 "0 -1 0"
+"c19" 4 "0 -1 0"
+"d19" 4 "0 -1 0"
+"e19" 4 "0 -1 0"
+"f19" 4 "0 -1 0"
+"g19" 4 "0 -1 0"
+"h19" 4 "0 -1 0"
+"i19" 4 "0 -1 0"
+"j19" 4 "0 -1 0"
+"k19" 4 "0 -1 0"
+"l19" 4 "0 -1 0"
+"m19" 4 "0 -1 0"
+"n19" 4 "0 -1 0"
+"o19" 4 "0 -1 0"
+"p19" 4 "0 -1 0"
+"q19" 4 "0 -1 0"
+"r19" 4 "0 -1 0"
+"s19" 4 "0 -1 0"
+"t19" 4 "0 -1 0"
+"t18" 4 "0 -1 0"
+"s18" 4 "0 -1 0"
+"r18" 4 "0 -1 0"
+"q18" 4 "0 -1 0"
+"p18" 4 "0 -1 0"
+"o18" 4 "0 -1 0"
+"n18" 4 "0 -1 0"
+"m18" 4 "0 -1 0"
+"l18" 4 "0 -1 0"
+"k18" 4 "0 -1 0"
+"j18" 4 "0 -1 0"
+"s17" 4 "0 -1 0"
+"t17" 4 "0 -1 0"
+"t20" 4 "0 -1 0"
+"s20" 4 "0 -1 0"
+"r20" 4 "0 -1 0"
+"q20" 4 "0 -1 0"
+"p20" 4 "0 -1 0"
+"o20" 4 "0 -1 0"
+"n20" 4 "0 -1 0"
+"m20" 4 "0 -1 0"
+"l20" 4 "0 -1 0"
+"k20" 4 "0 -1 0"
+"j20" 4 "0 -1 0"
+"i20" 4 "0 -1 0"
+"h20" 4 "0 -1 0"
+"g20" 4 "0 -1 0"
+"f20" 4 "0 -1 0"
+"e20" 4 "0 -1 0"
+"d20" 4 "0 -1 0"
+"c20" 4 "0 -1 0"
+"b20" 4 "0 -1 0"
+"a20" 4 "0 -1 0"
+"p14" 4 "0 -1 0"
diff --git a/minigames/bulldozer/storage_level9.txt b/minigames/bulldozer/storage_level9.txt
new file mode 100644 (file)
index 0000000..42e3186
--- /dev/null
@@ -0,0 +1,307 @@
+// bulldozer storage "level4" last updated 16-11-2015 04:16:07
+nextlevel = "level1"
+"e15" 3 "0 0 0"
+"f14" 3 "0 0 0"
+"g13" 3 "0 0 0"
+"k13" 3 "0 0 0"
+"b14" 4 "0 0 0"
+"a14" 4 "0 0 0"
+"a13" 4 "0 0 0"
+"b13" 4 "0 0 0"
+"i13" 3 "0 0 0"
+"m13" 3 "0 0 0"
+"n14" 3 "0 0 0"
+"o15" 3 "0 0 0"
+"h17" 2 "0 0 0"
+"l17" 2 "0 0 0"
+"c12" 2 "0 0 0"
+"c13" 2 "0 0 0"
+"c14" 2 "0 0 0"
+"r14" 2 "0 0 0"
+"r13" 2 "0 0 0"
+"r12" 2 "0 0 0"
+"j15" 1 "0 -1 0"
+"s13" 4 "0 0 0"
+"t13" 4 "0 0 0"
+"t12" 4 "0 0 0"
+"s12" 4 "0 0 0"
+"b12" 4 "0 0 0"
+"a12" 4 "0 0 0"
+"a11" 4 "0 0 0"
+"b11" 4 "0 0 0"
+"c11" 4 "0 0 0"
+"d11" 4 "0 0 0"
+"e11" 4 "0 0 0"
+"f11" 4 "0 0 0"
+"g11" 4 "0 0 0"
+"h11" 4 "0 0 0"
+"i11" 4 "0 0 0"
+"j11" 4 "0 0 0"
+"k11" 4 "0 0 0"
+"l11" 4 "0 0 0"
+"m11" 4 "0 0 0"
+"n11" 4 "0 0 0"
+"o11" 4 "0 0 0"
+"p11" 4 "0 0 0"
+"q11" 4 "0 0 0"
+"r11" 4 "0 0 0"
+"s11" 4 "0 0 0"
+"t11" 4 "0 0 0"
+"t6" 6 "0 0 0"
+"s10" 4 "0 0 0"
+"r10" 4 "0 0 0"
+"q10" 4 "0 0 0"
+"b10" 6 "0 0 0"
+"o10" 4 "0 0 0"
+"c10" 6 "0 0 0"
+"d10" 6 "0 0 0"
+"e6" 4 "0 0 0"
+"b9" 6 "0 0 0"
+"b8" 6 "0 0 0"
+"c7" 4 "0 0 0"
+"b7" 6 "0 0 0"
+"b6" 6 "0 0 0"
+"c6" 6 "0 0 0"
+"d6" 6 "0 0 0"
+"f10" 6 "0 0 0"
+"g10" 6 "0 0 0"
+"h10" 6 "0 0 0"
+"a10" 4 "0 0 0"
+"a9" 4 "0 0 0"
+"h9" 4 "0 0 0"
+"c9" 4 "0 0 0"
+"d9" 4 "0 0 0"
+"h8" 4 "0 0 0"
+"h7" 4 "0 0 0"
+"i10" 6 "0 0 0"
+"i9" 6 "0 0 0"
+"j7" 4 "0 0 0"
+"j6" 4 "0 0 0"
+"j10" 4 "0 0 0"
+"i8" 6 "0 0 0"
+"m9" 4 "0 0 0"
+"i7" 6 "0 0 0"
+"o9" 4 "0 0 0"
+"i6" 6 "0 0 0"
+"q9" 4 "0 0 0"
+"r9" 4 "0 0 0"
+"s9" 4 "0 0 0"
+"h6" 6 "0 0 0"
+"g6" 6 "0 0 0"
+"s8" 4 "0 0 0"
+"r8" 4 "0 0 0"
+"q8" 4 "0 0 0"
+"f6" 6 "0 0 0"
+"o8" 4 "0 0 0"
+"f7" 6 "0 0 0"
+"m8" 4 "0 0 0"
+"f8" 6 "0 0 0"
+"f9" 6 "0 0 0"
+"k10" 6 "0 0 0"
+"e10" 4 "0 0 0"
+"d7" 4 "0 0 0"
+"e9" 4 "0 0 0"
+"e8" 4 "0 0 0"
+"e7" 4 "0 0 0"
+"l10" 6 "0 0 0"
+"c8" 4 "0 0 0"
+"m10" 6 "0 0 0"
+"a8" 4 "0 0 0"
+"a7" 4 "0 0 0"
+"g7" 4 "0 0 0"
+"g8" 4 "0 0 0"
+"g9" 4 "0 0 0"
+"n10" 6 "0 0 0"
+"n9" 6 "0 0 0"
+"n8" 6 "0 0 0"
+"d8" 4 "0 0 0"
+"n7" 6 "0 0 0"
+"n6" 6 "0 0 0"
+"m6" 6 "0 0 0"
+"l6" 6 "0 0 0"
+"m7" 4 "0 0 0"
+"k6" 6 "0 0 0"
+"o7" 4 "0 0 0"
+"k7" 6 "0 0 0"
+"q7" 4 "0 0 0"
+"r7" 4 "0 0 0"
+"s7" 4 "0 0 0"
+"k8" 6 "0 0 0"
+"k9" 6 "0 0 0"
+"s6" 4 "0 0 0"
+"p9" 6 "0 0 0"
+"p8" 6 "0 0 0"
+"p7" 6 "0 0 0"
+"o6" 4 "0 0 0"
+"p6" 6 "0 0 0"
+"q6" 6 "0 0 0"
+"r6" 6 "0 0 0"
+"p10" 6 "0 0 0"
+"j9" 4 "0 0 0"
+"j8" 4 "0 0 0"
+"t10" 6 "0 0 0"
+"t9" 6 "0 0 0"
+"t8" 6 "0 0 0"
+"l7" 4 "0 0 0"
+"l8" 4 "0 0 0"
+"l9" 4 "0 0 0"
+"t7" 4 "0 0 0"
+"a6" 4 "0 0 0"
+"a5" 4 "0 0 0"
+"b5" 4 "0 0 0"
+"c5" 4 "0 0 0"
+"d5" 4 "0 0 0"
+"e5" 4 "0 0 0"
+"f5" 4 "0 0 0"
+"g5" 4 "0 0 0"
+"h5" 4 "0 0 0"
+"i5" 4 "0 0 0"
+"j5" 4 "0 0 0"
+"k5" 4 "0 0 0"
+"l5" 4 "0 0 0"
+"m5" 4 "0 0 0"
+"n5" 4 "0 0 0"
+"o5" 4 "0 0 0"
+"p5" 4 "0 0 0"
+"q5" 4 "0 0 0"
+"r5" 4 "0 0 0"
+"s5" 4 "0 0 0"
+"t5" 4 "0 0 0"
+"t4" 4 "0 0 0"
+"s4" 4 "0 0 0"
+"r4" 4 "0 0 0"
+"q4" 4 "0 0 0"
+"p4" 4 "0 0 0"
+"o4" 4 "0 0 0"
+"n4" 4 "0 0 0"
+"m4" 4 "0 0 0"
+"l4" 4 "0 0 0"
+"k4" 4 "0 0 0"
+"j4" 4 "0 0 0"
+"i4" 4 "0 0 0"
+"h4" 4 "0 0 0"
+"g4" 4 "0 0 0"
+"f4" 4 "0 0 0"
+"e4" 4 "0 0 0"
+"d4" 4 "0 0 0"
+"c4" 4 "0 0 0"
+"b4" 4 "0 0 0"
+"a4" 4 "0 0 0"
+"a3" 4 "0 0 0"
+"b3" 4 "0 0 0"
+"c3" 4 "0 0 0"
+"d3" 4 "0 0 0"
+"e3" 4 "0 0 0"
+"f3" 4 "0 0 0"
+"g3" 4 "0 0 0"
+"h3" 4 "0 0 0"
+"i3" 4 "0 0 0"
+"j3" 4 "0 0 0"
+"k3" 4 "0 0 0"
+"l3" 4 "0 0 0"
+"m3" 4 "0 0 0"
+"n3" 4 "0 0 0"
+"o3" 4 "0 0 0"
+"p3" 4 "0 0 0"
+"q3" 4 "0 0 0"
+"r3" 4 "0 0 0"
+"s3" 4 "0 0 0"
+"t3" 4 "0 0 0"
+"t2" 4 "0 0 0"
+"s2" 4 "0 0 0"
+"r2" 4 "0 0 0"
+"q2" 4 "0 0 0"
+"p2" 4 "0 0 0"
+"o2" 4 "0 0 0"
+"n2" 4 "0 0 0"
+"m2" 4 "0 0 0"
+"l2" 4 "0 0 0"
+"k2" 4 "0 0 0"
+"j2" 4 "0 0 0"
+"i2" 4 "0 0 0"
+"h2" 4 "0 0 0"
+"g2" 4 "0 0 0"
+"f2" 4 "0 0 0"
+"e2" 4 "0 0 0"
+"d2" 4 "0 0 0"
+"c2" 4 "0 0 0"
+"b2" 4 "0 0 0"
+"a2" 4 "0 0 0"
+"a1" 4 "0 0 0"
+"b1" 4 "0 0 0"
+"c1" 4 "0 0 0"
+"d1" 4 "0 0 0"
+"e1" 4 "0 0 0"
+"f1" 4 "0 0 0"
+"g1" 4 "0 0 0"
+"h1" 4 "0 0 0"
+"i1" 4 "0 0 0"
+"j1" 4 "0 0 0"
+"k1" 4 "0 0 0"
+"l1" 4 "0 0 0"
+"m1" 4 "0 0 0"
+"n1" 4 "0 0 0"
+"o1" 4 "0 0 0"
+"p1" 4 "0 0 0"
+"q1" 4 "0 0 0"
+"r1" 4 "0 0 0"
+"s1" 4 "0 0 0"
+"t1" 4 "0 0 0"
+"t14" 4 "0 0 0"
+"s14" 4 "0 0 0"
+"b15" 4 "0 0 0"
+"a15" 4 "0 0 0"
+"a16" 4 "0 0 0"
+"b16" 4 "0 0 0"
+"s16" 4 "0 0 0"
+"t16" 4 "0 0 0"
+"t15" 4 "0 0 0"
+"s15" 4 "0 0 0"
+"t17" 4 "0 0 0"
+"s17" 4 "0 0 0"
+"b17" 4 "0 0 0"
+"a17" 4 "0 0 0"
+"a18" 4 "0 0 0"
+"b18" 4 "0 0 0"
+"s18" 4 "0 0 0"
+"t18" 4 "0 0 0"
+"t19" 4 "0 0 0"
+"s19" 4 "0 0 0"
+"r19" 4 "0 0 0"
+"q19" 4 "0 0 0"
+"p19" 4 "0 0 0"
+"o19" 4 "0 0 0"
+"n19" 4 "0 0 0"
+"m19" 4 "0 0 0"
+"l19" 4 "0 0 0"
+"k19" 4 "0 0 0"
+"j19" 4 "0 0 0"
+"i19" 4 "0 0 0"
+"h19" 4 "0 0 0"
+"g19" 4 "0 0 0"
+"f19" 4 "0 0 0"
+"e19" 4 "0 0 0"
+"d19" 4 "0 0 0"
+"c19" 4 "0 0 0"
+"b19" 4 "0 0 0"
+"a19" 4 "0 0 0"
+"a20" 4 "0 0 0"
+"b20" 4 "0 0 0"
+"c20" 4 "0 0 0"
+"d20" 4 "0 0 0"
+"e20" 4 "0 0 0"
+"f20" 4 "0 0 0"
+"g20" 4 "0 0 0"
+"h20" 4 "0 0 0"
+"i20" 4 "0 0 0"
+"j20" 4 "0 0 0"
+"k20" 4 "0 0 0"
+"l20" 4 "0 0 0"
+"m20" 4 "0 0 0"
+"n20" 4 "0 0 0"
+"o20" 4 "0 0 0"
+"p20" 4 "0 0 0"
+"q20" 4 "0 0 0"
+"r20" 4 "0 0 0"
+"s20" 4 "0 0 0"
+"t20" 4 "0 0 0"
index 1402b7a0b02b77868ad4054ef7e0a44149a2bae7..e3df814e3618570e7f44577d33e2c5ef805fcdc8 100644 (file)
@@ -1 +1 @@
-sprite,models/ok_nade_counter/ok_nade_counter_10
\ No newline at end of file
+sprite,models/ok_nade_counter/ok_nade_counter_09
\ No newline at end of file
diff --git a/models/weapons/overkillbullet.tga b/models/weapons/overkillbullet.tga
deleted file mode 100644 (file)
index f48d302..0000000
Binary files a/models/weapons/overkillbullet.tga and /dev/null differ
diff --git a/models/weapons/overkillbullet_gloss.tga b/models/weapons/overkillbullet_gloss.tga
deleted file mode 100644 (file)
index 08f2fd0..0000000
Binary files a/models/weapons/overkillbullet_gloss.tga and /dev/null differ
diff --git a/models/weapons/overkillbullet_reflect.tga b/models/weapons/overkillbullet_reflect.tga
deleted file mode 100644 (file)
index ecb0222..0000000
Binary files a/models/weapons/overkillbullet_reflect.tga and /dev/null differ
index b5b77e09ba392461593e1237d834119f90a728ba..d332a0413789e72e4f4201c0203fef10d0519069 100644 (file)
@@ -2,6 +2,7 @@ SCM := $(shell if [ -d .svn ]; then echo svn; elif [ -d ../.git ]; then echo git
 PERL ?= perl
 QCCFLAGS_WATERMARK ?= -DWATERMARK='"$(shell git describe)"'
 QCC ?= gmqcc
+NDEBUG ?= 1
  
 QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversion.txt && git hash-object qccversion.txt)
 
@@ -22,7 +23,7 @@ QCCFLAGS ?= \
        -fftepp -flno -futf8 -fno-bail-on-werror -fftepp-predefs \
        -frelaxed-switch -freturn-assignments \
        $(QCCFLAGS_WATERMARK) \
-       -DNDEBUG=1 \
+       -DNDEBUG=$(NDEBUG) \
        $(QCCFLAGS_FEATURES) \
        $(QCCFLAGS_EXTRA)
 
@@ -46,17 +47,17 @@ $(QCCVERSIONFILE):
 FILES_CSPROGS = $(shell find lib common client -type f)
 ../csprogs.dat: $(FILES_CSPROGS) $(QCCVERSIONFILE)
        @echo make[1]: Entering directory \`$(PWD)/client\'
-       cd client && $(QCC) $(QCCFLAGS) -DCSQC
+       cd client && $(QCC) $(QCCFLAGS) -DCSQC -o ../../csprogs.dat progs.inc
 
 FILES_PROGS = $(shell find lib common server -type f)
 ../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE)
        @echo make[1]: Entering directory \`$(PWD)/server\'
-       cd server && $(QCC) $(QCCFLAGS) -DSVQC
+       cd server && $(QCC) $(QCCFLAGS) -DSVQC -o ../../progs.dat progs.inc
 
 FILES_MENU = $(shell find lib common menu -type f)
 ../menu.dat: $(FILES_MENU) $(QCCVERSIONFILE)
        @echo make[1]: Entering directory \`$(PWD)/menu\'
-       cd menu && $(QCC) $(QCCFLAGS) -DMENUQC
+       cd menu && $(QCC) $(QCCFLAGS) -DMENUQC -o ../../menu.dat progs.inc
 
 .PHONY: testcase
 testcase:
index 919cf031ebed7ab7b412eb2b54e623500d5ac7e9..4697319d154e31fa392500aad1bbfa0167edb6b8 100644 (file)
@@ -153,10 +153,6 @@ float autocvar_crosshair_size;
 int autocvar_ekg;
 float autocvar_fov;
 float autocvar_g_balance_damagepush_speedfactor;
-float autocvar_g_balance_tuba_attenuation;
-float autocvar_g_balance_tuba_fadetime;
-float autocvar_g_balance_tuba_volume;
-int autocvar_g_balance_tuba_pitchstep;
 float autocvar_g_warmup_limit;
 bool autocvar_hud_cursormode = true;
 float autocvar_hud_colorflash_alpha;
index 506d35c6bb6c02a6a4dc934645c34ec66474878e..83c3f448a2ec802378a09d238b62d0afdcf26de1 100644 (file)
@@ -333,10 +333,10 @@ void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
        // player "pops in"
        if(isnew)
        {
-#define FIX_FRAMETIME(f,ft) do {                                                                                                                                                                       \
+#define FIX_FRAMETIME(f,ft) MACRO_BEGIN {                                                                                                                                                      \
                if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0)                                                                                       \
                        self.ft = self.death_time;                                                                                                                                                              \
-} while(0)
+} MACRO_END
                FIX_FRAMETIME(frame, frame1time);
                FIX_FRAMETIME(frame2, frame2time);
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
index 069598e3b4613c457f86d0479fdba2a4077edb4c..3e959b084ef753251abe18a338253d14f38896c9 100644 (file)
@@ -108,13 +108,6 @@ int w_deathtype;
 float w_issilent, w_random;
 vector w_org, w_backoff;
 
-float rifle_scope;
-float vortex_scope;
-
-float minelayer_maxmines;
-
-float hagar_maxrockets;
-
 float bgmtime;
 
 string weaponorder_byimpulse;
@@ -130,5 +123,4 @@ float uid2name_dialog;
 
 #define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
 
-float g_balance_porto_secondary;
 #endif
index d30a87273514636a87d1fd9b2ca6903c96e0f67d..47126a7389c6c53f4fd73b6e51a546edb4b04ce5 100644 (file)
@@ -24,10 +24,10 @@ REGISTER_REGISTRY(hud_panels)
 #define HUD_PANEL(NAME) HUD_PANEL_##NAME
 
 // draw the background/borders
-#define HUD_Panel_DrawBg(theAlpha) do {                                                                                                                                                                \
+#define HUD_Panel_DrawBg(theAlpha) MACRO_BEGIN {                                                                                                                                                               \
        if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")                                                                                               \
                draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
-} while(0)
+} MACRO_END
 
 int panel_order[hud_panels_MAX];
 string hud_panelorder_prev;
@@ -213,7 +213,7 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
 
 // Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
 // comment on last line of macro: // we probably want to see a background in config mode at all times...
-#define HUD_Panel_GetBg() do {                                                                                      \
+#define HUD_Panel_GetBg() MACRO_BEGIN {                                                                             \
        string panel_bg;                                                                                                \
        if (!autocvar__hud_configure && panel_bg_str == "0") {                                                          \
                panel_bg = "0";                                                                                             \
@@ -238,10 +238,10 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
        if (panel.current_panel_bg)                                                                                     \
                strunzone(panel.current_panel_bg);                                                                          \
        panel.current_panel_bg = strzone(panel_bg);                                                                     \
-} while(0)
+} MACRO_END
 
 // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
-#define HUD_Panel_GetColor() do {                                                                                   \
+#define HUD_Panel_GetColor() MACRO_BEGIN {                                                                          \
        if ((teamplay) && panel_bg_color_team) {                                                                        \
                if (autocvar__hud_configure && myteam == NUM_SPECTATOR)                                                     \
                        panel_bg_color = '1 0 0' * panel_bg_color_team;                                                         \
@@ -262,20 +262,20 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
                        }                                                                                                       \
                }                                                                                                           \
        }                                                                                                               \
-} while(0)
+} MACRO_END
 
 // Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
-#define HUD_Panel_GetColorTeam() do {                                                                               \
+#define HUD_Panel_GetColorTeam() MACRO_BEGIN {                                                                      \
        if (panel_bg_color_team_str == "") {                                                                            \
                panel_bg_color_team = autocvar_hud_panel_bg_color_team;                                                     \
        } else {                                                                                                        \
                panel_bg_color_team = stof(panel_bg_color_team_str);                                                        \
        }                                                                                                               \
-} while(0)
+} MACRO_END
 
 // Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
 // comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
-#define HUD_Panel_GetBgAlpha() do {                                                                                 \
+#define HUD_Panel_GetBgAlpha() MACRO_BEGIN {                                                                        \
        if (panel_bg_alpha_str == "") {                                                                                 \
                panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);                                                     \
        }                                                                                                               \
@@ -288,39 +288,39 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
                else                                                                                                        \
                        panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha);                                \
        }                                                                                                               \
-} while(0)
+} MACRO_END
 
 // Get value for panel_fg_alpha. Also do various minalpha checks
 // comment on line 2 of macro: // ALWAYS show disabled panels at 0.25 alpha when in config mode
-#define HUD_Panel_GetFgAlpha() do {                                                                                 \
+#define HUD_Panel_GetFgAlpha() MACRO_BEGIN {                                                                        \
        panel_fg_alpha = autocvar_hud_panel_fg_alpha;                                                                   \
        if (autocvar__hud_configure && !panel_enabled)                                                                  \
                panel_fg_alpha = 0.25;                                                                                      \
-} while(0)
+} MACRO_END
 
 // Get border. See comments above, it's similar.
-#define HUD_Panel_GetBorder() do {                                                                                  \
+#define HUD_Panel_GetBorder() MACRO_BEGIN {                                                                         \
        if (panel_bg_border_str == "") {                                                                                \
                panel_bg_border = autocvar_hud_panel_bg_border;                                                             \
        } else {                                                                                                        \
                panel_bg_border = stof(panel_bg_border_str);                                                                \
        }                                                                                                               \
-} while(0)
+} MACRO_END
 
 // Get padding. See comments above, it's similar.
 // last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
-#define HUD_Panel_GetPadding() do {                                                                                 \
+#define HUD_Panel_GetPadding() MACRO_BEGIN {                                                                        \
        if (panel_bg_padding_str == "") {                                                                               \
                panel_bg_padding = autocvar_hud_panel_bg_padding;                                                           \
        } else {                                                                                                        \
                panel_bg_padding = stof(panel_bg_padding_str);                                                              \
        }                                                                                                               \
        panel_bg_padding = min(min(panel_size.x, panel_size.y)/2 - 5, panel_bg_padding);                                \
-} while(0)
+} MACRO_END
 
 // return smoothly faded pos and size of given panel when a dialog is active
 // don't center too wide panels, it doesn't work with different resolutions
-#define HUD_Panel_UpdatePosSize_ForMenu() do { \
+#define HUD_Panel_UpdatePosSize_ForMenu() MACRO_BEGIN { \
        vector menu_enable_size = panel_size; \
        float max_panel_width = 0.52 * vid_conwidth; \
        if(panel_size.x > max_panel_width) \
@@ -331,16 +331,16 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
        vector menu_enable_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * menu_enable_size; \
        panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos; \
        panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size; \
-} while(0)
+} MACRO_END
 
 // Scale the pos and size vectors to absolute coordinates
-#define HUD_Panel_ScalePosSize() do {                                                                               \
+#define HUD_Panel_ScalePosSize() MACRO_BEGIN {                                                                      \
        panel_pos.x *= vid_conwidth;  panel_pos.y *= vid_conheight;                                                     \
        panel_size.x *= vid_conwidth; panel_size.y *= vid_conheight;                                                    \
-} while(0)
+} MACRO_END
 
 // NOTE: in hud_configure mode cvars must be reloaded every frame
-#define HUD_Panel_UpdateCvars() do {                                                                                \
+#define HUD_Panel_UpdateCvars() MACRO_BEGIN {                                                                       \
        if (panel.update_time <= time) {                                                                                \
                if (autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                  \
                panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                              \
@@ -386,9 +386,9 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
                panel_bg_padding = panel.current_panel_bg_padding;                                                          \
                panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha;                                             \
        }                                                                                                               \
-} while(0)
+} MACRO_END
 
-#define HUD_Panel_UpdatePosSize() do {                                                                              \
+#define HUD_Panel_UpdatePosSize() MACRO_BEGIN {                                                                     \
        panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                                                   \
        panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                                  \
        panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                                \
@@ -398,7 +398,7 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
        }                                                                                                               \
        panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border"));                        \
        HUD_Panel_GetBorder();                                                                                          \
-} while(0)
+} MACRO_END
 
 const int NOTIFY_MAX_ENTRIES = 10;
 const float NOTIFY_ICON_MARGIN = 0.02;
index 6c37aa13a89ea740d944d2a46aec0bd1d1c0bb9c..96343d6a9668567abfc10b06c7e47bbd04db8291 100644 (file)
@@ -160,7 +160,7 @@ void HUD_Ammo()
 
        Weapon wep = switchweapon;
        int i;
-       bool infinite_ammo = (getstati(STAT_ITEMS, 0, 24) & IT_UNLIMITED_WEAPON_AMMO);
+       bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO);
        row = column = 0;
        if(autocvar_hud_panel_ammo_onlycurrent)
        {
index bab17556d477bf9801af055822d450c2fa165a10..3b094d39d9f6b40849e3eb146ea8b6b93762689a 100644 (file)
@@ -8,13 +8,13 @@ void HUD_HealthArmor()
                if(hud != HUD_NORMAL) return;
                if(spectatee_status == -1) return;
 
-               health = getstati(STAT_HEALTH);
+               health = STAT(HEALTH);
                if(health <= 0)
                {
                        prev_health = -1;
                        return;
                }
-               armor = getstati(STAT_ARMOR);
+               armor = STAT(ARMOR);
 
                // code to check for spectatee_status changes is in Ent_ClientData()
                // prev_p_health and prev_health can be set to -1 there
index 33f797f3d3201b0a337596a774f709c1c8244ce9..9153b855da45c510d7c88fcb561b8fb205ea0bac 100644 (file)
@@ -1,11 +1,11 @@
 // Info messages panel (#14)
 
-#define drawInfoMessage(s) do {                                                                                                                                                                                \
+#define drawInfoMessage(s) MACRO_BEGIN {                                                                                                                                                       \
        if(autocvar_hud_panel_infomessages_flip)                                                                                                                                                \
                o.x = pos.x + mySize.x - stringwidth(s, true, fontsize);                                                                                                        \
        drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);                                                                                                               \
        o.y += fontsize.y;                                                                                                                                                                                              \
-} while(0)
+} MACRO_END
 void HUD_InfoMessages()
 {
        if(!autocvar__hud_configure)
index 8e3166b6ad8f23ef803bc0a779fdaf83c6cd0798..9ea22c92bf55333fe9e508652bb7185d6f6cbbd1 100644 (file)
@@ -135,14 +135,14 @@ void HUD_Mod_CTF(vector pos, vector mySize)
        }
 
        // when status CHANGES, set old status into prevstatus and current status into status
-       #define X(team) do {                                                                                                                    \
+       #define X(team) MACRO_BEGIN {                                                                                                   \
                if (team##flag != team##flag_prevframe) {                                                                       \
                team##flag_statuschange_time = time;                                                                    \
                team##flag_prevstatus = team##flag_prevframe;                                                   \
                team##flag_prevframe = team##flag;                                                                              \
        }                                                                                                                                                       \
        team##flag_statuschange_elapsedtime = time - team##flag_statuschange_time;      \
-    } while (0)
+    } MACRO_END
        X(red);
        X(blue);
        X(yellow);
@@ -163,7 +163,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
        string team##_icon, team##_icon_prevstatus; \
        int team##_alpha, team##_alpha_prevstatus; \
        team##_alpha = team##_alpha_prevstatus = 1; \
-       do { \
+       MACRO_BEGIN { \
                switch (team##flag) { \
                        case 1: team##_icon = "flag_" #team "_taken"; break; \
                        case 2: team##_icon = "flag_" #team "_lost"; break; \
@@ -190,7 +190,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                                } \
                                break; \
                } \
-       } while (0)
+       } MACRO_END
        X(red, myteam != NUM_TEAM_1);
        X(blue, myteam != NUM_TEAM_2);
        X(yellow, myteam != NUM_TEAM_3);
@@ -255,13 +255,13 @@ void HUD_Mod_CTF(vector pos, vector mySize)
        neutralflag_pos = pos;
        flag_size = e1 * fs * size1 + e2 * size2;
 
-       #define X(team) do { \
+       #define X(team) MACRO_BEGIN { \
                f = bound(0, team##flag_statuschange_elapsedtime * 2, 1); \
                if (team##_icon_prevstatus && f < 1) \
                        drawpic_aspect_skin_expanding(team##flag_pos, team##_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * team##_alpha_prevstatus, DRAWFLAG_NORMAL, f); \
                if (team##_icon) \
                        drawpic_aspect_skin(team##flag_pos, team##_icon, flag_size, '1 1 1', panel_fg_alpha * team##_alpha * f, DRAWFLAG_NORMAL); \
-       } while (0)
+       } MACRO_END
        X(red);
        X(blue);
        X(yellow);
@@ -415,7 +415,7 @@ void HUD_Mod_Keepaway(vector pos, vector mySize)
        float BLINK_FREQ = 5;
        float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
 
-       int stat_items = getstati(STAT_ITEMS, 0, 24);
+       int stat_items = STAT(ITEMS);
        int kaball = (stat_items/IT_KEY1) & 1;
 
        if(kaball != kaball_prevstatus)
@@ -451,7 +451,7 @@ void HUD_Mod_NexBall(vector pos, vector mySize)
        float nb_pb_starttime, dt, p;
        int stat_items;
 
-       stat_items = getstati(STAT_ITEMS, 0, 24);
+       stat_items = STAT(ITEMS);
        nb_pb_starttime = STAT(NB_METERSTART);
 
        if (stat_items & IT_KEY1)
index e75f21f3685a0112dc44b5c9a66d07b083a9d564..854ed594a0de49904ab2544f501ec23ff4ce916e 100644 (file)
@@ -56,7 +56,7 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b
 
 void HUD_Powerups()
 {
-       int allItems = getstati(STAT_ITEMS, 0, 24);
+       int allItems = STAT(ITEMS);
        int allBuffs = STAT(BUFFS);
        int strengthTime, shieldTime, superTime;
 
@@ -65,7 +65,7 @@ void HUD_Powerups()
        {
                if(!autocvar_hud_panel_powerups) return;
                if(spectatee_status == -1) return;
-               if(getstati(STAT_HEALTH) <= 0) return;
+               if(STAT(HEALTH) <= 0) return;
                if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return;
 
                strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99);
index 33f4e1e649f2d69fb1fdaeb965e2237660ba867f..66d516960da4e88689c94441d3fd9eb7e7edd895 100644 (file)
@@ -79,7 +79,7 @@ float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
                                return false;
                }
 
-               if ( getstati(STAT_HEALTH) <= 0 )
+               if ( STAT(HEALTH) <= 0 )
                {
                        // Show scoreboard
                        if ( bInputType < 2 )
@@ -369,7 +369,7 @@ void HUD_Radar()
        {
                string message = "Click to select teleport destination";
 
-               if ( getstati(STAT_HEALTH) <= 0 )
+               if ( STAT(HEALTH) <= 0 )
                {
                        message = "Click to select spawn location";
                }
index 8970332cd105def4f719790ddfabd38f217e44ec..9cfebb81e716c80f198f39a5235426cb25b93194 100644 (file)
@@ -11,9 +11,8 @@ void weaponorder_swap(int i, int j, entity pass)
 string weaponorder_cmp_str;
 int weaponorder_cmp(int i, int j, entity pass)
 {
-       int ai, aj;
-       ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].weapon), 0);
-       aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].weapon), 0);
+       int ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].m_id), 0);
+       int aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].m_id), 0);
        return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
 }
 
@@ -118,7 +117,7 @@ void HUD_Weapons()
                // do we own this weapon?
                weapon_count = 0;
                for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
-                       if((weapons_stat & WepSet_FromWeapon(Weapons_from(weaponorder[i].weapon))) || (weaponorder[i].weapon == complain_weapon))
+                       if((weapons_stat & WepSet_FromWeapon(weaponorder[i])) || (weaponorder[i].m_id == complain_weapon))
                                ++weapon_count;
 
 
@@ -339,14 +338,14 @@ void HUD_Weapons()
                // retrieve information about the current weapon to be drawn
                setself(weaponorder[i]);
                weapon_id = self.impulse;
-               isCurrent = (self.weapon == switchweapon.m_id);
+               isCurrent = (self == switchweapon);
 
                // skip if this weapon doesn't exist
                if(!self || weapon_id < 0) { continue; }
 
                // skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon
                if(autocvar_hud_panel_weapons_onlyowned)
-               if (!((weapons_stat & WepSet_FromWeapon(Weapons_from(self.weapon))) || (self.weapon == complain_weapon)))
+               if (!((weapons_stat & WepSet_FromWeapon(self)) || (self.m_id == complain_weapon)))
                        continue;
 
                // figure out the drawing position of weapon
@@ -361,7 +360,7 @@ void HUD_Weapons()
                // draw the weapon accuracy
                if(autocvar_hud_panel_weapons_accuracy)
                {
-                       float panel_weapon_accuracy = weapon_accuracy[self.weapon-WEP_FIRST];
+                       float panel_weapon_accuracy = weapon_accuracy[self.m_id-WEP_FIRST];
                        if(panel_weapon_accuracy >= 0)
                        {
                                color = Accuracy_GetColor(panel_weapon_accuracy);
@@ -370,7 +369,7 @@ void HUD_Weapons()
                }
 
                // drawing all the weapon items
-               if(weapons_stat & WepSet_FromWeapon(Weapons_from(self.weapon)))
+               if(weapons_stat & WepSet_FromWeapon(self))
                {
                        // draw the weapon image
                        if(isCurrent)
@@ -442,7 +441,7 @@ void HUD_Weapons()
                }
 
                // draw the complain message
-               if(self.weapon == complain_weapon)
+               if(self.m_id == complain_weapon)
                {
                        if(fadetime)
                                a = ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1));
index f2df818aa62e2123ce86509934beac37b578788b..2009388dad4c118856345e04ede9c29b7ad29043 100644 (file)
@@ -42,6 +42,11 @@ void CSQC_Init()
        LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK);
 #endif
 
+       // needs to be done so early because of the constants they create
+       static_init();
+       static_init_late();
+       static_init_precache();
+
        binddb = db_create();
        tempdb = db_create();
        ClientProgsDB = db_load("client.db");
@@ -93,11 +98,6 @@ void CSQC_Init()
 
        GetTeam(NUM_SPECTATOR, true); // add specs first
 
-       // needs to be done so early because of the constants they create
-       static_init();
-       static_init_late();
-       static_init_precache();
-
        // precaches
 
        if(autocvar_cl_reticle)
@@ -167,6 +167,7 @@ void Shutdown()
 .float has_team;
 float SetTeam(entity o, int Team)
 {
+       assert_once(Team);
        entity tm;
        if(teamplay)
        {
@@ -270,7 +271,8 @@ void Playerchecker_Think()
                                e.ping_packetloss = 0;
                                e.ping_movementloss = 0;
                                //e.gotscores = 0; // we might already have the scores...
-                               SetTeam(e, entcs_GetTeam(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
+                               int t = entcs_GetScoreTeam(i);
+                               if (t) SetTeam(e, t); // will not hurt; later updates come with HUD_UpdatePlayerTeams
                                RegisterPlayer(e);
                                HUD_UpdatePlayerPos(e);
                        }
@@ -357,7 +359,7 @@ NET_HANDLE(ENT_CLIENT_SCORES, bool isnew)
        if(!isNew && n != this.sv_entnum)
        {
                //print("A CSQC entity changed its owner!\n");
-               LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(this), this.classname);
+               LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname);
                isNew = true;
                Ent_Remove();
        }
@@ -736,7 +738,7 @@ void CSQC_Ent_Update(bool isnew)
        {
                if (t != this.enttype || isnew)
                {
-                       LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(this), this.entnum, this.enttype, t);
+                       LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t);
                        Ent_Remove();
                        clearentity(this);
                        isnew = true;
@@ -746,7 +748,7 @@ void CSQC_Ent_Update(bool isnew)
        {
                if (!isnew)
                {
-                       LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(this), this.entnum, t);
+                       LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t);
                        isnew = true;
                }
        }
@@ -908,22 +910,10 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
 
        armorblockpercent = ReadByte() / 255.0;
 
-       g_balance_mortar_bouncefactor = ReadCoord();
-       g_balance_mortar_bouncestop = ReadCoord();
-       g_balance_electro_secondary_bouncefactor = ReadCoord();
-       g_balance_electro_secondary_bouncestop = ReadCoord();
-
-       vortex_scope = !ReadByte();
-       rifle_scope = !ReadByte();
-
        serverflags = ReadByte();
 
-       minelayer_maxmines = ReadByte();
-
-       hagar_maxrockets = ReadByte();
-
        g_trueaim_minrange = ReadCoord();
-       g_balance_porto_secondary = ReadByte();
+
        return = true;
 
        MUTATOR_CALLHOOK(Ent_Init);
@@ -1110,7 +1100,7 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew)
 {
        complain_weapon = ReadByte();
        if (complain_weapon_name) strunzone(complain_weapon_name);
-       complain_weapon_name = strzone(WEP_NAME(complain_weapon));
+       complain_weapon_name = strzone(Weapons_from(complain_weapon).m_name);
        complain_weapon_type = ReadByte();
        return = true;
 
index 91d5de09bd1b36de04e1b32c4735bd52e18b480c..49a92bb45ca483a399ea675076121a345fb7afa4 100644 (file)
@@ -136,10 +136,6 @@ const int HOOK_END =      2;
 
 .float ping, ping_packetloss, ping_movementloss;
 
-float g_balance_mortar_bouncefactor;
-float g_balance_mortar_bouncestop;
-float g_balance_electro_secondary_bouncefactor;
-float g_balance_electro_secondary_bouncestop;
 float g_trueaim_minrange;
 
 float hud;
index 673cf00f1bf8bb1666636b34477bd60cef16bc5e..b7962d52d5fb73e42cc2f8e802b9d016f6027565 100644 (file)
@@ -79,6 +79,7 @@ void MoveToLast(entity e)
 
 float RegisterTeam(entity Team)
 {
+       assert_once(Team.team, eprint(Team));
        entity tm;
        AuditLists();
        for(tm = teams.sort_next; tm; tm = tm.sort_next)
index ddac22e8dab42c07f560372bd795ee0e4cf564cf..3066fc6c642c8f7c5530732352911222e61bc18b 100644 (file)
@@ -42,8 +42,8 @@ float cvar_or(string cv, float v);
 
 vector project_3d_to_2d(vector vec);
 
-#define draw_beginBoldFont()    do { drawfont = FONT_USER + 2; } while (0)
-#define draw_endBoldFont()      do { drawfont = FONT_USER + 1; } while (0)
+#define draw_beginBoldFont()    MACRO_BEGIN { drawfont = FONT_USER + 2; } MACRO_END
+#define draw_endBoldFont()      MACRO_BEGIN { drawfont = FONT_USER + 1; } MACRO_END
 
 float expandingbox_sizefactor_from_fadelerp(float fadelerp);
 
@@ -60,7 +60,7 @@ vector _drawpic_sz;
 float _drawpic_oldsz;
 string _drawpic_picpath;
 #define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
-       do {\
+       MACRO_BEGIN {\
                _drawpic_imgsize = draw_getimagesize(pic);\
                if(_drawpic_imgsize != '0 0 0') {\
                        _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\
@@ -77,35 +77,35 @@ string _drawpic_picpath;
                                        drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
                        }\
                }\
-       } while(0)
+       } MACRO_END
 
 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
 #define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
-       do{\
+       MACRO_BEGIN {\
                _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
                if(precache_pic(_drawpic_picpath) == "") {\
                        _drawpic_picpath = strcat("gfx/hud/default/", pic);\
                }\
                drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
                _drawpic_picpath = string_null;\
-       } while(0)
+       } MACRO_END
 
 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
 #define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
-       do{\
+       MACRO_BEGIN {\
                _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
                if(precache_pic(_drawpic_picpath) == "") {\
                        _drawpic_picpath = strcat("gfx/hud/default/", pic);\
                }\
                drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
                _drawpic_picpath = string_null;\
-       } while(0)
+       } MACRO_END
 
 void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
 
 void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
 
-#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) do {                                                                                                                                     \
+#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN {                                                                                                                    \
        float textaspect, oldsz;                                                                                                                                                                                \
        textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y;                                                                                    \
        if(sz.x/sz.y > textaspect) {                                                                                                                                                                    \
@@ -117,7 +117,7 @@ void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theSc
                sz.y = sz.x / textaspect;                                                                                                                                                                       \
                pos.y += (oldsz - sz.y) * 0.5;                                                                                                                                                          \
        }                                                                                                                                                                                                                               \
-} while(0)
+} MACRO_END
 
 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
 void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag);
index 775e031481ff9141b79411b3d586273de6f07dc1..2727db46e62707596a130f14ec7c8e177c5148ac 100644 (file)
@@ -45,6 +45,7 @@
 #include "../common/deathtypes/all.qc"
 #include "../common/effects/all.qc"
 #include "../common/gamemodes/all.qc"
+#include "../common/impulses/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src
deleted file mode 100644 (file)
index 8a3c036..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../../csprogs.dat
-progs.inc
index 4d9a8c69d0c35c91fe9496da174b91d33ea29e9c..9c86d9e4c63355a9c198aa84c9ed285c89d51a50 100644 (file)
@@ -109,7 +109,7 @@ void HUD_UpdatePlayerTeams()
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
                num += 1;
-               Team = entcs_GetTeam(pl.sv_entnum);
+               Team = entcs_GetScoreTeam(pl.sv_entnum);
                if(SetTeam(pl, Team))
                {
                        tmp = pl.sort_prev;
@@ -986,7 +986,7 @@ float HUD_WouldDrawScoreboard() {
                return 1;
        else if (intermission == 2)
                return 0;
-       else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
+       else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
                return 1;
        else if (scoreboard_showscores_force)
                return 1;
@@ -1002,8 +1002,6 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        float initial_posx = pos.x;
        int disownedcnt = 0;
        FOREACH(Weapons, it != WEP_Null, LAMBDA(
-               if (!it.weapon) continue;
-
                int weapon_stats = weapon_accuracy[i - WEP_FIRST];
 
                WepSet set = it.m_wepset;
@@ -1064,7 +1062,6 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 
        int column = 0;
        FOREACH(Weapons, it != WEP_Null, LAMBDA(
-               if (!it.weapon) continue;
                int weapon_stats = weapon_accuracy[i - WEP_FIRST];
 
                WepSet set = it.m_wepset;
index 85fea0d1b77c81406d4f4930beffd48895f05e69..8602ef26a24eb179ebf0aee8599393f3e25dff67 100644 (file)
@@ -63,50 +63,50 @@ float autocvar_cl_leanmodel_up_highpass1;
 float autocvar_cl_leanmodel_up_lowpass;
 float autocvar_cl_leanmodel_up_limit;
 
-#define lowpass(value, frac, ref_store, ret) do \
+#define lowpass(value, frac, ref_store, ret) MACRO_BEGIN \
 { \
        float __frac = bound(0, frac, 1); \
        ret = ref_store = ref_store * (1 - __frac) + (value) * __frac; \
-} while (0)
+} MACRO_END
 
-#define lowpass_limited(value, frac, limit, ref_store, ret) do \
+#define lowpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
 { \
        float __ignore; lowpass(value, frac, ref_store, __ignore); \
        ret = ref_store = bound((value) - (limit), ref_store, (value) + (limit)); \
-} while (0)
+} MACRO_END
 
-#define highpass(value, frac, ref_store, ret) do \
+#define highpass(value, frac, ref_store, ret) MACRO_BEGIN \
 { \
        float __f; lowpass(value, frac, ref_store, __f); \
        ret = (value) - __f; \
-} while (0)
+} MACRO_END
 
-#define highpass_limited(value, frac, limit, ref_store, ret) do \
+#define highpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
 { \
        float __f; lowpass_limited(value, frac, limit, ref_store, __f); \
        ret = (value) - __f; \
-} while (0)
+} MACRO_END
 
-#define lowpass3(value, fracx, fracy, fracz, ref_store, ref_out) do \
+#define lowpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \
 { \
        lowpass(value.x, fracx, ref_store.x, ref_out.x); \
        lowpass(value.y, fracy, ref_store.y, ref_out.y); \
        lowpass(value.z, fracz, ref_store.z, ref_out.z); \
-} while (0)
+} MACRO_END
 
-#define highpass3(value, fracx, fracy, fracz, ref_store, ref_out) do \
+#define highpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \
 { \
        highpass(value.x, fracx, ref_store.x, ref_out.x); \
        highpass(value.y, fracy, ref_store.y, ref_out.y); \
        highpass(value.z, fracz, ref_store.z, ref_out.z); \
-} while (0)
+} MACRO_END
 
-#define highpass3_limited(value, fracx, limitx, fracy, limity, fracz, limitz, ref_store, ref_out) do \
+#define highpass3_limited(value, fracx, limitx, fracy, limity, fracz, limitz, ref_store, ref_out) MACRO_BEGIN \
 { \
        highpass_limited(value.x, fracx, limitx, ref_store.x, ref_out.x); \
        highpass_limited(value.y, fracy, limity, ref_store.y, ref_out.y); \
        highpass_limited(value.z, fracz, limitz, ref_store.z, ref_out.z); \
-} while (0)
+} MACRO_END
 
 void viewmodel_animate(entity this)
 {
@@ -115,7 +115,7 @@ void viewmodel_animate(entity this)
        prevtime = time;
 
        if (autocvar_chase_active) return;
-       if (getstati(STAT_HEALTH) <= 0) return;
+       if (STAT(HEALTH) <= 0) return;
 
        entity view = CSQCModel_server2csqc(player_localentnum - 1);
 
@@ -272,7 +272,7 @@ void viewmodel_animate(entity this)
 
 void viewmodel_draw(entity this)
 {
-       int mask = (intermission || (getstati(STAT_HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
+       int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
        float a = this.alpha;
        int c = stof(getplayerkeyvalue(current_player, "colors"));
        vector g;
@@ -350,13 +350,13 @@ void Porto_Draw(entity this)
 
        if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
                return;
-       if(g_balance_porto_secondary)
+       if(WEP_CVAR(porto, secondary))
                return;
        if(intermission == 1)
                return;
        if(intermission == 2)
                return;
-       if (getstati(STAT_HEALTH) <= 0)
+       if (STAT(HEALTH) <= 0)
                return;
 
        dir = view_forward;
@@ -448,7 +448,7 @@ vector GetCurrentFov(float fov)
        zoomdir = button_zoom;
        if(hud == HUD_NORMAL)
        if(switchweapon == activeweapon)
-       if((activeweapon == WEP_VORTEX && vortex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+       if((activeweapon == WEP_VORTEX && !WEP_CVAR(vortex, secondary)) || (activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here
                zoomdir += button_attack2;
        if(spectatee_status > 0 || isdemo())
        {
@@ -672,7 +672,7 @@ float TrueAimCheck()
                        break;
        }
 
-       vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * getstati(STAT_VIEWHEIGHT));
+       vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * STAT(VIEWHEIGHT));
 
        vecs = decompressShotOrigin(STAT(SHOTORG));
 
@@ -757,7 +757,7 @@ bool WantEventchase()
                        return true;
                if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
                        return true;
-               if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
+               if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0))
                {
                        if(autocvar_cl_eventchase_death == 2)
                        {
@@ -954,7 +954,7 @@ void HUD_Crosshair()
 
                        case 2: // crosshair_color_by_health
                        {
-                               float x = getstati(STAT_HEALTH);
+                               float x = STAT(HEALTH);
 
                                //x = red
                                //y = green
@@ -1169,16 +1169,16 @@ void HUD_Crosshair()
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring_nexgun.tga";
                                }
-                               else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
+                               else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer)
                                {
-                                       ring_value = bound(0, STAT(LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+                                       ring_value = bound(0, STAT(LAYED_MINES) / WEP_CVAR(minelayer, limit), 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
                                        ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring.tga";
                                }
                                else if (activeweapon == WEP_HAGAR && STAT(HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
                                {
-                                       ring_value = bound(0, STAT(HAGAR_LOAD) / hagar_maxrockets, 1);
+                                       ring_value = bound(0, STAT(HAGAR_LOAD) / WEP_CVAR_SEC(hagar, load_max), 1);
                                        ring_alpha = autocvar_crosshair_ring_hagar_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring.tga";
@@ -1242,8 +1242,7 @@ void HUD_Crosshair()
                        }
 
 #define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
-                       do \
-                       { \
+                       MACRO_BEGIN { \
                                if(wcross_blur > 0) \
                                { \
                                        for(i = -2; i <= 2; ++i) \
@@ -1254,8 +1253,7 @@ void HUD_Crosshair()
                                { \
                                        M(0,0,sz,wcross_name,wcross_alpha); \
                                } \
-                       } \
-                       while(0)
+                       } MACRO_END
 
 #define CROSSHAIR_DRAW_SINGLE(i,j,sz,wcross_name,wcross_alpha) \
                        drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size.x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size.y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
@@ -1432,7 +1430,7 @@ void CSQC_UpdateView(float w, float h)
 
        ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
 
-       float is_dead = (getstati(STAT_HEALTH) <= 0);
+       float is_dead = (STAT(HEALTH) <= 0);
 
        // FIXME do we need this hack?
        if(isdemo())
@@ -1710,7 +1708,7 @@ void CSQC_UpdateView(float w, float h)
        switchingweapon = Weapons_from(STAT(SWITCHINGWEAPON));
 
        // actually active weapon (for zoom)
-       activeweapon = Weapons_from(getstati(STAT_ACTIVEWEAPON));
+       activeweapon = Weapons_from(STAT(ACTIVEWEAPON));
 
        switchweapon = Weapons_from(STAT(SWITCHWEAPON));
 
@@ -2006,7 +2004,7 @@ void CSQC_UpdateView(float w, float h)
                splash_pos.y = (vid_conheight - splash_size.y) / 2;
 
                float myhealth_flash_temp;
-               myhealth = getstati(STAT_HEALTH);
+               myhealth = STAT(HEALTH);
 
                // fade out
                myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
@@ -2115,7 +2113,7 @@ void CSQC_UpdateView(float w, float h)
                if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
                if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
 
-               sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
+               sharpen_intensity = bound(0, ((STAT(HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
 
                if(autocvar_hud_powerup && sharpen_intensity > 0)
                {
index 2100c3f5fd41d4680937b0adfc63ff7c10cf642e..1b79f7d589ca31497f01e4ddddae42ae5fb7ceab 100644 (file)
@@ -344,8 +344,8 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                self.maxs = '0 0 -4';
                                self.move_movetype = MOVETYPE_BOUNCE;
                                self.move_touch = func_null;
-                               self.move_bounce_factor = g_balance_electro_secondary_bouncefactor;
-                               self.move_bounce_stopspeed = g_balance_electro_secondary_bouncestop;
+                               self.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor);
+                               self.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop);
                                break;
                        case PROJECTILE_RPC:
                        case PROJECTILE_ROCKET:
@@ -362,8 +362,8 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                self.maxs = '3 3 3';
                                self.move_movetype = MOVETYPE_BOUNCE;
                                self.move_touch = func_null;
-                               self.move_bounce_factor = g_balance_mortar_bouncefactor;
-                               self.move_bounce_stopspeed = g_balance_mortar_bouncestop;
+                               self.move_bounce_factor = WEP_CVAR(mortar, bouncefactor);
+                               self.move_bounce_stopspeed = WEP_CVAR(mortar, bouncestop);
                                break;
                        case PROJECTILE_SHAMBLER_LIGHTNING:
                                self.mins = '-8 -8 -8';
@@ -444,8 +444,8 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                            self.maxs = '0 0 -4';
                            self.move_movetype = MOVETYPE_BOUNCE;
                            self.move_touch = func_null;
-                           self.move_bounce_factor = g_balance_electro_secondary_bouncefactor;
-                           self.move_bounce_stopspeed = g_balance_electro_secondary_bouncestop;
+                           self.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor);
+                           self.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop);
                            break;
                        */
                        default:
index 23f43b9e94a74535614eb5919480d1a2db41236c..44b3c1baf5fe68a85080bf3666c1783d10922ee4 100644 (file)
@@ -56,9 +56,9 @@ bool monsters_animoverride(entity e)
 
 void animdecide_load_if_needed(entity e)
 {
-       if(e.modelindex == e.animdecide_modelindex)
-               return;
-       e.animdecide_modelindex = e.modelindex;
+       int mdlidx = e.modelindex;
+       if (mdlidx == e.animdecide_modelindex) return;
+       e.animdecide_modelindex = mdlidx;
 
        if(substring(e.model, 0, 16) == "models/monsters/")
        {
@@ -66,35 +66,39 @@ void animdecide_load_if_needed(entity e)
                        return;
        }
 
+#define ANIM_VEC(a, frames, rate) anim_vec(ANIM_##a, mdlidx, frames, rate)
+
        vector none = '0 0 0';
-       e.anim_die1 = animfixfps(e, '0 1 0.5', none); // 2 seconds
-       e.anim_die2 = animfixfps(e, '1 1 0.5', none); // 2 seconds
-       e.anim_draw = animfixfps(e, '2 1 3', none);
-       e.anim_duckwalk = animfixfps(e, '4 1 1', none);
-       e.anim_duckjump = animfixfps(e, '5 1 10', none);
-       e.anim_duckidle = animfixfps(e, '6 1 1', none);
-       e.anim_idle = animfixfps(e, '7 1 1', none);
-       e.anim_jump = animfixfps(e, '8 1 10', none);
-       e.anim_pain1 = animfixfps(e, '9 1 2', none); // 0.5 seconds
-       e.anim_pain2 = animfixfps(e, '10 1 2', none); // 0.5 seconds
-       e.anim_shoot = animfixfps(e, '11 1 5', none); // analyze models and set framerate
-       e.anim_taunt = animfixfps(e, '12 1 0.33', none);
-       e.anim_run = animfixfps(e, '13 1 1', none);
-       e.anim_runbackwards = animfixfps(e, '14 1 1', none);
-       e.anim_strafeleft = animfixfps(e, '15 1 1', none);
-       e.anim_straferight = animfixfps(e, '16 1 1', none);
-       e.anim_forwardright = animfixfps(e, '19 1 1', '16 1 1');
-       e.anim_forwardleft = animfixfps(e, '20 1 1', '15 1 1');
-       e.anim_backright = animfixfps(e, '21 1 1', '16 1 1');
-       e.anim_backleft  = animfixfps(e, '22 1 1', '15 1 1');
-       e.anim_melee = animfixfps(e, '23 1 1', '11 1 1');
-       e.anim_duckwalkbackwards = animfixfps(e, '24 1 1', '4 1 1');
-       e.anim_duckwalkstrafeleft = animfixfps(e, '25 1 1', '4 1 1');
-       e.anim_duckwalkstraferight = animfixfps(e, '26 1 1', '4 1 1');
-       e.anim_duckwalkforwardright = animfixfps(e, '27 1 1', '4 1 1');
-       e.anim_duckwalkforwardleft = animfixfps(e, '28 1 1', '4 1 1');
-       e.anim_duckwalkbackright = animfixfps(e, '29 1 1', '4 1 1');
-       e.anim_duckwalkbackleft  = animfixfps(e, '30 1 1', '4 1 1');
+       e.anim_die1 = animfixfps(e, ANIM_VEC(die1, 1, 0.5), none); // 2 seconds
+       e.anim_die2 = animfixfps(e, ANIM_VEC(die2, 1, 0.5), none); // 2 seconds
+       e.anim_draw = animfixfps(e, ANIM_VEC(draw, 1, 3), none);
+       e.anim_duckwalk = animfixfps(e, ANIM_VEC(duckwalk, 1, 1), none);
+       e.anim_duckjump = animfixfps(e, ANIM_VEC(duckjump, 1, 10), none);
+       e.anim_duckidle = animfixfps(e, ANIM_VEC(duckidle, 1, 1), none);
+       e.anim_idle = animfixfps(e, ANIM_VEC(idle, 1, 1), none);
+       e.anim_jump = animfixfps(e, ANIM_VEC(jump, 1, 10), none);
+       e.anim_pain1 = animfixfps(e, ANIM_VEC(pain1, 1, 2), none); // 0.5 seconds
+       e.anim_pain2 = animfixfps(e, ANIM_VEC(pain2, 1, 2), none); // 0.5 seconds
+       e.anim_shoot = animfixfps(e, ANIM_VEC(shoot, 1, 5), none); // analyze models and set framerate
+       e.anim_taunt = animfixfps(e, ANIM_VEC(taunt, 1, 0.33), none);
+       e.anim_run = animfixfps(e, ANIM_VEC(run, 1, 1), none);
+       e.anim_runbackwards = animfixfps(e, ANIM_VEC(runbackwards, 1, 1), none);
+       e.anim_strafeleft = animfixfps(e, ANIM_VEC(strafeleft, 1, 1), none);
+       e.anim_straferight = animfixfps(e, ANIM_VEC(straferight, 1, 1), none);
+       e.anim_forwardright = animfixfps(e, ANIM_VEC(forwardright, 1, 1), ANIM_VEC(straferight, 1, 1));
+       e.anim_forwardleft = animfixfps(e, ANIM_VEC(forwardleft, 1, 1), ANIM_VEC(strafeleft, 1, 1));
+       e.anim_backright = animfixfps(e, ANIM_VEC(backright, 1, 1), ANIM_VEC(straferight, 1, 1));
+       e.anim_backleft  = animfixfps(e, ANIM_VEC(backleft , 1, 1), ANIM_VEC(strafeleft, 1, 1));
+       e.anim_melee = animfixfps(e, ANIM_VEC(melee, 1, 1), ANIM_VEC(shoot, 1, 1));
+       e.anim_duckwalkbackwards = animfixfps(e, ANIM_VEC(duckwalkbackwards, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+       e.anim_duckwalkstrafeleft = animfixfps(e, ANIM_VEC(duckwalkstrafeleft, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+       e.anim_duckwalkstraferight = animfixfps(e, ANIM_VEC(duckwalkstraferight, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+       e.anim_duckwalkforwardright = animfixfps(e, ANIM_VEC(duckwalkforwardright, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+       e.anim_duckwalkforwardleft = animfixfps(e, ANIM_VEC(duckwalkforwardleft, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+       e.anim_duckwalkbackright = animfixfps(e, ANIM_VEC(duckwalkbackright, 1,  1), ANIM_VEC(duckwalk, 1, 1));
+       e.anim_duckwalkbackleft  = animfixfps(e, ANIM_VEC(duckwalkbackleft , 1,  1), ANIM_VEC(duckwalk, 1, 1));
+
+#undef ANIM_VEC
 
        // these anims ought to stay until stopped explicitly by weaponsystem
        e.anim_shoot_z = 0.001;
index 521c6ab989b906649bf774b55ca840cb8416de1b..578a30f68bccab793dbadf9e6e8b956be4dc677e 100644 (file)
@@ -8,40 +8,100 @@ void animdecide_load_if_needed(entity e);
 void animdecide_setimplicitstate(entity e, float onground);
 void animdecide_setframes(entity e, bool support_blending, .int fld_frame, .int fld_frame1time, .int fld_frame2, .int fld_frame2time);
 
+CLASS(Animation, Object)
+       ATTRIB(Animation, m_framenames, string, string_null)
+       STATIC_METHOD(Animation, getframe, int(Animation this, int mdlidx))
+       {
+               FOREACH_WORD(this.m_framenames, true, {
+                       int f = frameforname(mdlidx, it);
+                       if (f != -1) return f;
+               });
+#ifdef CSQC
+               LOG_DEBUGF("Missing animation for %s: %s\n", modelnameforindex(mdlidx), this.registered_id);
+#endif
+               return -1;
+       }
+ENDCLASS(Animation)
+
+REGISTRY(Animations, BITS(8))
+REGISTER_REGISTRY(Animations)
+#define Animations_from(id) _Animations_from(id, NULL)
+#define WriteAnimation(to, it) WriteRegistry(Animations, to, it)
+#define ReadAnimation() ReadRegistry(Animations)
+#define REGISTER_ANIMATION(id, framenames) \
+       .vector anim_##id; \
+       REGISTER(Animations, ANIM_##id, m_id, NEW(Animation)) { \
+               this.m_framenames = framenames; \
+       }
+
+vector anim_vec(Animation anim, int mdlidx, int numframes, float framerate)
+{
+       vector v;
+       v.x = Animation_getframe(anim, mdlidx);
+       v.y = numframes;
+       v.z = framerate;
+       return v;
+}
+
 // player animation data for this model
 // each vector is as follows:
 // _x = startframe
 // _y = numframes
 // _z = framerate
-.vector anim_die1; // player dies
-.vector anim_die2; // player dies differently
-.vector anim_draw; // player pulls out a weapon
-.vector anim_duckwalk; // player walking while crouching
-.vector anim_duckjump; // player jumping from a crouch
-.vector anim_duckidle; // player idling while crouching
-.vector anim_idle; // player standing
-.vector anim_jump; // player jump
-.vector anim_pain1; // player flinches from pain
-.vector anim_pain2; // player flinches from pain, differently
-.vector anim_shoot; // player shoots
-.vector anim_taunt; // player taunts others (FIXME: no code references this)
-.vector anim_run; // player running forward
-.vector anim_runbackwards; // player running backward
-.vector anim_strafeleft; // player shuffling left quickly
-.vector anim_straferight; // player shuffling right quickly
-.vector anim_forwardright; // player running forward and right
-.vector anim_forwardleft; // player running forward and left
-.vector anim_backright; // player running backward and right
-.vector anim_backleft; // player running back and left
-.vector anim_melee; // player doing the melee action
-.vector anim_duck; // player doing the melee action
-.vector anim_duckwalkbackwards;
-.vector anim_duckwalkstrafeleft;
-.vector anim_duckwalkstraferight;
-.vector anim_duckwalkforwardright;
-.vector anim_duckwalkforwardleft;
-.vector anim_duckwalkbackright;
-.vector anim_duckwalkbackleft;
+/** player dies */
+REGISTER_ANIMATION(die1, "dieone groupified_0_anim");
+/** player dies differently */
+REGISTER_ANIMATION(die2, "dietwo groupified_1_anim");
+/** player pulls out a weapon */
+REGISTER_ANIMATION(draw, "draw groupified_2_anim");
+REGISTER_ANIMATION(duck, "duck groupified_3_anim");
+/** player walking while crouching */
+REGISTER_ANIMATION(duckwalk, "duckwalk groupified_4_anim");
+/** player jumping from a crouch */
+REGISTER_ANIMATION(duckjump, "duckjump groupified_5_anim");
+/** player idling while crouching */
+REGISTER_ANIMATION(duckidle, "duckidle groupified_6_anim");
+/** player standing */
+REGISTER_ANIMATION(idle, "idle groupified_7_anim");
+/** player jump */
+REGISTER_ANIMATION(jump, "jump groupified_8_anim");
+/** player flinches from pain */
+REGISTER_ANIMATION(pain1, "painone groupified_9_anim");
+/** player flinches from pain, differently */
+REGISTER_ANIMATION(pain2, "paintwo groupified_10_anim");
+/** player shoots */
+REGISTER_ANIMATION(shoot, "shoot groupified_11_anim");
+/** player taunts others (FIXME: no code references this) */
+REGISTER_ANIMATION(taunt, "taunt groupified_12_anim");
+/** player running forward */
+REGISTER_ANIMATION(run, "run groupified_13_anim");
+/** player running backward */
+REGISTER_ANIMATION(runbackwards, "runbackwards groupified_14_anim");
+/** player shuffling left quickly */
+REGISTER_ANIMATION(strafeleft, "strafeleft groupified_15_anim");
+/** player shuffling right quickly */
+REGISTER_ANIMATION(straferight, "straferight groupified_16_anim");
+/**  */
+REGISTER_ANIMATION(dead1, "deadone groupified_17_anim");
+/**  */
+REGISTER_ANIMATION(dead2, "deadtwo groupified_18_anim");
+/** player running forward and right */
+REGISTER_ANIMATION(forwardright, "forwardright groupified_19_anim");
+/** player running forward and left */
+REGISTER_ANIMATION(forwardleft, "forwardleft groupified_20_anim");
+/** player running backward and right */
+REGISTER_ANIMATION(backright, "backright groupified_21_anim");
+/** player running back and left */
+REGISTER_ANIMATION(backleft, "backleft groupified_22_anim");
+/** player doing the melee action */
+REGISTER_ANIMATION(melee, "melee groupified_23_anim");
+REGISTER_ANIMATION(duckwalkbackwards, "duckwalkbackwards groupified_24_anim");
+REGISTER_ANIMATION(duckwalkstrafeleft, "duckwalkstrafeleft duckstrafeleft groupified_25_anim");
+REGISTER_ANIMATION(duckwalkstraferight, "duckwalkstraferight duckstraferight groupified_26_anim");
+REGISTER_ANIMATION(duckwalkforwardright, "duckwalkforwardright duckforwardright groupified_27_anim");
+REGISTER_ANIMATION(duckwalkforwardleft, "duckwalkforwardleft groupified_28_anim");
+REGISTER_ANIMATION(duckwalkbackright, "duckwalkbackright duckbackwardright groupified_29_anim");
+REGISTER_ANIMATION(duckwalkbackleft, "duckwalkbackleft duckbackwardleft groupified_30_anim");
 .float animdecide_modelindex;
 
 // please network this one
index 9e16238d17af8dea6150ee44c210229052ae5227..efe9f72684f8a554d65eab872dadea820bb1c16d 100644 (file)
@@ -13,7 +13,7 @@ REGISTRY_SORT(GENERIC_COMMANDS)
        ATTRIB(genericcommand_##id, m_description, string, description); \
        ENDCLASS(genericcommand_##id) \
     REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
-       METHOD(genericcommand_##id, m_invokecmd, void(int request, int arguments, string command))
+       METHOD(genericcommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
 
 STATIC_INIT(GENERIC_COMMANDS_aliases) {
        FOREACH(GENERIC_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu"))));
index 31909549a68f82d1d39bfc348601961ab1ca8a48..beda2288c9ff97e9bc7ee2ad4fcdb2426b263b62 100644 (file)
@@ -7,7 +7,7 @@ const int CMD_REQUEST_USAGE = 2;
 CLASS(Command, Object)
        ATTRIB(Command, m_name, string, string_null);
        ATTRIB(Command, m_description, string, string_null);
-       METHOD(Command, m_invokecmd, void(int request, int arguments, string command)) { }
+       METHOD(Command, m_invokecmd, void(int request, entity caller, int arguments, string command)) { }
 ENDCLASS(Command)
 
 #endif
index 9a50894c04116d52427c33abe093a404ff2be72e..6931a98c2d8fbb964696923564a838ca1a84646a 100644 (file)
@@ -274,16 +274,9 @@ void GenericCommand_maplist(float request, float argc)
                                {
                                        MapInfo_Enumerate();
                                        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
-                                       argc = tokenizebyseparator(cvar_string("g_maplist"), " ");
-
-                                       tmp_string = "";
-                                       for(i = 0; i < argc; ++i)
-                                               if(MapInfo_CheckMap(argv(i)))
-                                                       tmp_string = strcat(tmp_string, " ", argv(i));
-
-                                       tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
-                                       cvar_set("g_maplist", tmp_string);
-
+                                       string filtered = "";
+                                       FOREACH_WORD(cvar_string("g_maplist"), MapInfo_CheckMap(it), filtered = cons(filtered, it));
+                                       cvar_set("g_maplist", filtered);
                                        return;
                                }
 
@@ -559,7 +552,7 @@ float GenericCommand_macro_command(float argc, string command)
 {
        string c = strtolower(argv(0));
        FOREACH(GENERIC_COMMANDS, it.m_name == c, LAMBDA(
-               it.m_invokecmd(CMD_REQUEST_COMMAND, argc, command);
+               it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
                return true;
        ));
        return false;
@@ -569,7 +562,7 @@ float GenericCommand_macro_usage(float argc)
 {
        string c = strtolower(argv(1));
        FOREACH(GENERIC_COMMANDS, it.m_name == c, LAMBDA(
-               it.m_invokecmd(CMD_REQUEST_USAGE, argc, "");
+               it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
                return true;
        ));
        return false;
index 5ead52479d9efda26f400c984c566edb1b23060e..7470235f1ba156aaac09e9e4a8fa1bdc73b75571 100644 (file)
@@ -28,7 +28,7 @@ REGISTER_NET_TEMP(net_debug)
                int channel = MSG_ONE;
                msg_entity = to;
                WriteHeader(channel, net_debug);
-               WriteShort(channel, num_for_edict(this));
+               WriteShort(channel, etof(this));
                WriteByte(channel, is_pure(this));
                WriteCoord(channel, this.origin.x);
                WriteCoord(channel, this.origin.y);
@@ -71,7 +71,7 @@ bool autocvar_debugdraw;
                                pos.z = 0;
                                pos.y += ofs * size;
                                drawcolorcodedstring2(pos,
-                                       sprintf("%d: '%s'@%s:%d", (e.debug ? e.sv_entnum : num_for_edict(e)),
+                                       sprintf("%d: '%s'@%s:%d", (e.debug ? e.sv_entnum : etof(e)),
                                        e.classname, e.sourceLocFile, e.sourceLocLine),
                                        size * '1 1 0', rgb, 0.5, DRAWFLAG_NORMAL);
                                ++ofs;
@@ -81,7 +81,7 @@ bool autocvar_debugdraw;
 #endif
 
 #ifdef SVQC
-       GENERIC_COMMAND(debugdraw_sv, "Dump all server entities")
+       COMMON_COMMAND(debugdraw_sv, "Dump all server entities")
        {
                switch (request)
                {
index f4df3237d4e5ef046bb5909e84652004d2da9f59..f6b82a622c0f3330efb5fadb758b7481ecc6551a 100644 (file)
 #define EFFECTINFO_PARSER(on) \
     on(type,                                        MY(type) \
-    ,{ ASSERT(n == 1 && "type");                    MY(type) = strzone(argv(1)); \
+    ,{ demand(n == 1 && "type");                    MY(type) = strzone(argv(1)); \
     }, sprintf(" %s",                               (MY(type)) \
     )) \
     on(airfriction,                                 MY(airfriction) \
-    ,{ ASSERT(n == 1 && "airfriction");             MY(airfriction) = stof(argv(1)); \
+    ,{ demand(n == 1 && "airfriction");             MY(airfriction) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(airfriction)) \
     )) \
     on(alpha,                                       MY(alpha_min) ||                    MY(alpha_max) ||                MY(alpha_fade) \
-    ,{ ASSERT(n == 3 && "alpha");                   MY(alpha_min) = stof(argv(1));      MY(alpha_max) = stof(argv(2));  MY(alpha_fade) = stof(argv(3)); \
+    ,{ demand(n == 3 && "alpha");                   MY(alpha_min) = stof(argv(1));      MY(alpha_max) = stof(argv(2));  MY(alpha_fade) = stof(argv(3)); \
     }, sprintf(" %s %s %s",                         ftos(MY(alpha_min)),                ftos(MY(alpha_max)),            ftos(MY(alpha_fade)) \
     )) \
     on(blend,                                       MY(blend) \
-    ,{ ASSERT(n == 1 && "blend");                   MY(blend) = strzone(argv(1)); \
+    ,{ demand(n == 1 && "blend");                   MY(blend) = strzone(argv(1)); \
     }, sprintf(" %s",                               (MY(blend)) \
     )) \
     on(bounce,                                      MY(bounce) \
-    ,{ ASSERT(n == 1 && "bounce");                  MY(bounce) = stof(argv(1)); \
+    ,{ demand(n == 1 && "bounce");                  MY(bounce) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(bounce)) \
     )) \
     on(color,                                       MY(color_min) ||                    MY(color_max) \
-    ,{ ASSERT(n == 2 && "color");                   MY(color_min) = strzone(argv(1));   MY(color_max) = strzone(argv(2)); \
+    ,{ demand(n == 2 && "color");                   MY(color_min) = strzone(argv(1));   MY(color_max) = strzone(argv(2)); \
     }, sprintf(" %s %s",                            (MY(color_min)),                    (MY(color_max)) \
     )) \
     on(countabsolute,                               MY(countabsolute) \
-    ,{ ASSERT(n == 1 && "countabsolute");           MY(countabsolute) = stof(argv(1)); \
+    ,{ demand(n == 1 && "countabsolute");           MY(countabsolute) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(countabsolute)) \
     )) \
     on(count,                                       MY(count) \
-    ,{ ASSERT(n == 1 && "count");                   MY(count) = stof(argv(1)); \
+    ,{ demand(n == 1 && "count");                   MY(count) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(count)) \
     )) \
     on(gravity,                                     MY(gravity) \
-    ,{ ASSERT(n == 1 && "gravity");                 MY(gravity) = stof(argv(1)); \
+    ,{ demand(n == 1 && "gravity");                 MY(gravity) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(gravity)) \
     )) \
     on(lightcolor,                                  MY(lightcolor) \
-    ,{ ASSERT(n == 3 && "lightcolor");              MY(lightcolor) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "lightcolor");              MY(lightcolor) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(lightcolor)) \
     )) \
     on(lightradiusfade,                             MY(lightradiusfade) \
-    ,{ ASSERT(n == 1 && "lightradiusfade");         MY(lightradiusfade) = stof(argv(1)); \
+    ,{ demand(n == 1 && "lightradiusfade");         MY(lightradiusfade) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(lightradiusfade)) \
     )) \
     on(lightradius,                                 MY(lightradius) \
-    ,{ ASSERT(n == 1 && "lightradius");             MY(lightradius) = stof(argv(1)); \
+    ,{ demand(n == 1 && "lightradius");             MY(lightradius) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(lightradius)) \
     )) \
     on(lighttime,                                   MY(lighttime) \
-    ,{ ASSERT(n == 1 && "lighttime");               MY(lighttime) = stof(argv(1)); \
+    ,{ demand(n == 1 && "lighttime");               MY(lighttime) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(lighttime)) \
     )) \
     on(liquidfriction,                              MY(liquidfriction) \
-    ,{ ASSERT(n == 1 && "liquidfriction");          MY(liquidfriction) = stof(argv(1)); \
+    ,{ demand(n == 1 && "liquidfriction");          MY(liquidfriction) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(liquidfriction)) \
     )) \
     on(notunderwater,                               MY(notunderwater) \
-    ,{ ASSERT(n == 0 && "notunderwater");           MY(notunderwater) = true; \
+    ,{ demand(n == 0 && "notunderwater");           MY(notunderwater) = true; \
     }, "" \
     ) \
     on(orientation,                                 MY(orientation) \
-    ,{ ASSERT(n == 1 && "orientation");             MY(orientation) = strzone(argv(1)); \
+    ,{ demand(n == 1 && "orientation");             MY(orientation) = strzone(argv(1)); \
     }, sprintf(" %s",                               (MY(orientation)) \
     )) \
     on(originjitter,                                MY(originjitter) \
-    ,{ ASSERT(n == 3 && "originjitter");            MY(originjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "originjitter");            MY(originjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(originjitter)) \
     )) \
     on(originoffset,                                MY(originoffset) \
-    ,{ ASSERT(n == 3 && "originoffset");            MY(originoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "originoffset");            MY(originoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(originoffset)) \
     )) \
     on(relativeoriginoffset,                        MY(relativeoriginoffset) \
-    ,{ ASSERT(n == 3 && "relativeoriginoffset");    MY(relativeoriginoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "relativeoriginoffset");    MY(relativeoriginoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(relativeoriginoffset)) \
     )) \
     on(relativevelocityoffset,                      MY(relativevelocityoffset) \
-    ,{ ASSERT(n == 3 && "relativevelocityoffset");  MY(relativevelocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "relativevelocityoffset");  MY(relativevelocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(relativevelocityoffset)) \
     )) \
     on(rotate,                                      MY(startangle_min) ||               MY(startangle_max) ||               MY(spin_min) ||                 MY(spin_max) \
-    ,{ ASSERT(n == 4 && "rotate");                  MY(startangle_min) = stof(argv(1)); MY(startangle_max) = stof(argv(2)); MY(spin_min) = stof(argv(3));   MY(spin_max) = stof(argv(4)); \
+    ,{ demand(n == 4 && "rotate");                  MY(startangle_min) = stof(argv(1)); MY(startangle_max) = stof(argv(2)); MY(spin_min) = stof(argv(3));   MY(spin_max) = stof(argv(4)); \
     }, sprintf(" %s %s %s %s",                      ftos(MY(startangle_min)),           ftos(MY(startangle_max)),           ftos(MY(spin_min)),             ftos(MY(spin_max)) \
     )) \
     on(sizeincrease,                                MY(sizeincrease) \
-    ,{ ASSERT(n == 1 && "sizeincrease");            MY(sizeincrease) = stof(argv(1)); \
+    ,{ demand(n == 1 && "sizeincrease");            MY(sizeincrease) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(sizeincrease)) \
     )) \
     on(size,                                        MY(size_min) ||                     MY(size_max) \
-    ,{ ASSERT(n == 2 && "size");                    MY(size_min) = stof(argv(1));       MY(size_max) = stof(argv(2)); \
+    ,{ demand(n == 2 && "size");                    MY(size_min) = stof(argv(1));       MY(size_max) = stof(argv(2)); \
     }, sprintf(" %s %s",                            ftos(MY(size_min)),                 ftos(MY(size_max)) \
     )) \
     on(staincolor,                                  MY(staincolor_min) ||                   MY(staincolor_max) \
-    ,{ ASSERT(n == 2 && "staincolor");              MY(staincolor_min) = strzone(argv(1));  MY(staincolor_max) = strzone(argv(2)); \
+    ,{ demand(n == 2 && "staincolor");              MY(staincolor_min) = strzone(argv(1));  MY(staincolor_max) = strzone(argv(2)); \
     }, sprintf(" %s %s",                            (MY(staincolor_min)),                   (MY(staincolor_max)) \
     )) \
     on(stainsize,                                   MY(stainsize_min) ||                MY(stainsize_max) \
-    ,{ ASSERT(n == 2 && "stainsize");               MY(stainsize_min) = stof(argv(1));  MY(stainsize_max) = stof(argv(2)); \
+    ,{ demand(n == 2 && "stainsize");               MY(stainsize_min) = stof(argv(1));  MY(stainsize_max) = stof(argv(2)); \
     }, sprintf(" %s %s",                            ftos(MY(stainsize_min)),            ftos(MY(stainsize_max)) \
     )) \
     on(staintex,                                    MY(staintex_min) ||                 MY(staintex_max) \
-    ,{ ASSERT(n == 2 && "staintex");                MY(staintex_min) = stof(argv(1));   MY(staintex_max) = stof(argv(2)); \
+    ,{ demand(n == 2 && "staintex");                MY(staintex_min) = stof(argv(1));   MY(staintex_max) = stof(argv(2)); \
     }, sprintf(" %s %s",                            ftos(MY(staintex_min)),             ftos(MY(staintex_max)) \
     )) \
     on(stretchfactor,                               MY(stretchfactor) \
-    ,{ ASSERT(n == 1 && "stretchfactor");           MY(stretchfactor) = stof(argv(1)); \
+    ,{ demand(n == 1 && "stretchfactor");           MY(stretchfactor) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(stretchfactor)) \
     )) \
     on(tex,                                         MY(tex_min) ||                      MY(tex_max) \
-    ,{ ASSERT(n == 2 && "tex");                     MY(tex_min) = stof(argv(1));        MY(tex_max) = stof(argv(2)); \
+    ,{ demand(n == 2 && "tex");                     MY(tex_min) = stof(argv(1));        MY(tex_max) = stof(argv(2)); \
     }, sprintf(" %s %s",                            ftos(MY(tex_min)),                  ftos(MY(tex_max)) \
     )) \
     on(time,                                        MY(time_min) ||                     MY(time_max) \
-    ,{ ASSERT(n == 2 && "time");                    MY(time_min) = stof(argv(1));       MY(time_max) = stof(argv(2)); \
+    ,{ demand(n == 2 && "time");                    MY(time_min) = stof(argv(1));       MY(time_max) = stof(argv(2)); \
     }, sprintf(" %s %s",                            ftos(MY(time_min)),                 ftos(MY(time_max)) \
     )) \
     on(trailspacing,                                MY(trailspacing) \
-    ,{ ASSERT(n == 1 && "trailspacing");            MY(trailspacing) = stof(argv(1)); \
+    ,{ demand(n == 1 && "trailspacing");            MY(trailspacing) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(trailspacing)) \
     )) \
     on(underwater,                                  MY(underwater) \
-    ,{ ASSERT(n == 0 && "underwater");              MY(underwater) = true; \
+    ,{ demand(n == 0 && "underwater");              MY(underwater) = true; \
     }, "" \
     ) \
     on(velocityjitter,                              MY(velocityjitter) \
-    ,{ ASSERT(n == 3 && "velocityjitter");          MY(velocityjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "velocityjitter");          MY(velocityjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(velocityjitter)) \
     )) \
     on(velocitymultiplier,                          MY(velocitymultiplier) \
-    ,{ ASSERT(n == 1 && "velocitymultiplier");      MY(velocitymultiplier) = stof(argv(1)); \
+    ,{ demand(n == 1 && "velocitymultiplier");      MY(velocitymultiplier) = stof(argv(1)); \
     }, sprintf(" %s",                               ftos(MY(velocitymultiplier)) \
     )) \
     on(velocityoffset,                              MY(velocityoffset) \
-    ,{ ASSERT(n == 3 && "velocityoffset");          MY(velocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+    ,{ demand(n == 3 && "velocityoffset");          MY(velocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
     }, sprintf(" %v",                               (MY(velocityoffset)) \
     )) \
     /**/
@@ -238,11 +238,11 @@ void effectinfo_read()
         n--;
         string k = argv(0);
         if (k == "effect") {
-            ASSERT(n == 1);
+            demand(n == 1);
             info = NEW(EffectInfo, strzone(argv(1)));
             continue;
         }
-        ASSERT(info != NULL);
+        demand(info != NULL);
         switch (k) {
             #define MY(f) info.effectinfo_##f
             #define p(k, isset, parse, unparse) case #k: parse break;
@@ -259,10 +259,10 @@ void effectinfo_read()
 
 void effectinfo_dump(int fh, bool alsoprint)
 {
-    #define WRITE(s) do { \
+    #define WRITE(s) MACRO_BEGIN { \
         fputs(fh, s); \
         if (alsoprint) LOG_INFO(s); \
-    } while (0)
+    } MACRO_END
     WRITE("// ********************************************** //\n");
     WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
     WRITE("// **                                          ** //\n");
index 3c778b52ba363feab38f4edfdcdf8e2dfacc181a..19f47500e5d19f1b9efef96e5b109679cdcd181f 100644 (file)
@@ -34,9 +34,9 @@ void Violence_GibSplash_At(vector org, vector dir, float type, float amount, ent
        // if this is a copied dead body, send the num of its player instead
        // TODO: remove this field, read from model txt files
        if(self.classname == "body")
-               e.team = num_for_edict(self.enemy);
+               e.team = etof(self.enemy);
        else
-               e.team = num_for_edict(self);
+               e.team = etof(self);
 
        setorigin(e, org);
        e.velocity = dir;
index 6e0e461f2b8e707ce776ec07b57e964efe3be9d4..83a2440cf8fe08e9f1db7e3423bdcff89a37c2a5 100644 (file)
@@ -1,6 +1,6 @@
 #include "globalsound.qh"
 
-#include "../common/ent_cs.qh"
+#include "../../ent_cs.qh"
 
 #ifdef IMPLEMENTATION
        #include "../../animdecide.qh"
@@ -71,8 +71,7 @@
                        string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
                        int who = ReadByte();
                        entity e = entcs_receiver(who - 1);
-                       int chan = ReadByte();
-                       chan = (chan & BIT(7) ? -1 : 1) * (chan & BITS(7));
+                       int chan = ReadSByte();
                        float vol = ReadByte() / 255;
                        float atten = ReadByte() / 64;
                        vector o;
                        UpdatePlayerSounds(e);
                        string s = e.(ps.m_playersoundfld);
                        string sample = GlobalSound_sample(s, r);
-                       int chan = ReadByte();
-                       chan = (chan & BIT(7) ? -1 : 1) * (chan & BITS(7));
+                       int chan = ReadSByte();
                        float vol = ReadByte() / 255;
                        float atten = ReadByte() / 64;
                        vector o;
                                case VOICETYPE_TEAMRADIO:
                                {
                                        #define X() \
-                                               do \
+                                               MACRO_BEGIN \
                                                { \
                                                        float atten = (msg_entity.cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
                                                        if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \
                                                        else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
                                                        else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
-                                               } \
-                                               while (0)
+                                               } MACRO_END
 
                                        if (fake) { msg_entity = this; X(); }
                                        else
                                        float tauntrand = 0;
                                        if (voicetype == VOICETYPE_AUTOTAUNT) tauntrand = random();
                                        #define X() \
-                                               do \
+                                               MACRO_BEGIN \
                                                { \
                                                        if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < msg_entity.cvar_cl_autotaunt) \
                                                        { \
                                                                else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
                                                                else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
                                                        } \
-                                               } \
-                                               while (0)
+                                               } MACRO_END
                                        if (fake)
                                        {
                                                msg_entity = this;
index 892d3d078b3dfb523f41c6bb59ea44d4eb8c0ec6..1708f912e67fbd47af8a722b8fa08078efc1c658 100644 (file)
@@ -124,9 +124,9 @@ void PrecachePlayerSounds(string f);
        void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float voicetype, bool fake);
        #define GlobalSound(this, def, chan, voicetype) _GlobalSound(this, def, NULL, string_null, chan, voicetype, false)
        #define GlobalSound_string(this, def, chan, voicetype) _GlobalSound(this, NULL, NULL, def, chan, voicetype, false)
-       #define PlayerSound(thise, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false)
+       #define PlayerSound(this, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false)
        #define VoiceMessage(this, def, msg) \
-               do \
+               MACRO_BEGIN \
                { \
                        entity VM = def; \
                        int voicetype = VM.m_playersoundvt; \
@@ -137,8 +137,7 @@ void PrecachePlayerSounds(string f);
                        else if (flood > 0) fake = false; \
                        else break; \
                        _GlobalSound(this, NULL, VM, string_null, CH_VOICE, voicetype, fake); \
-               } \
-               while (0)
+               } MACRO_END
 
 #endif
 
index 8122ccdc0ee543ad913594b6384c697efe665971..389aadc1fd9283d1301f635d9d6f0dc93fc8b42f 100644 (file)
@@ -82,6 +82,16 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
                return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
        }
 
+       /**
+        * Same as `entcs_GetTeam`, but returns -1 for no team in teamplay
+        */
+       int entcs_GetScoreTeam(int i)
+       {
+               int t = entcs_GetTeam(i);
+               if (teamplay && !t) t = -1;
+               return t;
+       }
+
        /**
        * @param i zero indexed player
        */
index cc418df5e4da015f0a5600a41c6b66f5232ed58d..97bfe91538f6e2e820f4eb10003e9a771b9054b9 100644 (file)
@@ -180,13 +180,13 @@ void GiveBall(entity plyr, entity ball)
        }
 
        plyr.(weaponentity).weapons = plyr.weapons;
-       plyr.(weaponentity).switchweapon = plyr.weapon;
+       plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon;
        plyr.weapons = WEPSET(NEXBALL);
        setself(plyr);
        Weapon w = WEP_NEXBALL;
        w.wr_resetplayer(w);
-       plyr.switchweapon = WEP_NEXBALL.m_id;
-       W_SwitchWeapon(WEP_NEXBALL.m_id);
+       PS(plyr).m_switchweapon = WEP_NEXBALL;
+       W_SwitchWeapon(WEP_NEXBALL);
        setself(this);
 }
 
@@ -971,8 +971,8 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
                                self.weapons = self.(weaponentity).weapons;
                                Weapon w = WEP_NEXBALL;
                                w.wr_resetplayer(w);
-                               self.switchweapon = self.(weaponentity).switchweapon;
-                               W_SwitchWeapon(self.switchweapon);
+                               PS(self).m_switchweapon = self.(weaponentity).m_switchweapon;
+                               W_SwitchWeapon(PS(self).m_switchweapon);
 
                                self.(weaponentity).weapons = '0 0 0';
                        }
@@ -1021,12 +1021,12 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
 {SELFPARAM();
-       return self.weapon == WEP_NEXBALL.m_id;
+       return PS(self).m_weapon == WEP_NEXBALL;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
 {SELFPARAM();
-       return self.weapon == WEP_MORTAR.m_id; // TODO: what is this for?
+       return PS(self).m_weapon == WEP_MORTAR; // TODO: what is this for?
 }
 
 MUTATOR_HOOKFUNCTION(nb, FilterItem)
diff --git a/qcsrc/common/impulses/all.qc b/qcsrc/common/impulses/all.qc
new file mode 100644 (file)
index 0000000..b056751
--- /dev/null
@@ -0,0 +1 @@
+#include "all.qh"
diff --git a/qcsrc/common/impulses/all.qh b/qcsrc/common/impulses/all.qh
new file mode 100644 (file)
index 0000000..7f277b6
--- /dev/null
@@ -0,0 +1,222 @@
+#ifndef IMPULSES_ALL_H
+#define IMPULSES_ALL_H
+
+REGISTRY(IMPULSES, 255)
+REGISTER_REGISTRY(IMPULSES)
+REGISTRY_SORT(IMPULSES)
+STATIC_INIT(IMPULSES_renumber)
+{
+       FOREACH(IMPULSES, true, LAMBDA(it.m_id = i));
+}
+REGISTRY_CHECK(IMPULSES)
+
+.void(entity this) impulse_handle;
+
+#if defined(CSQC)
+#define IMPULSE_ALIAS(alias, id) localcmd("\nalias " #alias " \"", id ,"\"\n")
+#else
+#define IMPULSE_ALIAS(alias, id)
+#endif
+
+#define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n)
+#define _REGISTER_IMPULSE(id, alias, n) \
+       REGISTER(IMPULSES, id, m_id, new(Impulse)) \
+       { \
+               make_pure(this); \
+               this.impulse = n; \
+               IMPULSE_ALIAS(alias, "impulse " #n); \
+       }
+
+#define LEGACY_IMPULSE_ID(alias, id) LEGACY_IMPULSE(alias, id, sprintf("impulse %d", IMP_##alias.impulse))
+
+#define LEGACY_IMPULSE(alias, id, new) \
+       STATIC_INIT(legacy_##alias) { \
+               string s = new; \
+               if (s == #alias) LOG_FATALF("LEGACY_IMPULSE: would define a recursive alias for '%s', use LEGACY_IMPULSE_ID instead", s); \
+               IMPULSE_ALIAS(alias, s); \
+       } \
+       SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
+
+#define X(slot, imp) \
+       REGISTER_IMPULSE(weapon_group_##slot, imp) \
+       LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
+X(1, 1)
+X(2, 2)
+X(3, 3)
+X(4, 4)
+X(5, 5)
+X(6, 6)
+X(7, 7)
+X(8, 8)
+X(9, 9)
+X(0, 14)
+#undef X
+
+#define X(slot, dir, imp) \
+       REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
+       LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
+X(0, prev, 200)
+X(1, prev, 201)
+X(2, prev, 202)
+X(3, prev, 203)
+X(4, prev, 204)
+X(5, prev, 205)
+X(6, prev, 206)
+X(7, prev, 207)
+X(8, prev, 208)
+X(9, prev, 209)
+
+X(0, best, 210)
+X(1, best, 211)
+X(2, best, 212)
+X(3, best, 213)
+X(4, best, 214)
+X(5, best, 215)
+X(6, best, 216)
+X(7, best, 217)
+X(8, best, 218)
+X(9, best, 219)
+
+X(0, next, 220)
+X(1, next, 221)
+X(2, next, 222)
+X(3, next, 223)
+X(4, next, 224)
+X(5, next, 225)
+X(6, next, 226)
+X(7, next, 227)
+X(8, next, 228)
+X(9, next, 229)
+#undef X
+
+// direct weapons
+
+#define X(i, imp) \
+       REGISTER_IMPULSE(weapon_byid_##i, imp)
+X(0, 230)
+X(1, 231)
+X(2, 232)
+X(3, 233)
+X(4, 234)
+X(5, 235)
+X(6, 236)
+X(7, 237)
+X(8, 238)
+X(9, 239)
+X(10, 240)
+X(11, 241)
+X(12, 242)
+X(13, 243)
+X(14, 244)
+X(15, 245)
+X(16, 246)
+X(17, 247)
+X(18, 248)
+X(19, 249)
+X(20, 250)
+X(21, 251)
+X(22, 252)
+X(23, 253)
+#undef X
+
+REGISTER_IMPULSE(weapon_next_byid, 10)
+LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
+
+REGISTER_IMPULSE(weapon_prev_byid, 12)
+LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
+
+REGISTER_IMPULSE(weapon_next_bygroup, 18)
+LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
+
+REGISTER_IMPULSE(weapon_prev_bygroup, 19)
+LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
+
+REGISTER_IMPULSE(weapon_next_bypriority, 15)
+LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
+
+REGISTER_IMPULSE(weapon_prev_bypriority, 16)
+LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
+
+REGISTER_IMPULSE(weapon_last, 11)
+LEGACY_IMPULSE(weaplast, 11, "weapon_last")
+
+REGISTER_IMPULSE(weapon_best, 13)
+LEGACY_IMPULSE(weapbest, 13, "weapon_best")
+
+REGISTER_IMPULSE(weapon_drop, 17)
+LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
+
+REGISTER_IMPULSE(weapon_reload, 20)
+LEGACY_IMPULSE(reload, 20, "weapon_reload")
+
+REGISTER_IMPULSE(use, 21)
+LEGACY_IMPULSE_ID(use, 21)
+
+REGISTER_IMPULSE(waypoint_personal_here, 30)
+LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
+
+REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
+LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
+
+REGISTER_IMPULSE(waypoint_personal_death, 32)
+LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
+
+REGISTER_IMPULSE(waypoint_here_follow, 33)
+LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
+
+REGISTER_IMPULSE(waypoint_here_here, 34)
+LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
+
+REGISTER_IMPULSE(waypoint_here_crosshair, 35)
+LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
+
+REGISTER_IMPULSE(waypoint_here_death, 36)
+LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
+
+REGISTER_IMPULSE(waypoint_danger_here, 37)
+LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
+
+REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
+LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
+
+REGISTER_IMPULSE(waypoint_danger_death, 39)
+LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
+
+REGISTER_IMPULSE(waypoint_clear_personal, 47)
+LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
+
+REGISTER_IMPULSE(waypoint_clear, 48)
+LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
+
+REGISTER_IMPULSE(navwaypoint_spawn, 103)
+LEGACY_IMPULSE(g_waypointeditor_spawn, 103, "navwaypoint_spawn")
+
+REGISTER_IMPULSE(navwaypoint_remove, 104)
+LEGACY_IMPULSE(g_waypointeditor_remove, 104, "navwaypoint_remove")
+
+REGISTER_IMPULSE(navwaypoint_relink, 105)
+LEGACY_IMPULSE(g_waypointeditor_relinkall, 105, "navwaypoint_relink")
+
+REGISTER_IMPULSE(navwaypoint_save, 106)
+LEGACY_IMPULSE(g_waypointeditor_saveall, 106, "navwaypoint_save")
+
+REGISTER_IMPULSE(navwaypoint_unreachable, 107)
+LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable")
+
+#define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
+#define _CHIMPULSE(id, n) \
+       REGISTER(IMPULSES, id, m_id, new(Impulse)) \
+       { \
+               make_pure(this); \
+               this.impulse = n; \
+       }
+
+CHIMPULSE(SPEEDRUN_INIT, 30)
+CHIMPULSE(GIVE_ALL, 99)
+CHIMPULSE(CLONE_MOVING, 140)
+CHIMPULSE(SPEEDRUN, 141)
+CHIMPULSE(CLONE_STANDING, 142)
+CHIMPULSE(TELEPORT, 143)
+CHIMPULSE(R00T, 148)
+
+#endif
index 5ca1c3803da30ea19467f6daaa21074ec4ac2d74..b4cd541844576f7e7bef9163fe5b999394a7622b 100644 (file)
     #include "mapinfo.qh"
 #endif
 
+bool autocvar_developer_mapper;
+
+#define LOG_MAPWARN(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNING(__VA_ARGS__); } MACRO_END
+#define LOG_MAPWARNF(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNINGF(__VA_ARGS__); } MACRO_END
+
 // generic string stuff
 
 int _MapInfo_Cache_Active;
@@ -390,7 +395,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
        }
        if(inWorldspawn)
        {
-               LOG_INFO(fn, " ended still in worldspawn, BUG\n");
+               LOG_MAPWARN(fn, " ended still in worldspawn, BUG\n");
                return 0;
        }
        diameter = vlen(mapMaxs - mapMins);
@@ -628,7 +633,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, int pWantedType, int pThisType)
                if (sa == "") continue;
                int p = strstrofs(sa, "=", 0);
                if (p < 0) {
-                       LOG_WARNINGF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
+                       LOG_MAPWARNF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
                        continue;
                }
                string k = substring(sa, 0, p);
@@ -668,7 +673,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, int pWantedType, int pThisType)
                }
                FOREACH(Gametypes, true, LAMBDA(handled |= it.m_parse_mapinfo(k, v)));
                if (!handled)
-            LOG_WARNINGF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
+            LOG_MAPWARNF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
        }
 
        if (pWantedType == MAPINFO_TYPE_RACE && cvar("g_race_teams") >= 2)
@@ -691,13 +696,13 @@ Gametype MapInfo_Type(int t)
 
 int MapInfo_Type_FromString(string t)
 {
-#define deprecate(from, to) do { \
+#define deprecate(from, to) MACRO_BEGIN { \
        if (t == #from) { \
                string replacement = #to; \
-               LOG_WARNINGF("MapInfo_Type_FromString (probably %s): using deprecated name '%s'. Should use '%s'.\n", MapInfo_Map_bspname, t, replacement); \
+               LOG_MAPWARNF("MapInfo_Type_FromString (probably %s): using deprecated name '%s'. Should use '%s'.\n", MapInfo_Map_bspname, t, replacement); \
                t = replacement; \
        } \
-} while (0)
+} MACRO_END
        deprecate(nexball, nb);
        deprecate(freezetag, ft);
        deprecate(keepaway, ka);
@@ -770,7 +775,7 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s,
                {
                        fh = fopen(s, FILE_READ);
                        if(fh < 0)
-                               LOG_INFO("Map ", pFilename, " references not existing config file ", s, "\n");
+                               LOG_MAPWARN("Map ", pFilename, " references not existing config file ", s, "\n");
                        else
                        {
                                for (;;)
@@ -799,18 +804,18 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s,
                        }
                }
                else
-                       LOG_INFO("Map ", pFilename, " uses too many levels of inclusion\n");
+                       LOG_MAPWARN("Map ", pFilename, " uses too many levels of inclusion\n");
        }
        else if(t == "")
-               LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+               LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
        else if (!cvar_value_issafe(t))
-               LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+               LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
        else if (!cvar_value_issafe(s))
-               LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+               LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
        else if(matchacl(MAPINFO_SETTEMP_ACL_SYSTEM, t) <= 0)
-               LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+               LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
        else if(matchacl(acl, t) <= 0)
-               LOG_INFO("Map ", pFilename, " contains a denied setting, ignored\n");
+               LOG_MAPWARN("Map ", pFilename, " contains a denied setting, ignored\n");
        else
        {
                if(type == 0) // server set
@@ -870,7 +875,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
 
        if(strstrofs(pFilename, "/", 0) >= 0)
        {
-               LOG_INFO("Invalid character in map name, ignored\n");
+               LOG_MAPWARN("Invalid character in map name, ignored\n");
                return 0;
        }
 
@@ -960,7 +965,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                                error("... but I just wrote it!");
                }
 
-               LOG_INFO("WARNING: autogenerated mapinfo file ", fn, " has been loaded; please edit that file and move it to maps/", pFilename, ".mapinfo\n");
+               LOG_MAPWARN("autogenerated mapinfo file ", fn, " has been loaded; please edit that file and move it to maps/", pFilename, ".mapinfo\n");
        }
 
        _MapInfo_Map_Reset();
@@ -999,7 +1004,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        else if(t == "monsters") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_MONSTERS;
                        else if(t == "new_toys") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
                        else
-                               LOG_TRACE("Map ", pFilename, " supports unknown feature ", t, ", ignored\n");
+                               LOG_MAPWARN("Map ", pFilename, " supports unknown feature ", t, ", ignored\n");
                }
                else if(t == "hidden")
                {
@@ -1026,11 +1031,11 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                {
                        t = car(s); s = cdr(s);
                        f = MapInfo_Type_FromString(t);
-                       LOG_WARNING("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n");
+                       LOG_MAPWARN("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n");
                        if(f)
                                _MapInfo_Map_ApplyGametype (s, pGametypeToSet, f, true);
                        else
-                               LOG_TRACE("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
+                               LOG_MAPWARN("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
                }
                else if(t == "gametype")
                {
@@ -1039,7 +1044,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        if(f)
                                _MapInfo_Map_ApplyGametypeEx (s, pGametypeToSet, f);
                        else
-                               LOG_TRACE("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
+                               LOG_MAPWARN("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
                }
                else if(t == "size")
                {
@@ -1050,16 +1055,16 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        t = car(s); s = cdr(s); d = stof(t);
                        t = car(s); s = cdr(s); e = stof(t);
                        if(s == "")
-                               LOG_INFO("Map ", pFilename, " contains an incorrect size line (not enough params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
+                               LOG_MAPWARN("Map ", pFilename, " contains an incorrect size line (not enough params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
                        else
                        {
                                t = car(s); s = cdr(s); f = stof(t);
                                if(s != "")
-                                       LOG_INFO("Map ", pFilename, " contains an incorrect size line (too many params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
+                                       LOG_MAPWARN("Map ", pFilename, " contains an incorrect size line (too many params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
                                else
                                {
                                        if(a >= d || b >= e || c >= f)
-                                               LOG_INFO("Map ", pFilename, " contains an incorrect size line, mins have to be < maxs\n");
+                                               LOG_MAPWARN("Map ", pFilename, " contains an incorrect size line, mins have to be < maxs\n");
                                        else
                                        {
                                                MapInfo_Map_mins.x = a;
@@ -1084,7 +1089,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        }
                        else
                        {
-                               LOG_TRACE("Map ", pFilename, " has a setting for unknown game type ", t, ", ignored\n");
+                               LOG_MAPWARN("Map ", pFilename, " has a setting for unknown game type ", t, ", ignored\n");
                        }
                }
                else if(t == "clientsettemp_for_type")
@@ -1099,13 +1104,13 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        }
                        else
                        {
-                               LOG_TRACE("Map ", pFilename, " has a client setting for unknown game type ", t, ", ignored\n");
+                               LOG_MAPWARN("Map ", pFilename, " has a client setting for unknown game type ", t, ", ignored\n");
                        }
                }
                else if(t == "fog")
                {
                        if (!cvar_value_issafe(s))
-                               LOG_INFO("Map ", pFilename, " contains a potentially harmful fog setting, ignored\n");
+                               LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful fog setting, ignored\n");
                        else
                                MapInfo_Map_fog = s;
                }
@@ -1121,7 +1126,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        if(pGametypeToSet)
                        {
                                if (!cvar_value_issafe(t))
-                                       LOG_INFO("Map ", pFilename, " contains a potentially harmful cdtrack, ignored\n");
+                                       LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful cdtrack, ignored\n");
                                else
                                        MapInfo_Map_clientstuff = strcat(
                                                MapInfo_Map_clientstuff, "cd loop \"", t, "\"\n"
@@ -1129,7 +1134,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        }
                }
                else
-                       LOG_TRACE("Map ", pFilename, " provides unknown info item ", t, ", ignored\n");
+                       LOG_MAPWARN("Map ", pFilename, " provides unknown info item ", t, ", ignored\n");
        }
        fclose(fh);
 
@@ -1143,7 +1148,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
        MapInfo_Cache_Store();
        if(MapInfo_Map_supportedGametypes != 0)
                return r;
-       LOG_TRACE("Map ", pFilename, " supports no game types, ignored\n");
+       LOG_MAPWARN("Map ", pFilename, " supports no game types, ignored\n");
        return 0;
 }
 float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, int pGametypeToSet)
@@ -1335,14 +1340,14 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
        {
                if(cvar("g_mapinfo_allow_unsupported_modes_and_let_stuff_break"))
                {
-                       LOG_INFO("EMERGENCY: can't play the selected map in the given game mode. Working with only the override settings.\n");
+                       LOG_SEVERE("can't play the selected map in the given game mode. Working with only the override settings.\n");
                        _MapInfo_Map_ApplyGametypeEx("", t, t);
                        return; // do not call Get_ByName!
                }
 
                if(MapInfo_Map_supportedGametypes == 0)
                {
-                       LOG_INFO("Mapinfo system is not functional at all. Assuming deathmatch.\n");
+                       LOG_SEVERE("Mapinfo system is not functional at all. Assuming deathmatch.\n");
                        MapInfo_Map_supportedGametypes = MAPINFO_TYPE_DEATHMATCH;
                        MapInfo_LoadMapSettings_SaveGameType(MAPINFO_TYPE_DEATHMATCH);
                        _MapInfo_Map_ApplyGametypeEx("", MAPINFO_TYPE_DEATHMATCH, MAPINFO_TYPE_DEATHMATCH);
@@ -1357,7 +1362,7 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
                }
 
                // t is now a supported mode!
-               LOG_INFO("EMERGENCY: can't play the selected map in the given game mode. Falling back to a supported mode.\n");
+               LOG_WARNING("can't play the selected map in the given game mode. Falling back to a supported mode.\n");
                MapInfo_LoadMapSettings_SaveGameType(t);
        }
        MapInfo_Get_ByName(s, 1, t);
index a9f4a4f4cfab763ce23a22572b74b964bacb4a26..ea5596f080108ac6065d95cdb874dbd75478a846 100644 (file)
@@ -74,7 +74,7 @@ MINIGAME_SIMPLELINKED_ENTITIES
 
 void minigame_autoclean_entity(entity e)
 {
-       LOG_DEBUG("CL Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n");
+       LOG_DEBUG("CL Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")\n");
        remove(e);
 }
 
@@ -235,7 +235,7 @@ NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew)
 
        if ( sf & MINIG_SF_CREATE )
        {
-               LOG_DEBUG("CL Reading entity: ",ftos(num_for_edict(self)),
+               LOG_DEBUG("CL Reading entity: ",ftos(etof(self)),
                        " classname:",self.classname," enttype:",ftos(self.enttype) );
                LOG_DEBUG(" sf:",ftos(sf)," netname:",self.netname,"\n\n");
        }
index f69fc15b548c39ef99759700247db76dfdfedd5f..ca111e6c8cd978dd4bdd69482b0561345096d647 100644 (file)
@@ -25,7 +25,7 @@ void minigame_rmplayer(entity minigame_session, entity player)
                }
                minigame_session.minigame_event(minigame_session,"part",player);
                GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":",
-                       ftos(num_for_edict(player)),":",player.netname));
+                       ftos(etof(player)),":",player.netname));
                minigame_session.minigame_players = p.list_next;
                remove ( p );
                player_clear_minigame(player);
@@ -38,7 +38,7 @@ void minigame_rmplayer(entity minigame_session, entity player)
                        {
                                minigame_session.minigame_event(minigame_session,"part",player);
                                GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":",
-                                       ftos(num_for_edict(player)),":",player.netname));
+                                       ftos(etof(player)),":",player.netname));
                                p.list_next = e.list_next;
                                remove(e);
                                player_clear_minigame(player);
@@ -86,7 +86,7 @@ bool minigame_SendEntity(entity this, entity to, int sf)
                if ( sf & MINIG_SF_CREATE )
                {
                        WriteString(MSG_ENTITY,self.owner.netname);
-                       WriteLong(MSG_ENTITY,num_for_edict(self.minigame_players));
+                       WriteLong(MSG_ENTITY,etof(self.minigame_players));
                }
                if ( sf & MINIG_SF_UPDATE )
                        WriteByte(MSG_ENTITY,self.team);
@@ -155,7 +155,7 @@ int minigame_addplayer(entity minigame_session, entity player)
        }
        else { remove(player_pointer); }
        GameLogEcho(strcat(":minigame:join",(mgteam?"":"fail"),":",minigame_session.netname,":",
-               ftos(num_for_edict(player)),":",player.netname));
+               ftos(etof(player)),":",player.netname));
 
        return mgteam;
 }
@@ -169,7 +169,7 @@ entity start_minigame(entity player, string minigame )
        if ( e )
        {
                entity minig = new(minigame);
-               minig.netname = strzone(strcat(e.netname,"_",ftos(num_for_edict(minig))));
+               minig.netname = strzone(strcat(e.netname,"_",ftos(etof(minig))));
                minig.descriptor = e;
                minig.minigame_event = e.minigame_event;
                minig.minigame_event(minig,"start");
@@ -235,7 +235,7 @@ void end_minigame(entity minigame_session)
        while( (e = findentity(e, owner, minigame_session)) )
                if ( e.minigame_autoclean )
                {
-                       LOG_TRACE("SV Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n");
+                       LOG_TRACE("SV Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")\n");
                        remove(e);
                }
 
@@ -274,7 +274,7 @@ string invite_minigame(entity inviter, entity player)
                inviter.active_minigame.netname, inviter.netname );
 
        GameLogEcho(strcat(":minigame:invite:",inviter.active_minigame.netname,":",
-               ftos(num_for_edict(player)),":",player.netname));
+               ftos(etof(player)),":",player.netname));
 
        return "";
 }
@@ -290,12 +290,13 @@ entity minigame_find_player(entity client)
        return world;
 }
 
-bool MinigameImpulse(int imp)
-{SELFPARAM();
-       entity e = minigame_find_player(self);
-       if ( imp && self.active_minigame && e )
+bool MinigameImpulse(entity this, int imp)
+{
+       if (!this.active_minigame) return false;
+       entity e = minigame_find_player(this);
+       if ( imp && this.active_minigame && e )
        {
-               return self.active_minigame.minigame_event(self.active_minigame,"impulse",e,imp);
+               return this.active_minigame.minigame_event(this.active_minigame,"impulse",e,imp);
        }
        return false;
 }
index 10e0a039fe3a5755bd22d4a075637150206dc449..2a8496932c177d6b928f85982c2054aa2a00dd00 100644 (file)
@@ -27,7 +27,7 @@ void end_minigames();
 bool minigame_CheckSend();
 
 // Check for minigame impulses
-bool MinigameImpulse(int imp);
+bool MinigameImpulse(entity this, int imp);
 
 // Parse a client command ( cmd minigame ... )
 void ClientCommand_minigame(int request, int argc, string command);
index f6b52dae0784e60fc08b8ddbcc20111d179ba136..e03e9fae413ca5988090aef046981d96fd0a8dc1 100644 (file)
@@ -441,12 +441,12 @@ bool _Movetype_UnstickEntity(entity this)  // SV_UnstickEntity
                if(!_Movetype_TestEntityPosition(this, '0 0 -1' * i)) goto success;
                if(!_Movetype_TestEntityPosition(this, '0 0 1' * i)) goto success;
        }
-       LOG_DEBUG("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n",
-               num_for_edict(this), this.classname, vtos(this.move_origin));
+       LOG_DEBUGF("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n",
+               etof(this), this.classname, vtos(this.move_origin));
        return false;
        : success;
-       LOG_DEBUG("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n",
-               num_for_edict(this), this.classname, vtos(this.move_origin));
+       LOG_DEBUGF("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n",
+               etof(this), this.classname, vtos(this.move_origin));
        _Movetype_LinkEdict(this, true);
        return true;
 }
index 54b7b662413e28aff63f1c6795aef7ea11237063..6e06e5590943b0c5a7619b96d46a5fcfa8876181 100644 (file)
@@ -300,7 +300,7 @@ STATIC_INIT_LATE(Mutators) {
     bool mut##_##cb() { return = false; } \
     [[accumulate]] bool mut##_##cb()
 
-#define MUTATOR_HOOK(cb, func, order) do {                              \
+#define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN {                     \
     MUTATOR_ONADD {                                                     \
         if (!CallbackChain_Add(HOOK_##cb, CALLBACK_##func, order)) {    \
             LOG_INFO("HOOK FAILED: ", #cb, ":", #func, "\n");           \
@@ -310,7 +310,7 @@ STATIC_INIT_LATE(Mutators) {
     MUTATOR_ONROLLBACK_OR_REMOVE {                                      \
         CallbackChain_Remove(HOOK_##cb, CALLBACK_##func);               \
     }                                                                   \
-} while (0)
+} MACRO_END
 
 #include "events.qh"
 
index 1c9e3a2177b9f3c07f5822392e0232d4d88ba6e7..37a0573dcf56accbd31d630f2cd280ee842b864e 100644 (file)
@@ -880,7 +880,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 
        if(self.buffs & BUFF_AMMO.m_itemid)
        if(self.clip_size)
-               self.clip_load = self.(weapon_load[self.switchweapon]) = self.clip_size;
+               self.clip_load = self.(weapon_load[PS(self).m_switchweapon.m_id]) = self.clip_size;
 
        if((self.buffs & BUFF_INVISIBLE.m_itemid) && (self.oldbuffs & BUFF_INVISIBLE.m_itemid))
        if(self.alpha != autocvar_g_buffs_invisible_alpha)
@@ -902,7 +902,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 
                        if(self.clip_load)
                                self.buff_ammo_prev_clipload = self.clip_load;
-                       self.clip_load = self.(weapon_load[self.switchweapon]) = self.clip_size;
+                       self.clip_load = self.(weapon_load[PS(self).m_switchweapon.m_id]) = self.clip_size;
                }
 
                BUFF_ONREM(BUFF_AMMO)
index 6d16fd15096b3f39cf8131122a9f6c55b5e5ae56..d2f350c5f2bcaa3a9dcba264a541f84c305ff700 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef MENUQC
-#define NADE_PROJECTILE(i, projectile, trail) do { \
+#define NADE_PROJECTILE(i, projectile, trail) MACRO_BEGIN { \
     this.m_projectile[i] = projectile; \
     this.m_trail[i] = trail; \
-} while (0)
+} MACRO_END
 #else
 #define NADE_PROJECTILE(i, projectile, trail)
 #endif
index c1ab9774dacc7d8a9cfb93d7cd9739a7a60163dc..28aaac5dc17664df2622bcfab6634cc4ed3c66da 100644 (file)
@@ -658,6 +658,11 @@ void nade_boom()
 
 void nade_touch()
 {SELFPARAM();
+       if(other)
+               UpdateCSQCProjectile(self);
+
+       if(other == self.realowner)
+               return; // no self impacts
        /*float is_weapclip = 0;
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
        if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
index 2a0df8c642cce3b1157525e477675a64a833cb2e..20a9d94f5452c6c5d63885e2f6de5ced4baaa890 100644 (file)
@@ -169,8 +169,7 @@ MUTATOR_HOOKFUNCTION(nt, SetStartItems)
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
                entity e = Weapons_from(i);
-               if(!e.weapon)
-                       continue;
+               if(e == WEP_Null) continue;
 
                n = tokenize_console(nt_GetReplacement(e.netname, autocvar_g_new_toys_autoreplace));
 
index a07ad44cac4a25d6d96959810a5324c4f9d5b077..a6d42d58e8fc650911d0b80926e515143dfeb5e5 100644 (file)
@@ -68,8 +68,8 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
                        e.ammo_rockets = start_ammo_rockets;
                        e.ammo_fuel = start_ammo_fuel;
                        e.weapons = start_weapons;
-                       if(!client_hasweapon(e, e.weapon, true, false))
-                               e.switchweapon = w_getbestweapon(self);
+                       if(!client_hasweapon(e, PS(e).m_weapon, true, false))
+                               PS(e).m_switchweapon = w_getbestweapon(self);
                }
        }
 
@@ -79,8 +79,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
 bool NIX_CanChooseWeapon(int wpn)
 {
        entity e = Weapons_from(wpn);
-       if(!e.weapon) // skip dummies
-               return false;
+       if (e == WEP_Null) return false; // skip dummies
        if(g_weaponarena)
        {
                if(!(g_weaponarena_weapons & e.m_wepset))
@@ -210,10 +209,13 @@ void NIX_GiveCurrentWeapon()
                self.weapons |= WEPSET(BLASTER);
        self.weapons |= e.m_wepset;
 
-       if(self.switchweapon != nix_weapon)
-               if(!client_hasweapon(self, self.switchweapon, true, false))
-                       if(client_hasweapon(self, nix_weapon, true, false))
-                               W_SwitchWeapon(nix_weapon);
+    Weapon w = Weapons_from(nix_weapon);
+       if(PS(self).m_switchweapon != w)
+               if(!client_hasweapon(self, PS(self).m_switchweapon, true, false))
+               {
+                       if(client_hasweapon(self, w, true, false))
+                               W_SwitchWeapon(w);
+               }
 }
 
 MUTATOR_HOOKFUNCTION(nix, ForbidThrowCurrentWeapon)
index 8341f7c71d4230faa24cf86286e3f29a742f7c7b..28b1715e18cd23e348753815ff26e960821716c7 100644 (file)
@@ -14,31 +14,32 @@ CLASS(HeavyMachineGun, Weapon)
 /* wepimg    */ ATTRIB(HeavyMachineGun, model2, string, "weaponhmg");
 /* refname   */ ATTRIB(HeavyMachineGun, netname, string, "hmg");
 /* wepname   */ ATTRIB(HeavyMachineGun, m_name, string, _("Heavy Machine Gun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, solidpenetration, float, NONE) \
+               P(class, prefix, spread_add, float, NONE) \
+               P(class, prefix, spread_max, float, NONE) \
+               P(class, prefix, spread_min, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, HeavyMachineGun, hmg)
+#undef X
+
 ENDCLASS(HeavyMachineGun)
-REGISTER_WEAPON(HMG, NEW(HeavyMachineGun));
-
-#define HMG_SETTINGS(w_cvar,w_prop) HMG_SETTINGS_LIST(w_cvar, w_prop, HMG, hmg)
-#define HMG_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, spread_min) \
-       w_cvar(id, sn, NONE, spread_max) \
-       w_cvar(id, sn, NONE, spread_add) \
-       w_cvar(id, sn, NONE, solidpenetration) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun));
 
-#ifdef SVQC
-HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -118,10 +119,6 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
                                }
                        }
                }
-               METHOD(HeavyMachineGun, wr_init, void(entity thiswep))
-               {
-                       HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
@@ -140,10 +137,6 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
                        return ammo_amount;
                }
-               METHOD(HeavyMachineGun, wr_config, void(entity thiswep))
-               {
-                       HMG_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(HeavyMachineGun, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
index 05b6ddde34ae3bb9560259da179eca784ebe8d82..bd1a9efe308496c9a4cecb38b58d6c40b36514c7 100644 (file)
@@ -44,7 +44,7 @@ MUTATOR_HOOKFUNCTION(ok, W_DecreaseAmmo)
        entity actor = MUTATOR_ARGV(0, entity);
        if (actor.ok_use_ammocharge)
        {
-               ok_DecreaseCharge(actor, actor.weapon);
+               ok_DecreaseCharge(actor, PS(actor).m_weapon.m_id);
                return true;
        }
 }
@@ -65,8 +65,7 @@ void ok_DecreaseCharge(entity ent, int wep)
 
        entity wepent = Weapons_from(wep);
 
-       if(wepent.weapon == 0)
-               return; // dummy
+       if (wepent == WEP_Null) return;  // dummy
 
        ent.ammo_charge[wep] -= max(0, cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
 }
@@ -75,8 +74,7 @@ void ok_IncreaseCharge(entity ent, int wep)
 {
        entity wepent = Weapons_from(wep);
 
-       if(wepent.weapon == 0)
-               return; // dummy
+       if (wepent == WEP_Null) return;  // dummy
 
        if(ent.ok_use_ammocharge)
        if(!ent.BUTTON_ATCK) // not while attacking?
@@ -89,8 +87,7 @@ float ok_CheckWeaponCharge(entity ent, int wep)
 
        entity wepent = Weapons_from(wep);
 
-       if(wepent.weapon == 0)
-               return 0; // dummy
+       if(wepent == WEP_Null) return 0;  // dummy
 
        return (ent.ammo_charge[wep] >= cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
 }
@@ -123,29 +120,30 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDamage_SplitHealthArmor)
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerDies)
-{SELFPARAM();
+{
+       SELFPARAM();
        entity targ = ((frag_attacker) ? frag_attacker : frag_target);
 
-       if(IS_MONSTER(self))
+       if(IS_MONSTER(this))
        {
                remove(other); // remove default item
-               other = world;
+               other = NULL;
        }
 
-       setself(new(droppedweapon)); // hax
-       self.ok_item = true;
-       self.noalign = true;
-       self.pickup_anyway = true;
-       spawnfunc_item_armor_small(this);
-       self.movetype = MOVETYPE_TOSS;
-       self.gravity = 1;
-       self.reset = SUB_Remove;
-       setorigin(self, frag_target.origin + '0 0 32');
-       self.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
-       SUB_SetFade(self, time + 5, 1);
-       setself(this);
-
-       self.ok_lastwep = self.switchweapon;
+       entity e = new(droppedweapon); // hax
+       e.ok_item = true;
+       e.noalign = true;
+       e.pickup_anyway = true;
+       e.spawnfunc_checked = true;
+       spawnfunc_item_armor_small(e);
+       e.movetype = MOVETYPE_TOSS;
+       e.gravity = 1;
+       e.reset = SUB_Remove;
+       setorigin(e, frag_target.origin + '0 0 32');
+       e.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
+       SUB_SetFade(e, time + 5, 1);
+
+       this.ok_lastwep = PS(this).m_switchweapon.m_id;
 
        return false;
 }
@@ -185,11 +183,11 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
 
        if(self.ok_lastwep)
        {
-               self.switchweapon = self.ok_lastwep;
+               PS(self).m_switchweapon = Weapons_from(self.ok_lastwep);
                self.ok_lastwep = 0;
        }
 
-       ok_IncreaseCharge(self, self.weapon);
+       ok_IncreaseCharge(self, PS(self).m_weapon.m_id);
 
        if(self.BUTTON_ATCK2)
        if(!forbidWeaponUse(self) || self.weapon_blocked) // allow if weapon is blocked
@@ -198,8 +196,8 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor();
                makevectors(self.v_angle);
 
-               int oldwep = self.weapon;
-               self.weapon = WEP_BLASTER.m_id;
+               Weapon oldwep = PS(self).m_weapon;
+               PS(self).m_weapon = WEP_BLASTER;
                W_Blaster_Attack(
                        self,
                        WEP_BLASTER.m_id | HITTYPE_SECONDARY,
@@ -213,23 +211,23 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                        WEP_CVAR_SEC(vaporizer, delay),
                        WEP_CVAR_SEC(vaporizer, lifetime)
                );
-               self.weapon = oldwep;
+               PS(self).m_weapon = oldwep;
        }
 
        self.weapon_blocked = false;
 
-       self.ok_ammo_charge = self.ammo_charge[self.weapon];
+       self.ok_ammo_charge = self.ammo_charge[PS(self).m_weapon.m_id];
 
        if(self.ok_use_ammocharge)
-       if(!ok_CheckWeaponCharge(self, self.weapon))
+       if(!ok_CheckWeaponCharge(self, PS(self).m_weapon.m_id))
        {
-               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && self.weapon == self.switchweapon)
+               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && PS(self).m_weapon == PS(self).m_switchweapon)
                {
                        //Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE);
                        self.ok_notice_time = time + 2;
                        play2(self, SND(DRYFIRE));
                }
-               Weapon wpn = Weapons_from(self.weapon);
+               Weapon wpn = PS(self).m_weapon;
                .entity weaponentity = weaponentities[0]; // TODO: unhardcode
                if(self.(weaponentity).state != WS_CLEAR)
                        w_ready(wpn, self, weaponentity, (self.BUTTON_ATCK ? 1 : 0) | (self.BUTTON_ATCK2 ? 2 : 0));
@@ -279,6 +277,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        wep.team = self.team;
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
                        wep.pickup_anyway = true;
+                       wep.spawnfunc_checked = true;
                        wep.think = self_spawnfunc_weapon_hmg;
                        wep.nextthink = time + 0.1;
                        return true;
@@ -295,6 +294,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        wep.team = self.team;
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
                        wep.pickup_anyway = true;
+                       wep.spawnfunc_checked = true;
                        wep.think = self_spawnfunc_weapon_rpc;
                        wep.nextthink = time + 0.1;
                        return true;
@@ -320,7 +320,7 @@ MUTATOR_HOOKFUNCTION(ok, FilterItem)
 
 MUTATOR_HOOKFUNCTION(ok, SpectateCopy)
 {SELFPARAM();
-       self.ammo_charge[self.weapon] = other.ammo_charge[other.weapon];
+       self.ammo_charge[PS(self).m_weapon.m_id] = other.ammo_charge[PS(other).m_weapon.m_id];
        self.ok_use_ammocharge = other.ok_use_ammocharge;
 
        return false;
index 94f1bd10cf5ba38bf4242ec4a0564e083377a0f1..638873d341bae18451655bb4532dd24e49ecace0 100644 (file)
@@ -14,36 +14,37 @@ CLASS(RocketPropelledChainsaw, Weapon)
 /* wepimg    */ ATTRIB(RocketPropelledChainsaw, model2, string, "weaponrpc");
 /* refname   */ ATTRIB(RocketPropelledChainsaw, netname, string, "rpc");
 /* wepname   */ ATTRIB(RocketPropelledChainsaw, m_name, string, _("Rocket Propelled Chainsaw"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, damage2, float, NONE) \
+               P(class, prefix, damageforcescale, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, health, float, NONE) \
+               P(class, prefix, lifetime, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, speedaccel, float, NONE) \
+               P(class, prefix, speed, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, RocketPropelledChainsaw, rpc)
+#undef X
+
 ENDCLASS(RocketPropelledChainsaw)
-REGISTER_WEAPON(RPC, NEW(RocketPropelledChainsaw));
-
-#define RPC_SETTINGS(w_cvar,w_prop) RPC_SETTINGS_LIST(w_cvar, w_prop, RPC, rpc)
-#define RPC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, damage2) \
-       w_cvar(id, sn, NONE, damageforcescale) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, health) \
-       w_cvar(id, sn, NONE, lifetime) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, speed) \
-       w_cvar(id, sn, NONE, speedaccel) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw));
 
-#ifdef SVQC
-RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -174,13 +175,9 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                                }
                        }
                }
-               METHOD(RocketPropelledChainsaw, wr_init, void(entity thiswep))
-               {
-                       RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(RPC) >= WEP_CVAR(rpc, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
                        ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
                        return ammo_amount;
                }
@@ -188,10 +185,6 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                {
                        return false;
                }
-               METHOD(RocketPropelledChainsaw, wr_config, void(entity thiswep))
-               {
-                       RPC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
index 99c1321c1aaa37062f84830272978a5efdaea0fc..d5cbb7fdaeb75b5833aba3266cde6810b2ec6293 100644 (file)
@@ -5,7 +5,7 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
 {SELFPARAM();
        for(int j = WEP_FIRST; j <= WEP_LAST; ++j)
        if(self.weapons & WepSet_FromWeapon(Weapons_from(j)))
-       if(self.switchweapon != j)
+       if(PS(self).m_switchweapon.m_id != j)
        if(W_IsWeaponThrowable(j))
                W_ThrowNewWeapon(self, j, false, self.origin + (self.mins + self.maxs) * 0.5, randomvec() * 175 + '0 0 325');
 
index c25997b1a3dc75c5a15f3e36e5fce9bc87670472..06f310799423f05c635f263e76e74b35225e8f75 100644 (file)
@@ -79,7 +79,7 @@ void cl_notice_run()
     drawfill(v1, v2, '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
 
     vector v3 = v1 + '10 10 0';
-    #define OUT(s, z) do { drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3.y += z + 4; } while (0)
+    #define OUT(s, z) MACRO_BEGIN { drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3.y += z + 4; } MACRO_END
 
     OUT(_("^1Server notices:"), 32);
     LL_EACH(cl_notices, it.alpha > time, LAMBDA(
index 94a46d94aed1774daf01790a11414ca9509b329e..c8664e7af04743d2fce4886ed2ce463a4c185cb4 100644 (file)
@@ -239,14 +239,14 @@ void Destroy_All_Notifications()
        entity notif;
        int i;
 
-       #define DESTROY_LOOP(type,count) do { \
+       #define DESTROY_LOOP(type,count) MACRO_BEGIN { \
                for(i = 1; i <= count; ++i) \
                { \
                        notif = Get_Notif_Ent(type, i); \
                        if (!notif) { backtrace("Destroy_All_Notifications(): Missing notification entity!\n"); return; } \
                        Destroy_Notification_Entity(notif); \
                } \
-       } while(0)
+       } MACRO_END
 
        // kill all networked notifications and centerprints
        #ifdef SVQC
@@ -737,7 +737,7 @@ void Create_Notification_Entity(
                                // ======================
                                //  Process Notif String
                                // ======================
-                               #define SET_NOTIF_STRING(string,stringname) do { \
+                               #define SET_NOTIF_STRING(string,stringname) MACRO_BEGIN { \
                                        notif.nent_string = strzone(CCR( \
                                                Process_Notif_Line( \
                                                        typeId, \
@@ -748,7 +748,7 @@ void Create_Notification_Entity(
                                                        stringname \
                                                )) \
                                        ); \
-                               } while(0)
+                               } MACRO_END
 
                                if(GENTLE)
                                {
@@ -2049,7 +2049,7 @@ void Send_Notification(
                //   2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
                entity found_choice;
 
-               #define RECURSE_FROM_CHOICE(ent,action) do { \
+               #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \
                        if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
                        { \
                                switch(ent.msg_choice_choices[net_name - 1]) \
@@ -2069,7 +2069,7 @@ void Send_Notification(
                                found_choice.nent_floatcount, \
                                s1, s2, s3, s4, \
                                f1, f2, f3, f4); \
-               } while(0)
+               } MACRO_END
 
                switch(broadcast)
                {
index f3cd0ba494ea482f77b60441f0d7219cc365a815..6619e7d7304aa89d1a5b2f446ce0ae998d027a91 100644 (file)
@@ -318,7 +318,7 @@ string BUFF_NAME(int i);
     ARG_CASE(ARG_CS_SV,     "spree_inf",     (autocvar_notification_show_sprees ? notif_arg_spree_inf(1, input, s2, f2) : "")) \
     ARG_CASE(ARG_CS_SV,     "spree_end",     (autocvar_notification_show_sprees ? notif_arg_spree_inf(-1, "", "", f1) : "")) \
     ARG_CASE(ARG_CS_SV,     "spree_lost",    (autocvar_notification_show_sprees ? notif_arg_spree_inf(-2, "", "", f1) : "")) \
-    ARG_CASE(ARG_CS_SV,     "item_wepname",  WEP_NAME(f1)) \
+    ARG_CASE(ARG_CS_SV,     "item_wepname",  Weapons_from(f1).m_name) \
     ARG_CASE(ARG_CS_SV,     "item_buffname", BUFF_NAME(f1)) \
     ARG_CASE(ARG_CS_SV,     "f3buffname",    BUFF_NAME(f3)) \
     ARG_CASE(ARG_CS_SV,     "item_wepammo",  (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \
@@ -328,9 +328,9 @@ string BUFF_NAME(int i);
     ARG_CASE(ARG_CS_SV_HA,  "minigame1_name",find(world,netname,s1).descriptor.message) \
     ARG_CASE(ARG_CS_SV_HA,  "minigame1_d",   find(world,netname,s1).descriptor.netname)
 
-#define NOTIF_HIT_MAX(count,funcname) do { \
+#define NOTIF_HIT_MAX(count,funcname) MACRO_BEGIN { \
     if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; } \
-} while(0)
+} MACRO_END
 #define NOTIF_HIT_UNKNOWN(token,funcname) { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; }
 
 #define KILL_SPREE_LIST \
@@ -897,29 +897,6 @@ float notif_global_error;
 void RegisterNotifications_First()
 {
     notif_global_error = false;
-
-    #ifdef SVQC
-    #define dedi (server_is_dedicated ? "a dedicated " : "")
-    #else
-    #define dedi ""
-    #endif
-
-    LOG_INFOF("Beginning notification initialization on %s%s program...\n", dedi, PROGNAME);
-    #undef dedi
-
-    // maybe do another implementation of this with checksums? for now, we don't need versioning
-    /*if(autocvar_notification_version != NOTIF_VERSION)
-    {
-        #ifdef CSQC
-        if(autocvar_notification_version_mismatch_client_error)
-        #else
-        if(autocvar_notification_version_mismatch_server_error)
-        #endif
-            notif_global_error = true;
-
-        printf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n",
-            PROGNAME, autocvar_notification_version, NOTIF_VERSION);
-    }*/
 }
 
 void RegisterNotifications_Done()
@@ -928,11 +905,10 @@ void RegisterNotifications_Done()
     {
         // shit happened... stop the loading of the program now if this is unacceptable
         if(autocvar_notification_errors_are_fatal)
-            error("Notification initialization failed! Read above and fix the errors!\n");
+            LOG_FATAL("Notification initialization failed! Read above and fix the errors!\n");
         else
-            LOG_INFO("Notification initialization failed! Read above and fix the errors!\n");
+            LOG_SEVERE("Notification initialization failed! Read above and fix the errors!\n");
     }
-    else { LOG_INFO("Notification initialization successful!\n"); }
 }
 
 // NOW we actually activate the declarations
index f7551e253a5341be8df131b048529c4a3f011f05..dc1dcacde3ae0fdefb994972f704c9ea59ac1163 100644 (file)
@@ -628,7 +628,7 @@ string specialcommand = "xwxwxsxsxaxdxaxdx1x ";
 void SpecialCommand()
 {
 #ifdef SVQC
-       if (!CheatImpulse(99))
+       if (!CheatImpulse(CHIMPULSE_GIVE_ALL.impulse))
                LOG_INFO("A hollow voice says \"Plugh\".\n");
 #endif
 }
@@ -1258,7 +1258,7 @@ void PM_Main(entity this)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
 #ifdef CSQC
-       this.items = getstati(STAT_ITEMS, 0, 24);
+       this.items = STAT(ITEMS);
 
        this.movement = PHYS_INPUT_MOVEVALUES(this);
 
index 92c5ef059ae7e160b2f282f886c96135b6f86467..0ec413c37edd53c6d2572e5bcc0bce1128d63715 100644 (file)
@@ -76,7 +76,7 @@ void soundat(entity e, vector o, int chan, string samp, float vol, float _atten)
 void stopsoundto(int _dest, entity e, int chan)
 {
        if (!sound_allowed(_dest, e)) return;
-       int entno = num_for_edict(e);
+       int entno = etof(e);
        if (entno >= 8192 || chan < 0 || chan > 7)
        {
                int idx = precache_sound_index(SND(Null));
index 1e02758580b7a7e2c982fd36dbd3019013809a61..7e9ba263240f759de67320a778bbc9137612edea 100644 (file)
@@ -40,13 +40,12 @@ const float VOL_BASEVOICE = 1.0;
 // Otherwise, channels 8 to 15 would be blocked for a weird QW feature.
 #ifdef SVQC
        #define _sound(e, c, s, v, a) \
-               do \
+               MACRO_BEGIN \
                { \
                        entity __e = e; \
-                       if (!sound_allowed(MSG_BROADCAST, __e)) break; \
-                       sound7(__e, c, s, v, a, 0, 0); \
-               } \
-               while (0)
+                       if (sound_allowed(MSG_BROADCAST, __e)) \
+                               sound7(__e, c, s, v, a, 0, 0); \
+               } MACRO_END
 #else
        #define _sound(e, c, s, v, a) sound7(e, c, s, v, a, 0, 0)
 #endif
@@ -65,7 +64,7 @@ const float VOL_BASEVOICE = 1.0;
  * @param sf
  */
 #define sound8(e, o, chan, samp, vol, atten, speed, sf) \
-       do \
+       MACRO_BEGIN \
        { \
                entity __e; \
                int __chan = chan; \
@@ -87,11 +86,12 @@ const float VOL_BASEVOICE = 1.0;
                setorigin(__e, o); \
                setsize(__e, '0 0 0', '0 0 0'); \
                sound7(__e, __chan, __samp, vol, atten, speed, sf); \
-               if (auto) break; \
-               setorigin(__e, old_origin); \
-               setsize(__e, old_mins, old_maxs); \
-       } \
-       while (0)
+               if (!auto) \
+               { \
+                       setorigin(__e, old_origin); \
+                       setsize(__e, old_mins, old_maxs); \
+               } \
+       } MACRO_END
 
 CLASS(Sound, Object)
        ATTRIB(Sound, m_id, int, 0)
diff --git a/qcsrc/common/state.qh b/qcsrc/common/state.qh
new file mode 100644 (file)
index 0000000..1779354
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * Purpose: common player state, usable on client and server
+ * Client: singleton representing the viewed player
+ * Server: instance per client, clients decoupled from players
+ */
+CLASS(PlayerState, Object)
+       ATTRIB(PlayerState, m_client, entity, NULL)
+       CONSTRUCTOR(PlayerState, entity client)
+       {
+               CONSTRUCT(PlayerState);
+               this.m_client = client;
+       }
+       ATTRIB(PlayerState, m_switchingweapon, Weapon, Weapons_from(-1))
+       ATTRIB(PlayerState, m_switchweapon, Weapon, Weapons_from(-1))
+       ATTRIB(PlayerState, m_weapon, Weapon, Weapons_from(-1))
+       METHOD(PlayerState, ps_push, void(PlayerState this, entity cl))
+       {
+               STAT(ACTIVEWEAPON, cl) = this.m_weapon.m_id;
+               STAT(SWITCHINGWEAPON, cl) = this.m_switchingweapon.m_id;
+               STAT(SWITCHWEAPON, cl) = this.m_switchweapon.m_id;
+       }
+ENDCLASS(PlayerState)
+
+.PlayerState _ps;
+#if NDEBUG
+       #define PS(this) (this._ps)
+#else
+       PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
+#endif
+
+void PlayerState_attach(entity this)
+{
+       // TODO: dynamic
+       // this._ps = NEW(PlayerState, this);
+}
+
+void PlayerState_detach(entity this)
+{
+       // TODO: dynamic
+       // if (!PS(this)) return;  // initial connect
+       // remove(PS(this));
+       // this._ps = NULL;
+}
+
+/**
+ * Purpose: common client state, usable on client and server
+ * Client: singleton representing the viewed player
+ * Server: instance per client
+ */
+CLASS(ClientState, Object)
+       ATTRIB(ClientState, m_client, entity, NULL)
+       CONSTRUCTOR(ClientState, entity client)
+       {
+               CONSTRUCT(ClientState);
+               this.m_client = client;
+       }
+ENDCLASS(ClientState)
+
+.ClientState _cs;
+
+#if NDEBUG
+       #define CS(this) (this._cs)
+#else
+       ClientState CS(entity this) { assert(IS_CLIENT(this)); assert(this._cs); return this._cs; }
+#endif
+
+void ClientState_attach(entity this)
+{
+       this._cs = NEW(ClientState, this);
+       this._ps = NEW(PlayerState, this);  // TODO: dynamic
+}
+
+void ClientState_detach(entity this)
+{
+       remove(CS(this));
+       this._cs = NULL;
+       this._ps = NULL;  // TODO: dynamic
+}
index d52329333ca400399984919a8e7857cb0ce1007b..e8320bda49db2078ed1437b3bfa99a1368d1e388 100644 (file)
@@ -9,16 +9,37 @@
 // 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
 
 const int MAX_CL_STATS = 256;
-#ifndef CSQC
-const int STAT_HEALTH = 0; // .health
-const int STAT_ARMOR = 4; // .armorvalue
-const int STAT_SHELLS = 6; // .ammo_shells
-const int STAT_NAILS = 7; // .ammo_nails
-const int STAT_ROCKETS = 8; // .ammo_rockets
-const int STAT_CELLS = 9; // .ammo_cells
-const int STAT_ACTIVEWEAPON = 10; // .weapon
-const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
-const int STAT_VIEWHEIGHT = 16; // .view_ofs_z
+
+// const int STAT_HEALTH = 0;
+// const int STAT_ARMOR = 4;
+// const int STAT_SHELLS = 6;
+// const int STAT_NAILS = 7;
+// const int STAT_ROCKETS = 8;
+// const int STAT_CELLS = 9;
+// const int STAT_ACTIVEWEAPON = 10;
+// const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
+// const int STAT_VIEWHEIGHT = 16;
+
+#if defined(CSQC)
+    #define g_stat_HEALTH getstati(STAT_HEALTH)
+    #define g_stat_ARMOR getstat_int(STAT_ARMOR)
+    #define g_stat_SHELLS getstat_int(STAT_SHELLS)
+    #define g_stat_NAILS getstat_int(STAT_NAILS)
+    #define g_stat_ROCKETS getstat_int(STAT_ROCKETS)
+    #define g_stat_CELLS getstat_int(STAT_CELLS)
+    #define g_stat_ACTIVEWEAPON getstat_int(STAT_ACTIVEWEAPON)
+    #define g_stat_ITEMS getstat_int(STAT_ITEMS)
+    #define g_stat_VIEWHEIGHT getstati(STAT_VIEWHEIGHT)
+#elif defined(SVQC)
+    #define stat_HEALTH health
+    #define stat_ARMOR armorvalue
+    #define stat_SHELLS ammo_shells
+    #define stat_NAILS ammo_nails
+    #define stat_ROCKETS ammo_rockets
+    #define stat_CELLS ammo_cells
+    #define stat_ACTIVEWEAPON weapon
+    #define stat_ITEMS items
+    #define stat_VIEWHEIGHT view_ofs_z
 #endif
 
 REGISTER_STAT(WEAPONS, vectori)
index 074835d5e79c4914807f79ed60ab51137525c3f4..9fc5bdb18e631c1164ba7c582211336a4eb62764 100644 (file)
@@ -160,8 +160,8 @@ float Team_TeamToNumber(float teamid)
 #define TCR(input,teamcolor,teamtext) strreplace("^TC", teamcolor, strreplace("^TT", teamtext, input))
 
 // safe team comparisons
-#define SAME_TEAM(a,b) (teamplay ? ((a.team == b.team) ? 1 : 0) : ((a == b) ? 1 : 0))
-#define DIFF_TEAM(a,b) (teamplay ? ((a.team != b.team) ? 1 : 0) : ((a != b) ? 1 : 0))
+#define SAME_TEAM(a,b) (teamplay ? (a.team == b.team) : (a == b))
+#define DIFF_TEAM(a,b) (teamplay ? (a.team != b.team) : (a != b))
 
 // used for notification system multi-team identifiers
 #define APP_TEAM_NUM_2(num,prefix) ((num == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
index 7f97668c88dfbaac8ffd0a4ebf2537f394270e9b..1d8864f2c74291c66c687252c5cd8608f4704bd9 100644 (file)
@@ -23,7 +23,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_MUSIC)
 void target_music_sendto(float to, float is)
 {SELFPARAM();
        WriteHeader(to, TE_CSQC_TARGET_MUSIC);
-       WriteShort(to, num_for_edict(self));
+       WriteShort(to, etof(self));
        WriteByte(to, self.volume * 255.0 * is);
        WriteByte(to, self.fade_time * 16.0);
        WriteByte(to, self.fade_rate * 16.0);
index b95837127f3b9b18ecb262643d66ed94d0cce10d..59737cb992951fbeeb5f6e072c2a3f798d06a729 100644 (file)
@@ -157,7 +157,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                                if(valuefield == "")
                                {
                                        if(value == "")
-                                               value = ftos(num_for_edict(valueent));
+                                               value = ftos(etof(valueent));
                                }
                                else
                                {
index b322741f29d5a6fd60ed670cd8fff51af58452e4..c81b1a5769942860beb7702b747d1ca01a4c53bf 100644 (file)
@@ -1431,14 +1431,13 @@ vector animfixfps(entity e, vector a, vector b)
        // multi-frame anim: keep as-is
        if(a.y == 1)
        {
-               float dur;
-               dur = frameduration(e.modelindex, a.x);
-               if(dur <= 0 && b.y)
+               float dur = frameduration(e.modelindex, a.x);
+               if (dur <= 0 && b.y)
                {
                        a = b;
                        dur = frameduration(e.modelindex, a.x);
                }
-               if(dur > 0)
+               if (dur > 0)
                        a.z = 1.0 / dur;
        }
        return a;
index 0068a51e247f1222a06c65fea089e36d02222b8e..97a6b467ca5e6f3b6e0c82749c3ecf5710dd3b64 100644 (file)
@@ -877,7 +877,7 @@ void vehicles_exit(bool eject)
                _player.view_ofs                = PL_VIEW_OFS;
                _player.event_damage    = PlayerDamage;
                _player.hud                             = HUD_NORMAL;
-               _player.switchweapon    = _vehicle.switchweapon;
+               PS(_player).m_switchweapon = _vehicle.m_switchweapon;
                _player.last_vehiclecheck = time + 3;
                _player.vehicle_enter_delay = time + 2;
 
@@ -951,17 +951,21 @@ void vehicles_touch()
        vehicles_enter(other, self);
 }
 
-bool vehicle_impulse(int imp)
-{SELFPARAM();
-       switch(imp)
+bool vehicle_impulse(entity this, int imp)
+{
+       entity v = this.vehicle;
+       if (!v) return false;
+       if (v.deadflag != DEAD_NO) return false;
+       bool(int) f = v.vehicles_impulse;
+       if (f && f(imp)) return true;
+       switch (imp)
        {
-               case 17:
+               case IMP_weapon_drop.impulse:
                {
                        stuffcmd(self, "\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n");
                        return true;
                }
        }
-
        return false;
 }
 
@@ -1059,7 +1063,7 @@ void vehicles_enter(entity pl, entity veh)
        veh.colormap            = pl.colormap;
        if(veh.tur_head)
                veh.tur_head.colormap = pl.colormap;
-       veh.switchweapon = pl.switchweapon;
+       veh.m_switchweapon = PS(pl).m_switchweapon;
        pl.hud = veh.vehicleid;
        pl.PlayerPhysplug = veh.PlayerPhysplug;
 
index 423c8ec047380a2a84f20212bd4324ded774ff70..496ef9c40babede723f78406b5eb2f905be9b1b0 100644 (file)
@@ -101,7 +101,7 @@ float vehicles_exit_running;
 
 void vehicles_exit(float eject);
 float vehicle_initialize(entity vehicle, float nodrop);
-bool vehicle_impulse(int imp);
+bool vehicle_impulse(entity this, int imp);
 bool vehicles_crushable(entity e);
 
 #endif
index 244b4e2f6126e7fbabf9ca5533b4e24405618332..f279e9e2a27f90e701a5fcf97ac13731f53c6e6e 100644 (file)
@@ -261,7 +261,7 @@ void bumblebee_gunner_exit(int _exitflag)
        player.event_damage   = PlayerDamage;
        player.hud            = HUD_NORMAL;
        player.teleportable       = TELEPORT_NORMAL;
-       player.switchweapon   = gunner.switchweapon;
+       PS(player).m_switchweapon = gunner.m_switchweapon;
        player.vehicle_enter_delay = time + 2;
 
        fixedmakevectors(vehic.angles);
@@ -330,7 +330,7 @@ bool bumblebee_gunner_enter()
 
        RemoveGrapplingHook(player);
 
-       gunner.switchweapon = player.switchweapon;
+       gunner.m_switchweapon = PS(player).m_switchweapon;
        gunner.vehicle_exit = bumblebee_gunner_exit;
        gunner.vehicle_hudmodel.viewmodelforclient = player;
 
index 8ff604579c246715959e4164c7290bab31bd79bd..11ee8ebc7eed104bcc529b5b09e89794cf936f9c 100644 (file)
@@ -37,7 +37,7 @@ bool bumble_raygun_send(entity this, entity to, float sf)
     WriteByte(MSG_ENTITY, sf);
     if(sf & BRG_SETUP)
     {
-        WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
+        WriteByte(MSG_ENTITY, etof(self.realowner));
         WriteByte(MSG_ENTITY, self.realowner.team);
         WriteByte(MSG_ENTITY, self.cnt);
     }
index 38e343f65e8827a9a9e5a7b3c33b1e0de5638b7b..22c3f1e021ad1164ec1522fb02ab14e16405168c 100644 (file)
@@ -532,17 +532,17 @@ void racer_draw()
        self.lastpushtime = time;
        if(!pushdeltatime) return;
 
-       tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * getstatf(STAT_VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self);
+       tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * STAT(VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self);
 
-       vector df = self.move_velocity * -getstatf(STAT_VEH_RACER_FRICTION);
-       df_z += (1 - trace_fraction) * getstatf(STAT_VEH_RACER_HOVERPOWER) + sin(time * 2) * (getstatf(STAT_VEH_RACER_SPRINGLENGTH) * 2);
+       vector df = self.move_velocity * -STAT(VEH_RACER_FRICTION);
+       df_z += (1 - trace_fraction) * STAT(VEH_RACER_HOVERPOWER) + sin(time * 2) * (STAT(VEH_RACER_SPRINGLENGTH) * 2);
 
-       float forced = getstatf(STAT_VEH_RACER_UPFORCEDAMPER);
+       float forced = STAT(VEH_RACER_UPFORCEDAMPER);
 
        int cont = pointcontents(self.move_origin - '0 0 64');
        if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
        {
-               forced = getstatf(STAT_VEH_RACER_WATER_UPFORCEDAMPER);
+               forced = STAT(VEH_RACER_WATER_UPFORCEDAMPER);
                self.move_velocity_z += 200;
        }
 
@@ -550,8 +550,8 @@ void racer_draw()
        if(self.move_velocity_z > 0)
                self.move_velocity_z *= 1 - forced * pushdeltatime;
 
-       self.move_angles_x *= 1 - (getstatf(STAT_VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
-       self.move_angles_z *= 1 - (getstatf(STAT_VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
+       self.move_angles_x *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
+       self.move_angles_z *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
 
        Movetype_Physics_MatchServer(false);
 }
index a3739322bc7980df470e0890a2eb9bfabde92bcf..7ebac8152adeed819a6d57eb3ad3e290ccf21605 100644 (file)
@@ -569,28 +569,28 @@ float raptor_impulse(float _imp)
 {SELFPARAM();
        switch(_imp)
        {
-               case 1:
+               case IMP_weapon_group_1.impulse:
                        self.vehicle.vehicle_weapon2mode = RSM_BOMB;
                        CSQCVehicleSetup(self, 0);
                        return true;
-               case 2:
+               case IMP_weapon_group_2.impulse:
                        self.vehicle.vehicle_weapon2mode = RSM_FLARE;
                        CSQCVehicleSetup(self, 0);
                        return true;
 
-               case 10:
-               case 15:
-               case 18:
+               case IMP_weapon_next_byid.impulse:
+               case IMP_weapon_next_bypriority.impulse:
+               case IMP_weapon_next_bygroup.impulse:
                        self.vehicle.vehicle_weapon2mode += 1;
                        if(self.vehicle.vehicle_weapon2mode > RSM_LAST)
                                self.vehicle.vehicle_weapon2mode = RSM_FIRST;
 
                        CSQCVehicleSetup(self, 0);
                        return true;
-               case 11:
-               case 12:
-               case 16:
-               case 19:
+               case IMP_weapon_last.impulse:
+               case IMP_weapon_prev_byid.impulse:
+               case IMP_weapon_prev_bypriority.impulse:
+               case IMP_weapon_prev_bygroup.impulse:
                        self.vehicle.vehicle_weapon2mode -= 1;
                        if(self.vehicle.vehicle_weapon2mode < RSM_FIRST)
                                self.vehicle.vehicle_weapon2mode = RSM_LAST;
@@ -599,9 +599,9 @@ float raptor_impulse(float _imp)
                        return true;
 
                /*
-               case 17: // toss gun, could be used to exit?
+               case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
                        break;
-               case 20: // Manual minigun reload?
+               case IMP_weapon_reload.impulse: // Manual minigun reload?
                        break;
                */
        }
index 8cb2487811d61da7bbe89d4286b6f596f5165c55..d817c2e1a23d93702497d54b2db43789f1a8d555 100644 (file)
@@ -88,7 +88,7 @@ float spiderbot_frame()
 
        player.BUTTON_ZOOM        = 0;
        player.BUTTON_CROUCH    = 0;
-       player.switchweapon      = 0;
+       PS(player).m_switchweapon = WEP_Null;
        player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
 
 
@@ -497,22 +497,22 @@ bool spiderbot_impulse(int _imp)
 {SELFPARAM();
        switch(_imp)
        {
-               case 1:
+               case IMP_weapon_group_1.impulse:
                        self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
                        CSQCVehicleSetup(self, 0);
                        return true;
-               case 2:
+               case IMP_weapon_group_2.impulse:
                        self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
                        CSQCVehicleSetup(self, 0);
                        return true;
-               case 3:
+               case IMP_weapon_group_3.impulse:
                        self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
                        CSQCVehicleSetup(self, 0);
                        return true;
 
-               case 10:
-               case 15:
-               case 18:
+               case IMP_weapon_next_byid.impulse:
+               case IMP_weapon_next_bypriority.impulse:
+               case IMP_weapon_next_bygroup.impulse:
                        self.vehicle.vehicle_weapon2mode += 1;
                        if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
                                self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
@@ -520,10 +520,10 @@ bool spiderbot_impulse(int _imp)
                        //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
                        CSQCVehicleSetup(self, 0);
                        return true;
-               case 11:
-               case 12:
-               case 16:
-               case 19:
+               case IMP_weapon_last.impulse:
+               case IMP_weapon_prev_byid.impulse:
+               case IMP_weapon_prev_bypriority.impulse:
+               case IMP_weapon_prev_bygroup.impulse:
                        self.vehicle.vehicle_weapon2mode -= 1;
                        if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
                                self.vehicle.vehicle_weapon2mode = SBRM_LAST;
@@ -533,9 +533,9 @@ bool spiderbot_impulse(int _imp)
                        return true;
 
                /*
-               case 17: // toss gun, could be used to exit?
+               case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
                        break;
-               case 20: // Manual minigun reload?
+               case IMP_weapon_reload.impulse: // Manual minigun reload?
                        break;
                */
        }
index fc3bd9167a27121b7376da6c33cb684be0dbac14..b18d6991a8a80c1c7980f6331d7bbd52801aff3d 100644 (file)
@@ -562,8 +562,10 @@ NET_HANDLE(wframe, bool isNew)
        switch (viewmodel.state)
        {
                case WS_RAISE:
+                       viewmodel.weapon_switchdelay = activeweapon.switchdelay_raise;
+                       break;
                case WS_DROP:
-                       viewmodel.weapon_switchdelay = ReadFloat();
+                       viewmodel.weapon_switchdelay = activeweapon.switchdelay_drop;
                        break;
         default:
             viewmodel.weapon_switchdelay = 0;
@@ -587,16 +589,6 @@ void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim)
        WriteByte(channel, weaponentity.state);
        WriteFloat(channel, weaponentity.weapon_nextthink);
        WriteByte(channel, weaponentity.m_alpha * 255);
-       Weapon w = Weapons_from(actor.weapon);
-       switch (weaponentity.state)
-       {
-               case WS_RAISE:
-                       WriteFloat(channel, w.switchdelay_raise);
-                       break;
-               case WS_DROP:
-                       WriteFloat(channel, w.switchdelay_drop);
-                       break;
-       }
 }
 #endif
 
index 7e4d390ba698ef4be96ed7ff6c53c954f94a83ed..929564c3ef8504efa2f77a5b1916da72109a4829 100644 (file)
@@ -39,10 +39,7 @@ STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, LAMBDA(it.m_pickup = NEW(Weap
 #define WEPSET(id) (WEP_##id.m_wepset)
 #define WepSet_FromWeapon(it) ((it).m_wepset)
 WepSet _WepSet_FromWeapon(int i);
-STATIC_INIT(WepSets)
-{
-    FOREACH(Weapons, true, LAMBDA(it.m_wepset = _WepSet_FromWeapon(it.m_id)));
-}
+STATIC_INIT(WepSets) { FOREACH(Weapons, true, LAMBDA(it.m_wepset = _WepSet_FromWeapon(it.m_id))); }
 
 GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
 {
@@ -97,43 +94,198 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPON
     }
 }
 
-#define REGISTER_WEAPON(id, inst) \
-    /* WepSet WEPSET_##id; */ \
-    REGISTER(Weapons, WEP, id, m_id, inst)
+#ifdef SVQC
+entity W_PROP_reloader;
+float autocvar_w_prop_interval = 0;
+.void(Weapon this, int) wr_net;
+void W_PROP_reload(int chan, entity to)
+{
+    W_PROP_reloader.nextthink = time + autocvar_w_prop_interval;
+    msg_entity = to;
+    FOREACH(Weapons, true, {
+        it.wr_update(it);
+        void(Weapon, int) f = it.wr_net;
+        if (f) f(it, chan);
+    });
+}
+void W_PROP_think()
+{
+    W_PROP_reload(MSG_ALL, NULL);
+}
+STATIC_INIT_LATE(W_PROP_reloader)
+{
+    entity e = W_PROP_reloader = new(W_PROP_reloader);
+    make_pure(e);
+    WITH(entity, self, e, (e.think = W_PROP_think)());
+}
+#endif
 
-// create cvars for weapon settings
-#define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
+#define REGISTER_WEAPON(...) EVAL(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__))
+#define REGISTER_WEAPON_2(id, inst) REGISTER(Weapons, WEP, id, m_id, inst)
+/** TODO: deprecated - remove */
+#define REGISTER_WEAPON_3(id, sname, inst) \
+    REGISTER_WEAPON_2(id, inst); \
+    [[alias("WEP_" #id)]] Weapon _wep_##sname
 
-#define WEP_ADD_CVAR_PRI(wepname,name) WEP_ADD_CVAR_NONE(wepname, primary_##name)
-#define WEP_ADD_CVAR_SEC(wepname,name) WEP_ADD_CVAR_NONE(wepname, secondary_##name)
-#define WEP_ADD_CVAR_BOTH(wepname,name) \
-    WEP_ADD_CVAR_PRI(wepname, name) \
-    WEP_ADD_CVAR_SEC(wepname, name)
+REGISTER_WEAPON(Null, NEW(Weapon));
 
-#define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name)
+Weapon Weapons_fromstr(string s)
+{
+    FOREACH(Weapons, it != WEP_Null && it.netname == s, return it);
+    return NULL;
+}
 
-// create properties for weapon settings
-#define WEP_ADD_PROP(wepid,wepname,type,prop,name) \
-    .type prop; \
-    [[last]] type autocvar_g_balance_##wepname##_##name;
 
-// read cvars from weapon settings
-#define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name
-#define WEP_CVAR_PRI(wepname,name) WEP_CVAR(wepname, primary_##name)
-#define WEP_CVAR_SEC(wepname,name) WEP_CVAR(wepname, secondary_##name)
-#define WEP_CVAR_BOTH(wepname,isprimary,name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
+// legacy w_prop mappings
+#define X(fld, T) .T fld; .T wepvar_##fld = fld;
+X(switchdelay_drop, float)
+X(switchdelay_raise, float)
+X(weaponreplace, string)
+X(weaponstartoverride, float)
+X(weaponstart, float)
+X(weaponthrowable, float)
+X(reload_ammo, float)
+.float reloading_ammo = reload_ammo;
+X(reload_time, float)
+.float reloading_time = reload_time;
+#undef X
+
+
+
+#define W_PROPS(L, class, prefix) \
+    L(W_PROP_BEGIN, W_PROP, W_PROP_END, class, prefix) \
+    L(W_CONFIG_BEGIN, W_CONFIG, W_CONFIG_END, class, prefix) \
+    L(W_UPDATE_BEGIN, W_UPDATE, W_UPDATE_END, class, prefix) \
+    L(W_NET_BEGIN, W_NET, W_NET_END, class, prefix) \
+    /**/ \
+
+
+    #define W_PROP(class, wepname, fld, T, m)       W_PROP_##m(class, fld, T, wepname)
+    #define W_PROP_NONE(class, fld, T, wepname)     _W_PROP(class, fld, T, wepname)
+    #define W_PROP_PRI(class, fld, T, wepname)      _W_PROP(class, primary_##fld, T, wepname)
+    #define W_PROP_SEC(class, fld, T, wepname)      _W_PROP(class, secondary_##fld, T, wepname)
+    #define W_PROP_BOTH(class, fld, T, wepname) \
+            W_PROP_PRI(class, fld, T, wepname) \
+            W_PROP_SEC(class, fld, T, wepname)
+    #define W_PROP_BEGIN(class)
+        #define _W_PROP(class, fld, T, wepname) \
+            /* static */ T _W_PROP_CVAR(wepname, fld); \
+            ATTRIB(class, wepvar_##fld, T, _W_PROP_CVAR(wepname, fld));
+        #define _W_PROP_CVAR(wepname, fld) autocvar_g_balance_##wepname##_##fld
+    #define W_PROP_END()
+
+
+
+    #define W_CONFIG(class, wepname, fld, T, m)     W_CONFIG_##m(class, fld, T, wepname)
+    #define W_CONFIG_NONE(class, fld, T, wepname)   _W_CONFIG(class, fld, T, wepname)
+    #define W_CONFIG_PRI(class, fld, T, wepname)    _W_CONFIG(class, primary_##fld, T, wepname)
+    #define W_CONFIG_SEC(class, fld, T, wepname)    _W_CONFIG(class, secondary_##fld, T, wepname)
+    #define W_CONFIG_BOTH(class, fld, T, wepname) \
+            W_CONFIG_PRI(class, fld, T, wepname) \
+            W_CONFIG_SEC(class, fld, T, wepname)
+    #define W_CONFIG_BEGIN(class) METHOD(class, wr_config, void(class this)) {
+        #ifdef SVQC
+            #define _W_CONFIG(class, fld, T, wepname) if (#wepname == this.netname) WEP_CONFIG_WRITE_CVARS(wepname, fld, T);
+        #else
+            #define _W_CONFIG(class, fld, T, wepname)
+        #endif
+    #define W_CONFIG_END() }
+
+
+    #define W_UPDATE(class, wepname, fld, T, m)     W_UPDATE_##m(class, fld, T, wepname)
+    #define W_UPDATE_NONE(class, fld, T, wepname)   _W_UPDATE(class, fld, T, wepname)
+    #define W_UPDATE_PRI(class, fld, T, wepname)    _W_UPDATE(class, primary_##fld, T, wepname)
+    #define W_UPDATE_SEC(class, fld, T, wepname)    _W_UPDATE(class, secondary_##fld, T, wepname)
+    #define W_UPDATE_BOTH(class, fld, T, wepname) \
+            W_UPDATE_PRI(class, fld, T, wepname) \
+            W_UPDATE_SEC(class, fld, T, wepname)
+    .entity baseline, baseline_target;
+    #define W_UPDATE_BEGIN(class) \
+        METHOD(class, wr_update, void(class this)) \
+        { \
+            noref entity b = this.baseline; \
+            if (!b) \
+            { \
+                b = this.baseline = new(baseline); \
+                make_pure(b); \
+                b.baseline_target = this; \
+            }
+        #ifdef SVQC
+            #define _W_UPDATE(class, fld, T, wepname) \
+                { \
+                    T it = _W_PROP_CVAR(wepname, fld); \
+                    b.wepvar_##fld = this.wepvar_##fld; \
+                    this.wepvar_##fld = it; \
+                }
+        #else
+            #define _W_UPDATE(class, fld, T, wepname)
+        #endif
+    #define W_UPDATE_END() }
+
+
+    #define W_NET(class, wepname, fld, T, m)     W_NET_##m(class, fld, T, wepname)
+    #define W_NET_NONE(class, fld, T, wepname)   _W_NET(class, fld, T, wepname)
+    #define W_NET_PRI(class, fld, T, wepname)    _W_NET(class, primary_##fld, T, wepname)
+    #define W_NET_SEC(class, fld, T, wepname)    _W_NET(class, secondary_##fld, T, wepname)
+    #define W_NET_BOTH(class, fld, T, wepname) \
+            W_NET_PRI(class, fld, T, wepname) \
+            W_NET_SEC(class, fld, T, wepname)
+    REGISTER_NET_TEMP(WeaponUpdate)
+    #if defined(CSQC)
+        #define W_NET_BEGIN(class) METHOD(class, wr_net, void(class this, int i)) { int n = 0;
+            #define _W_NET(class, fld, T, wepname) \
+            { \
+                if (++n == i) this.wepvar_##fld = Read_##T(); \
+            }
+            .void(Weapon this, int i) wr_net;
+            NET_HANDLE(WeaponUpdate, bool isnew)
+            {
+                Weapon w = Weapons_from(ReadByte());
+                for (int i; (i = ReadByte()); )
+                {
+                    w.wr_net(w, i);
+                }
+                return true;
+            }
+        #define W_NET_END() }
+    #elif defined(SVQC)
+        #define W_NET_BEGIN(class) \
+            METHOD(class, wr_net, void(class this, int chan)) \
+            { \
+                bool commit = false; \
+                int i = 0;
+    #define _W_NET(class, fld, T, wepname) \
+                { \
+                    ++i; \
+                    T it = this.wepvar_##fld; \
+                    if (chan == MSG_ONE || it != this.baseline.wepvar_##fld) \
+                    { \
+                        if (!commit) { commit = true; WriteHeader(chan, WeaponUpdate); WriteByte(chan, this.m_id); } \
+                        WriteByte(chan, i); Write_##T(chan, it); \
+                    } \
+                }
+    #define W_NET_END() \
+                if (commit) WriteByte(chan, 0); \
+            }
+    #else
+        #define W_NET_BEGIN(class)
+            #define _W_NET(class, fld, T, wepname)
+        #define W_NET_END()
+    #endif
+
 
-// set initialization values for weapon settings
-#define WEP_SKIP_CVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */
-#define WEP_SET_PROP(wepid,wepname,type,prop,name) WEP_##wepid.prop = autocvar_g_balance_##wepname##_##name;
+
+// read cvars from weapon settings
+#define WEP_CVAR(wepname, name) (_wep_##wepname.wepvar_##name)
+#define WEP_CVAR_PRI(wepname, name) WEP_CVAR(wepname, primary_##name)
+#define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name)
+#define WEP_CVAR_BOTH(wepname, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
 
 const int WEP_FIRST = 1;
 #define WEP_LAST (Weapons_COUNT - 1)
 WepSet WEPSET_ALL;
 WepSet WEPSET_SUPERWEAPONS;
 
-REGISTER_WEAPON(Null, NEW(Weapon));
-
 #include "all.inc"
 
 // TODO: remove after 0.8.2. Retains impulse number compatibility because 0.8.1 clients don't reload the weapons.cfg
@@ -153,13 +305,13 @@ STATIC_INIT(register_weapons_done)
         WepSet set = it.m_wepset;
         WEPSET_ALL |= set;
         if ((it.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
-        it.weapon = it.m_id;
         it.weapons = set;
+        if (it == WEP_Null) continue;
         int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
         if (imp <= WEP_IMPULSE_END)
             localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
         else
-            LOG_TRACEF(_("Impulse limit exceeded, weapon will not be directly accessible: %s\n"), it.netname);
+            LOG_TRACEF("Impulse limit exceeded, weapon will not be directly accessible: %s\n", it.netname);
     ));
     #ifdef CSQC
     FOREACH(Weapons, true, LAMBDA(it.wr_init(it)));
@@ -178,10 +330,6 @@ STATIC_INIT(register_weapons_done)
 .vector weaponentity_glowmod;
 
 //.int weapon; // current weapon
-#ifdef SVQC
-.int switchweapon = _STAT(SWITCHWEAPON);
-.int switchingweapon = _STAT(SWITCHINGWEAPON);
-#endif
 .string weaponname; // name of .weapon
 
 .vector spawnorigin; // for casings
index b232bbcda358bf977b87e21cc75ee8e8a1b0bdc0..d88e18194bf7c37af8991483eb4448f7448e8a50 100644 (file)
@@ -18,34 +18,23 @@ string wep_config_queue[MAX_WEP_CONFIG];
        wep_config_queue[WEP_CONFIG_COUNT] = a; \
        ++WEP_CONFIG_COUNT; }
 
-#define WEP_CONFIG_WRITETOFILE(a) do { \
+#define WEP_CONFIG_WRITETOFILE(a) MACRO_BEGIN { \
        fputs(wep_config_file, a); \
        if(wep_config_alsoprint) { LOG_INFO(a); } \
-} while(0)
+} MACRO_END
 
-#define WEP_CONFIG_WRITE_CVARS_NONE(wepname,name) \
-       { WEP_CONFIG_QUEUE( \
-               sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
-               cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
-
-#define WEP_CONFIG_WRITE_CVARS_PRI(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, primary_##name)
-#define WEP_CONFIG_WRITE_CVARS_SEC(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, secondary_##name)
-#define WEP_CONFIG_WRITE_CVARS_BOTH(wepname,name) \
-       WEP_CONFIG_WRITE_CVARS_PRI(wepname, name) \
-       WEP_CONFIG_WRITE_CVARS_SEC(wepname, name)
 
-#define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name)
+#define WEP_CONFIG_WRITE_CVARS(wepname, name, T) WEP_CONFIG_WRITE_PROPS_##T(wepname, name)
 
-#define WEP_CONFIG_WRITE_PROPS_string(wepname,name) \
+#define WEP_CONFIG_WRITE_PROPS_string(wepname, name) \
        { WEP_CONFIG_QUEUE( \
                sprintf("set g_balance_%s_%s \"%s\"\n", #wepname, #name, \
                cvar_string(sprintf("g_balance_%s_%s", #wepname, #name)))) }
 
-#define WEP_CONFIG_WRITE_PROPS_float(wepname,name) \
+#define WEP_CONFIG_WRITE_PROPS_float(wepname, name) \
        { WEP_CONFIG_QUEUE( \
                sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
                cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
 
-#define WEP_CONFIG_WRITE_PROPS(wepid,wepname,type,prop,name) WEP_CONFIG_WRITE_PROPS_##type(wepname,name)
 #endif
 #endif
index bc98da4330f81278254b76c9296d1a4b12f24552..ccb71154e5b3dd95d7d7a162dff8784b12880d68 100644 (file)
@@ -51,11 +51,6 @@ const int WS_READY  = 4;
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
        ATTRIB(Weapon, m_id, int, 0)
-    /**
-     * M: WEP_id    : WEP_...
-     * you can recognize dummies when this == 0
-     */
-    ATTRIB(Weapon, weapon, int, 0);
     /** A: WEPSET_id : WEPSET_... */
     ATTRIB(Weapon, weapons, WepSet, '0 0 0');
     /** M: ammotype  : main ammo field */
@@ -124,7 +119,8 @@ CLASS(Weapon, Object)
     METHOD(Weapon, wr_drop, void(Weapon this)) {}
     /** (SERVER) a weapon is picked up */
     METHOD(Weapon, wr_pickup, void(Weapon this)) {}
-
+    /** (SERVER) update cvar based properties */
+    METHOD(Weapon, wr_update, void(Weapon this)) {}
        METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
                returns(this.m_name, this.model2 ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.model2) : string_null);
        }
@@ -215,9 +211,4 @@ int GetAmmoStat(.int ammotype);
 string W_Sound(string w_snd);
 string W_Model(string w_mdl);
 
-
-// other useful macros
-#define WEP_AMMO(wpn) (WEP_##wpn.ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
-#define WEP_NAME(wpn) ((Weapons_from(wpn)).m_name)
-
 #endif
index 7c9d64c01abed4d09077f4a29d2e0546dee57ac2..959e0939d3b010806028f6c9b71dcaba5e6db497 100644 (file)
@@ -14,47 +14,52 @@ CLASS(Arc, Weapon)
 /* wepimg    */ ATTRIB(Arc, model2, string, "weaponarc");
 /* refname   */ ATTRIB(Arc, netname, string, "arc");
 /* wepname   */ ATTRIB(Arc, m_name, string, _("Arc"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, beam_ammo, float, NONE) \
+        P(class, prefix, beam_animtime, float, NONE) \
+        P(class, prefix, beam_botaimlifetime, float, NONE) \
+        P(class, prefix, beam_botaimspeed, float, NONE) \
+        P(class, prefix, beam_damage, float, NONE) \
+        P(class, prefix, beam_degreespersegment, float, NONE) \
+        P(class, prefix, beam_distancepersegment, float, NONE) \
+        P(class, prefix, beam_falloff_halflifedist, float, NONE) \
+        P(class, prefix, beam_falloff_maxdist, float, NONE) \
+        P(class, prefix, beam_falloff_mindist, float, NONE) \
+        P(class, prefix, beam_force, float, NONE) \
+        P(class, prefix, beam_healing_amax, float, NONE) \
+        P(class, prefix, beam_healing_aps, float, NONE) \
+        P(class, prefix, beam_healing_hmax, float, NONE) \
+        P(class, prefix, beam_healing_hps, float, NONE) \
+        P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
+        P(class, prefix, beam_maxangle, float, NONE) \
+        P(class, prefix, beam_nonplayerdamage, float, NONE) \
+        P(class, prefix, beam_range, float, NONE) \
+        P(class, prefix, beam_refire, float, NONE) \
+        P(class, prefix, beam_returnspeed, float, NONE) \
+        P(class, prefix, beam_tightness, float, NONE) \
+        P(class, prefix, burst_ammo, float, NONE) \
+        P(class, prefix, burst_damage, float, NONE) \
+        P(class, prefix, burst_healing_aps, float, NONE) \
+        P(class, prefix, burst_healing_hps, float, NONE) \
+        P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
+        P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
+        P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
+        P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, Arc, arc)
+#undef X
+
 ENDCLASS(Arc)
-REGISTER_WEAPON(ARC, NEW(Arc));
-
-#define ARC_SETTINGS(w_cvar,w_prop) ARC_SETTINGS_LIST(w_cvar, w_prop, ARC, arc)
-#define ARC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, beam_ammo) \
-       w_cvar(id, sn, NONE, beam_animtime) \
-       w_cvar(id, sn, NONE, beam_botaimspeed) \
-       w_cvar(id, sn, NONE, beam_botaimlifetime) \
-       w_cvar(id, sn, NONE, beam_damage) \
-       w_cvar(id, sn, NONE, beam_degreespersegment) \
-       w_cvar(id, sn, NONE, beam_distancepersegment) \
-       w_cvar(id, sn, NONE, beam_falloff_halflifedist) \
-       w_cvar(id, sn, NONE, beam_falloff_maxdist) \
-       w_cvar(id, sn, NONE, beam_falloff_mindist) \
-       w_cvar(id, sn, NONE, beam_force) \
-       w_cvar(id, sn, NONE, beam_healing_amax) \
-       w_cvar(id, sn, NONE, beam_healing_aps) \
-       w_cvar(id, sn, NONE, beam_healing_hmax) \
-       w_cvar(id, sn, NONE, beam_healing_hps) \
-       w_cvar(id, sn, NONE, beam_maxangle) \
-       w_cvar(id, sn, NONE, beam_nonplayerdamage) \
-       w_cvar(id, sn, NONE, beam_range) \
-       w_cvar(id, sn, NONE, beam_refire) \
-       w_cvar(id, sn, NONE, beam_returnspeed) \
-       w_cvar(id, sn, NONE, beam_tightness) \
-       w_cvar(id, sn, NONE, burst_ammo) \
-       w_cvar(id, sn, NONE, burst_damage) \
-       w_cvar(id, sn, NONE, burst_healing_aps) \
-       w_cvar(id, sn, NONE, burst_healing_hps) \
-       w_cvar(id, sn, NONE, overheat_max)/* maximum heat before jamming */ \
-       w_cvar(id, sn, NONE, overheat_min)/* minimum heat to wait for cooldown */ \
-       w_cvar(id, sn, NONE, beam_heat)   /* heat increase per second (primary) */ \
-       w_cvar(id, sn, NONE, burst_heat)  /* heat increase per second (secondary) */ \
-       w_cvar(id, sn, NONE, cooldown)    /* heat decrease per second when resting */ \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(ARC, arc, NEW(Arc));
+
 
 #ifndef MENUQC
 const float ARC_MAX_SEGMENTS = 20;
@@ -82,7 +87,6 @@ const int ARC_SF_BEAMTYPE =    BIT(4);
 const int ARC_SF_LOCALMASK =   ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
 #endif
 #ifdef SVQC
-ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity arc_beam;
 .bool arc_BUTTON_ATCK_prev; // for better animation control
 .float beam_prev;
@@ -230,10 +234,12 @@ void W_Arc_Beam_Think()
                burst = ARC_BT_BURSTMASK;
        }
 
+       Weapon thiswep = WEP_ARC;
+
        if(
                !IS_PLAYER(self.owner)
                ||
-               (self.owner.WEP_AMMO(ARC) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
+               (self.owner.(thiswep.ammo_field) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
                ||
                self.owner.deadflag != DEAD_NO
                ||
@@ -298,8 +304,8 @@ void W_Arc_Beam_Think()
 
                if(rootammo)
                {
-                       coefficient = min(coefficient, self.owner.WEP_AMMO(ARC) / rootammo);
-                       self.owner.WEP_AMMO(ARC) = max(0, self.owner.WEP_AMMO(ARC) - (rootammo * frametime));
+                       coefficient = min(coefficient, self.owner.(thiswep.ammo_field) / rootammo);
+                       self.owner.(thiswep.ammo_field) = max(0, self.owner.(thiswep.ammo_field) - (rootammo * frametime));
                }
        }
        float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
@@ -625,7 +631,7 @@ void Arc_Smoke()
        }
 
        if (  self.arc_smoke_sound && ( self.arc_overheat <= time ||
-               !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC.m_id )
+               !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || PS(self).m_switchweapon != WEP_ARC )
        {
                self.arc_smoke_sound = 0;
                sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
@@ -719,22 +725,17 @@ void Arc_Smoke()
                                arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
                                arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
                        }
-                       ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
                }
                METHOD(Arc, wr_checkammo1, bool(entity thiswep))
                {
                        SELFPARAM();
-                       return ((!WEP_CVAR(arc, beam_ammo)) || (self.WEP_AMMO(ARC) > 0));
+                       return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
                }
                METHOD(Arc, wr_checkammo2, bool(entity thiswep))
                {
                        SELFPARAM();
                        return WEP_CVAR(arc, overheat_max) > 0 &&
-                               ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
-               }
-               METHOD(Arc, wr_config, void(entity thiswep))
-               {
-                       ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                               ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
                }
                METHOD(Arc, wr_killmessage, int(entity thiswep))
                {
@@ -749,7 +750,7 @@ void Arc_Smoke()
                }
                METHOD(Arc, wr_pickup, void(entity thiswep))
                {
-                       if ( !client_hasweapon(self, WEP_ARC.m_id, false, false) &&
+                       if ( !client_hasweapon(self, thiswep, false, false) &&
                                weapon_dropevent_item.arc_overheat > time )
                        {
                                self.arc_overheat = weapon_dropevent_item.arc_overheat;
@@ -1227,7 +1228,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                else
                {
                        // use player origin so that third person display still works
-                       self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
+                       self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
                }
        }
 
index 23ea7e1c8cb1d2c2d9739eb9495b6272fc8f32af..5ae4dd4b9d8f43a609ec2fe34b994c3c57544577 100644 (file)
@@ -14,33 +14,36 @@ CLASS(Blaster, Weapon)
 /* wepimg    */ ATTRIB(Blaster, model2, string, "weaponlaser");
 /* refname   */ ATTRIB(Blaster, netname, string, "blaster");
 /* wepname   */ ATTRIB(Blaster, m_name, string, _("Blaster"));
-ENDCLASS(Blaster)
-REGISTER_WEAPON(BLASTER, NEW(Blaster));
 
-#define BLASTER_SETTINGS(w_cvar,w_prop) BLASTER_SETTINGS_LIST(w_cvar, w_prop, BLASTER, blaster)
-#define BLASTER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, delay) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, force_zscale) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, shotangle) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, delay, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, force_zscale, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shotangle, float, BOTH) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Blaster, blaster)
+#undef X
+
+ENDCLASS(Blaster)
+REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 
 #ifdef SVQC
-BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float blaster_damage;
 .float blaster_edgedamage;
 .float blaster_radius;
@@ -188,7 +191,7 @@ void W_Blaster_Attack(
                                {
                                        case 0: // switch to last used weapon
                                        {
-                                               if(actor.switchweapon == WEP_BLASTER.m_id) // don't do this if already switching
+                                               if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
                                                        W_LastWeapon();
                                                break;
                                        }
@@ -219,11 +222,6 @@ void W_Blaster_Attack(
                        }
                }
 
-               METHOD(Blaster, wr_init, void(entity thiswep))
-               {
-                       BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
-
                METHOD(Blaster, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -239,11 +237,6 @@ void W_Blaster_Attack(
                        return true; // blaster has infinite ammo
                }
 
-               METHOD(Blaster, wr_config, void(entity thiswep))
-               {
-                       BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
-
                METHOD(Blaster, wr_suicidemessage, int(entity thiswep))
                {
                        return WEAPON_BLASTER_SUICIDE;
index 300622289b8af9656fcab2214a3c61239140c946..7ef7cf64dfb0d26fe2d9fec069494821576548a7 100644 (file)
@@ -14,48 +14,51 @@ CLASS(Crylink, Weapon)
 /* wepimg    */ ATTRIB(Crylink, model2, string, "weaponcrylink");
 /* refname   */ ATTRIB(Crylink, netname, string, "crylink");
 /* wepname   */ ATTRIB(Crylink, m_name, string, _("Crylink"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+        P(class, prefix, animtime, float, BOTH) \
+        P(class, prefix, bouncedamagefactor, float, BOTH) \
+        P(class, prefix, bounces, float, BOTH) \
+        P(class, prefix, damage, float, BOTH) \
+        P(class, prefix, edgedamage, float, BOTH) \
+        P(class, prefix, force, float, BOTH) \
+        P(class, prefix, joindelay, float, BOTH) \
+        P(class, prefix, joinexplode, float, BOTH) \
+        P(class, prefix, joinexplode_damage, float, BOTH) \
+        P(class, prefix, joinexplode_edgedamage, float, BOTH) \
+        P(class, prefix, joinexplode_force, float, BOTH) \
+        P(class, prefix, joinexplode_radius, float, BOTH) \
+        P(class, prefix, joinspread, float, BOTH) \
+        P(class, prefix, linkexplode, float, BOTH) \
+        P(class, prefix, middle_fadetime, float, BOTH) \
+        P(class, prefix, middle_lifetime, float, BOTH) \
+        P(class, prefix, other_fadetime, float, BOTH) \
+        P(class, prefix, other_lifetime, float, BOTH) \
+        P(class, prefix, radius, float, BOTH) \
+        P(class, prefix, refire, float, BOTH) \
+        P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, secondary, float, NONE) \
+        P(class, prefix, shots, float, BOTH) \
+        P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, spreadtype, float, SEC) \
+        P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Crylink, crylink)
+#undef X
+
 ENDCLASS(Crylink)
-REGISTER_WEAPON(CRYLINK, NEW(Crylink));
-
-#define CRYLINK_SETTINGS(w_cvar,w_prop) CRYLINK_SETTINGS_LIST(w_cvar, w_prop, CRYLINK, crylink)
-#define CRYLINK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, shots) \
-       w_cvar(id, sn, BOTH, bounces) \
-       w_cvar(id, sn, BOTH, bouncedamagefactor) \
-       w_cvar(id, sn, BOTH, middle_lifetime) \
-       w_cvar(id, sn, BOTH, middle_fadetime) \
-       w_cvar(id, sn, BOTH, other_lifetime) \
-       w_cvar(id, sn, BOTH, other_fadetime) \
-       w_cvar(id, sn, BOTH, linkexplode) \
-       w_cvar(id, sn, BOTH, joindelay) \
-       w_cvar(id, sn, BOTH, joinspread) \
-       w_cvar(id, sn, BOTH, joinexplode) \
-       w_cvar(id, sn, BOTH, joinexplode_damage) \
-       w_cvar(id, sn, BOTH, joinexplode_edgedamage) \
-       w_cvar(id, sn, BOTH, joinexplode_radius) \
-       w_cvar(id, sn, BOTH, joinexplode_force) \
-       w_cvar(id, sn, SEC,  spreadtype) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
 
 #ifdef SVQC
-CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float gravity;
 .float crylink_waitrelease;
 .entity crylink_lastgroup;
@@ -623,15 +626,11 @@ void W_Crylink_Attack2(Weapon thiswep)
                                        {
                                                // ran out of ammo!
                                                actor.cnt = WEP_CRYLINK.m_id;
-                                               actor.switchweapon = w_getbestweapon(actor);
+                                               PS(actor).m_switchweapon = w_getbestweapon(actor);
                                        }
                                }
                        }
                }
-               METHOD(Crylink, wr_init, void(entity thiswep))
-               {
-                       CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
                {
                        SELFPARAM();
@@ -639,7 +638,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                        if(self.crylink_lastgroup && self.crylink_waitrelease)
                                return true;
 
-                       float ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
                        ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
                        return ammo_amount;
                }
@@ -650,14 +649,10 @@ void W_Crylink_Attack2(Weapon thiswep)
                        if(self.crylink_lastgroup && self.crylink_waitrelease)
                                return true;
 
-                       float ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
                        ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
                        return ammo_amount;
                }
-               METHOD(Crylink, wr_config, void(entity thiswep))
-               {
-                       CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Crylink, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
index 6a841c9eb4186eac9cd17a2b64afb7a67a0d0a87..6aff9a2f3ea0842cd8d1229dd83afa5cb2273054 100644 (file)
@@ -14,50 +14,53 @@ CLASS(Devastator, Weapon)
 /* wepimg    */ ATTRIB(Devastator, model2, string, "weaponrocketlauncher");
 /* refname   */ ATTRIB(Devastator, netname, string, "devastator");
 /* wepname   */ ATTRIB(Devastator, m_name, string, _("Devastator"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+        P(class, prefix, animtime, float, NONE) \
+        P(class, prefix, damageforcescale, float, NONE) \
+        P(class, prefix, damage, float, NONE) \
+        P(class, prefix, detonatedelay, float, NONE) \
+        P(class, prefix, edgedamage, float, NONE) \
+        P(class, prefix, force, float, NONE) \
+        P(class, prefix, guidedelay, float, NONE) \
+        P(class, prefix, guidegoal, float, NONE) \
+        P(class, prefix, guideratedelay, float, NONE) \
+        P(class, prefix, guiderate, float, NONE) \
+        P(class, prefix, guidestop, float, NONE) \
+        P(class, prefix, health, float, NONE) \
+        P(class, prefix, lifetime, float, NONE) \
+        P(class, prefix, radius, float, NONE) \
+        P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, remote_damage, float, NONE) \
+        P(class, prefix, remote_edgedamage, float, NONE) \
+        P(class, prefix, remote_force, float, NONE) \
+        P(class, prefix, remote_jump_damage, float, NONE) \
+        P(class, prefix, remote_jump_radius, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_add, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_max, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_min, float, NONE) \
+        P(class, prefix, remote_radius, float, NONE) \
+        P(class, prefix, speedaccel, float, NONE) \
+        P(class, prefix, speedstart, float, NONE) \
+        P(class, prefix, speed, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Devastator, devastator)
+#undef X
+
 ENDCLASS(Devastator)
-REGISTER_WEAPON(DEVASTATOR, NEW(Devastator));
-
-#define DEVASTATOR_SETTINGS(w_cvar,w_prop) DEVASTATOR_SETTINGS_LIST(w_cvar, w_prop, DEVASTATOR, devastator)
-#define DEVASTATOR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, damageforcescale) \
-       w_cvar(id, sn, NONE, detonatedelay) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, guidedelay) \
-       w_cvar(id, sn, NONE, guidegoal) \
-       w_cvar(id, sn, NONE, guiderate) \
-       w_cvar(id, sn, NONE, guideratedelay) \
-       w_cvar(id, sn, NONE, guidestop) \
-       w_cvar(id, sn, NONE, health) \
-       w_cvar(id, sn, NONE, lifetime) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, remote_damage) \
-       w_cvar(id, sn, NONE, remote_edgedamage) \
-       w_cvar(id, sn, NONE, remote_force) \
-       w_cvar(id, sn, NONE, remote_jump_damage) \
-       w_cvar(id, sn, NONE, remote_jump_radius) \
-       w_cvar(id, sn, NONE, remote_jump_velocity_z_add) \
-       w_cvar(id, sn, NONE, remote_jump_velocity_z_max) \
-       w_cvar(id, sn, NONE, remote_jump_velocity_z_min) \
-       w_cvar(id, sn, NONE, remote_radius) \
-       w_cvar(id, sn, NONE, speed) \
-       w_cvar(id, sn, NONE, speedaccel) \
-       w_cvar(id, sn, NONE, speedstart) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
 
 #ifdef SVQC
-DEVASTATOR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float rl_release;
 .float rl_detonate_later;
 #endif
@@ -105,15 +108,16 @@ void W_Devastator_Explode()
                other
        );
 
-       if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
+       Weapon thiswep = WEP_DEVASTATOR;
+       if(PS(self.realowner).m_weapon == thiswep)
        {
-               if(self.realowner.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
+               if(self.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
                if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        self.realowner.cnt = WEP_DEVASTATOR.m_id;
                        int slot = 0; // TODO: unhardcode
                        ATTACK_FINISHED(self.realowner, slot) = time;
-                       self.realowner.switchweapon = w_getbestweapon(self.realowner);
+                       PS(self.realowner).m_switchweapon = w_getbestweapon(self.realowner);
                }
        }
        remove(self);
@@ -185,15 +189,16 @@ void W_Devastator_DoRemoteExplode(.entity weaponentity)
                world
        );
 
-       if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
+       Weapon thiswep = WEP_DEVASTATOR;
+       if(PS(self.realowner).m_weapon == thiswep)
        {
-               if(self.realowner.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
+               if(self.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
                if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        self.realowner.cnt = WEP_DEVASTATOR.m_id;
                        int slot = weaponslot(weaponentity);
                        ATTACK_FINISHED(self.realowner, slot) = time;
-                       self.realowner.switchweapon = w_getbestweapon(self.realowner);
+                       PS(self.realowner).m_switchweapon = w_getbestweapon(self.realowner);
                }
        }
        remove(self);
@@ -267,7 +272,7 @@ void W_Devastator_Think()
                self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor() * frametime, velspeed);
 
        // laser guided, or remote detonation
-       if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
+       if(PS(self.realowner).m_weapon == WEP_DEVASTATOR)
        {
                if(self == self.realowner.lastrocket)
                if(!self.realowner.rl_release)
@@ -542,7 +547,7 @@ void W_Devastator_Attack(Weapon thiswep)
                                        actor.rl_release = 1;
 
                                if(fire & 2)
-                               if(actor.switchweapon == WEP_DEVASTATOR.m_id)
+                               if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
                                {
                                        entity rock;
                                        bool rockfound = false;
@@ -559,10 +564,6 @@ void W_Devastator_Attack(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Devastator, wr_init, void(entity thiswep))
-               {
-                       DEVASTATOR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Devastator, wr_setup, void(entity thiswep))
                {
                        self.rl_release = 1;
@@ -571,15 +572,15 @@ void W_Devastator_Attack(Weapon thiswep)
                {
                        #if 0
                        // don't switch while guiding a missile
-                       if(ATTACK_FINISHED(self, slot) <= time || self.weapon != WEP_DEVASTATOR.m_id)
+                       if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
                        {
                                ammo_amount = false;
                                if(WEP_CVAR(devastator, reload_ammo))
                                {
-                                       if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+                                       if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
                                                ammo_amount = true;
                                }
-                               else if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
+                               else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
                                        ammo_amount = true;
                                return !ammo_amount;
                        }
@@ -587,18 +588,18 @@ void W_Devastator_Attack(Weapon thiswep)
                        #if 0
                        if(self.rl_release == 0)
                        {
-                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.WEP_AMMO(DEVASTATOR), WEP_CVAR(devastator, ammo));
+                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
                                return true;
                        }
                        else
                        {
-                               ammo_amount = self.WEP_AMMO(DEVASTATOR) >= WEP_CVAR(devastator, ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
                                ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.WEP_AMMO(DEVASTATOR), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
                                return ammo_amount;
                        }
                        #else
-                       float ammo_amount = self.WEP_AMMO(DEVASTATOR) >= WEP_CVAR(devastator, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
                        ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
                        return ammo_amount;
                        #endif
@@ -607,10 +608,6 @@ void W_Devastator_Attack(Weapon thiswep)
                {
                        return false;
                }
-               METHOD(Devastator, wr_config, void(entity thiswep))
-               {
-                       DEVASTATOR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Devastator, wr_resetplayer, void(entity thiswep))
                {
                        self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
index 30dd6d74a3813394a268c59532577ed099d5fd65..44c5cf80d1f0ec9b9c582a865262ee48878baa05 100644 (file)
@@ -14,54 +14,58 @@ CLASS(Electro, Weapon)
 /* wepimg    */ ATTRIB(Electro, model2, string, "weaponelectro");
 /* refname   */ ATTRIB(Electro, netname, string, "electro");
 /* wepname   */ ATTRIB(Electro, m_name, string, _("Electro"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bouncefactor, float, SEC) \
+               P(class, prefix, bouncestop, float, SEC) \
+               P(class, prefix, comboradius, float, PRI) \
+               P(class, prefix, combo_comboradius, float, NONE) \
+               P(class, prefix, combo_comboradius_thruwall, float, NONE) \
+               P(class, prefix, combo_damage, float, NONE) \
+               P(class, prefix, combo_edgedamage, float, NONE) \
+               P(class, prefix, combo_force, float, NONE) \
+               P(class, prefix, combo_radius, float, NONE) \
+               P(class, prefix, combo_safeammocheck, float, NONE) \
+               P(class, prefix, combo_speed, float, NONE) \
+               P(class, prefix, count, float, SEC) \
+               P(class, prefix, damagedbycontents, float, SEC) \
+               P(class, prefix, damageforcescale, float, SEC) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, health, float, SEC) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, midaircombo_explode, float, PRI) \
+               P(class, prefix, midaircombo_interval, float, PRI) \
+               P(class, prefix, midaircombo_radius, float, PRI) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire2, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, SEC) \
+               P(class, prefix, speed_z, float, SEC) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, touchexplode, float, SEC) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Electro, electro)
+#undef X
+
 ENDCLASS(Electro)
-REGISTER_WEAPON(ELECTRO, NEW(Electro));
-
-#define ELECTRO_SETTINGS(w_cvar,w_prop) ELECTRO_SETTINGS_LIST(w_cvar, w_prop, ELECTRO, electro)
-#define ELECTRO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, PRI,  comboradius) \
-       w_cvar(id, sn, PRI,  midaircombo_explode) \
-       w_cvar(id, sn, PRI,  midaircombo_interval) \
-       w_cvar(id, sn, PRI,  midaircombo_radius) \
-       w_cvar(id, sn, SEC,  bouncefactor) \
-       w_cvar(id, sn, SEC,  bouncestop) \
-       w_cvar(id, sn, SEC,  count) \
-       w_cvar(id, sn, SEC,  damageforcescale) \
-       w_cvar(id, sn, SEC,  damagedbycontents) \
-       w_cvar(id, sn, SEC,  health) \
-       w_cvar(id, sn, SEC,  refire2) \
-       w_cvar(id, sn, SEC,  speed_up) \
-       w_cvar(id, sn, SEC,  speed_z) \
-       w_cvar(id, sn, SEC,  touchexplode) \
-       w_cvar(id, sn, NONE, combo_comboradius) \
-       w_cvar(id, sn, NONE, combo_comboradius_thruwall) \
-       w_cvar(id, sn, NONE, combo_damage) \
-       w_cvar(id, sn, NONE, combo_edgedamage) \
-       w_cvar(id, sn, NONE, combo_force) \
-       w_cvar(id, sn, NONE, combo_radius) \
-       w_cvar(id, sn, NONE, combo_speed) \
-       w_cvar(id, sn, NONE, combo_safeammocheck) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
+
 
 #ifdef SVQC
-ELECTRO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float electro_count;
 .float electro_secondarytime;
 void W_Electro_ExplodeCombo();
@@ -486,13 +490,9 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                                }
                        }
                }
-               METHOD(Electro, wr_init, void(entity thiswep))
-               {
-                       ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Electro, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_PRI(electro, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
                        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
                        return ammo_amount;
                }
@@ -501,20 +501,16 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                        float ammo_amount;
                        if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
                        {
-                               ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
                                ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
                        }
                        else
                        {
-                               ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_SEC(electro, ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
                                ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
                        }
                        return ammo_amount;
                }
-               METHOD(Electro, wr_config, void(entity thiswep))
-               {
-                       ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Electro, wr_resetplayer, void(entity thiswep))
                {
                        self.electro_secondarytime = time;
index 7b96971e9247e1178f975d4297e4a10f322512a4..2beeb69a12dbc75c174a76c307cca254939b0e7e 100644 (file)
@@ -14,42 +14,45 @@ CLASS(Fireball, Weapon)
 /* wepimg    */ ATTRIB(Fireball, model2, string, "weaponfireball");
 /* refname   */ ATTRIB(Fireball, netname, string, "fireball");
 /* wepname   */ ATTRIB(Fireball, m_name, string, _("Fireball"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bfgdamage, float, PRI) \
+               P(class, prefix, bfgforce, float, PRI) \
+               P(class, prefix, bfgradius, float, PRI) \
+               P(class, prefix, damageforcescale, float, BOTH) \
+               P(class, prefix, damagetime, float, SEC) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, PRI) \
+               P(class, prefix, force, float, PRI) \
+               P(class, prefix, health, float, PRI) \
+               P(class, prefix, laserburntime, float, BOTH) \
+               P(class, prefix, laserdamage, float, BOTH) \
+               P(class, prefix, laseredgedamage, float, BOTH) \
+               P(class, prefix, laserradius, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, PRI) \
+               P(class, prefix, refire2, float, PRI) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, SEC) \
+               P(class, prefix, speed_z, float, SEC) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Fireball, fireball)
+#undef X
+
 ENDCLASS(Fireball)
-REGISTER_WEAPON(FIREBALL, NEW(Fireball));
-
-#define FIREBALL_SETTINGS(w_cvar,w_prop) FIREBALL_SETTINGS_LIST(w_cvar, w_prop, FIREBALL, fireball)
-#define FIREBALL_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, damageforcescale) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, laserburntime) \
-       w_cvar(id, sn, BOTH, laserdamage) \
-       w_cvar(id, sn, BOTH, laseredgedamage) \
-       w_cvar(id, sn, BOTH, laserradius) \
-       w_cvar(id, sn, PRI,  edgedamage) \
-       w_cvar(id, sn, PRI,  force) \
-       w_cvar(id, sn, PRI,  radius) \
-       w_cvar(id, sn, PRI,  health) \
-       w_cvar(id, sn, PRI,  refire2) \
-       w_cvar(id, sn, PRI,  bfgdamage) \
-       w_cvar(id, sn, PRI,  bfgforce) \
-       w_cvar(id, sn, PRI,  bfgradius) \
-       w_cvar(id, sn, SEC,  damagetime) \
-       w_cvar(id, sn, SEC,  speed_up) \
-       w_cvar(id, sn, SEC,  speed_z) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
 
 #ifdef SVQC
-FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float bot_primary_fireballmooth; // whatever a mooth is
 .vector fireball_impactvec;
 .float fireball_primarytime;
@@ -389,10 +392,6 @@ void W_Fireball_Attack2()
                                }
                        }
                }
-               METHOD(Fireball, wr_init, void(entity thiswep))
-               {
-                       FIREBALL_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Fireball, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -405,10 +404,6 @@ void W_Fireball_Attack2()
                {
                        return true; // fireball has infinite ammo
                }
-               METHOD(Fireball, wr_config, void(entity thiswep))
-               {
-                       FIREBALL_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Fireball, wr_resetplayer, void(entity thiswep))
                {
                        self.fireball_primarytime = time;
index a5066017a974855caeeb9b7994c79b40ca572e61..292e0361f32faafc86d92b0aa623cb121fd67686 100644 (file)
@@ -14,47 +14,48 @@ CLASS(Hagar, Weapon)
 /* wepimg    */ ATTRIB(Hagar, model2, string, "weaponhagar");
 /* refname   */ ATTRIB(Hagar, netname, string, "hagar");
 /* wepname   */ ATTRIB(Hagar, m_name, string, _("Hagar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+        P(class, prefix, damageforcescale, float, BOTH) \
+        P(class, prefix, damage, float, BOTH) \
+        P(class, prefix, edgedamage, float, BOTH) \
+        P(class, prefix, force, float, BOTH) \
+        P(class, prefix, health, float, BOTH) \
+        P(class, prefix, lifetime, float, PRI) \
+        P(class, prefix, lifetime_min, float, SEC) \
+        P(class, prefix, lifetime_rand, float, SEC) \
+        P(class, prefix, load, float, SEC) \
+        P(class, prefix, load_abort, float, SEC) \
+        P(class, prefix, load_animtime, float, SEC) \
+        P(class, prefix, load_hold, float, SEC) \
+        P(class, prefix, load_linkexplode, float, SEC) \
+        P(class, prefix, load_max, float, SEC) \
+        P(class, prefix, load_releasedeath, float, SEC) \
+        P(class, prefix, load_speed, float, SEC) \
+        P(class, prefix, load_spread, float, SEC) \
+        P(class, prefix, load_spread_bias, float, SEC) \
+        P(class, prefix, radius, float, BOTH) \
+        P(class, prefix, refire, float, BOTH) \
+        P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, secondary, float, NONE) \
+        P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Hagar, hagar)
+#undef X
+
 ENDCLASS(Hagar)
-REGISTER_WEAPON(HAGAR, NEW(Hagar));
-
-#define HAGAR_SETTINGS(w_cvar,w_prop) HAGAR_SETTINGS_LIST(w_cvar, w_prop, HAGAR, hagar)
-#define HAGAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, damageforcescale) \
-       w_cvar(id, sn, BOTH, health) \
-       w_cvar(id, sn, PRI,  lifetime) \
-       w_cvar(id, sn, SEC,  load) \
-       w_cvar(id, sn, SEC,  load_max) \
-       w_cvar(id, sn, SEC,  load_abort) \
-       w_cvar(id, sn, SEC,  load_animtime) \
-       w_cvar(id, sn, SEC,  load_hold) \
-       w_cvar(id, sn, SEC,  load_speed) \
-       w_cvar(id, sn, SEC,  load_releasedeath) \
-       w_cvar(id, sn, SEC,  load_spread) \
-       w_cvar(id, sn, SEC,  load_spread_bias) \
-       w_cvar(id, sn, SEC,  load_linkexplode) \
-       w_cvar(id, sn, SEC,  lifetime_min) \
-       w_cvar(id, sn, SEC,  lifetime_rand) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
 
-#ifdef SVQC
-HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -304,7 +305,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
        else if(autocvar_g_balance_hagar_reload_ammo)
                enough_ammo = self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
        else
-               enough_ammo = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
+               enough_ammo = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
 
        bool stopped = loaded || !enough_ammo;
 
@@ -439,10 +440,6 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                                W_Hagar_Attack2_Load_Release(weaponentity);
                        }
                }
-               METHOD(Hagar, wr_init, void(entity thiswep))
-               {
-                       HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Hagar, wr_setup, void(entity thiswep))
                {
                        self.hagar_loadblock = false;
@@ -455,20 +452,16 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                }
                METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_PRI(hagar, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
                        ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
                        return ammo_amount;
                }
                METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
                        ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
                        return ammo_amount;
                }
-               METHOD(Hagar, wr_config, void(entity thiswep))
-               {
-                       HAGAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Hagar, wr_resetplayer, void(entity thiswep))
                {
                        self.hagar_load = 0;
index f99c700735d358e79d089f11c1b0f2c8fc66cdc2..4398386704a0675002482479b9b08ae3bef888e5 100644 (file)
@@ -14,39 +14,41 @@ CLASS(HLAC, Weapon)
 /* wepimg    */ ATTRIB(HLAC, model2, string, "weaponhlac");
 /* refname   */ ATTRIB(HLAC, netname, string, "hlac");
 /* wepname   */ ATTRIB(HLAC, m_name, string, _("Heavy Laser Assault Cannon"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shots, float, SEC) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, spread, float, SEC) \
+               P(class, prefix, spread_add, float, PRI) \
+               P(class, prefix, spread_crouchmod, float, BOTH) \
+               P(class, prefix, spread_max, float, PRI) \
+               P(class, prefix, spread_min, float, PRI) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, HLAC, hlac)
+#undef X
+
 ENDCLASS(HLAC)
-REGISTER_WEAPON(HLAC, NEW(HLAC));
-
-#define HLAC_SETTINGS(w_cvar,w_prop) HLAC_SETTINGS_LIST(w_cvar, w_prop, HLAC, hlac)
-#define HLAC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread_crouchmod) \
-       w_cvar(id, sn, PRI,  spread_add) \
-       w_cvar(id, sn, PRI,  spread_max) \
-       w_cvar(id, sn, PRI,  spread_min) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  shots) \
-       w_cvar(id, sn, SEC,  spread) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
+
 
-#ifdef SVQC
-HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -161,7 +163,7 @@ void W_HLAC_Attack2()
 // weapon frames
 void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if(actor.weapon != actor.switchweapon) // abort immediately if switching
+       if(PS(actor).m_weapon != PS(actor).m_switchweapon) // abort immediately if switching
        {
                w_ready(thiswep, actor, weaponentity, fire);
                return;
@@ -232,26 +234,18 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                                }
                        }
                }
-               METHOD(HLAC, wr_init, void(entity thiswep))
-               {
-                       HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_PRI(hlac, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
                        ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
                        return ammo_amount;
                }
                METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_SEC(hlac, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
                        ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
                        return ammo_amount;
                }
-               METHOD(HLAC, wr_config, void(entity thiswep))
-               {
-                       HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(HLAC, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
index 4e3722f138032c5aefbe1512923864901c48bbf7..a8a76cfd6e5783056a0760bb401a3586bcb95ff0 100644 (file)
@@ -15,8 +15,38 @@ CLASS(Hook, Weapon)
 /* refname   */ ATTRIB(Hook, netname, string, "hook");
 /* wepname   */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
        ATTRIB(Hook, ammo_factor, float, 1)
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, PRI) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damageforcescale, float, SEC) \
+               P(class, prefix, damage, float, SEC) \
+               P(class, prefix, duration, float, SEC) \
+               P(class, prefix, edgedamage, float, SEC) \
+               P(class, prefix, force, float, SEC) \
+               P(class, prefix, gravity, float, SEC) \
+               P(class, prefix, health, float, SEC) \
+               P(class, prefix, hooked_ammo, float, PRI) \
+               P(class, prefix, hooked_time_free, float, PRI) \
+               P(class, prefix, hooked_time_max, float, PRI) \
+               P(class, prefix, lifetime, float, SEC) \
+               P(class, prefix, power, float, SEC) \
+               P(class, prefix, radius, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, speed, float, SEC) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Hook, hook)
+#undef X
+
 ENDCLASS(Hook)
-REGISTER_WEAPON(HOOK, NEW(Hook));
+REGISTER_WEAPON(HOOK, hook, NEW(Hook));
 
 CLASS(OffhandHook, OffhandWeapon)
 #ifdef SVQC
@@ -30,34 +60,7 @@ CLASS(OffhandHook, OffhandWeapon)
 ENDCLASS(OffhandHook)
 OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
 
-#define HOOK_SETTINGS(w_cvar,w_prop) HOOK_SETTINGS_LIST(w_cvar, w_prop, HOOK, hook)
-#define HOOK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, PRI,  ammo) \
-       w_cvar(id, sn, PRI,  hooked_ammo) \
-       w_cvar(id, sn, PRI,  hooked_time_free) \
-       w_cvar(id, sn, PRI,  hooked_time_max) \
-       w_cvar(id, sn, SEC,  damage) \
-       w_cvar(id, sn, SEC,  duration) \
-       w_cvar(id, sn, SEC,  edgedamage) \
-       w_cvar(id, sn, SEC,  force) \
-       w_cvar(id, sn, SEC,  gravity) \
-       w_cvar(id, sn, SEC,  lifetime) \
-       w_cvar(id, sn, SEC,  power) \
-       w_cvar(id, sn, SEC,  radius) \
-       w_cvar(id, sn, SEC,  speed) \
-       w_cvar(id, sn, SEC,  health) \
-       w_cvar(id, sn, SEC,  damageforcescale) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
-
 #ifdef SVQC
-HOOK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 
 .float dmg;
 .float dmg_edge;
@@ -269,10 +272,6 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
                                actor.hook_state &= ~HOOK_REMOVING;
                        }
                }
-               METHOD(Hook, wr_init, void(entity thiswep))
-               {
-                       HOOK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Hook, wr_setup, void(entity thiswep))
                {
                        self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
@@ -290,10 +289,6 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
                        // infinite ammo for now
                        return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
                }
-               METHOD(Hook, wr_config, void(entity thiswep))
-               {
-                       HOOK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Hook, wr_resetplayer, void(entity thiswep))
                {
                        RemoveGrapplingHook(self);
index 7e79bc929f4c4538d0d7e9c8f89c93ef8e4f01ef..beebed977beb03df83bf8934850f2a4b3df3a7e1 100644 (file)
@@ -14,45 +14,47 @@ CLASS(MachineGun, Weapon)
 /* wepimg    */ ATTRIB(MachineGun, model2, string, "weaponuzi");
 /* refname   */ ATTRIB(MachineGun, netname, string, "machinegun");
 /* wepname   */ ATTRIB(MachineGun, m_name, string, _("MachineGun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, burst, float, NONE) \
+               P(class, prefix, burst_ammo, float, NONE) \
+               P(class, prefix, burst_animtime, float, NONE) \
+               P(class, prefix, burst_refire2, float, NONE) \
+               P(class, prefix, burst_refire, float, NONE) \
+               P(class, prefix, burst_speed, float, NONE) \
+               P(class, prefix, first, float, NONE) \
+               P(class, prefix, first_ammo, float, NONE) \
+               P(class, prefix, first_damage, float, NONE) \
+               P(class, prefix, first_force, float, NONE) \
+               P(class, prefix, first_refire, float, NONE) \
+               P(class, prefix, first_spread, float, NONE) \
+               P(class, prefix, mode, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, solidpenetration, float, NONE) \
+               P(class, prefix, spread_add, float, NONE) \
+               P(class, prefix, spread_max, float, NONE) \
+               P(class, prefix, spread_min, float, NONE) \
+               P(class, prefix, sustained_ammo, float, NONE) \
+               P(class, prefix, sustained_damage, float, NONE) \
+               P(class, prefix, sustained_force, float, NONE) \
+               P(class, prefix, sustained_refire, float, NONE) \
+               P(class, prefix, sustained_spread, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, MachineGun, machinegun)
+#undef X
+
 ENDCLASS(MachineGun)
-REGISTER_WEAPON(MACHINEGUN, NEW(MachineGun));
-
-#define MACHINEGUN_SETTINGS(w_cvar,w_prop) MACHINEGUN_SETTINGS_LIST(w_cvar, w_prop, MACHINEGUN, machinegun)
-#define MACHINEGUN_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, spread_min) \
-       w_cvar(id, sn, NONE, spread_max) \
-       w_cvar(id, sn, NONE, spread_add) \
-       w_cvar(id, sn, NONE, mode) \
-       w_cvar(id, sn, NONE, first) \
-       w_cvar(id, sn, NONE, first_damage) \
-       w_cvar(id, sn, NONE, first_force) \
-       w_cvar(id, sn, NONE, first_refire) \
-       w_cvar(id, sn, NONE, first_spread) \
-       w_cvar(id, sn, NONE, first_ammo) \
-       w_cvar(id, sn, NONE, solidpenetration) \
-       w_cvar(id, sn, NONE, sustained_damage) \
-       w_cvar(id, sn, NONE, sustained_force) \
-       w_cvar(id, sn, NONE, sustained_refire) \
-       w_cvar(id, sn, NONE, sustained_spread) \
-       w_cvar(id, sn, NONE, sustained_ammo) \
-       w_cvar(id, sn, NONE, burst) \
-       w_cvar(id, sn, NONE, burst_refire) \
-       w_cvar(id, sn, NONE, burst_refire2) \
-       w_cvar(id, sn, NONE, burst_animtime) \
-       w_cvar(id, sn, NONE, burst_speed) \
-       w_cvar(id, sn, NONE, burst_ammo) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
+
 
-#ifdef SVQC
-MACHINEGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -139,7 +141,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
 // weapon frames
 void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if(actor.weapon != actor.switchweapon) // abort immediately if switching
+       if(PS(actor).m_weapon != PS(actor).m_switchweapon) // abort immediately if switching
        {
                w_ready(thiswep, actor, weaponentity, fire);
                return;
@@ -298,17 +300,13 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                                }
                        }
                }
-               METHOD(MachineGun, wr_init, void(entity thiswep))
-               {
-                       MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount;
                        if(WEP_CVAR(machinegun, mode) == 1)
-                               ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, sustained_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
                        else
-                               ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, first_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
 
                        if(WEP_CVAR(machinegun, reload_ammo))
                        {
@@ -323,9 +321,9 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                {
                        float ammo_amount;
                        if(WEP_CVAR(machinegun, mode) == 1)
-                               ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, burst_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
                        else
-                               ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, first_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
 
                        if(WEP_CVAR(machinegun, reload_ammo))
                        {
@@ -336,10 +334,6 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                        }
                        return ammo_amount;
                }
-               METHOD(MachineGun, wr_config, void(entity thiswep))
-               {
-                       MACHINEGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(MachineGun, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
index 2f1459f83d4735ba6e9a75934a7b0ebfb932e71f..ee5660b326e99d402914a2eb58274fb69311c87f 100644 (file)
@@ -14,43 +14,45 @@ CLASS(MineLayer, Weapon)
 /* wepimg    */ ATTRIB(MineLayer, model2, string, "weaponminelayer");
 /* refname   */ ATTRIB(MineLayer, netname, string, "minelayer");
 /* wepname   */ ATTRIB(MineLayer, m_name, string, _("Mine Layer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, damageforcescale, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, detonatedelay, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, health, float, NONE) \
+               P(class, prefix, lifetime, float, NONE) \
+               P(class, prefix, lifetime_countdown, float, NONE) \
+               P(class, prefix, limit, float, NONE) \
+               P(class, prefix, protection, float, NONE) \
+               P(class, prefix, proximityradius, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, remote_damage, float, NONE) \
+               P(class, prefix, remote_edgedamage, float, NONE) \
+               P(class, prefix, remote_force, float, NONE) \
+               P(class, prefix, remote_radius, float, NONE) \
+               P(class, prefix, speed, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, time, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, MineLayer, minelayer)
+#undef X
 ENDCLASS(MineLayer)
-REGISTER_WEAPON(MINE_LAYER, NEW(MineLayer));
-
-#define MINELAYER_SETTINGS(w_cvar,w_prop) MINELAYER_SETTINGS_LIST(w_cvar, w_prop, MINE_LAYER, minelayer)
-#define MINELAYER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, damageforcescale) \
-       w_cvar(id, sn, NONE, detonatedelay) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, health) \
-       w_cvar(id, sn, NONE, lifetime) \
-       w_cvar(id, sn, NONE, lifetime_countdown) \
-       w_cvar(id, sn, NONE, limit) \
-       w_cvar(id, sn, NONE, protection) \
-       w_cvar(id, sn, NONE, proximityradius) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, remote_damage) \
-       w_cvar(id, sn, NONE, remote_edgedamage) \
-       w_cvar(id, sn, NONE, remote_force) \
-       w_cvar(id, sn, NONE, remote_radius) \
-       w_cvar(id, sn, NONE, speed) \
-       w_cvar(id, sn, NONE, time) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
 
 #ifdef SVQC
-MINELAYER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 void W_MineLayer_Think();
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
@@ -121,7 +123,7 @@ void W_MineLayer_Explode()
 
        RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), world, world, WEP_CVAR(minelayer, force), self.projectiledeathtype, other);
 
-       if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
+       if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
        {
                setself(self.realowner);
                Weapon w = WEP_MINE_LAYER;
@@ -130,7 +132,7 @@ void W_MineLayer_Explode()
                        self.cnt = WEP_MINE_LAYER.m_id;
                        int slot = 0; // TODO: unhardcode
                        ATTACK_FINISHED(self, slot) = time;
-                       self.switchweapon = w_getbestweapon(self);
+                       PS(self).m_switchweapon = w_getbestweapon(self);
                }
                setself(this);
        }
@@ -148,7 +150,7 @@ void W_MineLayer_DoRemoteExplode()
 
        RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), world, world, WEP_CVAR(minelayer, remote_force), self.projectiledeathtype | HITTYPE_BOUNCE, world);
 
-       if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
+       if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
        {
                setself(self.realowner);
                Weapon w = WEP_MINE_LAYER;
@@ -157,7 +159,7 @@ void W_MineLayer_DoRemoteExplode()
                        self.cnt = WEP_MINE_LAYER.m_id;
                        int slot = 0; // TODO: unhardcode
                        ATTACK_FINISHED(self, slot) = time;
-                       self.switchweapon = w_getbestweapon(self);
+                       PS(self).m_switchweapon = w_getbestweapon(self);
                }
                setself(this);
        }
@@ -263,7 +265,7 @@ void W_MineLayer_Think()
        }
 
        // remote detonation
-       if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
+       if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
        if(self.realowner.deadflag == DEAD_NO)
        if(self.minelayer_detonate)
                W_MineLayer_RemoteExplode();
@@ -505,7 +507,7 @@ float W_MineLayer_PlacedMines(float detonate)
                        if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
                        {
                                // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-                               if(!(W_MineLayer_PlacedMines(false) && actor.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo))) {
+                               if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
                                        thiswep.wr_reload(thiswep);
                                }
                        }
@@ -524,17 +526,13 @@ float W_MineLayer_PlacedMines(float detonate)
                                        sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
                        }
                }
-               METHOD(MineLayer, wr_init, void(entity thiswep))
-               {
-                       MINELAYER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
                {
                        int slot = 0; // TODO: unhardcode
                        // don't switch while placing a mine
-                       if(ATTACK_FINISHED(self, slot) <= time || self.weapon != WEP_MINE_LAYER.m_id)
+                       if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
                        {
-                               float ammo_amount = self.WEP_AMMO(MINE_LAYER) >= WEP_CVAR(minelayer, ammo);
+                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
                                ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
                                return ammo_amount;
                        }
@@ -547,10 +545,6 @@ float W_MineLayer_PlacedMines(float detonate)
                        else
                                return false;
                }
-               METHOD(MineLayer, wr_config, void(entity thiswep))
-               {
-                       MINELAYER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
                {
                        self.minelayer_mines = 0;
index 223d13ffb2dbb6a1452f672659c850d78e88e39d..3271b2b253cdabba0439c5b1e674f4d829a2ea6b 100644 (file)
@@ -14,43 +14,46 @@ CLASS(Mortar, Weapon)
 /* wepimg    */ ATTRIB(Mortar, model2, string, "weapongrenadelauncher");
 /* refname   */ ATTRIB(Mortar, netname, string, "mortar");
 /* wepname   */ ATTRIB(Mortar, m_name, string, _("Mortar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bouncefactor, float, NONE) \
+               P(class, prefix, bouncestop, float, NONE) \
+               P(class, prefix, damageforcescale, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, health, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, lifetime_bounce, float, SEC) \
+               P(class, prefix, lifetime_stick, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, remote_detonateprimary, float, SEC) \
+               P(class, prefix, remote_minbouncecnt, float, PRI) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, BOTH) \
+               P(class, prefix, speed_z, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, type, float, BOTH) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Mortar, mortar)
+#undef X
 ENDCLASS(Mortar)
-REGISTER_WEAPON(MORTAR, NEW(Mortar));
-
-#define MORTAR_SETTINGS(w_cvar,w_prop) MORTAR_SETTINGS_LIST(w_cvar, w_prop, MORTAR, mortar)
-#define MORTAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, NONE, bouncefactor) \
-       w_cvar(id, sn, NONE, bouncestop) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, damageforcescale) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, health) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, SEC,  lifetime_bounce) \
-       w_cvar(id, sn, BOTH, lifetime_stick) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, SEC,  remote_detonateprimary) \
-       w_cvar(id, sn, PRI,  remote_minbouncecnt) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, speed_up) \
-       w_cvar(id, sn, BOTH, speed_z) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, type) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
+
 
 #ifdef SVQC
-MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float gl_detonate_later;
 .float gl_bouncecnt;
 #endif
@@ -368,26 +371,18 @@ void W_Mortar_Attack2(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Mortar, wr_init, void(entity thiswep))
-               {
-                       MORTAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_PRI(mortar, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
                        ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
                        return ammo_amount;
                }
                METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_SEC(mortar, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
                        ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
                        return ammo_amount;
                }
-               METHOD(Mortar, wr_config, void(entity thiswep))
-               {
-                       MORTAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Mortar, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
index b8c54c4165af491c655055e9c2a886a2c16a4b05..f992e31bda17a915172665ee8250635c5acf1647 100644 (file)
@@ -14,25 +14,27 @@ CLASS(PortoLaunch, Weapon)
 /* wepimg    */ ATTRIB(PortoLaunch, model2, string, "weaponporto");
 /* refname   */ ATTRIB(PortoLaunch, netname, string, "porto");
 /* wepname   */ ATTRIB(PortoLaunch, m_name, string, _("Port-O-Launch"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, PortoLaunch, porto)
+#undef X
 ENDCLASS(PortoLaunch)
-REGISTER_WEAPON(PORTO, NEW(PortoLaunch));
-
-#define PORTO_SETTINGS(w_cvar,w_prop) PORTO_SETTINGS_LIST(w_cvar, w_prop, PORTO, porto)
-#define PORTO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
 
 #ifdef SVQC
-PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity porto_current;
 .vector porto_v_angle; // holds "held" view angles
 .float porto_v_angle_held;
@@ -301,10 +303,6 @@ void W_Porto_Attack(float type)
                                if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
                                        self.BUTTON_ATCK = true;
                }
-               METHOD(PortoLaunch, wr_config, void(entity this))
-               {
-                       PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(WEP_CVAR(porto, secondary))
@@ -371,10 +369,6 @@ void W_Porto_Attack(float type)
                        // always allow infinite ammo
                        return true;
                }
-               METHOD(PortoLaunch, wr_init, void(entity this))
-               {
-                       PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(PortoLaunch, wr_setup, void(entity thiswep))
                {
                        SELFPARAM();
index a639747db7f2c9493bec6be49ab50e7136d88bad..97bcac8bb5d7de7833b4ec32409188354bf1cfd9 100644 (file)
@@ -14,36 +14,39 @@ CLASS(Rifle, Weapon)
 /* wepimg    */ ATTRIB(Rifle, model2, string, "weaponrifle");
 /* refname   */ ATTRIB(Rifle, netname, string, "rifle");
 /* wepname   */ ATTRIB(Rifle, m_name, string, _("Rifle"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bullethail, float, BOTH) \
+               P(class, prefix, burstcost, float, BOTH) \
+               P(class, prefix, bursttime, float, NONE) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload, float, SEC) \
+               P(class, prefix, reload_ammo, float, NONE) \
+       P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shots, float, BOTH) \
+               P(class, prefix, solidpenetration, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+       P(class, prefix, switchdelay_drop, float, NONE) \
+       P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, tracer, float, BOTH) \
+       P(class, prefix, weaponreplace, string, NONE) \
+       P(class, prefix, weaponstartoverride, float, NONE) \
+       P(class, prefix, weaponstart, float, NONE) \
+       P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Rifle, rifle)
+#undef X
 ENDCLASS(Rifle)
-REGISTER_WEAPON(RIFLE, NEW(Rifle));
+REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
 
-#define RIFLE_SETTINGS(w_cvar,w_prop) RIFLE_SETTINGS_LIST(w_cvar, w_prop, RIFLE, rifle)
-#define RIFLE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, bullethail) \
-       w_cvar(id, sn, BOTH, burstcost) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, shots) \
-       w_cvar(id, sn, BOTH, solidpenetration) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, tracer) \
-       w_cvar(id, sn, NONE, bursttime) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  reload) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
 
 #ifdef SVQC
-RIFLE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float rifle_accumulator;
 #endif
 #endif
@@ -92,16 +95,16 @@ void W_Rifle_Attack2()
 .float rifle_bullethail_refire;
 void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       float r, sw, af;
+       float r, af;
 
-       sw = actor.switchweapon; // make it not detect weapon changes as reason to abort firing
+       Weapon sw = PS(actor).m_switchweapon; // make it not detect weapon changes as reason to abort firing
        int slot = weaponslot(weaponentity);
        af = ATTACK_FINISHED(actor, slot);
-       actor.switchweapon = actor.weapon;
+       PS(actor).m_switchweapon = PS(actor).m_weapon;
        ATTACK_FINISHED(actor, slot) = time;
        r = weapon_prepareattack(thiswep, actor, weaponentity, actor.rifle_bullethail_frame == WFRAME_FIRE2, actor.rifle_bullethail_refire);
-       if(actor.switchweapon == actor.weapon)
-               actor.switchweapon = sw;
+       if(PS(actor).m_switchweapon == PS(actor).m_weapon)
+               PS(actor).m_switchweapon = sw;
        if(r)
        {
                actor.rifle_bullethail_attackfunc();
@@ -193,26 +196,18 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                                }
                        }
                }
-               METHOD(Rifle, wr_init, void(entity thiswep))
-               {
-                       RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_PRI(rifle, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
                        ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
                        return ammo_amount;
                }
                METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_SEC(rifle, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
                        ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
                        return ammo_amount;
                }
-               METHOD(Rifle, wr_config, void(entity thiswep))
-               {
-                       RIFLE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Rifle, wr_resetplayer, void(entity thiswep))
                {
                        self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
index 01c7feb887848f1ce0c157e2f19fd33c048323d0..55d6b4f7af125b411a0d6c528ac64890d6eb84cd 100644 (file)
@@ -14,72 +14,75 @@ CLASS(Seeker, Weapon)
 /* wepimg    */ ATTRIB(Seeker, model2, string, "weaponseeker");
 /* refname   */ ATTRIB(Seeker, netname, string, "seeker");
 /* wepname   */ ATTRIB(Seeker, m_name, string, _("T.A.G. Seeker"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+       P(class, prefix, flac_ammo, float, NONE) \
+       P(class, prefix, flac_animtime, float, NONE) \
+       P(class, prefix, flac_damage, float, NONE) \
+       P(class, prefix, flac_edgedamage, float, NONE) \
+       P(class, prefix, flac_force, float, NONE) \
+       P(class, prefix, flac_lifetime, float, NONE) \
+       P(class, prefix, flac_lifetime_rand, float, NONE) \
+       P(class, prefix, flac_radius, float, NONE) \
+       P(class, prefix, flac_refire, float, NONE) \
+       P(class, prefix, flac_speed, float, NONE) \
+       P(class, prefix, flac_speed_up, float, NONE) \
+       P(class, prefix, flac_speed_z, float, NONE) \
+       P(class, prefix, flac_spread, float, NONE) \
+       P(class, prefix, missile_accel, float, NONE) \
+       P(class, prefix, missile_ammo, float, NONE) \
+       P(class, prefix, missile_animtime, float, NONE) \
+       P(class, prefix, missile_count, float, NONE) \
+       P(class, prefix, missile_damageforcescale, float, NONE) \
+       P(class, prefix, missile_damage, float, NONE) \
+       P(class, prefix, missile_decel, float, NONE) \
+       P(class, prefix, missile_delay, float, NONE) \
+       P(class, prefix, missile_edgedamage, float, NONE) \
+       P(class, prefix, missile_force, float, NONE) \
+       P(class, prefix, missile_health, float, NONE) \
+       P(class, prefix, missile_lifetime, float, NONE) \
+       P(class, prefix, missile_proxy, float, NONE) \
+       P(class, prefix, missile_proxy_delay, float, NONE) \
+       P(class, prefix, missile_proxy_maxrange, float, NONE) \
+       P(class, prefix, missile_radius, float, NONE) \
+       P(class, prefix, missile_refire, float, NONE) \
+       P(class, prefix, missile_smart, float, NONE) \
+       P(class, prefix, missile_smart_mindist, float, NONE) \
+       P(class, prefix, missile_smart_trace_max, float, NONE) \
+       P(class, prefix, missile_smart_trace_min, float, NONE) \
+       P(class, prefix, missile_speed, float, NONE) \
+       P(class, prefix, missile_speed_max, float, NONE) \
+       P(class, prefix, missile_speed_up, float, NONE) \
+       P(class, prefix, missile_speed_z, float, NONE) \
+       P(class, prefix, missile_spread, float, NONE) \
+       P(class, prefix, missile_turnrate, float, NONE) \
+       P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+       P(class, prefix, tag_ammo, float, NONE) \
+       P(class, prefix, tag_animtime, float, NONE) \
+       P(class, prefix, tag_damageforcescale, float, NONE) \
+       P(class, prefix, tag_health, float, NONE) \
+       P(class, prefix, tag_lifetime, float, NONE) \
+       P(class, prefix, tag_refire, float, NONE) \
+       P(class, prefix, tag_speed, float, NONE) \
+       P(class, prefix, tag_spread, float, NONE) \
+       P(class, prefix, tag_tracker_lifetime, float, NONE) \
+               P(class, prefix, type, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Seeker, seeker)
+#undef X
 ENDCLASS(Seeker)
-REGISTER_WEAPON(SEEKER, NEW(Seeker));
-
-#define SEEKER_SETTINGS(w_cvar,w_prop) SEEKER_SETTINGS_LIST(w_cvar, w_prop, SEEKER, seeker)
-#define SEEKER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, type) \
-       w_cvar(id, sn, NONE, flac_ammo) \
-       w_cvar(id, sn, NONE, flac_animtime) \
-       w_cvar(id, sn, NONE, flac_damage) \
-       w_cvar(id, sn, NONE, flac_edgedamage) \
-       w_cvar(id, sn, NONE, flac_force) \
-       w_cvar(id, sn, NONE, flac_lifetime) \
-       w_cvar(id, sn, NONE, flac_lifetime_rand) \
-       w_cvar(id, sn, NONE, flac_radius) \
-       w_cvar(id, sn, NONE, flac_refire) \
-       w_cvar(id, sn, NONE, flac_speed) \
-       w_cvar(id, sn, NONE, flac_speed_up) \
-       w_cvar(id, sn, NONE, flac_speed_z) \
-       w_cvar(id, sn, NONE, flac_spread) \
-       w_cvar(id, sn, NONE, missile_accel) \
-       w_cvar(id, sn, NONE, missile_ammo) \
-       w_cvar(id, sn, NONE, missile_animtime) \
-       w_cvar(id, sn, NONE, missile_count) \
-       w_cvar(id, sn, NONE, missile_damage) \
-       w_cvar(id, sn, NONE, missile_damageforcescale) \
-       w_cvar(id, sn, NONE, missile_decel) \
-       w_cvar(id, sn, NONE, missile_delay) \
-       w_cvar(id, sn, NONE, missile_edgedamage) \
-       w_cvar(id, sn, NONE, missile_force) \
-       w_cvar(id, sn, NONE, missile_health) \
-       w_cvar(id, sn, NONE, missile_lifetime) \
-       w_cvar(id, sn, NONE, missile_proxy) \
-       w_cvar(id, sn, NONE, missile_proxy_delay) \
-       w_cvar(id, sn, NONE, missile_proxy_maxrange) \
-       w_cvar(id, sn, NONE, missile_radius) \
-       w_cvar(id, sn, NONE, missile_refire) \
-       w_cvar(id, sn, NONE, missile_smart) \
-       w_cvar(id, sn, NONE, missile_smart_mindist) \
-       w_cvar(id, sn, NONE, missile_smart_trace_max) \
-       w_cvar(id, sn, NONE, missile_smart_trace_min) \
-       w_cvar(id, sn, NONE, missile_speed) \
-       w_cvar(id, sn, NONE, missile_speed_max) \
-       w_cvar(id, sn, NONE, missile_speed_up) \
-       w_cvar(id, sn, NONE, missile_speed_z) \
-       w_cvar(id, sn, NONE, missile_spread) \
-       w_cvar(id, sn, NONE, missile_turnrate) \
-       w_cvar(id, sn, NONE, tag_ammo) \
-       w_cvar(id, sn, NONE, tag_animtime) \
-       w_cvar(id, sn, NONE, tag_damageforcescale) \
-       w_cvar(id, sn, NONE, tag_health) \
-       w_cvar(id, sn, NONE, tag_lifetime) \
-       w_cvar(id, sn, NONE, tag_refire) \
-       w_cvar(id, sn, NONE, tag_speed) \
-       w_cvar(id, sn, NONE, tag_spread) \
-       w_cvar(id, sn, NONE, tag_tracker_lifetime) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
+
 
 #ifdef SVQC
-SEEKER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity tag_target, wps_tag_tracker;
 .float tag_time;
 #endif
@@ -417,7 +420,8 @@ void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
        entity oldenemy;
        self.cnt = self.cnt - 1;
 
-       if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.WEP_AMMO(SEEKER) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id))
+       Weapon thiswep = WEP_SEEKER;
+       if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.(thiswep.ammo_field) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (PS(self.realowner).m_switchweapon != WEP_SEEKER))
        {
                remove(self);
                return;
@@ -455,7 +459,7 @@ void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
 void W_Seeker_Tracker_Think()
 {SELFPARAM();
        // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
-       if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id)
+       if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (PS(self.realowner).m_switchweapon != WEP_SEEKER)
        || (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
        {
                if(self)
@@ -648,21 +652,17 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Seeker, wr_init, void(entity thiswep))
-               {
-                       SEEKER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount;
                        if(WEP_CVAR(seeker, type) == 1)
                        {
-                               ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, missile_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
                                ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
                        }
                        else
                        {
-                               ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, tag_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
                                ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
                        }
                        return ammo_amount;
@@ -672,20 +672,16 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                        float ammo_amount;
                        if(WEP_CVAR(seeker, type) == 1)
                        {
-                               ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, tag_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
                                ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
                        }
                        else
                        {
-                               ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, flac_ammo);
+                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
                                ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
                        }
                        return ammo_amount;
                }
-               METHOD(Seeker, wr_config, void(entity thiswep))
-               {
-                       SEEKER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Seeker, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
index 43a207e9686d0eff9c6da2f577c0b196305dd6d7..fb5fbf4bbb96fa36bb97a4ed3960b3e7630017c2 100644 (file)
@@ -14,64 +14,66 @@ CLASS(Shockwave, Weapon)
 /* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshotgun");
 /* refname   */ ATTRIB(Shockwave, netname, string, "shockwave");
 /* wepname   */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, blast_animtime, float, NONE) \
+               P(class, prefix, blast_damage, float, NONE) \
+               P(class, prefix, blast_distance, float, NONE) \
+               P(class, prefix, blast_edgedamage, float, NONE) \
+               P(class, prefix, blast_force, float, NONE) \
+               P(class, prefix, blast_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_damage, float, NONE) \
+               P(class, prefix, blast_jump_edgedamage, float, NONE) \
+               P(class, prefix, blast_jump_force, float, NONE) \
+               P(class, prefix, blast_jump_force_velocitybias, float, NONE) \
+               P(class, prefix, blast_jump_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_min, float, NONE) \
+               P(class, prefix, blast_jump_radius, float, NONE) \
+               P(class, prefix, blast_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_multiplier_min, float, NONE) \
+               P(class, prefix, blast_refire, float, NONE) \
+               P(class, prefix, blast_splash_damage, float, NONE) \
+               P(class, prefix, blast_splash_edgedamage, float, NONE) \
+               P(class, prefix, blast_splash_force, float, NONE) \
+               P(class, prefix, blast_splash_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_min, float, NONE) \
+               P(class, prefix, blast_splash_radius, float, NONE) \
+               P(class, prefix, blast_spread_max, float, NONE) \
+               P(class, prefix, blast_spread_min, float, NONE) \
+               P(class, prefix, melee_animtime, float, NONE) \
+               P(class, prefix, melee_damage, float, NONE) \
+               P(class, prefix, melee_delay, float, NONE) \
+               P(class, prefix, melee_force, float, NONE) \
+               P(class, prefix, melee_multihit, float, NONE) \
+               P(class, prefix, melee_no_doubleslap, float, NONE) \
+               P(class, prefix, melee_nonplayerdamage, float, NONE) \
+               P(class, prefix, melee_range, float, NONE) \
+               P(class, prefix, melee_refire, float, NONE) \
+               P(class, prefix, melee_swing_side, float, NONE) \
+               P(class, prefix, melee_swing_up, float, NONE) \
+               P(class, prefix, melee_time, float, NONE) \
+               P(class, prefix, melee_traces, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shockwave, shockwave)
+#undef X
+
 ENDCLASS(Shockwave)
-REGISTER_WEAPON(SHOCKWAVE, NEW(Shockwave));
-
-#define SHOCKWAVE_SETTINGS(w_cvar,w_prop) SHOCKWAVE_SETTINGS_LIST(w_cvar, w_prop, SHOCKWAVE, shockwave)
-#define SHOCKWAVE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, blast_animtime) \
-       w_cvar(id, sn, NONE, blast_damage) \
-       w_cvar(id, sn, NONE, blast_distance) \
-       w_cvar(id, sn, NONE, blast_edgedamage) \
-       w_cvar(id, sn, NONE, blast_force) \
-       w_cvar(id, sn, NONE, blast_force_forwardbias) \
-       w_cvar(id, sn, NONE, blast_force_zscale) \
-       w_cvar(id, sn, NONE, blast_jump_damage) \
-       w_cvar(id, sn, NONE, blast_jump_edgedamage) \
-       w_cvar(id, sn, NONE, blast_jump_force) \
-       w_cvar(id, sn, NONE, blast_jump_force_velocitybias) \
-       w_cvar(id, sn, NONE, blast_jump_force_zscale) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_jump_radius) \
-       w_cvar(id, sn, NONE, blast_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_refire) \
-       w_cvar(id, sn, NONE, blast_splash_damage) \
-       w_cvar(id, sn, NONE, blast_splash_edgedamage) \
-       w_cvar(id, sn, NONE, blast_splash_force) \
-       w_cvar(id, sn, NONE, blast_splash_force_forwardbias) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_splash_radius) \
-       w_cvar(id, sn, NONE, blast_spread_max) \
-       w_cvar(id, sn, NONE, blast_spread_min) \
-       w_cvar(id, sn, NONE, melee_animtime) \
-       w_cvar(id, sn, NONE, melee_damage) \
-       w_cvar(id, sn, NONE, melee_delay) \
-       w_cvar(id, sn, NONE, melee_force) \
-       w_cvar(id, sn, NONE, melee_multihit) \
-       w_cvar(id, sn, NONE, melee_no_doubleslap) \
-       w_cvar(id, sn, NONE, melee_nonplayerdamage) \
-       w_cvar(id, sn, NONE, melee_range) \
-       w_cvar(id, sn, NONE, melee_refire) \
-       w_cvar(id, sn, NONE, melee_swing_side) \
-       w_cvar(id, sn, NONE, melee_swing_up) \
-       w_cvar(id, sn, NONE, melee_time) \
-       w_cvar(id, sn, NONE, melee_traces) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
+
 
-#ifdef SVQC
-SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #ifdef CSQC
 void Net_ReadShockwaveParticle();
 .vector sw_shotorg;
@@ -350,7 +352,7 @@ void W_Shockwave_Send()
        WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
-       WriteByte(MSG_BROADCAST, num_for_edict(self));
+       WriteByte(MSG_BROADCAST, etof(self));
 }
 
 void W_Shockwave_Attack()
@@ -702,10 +704,6 @@ void W_Shockwave_Attack()
                                }
                        }
                }
-               METHOD(Shockwave, wr_init, void(entity thiswep))
-               {
-                       SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
                {
                        return true; // infinite ammo
@@ -715,10 +713,6 @@ void W_Shockwave_Attack()
                        // shockwave has infinite ammo
                        return true;
                }
-               METHOD(Shockwave, wr_config, void(entity thiswep))
-               {
-                       SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
                {
                        return WEAPON_THINKING_WITH_PORTALS;
index c50eff100e81f04bb69551bc54d1eae0c6bc3af6..9bc1a229e45a4469cc768712cf6f7c15f3d6e0e4 100644 (file)
@@ -14,43 +14,45 @@ CLASS(Shotgun, Weapon)
 /* wepimg    */ ATTRIB(Shotgun, model2, string, "weaponshotgun");
 /* refname   */ ATTRIB(Shotgun, netname, string, "shotgun");
 /* wepname   */ ATTRIB(Shotgun, m_name, string, _("Shotgun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, alt_animtime, float, SEC) \
+               P(class, prefix, alt_refire, float, SEC) \
+               P(class, prefix, ammo, float, PRI) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bullets, float, PRI) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, melee_delay, float, SEC) \
+               P(class, prefix, melee_multihit, float, SEC) \
+               P(class, prefix, melee_nonplayerdamage, float, SEC) \
+               P(class, prefix, melee_no_doubleslap, float, SEC) \
+               P(class, prefix, melee_range, float, SEC) \
+               P(class, prefix, melee_swing_side, float, SEC) \
+               P(class, prefix, melee_swing_up, float, SEC) \
+               P(class, prefix, melee_time, float, SEC) \
+               P(class, prefix, melee_traces, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, solidpenetration, float, PRI) \
+               P(class, prefix, spread, float, PRI) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shotgun, shotgun)
+#undef X
+
 ENDCLASS(Shotgun)
-REGISTER_WEAPON(SHOTGUN, NEW(Shotgun));
-
-#define SHOTGUN_SETTINGS(w_cvar,w_prop) SHOTGUN_SETTINGS_LIST(w_cvar, w_prop, SHOTGUN, shotgun)
-#define SHOTGUN_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, PRI,  ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, PRI,  bullets) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, PRI,  solidpenetration) \
-       w_cvar(id, sn, PRI,  spread) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  melee_time) \
-       w_cvar(id, sn, SEC,  melee_no_doubleslap) \
-       w_cvar(id, sn, SEC,  melee_traces) \
-       w_cvar(id, sn, SEC,  melee_swing_up) \
-       w_cvar(id, sn, SEC,  melee_swing_side) \
-       w_cvar(id, sn, SEC,  melee_nonplayerdamage) \
-       w_cvar(id, sn, SEC,  melee_multihit) \
-       w_cvar(id, sn, SEC,  melee_delay) \
-       w_cvar(id, sn, SEC,  melee_range) \
-       w_cvar(id, sn, SEC,  alt_animtime) \
-       w_cvar(id, sn, SEC,  alt_refire) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
+
 
-#ifdef SVQC
-SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -271,24 +273,20 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                        if(actor.clip_load >= 0) // we are not currently reloading
                        if(!actor.crouch) // no crouchmelee please
                        if(WEP_CVAR(shotgun, secondary) == 1)
-                       if(((fire & 1) && actor.WEP_AMMO(SHOTGUN) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
+                       if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
                        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
                        {
                                // attempt forcing playback of the anim by switching to another anim (that we never play) here...
                                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
                        }
                }
-               METHOD(Shotgun, wr_init, void(entity thiswep))
-               {
-                       SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Shotgun, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
                }
                METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
                        ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
                        return ammo_amount;
                }
@@ -302,17 +300,13 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                                case 1: return true; // melee does not use ammo
                                case 2: // secondary triple shot
                                {
-                                       float ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
+                                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
                                        ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
                                        return ammo_amount;
                                }
                                default: return false; // secondary unavailable
                        }
                }
-               METHOD(Shotgun, wr_config, void(entity thiswep))
-               {
-                       SHOTGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Shotgun, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
index 308d43fc122f5d9e7ddc82a12f69f31b06ae7057..ef2e5e2612dafd69847c56bf8b1574035b37eed3 100644 (file)
@@ -15,34 +15,34 @@ CLASS(Tuba, Weapon)
 /* refname   */ ATTRIB(Tuba, netname, string, "tuba");
 /* xgettext:no-c-format */
 /* wepname   */ ATTRIB(Tuba, m_name, string, _("@!#%'n Tuba"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, attenuation, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, fadetime, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, pitchstep, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, volume, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Tuba, tuba)
+#undef X
+
 ENDCLASS(Tuba)
-REGISTER_WEAPON(TUBA, NEW(Tuba));
-
-#define TUBA_SETTINGS(w_cvar,w_prop) TUBA_SETTINGS_LIST(w_cvar, w_prop, TUBA, tuba)
-#define TUBA_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, attenuation) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, fadetime) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, pitchstep) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, volume) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
+
 
 #ifdef SVQC
-TUBA_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-float W_Tuba_MarkClientOnlyFieldsAsUsed() {
-       // These variables are only used by client/tuba.qc. TODO: move client/tuba.qc code here.
-       return WEP_CVAR(tuba, fadetime) + WEP_CVAR(tuba, pitchstep) + WEP_CVAR(tuba, volume);
-}
 
 .entity tuba_note;
 .float tuba_smoketime;
@@ -403,10 +403,6 @@ void W_Tuba_NoteOn(float hittype)
                                }
                        }
                }
-               METHOD(Tuba, wr_init, void(entity thiswep))
-               {
-                       TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Tuba, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -447,10 +443,6 @@ void W_Tuba_NoteOn(float hittype)
                {
                        return true; // tuba has infinite ammo
                }
-               METHOD(Tuba, wr_config, void(entity thiswep))
-               {
-                       TUBA_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Tuba, wr_suicidemessage, int(entity thiswep))
                {
                        if(w_deathtype & HITTYPE_BOUNCE)
index 7ab692f24dcd8779ca711bdb88f23367aab168da..d3c47ee5fa031adf2caab63baef747aa9c3bf658 100644 (file)
@@ -14,38 +14,42 @@ CLASS(Vaporizer, Weapon)
 /* wepimg    */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
 /* refname   */ ATTRIB(Vaporizer, netname, string, "vaporizer");
 /* wepname   */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, PRI) \
+       P(class, prefix, animtime, float, PRI) \
+       P(class, prefix, damage, float, PRI) \
+       P(class, prefix, refire, float, PRI) \
+       P(class, prefix, ammo, float, SEC) \
+       P(class, prefix, animtime, float, SEC) \
+       P(class, prefix, damage, float, SEC) \
+       P(class, prefix, delay, float, SEC) \
+       P(class, prefix, edgedamage, float, SEC) \
+       P(class, prefix, force, float, SEC) \
+       P(class, prefix, lifetime, float, SEC) \
+       P(class, prefix, radius, float, SEC) \
+       P(class, prefix, refire, float, SEC) \
+       P(class, prefix, shotangle, float, SEC) \
+       P(class, prefix, speed, float, SEC) \
+       P(class, prefix, spread, float, SEC) \
+       P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Vaporizer, vaporizer)
+#undef X
+
 ENDCLASS(Vaporizer)
-REGISTER_WEAPON(VAPORIZER, NEW(Vaporizer));
-
-#define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
-#define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, PRI, ammo) \
-       w_cvar(id, sn, PRI, animtime) \
-       w_cvar(id, sn, PRI, damage) \
-       w_cvar(id, sn, PRI, refire) \
-       w_cvar(id, sn, SEC, ammo) \
-       w_cvar(id, sn, SEC, animtime) \
-       w_cvar(id, sn, SEC, damage) \
-       w_cvar(id, sn, SEC, delay) \
-       w_cvar(id, sn, SEC, edgedamage) \
-       w_cvar(id, sn, SEC, force) \
-       w_cvar(id, sn, SEC, lifetime) \
-       w_cvar(id, sn, SEC, radius) \
-       w_cvar(id, sn, SEC, refire) \
-       w_cvar(id, sn, SEC, shotangle) \
-       w_cvar(id, sn, SEC, speed) \
-       w_cvar(id, sn, SEC, spread) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
+
 
 #ifdef SVQC
-VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float vaporizer_lasthit;
 .float jump_interval;
 .float jump_interval2;
@@ -71,7 +75,7 @@ void SendCSQCVaporizerBeamParticle(entity player, int hit) {
        WriteCoord(MSG_BROADCAST, v.y);
        WriteCoord(MSG_BROADCAST, v.z);
        WriteByte(MSG_BROADCAST, hit);
-       WriteByte(MSG_BROADCAST, num_for_edict(player));
+       WriteByte(MSG_BROADCAST, etof(player));
        WriteByte(MSG_BROADCAST, player.team);
 }
 #elif defined(CSQC)
@@ -124,7 +128,7 @@ void VaporizerBeam_Draw(entity this)
        Draw_VaporizerBeam_trace_callback_tex = string_null;
 
        /*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
-       if(autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
+       if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
                WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
        else
                WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
@@ -241,10 +245,10 @@ void W_RocketMinsta_Attack2()
        float spread = autocvar_g_rm_laser_spread;
        float rndspread = autocvar_g_rm_laser_spread_random;
 
-       float w = self.weapon;
-       self.weapon = WEP_ELECTRO.m_id;
+       Weapon w = PS(self).m_weapon;
+       PS(self).m_weapon = WEP_ELECTRO;
        W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, autocvar_g_rm_laser_damage);
-       self.weapon = w;
+       PS(self).m_weapon = w;
 
        Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -293,10 +297,10 @@ void W_RocketMinsta_Attack3 ()
        float counter = 0;
        float total = 1;
 
-       int w = self.weapon;
-       self.weapon = WEP_ELECTRO.m_id;
+       Weapon w = PS(self).m_weapon;
+       PS(self).m_weapon = WEP_ELECTRO;
        W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(ELECTRO_FIRE2), CH_WEAPON_A, autocvar_g_rm_laser_damage);
-       self.weapon = w;
+       PS(self).m_weapon = w;
 
        Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -337,7 +341,7 @@ void W_RocketMinsta_Attack3 ()
 
                METHOD(Vaporizer, wr_aim, void(entity thiswep))
                {
-                       if(self.WEP_AMMO(VAPORIZER) > 0)
+                       if(self.(thiswep.ammo_field) > 0)
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
                        else
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
@@ -392,8 +396,8 @@ void W_RocketMinsta_Attack3 ()
 
                                        // ugly instagib hack to reuse the fire mode of the laser
                                        makevectors(actor.v_angle);
-                                       int oldwep = actor.weapon; // we can't avoid this hack
-                                       actor.weapon = WEP_BLASTER.m_id;
+                                       Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
+                                       PS(actor).m_weapon = WEP_BLASTER;
                                        W_Blaster_Attack(
                                                actor,
                                                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
@@ -407,7 +411,7 @@ void W_RocketMinsta_Attack3 ()
                                                WEP_CVAR_SEC(vaporizer, delay),
                                                WEP_CVAR_SEC(vaporizer, lifetime)
                                        );
-                                       actor.weapon = oldwep;
+                                       PS(actor).m_weapon = oldwep;
 
                                        // now do normal refire
                                        weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
@@ -416,20 +420,15 @@ void W_RocketMinsta_Attack3 ()
                        else
                                actor.held_down = false;
                }
-               METHOD(Vaporizer, wr_init, void(entity thiswep))
-               {
-                       //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
-                       VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Vaporizer, wr_setup, void(entity thiswep))
                {
-                       self.ammo_field = WEP_AMMO(VAPORIZER);
+                       self.ammo_field = (thiswep.ammo_field);
                        self.vaporizer_lasthit = 0;
                }
                METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       float ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
+                       float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
                        ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
                        return ammo_amount;
                }
@@ -437,14 +436,10 @@ void W_RocketMinsta_Attack3 ()
                {
                        if(!WEP_CVAR_SEC(vaporizer, ammo))
                                return true;
-                       float ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
                        ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
                        return ammo_amount;
                }
-               METHOD(Vaporizer, wr_config, void(entity thiswep))
-               {
-                       VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
                {
                        self.vaporizer_lasthit = 0;
index ded0eede4617043675147fb80c52c1aca7ea1a3b..21e4dc92e517c572730d3bdc9d622baf51180626 100644 (file)
@@ -14,47 +14,51 @@ CLASS(Vortex, Weapon)
 /* wepimg    */ ATTRIB(Vortex, model2, string, "weaponnex");
 /* refname   */ ATTRIB(Vortex, netname, string, "vortex");
 /* wepname   */ ATTRIB(Vortex, m_name, string, _("Vortex"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, chargepool, float, SEC) \
+               P(class, prefix, chargepool_pause_regen, float, SEC) \
+               P(class, prefix, chargepool_regen, float, SEC) \
+               P(class, prefix, charge, float, NONE) \
+               P(class, prefix, charge_animlimit, float, NONE) \
+               P(class, prefix, charge_limit, float, NONE) \
+               P(class, prefix, charge_maxspeed, float, NONE) \
+               P(class, prefix, charge_mindmg, float, NONE) \
+               P(class, prefix, charge_minspeed, float, NONE) \
+               P(class, prefix, charge_rate, float, NONE) \
+               P(class, prefix, charge_rot_pause, float, NONE) \
+               P(class, prefix, charge_rot_rate, float, NONE) \
+               P(class, prefix, charge_shot_multiplier, float, NONE) \
+               P(class, prefix, charge_start, float, NONE) \
+               P(class, prefix, charge_velocity_rate, float, NONE) \
+               P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
+               P(class, prefix, damagefalloff_halflife, float, BOTH) \
+               P(class, prefix, damagefalloff_maxdist, float, BOTH) \
+               P(class, prefix, damagefalloff_mindist, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Vortex, vortex)
+#undef X
+
 ENDCLASS(Vortex)
-REGISTER_WEAPON(VORTEX, NEW(Vortex));
-
-#define VORTEX_SETTINGS(w_cvar,w_prop) VORTEX_SETTINGS_LIST(w_cvar, w_prop, VORTEX, vortex)
-#define VORTEX_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, damagefalloff_mindist) \
-       w_cvar(id, sn, BOTH, damagefalloff_maxdist) \
-       w_cvar(id, sn, BOTH, damagefalloff_halflife) \
-       w_cvar(id, sn, BOTH, damagefalloff_forcehalflife) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, NONE, charge) \
-       w_cvar(id, sn, NONE, charge_mindmg) \
-       w_cvar(id, sn, NONE, charge_shot_multiplier) \
-       w_cvar(id, sn, NONE, charge_animlimit) \
-       w_cvar(id, sn, NONE, charge_limit) \
-       w_cvar(id, sn, NONE, charge_rate) \
-       w_cvar(id, sn, NONE, charge_rot_rate) \
-       w_cvar(id, sn, NONE, charge_rot_pause) \
-       w_cvar(id, sn, NONE, charge_start) \
-       w_cvar(id, sn, NONE, charge_minspeed) \
-       w_cvar(id, sn, NONE, charge_maxspeed) \
-       w_cvar(id, sn, NONE, charge_velocity_rate) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  chargepool) \
-       w_cvar(id, sn, SEC,  chargepool_regen) \
-       w_cvar(id, sn, SEC,  chargepool_pause_regen) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
+
 
 #ifdef SVQC
-VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 
 .float vortex_lasthit;
 #endif
@@ -141,7 +145,7 @@ MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
 {SELFPARAM();
        // WEAPONTODO
        float xyspeed = vlen(vec2(self.velocity));
-       if (self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+       if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
        {
                // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
                xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
@@ -286,11 +290,11 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                                                                }
                                                                                else
                                                                                {
-                                                                                       dt = min(dt, (actor.WEP_AMMO(VORTEX) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+                                                                                       dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
                                                                                        dt = max(0, dt);
                                                                                        if(dt > 0)
                                                                                        {
-                                                                                               actor.WEP_AMMO(VORTEX) = max(WEP_CVAR_SEC(vortex, ammo), actor.WEP_AMMO(VORTEX) - WEP_CVAR_SEC(vortex, ammo) * dt);
+                                                                                               actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
                                                                                        }
                                                                                }
                                                                        }
@@ -316,17 +320,13 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                }
                        }
                }
-               METHOD(Vortex, wr_init, void(entity thiswep))
-               {
-                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Vortex, wr_setup, void(entity thiswep))
                {
                        self.vortex_lasthit = 0;
                }
                METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_PRI(vortex, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
                        ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
                        return ammo_amount;
                }
@@ -335,7 +335,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                        if(WEP_CVAR(vortex, secondary))
                        {
                                // don't allow charging if we don't have enough ammo
-                               float ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_SEC(vortex, ammo);
+                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
                                ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
                                return ammo_amount;
                        }
@@ -344,10 +344,6 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                return false; // zoom is not a fire mode
                        }
                }
-               METHOD(Vortex, wr_config, void(entity thiswep))
-               {
-                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Vortex, wr_resetplayer, void(entity thiswep))
                {
                        if (WEP_CVAR(vortex, charge)) {
@@ -373,7 +369,6 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
 #endif
 #ifdef CSQC
-float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
 
                METHOD(Vortex, wr_impacteffect, void(entity thiswep))
                {
index a63b43e22a58c879e8c378e91a037bd7b13b0bf4..2d1c0b9744f912fe3e5121f9a20276508e31b067 100644 (file)
@@ -25,6 +25,8 @@
        #include "../dpdefs/keycodes.qh"
 #endif
 
+#include "macro.qh"
+
 #include "warpzone/mathlib.qc"
 
 #include "accumulate.qh"
index b071805ef4136e0b06d2c4b4452f139c0e9e8968..a560474174c3ef742ebe2b711d7fe2142643e2ef 100644 (file)
@@ -6,7 +6,7 @@ typedef entity ArrayList;
 .int al_len;
 
 #define AL_NEW(this, n, default, T) \
-       do \
+       MACRO_BEGIN \
        { \
                ArrayList _al = this = new(ArrayList); \
                make_pure(_al); \
@@ -16,17 +16,15 @@ typedef entity ArrayList;
                        const _AL_type__##T() it = default; \
                        AL_set##T(this, i, it); \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define AL_DELETE(this) \
-       do \
+       MACRO_BEGIN \
        { \
                buf_del(this.al_buf); \
                remove(this); \
                this = NULL; \
-       } \
-       while (0)
+       } MACRO_END
 
 #define _AL_type__s() string
 #define AL_gets(this, idx) bufstr_get(this.al_buf, idx)
@@ -41,7 +39,7 @@ typedef entity ArrayList;
 #define AL_sete(this, idx, val) AL_setf(this, idx, etof(val))
 
 #define AL_EACH(this, T, cond, body) \
-       do \
+       MACRO_BEGIN \
        { \
                const noref ArrayList _al = this; \
                for (int i = 0, n = _al.al_len; i < n; ++i) \
@@ -49,7 +47,6 @@ typedef entity ArrayList;
                        const noref _AL_type__##T() it = AL_get##T(_al, i); \
                        if (cond) { body } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #endif
index ecc98b1a3c96c326bf4f9dcfcb13cb47bd7632fc..3fdef9583aa3de66ac8131b045fdb707da35b859 100644 (file)
@@ -202,7 +202,7 @@ void CSQCPlayer_PredictTo(entity this, float endframe, bool apply_error)
 #if 0
        // we don't need this
        // darkplaces makes servercommandframe == 0 in these cases anyway
-       if (getstatf(STAT_HEALTH) <= 0)
+       if (STAT(HEALTH) <= 0)
        {
                csqcplayer_moveframe = clientcommandframe;
                getinputstate(csqcplayer_moveframe-1);
@@ -245,7 +245,7 @@ void CSQCPlayer_SetViewLocation()
 void CSQCPlayer_SetCamera()
 {
        const vector v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
-       const float vh = getstati(STAT_VIEWHEIGHT);
+       const float vh = STAT(VIEWHEIGHT);
        const vector pl_viewofs = PL_VIEW_OFS;
        const vector pl_viewofs_crouch = PL_CROUCH_VIEW_OFS;
        const entity e = csqcplayer;
@@ -323,7 +323,7 @@ void CSQCPlayer_SetCamera()
                if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
                if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
                // note: these two only work in WIP2, but are harmless in WIP1
-               if (getstati(STAT_HEALTH) <= 0) refdefflags |= REFDEFFLAG_DEAD;
+               if (STAT(HEALTH) <= 0) refdefflags |= REFDEFFLAG_DEAD;
                if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
                V_CalcRefdef(view, refdefflags);
        }
index afb38ff95686509917343c9af5af6b43efb8faca..fd8ec83066ec7438fc3c9f8302c8efbcc034d90b 100644 (file)
@@ -7,6 +7,9 @@
 // translation helpers
 string prvm_language;
 
+/**
+ * @deprecated prefer _("translated")
+ */
 string language_filename(string s)
 {
        string fn = prvm_language;
index 3c2b650051eeee205ffa0b164e2234a0f2e890ad..f293aa1493ae11226504c928abd98511dba56573 100644 (file)
@@ -2,39 +2,36 @@
 #define ITER_H
 
 #define FOREACH_ARRAY(arr, start, end, cond, body) \
-       do \
+       MACRO_BEGIN \
        { \
                for (int i = start; i < end; ++i) \
                { \
                        const noref entity it = arr[i]; \
-                       if (cond) { body } \
+                       if (cond) { LAMBDA(body) } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define FOREACH_LIST(list, next, cond, body) \
-       do \
+       MACRO_BEGIN \
        { \
                int i = 0; \
                for (entity it = list##_first; it; (it = it.next, ++i)) \
                { \
-                       if (cond) { body } \
+                       if (cond) { LAMBDA(body) } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define FOREACH_WORD(words, cond, body) \
-       do \
+       MACRO_BEGIN \
        { \
                string _words = words; \
                int i = 0; \
                for (string _it; (_it = car(_words)); (_words = cdr(_words), ++i)) \
                { \
                        const noref string it = _it; \
-                       if (cond) { body } \
+                       if (cond) { LAMBDA(body) } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #if defined(CSQC)
        entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
 .entity _FOREACH_ENTITY_next;
 
 #define FOREACH_ENTITY_UNORDERED(cond, body) \
-       do { \
+       MACRO_BEGIN { \
                int i = 0; \
                for (entity it = findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
                { \
-                       if (cond) { body } \
+                       if (cond) { LAMBDA(body) } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define FOREACH_ENTITY_ORDERED(cond, body) \
-       do { \
+       MACRO_BEGIN { \
                int i = 0; \
                for (entity it = NULL; (it = nextent(it)); ++i) \
                { \
-                       if (cond) { body } \
+                       if (cond) { LAMBDA(body) } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define FOREACH_ENTITY_FLAGS(fld, flags, body) \
-       do { \
+       MACRO_BEGIN { \
                int i = 0; \
                for (entity it = _findchainflags_tofield(fld, flags, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
                { \
-                       body \
+                       LAMBDA(body) \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define FOREACH_ENTITY_CLASS(class, cond, body) \
-       do { \
+       MACRO_BEGIN { \
                int i = 0; \
                for (entity it = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
                { \
-                       if (cond) { body } \
+                       if (cond) { LAMBDA(body) } \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define FOREACH_ENTITY(cond, body) FOREACH_ENTITY_UNORDERED(cond, body)
 
index 3f57fdbc7214872dfad24b4de2fb0d10480185a0..192ffd79a7dc1c672c87b3d3208033bdb31b15b7 100644 (file)
@@ -48,7 +48,7 @@ entity LL_POP(LinkedList this)
 #define LL_CLEAR(...) EVAL(OVERLOAD(LL_CLEAR, __VA_ARGS__))
 #define LL_CLEAR_1(this) LL_CLEAR_2(this, LAMBDA())
 #define LL_CLEAR_2(this, dtor) \
-       do \
+       MACRO_BEGIN \
        { \
                LinkedList _ll = this; \
                assert(_ll); \
@@ -59,22 +59,20 @@ entity LL_POP(LinkedList this)
                        dtor \
                        remove(it); \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define LL_DELETE(...) EVAL(OVERLOAD(LL_DELETE, __VA_ARGS__))
 #define LL_DELETE_1(this) LL_DELETE_2(this, LAMBDA())
 #define LL_DELETE_2(this, dtor) \
-       do \
+       MACRO_BEGIN \
        { \
                LL_CLEAR(this, dtor); \
                remove(this); \
                this = NULL; \
-       } \
-       while (0)
+       } MACRO_END
 
 #define LL_EACH(list, cond, body) \
-       do                                                                  \
+       MACRO_BEGIN                                                         \
        {                                                                   \
                noref int i = 0;                                                \
                for (entity _it = list.ll_head; _it; (_it = _it.ll_next, ++i))  \
@@ -82,7 +80,6 @@ entity LL_POP(LinkedList this)
                        noref entity it = _it.ll_data;                              \
                        if (cond) { body }                                          \
                }                                                               \
-       }                                                                   \
-       while (0)
+       } MACRO_END
 
 #endif
index af2bab0f486a94b95a6795110f87a08c5d24fa1e..a5b46926bcdf4109307f149339b2a166936c80e4 100644 (file)
@@ -1,69 +1,76 @@
 #ifndef LOG_H
 #define LOG_H
 
-#define _printferr(...) error(sprintf(__VA_ARGS__))
-#define _printfbt(...) backtrace(sprintf(__VA_ARGS__))
-#define printf(...) print(sprintf(__VA_ARGS__))
-#define dprintf(...) dprint(sprintf(__VA_ARGS__))
-#define _dprintf2(...) \
-       do \
-       { \
-               if (autocvar_developer > 1) dprintf(__VA_ARGS__); \
-       } \
-       while (0)
-
 #define assert(expr, ...) _assert(LOG_SEVERE, expr, __VA_ARGS__)
-#define ASSERT(expr, ...) _assert(LOG_FATAL, expr, __VA_ARGS__)
+#define assert_once(expr, ...) \
+       MACRO_BEGIN { \
+               static bool __once; \
+               if (!__once) \
+               { \
+                       assert(expr, __VA_ARGS__); \
+                       __once = true; \
+               } \
+       } MACRO_END
+#define demand(expr, ...) _assert(LOG_FATAL, expr, __VA_ARGS__)
 #define _assert(f, expr, then) \
-       do \
+       MACRO_BEGIN \
        { \
                if (!(expr)) \
                { \
                        f("assertion failed: `" #expr "`\n"); \
                        then; \
                } \
-       } \
-       while (0)
+       } MACRO_END
 
 #define ASSERT_LESS(name, var, const) noref int name[(const - var + 1)];
 
-#define _LOG(f, level, s) f("[::"level "] ["__FILE__ ":%s:%.0f] %s", __FUNC__, __LINE__, s)
 
-#define  LOG_FATAL(...) _LOG_FATAL(strcat("", __VA_ARGS__))
+#if defined(MENUQC)
+string(string...) strcat0n = #53;
+#else
+string(string...) strcat0n = #115;
+#endif
+
+#define _LOG(f, level, s) \
+       MACRO_BEGIN { \
+               f(sprintf("^9[::"level "^9] ["__FILE__ "^7:^9%s^7:^9%d] \n^7%s\n", __FUNC__, __LINE__, s)); \
+       } MACRO_END
+
+#define  LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
 #define  LOG_FATALF(...) _LOG_FATAL(sprintf(__VA_ARGS__))
-#define _LOG_FATAL(s) _LOG(_printferr, "FATAL", s)
+#define _LOG_FATAL(s) _LOG(error, "^1FATAL", s)
 
-#define  LOG_SEVERE(...) _LOG_SEVERE(strcat("", __VA_ARGS__))
+#define  LOG_SEVERE(...) _LOG_SEVERE(strcat0n(__VA_ARGS__))
 #define  LOG_SEVEREF(...) _LOG_SEVERE(sprintf(__VA_ARGS__))
-#define _LOG_SEVERE(s) _LOG(_printfbt, "SEVERE", s)
+#define _LOG_SEVERE(s) _LOG(backtrace, "^1SEVERE", s)
 
-#define  LOG_WARNING(...) _LOG_WARNING(strcat("", __VA_ARGS__))
+#define  LOG_WARNING(...) _LOG_WARNING(strcat0n(__VA_ARGS__))
 #define  LOG_WARNINGF(...) _LOG_WARNING(sprintf(__VA_ARGS__))
-#define _LOG_WARNING(s) _LOG(printf, "WARNING", s)
+#define _LOG_WARNING(s) _LOG(print, "^3WARNING", s)
 
-#define  LOG_INFO(...) \
-       do \
-       { \
-               if (autocvar_developer) _LOG_INFO(strcat("", __VA_ARGS__)); \
-               else print(__VA_ARGS__); \
-       } \
-       while (0)
-#define  LOG_INFOF(...) \
-       do \
-       { \
-               if (autocvar_developer) _LOG_INFO(sprintf(__VA_ARGS__)); \
-               else printf(__VA_ARGS__); \
-       } \
-       while (0)
-#define _LOG_INFO(s) _LOG(printf, "INFO", s)
+#define  LOG_INFO(...) _LOG_INFO(strcat0n(__VA_ARGS__))
+#define  LOG_INFOF(...) _LOG_INFO(sprintf(__VA_ARGS__))
+#define _LOG_INFO(s) \
+       MACRO_BEGIN { \
+               string ___s = s; \
+               if (autocvar_developer) \
+                       _LOG(print, "^5INFO", ___s); \
+               else \
+                       print(___s); \
+       } MACRO_END
 
-#define  LOG_TRACE(...) _LOG_TRACE(strcat("", __VA_ARGS__))
+#define  LOG_TRACE(...) _LOG_TRACE(strcat0n(__VA_ARGS__))
 #define  LOG_TRACEF(...) _LOG_TRACE(sprintf(__VA_ARGS__))
-#define _LOG_TRACE(s) _LOG(dprintf, "TRACE", s)
+#define _LOG_TRACE(s) _LOG(dprint, "^6TRACE", s)
 
-#define  LOG_DEBUG(...) _LOG_DEBUG(strcat("", __VA_ARGS__))
+#define  LOG_DEBUG(...) _LOG_DEBUG(strcat0n(__VA_ARGS__))
 #define  LOG_DEBUGF(...) _LOG_DEBUG(sprintf(__VA_ARGS__))
-#define _LOG_DEBUG(s) _LOG(_dprintf2, "DEBUG", s)
+#define _LOG_DEBUG(s) _LOG(dprint2, "^2DEBUG", s)
+
+#define dprint2(msg) \
+       MACRO_BEGIN { \
+               if (autocvar_developer > 1) dprint(msg); \
+       } MACRO_END
 
 // TODO: this sucks, lets find a better way to do backtraces?
 #ifdef SVQC
 noref int autocvar_developer;
 noref bool autocvar_prvm_backtraceforwarnings;
 
+#ifdef SVQC
+#define bt_cvar_set(cvar, value) builtin_cvar_set(cvar, value)
+#else
+#define bt_cvar_set(cvar, value) cvar_set(cvar, value)
+#endif
+
 #define backtrace(msg) \
-       do \
+       MACRO_BEGIN \
        { \
                int dev = autocvar_developer; \
                bool war = autocvar_prvm_backtraceforwarnings; \
-               cvar_set("developer", "1"); \
-               cvar_set("prvm_backtraceforwarnings", "1"); \
-               print("\n--- CUT HERE ---\n", msg, "\n"); \
+               bt_cvar_set("developer", "1"); \
+               bt_cvar_set("prvm_backtraceforwarnings", "1"); \
+               print("\n--- CUT HERE ---\n", msg); \
                _backtrace(); \
                print("\n--- CUT UNTIL HERE ---\n"); \
-               cvar_set("developer", ftos(dev)); \
-               cvar_set("prvm_backtraceforwarnings", ftos(war)); \
-       } \
-       while (0)
+               bt_cvar_set("developer", ftos(dev)); \
+               bt_cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+       } MACRO_END
 
 #endif
diff --git a/qcsrc/lib/macro.qh b/qcsrc/lib/macro.qh
new file mode 100644 (file)
index 0000000..1301ca4
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef MACRO_H
+#define MACRO_H
+
+#if 1
+    void voidfunc() { error("voidfunc"); }
+    #define MACRO_BEGIN if (1) {
+    #define MACRO_END } else voidfunc()
+#else
+    #define MACRO_BEGIN do {
+    #define MACRO_END } while (0)
+#endif
+
+#define _CAT(a, b) a ## b
+#define CAT(a, b) _CAT(a, b)
+
+#endif
index e0ac0a478074b6778ab39b34ecf4e069e8c2d979..cecb15a11eb647a0662412970805d2625d87f0a9 100644 (file)
        // already defined
 #endif
 
-#undef etof
-// avoid bounds checks
-#define etof(e) stof(sprintf("%i", e))
-
 #define GET(name) name##get
 #define GETTER(type, name) type GET(name)() { return name; }
 #define PROPERTY(type, name) type name; GETTER(type, name)
 
 // With block may not contain continue or break
 #define WITH(type, name, value, block) \
-       do \
+       MACRO_BEGIN \
        { \
                type __with_save = (name); \
                name = (value); \
                LAMBDA(block) \
                name = __with_save; \
-       } \
-       while (0)
+       } MACRO_END
 
 #endif
index 1e3d511c6ef00d00c2e18711bc59efeff38b9088..af914fc6482a2d0af6094b24e3f5e67313a7e3d6 100644 (file)
 
 #ifdef CSQC
        #define Net_Accept(classname) \
-               do \
+               MACRO_BEGIN \
                { \
                        if (!this)    this = new(classname); \
-               } \
-               while (0)
+               } MACRO_END
        #define Net_Reject() \
-               do \
+               MACRO_BEGIN \
                { \
                        if (this)     remove(this); \
-               } \
-               while (0)
+               } MACRO_END
        #define NET_HANDLE(id, param) \
                bool Net_Handle_##id(entity this, param)
 #else
        #define WriteHeader(to, id) \
-               do \
+               MACRO_BEGIN \
                { \
                        if (NET_##id##_istemp) WriteByte(to, SVC_TEMPENTITY); \
                        WriteByte(to, NET_##id.m_id); \
-               } \
-               while (0)
+               } MACRO_END
 #endif
 
 #ifdef CSQC
@@ -161,7 +158,19 @@ STATIC_INIT(RegisterTempEntities_renumber)
        #define APPROXPASTTIME_MAX (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
        #define APPROXPASTTIME_RANGE (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
 
+       #if defined(CSQC)
+               #define Read_float() ReadFloat()
+               #define Read_int() ReadInt24_t()
+               #define Read_string() ReadString()
+       #elif defined(SVQC)
+               #define Write_float(to, f) WriteFloat(to, f)
+               #define Write_int(to, f) WriteInt24_t(to, f)
+               #define Write_string(to, f) WriteString(to, f)
+       #endif
+
        #ifdef CSQC
+       #define ReadRegistry(r) r##_from(ReadByte())
+
                entity ReadCSQCEntity()
                {
                        int f = ReadShort();
@@ -191,6 +200,8 @@ STATIC_INIT(RegisterTempEntities_renumber)
                        return v;
                }
 
+               int _ReadSByte;
+               #define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7)))
                #define ReadFloat() ReadCoord()
         vector ReadVector() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); return v; }
                vector ReadVector2D() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = 0; return v; }
@@ -208,6 +219,8 @@ STATIC_INIT(RegisterTempEntities_renumber)
        #else
                const int MSG_ENTITY = 5;
 
+               #define WriteRegistry(r, to, it) WriteByte(to, it.m_id)
+
                void WriteInt24_t(float dst, float val)
                {
                        float v;
@@ -227,8 +240,8 @@ STATIC_INIT(RegisterTempEntities_renumber)
                }
 
         #define WriteFloat(to, f) WriteCoord(to, f)
-               #define WriteVector(to, v) do { WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); } while (0)
-        #define WriteVector2D(to, v) do { WriteFloat(to, v.x); WriteFloat(to, v.y); } while (0)
+               #define WriteVector(to, v) MACRO_BEGIN { WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); } MACRO_END
+        #define WriteVector2D(to, v) MACRO_BEGIN { WriteFloat(to, v.x); WriteFloat(to, v.y); } MACRO_END
 
                // this will use the value:
                //   128
@@ -259,11 +272,10 @@ STATIC_INIT(RegisterTempEntities_renumber)
                        if (msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) \
                                statement msg_entity = varname
                #define WRITESPECTATABLE_MSG_ONE(statement) \
-                       do \
+                       MACRO_BEGIN \
                        { \
                                WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement); \
-                       } \
-                       while (0)
+                       } MACRO_END
                #define WRITESPECTATABLE(msg, statement) \
                        if (msg == MSG_ONE) WRITESPECTATABLE_MSG_ONE(statement); \
                        else \
index d7e9df848865a02039757ba6f92e12d39ecc9b7f..0a945109709a232ecbb689b5d5f3063ca17e4089 100644 (file)
 .vector origin;
 .bool pure_data;
 #define make_pure(e) \
-       do \
+       MACRO_BEGIN \
        { \
                (e).pure_data = true; \
-       } \
-       while (0)
+       } MACRO_END
 #define make_impure(e) \
-       do \
+       MACRO_BEGIN \
        { \
                (e).pure_data = false; \
-       } \
-       while (0)
+       } MACRO_END
 #define is_pure(e) ((e).pure_data)
 
 .string classname;
@@ -158,14 +156,20 @@ STATIC_INIT(RegisterClasses)
                spawn##base##_1(this);              \
        }
 
-#define METHOD(cname, name, prototype)      \
-       class(cname).prototype name;           \
-       prototype cname##_##name;               \
+#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 = cname##_##name; \
+               this.name = METHOD_REFERENCE(cname, name); \
        } \
-       prototype cname##_##name
+       STATIC_METHOD(cname, name, prototype)
 
 #define ATTRIB(cname, name, type, val)      \
        class(cname).type name;                \
index a2284b19448a10428963439464da0b91940a5b73..7f38afe2a7c65553816dd0d61b7662ba805ac544 100644 (file)
@@ -71,21 +71,21 @@ REGISTRY(Registries, BITS(8))
        ACCUMULATE_FUNCTION(Register##registry, Register_##id) \
        REGISTER_INIT(id)
 
-#define REGISTRY_PUSH(registry, fld, it) do { \
+#define REGISTRY_PUSH(registry, fld, it) MACRO_BEGIN { \
        it.fld = registry##_COUNT; \
        _R_SET(_##registry, registry##_COUNT, it); \
        ++registry##_COUNT; \
        if (!registry##_first) registry##_first = it; \
        if (registry##_last)   registry##_last.REGISTRY_NEXT = it; \
        registry##_last = it; \
-} while (0)
+} MACRO_END
 
-#define REGISTRY_RESERVE(registry, fld, id, suffix) do { \
+#define REGISTRY_RESERVE(registry, fld, id, suffix) MACRO_BEGIN { \
        entity e = new(registry_reserved); \
        make_pure(e); \
        e.registered_id = #id "/" #suffix; \
        REGISTRY_PUSH(registry, fld, e); \
-} while (0)
+} MACRO_END
 
 #define REGISTER_INIT(id) [[accumulate]] void Register_##id##_init(entity this)
 #define REGISTER_INIT_POST(id) [[accumulate]] void Register_##id##_init_post(entity this)
index 748bd2b2748efe82a071e4583771adbe338de146..32ae28112f16b98805789a1ee85aa9a8b5705f0e 100644 (file)
@@ -9,17 +9,16 @@ typedef int (int i1, int i2, entity pass) comparefunc_t;
 void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
 {
        #define heapify(_count) \
-               do \
+               MACRO_BEGIN \
                { \
                        for (int start = floor(((_count) - 2) / 2); start >= 0; --start) \
                        { \
                                siftdown(start, (_count) - 1); \
                        } \
-               } \
-               while (0)
+               } MACRO_END
 
        #define siftdown(_start, _end) \
-               do \
+               MACRO_BEGIN \
                { \
                        for (int root = (_start); root * 2 + 1 <= (_end); ) \
                        { \
@@ -29,8 +28,7 @@ void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
                                swap(root, child, pass); \
                                root = child; \
                        } \
-               } \
-               while (0)
+               } MACRO_END
 
        heapify(n);
        int end = n - 1;
index 75f56a23d01fbaafb70140067e53088670b5748a..3f9ca0e948a33c1d02ada7ee9f83f19fdfefb1a6 100644 (file)
@@ -28,6 +28,7 @@ noref bool require_spawnfunc_prefix;
        #define _spawnfunc_check(fld) \
                if (fieldname == #fld) continue;
 
+       noref entity __spawnfunc_expect;
        bool __spawnfunc_unreachable_workaround = true;
 
        #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
@@ -35,7 +36,16 @@ noref bool require_spawnfunc_prefix;
                void __spawnfunc_##id(entity this); \
                [[accumulate]] void spawnfunc_##id(entity this) \
                { \
-                       this = self; \
+                       if (self == __spawnfunc_expect) \
+                       { \
+                               /* engine call */ \
+                               __spawnfunc_expect = NULL; \
+                               this = self; \
+                       } \
+                       else \
+                       { \
+                               assert(this); \
+                       } \
                        if (!this.sourceLocFile) \
                        { \
                                this.sourceLocFile = __FILE__; \
index da796b910f5fd69745323de0b3493e7530ea5843..22aff1b63626d25348f132da602849f70656c5dc 100644 (file)
@@ -26,6 +26,7 @@ typedef vector vectori;
        #define _STAT(id) g_stat_##id
        #define REGISTER_STAT_2(id, T) \
                T _STAT(id); \
+               T CAT(_STAT(id), _prev); \
                REGISTER(Stats, STAT_##id, m_id, new(stat)) \
                { \
                        make_pure(this); \
@@ -36,7 +37,9 @@ typedef vector vectori;
                } \
                [[accumulate]] void stats_get() \
                { \
-                       _STAT(id) = getstat_##T(STAT_##id.m_id); \
+                       T it = getstat_##T(STAT_##id.m_id); \
+                       if (it != CAT(_STAT(id), _prev)) \
+                               CAT(_STAT(id), _prev) = _STAT(id) = it; \
                }
        #define REGISTER_STAT_3(x, T, expr) REGISTER_STAT(x, T)
 #elif defined(SVQC)
@@ -47,16 +50,16 @@ typedef vector vectori;
        #define addstat_int(id, fld) addstat(id, AS_INT, fld)
        #define addstat_bool(id, fld) addstat(id, AS_INT, fld)
        #define addstat_float(id, fld) addstat(id, AS_FLOAT, fld)
-       #define addstat_vector(id, fld) do { \
+       #define addstat_vector(id, fld) MACRO_BEGIN { \
                addstat_float(id + 0, fld##_x); \
                addstat_float(id + 1, fld##_y); \
                addstat_float(id + 2, fld##_z); \
-       } while (0)
-       #define addstat_vectori(id, fld) do { \
+       } MACRO_END
+       #define addstat_vectori(id, fld) MACRO_BEGIN { \
                addstat_int(id + 0, fld##_x); \
                addstat_int(id + 1, fld##_y); \
                addstat_int(id + 2, fld##_z); \
-       } while (0)
+       } MACRO_END
        const int AS_STRING = 1;
        const int AS_INT = 2;
        const int AS_FLOAT = 8;
index 6f61155800d5af390011bd645b005655b61e14ae..ef1c00c62c3c5c0d2714327f8d649b16120fc5ef 100644 (file)
@@ -130,6 +130,13 @@ string cdr(string s)
        return substring(s, o + 1, strlen(s) - (o + 1));
 }
 
+string cons(string a, string b)
+{
+       if (a == "") return b;
+       if (b == "") return a;
+       return strcat(a, " ", b);
+}
+
 string substring_range(string s, float b, float e)
 {
        return substring(s, b, e - b);
index 6cddb12e50b1257ac5fe60a56ff3c298889420bc..2890fcaf92f7012e0d8352eeecef69589a026de4 100644 (file)
@@ -2,11 +2,10 @@
 #define TEST_H
 
 #define TEST_Check(cond) \
-       do \
+       MACRO_BEGIN \
        { \
                if (!(cond)) TEST_Fail( #cond); \
-       } \
-       while (0)
+       } MACRO_END
 
 void TEST_OK();
 void TEST_Fail(string cond);
index f8fa38280dd709742bf96fc99c07cfb2be31a5b4..b218b660a534f1468bc84f8e7a51c9f89aea7ed0 100644 (file)
@@ -3,6 +3,8 @@
 
 #define reinterpret_cast(T, it) _unsafe_cast_##T(0, it)
 #define X(T) T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); }
+X(bool)
+X(int)
 X(float)
 X(entity)
 X(string)
@@ -10,6 +12,17 @@ typedef float(...) rawfunc;
 X(rawfunc)
 #undef X
 
-#define strid(s) etof(reinterpret_cast(entity, s))
+#define strid(s) ITOF(reinterpret_cast(int, s))
+
+.int _unsafe_fld1, _unsafe_fld2;
+int INTEGER_ONE;
+
+#define FTOI(f) ((f) * INTEGER_ONE)
+#define ITOF(i) ((i) / INTEGER_ONE)
+
+STATIC_INIT(INTEGER_ONE)
+{
+    INTEGER_ONE = reinterpret_cast(int, _unsafe_fld2) - reinterpret_cast(int, _unsafe_fld1);
+}
 
 #endif
index ec8257e3a672ce72d5007689208111fe2d2ca44d..c5c4d655585d1bf6d8a0b0b3d9dd0b2b8ffaebef 100644 (file)
@@ -71,12 +71,12 @@ float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) { ret
 #define YAW(v) ((v).y)
 #define ROLL(v) ((v).z)
 
-#define MAKEVECTORS(f, angles, forward, right, up) do { \
+#define MAKEVECTORS(f, angles, forward, right, up) MACRO_BEGIN { \
        f(angles); \
        forward = v_forward; \
        right = v_right; \
        up = v_up; \
-} while (0)
+} MACRO_END
 
 noref vector _vec2;
 #define vec2(v) (_vec2 = (v), _vec2.z = 0, _vec2)
index bb12e29c8162efc889bbf84f1c5109c8113e01cf..74bcae3042dfd886529aff28737462144e193272 100644 (file)
@@ -10,8 +10,8 @@ vector draw_scale;
 float draw_alpha;
 
 void draw_reset(float cw, float ch, float ox, float oy);
-#define draw_beginBoldFont() do { drawfont = FONT_USER + 3; } while (0)
-#define draw_endBoldFont() do { drawfont = FONT_USER + 0; } while (0)
+#define draw_beginBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 3; } MACRO_END
+#define draw_endBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 0; } MACRO_END
 void draw_setMousePointer(string pic, vector theSize, vector theOffset);
 void draw_drawMousePointer(vector where);
 
index 5e98da110504c06e7a4dc433e03b4edd6e34db37..22ab7047c87519455f23b82836ae550f8e0427b8 100644 (file)
@@ -152,18 +152,18 @@ void m_init_delayed()
        if (cvar_string("menu_skin") != "")
        {
                draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
-               fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
+               fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
        }
        if (fh < 0 && cvar_defstring("menu_skin") != "")
        {
                cvar_set("menu_skin", cvar_defstring("menu_skin"));
                draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
-               fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
+               fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
        }
        if (fh < 0)
        {
                draw_currentSkin = "gfx/menu/default";
-               fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
+               fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
        }
        if (fh < 0) error("cannot load any menu skin\n");
        draw_currentSkin = strzone(draw_currentSkin);
diff --git a/qcsrc/menu/progs.src b/qcsrc/menu/progs.src
deleted file mode 100644 (file)
index 1eb2b72..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../../menu.dat
-progs.inc
index 64fac23d27519c47ba7c861070c273b19ab3f86d..e3a8dec9d9800d7b3fc447f33f162f1c1617c1bf 100644 (file)
@@ -1,5 +1,372 @@
 #ifndef CREDITS_H
 #define CREDITS_H
+
+#define CREDITS(TITLE, FUNCTION, PERSON, PERSON_, NL) \
+       TITLE(_("Core Team")) \
+               PERSON(Rudolf "divVerent" Polzer) \
+               PERSON(Ant "Antibody" Zucaro) \
+               PERSON(Marvin "Mirio" Beck) \
+               PERSON(Merlijn Hofstra) \
+               PERSON(Peter "Morphed" Pielak) \
+               PERSON(Ruszkai "CuBe0wL" Ákos) \
+               PERSON(Samual "Ares" Lenks) \
+               PERSON(TimePath) \
+               PERSON(Tyler "-z-" Mulligan) \
+               PERSON(Zac "Mario" Jardine) \
+       NL() \
+       TITLE(_("Extended Team")) \
+               PERSON(Antonio "terencehill" Piu) \
+               PERSON(Archer) \
+               PERSON(BuddyFriendGuy) \
+               PERSON(Debugger) \
+               PERSON(GATTS) \
+               PERSON(Halogene) \
+               PERSON(IDWMaster) \
+               PERSON(Jan "zykure" Behrens) \
+               PERSON(JH0nny) \
+               PERSON(Luigi) \
+               PERSON(Łukasz "kuniu the frogg" Polek) \
+               PERSON(Matthias "matthiaskrgr" Krüger) \
+               PERSON(Mattia "Melanosuchus" Basaglia) \
+               PERSON(MrBougo) \
+               PERSON(Nick "bitbomb" Lucca) \
+               PERSON(nilyt/nyov) \
+               PERSON(Nitroxis) \
+               PERSON(packer) \
+               PERSON(Pearce "theShadow" Michal) \
+               PERSON(Rasmus "FruitieX" Eskola) \
+               PERSON(s1lence) \
+               PERSON(Severin "sev" Meyer) \
+               PERSON(Soelen) \
+               PERSON(Sydes) \
+               PERSON(unfa) \
+       NL() \
+       NL() \
+       FUNCTION(_("Website")) \
+               PERSON(Ant "Antibody" Zucaro (web)) \
+               PERSON(Merlijn Hofstra) \
+               PERSON(Tyler "-z-" Mulligan (web / game)) \
+       NL() \
+       FUNCTION(_("Stats")) \
+               PERSON(Ant "Antibody" Zucaro) \
+               PERSON(Jan "zykure" Behrens) \
+       NL() \
+       FUNCTION(_("Art")) \
+               PERSON(Severin "sev" Meyer) \
+               PERSON(Sahil "DiaboliK" Singhal) \
+               PERSON(Peter "Morphed" Pielak) \
+               PERSON(Sam "LJFHutch" Hutchinson) \
+               PERSON(Pearce "theShadow" Michal) \
+       NL() \
+       FUNCTION(_("Animation")) \
+               PERSON(Sahil "DiaboliK" Singhal) \
+               PERSON(nifrek) \
+       NL() \
+       FUNCTION(_("Level Design")) \
+               PERSON(Amadeusz "amade/proraide" Sławiński) \
+               PERSON(Ben "MooKow" Banker) \
+               PERSON(Calinou) \
+               PERSON(Cortez) \
+               PERSON(Cuinn "Cuinnton" Herrick) \
+               PERSON(Debugger) \
+               PERSON(Jakob "tZork" Markström Gröhn) \
+               PERSON(Konrad "Justin" Slawinski) \
+               PERSON(Maddin) \
+               PERSON(L0) \
+               PERSON(Łukasz "kuniu the frogg" Polek) \
+               PERSON(Maik "SavageX" Merten) \
+               PERSON(Marvin "Mirio" Beck) \
+               PERSON(MintOX) \
+               PERSON(packer) \
+               PERSON(Pearce "theShadow" Michal) \
+               PERSON(Rasmus "FruitieX" Eskola) \
+               PERSON(Ruszkai "CuBe0wL" Ákos) \
+               PERSON(Severin "sev" Meyer) \
+               PERSON(ShadoW) \
+       NL() \
+       FUNCTION(_("Music / Sound FX")) \
+               PERSON(AquaNova (Archer)) \
+               PERSON(blkrbt) \
+               PERSON(chooksta) \
+               PERSON(Independent.nu) \
+               PERSON([master]mind) \
+               PERSON(Merlijn Hofstra) \
+               PERSON(Mick Rippon) \
+               PERSON(Nick "bitbomb" Lucca) \
+               PERSON(remaxim) \
+               PERSON(Saulo "mand1nga" Gil) \
+               PERSON({SC0RP} - Ian "ID" Dorrell) \
+               PERSON(Stephan) \
+               PERSON(unfa) \
+       NL() \
+       FUNCTION(_("Game Code")) \
+               PERSON(Samual "Ares" Lenks) \
+               PERSON(Rudolf "divVerent" Polzer) \
+               PERSON(Jakob "tZork" Markström Gröhn) \
+               PERSON(Rasmus "FruitieX" Eskola) \
+               PERSON(TimePath) \
+               PERSON(Zac "Mario" Jardine) \
+       NL() \
+       FUNCTION(_("Marketing / PR")) \
+               PERSON(Tyler "-z-" Mulligan) \
+               PERSON(Ruszkai "CuBe0wL" Ákos) \
+               PERSON(Samual "Ares" Lenks) \
+               PERSON(Saulo "mand1nga" Gil) \
+       NL() \
+       FUNCTION(_("Legal")) \
+               PERSON(Rudolf "divVerent" Polzer) \
+               PERSON(Merlijn Hofstra) \
+       NL() \
+       NL() \
+       TITLE(_("Game Engine")) \
+               FUNCTION(_("DarkPlaces")) \
+                       PERSON(Forest "LordHavoc" Hale) \
+               NL() \
+               FUNCTION(_("Engine Additions")) \
+                       PERSON(Rudolf "divVerent" Polzer) \
+                       PERSON(Samual "Ares" Lenks) \
+               NL() \
+       NL() \
+       TITLE(_("Compiler")) \
+               FUNCTION(_("GMQCC")) \
+                       PERSON(Wolfgang "Blub\0" Bumiller) \
+                       PERSON(Dale "graphitemaster" Weiler) \
+               NL() \
+       NL() \
+       TITLE(_("Other Active Contributors")) \
+               PERSON(Erik "Ablu" Schilling) \
+               PERSON(Mircea "Taoki" Kitsune) \
+               PERSON(Penguinum) \
+       NL() \
+       NL() \
+       TITLE(_("Translators")) \
+               NL() \
+               FUNCTION(_("Asturian")) \
+                       PERSON(Llumex03) \
+                       PERSON(Tornes "Tornes.Llume" Ḷḷume) \
+                       PERSON(Ximielga) \
+               NL() \
+               FUNCTION(_("Belarusian")) \
+                       PERSON(Mihail "meequz" Varantsou) \
+               NL() \
+               FUNCTION(_("Bulgarian")) \
+                       PERSON(lokster) \
+                       PERSON(set_killer) \
+               NL() \
+               FUNCTION(_("Chinese (China)")) \
+                       PERSON(Antonidas) \
+                       PERSON(kalawore) \
+                       PERSON(sapphireliu) \
+               NL() \
+               FUNCTION(_("Czech")) \
+                       PERSON(shogun assassin/woky) \
+                       PERSON(Superovoce) \
+                       PERSON(Tomáš "CZHeron" Volavka) \
+               NL() \
+               FUNCTION(_("Dutch")) \
+                       PERSON(Alexander "freefang" van Dam) \
+                       PERSON(PinkRobot) \
+                       PERSON(vegiburger) \
+               NL() \
+               FUNCTION(_("English (Australia)")) \
+                       PERSON(Laurene "sunflowers" Albrand) \
+                       PERSON(Zac "Mario" Jardine) \
+               NL() \
+               FUNCTION(_("Finnish")) \
+                       PERSON(Henry "Exitium" Sanmark) \
+                       PERSON(Rasmus "FruitieX" Eskola) \
+               NL() \
+               FUNCTION(_("French")) \
+                       PERSON(Calinou) \
+                       PERSON(Maxime "Taximus" Paradis) \
+                       PERSON(RedGuff) \
+                       PERSON(Yannick "SpiKe" Le Guen) \
+               NL() \
+               FUNCTION(_("German")) \
+                       PERSON(Brot) \
+                       PERSON(cvcxc) \
+                       PERSON(Erik "Ablu" Schilling) \
+                       PERSON(Jope "Sless" Withers) \
+                       PERSON(Marvin "Mirio" Beck) \
+                       PERSON(Rudolf "divVerent" Polzer) \
+                       PERSON(Yepoleb) \
+               NL() \
+               FUNCTION(_("Greek")) \
+                       PERSON_("Γιάννης \"Evropi\" Ανθυμίδης") \
+                       PERSON(Konstantinos "LDinos" Mihalenas) \
+                       PERSON(Savoritias) \
+                       PERSON(Vindex) \
+               NL() \
+               FUNCTION(_("Hungarian")) \
+                       PERSON(Ruszkai "CuBe0wL" Ákos) \
+                       PERSON(xaN1C4n3) \
+               NL() \
+               FUNCTION(_("Italian")) \
+                       PERSON(Antonio "terencehill" Piu) \
+                       PERSON(Felice "MaidenBeast" Sallustio) \
+                       PERSON(stdi) \
+                       PERSON(XCostaX) \
+               NL() \
+               FUNCTION(_("Polish")) \
+                       PERSON(4m) \
+                       PERSON(Alex "tiprogrammierer.alex" Progger) \
+                       PERSON(Amadeusz "amade/proraide" Sławiński) \
+               NL() \
+               FUNCTION(_("Portuguese")) \
+                       PERSON(Ricardo Manuel "Hellgardia" da Cruz Coelho da Silva) \
+                       PERSON(xXxCHAOTICxXx) \
+               NL() \
+               FUNCTION(_("Romanian")) \
+                       PERSON(Adrian-Ciprian "adrian.tinjala" Tînjală) \
+                       PERSON(BusterDBK) \
+                       PERSON(Mircea "Taoki" Kitsune) \
+                       PERSON(Tudor "TropiKo" Ionel) \
+               NL() \
+               FUNCTION(_("Russian")) \
+                       PERSON(Alex "alextalker7" Talker) \
+                       PERSON(Alexandr "zrg") \
+                       PERSON(Andrei "adem4ik" Stepanov) \
+                       PERSON(gravicappa) \
+                       PERSON(Hot Dog) \
+                       PERSON(Lord Canistra) \
+                       PERSON(Nikoli) \
+                       PERSON(Sergej "Clearness High" Lutsyk) \
+               NL() \
+               FUNCTION(_("Serbian")) \
+                       PERSON_("Саша \"salepetronije\" Петровић") \
+                       PERSON(Pendulla) \
+                       PERSON(Rafael "Ristovski") \
+               NL() \
+               FUNCTION(_("Spanish")) \
+                       PERSON_("0000simon") \
+                       PERSON(Alan "aagp" Garcia) \
+                       PERSON(Ari_tent) \
+                       PERSON(brunodeleo) \
+                       PERSON(Kammy) \
+                       PERSON(roader_gentoo) \
+                       PERSON(Rodrigo Mouton Laudin) \
+                       PERSON(SouL) \
+               NL() \
+               FUNCTION(_("Swedish")) \
+                       PERSON(Karl-Oskar "machine" Rikås) \
+                       PERSON(marcus256) \
+               NL() \
+               FUNCTION(_("Ukrainian")) \
+                       PERSON(Oleh "BlaXpirit" Prypin) \
+                       PERSON(Vasyl "Harmata" Melnyk) \
+                       PERSON(Yuriy "herrniemand" Ackermann) \
+               NL() \
+       NL() \
+       TITLE(_("Past Contributors")) \
+               PERSON(Akari) \
+               PERSON(Alexander "naryl" Suhoverhov) \
+               PERSON(Alexander "motorsep" Zubov) \
+               PERSON(Amos "torus" Dudley) \
+               PERSON(Andreas "Black" Kirsch) \
+               PERSON(Attila "WW3" Houtkooper) \
+               PERSON(BigMac) \
+               PERSON(Braden "meoblast001" Walters) \
+               PERSON(Brain Younds) \
+               PERSON(Chris "amethyst7" Matz) \
+               PERSON(Christian Ice) \
+               PERSON(Clinton "Kaziganthe" Freeman) \
+               PERSON(Dan "Digger" Korostelev) \
+               PERSON(Dan "Wazat" Hale) \
+               PERSON(Dokujisan) \
+               PERSON(Donkey) \
+               PERSON(dstrek) \
+               PERSON(Dustin Geeraert) \
+               PERSON(Edgenetwork) \
+               PERSON(Edward "Ed" Holness) \
+               PERSON(Eric "Munyul Verminard" Sambach) \
+               PERSON(Fabien "H. Reaper" Tschirhart) \
+               PERSON(Florian Paul "lda17h" Schmidt) \
+               PERSON(FrikaC) \
+               PERSON(Garth "Zombie" Hendy) \
+               PERSON(Gerd "Elysis" Raudenbusch) \
+               PERSON(Gottfried "Toddd" Hofmann) \
+               PERSON(Henning "Tymo" Janssen) \
+               PERSON(Innovati) \
+               PERSON(Jitspoe) \
+               PERSON(Jody Gallagher) \
+               PERSON(Jope "Sless" Withers) \
+               PERSON(Juergen "LowDragon" Timm) \
+               PERSON(KadaverJack) \
+               PERSON(Kevin "Tyrann" Shanahan) \
+               PERSON(Kristian "morfar" Johansson) \
+               PERSON(Kurt Dereli) \
+               PERSON(lcatlnx) \
+               PERSON(Lee David Ash) \
+               PERSON(Lee Vermeulen) \
+               PERSON(leileilol) \
+               PERSON(magorian) \
+               PERSON(Marius "GreEn`mArine" Shekow) \
+               PERSON(Marko "Urre" Permanto) \
+               PERSON(Mathieu "Elric" Olivier) \
+               PERSON(Mattrew "Tronyn" Rye) \
+               PERSON(MauveBib) \
+               PERSON(Mephisto) \
+               PERSON(michaelb) \
+               PERSON(Michael "Tenshihan" Quinn) \
+               PERSON(Mepper) \
+               PERSON(Munyul) \
+               PERSON(Netzwerg) \
+               PERSON(NoelCower) \
+               PERSON(Parapraxis) \
+               PERSON(parasti) \
+               PERSON(Paul "Strahlemann" Evers) \
+               PERSON(Paul Scott) \
+               PERSON(Petithomme) \
+               PERSON(PlasmaSheep) \
+               PERSON(Przemysław "atheros" Grzywacz) \
+               PERSON(Q1 Retexturing Project) \
+               PERSON(Qantourisc) \
+               PERSON(Oleh "BlaXpirit" Prypin) \
+               PERSON(Rick "Rat" Kelley) \
+               PERSON(Robert "ai" Kuroto) \
+               PERSON(Ronan) \
+               PERSON(Sajt) \
+               PERSON(Saulo "mand1nga" Gil) \
+               PERSON(Shaggy) \
+               PERSON(Shank) \
+               PERSON(Simon O’Callaghan) \
+               PERSON(SomeGuy) \
+               PERSON(SoulKeeper_p) \
+               PERSON(Spike) \
+               PERSON(Spirit) \
+               PERSON(Stephan "esteel" Stahl) \
+               PERSON(Steve Vermeulen) \
+               PERSON(Supajoe) \
+               PERSON(Tei) \
+               PERSON(The player with the unnecessarily long name) \
+               PERSON(Tomaz) \
+               PERSON(Ulrich Galbraith) \
+               PERSON(Vortex) \
+               PERSON(William Libert) \
+               PERSON(William "Willis" Weilep) \
+               PERSON(Yves "EviLair" Allaire) \
+               PERSON(Zenex) \
+               /**/
+
+int credits_get()
+{
+       int n = buf_create();
+       #define CREDITS_TITLE(t) bufstr_add(n, strcat("**", t), 0);
+       #define CREDITS_FUNCTION(f) bufstr_add(n, strcat("*", f), 0);
+       #define CREDITS_PERSON(p) bufstr_add(n, p, 0);
+       #define _CREDITS_PERSON(p) CREDITS_PERSON(#p)
+       #define CREDITS_NL() bufstr_add(n, "", 0);
+    CREDITS(CREDITS_TITLE, CREDITS_FUNCTION, _CREDITS_PERSON, CREDITS_PERSON, CREDITS_NL)
+       #undef CREDITS_TITLE
+       #undef CREDITS_FUNCTION
+       #undef CREDITS_PERSON
+       #undef _CREDITS_PERSON
+       #undef CREDITS_NL
+       return n;
+}
+
+#undef CREDITS
+
 #include "listbox.qc"
 CLASS(XonoticCreditsList, XonoticListBox)
        METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity));
@@ -32,8 +399,7 @@ entity makeXonoticCreditsList()
 void XonoticCreditsList_configureXonoticCreditsList(entity me)
 {
        me.configureXonoticListBox(me);
-       // load the file
-       me.bufferIndex = buf_load(language_filename("xonotic-credits.txt"));
+    me.bufferIndex = credits_get();
        me.nItems = buf_getsize(me.bufferIndex);
 }
 void XonoticCreditsList_destroy(entity me)
index 039cb5a15fbce6aa198a8f010ddaa5ae4d41d815..9ce18c6b0a97357bc97e28b7fcefdb897d605ed5 100644 (file)
@@ -50,13 +50,13 @@ void Xonotic_KeyBinds_Read()
 {
        Xonotic_KeyBinds_Count = 0;
 
-       #define KEYBIND_DEF(func, desc) do { \
+       #define KEYBIND_DEF(func, desc) MACRO_BEGIN { \
                if((Xonotic_KeyBinds_Count < MAX_KEYBINDS)) { \
                        Xonotic_KeyBinds_Functions[Xonotic_KeyBinds_Count] = strzone(func); \
                        Xonotic_KeyBinds_Descriptions[Xonotic_KeyBinds_Count] = strzone(desc); \
                        ++Xonotic_KeyBinds_Count; \
                } \
-       } while(0)
+       } MACRO_END
 
        KEYBIND_DEF(""                                      , _("Moving"));
        KEYBIND_DEF("+forward"                              , _("forward"));
index c849254e8b85c66a925a5f2d8bcdc28b1d285bbb..5c4195351bdcb5442e242ba729688e15f80b0623 100644 (file)
@@ -108,7 +108,7 @@ void XonoticSkinList_getSkins(entity me)
                        bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, "nopreview_menuskin");
                else
                        bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview"));
-               fh = fopen(language_filename(s), FILE_READ);
+               fh = fopen(s, FILE_READ);
                if(fh < 0)
                {
                        LOG_INFO("Warning: can't open skinvalues.txt file\n");
index cbda56873aaa9091b3774b298fc6641954f46b0b..f277af62ab7a6953f7d2a7c96f2e914c8aa9d093 100644 (file)
@@ -20,7 +20,7 @@ const string STR_OBSERVER = "observer";
 #define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
 #define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
 
-#define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
+#define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (etof(v) <= maxclients); )
 #define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if (IS_CLIENT(v))
 #define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if (IS_REAL_CLIENT(v))
 
@@ -29,6 +29,16 @@ const string STR_OBSERVER = "observer";
 #define FOR_EACH_OBSERVER(v) FOR_EACH_CLIENT(v) if (IS_OBSERVER(v))
 #define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if (IS_PLAYER(v))
 
+#define FOREACH_CLIENT(cond, body) \
+       MACRO_BEGIN { \
+               int i = 0; \
+               for (entity it = NULL; (it = nextent(it)) && (etof(it) <= maxclients); ++i) \
+               { \
+                       if (!IS_CLIENT(it)) continue; \
+                       if (cond) { LAMBDA(body) } \
+               } \
+       } MACRO_END
+
 #define FOR_EACH_MONSTER(v) for (v = world; (v = findflags(v, flags, FL_MONSTER)) != world; )
 
 #include "../common/effects/all.qh"
index e4220f5d0c7f174d39befa55a55bd9f3710cc8b9..9b281a1f7ff475688282caf01f0eba3e2cbf3fc6 100644 (file)
@@ -64,7 +64,6 @@ bool autocvar_bot_debug_goalstack;
 bool autocvar_bot_wander_enable;
 int autocvar_captureleadlimit_override;
 #define autocvar_capturelimit_override cvar("capturelimit_override")
-#define autocvar_developer cvar("developer")
 float autocvar_ekg;
 #define autocvar_fraglimit cvar("fraglimit")
 #define autocvar_fraglimit_override cvar("fraglimit_override")
index 9541540298437b2a7526c326e8d5906e36b47030..d8d7d1b92b346f5864f0f43ade890387551dcc25 100644 (file)
@@ -338,12 +338,12 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        shotspeedupward *= W_WeaponSpeedFactor();
        if (!shotspeed)
        {
-               LOG_TRACE("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " shotspeed is zero!\n");
+               LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " shotspeed is zero!\n");
                shotspeed = 1000000;
        }
        if (!maxshottime)
        {
-               LOG_TRACE("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " maxshottime is zero!\n");
+               LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " maxshottime is zero!\n");
                maxshottime = 1;
        }
        makevectors(self.v_angle);
index 9a74d38415aa6b545fcb646b8f1ed25da238be0b..9f91db1f86329e780d460b65e8802a420e424a97 100644 (file)
@@ -104,7 +104,7 @@ void havocbot_ai()
 
                if(self.weapons)
                {
-                       Weapon w = Weapons_from(self.weapon);
+                       Weapon w = PS(self).m_weapon;
                        w.wr_aim(w);
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
                        {
@@ -114,7 +114,7 @@ void havocbot_ai()
                        else
                        {
                                if(self.BUTTON_ATCK||self.BUTTON_ATCK2)
-                                       self.lastfiredweapon = self.weapon;
+                                       self.lastfiredweapon = PS(self).m_weapon.m_id;
                        }
                }
                else
@@ -175,7 +175,7 @@ void havocbot_ai()
                        {
                                entity e = Weapons_from(i);
                                if ((self.weapons & (e.m_wepset)) && (e.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[i] < e.reloading_ammo))
-                                       self.switchweapon = i;
+                                       PS(self).m_switchweapon = Weapons_from(i);
                        }
                }
        }
@@ -603,7 +603,7 @@ void havocbot_movetogoal()
                else if(self.health>WEP_CVAR(devastator, damage)*0.5)
                {
                        if(self.velocity.z < 0)
-                       if(client_hasweapon(self, WEP_DEVASTATOR.m_id, true, false))
+                       if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
                        {
                                self.movement_x = maxspeed;
 
@@ -617,7 +617,7 @@ void havocbot_movetogoal()
                                        return;
                                }
 
-                               self.switchweapon = WEP_DEVASTATOR.m_id;
+                               PS(self).m_switchweapon = WEP_DEVASTATOR;
                                self.v_angle_x = 90;
                                self.BUTTON_ATCK = true;
                                self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
@@ -1014,7 +1014,7 @@ void havocbot_chooseweapon()
        // ;)
        if(g_weaponarena_weapons == WEPSET(TUBA))
        {
-               self.switchweapon = WEP_TUBA.m_id;
+               PS(self).m_switchweapon = WEP_TUBA;
                return;
        }
 
@@ -1022,12 +1022,12 @@ void havocbot_chooseweapon()
        if(self.enemy==world)
        {
                // If no weapon was chosen get the first available weapon
-               if(self.weapon==0)
+               if(PS(self).m_weapon==WEP_Null)
                for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER.m_id)
                {
-                       if(client_hasweapon(self, i, true, false))
+                       if(client_hasweapon(self, Weapons_from(i), true, false))
                        {
-                               self.switchweapon = i;
+                               PS(self).m_switchweapon = Weapons_from(i);
                                return;
                        }
                }
@@ -1055,7 +1055,7 @@ void havocbot_chooseweapon()
        combo = false;
 
        if(autocvar_bot_ai_weapon_combo)
-       if(self.weapon == self.lastfiredweapon)
+       if(PS(self).m_weapon.m_id == self.lastfiredweapon)
        if(af > combo_time)
        {
                combo = true;
@@ -1071,11 +1071,11 @@ void havocbot_chooseweapon()
                if ( distance > bot_distance_far ) {
                        for(i=0; i < Weapons_COUNT && bot_weapons_far[i] != -1 ; ++i){
                                w = bot_weapons_far[i];
-                               if ( client_hasweapon(self, w, true, false) )
+                               if ( client_hasweapon(self, Weapons_from(w), true, false) )
                                {
-                                       if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
+                                       if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
                                                continue;
-                                       self.switchweapon = w;
+                                       PS(self).m_switchweapon = Weapons_from(w);
                                        return;
                                }
                        }
@@ -1085,11 +1085,11 @@ void havocbot_chooseweapon()
                if ( distance > bot_distance_close) {
                        for(i=0; i < Weapons_COUNT && bot_weapons_mid[i] != -1 ; ++i){
                                w = bot_weapons_mid[i];
-                               if ( client_hasweapon(self, w, true, false) )
+                               if ( client_hasweapon(self, Weapons_from(w), true, false) )
                                {
-                                       if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
+                                       if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
                                                continue;
-                                       self.switchweapon = w;
+                                       PS(self).m_switchweapon = Weapons_from(w);
                                        return;
                                }
                        }
@@ -1098,11 +1098,11 @@ void havocbot_chooseweapon()
                // Choose weapons for close distance
                for(i=0; i < Weapons_COUNT && bot_weapons_close[i] != -1 ; ++i){
                        w = bot_weapons_close[i];
-                       if ( client_hasweapon(self, w, true, false) )
+                       if ( client_hasweapon(self, Weapons_from(w), true, false) )
                        {
-                               if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
+                               if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
                                        continue;
-                               self.switchweapon = w;
+                               PS(self).m_switchweapon = Weapons_from(w);
                                return;
                        }
                }
index b0348125e6cbb9a0ee05d573f045cd0e93bbaad4..4f14d2f3bb40cf875812664a9738108e9720117a 100644 (file)
@@ -570,15 +570,13 @@ float bot_cmd_turn()
 
 float bot_cmd_select_weapon()
 {SELFPARAM();
-       float id;
-
-       id = bot_cmd.bot_cmd_parm_float;
+       float id = bot_cmd.bot_cmd_parm_float;
 
        if(id < WEP_FIRST || id > WEP_LAST)
                return CMD_STATUS_ERROR;
 
-       if(client_hasweapon(self, id, true, false))
-               self.switchweapon = id;
+       if(client_hasweapon(self, Weapons_from(id), true, false))
+               PS(self).m_switchweapon = Weapons_from(id);
        else
                return CMD_STATUS_ERROR;
 
index fe767b8c93384fa006a53b14321fdb86dbbca15d..f85c8e1cdc7e494f34fce3dba5cbddf79265f47d 100644 (file)
@@ -451,11 +451,7 @@ float waypoint_load_links()
 
        fclose(file);
 
-       LOG_TRACE("loaded ");
-       LOG_TRACE(ftos(c));
-       LOG_TRACE(" waypoint links from maps/");
-       LOG_TRACE(mapname);
-       LOG_TRACE(".waypoints.cache\n");
+       LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.cache\n");
 
        botframe_cachedwaypointlinks = true;
        return true;
@@ -475,9 +471,7 @@ void waypoint_load_links_hardwired()
 
        if (file < 0)
        {
-               LOG_TRACE("waypoint links load from ");
-               LOG_TRACE(filename);
-               LOG_TRACE(" failed\n");
+               LOG_TRACE("waypoint links load from ", filename, " failed\n");
                return;
        }
 
@@ -548,11 +542,7 @@ void waypoint_load_links_hardwired()
 
        fclose(file);
 
-       LOG_TRACE("loaded ");
-       LOG_TRACE(ftos(c));
-       LOG_TRACE(" waypoint links from maps/");
-       LOG_TRACE(mapname);
-       LOG_TRACE(".waypoints.hardwired\n");
+       LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.hardwired\n");
 }
 
 entity waypoint_get_link(entity w, float i)
@@ -712,19 +702,11 @@ float waypoint_loadall()
                                cwb = cwb + 1;
                }
                fclose(file);
-               LOG_TRACE("loaded ");
-               LOG_TRACE(ftos(cwp));
-               LOG_TRACE(" waypoints and ");
-               LOG_TRACE(ftos(cwb));
-               LOG_TRACE(" wayboxes from maps/");
-               LOG_TRACE(mapname);
-               LOG_TRACE(".waypoints\n");
+               LOG_TRACE("loaded ", ftos(cwp), " waypoints and ", ftos(cwb), " wayboxes from maps/", mapname, ".waypoints\n");
        }
        else
        {
-               LOG_TRACE("waypoint load from ");
-               LOG_TRACE(filename);
-               LOG_TRACE(" failed\n");
+               LOG_TRACE("waypoint load from ", filename, " failed\n");
        }
        return cwp + cwb;
 }
index 5d6fba14fd8a2247aba7b8fd189635a2fe9f3ac2..7718f96fb59b0684ac4101f58652f270aab2c4c3 100644 (file)
@@ -71,7 +71,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
                return 0;
 
        // sv_clones
-       if(i == CHIMPULSE_CLONE_MOVING || i == CHIMPULSE_CLONE_STANDING)
+       if(i == CHIMPULSE_CLONE_MOVING.impulse || i == CHIMPULSE_CLONE_STANDING.impulse)
                if(self.lip < sv_clones)
                        return 1;
 
@@ -146,7 +146,7 @@ float CheatImpulse(float i)
        {
                entity e, e2;
 
-               case CHIMPULSE_SPEEDRUN_INIT: // deploy personal waypoint
+               case CHIMPULSE_SPEEDRUN_INIT.impulse: // deploy personal waypoint
                        // shared with regular waypoint init, so this is not a cheat by itself
                        if(!self.personal)
                        {
@@ -173,7 +173,7 @@ float CheatImpulse(float i)
                        self.personal.invincible_finished = self.invincible_finished;
                        self.personal.teleport_time = time;
                        break; // this part itself doesn't cheat, so let's not count this
-               case CHIMPULSE_CLONE_MOVING:
+               case CHIMPULSE_CLONE_MOVING.impulse:
                        IS_CHEAT(i, 0, 0);
                        makevectors (self.v_angle);
                        self.velocity = self.velocity + v_forward * 300;
@@ -182,17 +182,17 @@ float CheatImpulse(float i)
                        self.velocity = self.velocity - v_forward * 300;
                        DID_CHEAT();
                        break;
-               case CHIMPULSE_CLONE_STANDING:
+               case CHIMPULSE_CLONE_STANDING.impulse:
                        IS_CHEAT(i, 0, 0);
                        CopyBody(0);
                        self.lip += 1;
                        DID_CHEAT();
                        break;
-               case CHIMPULSE_GIVE_ALL:
+               case CHIMPULSE_GIVE_ALL.impulse:
                        IS_CHEAT(i, 0, 0);
                        CheatCommand(tokenize_console("give all"));
                        break; // already counted as cheat
-               case CHIMPULSE_SPEEDRUN:
+               case CHIMPULSE_SPEEDRUN.impulse:
                        IS_CHEAT(i, 0, 0);
                        if(self.personal)
                        {
@@ -238,7 +238,7 @@ float CheatImpulse(float i)
                        else
                                sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
                        break;
-               case CHIMPULSE_TELEPORT:
+               case CHIMPULSE_TELEPORT.impulse:
                        IS_CHEAT(i, 0, 0);
                        if(self.movetype == MOVETYPE_NOCLIP)
                        {
@@ -267,7 +267,7 @@ float CheatImpulse(float i)
                        }
                        sprint(self, "Emergency teleport could not find a good location, forget it!\n");
                        break;
-               case CHIMPULSE_R00T:
+               case CHIMPULSE_R00T.impulse:
                        IS_CHEAT(i, 0, 0);
                        RandomSelection_Init();
                        FOR_EACH_PLAYER(e)
@@ -599,7 +599,7 @@ float CheatCommand(float argc)
                                                        {
                                                                if(vlen(oldself.origin - start) < vlen(e.origin - start))
                                                                        ++effectnum;
-                                                               else if(vlen(oldself.origin - start) == vlen(e.origin - start) && num_for_edict(oldself) < num_for_edict(e))
+                                                               else if(vlen(oldself.origin - start) == vlen(e.origin - start) && etof(oldself) < etof(e))
                                                                        ++effectnum;
                                                        }
                                                        fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n"));
index f200c4c867bc5afc73e7c3eb86483a38e7f621ed..122d2f7e94becb6e32645b2b68a7e356762f9c53 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef CHEATS_H
 #define CHEATS_H
 
+#include "../common/impulses/all.qh"
+
 //float autocvar_sv_cheats; // must... declare... global
 
 float cheatcount_total;
@@ -13,14 +15,6 @@ float CheatImpulse(float i);
 float CheatCommand(float argc);
 float CheatFrame();
 
-const float CHIMPULSE_SPEEDRUN_INIT = 30;
-const float CHIMPULSE_GIVE_ALL = 99;
-const float CHIMPULSE_CLONE_MOVING = 140;
-const float CHIMPULSE_SPEEDRUN = 141;
-const float CHIMPULSE_CLONE_STANDING = 142;
-const float CHIMPULSE_TELEPORT = 143;
-const float CHIMPULSE_R00T = 148;
-
 const float CHRAME_DRAG = 8;
 
 void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
index c9d178720f95bca81fb9626ac2b60c0cee9c5658..d3d14a5cfb5118b180e52eeaf1e7a148897cf779 100644 (file)
 #include "bot/navigation.qh"
 
 #include "../common/ent_cs.qh"
-#include "../common/vehicles/all.qh"
+#include "../common/state.qh"
+
 #include "../common/triggers/teleporters.qh"
 
+#include "../common/vehicles/all.qh"
+
 #include "weapons/hitplot.qh"
 #include "weapons/weaponsystem.qh"
 
@@ -186,7 +189,9 @@ putting a client as observer in the server
 */
 void FixPlayermodel(entity player);
 void PutObserverInServer()
-{SELFPARAM();
+{
+       SELFPARAM();
+       PlayerState_detach(this);
        entity  spot;
     self.hud = HUD_NORMAL;
 
@@ -299,9 +304,9 @@ void PutObserverInServer()
        setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
        self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
 
-       self.weapon = 0;
+       PS(self).m_weapon = WEP_Null;
        self.weaponname = "";
-       self.switchingweapon = 0;
+       PS(self).m_switchingweapon = WEP_Null;
        self.weaponmodel = "";
        for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
@@ -438,6 +443,7 @@ void PutClientInServer()
        if (IS_OBSERVER(this)) {
                PutObserverInServer();
        } else if (IS_PLAYER(this)) {
+               PlayerState_attach(this);
                accuracy_resend(this);
 
                if (this.team < 0)
@@ -617,11 +623,11 @@ void PutClientInServer()
                        remove(spot); // usefull for checking if there are spawnpoints, that let drop through the floor
                }
 
-               this.switchweapon = w_getbestweapon(this);
+               PS(this).m_switchweapon = w_getbestweapon(this);
                this.cnt = -1; // W_LastWeapon will not complain
-               this.weapon = 0;
+               PS(this).m_weapon = WEP_Null;
                this.weaponname = "";
-               this.switchingweapon = 0;
+               PS(this).m_switchingweapon = WEP_Null;
 
                if (!warmup_stage && !this.alivetime)
                        this.alivetime = time;
@@ -630,6 +636,8 @@ void PutClientInServer()
        }
 }
 
+void ClientInit_misc();
+
 .float ebouncefactor, ebouncestop; // electro's values
 // TODO do we need all these fields, or should we stop autodetecting runtime
 // changes and just have a console command to update this?
@@ -638,7 +646,15 @@ bool ClientInit_SendEntity(entity this, entity to, int sf)
        WriteHeader(MSG_ENTITY, _ENT_CLIENT_INIT);
        return = true;
        msg_entity = to;
+       // MSG_INIT replacement
+       // TODO: make easier to use
        Registry_send_all();
+       W_PROP_reload(MSG_ONE, to);
+       ClientInit_misc();
+       MUTATOR_CALLHOOK(Ent_Init);
+}
+void ClientInit_misc()
+{
        int channel = MSG_ONE;
        WriteHeader(channel, ENT_CLIENT_INIT);
        WriteByte(channel, g_nexball_meter_period * 32);
@@ -656,19 +672,8 @@ bool ClientInit_SendEntity(entity this, entity to, int sf)
        else
                WriteString(channel, "");
        WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
-       WriteCoord(channel, self.bouncefactor); // g_balance_mortar_bouncefactor // WEAPONTODO
-       WriteCoord(channel, self.bouncestop); // g_balance_mortar_bouncestop
-       WriteCoord(channel, self.ebouncefactor); // g_balance_mortar_bouncefactor
-       WriteCoord(channel, self.ebouncestop); // g_balance_mortar_bouncestop
-       WriteByte(channel, WEP_CVAR(vortex, secondary)); // client has to know if it should zoom or not // WEAPONTODO
-       WriteByte(channel, WEP_CVAR(rifle, secondary)); // client has to know if it should zoom or not // WEAPONTODO
        WriteByte(channel, serverflags); // client has to know if it should zoom or not
-       WriteByte(channel, WEP_CVAR(minelayer, limit)); // minelayer max mines // WEAPONTODO
-       WriteByte(channel, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
        WriteCoord(channel, autocvar_g_trueaim_minrange);
-       WriteByte(channel, WEP_CVAR(porto, secondary)); // WEAPONTODO
-
-       MUTATOR_CALLHOOK(Ent_Init);
 }
 
 void ClientInit_CheckUpdate()
@@ -679,26 +684,6 @@ void ClientInit_CheckUpdate()
                self.count = autocvar_g_balance_armor_blockpercent;
                self.SendFlags |= 1;
        }
-       if(self.bouncefactor != autocvar_g_balance_mortar_bouncefactor) // WEAPONTODO
-       {
-               self.bouncefactor = autocvar_g_balance_mortar_bouncefactor;
-               self.SendFlags |= 1;
-       }
-       if(self.bouncestop != autocvar_g_balance_mortar_bouncestop)
-       {
-               self.bouncestop = autocvar_g_balance_mortar_bouncestop;
-               self.SendFlags |= 1;
-       }
-       if(self.ebouncefactor != autocvar_g_balance_electro_secondary_bouncefactor)
-       {
-               self.ebouncefactor = autocvar_g_balance_electro_secondary_bouncefactor;
-               self.SendFlags |= 1;
-       }
-       if(self.ebouncestop != autocvar_g_balance_electro_secondary_bouncestop)
-       {
-               self.ebouncestop = autocvar_g_balance_electro_secondary_bouncestop;
-               self.SendFlags |= 1;
-       }
 }
 
 void ClientInit_Spawn()
@@ -1002,7 +987,7 @@ void ClientPreConnect ()
        {
                GameLogEcho(sprintf(":connect:%d:%d:%s",
                        self.playerid,
-                       num_for_edict(self),
+                       etof(self),
                        ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
                ));
        }
@@ -1018,7 +1003,9 @@ Called when a client connects to the server
 */
 void DecodeLevelParms ();
 void ClientConnect ()
-{SELFPARAM();
+{
+       SELFPARAM();
+       ClientState_attach(this);
        float t;
 
        if(IS_CLIENT(self))
@@ -1047,7 +1034,8 @@ void ClientConnect ()
                player_count = 0;
        }
 
-       if(IS_REAL_CLIENT(self)) { PlayerStats_PlayerBasic_CheckUpdate(self); }
+       // TODO: xonstat elo.txt support, until then just 404s
+       if(false && IS_REAL_CLIENT(self)) { PlayerStats_PlayerBasic_CheckUpdate(self); }
 
        PlayerScore_Attach(self);
        ClientData_Attach();
@@ -1134,7 +1122,7 @@ void ClientConnect ()
         PlayerStats_GameReport_AddPlayer(self);
 
        if(autocvar_sv_eventlog)
-               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
+               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(etof(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
 
        LogTeamchange(self.playerid, self.team, 1);
 
@@ -1236,7 +1224,9 @@ Called when a client disconnects from the server
 .entity chatbubbleentity;
 void ReadyCount();
 void ClientDisconnect ()
-{SELFPARAM();
+{
+       SELFPARAM();
+       ClientState_detach(this);
        if(self.vehicle)
            vehicles_exit(VHEF_RELEASE);
 
@@ -1617,7 +1607,8 @@ void player_regen ()
        {
                if(self.vehicle)
                        vehicles_exit(VHEF_RELEASE);
-               self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+               if(self.event_damage)
+                       self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
        }
 
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -1689,9 +1680,9 @@ void SpectateCopy(entity this, entity spectatee)
        self.invincible_finished = spectatee.invincible_finished;
        self.pressedkeys = spectatee.pressedkeys;
        self.weapons = spectatee.weapons;
-       self.switchweapon = spectatee.switchweapon;
-       self.switchingweapon = spectatee.switchingweapon;
-       self.weapon = spectatee.weapon;
+       PS(self).m_switchweapon = PS(spectatee).m_switchweapon;
+       PS(self).m_switchingweapon = PS(spectatee).m_switchingweapon;
+       PS(self).m_weapon = PS(spectatee).m_weapon;
        self.vortex_charge = spectatee.vortex_charge;
        self.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
        self.hagar_load = spectatee.hagar_load;
@@ -2014,7 +2005,7 @@ void ObserverThink()
 {SELFPARAM();
        if ( self.impulse )
        {
-               MinigameImpulse(self.impulse);
+               MinigameImpulse(self, self.impulse);
                self.impulse = 0;
        }
        float prefered_movetype;
@@ -2049,7 +2040,7 @@ void SpectatorThink()
 {SELFPARAM();
        if ( self.impulse )
        {
-               if(MinigameImpulse(self.impulse))
+               if(MinigameImpulse(self, self.impulse))
                        self.impulse = 0;
        }
        if (self.flags & FL_JUMPRELEASED) {
@@ -2405,7 +2396,7 @@ void PlayerPreThink ()
                // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
                // It cannot be predicted by the engine!
                .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-               if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
+               if((PS(self).m_weapon == WEP_SHOCKWAVE || PS(self).m_weapon == WEP_SHOTGUN) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
                        do_crouch = 0;
 
                if (do_crouch)
@@ -2480,14 +2471,19 @@ void PlayerPreThink ()
 
        // WEAPONTODO: Add weapon request for this
        if(!zoomstate_set)
-               SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX.m_id) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE.m_id && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO
+               SetZoomState(
+                       self.BUTTON_ZOOM
+                       || self.BUTTON_ZOOMSCRIPT
+                       || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_VORTEX)
+                       || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+               ); // WEAPONTODO
 
        float oldspectatee_status;
        oldspectatee_status = self.spectatee_status;
        if(IS_SPEC(self))
-               self.spectatee_status = num_for_edict(self.enemy);
+               self.spectatee_status = etof(self.enemy);
        else if(IS_OBSERVER(self))
-               self.spectatee_status = num_for_edict(self);
+               self.spectatee_status = etof(self);
        else
                self.spectatee_status = 0;
        if(self.spectatee_status != oldspectatee_status)
@@ -2520,7 +2516,7 @@ void PlayerPreThink ()
 
        // WEAPONTODO: Move into weaponsystem somehow
        // if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
-       if(!self.weapon)
+       if (PS(self).m_weapon == WEP_Null)
                self.clip_load = self.clip_size = 0;
 }
 
@@ -2601,7 +2597,7 @@ void PlayerPostThink ()
                CheckRules_Player();
                UpdateChatBubble();
                if (self.impulse)
-                       ImpulseCommands();
+                       ImpulseCommands(self);
                if (intermission_running)
                        return;         // intermission or finale
                GetPressedKeys();
index 05cd17d0d99a9dc9b8d8e564c62e66fc7fe6ef71..59fc183aa495b492e48f3ccbcb4e0f6a47bc0ae4 100644 (file)
 
 .entity vehicle;
 
+#define IMPULSE(id) _IMPULSE(IMP_##id)
+#define _IMPULSE(id) \
+       void id##_handle(entity this); \
+       STATIC_INIT_LATE(id) \
+       { \
+               id.impulse_handle = id##_handle; \
+       } \
+       void id##_handle(entity this)
+
 /**
  * Impulse map:
  *
  * 0 reserved (no input)
- * 1 to 9, 14: weapon shortcuts
- * 10: next weapon according to linear list
- * 11: most recently used weapon
- * 12: previous weapon according to linear list
- * 13: best weapon according to priority list
- * 15: next weapon according to priority list
- * 16: previous weapon according to priority list
- * 17: throw weapon
- * 18: next weapon according to sbar_hudselector 1 list
- * 19: previous weapon according to sbar_hudselector 1 list
- * 20: reload if needed
- *
- * 30 to 39: create waypoints
- * 47: clear personal waypoints
- * 48: clear team waypoints
  *
  * 99: loaded
  *
  * 230 to 253: individual weapons (up to 24)
  */
 
-void ImpulseCommands ()
-{SELFPARAM();
-       int imp;
-       vector org;
-       float i;
-       float m;
-       entity e, e2;
+// weapon switching impulses
 
-       imp = self.impulse;
-       if (!imp || gameover)
-               return;
-       self.impulse = 0;
+#define X(slot) \
+       IMPULSE(weapon_group_##slot) \
+       { \
+               if (this.deadflag != DEAD_NO) return; \
+               W_NextWeaponOnImpulse(slot); \
+       }
+X(1)
+X(2)
+X(3)
+X(4)
+X(5)
+X(6)
+X(7)
+X(8)
+X(9)
+X(0)
+#undef X
 
-       if ( self.active_minigame )
-       if ( MinigameImpulse(imp) )
-               return;
+// custom order weapon cycling
+
+#define X(slot, dir) \
+       IMPULSE(weapon_priority_##slot##_##dir) \
+       { \
+               if (this.vehicle) return; \
+               if (this.deadflag != DEAD_NO) return; \
+               noref int prev = -1; \
+               noref int best =  0; \
+               noref int next = +1; \
+               W_CycleWeapon(this.cvar_cl_weaponpriorities[slot], dir); \
+       }
+X(0, prev)
+X(1, prev)
+X(2, prev)
+X(3, prev)
+X(4, prev)
+X(5, prev)
+X(6, prev)
+X(7, prev)
+X(8, prev)
+X(9, prev)
+
+X(0, best)
+X(1, best)
+X(2, best)
+X(3, best)
+X(4, best)
+X(5, best)
+X(6, best)
+X(7, best)
+X(8, best)
+X(9, best)
+
+X(0, next)
+X(1, next)
+X(2, next)
+X(3, next)
+X(4, next)
+X(5, next)
+X(6, next)
+X(7, next)
+X(8, next)
+X(9, next)
+#undef X
+
+// direct weapons
+
+#define X(i) \
+       IMPULSE(weapon_byid_##i) \
+       { \
+               if (this.vehicle) return; \
+               if (this.deadflag != DEAD_NO) return; \
+               W_SwitchWeapon(Weapons_from(WEP_FIRST + i)); \
+       }
+X(0)
+X(1)
+X(2)
+X(3)
+X(4)
+X(5)
+X(6)
+X(7)
+X(8)
+X(9)
+X(10)
+X(11)
+X(12)
+X(13)
+X(14)
+X(15)
+X(16)
+X(17)
+X(18)
+X(19)
+X(20)
+X(21)
+X(22)
+X(23)
+#undef X
+
+IMPULSE(weapon_next_byid)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_NextWeapon(0);
+}
+
+IMPULSE(weapon_prev_byid)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_PreviousWeapon(0);
+}
+
+IMPULSE(weapon_next_bygroup)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_NextWeapon(1);
+}
+
+IMPULSE(weapon_prev_bygroup)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_PreviousWeapon(1);
+}
+
+IMPULSE(weapon_next_bypriority)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_NextWeapon(2);
+}
+
+IMPULSE(weapon_prev_bypriority)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_PreviousWeapon(2);
+}
+
+IMPULSE(weapon_last)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_LastWeapon();
+}
+
+IMPULSE(weapon_best)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_SwitchWeapon(w_getbestweapon(this));
+}
+
+IMPULSE(weapon_drop)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       W_ThrowWeapon(W_CalculateProjectileVelocity(this.velocity, v_forward * 750, false), '0 0 0', true);
+}
+
+IMPULSE(weapon_reload)
+{
+       if (this.vehicle) return;
+       if (this.deadflag != DEAD_NO) return;
+       if (forbidWeaponUse(this)) return;
+       Weapon w = PS(this).m_weapon;
+       w.wr_reload(w);
+}
+
+void ImpulseCommands(entity this)
+{
+       if (gameover) return;
+
+       int imp = this.impulse;
+       if (!imp) return;
+       this.impulse = 0;
+
+       if (MinigameImpulse(this, imp)) return;
+
+       if (timeout_status == TIMEOUT_ACTIVE) return;  // don't allow any impulses while the game is paused
 
        // allow only weapon change impulses when not in round time
-       if(round_handler_IsActive() && !round_handler_IsRoundStarted())
-       if(imp == 17 || (imp >= 20 && imp < 200) || imp > 253)
-               return;
+       if (round_handler_IsActive() && !round_handler_IsRoundStarted())
+       {
+               #define X(id) case IMP_##id.impulse:
+               switch (imp)
+               {
+                       X(weapon_group_0)
+                       X(weapon_group_1)
+                       X(weapon_group_2)
+                       X(weapon_group_3)
+                       X(weapon_group_4)
+                       X(weapon_group_5)
+                       X(weapon_group_6)
+                       X(weapon_group_7)
+                       X(weapon_group_8)
+                       X(weapon_group_9)
+                       X(weapon_next_byid)
+                       X(weapon_prev_byid)
+                       X(weapon_next_bygroup)
+                       X(weapon_prev_bygroup)
+                       X(weapon_next_bypriority)
+                       X(weapon_prev_bypriority)
+                       X(weapon_last)
+                       X(weapon_best)
+                       X(weapon_reload)
+                       X(weapon_priority_0_prev)
+            X(weapon_priority_1_prev)
+            X(weapon_priority_2_prev)
+            X(weapon_priority_3_prev)
+            X(weapon_priority_4_prev)
+            X(weapon_priority_5_prev)
+            X(weapon_priority_6_prev)
+            X(weapon_priority_7_prev)
+            X(weapon_priority_8_prev)
+            X(weapon_priority_9_prev)
+            X(weapon_priority_0_next)
+                       X(weapon_priority_1_next)
+                       X(weapon_priority_2_next)
+                       X(weapon_priority_3_next)
+                       X(weapon_priority_4_next)
+                       X(weapon_priority_5_next)
+                       X(weapon_priority_6_next)
+                       X(weapon_priority_7_next)
+                       X(weapon_priority_8_next)
+                       X(weapon_priority_9_next)
+                       X(weapon_priority_0_best)
+            X(weapon_priority_1_best)
+            X(weapon_priority_2_best)
+            X(weapon_priority_3_best)
+            X(weapon_priority_4_best)
+            X(weapon_priority_5_best)
+            X(weapon_priority_6_best)
+            X(weapon_priority_7_best)
+            X(weapon_priority_8_best)
+            X(weapon_priority_9_best)
+            X(weapon_byid_0)
+            X(weapon_byid_1)
+            X(weapon_byid_2)
+            X(weapon_byid_3)
+            X(weapon_byid_4)
+            X(weapon_byid_5)
+            X(weapon_byid_6)
+            X(weapon_byid_7)
+            X(weapon_byid_8)
+            X(weapon_byid_9)
+            X(weapon_byid_10)
+            X(weapon_byid_11)
+            X(weapon_byid_12)
+            X(weapon_byid_13)
+            X(weapon_byid_14)
+            X(weapon_byid_15)
+            X(weapon_byid_16)
+            X(weapon_byid_17)
+            X(weapon_byid_18)
+            X(weapon_byid_19)
+            X(weapon_byid_20)
+            X(weapon_byid_21)
+            X(weapon_byid_22)
+            X(weapon_byid_23)
+                       break;
+                       default: return;
+               }
+#undef X
+       }
+
+       if (vehicle_impulse(this, imp)) return;
 
-       if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
+       if (CheatImpulse(imp)) return;
+
+       FOREACH(IMPULSES, it.impulse == imp, {
+               void(entity) f = it.impulse_handle;
+               if (!f) continue;
+               f(this);
                return;
+       });
+}
 
-       if(self.vehicle)
-       if(self.vehicle.deadflag == DEAD_NO)
+IMPULSE(use)
+{
+       PlayerUseKey();
+}
+
+IMPULSE(waypoint_personal_here)
+{
+       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this.origin, RADARICON_WAYPOINT);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "personal waypoint spawned at location\n");
+}
+
+IMPULSE(waypoint_personal_crosshair)
+{
+       WarpZone_crosshair_trace(this);
+       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "personal waypoint spawned at crosshair\n");
+}
+
+IMPULSE(waypoint_personal_death)
+{
+       if (!this.death_origin) return;
+       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this.death_origin, RADARICON_WAYPOINT);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "personal waypoint spawned at death location\n");
+}
+
+IMPULSE(waypoint_here_follow)
+{
+       if (!teamplay) return;
+       if (this.deadflag != DEAD_NO) return;
+       if (!MUTATOR_CALLHOOK(HelpMePing, this))
        {
-               if(self.vehicle.vehicles_impulse)
-               if(self.vehicle.vehicles_impulse(imp))
-                       return;
-               if(vehicle_impulse(imp))
-                       return;
+               entity wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME);
+               if (!wp) WaypointSprite_HelpMePing(this.waypointsprite_attachedforcarrier);
+               else WaypointSprite_Ping(wp);
        }
+       sprint(this, "HELP ME attached\n");
+}
+
+IMPULSE(waypoint_here_here)
+{
+       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this.origin, RADARICON_HERE);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "HERE spawned at location\n");
+}
+
+IMPULSE(waypoint_here_crosshair)
+{
+       WarpZone_crosshair_trace(this);
+       entity wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "HERE spawned at crosshair\n");
+}
+
+IMPULSE(waypoint_here_death)
+{
+       if (!this.death_origin) return;
+       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this.death_origin, RADARICON_HERE);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "HERE spawned at death location\n");
+}
 
-       if(CheatImpulse(imp))
+IMPULSE(waypoint_danger_here)
+{
+       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this.origin, RADARICON_DANGER);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "DANGER spawned at location\n");
+}
+
+IMPULSE(waypoint_danger_crosshair)
+{
+       WarpZone_crosshair_trace(this);
+       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "DANGER spawned at crosshair\n");
+}
+
+IMPULSE(waypoint_danger_death)
+{
+       if (!this.death_origin) return;
+       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this.death_origin, RADARICON_DANGER);
+       if (wp) WaypointSprite_Ping(wp);
+       sprint(this, "DANGER spawned at death location\n");
+}
+
+IMPULSE(waypoint_clear_personal)
+{
+       WaypointSprite_ClearPersonal();
+       if (this.personal)
        {
+               remove(this.personal);
+               this.personal = NULL;
        }
-       else if (imp >= 1 && imp <= 9)
+       sprint(this, "personal waypoint cleared\n");
+}
+
+IMPULSE(waypoint_clear)
+{
+       WaypointSprite_ClearOwned();
+       if (this.personal)
+       {
+               remove(this.personal);
+               this.personal = NULL;
+       }
+       sprint(this, "all waypoints cleared\n");
+}
+
+IMPULSE(navwaypoint_spawn)
+{
+       if (!autocvar_g_waypointeditor) return;
+       waypoint_schedulerelink(waypoint_spawn(this.origin, this.origin, 0));
+       bprint(strcat("Waypoint spawned at ", vtos(this.origin), "\n"));
+}
+
+IMPULSE(navwaypoint_remove)
+{
+       if (!autocvar_g_waypointeditor) return;
+       entity e = navigation_findnearestwaypoint(this, false);
+       if (!e) return;
+       if (e.wpflags & WAYPOINTFLAG_GENERATED) return;
+       bprint(strcat("Waypoint removed at ", vtos(e.origin), "\n"));
+       waypoint_remove(e);
+}
+
+IMPULSE(navwaypoint_relink)
+{
+       if (!autocvar_g_waypointeditor) return;
+       waypoint_schedulerelinkall();
+}
+
+IMPULSE(navwaypoint_save)
+{
+       if (!autocvar_g_waypointeditor) return;
+       waypoint_saveall();
+}
+
+IMPULSE(navwaypoint_unreachable)
+{
+       if (!autocvar_g_waypointeditor) return;
+       for (entity e = findchain(classname, "waypoint"); e; e = e.chain)
        {
-               // weapon switching impulses
-               if(self.deadflag == DEAD_NO)
-                       W_NextWeaponOnImpulse(imp);
-               //else // don't retry, as this can break weaplast bind
-               //      self.impulse = imp; // retry in next frame
+               e.colormod = '0.5 0.5 0.5';
+               e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
        }
-       else if(imp >= 10 && imp <= 20)
+       entity e2 = navigation_findnearestwaypoint(this, false);
+       navigation_markroutes(e2);
+
+       int i, m;
+
+       i = 0;
+       m = 0;
+       for (entity e = findchain(classname, "waypoint"); e; e = e.chain)
        {
-               if(!self.vehicle)
-               if(self.deadflag == DEAD_NO)
-               {
-                       switch(imp)
-                       {
-                               case 10:
-                                       W_NextWeapon(0);
-                                       break;
-                               case 11:
-                                       W_LastWeapon();
-                                       break;
-                               case 12:
-                                       W_PreviousWeapon(0);
-                                       break;
-                               case 13:
-                                       W_SwitchWeapon(w_getbestweapon(self));
-                                       break;
-                               case 14:
-                                       W_NextWeaponOnImpulse(0);
-                                       break;
-                               case 15:
-                                       W_NextWeapon(2);
-                                       break;
-                               case 16:
-                                       W_PreviousWeapon(2);
-                                       break;
-                               case 17:
-                                       W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, false), '0 0 0', true);
-                                       break;
-                               case 18:
-                                       W_NextWeapon(1);
-                                       break;
-                               case 19:
-                                       W_PreviousWeapon(1);
-                                       break;
-                               case 20:
-                                       if(!forbidWeaponUse(self)) {
-                                               Weapon w = Weapons_from(self.weapon);
-                                               w.wr_reload(w);
-                                       }
-                                       break;
-                       }
-               }
-               //else // don't retry, as this can break weaplast bind
-                       //self.impulse = imp; // retry in next frame
+               if (e.wpcost < 10000000) continue;
+               LOG_INFO("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
+               e.colormod_z = 8;
+               e.effects |= EF_NODEPTHTEST | EF_BLUE;
+               ++i;
+               ++m;
        }
-       else if(imp == 21)
+       if (i) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)\n", i);
+       navigation_markroutes_inverted(e2);
+
+       i = 0;
+       for (entity e = findchain(classname, "waypoint"); e; e = e.chain)
        {
-               PlayerUseKey ();
+               if (e.wpcost < 10000000) continue;
+               LOG_INFO("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
+               e.colormod_x = 8;
+               if (!(e.effects & EF_NODEPTHTEST))  // not already reported before
+                       ++m;
+               e.effects |= EF_NODEPTHTEST | EF_RED;
+               ++i;
        }
-       else if(imp >= 200 && imp <= 229)
+       if (i) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)\n", i);
+       if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
+
+       i = 0;
+       for (entity e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
        {
-               if(!self.vehicle)
-               if(self.deadflag == DEAD_NO)
+               vector org = e.origin;
+               tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
+               setorigin(e, trace_endpos);
+               if (navigation_findnearestwaypoint(e, false))
                {
-                       // custom order weapon cycling
-                       int i = imp % 10;
-                       m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
-                       W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
+                       setorigin(e, org);
+                       e.effects &= ~EF_NODEPTHTEST;
+                       e.model = "";
+               }
+               else
+               {
+                       setorigin(e, org);
+                       LOG_INFO("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
+                       e.effects |= EF_NODEPTHTEST;
+                       _setmodel(e, this.model);
+                       e.frame = this.frame;
+                       e.skin = this.skin;
+                       e.colormod = '8 0.5 8';
+                       setsize(e, '0 0 0', '0 0 0');
+                       ++i;
                }
-               //else // don't retry, as this can break weaplast bind
-                       //self.impulse = imp; // retry in next frame
        }
-       else if(imp >= WEP_IMPULSE_BEGIN && imp <= WEP_IMPULSE_END)
+       if (i) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", i);
+
+       i = 0;
+       entity start = findchainflags(flags, FL_ITEM);
+       for (entity e = start; e; e = e.chain)
        {
-               if(!self.vehicle)
-               if(self.deadflag == DEAD_NO)
-                       W_SwitchWeapon (imp - WEP_IMPULSE_BEGIN + WEP_FIRST);
-               //else // don't retry, as this can break weaplast bind
-                       //self.impulse = imp; // retry in next frame
+               e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
+               e.colormod = '0.5 0.5 0.5';
        }
-       // deploy waypoints
-       else if (imp >= 30 && imp <= 49)
+       for (entity e = start; e; e = e.chain)
        {
-               entity wp;
-               switch(imp)
-               {
-                       case 30:
-                               wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.origin, RADARICON_WAYPOINT);
-                               if(wp)
-                                       WaypointSprite_Ping(wp);
-                               sprint(self, "personal waypoint spawned at location\n");
-                               break;
-                       case 31:
-                               WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT);
-                               if(wp)
-                                       WaypointSprite_Ping(wp);
-                               sprint(self, "personal waypoint spawned at crosshair\n");
-                               break;
-                       case 32:
-                               if(vlen(self.death_origin))
-                               {
-                                       wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.death_origin, RADARICON_WAYPOINT);
-                                       if(wp)
-                                               WaypointSprite_Ping(wp);
-                                       sprint(self, "personal waypoint spawned at death location\n");
-                               }
-                               break;
-                       case 33:
-                               if(self.deadflag == DEAD_NO && teamplay)
-                               {
-                                       if (!MUTATOR_CALLHOOK(HelpMePing, self))
-                                       {
-                                               wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME);
-                                               if(!wp)
-                                                       WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
-                                               else
-                                                       WaypointSprite_Ping(wp);
-                                       }
-                                       sprint(self, "HELP ME attached\n");
-                               }
-                               break;
-                       case 34:
-                               wp = WaypointSprite_DeployFixed(WP_Here, false, self.origin, RADARICON_HERE);
-                               if(wp)
-                                       WaypointSprite_Ping(wp);
-                               sprint(self, "HERE spawned at location\n");
-                               break;
-                       case 35:
-                               WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE);
-                               if(wp)
-                                       WaypointSprite_Ping(wp);
-                               sprint(self, "HERE spawned at crosshair\n");
-                               break;
-                       case 36:
-                               if(vlen(self.death_origin))
-                               {
-                                       wp = WaypointSprite_DeployFixed(WP_Here, false, self.death_origin, RADARICON_HERE);
-                                       if(wp)
-                                               WaypointSprite_Ping(wp);
-                                       sprint(self, "HERE spawned at death location\n");
-                               }
-                               break;
-                       case 37:
-                               wp = WaypointSprite_DeployFixed(WP_Danger, false, self.origin, RADARICON_DANGER);
-                               if(wp)
-                                       WaypointSprite_Ping(wp);
-                               sprint(self, "DANGER spawned at location\n");
-                               break;
-                       case 38:
-                               WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER);
-                               if(wp)
-                                       WaypointSprite_Ping(wp);
-                               sprint(self, "DANGER spawned at crosshair\n");
-                               break;
-                       case 39:
-                               if(vlen(self.death_origin))
-                               {
-                                       wp = WaypointSprite_DeployFixed(WP_Danger, false, self.death_origin, RADARICON_DANGER);
-                                       if(wp)
-                                               WaypointSprite_Ping(wp);
-                                       sprint(self, "DANGER spawned at death location\n");
-                               }
-                               break;
-                       case 47:
-                               WaypointSprite_ClearPersonal();
-                               if(self.personal)
-                               {
-                                       remove(self.personal);
-                                       self.personal = world;
-                               }
-                               sprint(self, "personal waypoint cleared\n");
-                               break;
-                       case 48:
-                               WaypointSprite_ClearOwned();
-                               if(self.personal)
-                               {
-                                       remove(self.personal);
-                                       self.personal = world;
-                               }
-                               sprint(self, "all waypoints cleared\n");
-                               break;
-               }
+               if (navigation_findnearestwaypoint(e, false)) continue;
+               LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
+               e.effects |= EF_NODEPTHTEST | EF_RED;
+               e.colormod_x = 8;
+               ++i;
        }
-       else if(imp >= 103 && imp <= 107)
+       if (i) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", i);
+
+       i = 0;
+       for (entity e = start; e; e = e.chain)
        {
-               if(autocvar_g_waypointeditor)
-               {
-                       switch(imp)
-                       {
-                               case 103:
-                                       waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
-                                       bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
-                                       break;
-                               case 104:
-                                       e = navigation_findnearestwaypoint(self, false);
-                                       if (e)
-                                       if (!(e.wpflags & WAYPOINTFLAG_GENERATED))
-                                       {
-                                               bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
-                                               waypoint_remove(e);
-                                       }
-                                       break;
-                               case 105:
-                                       waypoint_schedulerelinkall();
-                                       break;
-                               case 106:
-                                       waypoint_saveall();
-                                       break;
-                               case 107:
-                                       for(e = findchain(classname, "waypoint"); e; e = e.chain)
-                                       {
-                                               e.colormod = '0.5 0.5 0.5';
-                                               e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
-                                       }
-                                       e2 = navigation_findnearestwaypoint(self, false);
-                                       navigation_markroutes(e2);
-                                       i = 0;
-                                       m = 0;
-                                       for(e = findchain(classname, "waypoint"); e; e = e.chain)
-                                       {
-                                               if(e.wpcost >= 10000000)
-                                               {
-                                                       LOG_INFO("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
-                                                       e.colormod_z = 8;
-                                                       e.effects |= EF_NODEPTHTEST | EF_BLUE;
-                                                       ++i;
-                                                       ++m;
-                                               }
-                                       }
-                                       if(i)
-                                               LOG_INFO(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
-                                       navigation_markroutes_inverted(e2);
-                                       i = 0;
-                                       for(e = findchain(classname, "waypoint"); e; e = e.chain)
-                                       {
-                                               if(e.wpcost >= 10000000)
-                                               {
-                                                       LOG_INFO("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
-                                                       e.colormod_x = 8;
-                                                       if(!(e.effects & EF_NODEPTHTEST)) // not already reported before
-                                                               ++m;
-                                                       e.effects |= EF_NODEPTHTEST | EF_RED;
-                                                       ++i;
-                                               }
-                                       }
-                                       if(i)
-                                               LOG_INFO(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
-                                       if(m)
-                                               LOG_INFO(ftos(m), " waypoints have been marked total\n");
-                                       i = 0;
-                                       for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
-                                       {
-                                               org = e.origin;
-                                               tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
-                                               setorigin(e, trace_endpos);
-                                               if(navigation_findnearestwaypoint(e, false))
-                                               {
-                                                       setorigin(e, org);
-                                                       e.effects &= ~EF_NODEPTHTEST;
-                                                       e.model = "";
-                                               }
-                                               else
-                                               {
-                                                       setorigin(e, org);
-                                                       LOG_INFO("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
-                                                       e.effects |= EF_NODEPTHTEST;
-                                                       _setmodel(e, self.model);
-                                                       e.frame = self.frame;
-                                                       e.skin = self.skin;
-                                                       e.colormod = '8 0.5 8';
-                                                       setsize(e, '0 0 0', '0 0 0');
-                                                       ++i;
-                                               }
-                                       }
-                                       if(i)
-                                               LOG_INFO(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");
-                                       i = 0;
-                                       entity start;
-                                       start = findchainflags(flags, FL_ITEM);
-                                       for(e = start; e; e = e.chain)
-                                       {
-                                               e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
-                                               e.colormod = '0.5 0.5 0.5';
-                                       }
-                                       for(e = start; e; e = e.chain)
-                                       {
-                                               if(navigation_findnearestwaypoint(e, false))
-                                               {
-                                               }
-                                               else
-                                               {
-                                                       LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
-                                                       e.effects |= EF_NODEPTHTEST | EF_RED;
-                                                       e.colormod_x = 8;
-                                                       ++i;
-                                               }
-                                       }
-                                       if(i)
-                                               LOG_INFO(ftos(i), " items have no nearest waypoint and cannot be walked away from (marked with red light)\n");
-                                       i = 0;
-                                       for(e = start; e; e = e.chain)
-                                       {
-                                               org = e.origin;
-                                               if(navigation_findnearestwaypoint(e, true))
-                                               {
-                                               }
-                                               else
-                                               {
-                                                       LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
-                                                       e.effects |= EF_NODEPTHTEST | EF_BLUE;
-                                                       e.colormod_z = 8;
-                                                       ++i;
-                                               }
-                                       }
-                                       if(i)
-                                               LOG_INFO(ftos(i), " items have no nearest waypoint and cannot be walked to (marked with blue light)\n");
-                                       break;
-                       }
-               }
+               if (navigation_findnearestwaypoint(e, true)) continue;
+               LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
+               e.effects |= EF_NODEPTHTEST | EF_BLUE;
+               e.colormod_z = 8;
+               ++i;
        }
+       if (i) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)\n", i);
 }
index 3a5ed9ecdfdf821398dc2f8c8a3378fc460628a8..aecf079b787f35cf8022f38ba23205675272eee1 100644 (file)
@@ -1,40 +1,5 @@
 #ifndef CL_IMPULSE_H
 #define CL_IMPULSE_H
 
-/*
- * Impulse map:
- *
- * 0 reserved (no input)
- * 1 to 9, 14: weapon shortcuts
- * 10: next weapon according to linear list
- * 11: most recently used weapon
- * 12: previous weapon according to linear list
- * 13: best weapon according to priority list
- * 15: next weapon according to priority list
- * 16: previous weapon according to priority list
- * 17: throw weapon
- * 18: next weapon according to sbar_hudselector 1 list
- * 19: previous weapon according to sbar_hudselector 1 list
- * 20: reload if needed
- *
- * 30 to 39: create waypoints
- * 47: clear personal waypoints
- * 48: clear team waypoints
- *
- * 99: loaded
- *
- * 140: moving clone
- * 141: ctf speedrun
- * 142: fixed clone
- * 143: emergency teleport
- * 148: unfairly eliminate
- *
- * TODO:
- * 200 to 209: prev weapon shortcuts
- * 210 to 219: best weapon shortcuts
- * 220 to 229: next weapon shortcuts
- * 230 to 253: individual weapons (up to 24)
- */
-
-void ImpulseCommands ();
+void ImpulseCommands(entity this);
 #endif
index d7ce1f66aedd85785d6f95b62416b4456e37f66f..cbe38ac5a5cb16dd232eb2eea27d5757f10fe462 100644 (file)
@@ -482,7 +482,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
        if(DIFF_TEAM(self, attacker))
        {
                if(DEATH_ISSPECIAL(deathtype))
-                       awep = Weapons_from(attacker.weapon);
+                       awep = PS(attacker).m_weapon;
                else
                        awep = DEATH_WEAPONOF(deathtype);
                valid_damage_for_weaponstats = 1;
@@ -492,7 +492,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
        {
                dh = dh - max(self.health, 0);
                da = da - max(self.armorvalue, 0);
-               WeaponStats_LogDamage(awep.m_id, abot, self.weapon, vbot, dh + da);
+               WeaponStats_LogDamage(awep.m_id, abot, PS(self).m_weapon.m_id, vbot, dh + da);
                MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype);
        }
 
@@ -508,7 +508,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                }
 
                if(valid_damage_for_weaponstats)
-                       WeaponStats_LogKill(awep.m_id, abot, self.weapon, vbot);
+                       WeaponStats_LogKill(awep.m_id, abot, PS(self).m_weapon.m_id, vbot);
 
                if(autocvar_sv_gentle < 1) // TODO make a "gentle" version?
                if(sound_allowed(MSG_BROADCAST, attacker))
@@ -548,7 +548,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
                excess = frag_damage;
 
-               Weapon wep = Weapons_from(self.weapon);
+               Weapon wep = PS(self).m_weapon;
                wep.wr_playerdeath(wep);
 
                RemoveGrapplingHook(self);
@@ -573,7 +573,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                // clear waypoints
                WaypointSprite_PlayerDead();
                // throw a weapon
-               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);
+               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, PS(self).m_switchweapon.m_id);
 
                // become fully visible
                self.alpha = default_player_alpha;
index af87c24b1adb6262e8f30619e89a15a5bf7da742..13bca963cc33a0937987914dee9767ce63273b4a 100644 (file)
@@ -1,7 +1,23 @@
 #ifndef SERVER_COMMANDS_ALL_H
 #define SERVER_COMMANDS_ALL_H
 
-#include "../../common/command/commands.qh"
+#include "../../common/command/command.qh"
+REGISTRY(SERVER_COMMANDS, BITS(7))
+#define SERVER_COMMANDS_from(i) _SERVER_COMMANDS_from(i, NULL)
+REGISTER_REGISTRY(SERVER_COMMANDS)
+REGISTRY_SORT(SERVER_COMMANDS)
+
+#define SERVER_COMMAND(id, description) \
+       CLASS(servercommand_##id, Command) \
+               ATTRIB(servercommand_##id, m_name, string, #id); \
+       ATTRIB(servercommand_##id, m_description, string, description); \
+       ENDCLASS(servercommand_##id) \
+    REGISTER(SERVER_COMMANDS, CMD_SV, id, m_id, NEW(servercommand_##id)); \
+       METHOD(servercommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+
+STATIC_INIT(SERVER_COMMANDS_aliases) {
+       FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
+}
 
 #include "sv_cmd.qh"
 
index 69f0222cb7d24586da4dc6ba64a191c558a360d8..484ecb2104d208ac969ba5c50825eeb1e186d1c3 100644 (file)
@@ -155,7 +155,7 @@ float GetFilteredNumber(string input)
        entity selection = GetFilteredEntity(input);
        float output;
 
-       output = num_for_edict(selection);
+       output = etof(selection);
 
        return output;
 }
@@ -791,7 +791,7 @@ void CommonCommand_who(float request, entity caller, float argc)
                                }
 
                                print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
-                                       num_for_edict(tmp_player),
+                                       etof(tmp_player),
                                        tmp_player.netname,
                                        tmp_player.ping,
                                        tmp_player.ping_packetloss,
index 2a1a2b42fd16d45008c89e2875617947f09bcd63..08b8b848fdd43e7cc1111e025609cc6d334e7648 100644 (file)
@@ -1,6 +1,24 @@
 #ifndef COMMAND_COMMON_H
 #define COMMAND_COMMON_H
 
+#include "../../common/command/command.qh"
+REGISTRY(COMMON_COMMANDS, BITS(7))
+#define COMMON_COMMANDS_from(i) _COMMON_COMMANDS_from(i, NULL)
+REGISTER_REGISTRY(COMMON_COMMANDS)
+REGISTRY_SORT(COMMON_COMMANDS)
+
+#define COMMON_COMMAND(id, description) \
+       CLASS(commoncommand_##id, Command) \
+               ATTRIB(commoncommand_##id, m_name, string, #id); \
+       ATTRIB(commoncommand_##id, m_description, string, description); \
+       ENDCLASS(commoncommand_##id) \
+    REGISTER(COMMON_COMMANDS, CMD_SV, id, m_id, NEW(commoncommand_##id)); \
+       METHOD(commoncommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+
+STATIC_INIT(COMMON_COMMANDS_aliases) {
+       FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
+}
+
 #include "vote.qh"
 #include "../../common/monsters/spawn.qh"
 
@@ -123,62 +141,50 @@ void CommonCommand_who(float request, entity caller, float argc);
 // ==================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define COMMON_COMMANDS(request, caller, arguments, command) \
-       COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \
-       COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \
-       COMMON_COMMAND("editmob", CommonCommand_editmob(request, caller, arguments), "Modifies a monster or all monsters") \
-       COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \
-       COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
-       COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
-       COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \
-       COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
-       COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
-       COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
-       COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \
-       COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \
-       COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
-       COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \
-       COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \
-       /* nothing */
+COMMON_COMMAND(cvar_changes, "Prints a list of all changed server cvars") { CommonCommand_cvar_changes(request, caller); }
+COMMON_COMMAND(cvar_purechanges, "Prints a list of all changed gameplay cvars") { CommonCommand_cvar_purechanges(request, caller); }
+COMMON_COMMAND(editmob, "Modifies a monster or all monsters") { CommonCommand_editmob(request, caller, arguments); }
+COMMON_COMMAND(info, "Request for unique server information set up by admin") { CommonCommand_info(request, caller, arguments); }
+COMMON_COMMAND(ladder, "Get information about top players if supported") { CommonCommand_ladder(request, caller); }
+COMMON_COMMAND(lsmaps, "List maps which can be used with the current game mode") { CommonCommand_lsmaps(request, caller); }
+COMMON_COMMAND(printmaplist, "Display full server maplist reply") { CommonCommand_printmaplist(request, caller); }
+COMMON_COMMAND(rankings, "Print information about rankings") { CommonCommand_rankings(request, caller); }
+COMMON_COMMAND(records, "List top 10 records for the current map") { CommonCommand_records(request, caller); }
+COMMON_COMMAND(teamstatus, "Show information about player and team scores") { CommonCommand_teamstatus(request, caller); }
+COMMON_COMMAND(time, "Print different formats/readouts of time") { CommonCommand_time(request, caller); }
+COMMON_COMMAND(timein, "Resume the game from being paused with a timeout") { CommonCommand_timein(request, caller); }
+COMMON_COMMAND(timeout, "Call a timeout which pauses the game for certain amount of time unless unpaused") { CommonCommand_timeout(request, caller); }
+COMMON_COMMAND(vote, "Request an action to be voted upon by players") { VoteCommand(request, caller, arguments, command); }
+COMMON_COMMAND(who, "Display detailed client information about all players") { CommonCommand_who(request, caller, arguments);}
 
 void CommonCommand_macro_help(entity caller)
 {
-       #define COMMON_COMMAND(name, function, description) \
-               { print_to(caller, strcat("  ^2", name, "^7: ", description)); }
-
-       COMMON_COMMANDS(0, caller, 0, "");
-#undef COMMON_COMMAND
+       FOREACH(COMMON_COMMANDS, true, LAMBDA(print_to(caller, sprintf("  ^2%s^7: %s\n", it.m_name, it.m_description))));
 }
 
 float CommonCommand_macro_command(float argc, entity caller, string command)
 {
-       #define COMMON_COMMAND(name, function, description) \
-               { if (name == strtolower(argv(0))) { function; return true; } }
-
-       COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command);
-#undef COMMON_COMMAND
-
+       string c = strtolower(argv(0));
+       FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+               it.m_invokecmd(CMD_REQUEST_COMMAND, caller, argc, command);
+               return true;
+       ));
        return false;
 }
 
 float CommonCommand_macro_usage(float argc, entity caller)
 {
-       #define COMMON_COMMAND(name, function, description) \
-               { if (name == strtolower(argv(1))) { function; return true; } }
-
-       COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "");
-#undef COMMON_COMMAND
-
+       string c = strtolower(argv(1));
+       FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+               it.m_invokecmd(CMD_REQUEST_USAGE, caller, argc, "");
+               return true;
+       ));
        return false;
 }
 
 void CommonCommand_macro_write_aliases(float fh)
 {
-       #define COMMON_COMMAND(name, function, description) \
-               { CMD_Write_Alias("qc_cmd_svcmd", name, description); }
-
-       COMMON_COMMANDS(0, world, 0, "");
-#undef COMMON_COMMAND
+       FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description)));
 }
 
 
index eec862f364f24b7c7b87ccb59cd0a194fac1100b..b7602451dbb364a1dcf4447055eb3b064bee0449 100644 (file)
@@ -1,5 +1,4 @@
-#include "../../common/command/command.qh"
-#include "sv_cmd.qh"
+#include "all.qh"
 
 #include "banning.qh"
 #include "cmd.qh"
@@ -560,7 +559,7 @@ void GameCommand_defer_clear_all(float request)
 
                        FOR_EACH_CLIENT(client)
                        {
-                               argc = tokenize_console(strcat("defer_clear ", ftos(num_for_edict(client))));
+                               argc = tokenize_console(strcat("defer_clear ", ftos(etof(client))));
                                GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
                                ++i;
                        }
@@ -1403,7 +1402,7 @@ void GameCommand_shuffleteams(float request)
                                                }
                                                else
                                                {
-                                                       shuffleteams_players[i] = num_for_edict(tmp_player);
+                                                       shuffleteams_players[i] = etof(tmp_player);
                                                        break;
                                                }
                                        }
@@ -1726,7 +1725,7 @@ void GameCommand_warp(float request, float argc)
                                if (argc >= 2)
                                {
                                        CampaignLevelWarp(stof(argv(1)));
-                                       LOG_INFO("Successfully warped to campaign level ", stof(argv(1)), ".\n");
+                                       LOG_INFO("Successfully warped to campaign level ", argv(1), ".\n");
                                }
                                else
                                {
@@ -1781,79 +1780,67 @@ void GameCommand_(float request)
 // ==================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define SERVER_COMMANDS(request, arguments, command) \
-       SERVER_COMMAND("adminmsg", GameCommand_adminmsg(request, arguments), "Send an admin message to a client directly") \
-       SERVER_COMMAND("allready", GameCommand_allready(request), "Restart the server and reset the players") \
-       SERVER_COMMAND("allspec", GameCommand_allspec(request, arguments), "Force all players to spectate") \
-       SERVER_COMMAND("anticheat", GameCommand_anticheat(request, arguments), "Create an anticheat report for a client") \
-       SERVER_COMMAND("animbench", GameCommand_animbench(request, arguments), "Benchmark model animation (LAGS)") \
-       SERVER_COMMAND("bbox", GameCommand_bbox(request), "Print detailed information about world size") \
-       SERVER_COMMAND("bot_cmd", GameCommand_bot_cmd(request, arguments, command), "Control and send commands to bots") \
-       SERVER_COMMAND("cointoss", GameCommand_cointoss(request, arguments), "Flip a virtual coin and give random result") \
-       SERVER_COMMAND("database", GameCommand_database(request, arguments), "Extra controls of the serverprogs database") \
-       SERVER_COMMAND("defer_clear", GameCommand_defer_clear(request, arguments), "Clear all queued defer commands for a specific client") \
-       SERVER_COMMAND("defer_clear_all", GameCommand_defer_clear_all(request), "Clear all queued defer commands for all clients") \
-       SERVER_COMMAND("delrec", GameCommand_delrec(request, arguments), "Delete race time record for a map") \
-       SERVER_COMMAND("effectindexdump", GameCommand_effectindexdump(request), "Dump list of effects from code and effectinfo.txt") \
-       SERVER_COMMAND("extendmatchtime", GameCommand_extendmatchtime(request), "Increase the timelimit value incrementally") \
-       SERVER_COMMAND("find", GameCommand_find(request, arguments), "Search through entities for matching classname") \
-       SERVER_COMMAND("gametype", GameCommand_gametype(request, arguments), "Simple command to change the active gametype") \
-       SERVER_COMMAND("gettaginfo", GameCommand_gettaginfo(request, arguments), "Get specific information about a weapon model") \
-       SERVER_COMMAND("gotomap", GameCommand_gotomap(request, arguments), "Simple command to switch to another map") \
-       SERVER_COMMAND("lockteams", GameCommand_lockteams(request), "Disable the ability for players to switch or enter teams") \
-       SERVER_COMMAND("make_mapinfo", GameCommand_make_mapinfo(request), "Automatically rebuild mapinfo files") \
-       SERVER_COMMAND("moveplayer", GameCommand_moveplayer(request, arguments), "Change the team/status of a player") \
-       SERVER_COMMAND("nospectators", GameCommand_nospectators(request), "Automatically remove spectators from a match") \
-       SERVER_COMMAND("playerdemo", GameCommand_playerdemo(request, arguments), "Control the ability to save demos of players") \
-       SERVER_COMMAND("printstats", GameCommand_printstats(request), "Dump eventlog player stats and other score information") \
-       SERVER_COMMAND("radarmap", GameCommand_radarmap(request, arguments), "Generate a radar image of the map") \
-       SERVER_COMMAND("reducematchtime", GameCommand_reducematchtime(request), "Decrease the timelimit value incrementally") \
-       SERVER_COMMAND("setbots", GameCommand_setbots(request, arguments), "Adjust how many bots are in the match") \
-       SERVER_COMMAND("shuffleteams", GameCommand_shuffleteams(request), "Randomly move players to different teams") \
-       SERVER_COMMAND("stuffto", GameCommand_stuffto(request, arguments), "Send a command to be executed on a client") \
-       SERVER_COMMAND("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \
-       SERVER_COMMAND("unlockteams", GameCommand_unlockteams(request), "Enable the ability for players to switch or enter teams") \
-       SERVER_COMMAND("warp", GameCommand_warp(request, arguments), "Choose different level in campaign") \
-       /* nothing */
+SERVER_COMMAND(adminmsg, "Send an admin message to a client directly") { GameCommand_adminmsg(request, arguments); }
+SERVER_COMMAND(allready, "Restart the server and reset the players") { GameCommand_allready(request); }
+SERVER_COMMAND(allspec, "Force all players to spectate") { GameCommand_allspec(request, arguments); }
+SERVER_COMMAND(anticheat, "Create an anticheat report for a client") { GameCommand_anticheat(request, arguments); }
+SERVER_COMMAND(animbench, "Benchmark model animation (LAGS)") { GameCommand_animbench(request, arguments); }
+SERVER_COMMAND(bbox, "Print detailed information about world size") { GameCommand_bbox(request); }
+SERVER_COMMAND(bot_cmd, "Control and send commands to bots") { GameCommand_bot_cmd(request, arguments, command); }
+SERVER_COMMAND(cointoss, "Flip a virtual coin and give random result") { GameCommand_cointoss(request, arguments); }
+SERVER_COMMAND(database, "Extra controls of the serverprogs database") { GameCommand_database(request, arguments); }
+SERVER_COMMAND(defer_clear, "Clear all queued defer commands for a specific client") { GameCommand_defer_clear(request, arguments); }
+SERVER_COMMAND(defer_clear_all, "Clear all queued defer commands for all clients") { GameCommand_defer_clear_all(request); }
+SERVER_COMMAND(delrec, "Delete race time record for a map") { GameCommand_delrec(request, arguments); }
+SERVER_COMMAND(effectindexdump, "Dump list of effects from code and effectinfo.txt") { GameCommand_effectindexdump(request); }
+SERVER_COMMAND(extendmatchtime, "Increase the timelimit value incrementally") { GameCommand_extendmatchtime(request); }
+SERVER_COMMAND(find, "Search through entities for matching classname") { GameCommand_find(request, arguments); }
+SERVER_COMMAND(gametype, "Simple command to change the active gametype") { GameCommand_gametype(request, arguments); }
+SERVER_COMMAND(gettaginfo, "Get specific information about a weapon model") { GameCommand_gettaginfo(request, arguments); }
+SERVER_COMMAND(gotomap, "Simple command to switch to another map") { GameCommand_gotomap(request, arguments); }
+SERVER_COMMAND(lockteams, "Disable the ability for players to switch or enter teams") { GameCommand_lockteams(request); }
+SERVER_COMMAND(make_mapinfo, "Automatically rebuild mapinfo files") { GameCommand_make_mapinfo(request); }
+SERVER_COMMAND(moveplayer, "Change the team/status of a player") { GameCommand_moveplayer(request, arguments); }
+SERVER_COMMAND(nospectators, "Automatically remove spectators from a match") { GameCommand_nospectators(request); }
+SERVER_COMMAND(playerdemo, "Control the ability to save demos of players") { GameCommand_playerdemo(request, arguments); }
+SERVER_COMMAND(printstats, "Dump eventlog player stats and other score information") { GameCommand_printstats(request); }
+SERVER_COMMAND(radarmap, "Generate a radar image of the map") { GameCommand_radarmap(request, arguments); }
+SERVER_COMMAND(reducematchtime, "Decrease the timelimit value incrementally") { GameCommand_reducematchtime(request); }
+SERVER_COMMAND(setbots, "Adjust how many bots are in the match") { GameCommand_setbots(request, arguments); }
+SERVER_COMMAND(shuffleteams, "Randomly move players to different teams") { GameCommand_shuffleteams(request); }
+SERVER_COMMAND(stuffto, "Send a command to be executed on a client") { GameCommand_stuffto(request, arguments); }
+SERVER_COMMAND(trace, "Various debugging tools with tracing") { GameCommand_trace(request, arguments); }
+SERVER_COMMAND(unlockteams, "Enable the ability for players to switch or enter teams") { GameCommand_unlockteams(request); }
+SERVER_COMMAND(warp, "Choose different level in campaign") { GameCommand_warp(request, arguments); }
 
 void GameCommand_macro_help()
 {
-       #define SERVER_COMMAND(name, function, description) \
-               { LOG_INFO("  ^2", name, "^7: ", description, "\n"); }
-
-       SERVER_COMMANDS(0, 0, "");
-#undef SERVER_COMMAND
+       FOREACH(SERVER_COMMANDS, true, LAMBDA(LOG_INFOF("  ^2%s^7: %s\n", it.m_name, it.m_description)));
 }
 
 float GameCommand_macro_command(float argc, string command)
 {
-       #define SERVER_COMMAND(name, function, description) \
-               { if (name == strtolower(argv(0))) { function; return true; } }
-
-       SERVER_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
-#undef SERVER_COMMAND
-
+       string c = strtolower(argv(0));
+       FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+               it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+               return true;
+       ));
        return false;
 }
 
 float GameCommand_macro_usage(float argc)
 {
-       #define SERVER_COMMAND(name, function, description) \
-               { if (name == strtolower(argv(1))) { function; return true; } }
-
-       SERVER_COMMANDS(CMD_REQUEST_USAGE, argc, "");
-#undef SERVER_COMMAND
-
+       string c = strtolower(argv(1));
+       FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+               it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+               return true;
+       ));
        return false;
 }
 
 void GameCommand_macro_write_aliases(float fh)
 {
-       #define SERVER_COMMAND(name, function, description) \
-               { CMD_Write_Alias("qc_cmd_sv", name, description); }
-
-       SERVER_COMMANDS(0, 0, "");
-#undef SERVER_COMMAND
+       FOREACH(SERVER_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description)));
 }
 
 
index a023594a5f8c0be0cbcc95ead050513fa64ae022..d1598e239cae5a5e85b889f48eca58004d1f3a97 100644 (file)
@@ -697,7 +697,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                                if (first_command == "kickban") command_arguments = strcat(ftos(autocvar_g_ban_default_bantime), " ", ftos(autocvar_g_ban_default_masksize), " ~");
                                else command_arguments = reason;
 
-                               vote_parsed_command = strcat(first_command, " # ", ftos(num_for_edict(victim)), " ", command_arguments);
+                               vote_parsed_command = strcat(first_command, " # ", ftos(etof(victim)), " ", command_arguments);
                                vote_parsed_display = strcat("^1", vote_command, " (^7", victim.netname, "^1): ", reason);
                        }
                        else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return false; }
index 62fec55feee4890ecd8b100eaa9b51ebb38ff5af..1aa3059c8ad6a3a1e34043860c00ec30aa3166d9 100644 (file)
@@ -144,7 +144,7 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 
 // WEAPONTODO
 .float autoswitch;
-float client_hasweapon(entity cl, float wpn, float andammo, float complain);
+bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain);
 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
 void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
@@ -242,7 +242,7 @@ float bot_waypoints_for_items;
 #else
 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
 #endif
-#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, (ent).weapon, slot)
+#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, PS(ent).m_weapon.m_id, slot)
 
 // assault game mode: Which team is attacking in this round?
 float assault_attacker_team;
index dfabd9d3dc9758b24fbbe9b0a843c581685bfe4c..e5ee28cc856e266d6670573ac1f7af7e622c60cf 100644 (file)
@@ -61,8 +61,8 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
        {
                // after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon
                Weapon culprit = DEATH_WEAPONOF(deathtype);
-               if(!culprit) culprit = Weapons_from(attacker.weapon);
-               else if(!(attacker.weapons & (culprit.m_wepset))) culprit = Weapons_from(attacker.weapon);
+               if(!culprit) culprit = PS(attacker).m_weapon;
+               else if(!(attacker.weapons & (culprit.m_wepset))) culprit = PS(attacker).m_weapon;
 
                if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator?
                {
@@ -95,7 +95,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
                }
 
                // after a frag, choose another random weapon set
-               if (!(attacker.weapons & WepSet_FromWeapon(Weapons_from(attacker.weapon))))
+               if (!(attacker.weapons & WepSet_FromWeapon(PS(attacker).m_weapon)))
                        W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker));
        }
 
@@ -113,8 +113,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
 
 string AppendItemcodes(string s, entity player)
 {
-       float w;
-       w = player.weapon;
+       int w = PS(player).m_weapon.m_id;
        //if(w == 0)
        //      w = player.switchweapon;
        if(w == 0)
index cee65e1643ad76bb00787468eeccb980d7115f14..fc8bf9c8f72b8e0d0d894721b8f5cbb6270963d3 100644 (file)
@@ -56,7 +56,7 @@ float IsFlying(entity a);
 void UpdateFrags(entity player, float f);
 
 // NOTE: f=0 means still count as a (positive) kill, but count no frags for it
-void W_SwitchWeapon_Force(entity e, float w);
+void W_SwitchWeapon_Force(entity e, Weapon w);
 entity GiveFrags_randomweapons;
 void GiveFrags (entity attacker, entity targ, float f, int deathtype);
 
index 360078d2a31124fde23eb212159440944d802649..06c49907b6d7360444174160142832423b8d4a73 100644 (file)
@@ -113,7 +113,7 @@ bool GrapplingHookSend(entity this, entity to, int sf)
        WriteByte(MSG_ENTITY, sf);
        if(sf & 1)
        {
-               WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
+               WriteByte(MSG_ENTITY, etof(self.realowner));
        }
        if(sf & 2)
        {
index 36b6074590031a955c67858c583585f7791a71d4..0fa0462d87eb4d3e7b93ecd4ea2d0102fe96bfca 100644 (file)
@@ -1992,6 +1992,10 @@ void EndFrame()
                setself(e_);
                antilag_record(e_, altime);
        }
+       FOREACH_CLIENT(PS(it), {
+               PlayerState s = PS(it);
+               s.ps_push(s, it);
+       });
 }
 
 
@@ -2070,7 +2074,7 @@ void Shutdown()
        if(world_initialized > 0)
        {
                world_initialized = 0;
-               LOG_INFO("Saving persistent data...\n");
+               LOG_TRACE("Saving persistent data...\n");
                Ban_SaveBans();
 
                // playerstats with unfinished match
@@ -2093,7 +2097,7 @@ void Shutdown()
                CheatShutdown(); // must be after cheatcount check
                db_close(ServerProgsDB);
                db_close(TemporaryDB);
-               LOG_INFO("done!\n");
+               LOG_TRACE("Saving persistent data... done!\n");
                // tell the bot system the game is ending now
                bot_endgame();
 
index e7eed32b43c5931998ca8425ab7a784f542b350c..7e8f4cfd357e5930fa1ca9e7cd4da8273b1bb95e 100644 (file)
@@ -262,7 +262,7 @@ string formatmessage(string msg)
                        case "l": replacement = NearestLocation(self.origin); break;
                        case "y": replacement = NearestLocation(cursor); break;
                        case "d": replacement = NearestLocation(self.death_origin); break;
-                       case "w": replacement = WEP_NAME(((!self.weapon) ? (!self.switchweapon ? self.cnt : self.switchweapon) : self.weapon)); break;
+                       case "w": replacement = ((PS(self).m_weapon == WEP_Null) ? ((PS(self).m_switchweapon == WEP_Null) ? Weapons_from(self.cnt) : PS(self).m_switchweapon) : PS(self).m_weapon).m_name; break;
                        case "W": replacement = ammoitems; break;
                        case "x": replacement = ((cursor_ent.netname == "" || !cursor_ent) ? "nothing" : cursor_ent.netname); break;
                        case "s": replacement = ftos(vlen(self.velocity - self.velocity_z * '0 0 1')); break;
@@ -374,7 +374,11 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo)
        self.weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o));
        return o;
 }
-void GetCvars(float f)
+
+/**
+ * @param f -1: cleanup, 0: request, 1: receive
+ */
+void GetCvars(int f)
 {SELFPARAM();
        string s = string_null;
 
@@ -423,7 +427,7 @@ void GetCvars(float f)
        if (f > 0)
        {
                if (s == "cl_weaponpriority")
-                       self.switchweapon = w_getbestweapon(self);
+                       if (PS(self)) PS(self).m_switchweapon = w_getbestweapon(self);
                if (s == "cl_allow_uidtracking")
                        PlayerStats_GameReport_AddPlayer(self);
        }
@@ -444,7 +448,7 @@ string playername(entity p)
 
 float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
 {
-       int i = weaponinfo.weapon;
+       int i = weaponinfo.m_id;
        int d = 0;
        bool allow_mutatorblocked = false;
 
@@ -735,32 +739,20 @@ void precache_playermodel(string m)
 }
 void precache_all_playermodels(string pattern)
 {
-       float globhandle, i, n;
-       string f;
-
-       globhandle = search_begin(pattern, true, false);
-       if (globhandle < 0)
-               return;
-       n = search_getsize(globhandle);
-       for (i = 0; i < n; ++i)
+       int globhandle = search_begin(pattern, true, false);
+       if (globhandle < 0) return;
+       int n = search_getsize(globhandle);
+       for (int i = 0; i < n; ++i)
        {
-               //print(search_getfilename(globhandle, i), "\n");
-               f = search_getfilename(globhandle, i);
-               precache_playermodel(f);
+               string s = search_getfilename(globhandle, i);
+               precache_playermodel(s);
        }
        search_end(globhandle);
 }
 
 void precache_playermodels(string s)
 {
-       if(s != "")
-       {
-               int n = tokenize_console(s);
-               precache_playermodel(argv(0));
-
-               for (int i = 1; i < n; ++i)
-                       precache_model(argv(i));
-       }
+       FOREACH_WORD(s, true, LAMBDA(precache_playermodel(it)));
 }
 
 void precache()
@@ -1068,7 +1060,7 @@ float SUB_NoImpactCheck()
        if(trace_dphitcontents == 0)
        {
                //dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n");
-               LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin));
+               LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", etof(self), self.classname, vtos(self.origin));
                checkclient();
        }
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
index 432c32de710dead3ac8d9c185c2f05aa3a0c50c3..699f1034caf0492a1646cd7acd375202736a460e 100644 (file)
@@ -1125,8 +1125,8 @@ void ctf_FlagThink()
                                ctf_CheckFlagReturn(self, RETURN_SPEEDRUN);
 
                                setself(self.owner);
-                               self.impulse = CHIMPULSE_SPEEDRUN; // move the player back to the waypoint they set
-                               ImpulseCommands();
+                               self.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
+                               ImpulseCommands(self);
                                setself(this);
                        }
                        if(autocvar_g_ctf_stalemate)
@@ -2759,7 +2759,7 @@ void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to
        // if no teams are found, spawn defaults
        if(find(world, classname, "ctf_team") == world)
        {
-               LOG_INFO("No \"ctf_team\" entities found on this map, creating them anyway.\n");
+               LOG_TRACE("No \"ctf_team\" entities found on this map, creating them anyway.\n");
                ctf_SpawnTeam("Red", NUM_TEAM_1 - 1);
                ctf_SpawnTeam("Blue", NUM_TEAM_2 - 1);
                if(ctf_teams >= 3)
index 5e509a9daa10164088643b869edd2ab4951d7fd9..9a3481ea7ba2553e189c371a3dd1bfd3d915739a 100644 (file)
@@ -421,7 +421,7 @@ MUTATOR_HOOKFUNCTION(cts, FixClientCvars)
 
 MUTATOR_HOOKFUNCTION(cts, WantWeapon)
 {
-       ret_float = (want_weaponinfo.weapon == WEP_SHOTGUN.m_id);
+       ret_float = (want_weaponinfo == WEP_SHOTGUN);
        want_mutatorblocked = true;
        return true;
 }
index da839e5171c3810418a44de41ff6211bd785338b..b52bf8c815c9c47c94334acccbb4d2cca07e9bca 100644 (file)
@@ -695,7 +695,7 @@ void dom_DelayedInit() // Do this check with a delay so we can wait for teams to
        // if no teams are found, spawn defaults
        if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
        {
-               LOG_INFO("No \"dom_team\" entities found on this map, creating them anyway.\n");
+               LOG_TRACE("No \"dom_team\" entities found on this map, creating them anyway.\n");
                domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
                dom_spawnteams(domination_teams);
        }
index 5da71b8177bd303715397d6d73a0f9a614487b4e..0c17a479b436fe13672b0d8c993f65d5ba2cd411 100644 (file)
@@ -71,7 +71,7 @@ void tdm_DelayedInit()
        // if no teams are found, spawn defaults
        if(find(world, classname, "tdm_team") == world)
        {
-               LOG_INFO("No \"tdm_team\" entities found on this map, creating them anyway.\n");
+               LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.\n");
 
                int numteams = min(4, autocvar_g_tdm_teams_override);
 
index 5ca2c1ca99d4450c11ad86b526f23cfaa869ec74..5273a65a7f1062c32548c34874578fdb50fa059d 100644 (file)
@@ -58,7 +58,7 @@ void playerdemo_open_write(string f)
        PLAYERDEMO_FIELD(func,string,playerskin) \
        PLAYERDEMO_FIELD(func,float,frame) \
        PLAYERDEMO_FIELD(func,float,effects) \
-       PLAYERDEMO_FIELD(func,float,switchweapon) \
+       /* PLAYERDEMO_FIELD(func,float,switchweapon) */ \
        PLAYERDEMO_FIELD(func,float,BUTTON_ATCK) \
        PLAYERDEMO_FIELD(func,float,BUTTON_ATCK2) \
        PLAYERDEMO_FIELD(func,float,BUTTON_CROUCH) \
index 5c79a0d88429e478effa0bbd766e66b83e2d5d6a..8bfab2052ee2b3dc4fa9d8b488eb2f4442a3ab09 100644 (file)
@@ -76,6 +76,7 @@
 #include "../common/deathtypes/all.qc"
 #include "../common/effects/all.qc"
 #include "../common/gamemodes/all.qc"
+#include "../common/impulses/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/turrets/all.qc"
diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src
deleted file mode 100644 (file)
index 9ba92b4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../../progs.dat
-progs.inc
index 03f3dbba37208d2eed5c5c8cc26fd18e628d3f49..e29d1723ba0aaa24abfaa124be7504695f80db9c 100644 (file)
@@ -59,7 +59,9 @@ bool TeamScore_SendEntity(entity this, entity to, float sendflags)
        float i, p, longflags;
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
-       WriteByte(MSG_ENTITY, self.team - 1);
+       int t = this.team - 1;
+       assert(t, eprint(this));
+       WriteByte(MSG_ENTITY, t);
 
        longflags = 0;
        for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
@@ -233,7 +235,7 @@ bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
        float i, p, longflags;
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
-       WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+       WriteByte(MSG_ENTITY, etof(self.owner));
 
        longflags = 0;
        for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
@@ -381,7 +383,7 @@ float PlayerScore_Compare(entity t1, entity t2, float strict)
        }
 
        if (result.x == 0 && strict)
-               result.x = num_for_edict(t1.owner) - num_for_edict(t2.owner);
+               result.x = etof(t1.owner) - etof(t2.owner);
 
        return result.x;
 }
index 36b08008e8b7dedfa643c1b931a60187c18a7e82..55662892acdff8160f7a6fefd5d625754b17bdf9 100644 (file)
@@ -30,7 +30,7 @@ bool SpawnEvent_Send(entity this, entity to, int sf)
 
        if(autocvar_g_spawn_alloweffects)
        {
-               WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+               WriteByte(MSG_ENTITY, etof(self.owner));
                WriteShort(MSG_ENTITY, self.owner.origin.x);
                WriteShort(MSG_ENTITY, self.owner.origin.y);
                WriteShort(MSG_ENTITY, self.owner.origin.z);
index 90e9f79384cd3dfc4eaaf8fdddb6fedf4d4b3fe4..1e9d3a766c18bfc784837d09cfe85a5e3ff8f8c3 100644 (file)
@@ -234,6 +234,7 @@ void StartFrame()
 float DoesQ3ARemoveThisEntity();
 void SV_OnEntityPreSpawnFunction()
 {SELFPARAM();
+       __spawnfunc_expect = this;
        if (self)
        if (self.gametypefilter != "")
        if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter))
index 97f63fc298db513777a5c84201a3e0738ede88b6..35fd8783205a9d2f017b263bcae1a04bf0d50302 100644 (file)
@@ -492,7 +492,7 @@ void Item_RespawnCountdown ()
                        do {
                                {
                                        entity wi = Weapons_from(self.weapon);
-                                       if (wi.m_id) {
+                                       if (wi != WEP_Null) {
                                                entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon);
                                                wp.wp_extra = wi.m_id;
                                                break;
@@ -500,7 +500,7 @@ void Item_RespawnCountdown ()
                                }
                                {
                                        entity ii = self.itemdef;
-                                       if (ii.m_id) {
+                                       if (ii != NULL) {
                                                entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Item);
                                                wp.wp_extra = ii.m_id;
                                                break;
@@ -642,10 +642,10 @@ float Item_GiveTo(entity item, entity player)
        // if the player is using their best weapon before items are given, they
        // probably want to switch to an even better weapon after items are given
        if (player.autoswitch)
-       if (player.switchweapon == w_getbestweapon(player))
+       if (PS(player).m_switchweapon == w_getbestweapon(player))
                _switchweapon = true;
 
-       if (!(player.weapons & WepSet_FromWeapon(Weapons_from(player.switchweapon))))
+       if (!(player.weapons & WepSet_FromWeapon(PS(player).m_switchweapon)))
                _switchweapon = true;
 
        pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
@@ -710,12 +710,12 @@ float Item_GiveTo(entity item, entity player)
        // crude hack to enforce switching weapons
        if(g_cts && item.itemdef.instanceOfWeaponPickup)
        {
-               W_SwitchWeapon_Force(player, item.weapon);
+               W_SwitchWeapon_Force(player, Weapons_from(item.weapon));
                return 1;
        }
 
        if (_switchweapon)
-               if (player.switchweapon != w_getbestweapon(player))
+               if (PS(player).m_switchweapon != w_getbestweapon(player))
                        W_SwitchWeapon_Force(player, w_getbestweapon(player));
 
        return 1;
@@ -1208,10 +1208,10 @@ void StartItem(entity this, GameItem def)
 
 spawnfunc(item_rockets)
 {
-       if(!self.ammo_rockets)
-               self.ammo_rockets = g_pickup_rockets;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_rockets)
+               this.ammo_rockets = g_pickup_rockets;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
     StartItem(this, ITEM_Rockets);
 }
 
@@ -1219,7 +1219,7 @@ spawnfunc(item_bullets)
 {
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
-       if(self.classname != "droppedweapon")
+       if(this.classname != "droppedweapon")
        {
                weaponswapping = true;
                spawnfunc_item_shells(this);
@@ -1227,28 +1227,28 @@ spawnfunc(item_bullets)
                return;
        }
 
-       if(!self.ammo_nails)
-               self.ammo_nails = g_pickup_nails;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_nails)
+               this.ammo_nails = g_pickup_nails;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
     StartItem(this, ITEM_Bullets);
 }
 
 spawnfunc(item_cells)
 {
-       if(!self.ammo_cells)
-               self.ammo_cells = g_pickup_cells;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_cells)
+               this.ammo_cells = g_pickup_cells;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Cells);
 }
 
 spawnfunc(item_plasma)
 {
-       if(!self.ammo_plasma)
-               self.ammo_plasma = g_pickup_plasma;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_plasma)
+               this.ammo_plasma = g_pickup_plasma;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Plasma);
 }
 
@@ -1256,7 +1256,7 @@ spawnfunc(item_shells)
 {
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
-       if(self.classname != "droppedweapon")
+       if(this.classname != "droppedweapon")
        {
                weaponswapping = true;
                spawnfunc_item_bullets(this);
@@ -1264,98 +1264,98 @@ spawnfunc(item_shells)
                return;
        }
 
-       if(!self.ammo_shells)
-               self.ammo_shells = g_pickup_shells;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_shells)
+               this.ammo_shells = g_pickup_shells;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Shells);
 }
 
 spawnfunc(item_armor_small)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armorsmall;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armorsmall_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armorsmall_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armorsmall;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armorsmall_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armorsmall_anyway;
        StartItem(this, ITEM_ArmorSmall);
 }
 
 spawnfunc(item_armor_medium)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armormedium;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armormedium_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armormedium_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armormedium;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armormedium_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armormedium_anyway;
        StartItem(this, ITEM_ArmorMedium);
 }
 
 spawnfunc(item_armor_big)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armorbig;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armorbig_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armorbig_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armorbig;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armorbig_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armorbig_anyway;
        StartItem(this, ITEM_ArmorLarge);
 }
 
 spawnfunc(item_armor_large)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armorlarge;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armorlarge_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armorlarge_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armorlarge;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armorlarge_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armorlarge_anyway;
        StartItem(this, ITEM_ArmorMega);
 }
 
 spawnfunc(item_health_small)
 {
-       if(!self.max_health)
-               self.max_health = g_pickup_healthsmall_max;
-       if(!self.health)
-               self.health = g_pickup_healthsmall;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_healthsmall_anyway;
+       if(!this.max_health)
+               this.max_health = g_pickup_healthsmall_max;
+       if(!this.health)
+               this.health = g_pickup_healthsmall;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_healthsmall_anyway;
        StartItem(this, ITEM_HealthSmall);
 }
 
 spawnfunc(item_health_medium)
 {
-       if(!self.max_health)
-               self.max_health = g_pickup_healthmedium_max;
-       if(!self.health)
-               self.health = g_pickup_healthmedium;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_healthmedium_anyway;
+       if(!this.max_health)
+               this.max_health = g_pickup_healthmedium_max;
+       if(!this.health)
+               this.health = g_pickup_healthmedium;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_healthmedium_anyway;
     StartItem(this, ITEM_HealthMedium);
 }
 
 spawnfunc(item_health_large)
 {
-       if(!self.max_health)
-               self.max_health = g_pickup_healthlarge_max;
-       if(!self.health)
-               self.health = g_pickup_healthlarge;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_healthlarge_anyway;
+       if(!this.max_health)
+               this.max_health = g_pickup_healthlarge_max;
+       if(!this.health)
+               this.health = g_pickup_healthlarge;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_healthlarge_anyway;
        StartItem(this, ITEM_HealthLarge);
 }
 
 spawnfunc(item_health_mega)
 {
-    if(!self.max_health)
-        self.max_health = g_pickup_healthmega_max;
-    if(!self.health)
-        self.health = g_pickup_healthmega;
-    if(!self.pickup_anyway)
-        self.pickup_anyway = g_pickup_healthmega_anyway;
+    if(!this.max_health)
+        this.max_health = g_pickup_healthmega_max;
+    if(!this.health)
+        this.health = g_pickup_healthmega;
+    if(!this.pickup_anyway)
+        this.pickup_anyway = g_pickup_healthmega_anyway;
     StartItem(this, ITEM_HealthMega);
 }
 
@@ -1368,20 +1368,20 @@ spawnfunc(item_health100) { spawnfunc_item_health_mega(this); }
 
 spawnfunc(item_strength)
 {
-               if(!self.strength_finished)
-                       self.strength_finished = autocvar_g_balance_powerup_strength_time;
+               if(!this.strength_finished)
+                       this.strength_finished = autocvar_g_balance_powerup_strength_time;
                StartItem(this, ITEM_Strength);
 }
 
 spawnfunc(item_invincible)
 {
-               if(!self.invincible_finished)
-                       self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+               if(!this.invincible_finished)
+                       this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
                StartItem(this, ITEM_Shield);
 }
 
 // compatibility:
-spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);}
+spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
 
 void target_items_use()
 {SELFPARAM();
@@ -1448,8 +1448,7 @@ spawnfunc(target_items)
                                        {
                                                self.weapons |= (e.m_wepset);
                                                if(self.spawnflags == 0 || self.spawnflags == 2) {
-                                                       Weapon w = Weapons_from(e.weapon);
-                                                       w.wr_init(w);
+                                                       e.wr_init(e);
                                                }
                                                break;
                                        }
@@ -1505,8 +1504,8 @@ spawnfunc(target_items)
                for(j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
                        e = Weapons_from(j);
-                       if(e.weapon)
-                               self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (e.m_wepset)), e.netname);
+                       if(e == WEP_Null) continue;
+                       self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (e.m_wepset)), e.netname);
                }
        }
        self.netname = strzone(self.netname);
@@ -1520,8 +1519,7 @@ spawnfunc(target_items)
                        e = Weapons_from(j);
                        if(argv(i) == e.netname)
                        {
-                               Weapon w = Weapons_from(e.weapon);
-                               w.wr_init(w);
+                               e.wr_init(e);
                                break;
                        }
                }
@@ -1530,10 +1528,10 @@ spawnfunc(target_items)
 
 spawnfunc(item_fuel)
 {
-       if(!self.ammo_fuel)
-               self.ammo_fuel = g_pickup_fuel;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_fuel)
+               this.ammo_fuel = g_pickup_fuel;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_JetpackFuel);
 }
 
@@ -1549,8 +1547,8 @@ spawnfunc(item_fuel_regen)
 
 spawnfunc(item_jetpack)
 {
-       if(!self.ammo_fuel)
-               self.ammo_fuel = g_pickup_fuel_jetpack;
+       if(!this.ammo_fuel)
+               this.ammo_fuel = g_pickup_fuel_jetpack;
        if(start_items & ITEM_Jetpack.m_itemid)
        {
                spawnfunc_item_fuel(this);
@@ -1627,7 +1625,7 @@ float GiveItems(entity e, float beginarg, float endarg)
 
        _switchweapon = false;
        if (e.autoswitch)
-               if (e.switchweapon == w_getbestweapon(e))
+               if (PS(e).m_switchweapon == w_getbestweapon(e))
                        _switchweapon = true;
 
        e.strength_finished = max(0, e.strength_finished - time);
@@ -1689,9 +1687,9 @@ float GiveItems(entity e, float beginarg, float endarg)
                                for(j = WEP_FIRST; j <= WEP_LAST; ++j)
                                {
                                        wi = Weapons_from(j);
-                                       if(wi.weapon)
-                                               if (!(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED))
-                                                       got += GiveWeapon(e, j, op, val);
+                                       if(wi == WEP_Null) continue;
+                                       if (!(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED))
+                                               got += GiveWeapon(e, j, op, val);
                                }
                        case "allammo":
                                got += GiveValue(e, ammo_cells, op, val);
@@ -1775,15 +1773,12 @@ float GiveItems(entity e, float beginarg, float endarg)
        for(j = WEP_FIRST; j <= WEP_LAST; ++j)
        {
                wi = Weapons_from(j);
-               if(wi.weapon)
-               {
-                       POSTGIVE_WEAPON(e, Weapons_from(j), SND(WEAPONPICKUP), string_null);
-                       if (!(save_weapons & (wi.m_wepset)))
-                               if(e.weapons & (wi.m_wepset)) {
-                                       Weapon w = Weapons_from(wi.weapon);
-                                       w.wr_init(w);
-                               }
-               }
+               if (wi == WEP_Null) continue;
+               POSTGIVE_WEAPON(e, Weapons_from(j), SND(WEAPONPICKUP), string_null);
+               if (!(save_weapons & (wi.m_wepset)))
+                       if(e.weapons & (wi.m_wepset)) {
+                               wi.wr_init(wi);
+                       }
        }
        POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF));
        POSTGIVE_VALUE(e, invincible_finished, 1, "misc/powerup_shield.wav", SND(POWEROFF));
@@ -1813,7 +1808,7 @@ float GiveItems(entity e, float beginarg, float endarg)
        else
                e.superweapons_finished += time;
 
-       if (!(e.weapons & WepSet_FromWeapon(Weapons_from(e.switchweapon))))
+       if (!(e.weapons & WepSet_FromWeapon(PS(e).m_switchweapon)))
                _switchweapon = true;
        if(_switchweapon)
                W_SwitchWeapon_Force(e, w_getbestweapon(e));
index ec48c6d3cea09c19bb6498cc9f1c47691c7aad4c..9846443647a921fa99e3effbc1cf669383c1be42 100644 (file)
@@ -71,7 +71,7 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright,
                        antilag_takeback(trace_ent, time - lag);
                        hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
                        antilag_restore(trace_ent);
-                       fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.switchweapon), "\n"));
+                       fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(PS(player).m_switchweapon.m_id), "\n"));
                        //print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
                }
        }
index b301da6f2e46ff7eb44cf0929fbce458b0537deb..1c286829f6d506c7fd007b56fcf982a931361c87 100644 (file)
@@ -17,28 +17,28 @@ void Send_WeaponComplain(entity e, float wpn, float type)
        WriteByte(MSG_ONE, type);
 }
 
-float client_hasweapon(entity cl, float wpn, float andammo, float complain)
-{SELFPARAM();
+bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain)
+{
        float f;
 
-       if(time < self.hasweapon_complain_spam)
+       if (time < cl.hasweapon_complain_spam)
                complain = 0;
 
        // ignore hook button when using other offhand equipment
        if (cl.offhand != OFFHAND_HOOK)
-       if (wpn == WEP_HOOK.m_id && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(Weapons_from(wpn))))
+       if (wpn == WEP_HOOK && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
            complain = 0;
 
-       if(complain)
-               self.hasweapon_complain_spam = time + 0.2;
+       if (complain)
+               cl.hasweapon_complain_spam = time + 0.2;
 
-       if (wpn < WEP_FIRST || wpn > WEP_LAST)
+       if (wpn == WEP_Null)
        {
                if (complain)
-                       sprint(self, "Invalid weapon\n");
+                       sprint(cl, "Invalid weapon\n");
                return false;
        }
-       if (cl.weapons & WepSet_FromWeapon(Weapons_from(wpn)))
+       if (cl.weapons & WepSet_FromWeapon(wpn))
        {
                if (andammo)
                {
@@ -48,17 +48,14 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                        }
                        else
                        {
-                               setself(cl);
-                               Weapon w = Weapons_from(wpn);
-                               f = w.wr_checkammo1(w) + w.wr_checkammo2(w);
+                               WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                entity mine;
-                               if(wpn == WEP_MINE_LAYER.m_id)
-                               for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
+                               if(wpn == WEP_MINE_LAYER)
+                               for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == cl)
                                        f = 1;
 
-                               setself(this);
                        }
                        if (!f)
                        {
@@ -66,7 +63,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                                if(IS_REAL_CLIENT(cl))
                                {
                                        play2(cl, SND(UNAVAILABLE));
-                                       Send_WeaponComplain (cl, wpn, 0);
+                                       Send_WeaponComplain (cl, wpn.m_id, 0);
                                }
                                return false;
                        }
@@ -77,15 +74,13 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
        {
                // DRESK - 3/16/07
                // Report Proper Weapon Status / Modified Weapon Ownership Message
-               if (weaponsInMap & WepSet_FromWeapon(Weapons_from(wpn)))
+               if (weaponsInMap & WepSet_FromWeapon(wpn))
                {
-                       Send_WeaponComplain(cl, wpn, 1);
+                       Send_WeaponComplain(cl, wpn.m_id, 1);
 
                        if(autocvar_g_showweaponspawns)
                        {
-                               entity e;
-
-                               for(e = world; (e = findfloat(e, weapon, wpn)); )
+                               for(entity e = world; (e = findfloat(e, weapon, wpn.m_id)); )
                                {
                                        if(e.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
                                                continue;
@@ -95,18 +90,18 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                                                WP_Weapon,
                                                1, 0,
                                                world, e.origin + ('0 0 1' * e.maxs.z) * 1.2,
-                                               self, 0,
+                                               cl, 0,
                                                world, enemy,
                                                0,
                                                RADARICON_NONE
                                        );
-                                       wp.wp_extra = wpn;
+                                       wp.wp_extra = wpn.m_id;
                                }
                        }
                }
                else
                {
-                       Send_WeaponComplain (cl, wpn, 2);
+                       Send_WeaponComplain (cl, wpn.m_id, 2);
                }
 
                play2(cl, SND(UNAVAILABLE));
@@ -126,7 +121,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        entity wep;
 
        if(skipmissing || pl.selectweapon == 0)
-               weaponcur = pl.switchweapon;
+               weaponcur = PS(pl).m_switchweapon.m_id;
        else
                weaponcur = pl.selectweapon;
 
@@ -145,15 +140,13 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                if(wep.impulse != imp)
                        continue;
 
-               float i, have_other = false;
-               for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-               {
-                       Weapon e = Weapons_from(i);
+               bool have_other = false;
+               FOREACH(Weapons, it != WEP_Null, {
                        if(i != weaponwant)
-                       if(e.impulse == imp || imp < 0)
-                       if((pl.weapons & (e.m_wepset)) || (weaponsInMap & (e.m_wepset)))
+                       if(it.impulse == imp || imp < 0)
+                       if((pl.weapons & (it.m_wepset)) || (weaponsInMap & (it.m_wepset)))
                                have_other = true;
-               }
+               });
 
                // skip weapons we don't own that aren't normal and aren't in the map
                if(!(pl.weapons & wepset))
@@ -163,7 +156,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
 
                ++c;
 
-               if(!skipmissing || client_hasweapon(pl, weaponwant, true, false))
+               if(!skipmissing || client_hasweapon(pl, wep, true, false))
                {
                        if(switchtonext)
                                return weaponwant;
@@ -203,15 +196,13 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                                if(wep.impulse != imp)
                                        continue;
 
-                       float i, have_other = false;
-                       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-                       {
-                               Weapon w = Weapons_from(i);
+                       bool have_other = false;
+                       FOREACH(Weapons, it != WEP_Null, {
                                if(i != weaponwant)
-                               if(w.impulse == imp || imp < 0)
-                               if((pl.weapons & (w.m_wepset)) || (weaponsInMap & (w.m_wepset)))
+                               if(it.impulse == imp || imp < 0)
+                               if((pl.weapons & (it.m_wepset)) || (weaponsInMap & (it.m_wepset)))
                                        have_other = true;
-                       }
+                       });
 
                        // skip weapons we don't own that aren't normal and aren't in the map
                        if(!(pl.weapons & wepset))
@@ -222,7 +213,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                        --c;
                        if(c == 0)
                        {
-                               client_hasweapon(pl, weaponwant, true, true);
+                               client_hasweapon(pl, wep, true, true);
                                break;
                        }
                }
@@ -230,19 +221,19 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        return 0;
 }
 
-void W_SwitchWeapon_Force(entity e, float w)
+void W_SwitchWeapon_Force(entity e, Weapon wep)
 {
-       e.cnt = e.switchweapon;
-       e.switchweapon = w;
-       e.selectweapon = w;
+       e.cnt = PS(e).m_switchweapon.m_id;
+       PS(e).m_switchweapon = wep;
+       e.selectweapon = wep.m_id;
 }
 
 // perform weapon to attack (weaponstate and attack_finished check is here)
 void W_SwitchToOtherWeapon(entity pl)
 {
        // hack to ensure it switches to an OTHER weapon (in case the other fire mode still has ammo, we want that anyway)
-       int ww;
-       WepSet set = WepSet_FromWeapon(Weapons_from(pl.weapon));
+       Weapon ww;
+       WepSet set = WepSet_FromWeapon(PS(pl).m_weapon);
        if(pl.weapons & set)
        {
                pl.weapons &= ~set;
@@ -255,17 +246,16 @@ void W_SwitchToOtherWeapon(entity pl)
                W_SwitchWeapon_Force(pl, ww);
 }
 
-void W_SwitchWeapon(float imp)
+void W_SwitchWeapon(Weapon w)
 {SELFPARAM();
-       if (self.switchweapon != imp)
+       if (PS(self).m_switchweapon != w)
        {
-               if (client_hasweapon(self, imp, true, true))
-                       W_SwitchWeapon_Force(self, imp);
+               if (client_hasweapon(self, w, true, true))
+                       W_SwitchWeapon_Force(self, w);
                else
-                       self.selectweapon = imp; // update selectweapon ANYWAY
+                       self.selectweapon = w.m_id; // update selectweapon ANYWAY
        }
        else if(!forbidWeaponUse(self)) {
-               Weapon w = Weapons_from(self.weapon);
                w.wr_reload(w);
        }
 }
@@ -275,7 +265,7 @@ void W_CycleWeapon(string weaponorder, float dir)
        float w;
        w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, true);
        if(w > 0)
-               W_SwitchWeapon(w);
+               W_SwitchWeapon(Weapons_from(w));
 }
 
 void W_NextWeaponOnImpulse(float imp)
@@ -283,7 +273,7 @@ void W_NextWeaponOnImpulse(float imp)
        float w;
        w = W_GetCycleWeapon(self, self.cvar_cl_weaponpriority, +1, imp, 1, (self.cvar_cl_weaponimpulsemode == 0));
        if(w > 0)
-               W_SwitchWeapon(w);
+               W_SwitchWeapon(Weapons_from(w));
 }
 
 // next weapon
@@ -311,8 +301,9 @@ void W_PreviousWeapon(float list)
 // previously used if exists and has ammo, (second) best otherwise
 void W_LastWeapon()
 {SELFPARAM();
-       if(client_hasweapon(self, self.cnt, true, false))
-               W_SwitchWeapon(self.cnt);
+       Weapon wep = Weapons_from(self.cnt);
+       if(client_hasweapon(self, wep, true, false))
+               W_SwitchWeapon(wep);
        else
                W_SwitchToOtherWeapon(self);
 }
index d51addd7d9ab729b5d9517982f038bb09bd0dee9..18e3f5a1c99cb1d62dd03f0656930b36d88ee84e 100644 (file)
@@ -5,18 +5,18 @@
 void Send_WeaponComplain(entity e, float wpn, float type);
 
 .float hasweapon_complain_spam;
-float client_hasweapon(entity cl, float wpn, float andammo, float complain);
+bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain);
 
 .int weaponcomplainindex;
 float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing);
 
-#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true)
+#define w_getbestweapon(ent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true))
 
-void W_SwitchWeapon_Force(entity e, float w);
+void W_SwitchWeapon_Force(entity e, Weapon w);
 
 // perform weapon to attack (weaponstate and attack_finished check is here)
 void W_SwitchToOtherWeapon(entity pl);
-void W_SwitchWeapon(float imp);
+void W_SwitchWeapon(Weapon imp);
 
 void W_CycleWeapon(string weaponorder, float dir);
 
index c362913d45aa3cc8f2039640b39d62c791204ba0..d6a108b52d6092e24ac79ae1b43998746849364f 100644 (file)
@@ -7,30 +7,19 @@
 
 string W_Apply_Weaponreplace(string in)
 {
-       float n = tokenize_console(in);
-       string out = "", s, replacement;
-       float i, j;
-       entity e;
-       for(i = 0; i < n; ++i)
-       {
-               replacement = "";
-               s = argv(i);
-
-               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+       string out = "";
+       FOREACH_WORD(in, true, {
+               string replacement = "";
+               Weapon w = Weapons_fromstr(it);
+               if (w)
                {
-                       e = Weapons_from(j);
-                       if(e.netname == s)
-                       {
-                               replacement = e.weaponreplace;
-                       }
+            replacement = w.weaponreplace;
+            if (replacement == "") replacement = it;
                }
-
-               if(replacement == "")
-                       out = strcat(out, " ", s);
-               else if(replacement != "0")
-                       out = strcat(out, " ", replacement);
-       }
-       return substring(out, 1, -1);
+               if (replacement == "0") continue;
+               out = cons(out, replacement);
+       });
+       return out;
 }
 
 void weapon_defaultspawnfunc(entity this, Weapon e)
@@ -125,10 +114,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
 
        if (e.spawnflags & WEP_FLAG_SUPERWEAPON)
                if (!this.superweapons_finished)
-               {
                        this.superweapons_finished = autocvar_g_balance_superweapons_time;
-                       LOG_INFO("Setting it to ", ftos(this.superweapons_finished), " on ", e.mdl, "\n");
-               }
 
        // if we don't already have ammo, give us some ammo
        if (!this.(e.ammo_field))
index 652ec92005aba884ea26c3955b42644fb33a6726..1bd88e16f66417ab4dbe7c83ef178b9e9da30b70 100644 (file)
@@ -97,10 +97,11 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                if(doreduce && g_weapon_stay == 2)
                {
                        // if our weapon is loaded, give its load back to the player
-                       if(self.(weapon_load[self.weapon]) > 0)
+                       int i = PS(self).m_weapon.m_id;
+                       if(self.(weapon_load[i]) > 0)
                        {
-                               own.(ammotype) += self.(weapon_load[self.weapon]);
-                               self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
+                               own.(ammotype) += self.(weapon_load[i]);
+                               self.(weapon_load[i]) = -1; // schedule the weapon for reloading
                        }
 
                        wep.(ammotype) = 0;
@@ -108,10 +109,11 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                else if(doreduce)
                {
                        // if our weapon is loaded, give its load back to the player
-                       if(self.(weapon_load[self.weapon]) > 0)
+                       int i = PS(self).m_weapon.m_id;
+                       if(self.(weapon_load[i]) > 0)
                        {
-                               own.(ammotype) += self.(weapon_load[self.weapon]);
-                               self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
+                               own.(ammotype) += self.(weapon_load[i]);
+                               self.(weapon_load[i]) = -1; // schedule the weapon for reloading
                        }
 
                        thisammo = min(own.(ammotype), wep.(ammotype));
@@ -165,8 +167,8 @@ bool W_IsWeaponThrowable(bool w)
 // toss current weapon
 void W_ThrowWeapon(vector velo, vector delta, float doreduce)
 {SELFPARAM();
-       int w = self.weapon;
-       if (w == WEP_Null.m_id)
+       Weapon w = PS(self).m_weapon;
+       if (w == WEP_Null)
                return; // just in case
        if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon))
                return;
@@ -175,23 +177,23 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
        if(self.(weaponentity).state != WS_READY)
                return;
-       if(!W_IsWeaponThrowable(w))
+       if(!W_IsWeaponThrowable(w.m_id))
                return;
 
-       WepSet set = WepSet_FromWeapon(Weapons_from(w));
+       WepSet set = WepSet_FromWeapon(w);
        if(!(self.weapons & set)) return;
        self.weapons &= ~set;
 
        W_SwitchWeapon_Force(self, w_getbestweapon(self));
-       string a = W_ThrowNewWeapon(self, w, doreduce, self.origin + delta, velo);
+       string a = W_ThrowNewWeapon(self, w.m_id, doreduce, self.origin + delta, velo);
 
        if(!a) return;
-       Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w);
+       Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
 }
 
 void SpawnThrownWeapon(vector org, float w)
 {SELFPARAM();
-       if(self.weapons & WepSet_FromWeapon(Weapons_from(self.weapon)))
-               if(W_IsWeaponThrowable(self.weapon))
-                       W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200');
+       if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon))
+               if(W_IsWeaponThrowable(PS(self).m_weapon.m_id))
+                       W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
 }
index ea0faa845b3ad6974ae040e656286ec3a12a004f..2d9dd23886b99e8f472fb46509252b29d54bf7e6 100644 (file)
@@ -25,7 +25,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        float oldsolid;
        vector vecs, dv;
        oldsolid = ent.dphitcontentsmask;
-       if(ent.weapon == WEP_RIFLE.m_id)
+       if(PS(ent).m_weapon == WEP_RIFLE)
                ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
        else
                ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
@@ -51,7 +51,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
 
        // track max damage
        if(accuracy_canbegooddamage(ent))
-               accuracy_add(ent, ent.weapon, maxdamage, 0);
+               accuracy_add(ent, PS(ent).m_weapon.m_id, maxdamage, 0);
 
        W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
 
@@ -331,7 +331,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        }
 
        // calculate hits and fired shots for hitscan
-       accuracy_add(self, self.weapon, 0, min(bdamage, totaldmg));
+       accuracy_add(self, PS(self).m_weapon.m_id, 0, min(bdamage, totaldmg));
 
        trace_endpos = endpoint;
        trace_ent = endent;
@@ -434,7 +434,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
                                // do not exceed 100%
                                float added_damage = min(damage - total_damage, damage * solid_penetration_left);
                                total_damage += damage * solid_penetration_left;
-                               accuracy_add(self, self.weapon, 0, added_damage);
+                               accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
                        }
                }
 
index 7607ae18c57ce2a1a7f8386173abe3eb55ba1cb7..919c88809c3dd80709f5d7abffde4a4d566190a4 100644 (file)
@@ -185,11 +185,8 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity)
 // Weapon subs
 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if (actor.weapon != -1)
-       {
-               actor.weapon = 0;
-               actor.switchingweapon = 0;
-       }
+       PS(actor).m_weapon = WEP_Null;
+       PS(actor).m_switchingweapon = WEP_Null;
        entity this = actor.(weaponentity);
        if (this)
        {
@@ -222,7 +219,7 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
        if (thiswep == WEP_SHOTGUN)
                if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false;           // no clicking, just allow
 
-       if (thiswep == Weapons_from(actor.switchweapon) && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
+       if (thiswep == PS(actor).m_switchweapon && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
        {
                sound(actor, CH_WEAPON_A, SND_DRYFIRE, VOL_BASE, ATTEN_NORM);
                actor.prevdryfire = time;
@@ -269,7 +266,7 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponenti
                return false;
 
        // do not even think about shooting if switching
-       if (actor.switchweapon != actor.weapon) return false;
+       if (PS(actor).m_switchweapon != PS(actor).m_weapon) return false;
 
        if (attacktime >= 0)
        {
@@ -386,7 +383,7 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
 
        if ((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
        {
-               int act = (fr == WFRAME_FIRE2 && (actor.weapon == WEP_SHOCKWAVE.m_id || actor.weapon == WEP_SHOTGUN.m_id))
+               int act = (fr == WFRAME_FIRE2 && (PS(actor).m_weapon == WEP_SHOCKWAVE || PS(actor).m_weapon == WEP_SHOTGUN))
                        ? ANIMACTION_MELEE
                        : ANIMACTION_SHOOT
                        ;
@@ -423,16 +420,16 @@ void W_WeaponFrame(entity actor)
        {
                if (actor.(weaponentity).state != WS_CLEAR)
                {
-                       Weapon wpn = Weapons_from(actor.weapon);
+                       Weapon wpn = PS(actor).m_weapon;
                        w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
                        return;
                }
        }
 
-       if (actor.switchweapon == 0)
+       if (PS(actor).m_switchweapon == WEP_Null)
        {
-               actor.weapon = 0;
-               actor.switchingweapon = 0;
+               PS(actor).m_weapon = WEP_Null;
+               PS(actor).m_switchingweapon = WEP_Null;
                this.state = WS_CLEAR;
                actor.weaponname = "";
                // actor.items &= ~IT_AMMO;
@@ -445,7 +442,7 @@ void W_WeaponFrame(entity actor)
        vector up = v_up;
 
        // Change weapon
-       if (actor.weapon != actor.switchweapon)
+       if (PS(actor).m_weapon != PS(actor).m_switchweapon)
        {
                switch (this.state)
                {
@@ -458,11 +455,11 @@ void W_WeaponFrame(entity actor)
                        case WS_CLEAR:
                        {
                                // end switching!
-                               actor.switchingweapon = actor.switchweapon;
-                               entity newwep = Weapons_from(actor.switchweapon);
+                               Weapon newwep = PS(actor).m_switchweapon;
+                               PS(actor).m_switchingweapon = newwep;
 
                                // the two weapon entities will notice this has changed and update their models
-                               actor.weapon = actor.switchweapon;
+                               PS(actor).m_weapon = newwep;
                                actor.weaponname = newwep.mdl;
                                actor.bulletcounter = 0;
                                actor.ammo_field = newwep.ammo_field;
@@ -472,7 +469,7 @@ void W_WeaponFrame(entity actor)
                                // set our clip load to the load of the weapon we switched to, if it's reloadable
                                if ((newwep.spawnflags & WEP_FLAG_RELOADABLE) && newwep.reloading_ammo)  // prevent accessing undefined cvars
                                {
-                                       actor.clip_load = actor.(weapon_load[actor.switchweapon]);
+                                       actor.clip_load = actor.(weapon_load[PS(actor).m_switchweapon.m_id]);
                                        actor.clip_size = newwep.reloading_ammo;
                                }
                                else
@@ -486,14 +483,14 @@ void W_WeaponFrame(entity actor)
                        case WS_DROP:
                        {
                                // in dropping phase we can switch at any time
-                               actor.switchingweapon = actor.switchweapon;
+                               PS(actor).m_switchingweapon = PS(actor).m_switchweapon;
                                break;
                        }
                        case WS_READY:
                        {
                                // start switching!
-                               actor.switchingweapon = actor.switchweapon;
-                               entity oldwep = Weapons_from(actor.weapon);
+                               PS(actor).m_switchingweapon = PS(actor).m_switchweapon;
+                               entity oldwep = PS(actor).m_weapon;
 
                                // set up weapon switch think in the future, and start drop anim
                                if (INDEPENDENT_ATTACK_FINISHED || ATTACK_FINISHED(actor, weaponslot(weaponentity)) <= time + actor.weapon_frametime * 0.5)
@@ -511,7 +508,7 @@ void W_WeaponFrame(entity actor)
        // if (actor.button0)
        //      print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor, slot)), " >= ", ftos(this.weapon_nextthink), "\n");
 
-       int w = actor.weapon;
+       int w = PS(actor).m_weapon.m_id;
 
        // call the think code which may fire the weapon
        // and do so multiple times to resolve framerate dependency issues if the
@@ -520,7 +517,7 @@ void W_WeaponFrame(entity actor)
        {
                if (w && !(actor.weapons & WepSet_FromWeapon(Weapons_from(w))))
                {
-                       if (actor.weapon == actor.switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+                       if (PS(actor).m_weapon == PS(actor).m_switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
                        w = 0;
                }
 
@@ -538,11 +535,11 @@ void W_WeaponFrame(entity actor)
                        }
                        else
                        {
-                               if (key_pressed && actor.switchweapon != WEP_HOOK.m_id && !actor.hook_switchweapon) W_SwitchWeapon(
-                                               WEP_HOOK.m_id);
+                               if (key_pressed && PS(actor).m_switchweapon != WEP_HOOK && !actor.hook_switchweapon)
+                                       W_SwitchWeapon(WEP_HOOK);
                                actor.hook_switchweapon = key_pressed;
                                Weapon h = WEP_HOOK;
-                               block_weapon = (actor.weapon == h.m_id && (actor.BUTTON_ATCK || key_pressed));
+                               block_weapon = (PS(actor).m_weapon == h && (actor.BUTTON_ATCK || key_pressed));
                                h.wr_think(h, actor, weaponentity, block_weapon ? 1 : 0);
                        }
                }
@@ -555,12 +552,12 @@ void W_WeaponFrame(entity actor)
                {
                        if (w)
                        {
-                               Weapon e = Weapons_from(actor.weapon);
+                               Weapon e = PS(actor).m_weapon;
                                e.wr_think(e, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
                        }
                        else
                        {
-                               Weapon w = Weapons_from(actor.weapon);
+                               Weapon w = PS(actor).m_weapon;
                                w.wr_gonethink(w);
                        }
                }
@@ -572,7 +569,7 @@ void W_WeaponFrame(entity actor)
                                v_forward = fo;
                                v_right = ri;
                                v_up = up;
-                               Weapon wpn = Weapons_from(actor.weapon);
+                               Weapon wpn = PS(actor).m_weapon;
                                this.weapon_think(wpn, actor, weaponentity,
                                        (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
                        }
@@ -625,7 +622,7 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use)
        if (wep.reloading_ammo)
        {
                actor.clip_load -= ammo_use;
-               actor.(weapon_load[actor.weapon]) = actor.clip_load;
+               actor.(weapon_load[PS(actor).m_weapon.m_id]) = actor.clip_load;
        }
        else if (wep.ammo_field != ammo_none)
        {
@@ -669,7 +666,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int
                actor.clip_load += load;
                actor.(actor.ammo_field) -= load;
        }
-       actor.(weapon_load[actor.weapon]) = actor.clip_load;
+       actor.(weapon_load[PS(actor).m_weapon.m_id]) = actor.clip_load;
 
        // do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon,
        // then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there,
@@ -677,7 +674,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int
 
        // ATTACK_FINISHED(actor, slot) -= actor.reload_time - 1;
 
-       Weapon wpn = Weapons_from(actor.weapon);
+       Weapon wpn = Weapons_from(PS(actor).m_weapon.m_id);
        w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
 }
 
@@ -685,7 +682,7 @@ void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
 {
        .entity weaponentity = weaponentities[0];
        // set global values to work with
-       entity e = Weapons_from(actor.weapon);
+       Weapon e = PS(actor).m_weapon;
 
        if (MUTATOR_CALLHOOK(W_Reload, actor)) return;
 
@@ -718,11 +715,11 @@ void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
                                if (IS_REAL_CLIENT(actor) && actor.reload_complain < time)
                                {
                                        play2(actor, SND(UNAVAILABLE));
-                                       sprint(actor, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(actor.weapon), "\n"));
+                                       sprint(actor, strcat("You don't have enough ammo to reload the ^2", PS(actor).m_weapon.m_name, "\n"));
                                        actor.reload_complain = time + 1;
                                }
                                // switch away if the amount of ammo is not enough to keep using this weapon
-                               Weapon w = Weapons_from(actor.weapon);
+                               Weapon w = PS(actor).m_weapon;
                                if (!(w.wr_checkammo1(w) + w.wr_checkammo2(w)))
                                {
                                        actor.clip_load = -1;  // reload later
@@ -756,7 +753,7 @@ void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
 
        if (actor.clip_load < 0) actor.clip_load = 0;
        actor.old_clip_load = actor.clip_load;
-       actor.clip_load = actor.(weapon_load[actor.weapon]) = -1;
+       actor.clip_load = actor.(weapon_load[PS(actor).m_weapon.m_id]) = -1;
 }
 
 void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
diff --git a/textures/overkillbullet.tga b/textures/overkillbullet.tga
new file mode 100644 (file)
index 0000000..f48d302
Binary files /dev/null and b/textures/overkillbullet.tga differ
diff --git a/textures/overkillbullet_gloss.tga b/textures/overkillbullet_gloss.tga
new file mode 100644 (file)
index 0000000..08f2fd0
Binary files /dev/null and b/textures/overkillbullet_gloss.tga differ
diff --git a/textures/overkillbullet_reflect.tga b/textures/overkillbullet_reflect.tga
new file mode 100644 (file)
index 0000000..ecb0222
Binary files /dev/null and b/textures/overkillbullet_reflect.tga differ
diff --git a/xonotic-credits.txt b/xonotic-credits.txt
deleted file mode 100644 (file)
index deacbcc..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-**Core Team
-Rudolf "divVerent" Polzer
-Ant "Antibody" Zucaro
-Marvin "Mirio" Beck
-Merlijn Hofstra
-Peter "Morphed" Pielak
-Ruszkai "CuBe0wL" Ákos
-Samual "Ares" Lenks
-Tyler "-z-" Mulligan
-Zac "Mario" Jardine
-
-**Extended Team
-Antonio "terencehill" Piu
-Archer
-BuddyFriendGuy
-Debugger
-GATTS
-Halogene
-IDWMaster
-Jan "zykure" Behrens
-JH0nny
-Luigi
-Łukasz "kuniu the frogg" Polek
-Matthias "matthiaskrgr" Krüger
-Mattia "Melanosuchus" Basaglia
-MrBougo
-Nick "bitbomb" Lucca
-nilyt/nyov
-Nitroxis
-packer
-Pearce "theShadow" Michal
-Rasmus "FruitieX" Eskola
-s1lence
-Severin "sev" Meyer
-Soelen
-Sydes
-unfa
-TimePath
-
-
-*Website
-Ant "Antibody" Zucaro (web)
-Merlijn Hofstra
-Tyler "-z-" Mulligan (web / game)
-
-*Stats
-Ant "Antibody" Zucaro
-Jan "zykure" Behrens
-
-*Art
-Severin "sev" Meyer
-Sahil "DiaboliK" Singhal
-Peter "Morphed" Pielak
-Sam "LJFHutch" Hutchinson
-Pearce "theShadow" Michal
-
-*Animation
-Sahil "DiaboliK" Singhal
-nifrek
-
-*Level Design
-Amadeusz "amade/proraide" Sławiński
-Ben "MooKow" Banker
-Calinou
-Cortez
-Cuinn "Cuinnton" Herrick
-Debugger
-Jakob "tZork" Markström Gröhn
-Konrad "Justin" Slawinski
-Maddin
-L0
-Łukasz "kuniu the frogg" Polek
-Maik "SavageX" Merten
-Marvin "Mirio" Beck
-MintOX
-packer
-Pearce "theShadow" Michal
-Rasmus "FruitieX" Eskola
-Ruszkai "CuBe0wL" Ákos
-Severin "sev" Meyer
-ShadoW
-
-*Music / Sound FX
-AquaNova (Archer)
-blkrbt
-chooksta
-Independent.nu
-[master]mind
-Merlijn Hofstra
-Mick Rippon
-Nick "bitbomb" Lucca
-remaxim
-Saulo "mand1nga" Gil
-{SC0RP} - Ian "ID" Dorrell
-Stephan
-unfa
-
-*Game Code
-Samual "Ares" Lenks
-Rudolf "divVerent" Polzer
-Jakob "tZork" Markström Gröhn
-Rasmus "FruitieX" Eskola
-Zac "Mario" Jardine
-
-*Marketing / PR
-Tyler "-z-" Mulligan
-Ruszkai "CuBe0wL" Ákos
-Samual "Ares" Lenks
-Saulo "mand1nga" Gil
-
-*Legal
-Rudolf "divVerent" Polzer
-Merlijn Hofstra
-
-
-**Game Engine
-*DarkPlaces
-Forest "LordHavoc" Hale
-
-*Engine Additions
-Rudolf "divVerent" Polzer
-Samual "Ares" Lenks
-
-
-**Compiler
-*GMQCC
-Wolfgang "Blub\0" Bumiller
-Dale "graphitemaster" Weiler
-
-
-**Other Active Contributors
-Erik "Ablu" Schilling
-Mircea "Taoki" Kitsune
-Penguinum
-
-
-**Translators
-
-*Asturian
-Llumex03
-Tornes "Tornes.Llume" Ḷḷume
-Ximielga
-
-*Belarusian
-Mihail "meequz" Varantsou
-
-*Bulgarian
-lokster
-set_killer
-
-*Chinese (China)
-Antonidas
-kalawore
-sapphireliu
-
-*Czech
-shogun assassin/woky
-Superovoce
-Tomáš "CZHeron" Volavka
-
-*Dutch
-Alexander "freefang" van Dam
-PinkRobot
-vegiburger
-
-*English (Australia)
-Laurene "sunflowers" Albrand
-Zac "Mario" Jardine
-
-*Finnish
-Henry "Exitium" Sanmark
-Rasmus "FruitieX" Eskola
-
-*French
-Calinou
-Maxime "Taximus" Paradis
-RedGuff
-Yannick "SpiKe" Le Guen
-
-*German
-Brot
-cvcxc
-Erik "Ablu" Schilling
-Jope "Sless" Withers
-Marvin "Mirio" Beck
-Rudolf "divVerent" Polzer
-Yepoleb
-
-*Greek
-Γιάννης "Evropi" Ανθυμίδης
-Konstantinos "LDinos" Mihalenas
-Savoritias
-Vindex
-
-*Hungarian
-Ruszkai "CuBe0wL" Ákos
-xaN1C4n3
-
-*Italian
-Antonio "terencehill" Piu
-Felice "MaidenBeast" Sallustio
-stdi
-XCostaX
-
-*Polish
-4m
-Alex "tiprogrammierer.alex" Progger
-Amadeusz "amade/proraide" Sławiński
-
-*Portuguese
-Ricardo Manuel "Hellgardia" da Cruz Coelho da Silva
-xXxCHAOTICxXx
-
-*Romanian
-Adrian-Ciprian "adrian.tinjala" Tînjală
-BusterDBK
-Mircea "Taoki" Kitsune
-Tudor "TropiKo" Ionel
-
-*Russian
-Alex "alextalker7" Talker
-Alexandr "zrg"
-Andrei "adem4ik" Stepanov
-gravicappa
-Hot Dog
-Lord Canistra
-Nikoli
-Sergej "Clearness High" Lutsyk
-
-*Serbian
-Саша "salepetronije" Петровић
-Pendulla
-Rafael "Ristovski"
-
-*Spanish
-0000simon
-Alan "aagp" Garcia
-Ari_tent
-brunodeleo
-Kammy
-roader_gentoo
-Rodrigo Mouton Laudin
-SouL
-
-*Swedish
-Karl-Oskar "machine" Rikås
-marcus256
-
-*Ukrainian
-Oleh "BlaXpirit" Prypin
-Vasyl "Harmata" Melnyk
-Yuriy "herrniemand" Ackermann
-
-
-**Past Contributors
-Akari
-Alexander "naryl" Suhoverhov
-Alexander "motorsep" Zubov
-Amos "torus" Dudley
-Andreas "Black" Kirsch
-Attila "WW3" Houtkooper
-BigMac
-Braden "meoblast001" Walters
-Brain Younds
-Chris "amethyst7" Matz
-Christian Ice
-Clinton "Kaziganthe" Freeman
-Dan "Digger" Korostelev
-Dan "Wazat" Hale
-Dokujisan
-Donkey
-dstrek
-Dustin Geeraert
-Edgenetwork
-Edward "Ed" Holness
-Eric "Munyul Verminard" Sambach
-Fabien "H. Reaper" Tschirhart
-Florian Paul "lda17h" Schmidt
-FrikaC
-Garth "Zombie" Hendy
-Gerd "Elysis" Raudenbusch
-Gottfried "Toddd" Hofmann
-Henning "Tymo" Janssen
-Innovati
-Jitspoe
-Jody Gallagher
-Jope "Sless" Withers
-Juergen "LowDragon" Timm
-KadaverJack
-Kevin "Tyrann" Shanahan
-Kristian "morfar" Johansson
-Kurt Dereli
-lcatlnx
-Lee David Ash
-Lee Vermeulen
-leileilol
-magorian
-Marius "GreEn`mArine" Shekow
-Marko "Urre" Permanto
-Mathieu "Elric" Olivier
-Mattrew "Tronyn" Rye
-MauveBib
-Mephisto
-michaelb
-Michael "Tenshihan" Quinn
-Mepper
-Munyul
-Netzwerg
-NoelCower
-Parapraxis
-parasti
-Paul "Strahlemann" Evers
-Paul Scott
-Petithomme
-PlasmaSheep
-Przemysław "atheros" Grzywacz
-Q1 Retexturing Project
-Qantourisc
-Oleh "BlaXpirit" Prypin
-Rick "Rat" Kelley
-Robert "ai" Kuroto
-Ronan
-Sajt
-Saulo "mand1nga" Gil
-Shaggy
-Shank
-Simon O'Callaghan
-SomeGuy
-SoulKeeper_p
-Spike
-Spirit
-Stephan "esteel" Stahl
-Steve Vermeulen
-Supajoe
-Tei
-The player with the unnecessarily long name
-Tomaz
-Ulrich Galbraith
-Vortex
-William Libert
-William "Willis" Weilep
-Yves "EviLair" Allaire
-Zenex