]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/translate_colors_2
authorterencehill <piuntn@gmail.com>
Sun, 27 Mar 2016 17:43:20 +0000 (19:43 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 27 Mar 2016 17:43:20 +0000 (19:43 +0200)
878 files changed:
.gitattributes
.gitlab-ci.yml
bal-wep-nexuiz25.cfg
bal-wep-overkill.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
bal-wep-xpm.cfg
defaultXonotic.cfg
qcsrc/.gitignore
qcsrc/Doxyfile
qcsrc/Makefile
qcsrc/autocvarize-update.sh [deleted file]
qcsrc/autocvarize.pl [deleted file]
qcsrc/client/_all.qh
qcsrc/client/_mod.inc [new file with mode: 0644]
qcsrc/client/announcer.qc
qcsrc/client/announcer.qh
qcsrc/client/autocvars.qh
qcsrc/client/bgmscript.qh
qcsrc/client/commands/_mod.inc [new file with mode: 0644]
qcsrc/client/commands/all.qc
qcsrc/client/commands/all.qh
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/commands/cl_cmd.qh
qcsrc/client/credit.txt [deleted file]
qcsrc/client/csqc_constants.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/csqcmodel_hooks.qh [new file with mode: 0644]
qcsrc/client/defs.qh
qcsrc/client/hud/_mod.inc [new file with mode: 0644]
qcsrc/client/hud/all.qc [deleted file]
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/hud_config.qh
qcsrc/client/hud/panel.qh [new file with mode: 0644]
qcsrc/client/hud/panel/_mod.inc [new file with mode: 0644]
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/ammo.qh [new file with mode: 0644]
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/centerprint.qh [new file with mode: 0644]
qcsrc/client/hud/panel/chat.qc
qcsrc/client/hud/panel/chat.qh [new file with mode: 0644]
qcsrc/client/hud/panel/engineinfo.qc
qcsrc/client/hud/panel/engineinfo.qh [new file with mode: 0644]
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/healtharmor.qh [new file with mode: 0644]
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/infomessages.qh [new file with mode: 0644]
qcsrc/client/hud/panel/minigame.qc
qcsrc/client/hud/panel/minigame.qh [new file with mode: 0644]
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/modicons.qh [new file with mode: 0644]
qcsrc/client/hud/panel/notify.qc
qcsrc/client/hud/panel/notify.qh [new file with mode: 0644]
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/physics.qh [new file with mode: 0644]
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/hud/panel/powerups.qh [new file with mode: 0644]
qcsrc/client/hud/panel/pressedkeys.qc
qcsrc/client/hud/panel/pressedkeys.qh [new file with mode: 0644]
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/quickmenu.qh [new file with mode: 0644]
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/hud/panel/racetimer.qh [new file with mode: 0644]
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/radar.qh [new file with mode: 0644]
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/score.qh [new file with mode: 0644]
qcsrc/client/hud/panel/timer.qc
qcsrc/client/hud/panel/timer.qh [new file with mode: 0644]
qcsrc/client/hud/panel/vote.qc
qcsrc/client/hud/panel/vote.qh [new file with mode: 0644]
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/hud/panel/weapons.qh [new file with mode: 0644]
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/client/mapvoting.qc
qcsrc/client/mapvoting.qh
qcsrc/client/miscfunctions.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/mutators/_mod.inc [new file with mode: 0644]
qcsrc/client/mutators/events.qh
qcsrc/client/player_skeleton.qc
qcsrc/client/player_skeleton.qh
qcsrc/client/progs.inc
qcsrc/client/quickmenu.qc [deleted file]
qcsrc/client/quickmenu.qh [deleted file]
qcsrc/client/scoreboard.qc
qcsrc/client/scoreboard.qh
qcsrc/client/shownames.qc
qcsrc/client/shownames.qh
qcsrc/client/teamradar.qc
qcsrc/client/teamradar.qh
qcsrc/client/view.qc
qcsrc/client/view.qh [new file with mode: 0644]
qcsrc/client/wall.qh
qcsrc/client/weapons/_mod.inc [new file with mode: 0644]
qcsrc/client/weapons/projectile.qc
qcsrc/client/weapons/projectile.qh
qcsrc/common/_all.inc
qcsrc/common/_mod.inc [new file with mode: 0644]
qcsrc/common/command/_mod.inc [new file with mode: 0644]
qcsrc/common/command/all.qh
qcsrc/common/command/command.qh
qcsrc/common/command/generic.qc
qcsrc/common/command/generic.qh
qcsrc/common/command/rpn.qc
qcsrc/common/deathtypes/_mod.inc [new file with mode: 0644]
qcsrc/common/deathtypes/all.qh
qcsrc/common/debug.qh
qcsrc/common/effects/_mod.inc [new file with mode: 0644]
qcsrc/common/effects/effectinfo.qc
qcsrc/common/effects/qc/_mod.inc [new file with mode: 0644]
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/effects/qc/gibs.qh [new file with mode: 0644]
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/effects/qc/globalsound.qh
qcsrc/common/effects/qc/lightningarc.qc
qcsrc/common/effects/qc/lightningarc.qh [new file with mode: 0644]
qcsrc/common/effects/qc/modeleffects.qc
qcsrc/common/effects/qc/modeleffects.qh [new file with mode: 0644]
qcsrc/common/effects/qc/rubble.qh
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/_mod.inc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/_mod.inc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/nexball/_mod.inc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/impulses/_mod.inc [new file with mode: 0644]
qcsrc/common/items/_mod.inc [new file with mode: 0644]
qcsrc/common/items/all.inc [deleted file]
qcsrc/common/items/all.qc
qcsrc/common/items/all.qh
qcsrc/common/items/inventory.qh
qcsrc/common/items/item.qh
qcsrc/common/items/item/_mod.inc [new file with mode: 0644]
qcsrc/common/items/item/pickup.qh
qcsrc/common/mapinfo.qh
qcsrc/common/minigames/_mod.inc [new file with mode: 0644]
qcsrc/common/minigames/cl_minigames.qh
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/_mod.inc [new file with mode: 0644]
qcsrc/common/minigames/minigame/all.qh
qcsrc/common/minigames/minigame/snake.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/minigames/sv_minigames.qh
qcsrc/common/models/_mod.inc [new file with mode: 0644]
qcsrc/common/models/model.qh
qcsrc/common/monsters/_mod.inc [new file with mode: 0644]
qcsrc/common/monsters/all.inc [deleted file]
qcsrc/common/monsters/all.qc
qcsrc/common/monsters/all.qh
qcsrc/common/monsters/monster.qh
qcsrc/common/monsters/monster/_mod.inc [new file with mode: 0644]
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/spawn.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/base.qh
qcsrc/common/mutators/mutator/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/bloodloss/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/breakablehook/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/all.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/bugrigs/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc
qcsrc/common/mutators/mutator/campcheck/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/cloaked/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/damagetext/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/damagetext/damagetext.qc
qcsrc/common/mutators/mutator/dodging/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/dodging/dodging.qc
qcsrc/common/mutators/mutator/doublejump/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/doublejump/doublejump.qc
qcsrc/common/mutators/mutator/hook/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/hook/hook.qc
qcsrc/common/mutators/mutator/instagib/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/instagib/items.qc
qcsrc/common/mutators/mutator/invincibleproj/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/melee_only/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/midair/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/midair/midair.qc
qcsrc/common/mutators/mutator/multijump/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/nades/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/new_toys/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/nix/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/nix/nix.qc
qcsrc/common/mutators/mutator/overkill/_mod.inc [new file with mode: 0644]
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/physical_items/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/physical_items/physical_items.qc
qcsrc/common/mutators/mutator/pinata/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/random_gravity/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/rocketflying/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/rocketminsta/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/running_guns/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/sandbox/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/superspec/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/superspec/superspec.qc
qcsrc/common/mutators/mutator/touchexplode/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/vampire/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/vampirehook/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/waypoints/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc [new file with mode: 0644]
qcsrc/common/net_notice.qc
qcsrc/common/notifications/_mod.inc [new file with mode: 0644]
qcsrc/common/notifications/all.qc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/_mod.inc [new file with mode: 0644]
qcsrc/common/physics/movelib.qc
qcsrc/common/physics/movelib.qh
qcsrc/common/physics/movetypes/_mod.inc [new file with mode: 0644]
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/push.qc
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/sounds/_mod.inc [new file with mode: 0644]
qcsrc/common/sounds/sound.qh
qcsrc/common/state.qc
qcsrc/common/state.qh
qcsrc/common/stats.qh
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/_mod.inc [new file with mode: 0644]
qcsrc/common/triggers/func/_mod.inc [new file with mode: 0644]
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/_mod.inc [new file with mode: 0644]
qcsrc/common/triggers/misc/follow.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/misc/teleport_dest.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/subs.qh
qcsrc/common/triggers/target/_mod.inc [new file with mode: 0644]
qcsrc/common/triggers/target/location.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/_mod.inc [new file with mode: 0644]
qcsrc/common/triggers/trigger/gamestart.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/_mod.inc [new file with mode: 0644]
qcsrc/common/turrets/all.inc [deleted file]
qcsrc/common/turrets/all.qc
qcsrc/common/turrets/all.qh
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/turrets/turret.qh
qcsrc/common/turrets/turret/_mod.inc [new file with mode: 0644]
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/ewheel_weapon.qc
qcsrc/common/turrets/turret/ewheel_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/flac.qc
qcsrc/common/turrets/turret/flac_weapon.qc
qcsrc/common/turrets/turret/flac_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/fusionreactor.qc
qcsrc/common/turrets/turret/hellion.qc
qcsrc/common/turrets/turret/hellion_weapon.qc
qcsrc/common/turrets/turret/hellion_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/hk.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/hk_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/machinegun.qc
qcsrc/common/turrets/turret/machinegun_weapon.qc
qcsrc/common/turrets/turret/machinegun_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/mlrs.qc
qcsrc/common/turrets/turret/mlrs_weapon.qc
qcsrc/common/turrets/turret/mlrs_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/phaser.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/turret/phaser_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/plasma.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/turrets/turret/plasma_weapon.qc
qcsrc/common/turrets/turret/plasma_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/tesla.qc
qcsrc/common/turrets/turret/tesla_weapon.qc
qcsrc/common/turrets/turret/tesla_weapon.qh [new file with mode: 0644]
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/turrets/turret/walker_weapon.qc
qcsrc/common/turrets/turret/walker_weapon.qh [new file with mode: 0644]
qcsrc/common/util.qh
qcsrc/common/vehicles/_mod.inc [new file with mode: 0644]
qcsrc/common/vehicles/all.inc [deleted file]
qcsrc/common/vehicles/all.qc
qcsrc/common/vehicles/all.qh
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/vehicle.qh
qcsrc/common/vehicles/vehicle/_mod.inc [new file with mode: 0644]
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/bumblebee.qh
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qh [new file with mode: 0644]
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qh [new file with mode: 0644]
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qh [new file with mode: 0644]
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh [new file with mode: 0644]
qcsrc/common/weapons/_mod.inc [new file with mode: 0644]
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/_mod.inc [new file with mode: 0644]
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/dpdefs/doc.md
qcsrc/dpdefs/progsdefs.qh
qcsrc/lib/_all.inc
qcsrc/lib/_mod.inc [new file with mode: 0644]
qcsrc/lib/arraylist.qh
qcsrc/lib/compiler.qh
qcsrc/lib/csqcmodel/_mod.inc [new file with mode: 0644]
qcsrc/lib/csqcmodel/cl_model.qc
qcsrc/lib/csqcmodel/sv_model.qc
qcsrc/lib/defer.qh
qcsrc/lib/enumclass.qh
qcsrc/lib/iter.qh
qcsrc/lib/linkedlist.qh
qcsrc/lib/log.qh
qcsrc/lib/map.qh
qcsrc/lib/net.qh
qcsrc/lib/oo.qh
qcsrc/lib/registry.qh
qcsrc/lib/self.qh
qcsrc/lib/sort.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/stats.qh
qcsrc/lib/test.qc
qcsrc/lib/unsafe.qh
qcsrc/lib/urllib.qh
qcsrc/lib/warpzone/_mod.inc [new file with mode: 0644]
qcsrc/lib/warpzone/client.qc
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/common.qh
qcsrc/lib/warpzone/server.qc
qcsrc/lib/warpzone/server.qh
qcsrc/lib/warpzone/util_server.qc
qcsrc/menu/_all.qh
qcsrc/menu/_mod.inc [new file with mode: 0644]
qcsrc/menu/anim/_mod.inc [new file with mode: 0644]
qcsrc/menu/anim/animation.qc
qcsrc/menu/anim/animation.qh [new file with mode: 0644]
qcsrc/menu/anim/animhost.qc
qcsrc/menu/anim/animhost.qh [new file with mode: 0644]
qcsrc/menu/anim/easing.qc
qcsrc/menu/anim/easing.qh [new file with mode: 0644]
qcsrc/menu/anim/keyframe.qc
qcsrc/menu/anim/keyframe.qh [new file with mode: 0644]
qcsrc/menu/classes.inc
qcsrc/menu/classes.qc [deleted file]
qcsrc/menu/command/_mod.inc [new file with mode: 0644]
qcsrc/menu/command/all.qc
qcsrc/menu/command/all.qh [deleted file]
qcsrc/menu/command/menu_cmd.qc
qcsrc/menu/command/menu_cmd.qh
qcsrc/menu/draw.qh
qcsrc/menu/gamesettings.qh
qcsrc/menu/item.qc
qcsrc/menu/item.qh [new file with mode: 0644]
qcsrc/menu/item/_mod.inc [new file with mode: 0644]
qcsrc/menu/item/borderimage.qc
qcsrc/menu/item/borderimage.qh [new file with mode: 0644]
qcsrc/menu/item/button.qc
qcsrc/menu/item/button.qh [new file with mode: 0644]
qcsrc/menu/item/checkbox.qc
qcsrc/menu/item/checkbox.qh [new file with mode: 0644]
qcsrc/menu/item/container.qc
qcsrc/menu/item/container.qh [new file with mode: 0644]
qcsrc/menu/item/dialog.qc
qcsrc/menu/item/dialog.qh [new file with mode: 0644]
qcsrc/menu/item/image.qc
qcsrc/menu/item/image.qh [new file with mode: 0644]
qcsrc/menu/item/inputbox.qc
qcsrc/menu/item/inputbox.qh [new file with mode: 0644]
qcsrc/menu/item/inputcontainer.qc
qcsrc/menu/item/inputcontainer.qh [new file with mode: 0644]
qcsrc/menu/item/label.qc
qcsrc/menu/item/label.qh [new file with mode: 0644]
qcsrc/menu/item/listbox.qc
qcsrc/menu/item/listbox.qh [new file with mode: 0644]
qcsrc/menu/item/modalcontroller.qc
qcsrc/menu/item/modalcontroller.qh [new file with mode: 0644]
qcsrc/menu/item/nexposee.qc
qcsrc/menu/item/nexposee.qh [new file with mode: 0644]
qcsrc/menu/item/radiobutton.qc
qcsrc/menu/item/radiobutton.qh [new file with mode: 0644]
qcsrc/menu/item/slider.qc
qcsrc/menu/item/slider.qh [new file with mode: 0644]
qcsrc/menu/item/tab.qc
qcsrc/menu/item/tab.qh [new file with mode: 0644]
qcsrc/menu/item/textslider.qc
qcsrc/menu/item/textslider.qh [new file with mode: 0644]
qcsrc/menu/menu.qc
qcsrc/menu/menu.qh
qcsrc/menu/mutators/_mod.inc [new file with mode: 0644]
qcsrc/menu/mutators/events.qh
qcsrc/menu/progs.inc
qcsrc/menu/skin.qh
qcsrc/menu/xonotic/_mod.inc [new file with mode: 0644]
qcsrc/menu/xonotic/bigbutton.qc
qcsrc/menu/xonotic/bigbutton.qh [new file with mode: 0644]
qcsrc/menu/xonotic/bigcommandbutton.qc
qcsrc/menu/xonotic/bigcommandbutton.qh [new file with mode: 0644]
qcsrc/menu/xonotic/button.qc
qcsrc/menu/xonotic/button.qh [new file with mode: 0644]
qcsrc/menu/xonotic/campaign.qc
qcsrc/menu/xonotic/campaign.qh [new file with mode: 0644]
qcsrc/menu/xonotic/charmap.qc
qcsrc/menu/xonotic/charmap.qh [new file with mode: 0644]
qcsrc/menu/xonotic/checkbox.qc
qcsrc/menu/xonotic/checkbox.qh [new file with mode: 0644]
qcsrc/menu/xonotic/checkbox_slider_invalid.qc
qcsrc/menu/xonotic/checkbox_slider_invalid.qh [new file with mode: 0644]
qcsrc/menu/xonotic/checkbox_string.qc
qcsrc/menu/xonotic/checkbox_string.qh [new file with mode: 0644]
qcsrc/menu/xonotic/colorbutton.qc
qcsrc/menu/xonotic/colorbutton.qh [new file with mode: 0644]
qcsrc/menu/xonotic/colorpicker.qc
qcsrc/menu/xonotic/colorpicker.qh [new file with mode: 0644]
qcsrc/menu/xonotic/colorpicker_string.qc
qcsrc/menu/xonotic/colorpicker_string.qh [new file with mode: 0644]
qcsrc/menu/xonotic/commandbutton.qc
qcsrc/menu/xonotic/commandbutton.qh [new file with mode: 0644]
qcsrc/menu/xonotic/credits.qc
qcsrc/menu/xonotic/credits.qh [new file with mode: 0644]
qcsrc/menu/xonotic/crosshairpicker.qc
qcsrc/menu/xonotic/crosshairpicker.qh [new file with mode: 0644]
qcsrc/menu/xonotic/crosshairpreview.qc
qcsrc/menu/xonotic/crosshairpreview.qh [new file with mode: 0644]
qcsrc/menu/xonotic/cvarlist.qc
qcsrc/menu/xonotic/cvarlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/datasource.qc
qcsrc/menu/xonotic/datasource.qh [new file with mode: 0644]
qcsrc/menu/xonotic/demolist.qc
qcsrc/menu/xonotic/demolist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog.qc
qcsrc/menu/xonotic/dialog.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_credits.qc
qcsrc/menu/xonotic/dialog_credits.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_firstrun.qc
qcsrc/menu/xonotic/dialog_firstrun.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_ammo.qc
qcsrc/menu/xonotic/dialog_hudpanel_ammo.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc
qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_chat.qc
qcsrc/menu/xonotic/dialog_hudpanel_chat.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qc
qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qc
qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qc
qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qc
qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_modicons.qc
qcsrc/menu/xonotic/dialog_hudpanel_modicons.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_notification.qc
qcsrc/menu/xonotic/dialog_hudpanel_notification.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_physics.qc
qcsrc/menu/xonotic/dialog_hudpanel_physics.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_powerups.qc
qcsrc/menu/xonotic/dialog_hudpanel_powerups.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qc
qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_quickmenu.qc
qcsrc/menu/xonotic/dialog_hudpanel_quickmenu.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qc
qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_radar.qc
qcsrc/menu/xonotic/dialog_hudpanel_radar.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_score.qc
qcsrc/menu/xonotic/dialog_hudpanel_score.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_timer.qc
qcsrc/menu/xonotic/dialog_hudpanel_timer.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_vote.qc
qcsrc/menu/xonotic/dialog_hudpanel_vote.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc
qcsrc/menu/xonotic/dialog_hudpanel_weapons.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudsetup_exit.qc
qcsrc/menu/xonotic/dialog_hudsetup_exit.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_monstertools.qc
qcsrc/menu/xonotic/dialog_monstertools.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer.qc
qcsrc/menu/xonotic/dialog_multiplayer.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_create.qc
qcsrc/menu/xonotic/dialog_multiplayer_create.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_join.qc
qcsrc/menu/xonotic/dialog_multiplayer_join.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media.qc
qcsrc/menu/xonotic/dialog_multiplayer_media.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_profile.qc
qcsrc/menu/xonotic/dialog_multiplayer_profile.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_quit.qc
qcsrc/menu/xonotic/dialog_quit.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_sandboxtools.qc
qcsrc/menu/xonotic/dialog_sandboxtools.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings.qc
qcsrc/menu/xonotic/dialog_settings.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_audio.qc
qcsrc/menu/xonotic/dialog_settings_audio.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_effects.qc
qcsrc/menu/xonotic/dialog_settings_effects.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game.qc
qcsrc/menu/xonotic/dialog_settings_game.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_crosshair.qc
qcsrc/menu/xonotic/dialog_settings_game_crosshair.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_hud.qc
qcsrc/menu/xonotic/dialog_settings_game_hud.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qc
qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_messages.qc
qcsrc/menu/xonotic/dialog_settings_game_messages.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_model.qc
qcsrc/menu/xonotic/dialog_settings_game_model.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_view.qc
qcsrc/menu/xonotic/dialog_settings_game_view.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_weapons.qc
qcsrc/menu/xonotic/dialog_settings_game_weapons.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_input.qc
qcsrc/menu/xonotic/dialog_settings_input.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_input_userbind.qc
qcsrc/menu/xonotic/dialog_settings_input_userbind.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_misc.qc
qcsrc/menu/xonotic/dialog_settings_misc.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_misc_cvars.qc
qcsrc/menu/xonotic/dialog_settings_misc_cvars.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_misc_reset.qc
qcsrc/menu/xonotic/dialog_settings_misc_reset.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_user.qc
qcsrc/menu/xonotic/dialog_settings_user.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qc
qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_video.qc
qcsrc/menu/xonotic/dialog_settings_video.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_singleplayer.qc
qcsrc/menu/xonotic/dialog_singleplayer.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_singleplayer_winner.qc
qcsrc/menu/xonotic/dialog_singleplayer_winner.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_teamselect.qc
qcsrc/menu/xonotic/dialog_teamselect.qh [new file with mode: 0644]
qcsrc/menu/xonotic/gametypebutton.qc [deleted file]
qcsrc/menu/xonotic/gametypelist.qc
qcsrc/menu/xonotic/gametypelist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/hudskinlist.qc
qcsrc/menu/xonotic/hudskinlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/image.qc
qcsrc/menu/xonotic/image.qh [new file with mode: 0644]
qcsrc/menu/xonotic/inputbox.qc
qcsrc/menu/xonotic/inputbox.qh [new file with mode: 0644]
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/keybinder.qh [new file with mode: 0644]
qcsrc/menu/xonotic/languagelist.qc
qcsrc/menu/xonotic/languagelist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/listbox.qc
qcsrc/menu/xonotic/listbox.qh [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.qc
qcsrc/menu/xonotic/mainwindow.qh [new file with mode: 0644]
qcsrc/menu/xonotic/maplist.qc
qcsrc/menu/xonotic/maplist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/nexposee.qc
qcsrc/menu/xonotic/nexposee.qh [new file with mode: 0644]
qcsrc/menu/xonotic/picker.qc
qcsrc/menu/xonotic/picker.qh [new file with mode: 0644]
qcsrc/menu/xonotic/playerlist.qc
qcsrc/menu/xonotic/playerlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/playermodel.qc
qcsrc/menu/xonotic/playermodel.qh [new file with mode: 0644]
qcsrc/menu/xonotic/playlist.qc
qcsrc/menu/xonotic/playlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/radiobutton.qc
qcsrc/menu/xonotic/radiobutton.qh [new file with mode: 0644]
qcsrc/menu/xonotic/rootdialog.qc
qcsrc/menu/xonotic/rootdialog.qh [new file with mode: 0644]
qcsrc/menu/xonotic/screenshotimage.qc
qcsrc/menu/xonotic/screenshotimage.qh [new file with mode: 0644]
qcsrc/menu/xonotic/screenshotlist.qc
qcsrc/menu/xonotic/screenshotlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/serverlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/skinlist.qc
qcsrc/menu/xonotic/skinlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/slider.qc
qcsrc/menu/xonotic/slider.qh [new file with mode: 0644]
qcsrc/menu/xonotic/slider_decibels.qc
qcsrc/menu/xonotic/slider_decibels.qh [new file with mode: 0644]
qcsrc/menu/xonotic/slider_particles.qc
qcsrc/menu/xonotic/slider_particles.qh [new file with mode: 0644]
qcsrc/menu/xonotic/slider_picmip.qc
qcsrc/menu/xonotic/slider_picmip.qh [new file with mode: 0644]
qcsrc/menu/xonotic/slider_resolution.qc
qcsrc/menu/xonotic/slider_resolution.qh [new file with mode: 0644]
qcsrc/menu/xonotic/slider_sbfadetime.qc
qcsrc/menu/xonotic/slider_sbfadetime.qh [new file with mode: 0644]
qcsrc/menu/xonotic/soundlist.qc
qcsrc/menu/xonotic/soundlist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/statslist.qc
qcsrc/menu/xonotic/statslist.qh [new file with mode: 0644]
qcsrc/menu/xonotic/tab.qc
qcsrc/menu/xonotic/tab.qh [new file with mode: 0644]
qcsrc/menu/xonotic/tabcontroller.qc
qcsrc/menu/xonotic/tabcontroller.qh [new file with mode: 0644]
qcsrc/menu/xonotic/textlabel.qc
qcsrc/menu/xonotic/textlabel.qh [new file with mode: 0644]
qcsrc/menu/xonotic/textslider.qc
qcsrc/menu/xonotic/textslider.qh [new file with mode: 0644]
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh
qcsrc/menu/xonotic/weaponarenacheckbox.qc
qcsrc/menu/xonotic/weaponarenacheckbox.qh [new file with mode: 0644]
qcsrc/menu/xonotic/weaponslist.qc
qcsrc/menu/xonotic/weaponslist.qh [new file with mode: 0644]
qcsrc/qcc.sh [deleted file]
qcsrc/server/_all.qh
qcsrc/server/_mod.inc [new file with mode: 0644]
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/antilag.qc
qcsrc/server/antilag.qh
qcsrc/server/autocvars.qh
qcsrc/server/bot/_all.inc [deleted file]
qcsrc/server/bot/_mod.inc [new file with mode: 0644]
qcsrc/server/bot/aim.qc
qcsrc/server/bot/aim.qh
qcsrc/server/bot/bot.qc
qcsrc/server/bot/bot.qh
qcsrc/server/bot/havocbot/_all.inc [deleted file]
qcsrc/server/bot/havocbot/_mod.inc [new file with mode: 0644]
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/havocbot.qh
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/bot/havocbot/roles.qh
qcsrc/server/bot/havocbot/scripting.qh
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh
qcsrc/server/bot/scripting.qc
qcsrc/server/bot/scripting.qh
qcsrc/server/bot/waypoints.qc
qcsrc/server/bot/waypoints.qh
qcsrc/server/campaign.qh
qcsrc/server/cheats.qc
qcsrc/server/cheats.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_client.qh
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_impulse.qh
qcsrc/server/cl_player.qc
qcsrc/server/cl_player.qh
qcsrc/server/command/_mod.inc [new file with mode: 0644]
qcsrc/server/command/all.qc
qcsrc/server/command/all.qh
qcsrc/server/command/banning.qc
qcsrc/server/command/banning.qh
qcsrc/server/command/cmd.qc
qcsrc/server/command/cmd.qh
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh
qcsrc/server/command/getreplies.qc
qcsrc/server/command/getreplies.qh
qcsrc/server/command/radarmap.qc
qcsrc/server/command/radarmap.qh
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/sv_cmd.qh
qcsrc/server/command/vote.qc
qcsrc/server/command/vote.qh
qcsrc/server/constants.qh
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_hook.qh
qcsrc/server/g_lights.qc
qcsrc/server/g_lights.qh [new file with mode: 0644]
qcsrc/server/g_models.qc
qcsrc/server/g_models.qh [new file with mode: 0644]
qcsrc/server/g_subs.qc
qcsrc/server/g_subs.qh
qcsrc/server/g_world.qc
qcsrc/server/g_world.qh
qcsrc/server/ipban.qc
qcsrc/server/ipban.qh
qcsrc/server/item_key.qh
qcsrc/server/mapvoting.qc
qcsrc/server/mapvoting.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/_mod.inc [new file with mode: 0644]
qcsrc/server/mutators/all.qc
qcsrc/server/mutators/all.qh
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode.qh
qcsrc/server/mutators/mutator.qh
qcsrc/server/mutators/mutator/_mod.inc [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_assault.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ca.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_cts.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_deathmatch.qc
qcsrc/server/mutators/mutator/gamemode_deathmatch.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_domination.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_lms.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/mutators/mutator/gamemode_race.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator/gamemode_tdm.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qh [new file with mode: 0644]
qcsrc/server/pathlib/_mod.inc [new file with mode: 0644]
qcsrc/server/pathlib/costs.qc
qcsrc/server/pathlib/costs.qh [new file with mode: 0644]
qcsrc/server/pathlib/debug.qc
qcsrc/server/pathlib/debug.qh [new file with mode: 0644]
qcsrc/server/pathlib/expandnode.qc
qcsrc/server/pathlib/expandnode.qh [new file with mode: 0644]
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/main.qh
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/movenode.qh [new file with mode: 0644]
qcsrc/server/pathlib/path_waypoint.qc
qcsrc/server/pathlib/path_waypoint.qh [new file with mode: 0644]
qcsrc/server/pathlib/pathlib.qh
qcsrc/server/pathlib/utility.qh
qcsrc/server/playerdemo.qc
qcsrc/server/playerdemo.qh
qcsrc/server/portals.qh
qcsrc/server/progdefs.h [deleted file]
qcsrc/server/progs.inc
qcsrc/server/race.qc
qcsrc/server/race.qh
qcsrc/server/round_handler.qh
qcsrc/server/scores.qc
qcsrc/server/scores.qh
qcsrc/server/scores_rules.qh
qcsrc/server/spawnpoints.qc
qcsrc/server/spawnpoints.qh
qcsrc/server/steerlib.qc
qcsrc/server/steerlib.qh
qcsrc/server/sv_main.qc
qcsrc/server/sv_main.qh [new file with mode: 0644]
qcsrc/server/sys-post.qh
qcsrc/server/sys-pre.qh
qcsrc/server/t_halflife.qc
qcsrc/server/t_halflife.qh [new file with mode: 0644]
qcsrc/server/t_quake.qc
qcsrc/server/t_quake.qh [new file with mode: 0644]
qcsrc/server/t_quake3.qc
qcsrc/server/t_quake3.qh [new file with mode: 0644]
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh
qcsrc/server/tests.qc [new file with mode: 0644]
qcsrc/server/tests.qh [new file with mode: 0644]
qcsrc/server/weapons/_mod.inc [new file with mode: 0644]
qcsrc/server/weapons/accuracy.qh
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/common.qh
qcsrc/server/weapons/csqcprojectile.qh
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/hitplot.qh
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/spawning.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh
qcsrc/server/weapons/weaponstats.qh
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh
qcsrc/test/compilationunit.sh [deleted file]
qcsrc/tools/autocvarize-update.sh [new file with mode: 0755]
qcsrc/tools/autocvarize.pl [new file with mode: 0644]
qcsrc/tools/compilationunits.sh [new file with mode: 0755]
qcsrc/tools/genmod.sh [new file with mode: 0755]
qcsrc/tools/headerstyle.sh [new file with mode: 0755]
qcsrc/tools/qcc.sh [new file with mode: 0755]
qcsrc/tools/uncrusticracy.sh [new file with mode: 0644]
qcsrc/tools/uncrustify.sh [new file with mode: 0755]
qcsrc/tools/whitespace.sh [new file with mode: 0755]
qcsrc/uncrusticracy.sh [deleted file]
qcsrc/uncrustify.cfg
qcsrc/uncrustify.sh [deleted file]
qcsrc/whitespace.sh [deleted file]
turrets.cfg
vehicle_bumblebee.cfg [deleted file]
vehicle_racer.cfg [deleted file]
vehicle_raptor.cfg [deleted file]
vehicle_spiderbot.cfg [deleted file]
vehicles.cfg [deleted file]

index bf8bf302160967d1887e0490d3d16b3d6fe1d3a1..0a63b24a2fb6e01bb1ae1d4482111d47d612a0a1 100644 (file)
@@ -1,3 +1,6 @@
+*.q[ch] linguist-language=C
+*.inc linguist-language=C
+
 * -crlf
 *.0 -diff -crlf
 *.1 crlf=input
index d638b6e0081c663f1bae59f9fd2e08d341c6f016..77d421436fd236b2ec9944b2b6aee7fc1a8e7bb9 100644 (file)
@@ -1,33 +1,25 @@
 before_script:
-  - git clone --depth=1 --branch=master https://gitlab.com/xonotic/darkplaces.git darkplaces
-  - cd darkplaces && make sv-debug -j $(nproc)
-  - cd ..
-  - export ENGINE="$PWD/darkplaces/darkplaces-dedicated -xonotic"
+  - ln -s $PWD data/xonotic-data.pk3dir
 
   - git clone --depth=1 --branch=master https://gitlab.com/xonotic/gmqcc.git gmqcc
-  - cd gmqcc && make -j $(nproc)
+  - cd gmqcc && make -j $(nproc) && export QCC="$PWD/gmqcc"
   - cd ..
-  - export QCC="$PWD/gmqcc/gmqcc"
-
-  - ln -s $PWD data/xonotic-data.pk3dir
 
-test_sv_unit:
+test_compilation_units:
   stage: test
   script:
-    - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
-    - make
-    - while read line; do
-        echo $line;
-        if [[ $line == "All tests OK" ]]; then exit 0; fi;
-      done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
-    - exit 1
+    - ./qcsrc/tools/compilationunits.sh
 
 test_sv_game:
   stage: test
   script:
+    - git clone --depth=1 --branch=master https://gitlab.com/xonotic/darkplaces.git darkplaces
+    - cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
+    - cd ..
+
     - wget -O data/g-23.pk3 http://beta.xonotic.org/autobuild-bsp/latest/g-23.pk3
     - make
-    - EXPECT=44a15d27dcfb0bccddc73284e6d968e7
+    - EXPECT=07fdfd9a19025920a599995730eb2a78
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
@@ -39,6 +31,21 @@ test_sv_game:
     - test "$HASH" == "$EXPECT"
     - exit $?
 
+test_sv_unit:
+  stage: test
+  script:
+    - git clone --depth=1 --branch=master https://gitlab.com/xonotic/darkplaces.git darkplaces
+    - cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
+    - cd ..
+
+    - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
+    - make
+    - while read line; do
+        echo $line;
+        if [[ $line == "All tests OK" ]]; then exit 0; fi;
+      done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
+    - exit 1
+
 doxygen:  # rename to 'pages' when gitlab.com allows pages to exceed 100MiB
   stage: deploy
   script:
@@ -53,7 +60,7 @@ doxygen:  # rename to 'pages' when gitlab.com allows pages to exceed 100MiB
     - git clone --single-branch --depth 1 ${DEPLOY_HOST}:${DEPLOY_REPO} ~/deploy_
     - mkdir ~/deploy && mv ~/deploy_/.git ~/deploy && rm -r ~/deploy_
     - cp -r ../public/* ~/deploy
-    - cd ~/deploy && git add -A . && git commit -m "Update" && git push origin gh-pages
+    - cd ~/deploy && git add -A . && git commit -m "Deploy ${CI_BUILD_REF}" && git push origin gh-pages
   artifacts:
     paths:
       - public
index bb7ab5f6780738b28e140ba39d829e2725e84206..97707a7255789ab49f96602d9b5a5373a8f673d1 100644 (file)
@@ -43,7 +43,7 @@ set g_balance_shotgun_primary_spread 0.07
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 2
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
 set g_balance_shotgun_secondary_damage 80
 set g_balance_shotgun_secondary_force 200
 set g_balance_shotgun_secondary_melee_delay 0.25
index 626ada04eab958e36e003f4ec0f0b8fbe04f2ff9..d0cfa361d269c1aae66c89cefc2e3e660f65dd24 100644 (file)
@@ -45,7 +45,7 @@ set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
 set g_balance_shotgun_secondary_alt_animtime 0.2
 set g_balance_shotgun_secondary_alt_refire 1.2
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
 set g_balance_shotgun_secondary_damage 70
 set g_balance_shotgun_secondary_force 200
 set g_balance_shotgun_secondary_melee_delay 0.25
index 5545c6502cf6bdd38e11c80c7ea0cc852b87241c..af2234f0d6c898c02d110d98273a46019bdb7c9d 100644 (file)
@@ -751,7 +751,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
 set g_balance_shotgun_secondary_damage 80
 set g_balance_shotgun_secondary_force 200
 set g_balance_shotgun_secondary_melee_delay 0.25
index cf7a05f6b5b0787fc13555bdc7ce2b8b601d1acf..931a63c6a2264d068110f90817f63be68fc5ac64 100644 (file)
@@ -43,7 +43,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
 set g_balance_shotgun_secondary_damage 80
 set g_balance_shotgun_secondary_force 200
 set g_balance_shotgun_secondary_melee_delay 0.25
index 7cb9d9f4c9b29c5b58ec430244227574d91b19c8..779c7129c68009e6493df50b05af29aef33c6581 100644 (file)
@@ -43,7 +43,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
 set g_balance_shotgun_secondary_damage 70
 set g_balance_shotgun_secondary_force 200
 set g_balance_shotgun_secondary_melee_delay 0.25
index 7cb9d9f4c9b29c5b58ec430244227574d91b19c8..779c7129c68009e6493df50b05af29aef33c6581 100644 (file)
@@ -43,7 +43,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
 set g_balance_shotgun_secondary_damage 70
 set g_balance_shotgun_secondary_force 200
 set g_balance_shotgun_secondary_melee_delay 0.25
index 8ef0f0da26771236f38ee1cbf93479d054d36d44..7ed41440f88ebbc56a349ee841a6194804cda7fe 100644 (file)
@@ -1340,7 +1340,7 @@ set g_frozen_damage_trigger 1 "if 1, frozen players falling into the void will d
 set g_frozen_force 0.6 "How much to multiply the force on a frozen player with"
 
 // player statistics server URI
-set g_playerstats_uri "" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
+set g_playerstats_gamereport_uri "http://stats.xonotic.org/stats/submit" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
 
 // autoscreenshots
 set g_max_info_autoscreenshot 3 "how many info_autoscreenshot entities are allowed"
@@ -1389,7 +1389,6 @@ exec balance-xonotic.cfg
 exec effects-normal.cfg
 exec physicsX.cfg
 exec turrets.cfg
-exec vehicles.cfg
 exec crosshairs.cfg
 exec gamemodes.cfg
 exec mutators.cfg
index 07a5db11e1d70122281df3c605ad7e7790d5cd06..0d67971477597243db12e9c15ab91a52e97e3817 100644 (file)
@@ -1,3 +1,2 @@
 /html/
-/qccversion*
 /*.pk3
index cf700aa843049518e7135ab8b9ffc66498bbf7ee..cb9ca2a883afc26501bec16c6ebcf17687241cfc 100644 (file)
@@ -559,7 +559,7 @@ SORT_MEMBER_DOCS       = YES
 # this will also influence the order of the classes in the class list.
 # The default value is: NO.
 
-SORT_BRIEF_DOCS        = NO
+SORT_BRIEF_DOCS        = YES
 
 # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
 # (brief and detailed) documentation of class members so that constructors and
@@ -571,7 +571,7 @@ SORT_BRIEF_DOCS        = NO
 # detailed member documentation.
 # The default value is: NO.
 
-SORT_MEMBERS_CTORS_1ST = NO
+SORT_MEMBERS_CTORS_1ST = YES
 
 # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
 # of group names into alphabetical order. If set to NO the group names will
@@ -1956,7 +1956,7 @@ ENABLE_PREPROCESSING   = YES
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-MACRO_EXPANSION        = NO
+MACRO_EXPANSION        = YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
 # the macro expansion is limited to the macros specified with the PREDEFINED and
@@ -1964,7 +1964,7 @@ MACRO_EXPANSION        = NO
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_ONLY_PREDEF     = NO
+EXPAND_ONLY_PREDEF     = YES
 
 # If the SEARCH_INCLUDES tag is set to YES, the include files in the
 # INCLUDE_PATH will be searched if a #include is found.
@@ -1978,7 +1978,7 @@ SEARCH_INCLUDES        = YES
 # preprocessor.
 # This tag requires that the tag SEARCH_INCLUDES is set to YES.
 
-INCLUDE_PATH           =
+INCLUDE_PATH           = .
 
 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
 # patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -1996,7 +1996,19 @@ INCLUDE_FILE_PATTERNS  =
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED             =
+PREDEFINED             = \
+    "USING(name, T)=using name = T" \
+    "CLASS(name, base)=class name : public base { public:" \
+    "INIT(class)=class::class()" \
+    "CONSTRUCTOR(class)=class::class(" \
+    "DESTRUCTOR(class)=class::~class()" \
+    "ATTRIB(class, name, T, val)=T name = val;" \
+    "ATTRIB_STRZONE(class, name, T, val)=T name = val;" \
+    "STATIC_ATTRIB(class, name, T, val)=static T name = val;" \
+    "STATIC_ATTRIB_STRZONE(class, name, T, val)=static T name = val;" \
+    "METHOD(class, name, prototype)=virtual void class::name()" \
+    "ENDCLASS(class)=};" \
+    __STDC__
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
@@ -2005,7 +2017,16 @@ PREDEFINED             =
 # definition found in the source code.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_AS_DEFINED      =
+EXPAND_AS_DEFINED      = \
+    USING \
+    CLASS \
+    INIT CONSTRUCTOR DESTRUCTOR \
+    ATTRIB ATTRIB_STRZONE \
+    STATIC_ATTRIB STATIC_ATTRIB_STRZONE \
+    METHOD \
+    ENDCLASS \
+    LABEL \
+    __STDC__
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
 # remove all references to function-like macros that are alone on a line, have
index f6cdc7c20a2fa01535487024d128c1d45a66db08..ee335d9b0013817edf041d88082c9d8a8a9d2cea 100644 (file)
@@ -4,8 +4,8 @@ QCC ?= gmqcc
 PROGS_OUT ?= $(CURDIR)/..
 WORKDIR ?= ../.tmp
 
-QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='*')
-VER = $(QCCFLAGS_WATERMARK)
+QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
+VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
 NDEBUG ?= 1
 BUILD_MOD ?= 0
 
@@ -92,6 +92,7 @@ $(QCCVERSIONFILE): | $(WORKDIR)
        @ $(RM) $(WORKDIR)/qccversion.*
        @ echo $(QCCVERSION) > $@
 
+export WORKDIR
 export CPP
 export QCC
 export QCCDEFS
@@ -99,15 +100,15 @@ export QCCFLAGS
 
 $(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
        @ echo make[1]: Entering directory \`$(CURDIR)/client\'
-       @ ./qcc.sh client $@ $<
+       @ ./tools/qcc.sh client $@ $<
 -include $(WORKDIR)/client.d
 
 $(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
        @ echo make[1]: Entering directory \`$(CURDIR)/server\'
-       @ ./qcc.sh server $@ $<
+       @ ./tools/qcc.sh server $@ $<
 -include $(WORKDIR)/server.d
 
 $(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
        @ echo make[1]: Entering directory \`$(CURDIR)/menu\'
-       @ ./qcc.sh menu $@ $<
+       @ ./tools/qcc.sh menu $@ $<
 -include $(WORKDIR)/menu.d
diff --git a/qcsrc/autocvarize-update.sh b/qcsrc/autocvarize-update.sh
deleted file mode 100755 (executable)
index 31ecc08..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-set -ex
-git checkout divVerent/autocvarizer_test
-trap 'git reset --hard; git checkout divVerent/autocvarizer' EXIT
-trap 'exit 1' INT
-git merge --no-commit -s ours divVerent/autocvarizer
-git read-tree -m -u divVerent/autocvarizer # "theirs"
-find server \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | AUTOCVARING_SVQC=1 xargs -0 perl autocvarize.pl > server/autocvars.qh.new
-diff -Nu server/autocvars.qh server/autocvars.qh.new || true
-mv server/autocvars.qh.new server/autocvars.qh
-find client \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | xargs -0 perl autocvarize.pl > client/autocvars.qh.new
-diff -Nu client/autocvars.qh client/autocvars.qh.new || true
-mv client/autocvars.qh.new client/autocvars.qh
-if make -C .. FTEQCC=../../../../fteqcc/fteqcc.bin FTEQCCFLAGS=; then
-       echo "Commit? ^C to not"
-       read -r L
-       git add server/autocvars.qh
-       git add client/autocvars.qh
-       git commit -a
-else
-       echo "FAILED. Exit this shell when done examining."
-       sh -i
-fi
diff --git a/qcsrc/autocvarize.pl b/qcsrc/autocvarize.pl
deleted file mode 100644 (file)
index 7ac048a..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-#!/usr/bin/perl
-# this tool generates JUST the autocvar declarations for cvars
-use strict;
-use warnings;
-
-my @files = @ARGV;
-
-my %cvars = ();
-my %old = ();
-my %menu = ();
-my %defaults = ();
-
-sub found($$$$)
-{
-       my ($name, $type, $default, $force) = @_;
-       if(length $name >= 55)
-       {
-               warn "cvar $name is a Dr. honorificabilitudinitatibis causa BRLOGENSHFEGLE";
-               $type = 'cvar_toolong';
-               return;
-       }
-#      $old{$name} = 1
-#              if $force;
-#      $menu{$name} = 1
-#              if $force > 1;
-       if(exists $cvars{$name} and not defined $cvars{name})
-       {
-               # have already warned
-       }
-       elsif(exists $cvars{$name} and $type ne $cvars{$name})
-       {
-               warn "cvar $name used with different types";
-               if($force)
-               {
-                       $defaults{$name} = $default;
-                       $cvars{$name} = $type;
-               }
-               else
-               {
-                       undef $cvars{$name}
-                               unless $old{$name};
-               }
-               return;
-       }
-       elsif(exists $cvars{$name} and exists $defaults{$name} and $default ne $defaults{$name})
-       {
-               warn "cvar $name used with different defaults";
-               if($force)
-               {
-                       $defaults{$name} = $default;
-                       $cvars{$name} = $type;
-               }
-               else
-               {
-                       undef $cvars{$name}
-                               unless $old{$name};
-               }
-       }
-       else
-       {
-               $defaults{$name} = $default;
-               $cvars{$name} = $type;
-       }
-}
-
-for my $f(@files)
-{
-       print STDERR "In file $f\n";
-       open my $fh, "<", $f;
-       while(<$fh>)
-       {
-               chomp;
-               if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
-               {
-                       next;
-               }
-               s/\/\/.*//;
-               if(/^(?:var )?float autocvar_(\w+);$/)
-               {
-                       found $1, 'cvar', 0, 1;
-                       next;
-               }
-               if(/^var float autocvar_(\w+) = (.*);$/)
-               {
-                       found $1, 'cvar', $2, 1;
-                       next;
-               }
-               if(/^(?:var )?vector autocvar_(\w+);$/)
-               {
-                       found $1, 'cvar_vector', "0 0 0", 1;
-                       next;
-               }
-               if(/^var vector autocvar_(\w+) = '(.*)';$/)
-               {
-                       found $1, 'cvar_vector', $2, 1;
-                       next;
-               }
-               if(/^(?:var )?string autocvar_(\w+);$/)
-               {
-                       found $1, 'cvar_string', "", 1;
-                       next;
-               }
-               if(/^var string autocvar_(\w+) = "(.*)";$/)
-               {
-                       found $1, 'cvar_string', $2, 1;
-                       next;
-               }
-               if(/^#define autocvar_(\w+) cvar("\1")$/)
-               {
-                       found $1, 'cvar', 0, 2;
-                       next;
-               }
-               if(/^#define autocvar_(\w+) cvar_or("\1", (.*))$/)
-               {
-                       found $1, 'cvar', $1, 2;
-                       next;
-               }
-               if(/^#define autocvar_(\w+) cvar_string("\1")$/)
-               {
-                       found $1, 'cvar_string', "", 2;
-                       next;
-               }
-               while(/\bcvar\s*\(\s*"(\w+)"\s*\)/g)
-               {
-                       found $1, 'cvar', 0, 0;
-               }
-               while(/\bcvar_string\s*\(\s*"(\w+)"\s*\)/g)
-               {
-                       found $1, 'cvar_string', "", 0;
-               }
-               while(/\bcvar_vector\s*\(\s*"(\w+)"\s*\)/g)
-               {
-                       found $1, 'cvar_vector', "0 0 0", 0;
-               }
-               while(/\bcvar_or\s*\(\s*"(\w+)"\s*,\s*([^\s)]+)\s*\)/g)
-               {
-                       found $1, 'cvar', $2, 0;
-               }
-       }
-}
-
-if($ENV{AUTOCVARING_SVQC})
-{
-       for my $f(<menu/xonotic/*.c>)
-       {
-               print STDERR "In file $f\n";
-               open my $fh, "<", $f;
-               while(<$fh>)
-               {
-                       for(/"([^"]*)"/g)
-                       {
-                               $menu{$1} = 1;
-                       }
-               }
-       }
-
-       for my $f(<../maps/campaign*.txt>)
-       {
-               print STDERR "In file $f\n";
-               open my $fh, "<", $f;
-               while(<$fh>)
-               {
-                       for(/\b(.+?)\b/g)
-                       {
-                               $menu{$1} = 1;
-                       }
-               }
-       }
-}
-
-for my $name(sort keys %cvars)
-{
-       my $type = $cvars{$name};
-       my $menu = $menu{$name};
-       my $default = $defaults{$name};
-       die "wtf" if $name =~ /\0/;
-       if(not defined $type)
-       {
-               print "// cannot declare $name, it is used with different types\n";
-       }
-       elsif($type eq 'cvar_toolong')
-       {
-               print "// cannot declare $name, name is too long\n";
-       }
-       elsif($type eq 'cvar' and not $menu and $default eq "0")
-       {
-               print "float autocvar_$name;\n";
-       }
-       elsif($type eq 'cvar' and not $menu and $default ne "0")
-       {
-               print "var float autocvar_$name = $default;\n";
-       }
-       elsif($type eq 'cvar_vector' and not $menu and $default eq "0 0 0")
-       {
-               print "vector autocvar_$name;\n";
-       }
-       elsif($type eq 'cvar_vector' and not $menu and $default ne "0 0 0")
-       {
-               print "var vector autocvar_$name = '$default';\n";
-       }
-       elsif($type eq 'cvar_string' and not $menu and $default eq "")
-       {
-               print "string autocvar_$name;\n";
-       }
-       elsif($type eq 'cvar_string' and not $menu and $default ne "")
-       {
-               print "var string autocvar_$name = \"$default\";\n";
-       }
-       elsif($type eq 'cvar' and $menu and $default eq "0")
-       {
-               print "#define autocvar_$name cvar(\"$name\")\n";
-       }
-       elsif($type eq 'cvar' and $menu and $default ne "0")
-       {
-               print "#define autocvar_$name cvar_or(\"$name\", \"$default\")\n";
-       }
-       elsif($type eq 'cvar_string' and $menu) # sorry, no cvar_or for these
-       {
-               print "#define autocvar_$name cvar_string(\"$name\")\n";
-       }
-       elsif($type eq 'cvar_vector' and $menu) # sorry, no cvar_or for these
-       {
-               print "#define autocvar_$name cvar_vector(\"$name\")\n";
-       }
-}
-
-for my $f(@files)
-{
-       print STDERR "In file $f\n";
-       open my $fh, "<", $f;
-       my $out = "";
-       while(<$fh>)
-       {
-               chomp;
-               if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
-               {
-                       $out .= "$_\n";
-                       next;
-               }
-               if(/^(?:var )?float autocvar_(.*);$/)
-               {
-                       $out .= "$_\n";
-                       next;
-               }
-               if(/^(?:var )?string autocvar_(.*);$/)
-               {
-                       $out .= "$_\n";
-                       next;
-               }
-               if(/^#define autocvar_(.*) cvar/)
-               {
-                       $out .= "$_\n";
-                       next;
-               }
-               s{\b(cvar|cvar_string|cvar_vector|cvar_or)\s*\(\s*"([^"]+)"\s*(?:,\s*[^\s)]+\s*)?\)}{
-                       my ($type, $name) = ($1, $2);
-                       $type = 'cvar' if $type eq 'cvar_or';
-                       my $realtype = $cvars{$name};
-                       my $r = $&;
-                       if(defined $realtype)
-                       {
-                               #$r = "$realtype(\"$name\")";
-                               $r = "autocvar_$name";
-                               if($type eq 'cvar' && $realtype eq 'cvar_string')
-                               {
-                                       $r = "stof($r)";
-                               }
-                               if($type eq 'cvar_string' && $realtype eq 'cvar')
-                               {
-                                       $r = "ftos($r)";
-                               }
-                       }
-                       $r;
-               }ge;
-               $out .= "$_\n";
-       }
-       close $fh;
-       open $fh, ">", $f;
-       print $fh $out;
-       close $fh;
-}
index 5297347533bbd341c854d4be567b6595a4d9bfbe..746734dee2011e048533d0113c4d59a089ea4e82 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_ALL_H
-#define CLIENT_ALL_H
+#pragma once
 
 #include <common/util.qh>
 
@@ -11,5 +10,3 @@
 #include "defs.qh"
 #include "main.qh"
 #include "miscfunctions.qh"
-
-#endif
diff --git a/qcsrc/client/_mod.inc b/qcsrc/client/_mod.inc
new file mode 100644 (file)
index 0000000..acb6977
--- /dev/null
@@ -0,0 +1,13 @@
+// generated file; do not modify
+#include "announcer.qc"
+#include "bgmscript.qc"
+#include "csqcmodel_hooks.qc"
+#include "main.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "player_skeleton.qc"
+#include "scoreboard.qc"
+#include "shownames.qc"
+#include "teamradar.qc"
+#include "view.qc"
+#include "wall.qc"
index 12d07d15044dd50ea036f4b84c5a6fde75cbbf8d..a7b0e47499595474c6c8e90aae4c40eb3a85887b 100644 (file)
@@ -51,12 +51,16 @@ void Announcer_Countdown()
                if(roundstarttime == starttime)
                {
                        Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded);
-                       Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded));
+                       Notification annce_num = Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded);
+                       if(annce_num != NULL)
+                               Local_Notification(MSG_ANNCE, annce_num);
                }
                else
                {
                        Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded);
-                       Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_GAMESTART, countdown_rounded));
+                       Notification annce_num = Announcer_PickNumber(CNT_GAMESTART, countdown_rounded);
+                       if(annce_num != NULL)           
+                               Local_Notification(MSG_ANNCE, annce_num);
                }
 
                this.nextthink = (starttime - (countdown - 1));
@@ -112,63 +116,37 @@ void Announcer_Gamestart()
        previous_game_starttime = startTime;
 }
 
+#define ANNOUNCER_CHECKMINUTE(minute) MACRO_BEGIN { \
+       if(announcer_##minute##min) { \
+               if(timeleft > minute * 60) \
+                       announcer_##minute##min = false; \
+       } else { \
+               if(timeleft < minute * 60 && timeleft > minute * 60 - 1) { \
+                       announcer_##minute##min = true; \
+                       Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_##minute); \
+               } \
+       } \
+} MACRO_END
 
-// Plays the 1 minute or 5 minutes (of maptime) remaining sound, if client wants it
 void Announcer_Time()
 {
-       float timelimit = STAT(TIMELIMIT);
-       float timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time);
-       float warmup_timeleft = 0;
-
+       float timeleft;
        if(warmup_stage)
-               if(autocvar_g_warmup_limit > 0)
-                       warmup_timeleft = max(0, autocvar_g_warmup_limit + STAT(GAMESTARTTIME) - time);
-
-       // 5 minute check
-       if(autocvar_cl_announcer_maptime >= 2)
        {
-               // make sure that after connect (and e.g. 4 minutes left) we will not get a wrong sound
-               if(announcer_5min)
-               {
-                       if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 300)
-                               || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 300))
-                                       announcer_5min = false;
-               }
+               float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+               if(warmup_timelimit > 0)
+                       timeleft = max(0, warmup_timelimit - time);
                else
-               {
-                       if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 300 && timeleft > 299)
-                               || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 300 && warmup_timeleft > 299))
-                       {
-                               //if we're in warmup mode, check whether there's a warmup timelimit
-                               if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
-                               {
-                                       announcer_5min = true;
-                                       Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_5);
-                               }
-                       }
-               }
+                       timeleft = 0;
        }
+       else
+               timeleft = max(0, STAT(TIMELIMIT) * 60 + STAT(GAMESTARTTIME) - time);
+
+       if(autocvar_cl_announcer_maptime >= 2)
+               ANNOUNCER_CHECKMINUTE(5);
 
-       // 1 minute check
        if((autocvar_cl_announcer_maptime == 1) || (autocvar_cl_announcer_maptime == 3))
-       {
-               if (announcer_1min)
-               {
-                       if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 60)
-                               || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 60))
-                                       announcer_1min = false;
-               }
-               else if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 60)
-                       || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 60))
-               {
-                       // if we're in warmup mode, check whether there's a warmup timelimit
-                       if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
-                       {
-                               announcer_1min = true;
-                               Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_1);
-                       }
-               }
-       }
+               ANNOUNCER_CHECKMINUTE(1);
 }
 
 void Announcer()
index 314c6602d8dd8871051557bcd3a2b52593b0635f..c7c0eb0259963f39e5100f31c3f3e76d97147c16 100644 (file)
@@ -1,8 +1,5 @@
-#ifndef CLIENT_ANNOUNCER_H
-#define CLIENT_ANNOUNCER_H
+#pragma once
 
 void Announcer();
 
 string AnnouncerOption();
-
-#endif
index d48fb6333513f9cf4d5d25533ef38627175a422e..3320b16620927c9840efeb86021f73ec1392484d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_AUTOCVARS_H
-#define CLIENT_AUTOCVARS_H
+#pragma once
 
 bool autocvar__con_chat_maximized;
 bool autocvar__hud_configure;
@@ -79,10 +78,11 @@ float autocvar_cl_spawnzoom_speed = 1;
 float autocvar_cl_spawnzoom_factor = 2;
 bool autocvar_cl_stripcolorcodes;
 bool autocvar_cl_vehicles_alarm = true;
-bool autocvar_cl_vehicles_hud_tactical = 1;
+bool autocvar_cl_vehicles_hud_tactical = true;
 float autocvar_cl_vehicles_hudscale = 0.5;
 float autocvar_cl_vehicles_notify_time = 15;
 float autocvar_cl_vehicles_crosshair_size = 0.5;
+bool autocvar_cl_vehicles_crosshair_colorize = true;
 bool autocvar__vehicles_shownchasemessage;
 bool autocvar_cl_velocityzoom_enabled;
 float autocvar_cl_velocityzoom_factor;
@@ -154,7 +154,6 @@ float autocvar_crosshair_size;
 int autocvar_ekg;
 float autocvar_fov;
 float autocvar_g_balance_damagepush_speedfactor;
-float autocvar_g_warmup_limit;
 bool autocvar_hud_cursormode = true;
 float autocvar_hud_colorflash_alpha;
 bool autocvar_hud_configure_checkcollisions;
@@ -454,4 +453,3 @@ float autocvar_crosshair_rpc_alpha = 1;
 float autocvar_crosshair_rpc_size = 1;
 int autocvar_cl_nade_timer;
 bool autocvar_cl_items_nofade;
-#endif
index d979e79d0731042f9d26579e6917bf50a0d34bd4..18b0d5ee4231c5c9e95998fdad5be86331b0b1e8 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_BGMSCRIPT_H
-#define CLIENT_BGMSCRIPT_H
+#pragma once
 
 entityclass(BGMScript);
 class(BGMScript) .string bgmscript;
@@ -14,5 +13,3 @@ class(BGMScript) .float just_toggled;
 void BGMScript_InitEntity(entity e);
 float doBGMScript(entity e);
 #endif
-
-#endif
diff --git a/qcsrc/client/commands/_mod.inc b/qcsrc/client/commands/_mod.inc
new file mode 100644 (file)
index 0000000..d9220c6
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "all.qc"
+#include "cl_cmd.qc"
index d37165ca9611e9116c33ea23049fe97e6bce99a4..bc15eeb689560fbaa07b91647cbd6cbe15ff1bdd 100644 (file)
@@ -1,3 +1,2 @@
+#include "all.qh"
 #include <common/command/all.qc>
-
-#include "cl_cmd.qc"
index cdaf8c55f727836a7ac89649fdaf9a77b1da799f..2df61f004bc21a072bdd32bbc4bd37e75bddf8b1 100644 (file)
@@ -1,8 +1,5 @@
-#ifndef CLIENT_COMMANDS_ALL_H
-#define CLIENT_COMMANDS_ALL_H
+#pragma once
 
-#include <common/commands/all.qh>
+#include <common/command/all.qh>
 
 #include "cl_cmd.qh"
-
-#endif
index b512ba53abfd5515483b41f1a8e8df21aedd489e..6dadff2f3cb8e610b2fd81bfbd78f77807557614 100644 (file)
@@ -1,3 +1,4 @@
+#include "cl_cmd.qh"
 // ==============================================
 //  CSQC client commands code, written by Samual
 //  Last updated: December 28th, 2011
@@ -40,6 +41,7 @@ void DrawDebugModel(entity this)
 
 void LocalCommand_blurtest(int request)
 {
+    TC(int, request);
        // Simple command to work with postprocessing temporarily... possibly completely pointless, the glsl shader is used for a real feature now...
        // Anyway, to enable it, just compile the client with -DBLURTEST and then you can use the command.
 
@@ -75,6 +77,7 @@ void LocalCommand_blurtest(int request)
 
 void LocalCommand_boxparticles(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -128,6 +131,7 @@ void LocalCommand_boxparticles(int request, int argc)
 
 void LocalCommand_create_scrshot_ent(int request)
 {
+    TC(int, request);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -166,6 +170,7 @@ void LocalCommand_create_scrshot_ent(int request)
 
 void LocalCommand_debugmodel(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -194,6 +199,7 @@ void LocalCommand_debugmodel(int request, int argc)
 
 void LocalCommand_handlevote(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -253,6 +259,7 @@ void HUD_Radar_Show_Maximized(bool doshow, bool clickable);
 
 void LocalCommand_hud(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -345,6 +352,7 @@ void LocalCommand_hud(int request, int argc)
 
 void LocalCommand_localprint(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -371,6 +379,7 @@ void LocalCommand_localprint(int request, int argc)
 
 void LocalCommand_mv_download(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -397,6 +406,7 @@ void LocalCommand_mv_download(int request, int argc)
 
 void LocalCommand_sendcvar(int request, int argc)
 {
+    TC(int, request); TC(int, argc);
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -479,7 +489,7 @@ bool LocalCommand_macro_command(int argc, string command)
 {
        string c = strtolower(argv(0));
        FOREACH(CLIENT_COMMANDS, it.m_name == c, {
-               it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+               it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
                return true;
        });
        return false;
@@ -489,7 +499,7 @@ bool LocalCommand_macro_usage(int argc)
 {
        string c = strtolower(argv(1));
        FOREACH(CLIENT_COMMANDS, it.m_name == c, {
-               it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+               it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
                return true;
        });
        return false;
index d53d1b6a6e671ee0c752b0deb534c4ba309f7b7a..65a723389e793645f7f2a674a8277ad85d61f0a8 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_COMMANDS_CL_CMD_H
-#define CLIENT_COMMANDS_CL_CMD_H
+#pragma once
 
 void Cmd_HUD_SetFields(int);
 void Cmd_HUD_Help();
@@ -18,10 +17,8 @@ REGISTRY_SORT(CLIENT_COMMANDS)
        ATTRIB(clientcommand_##id, m_description, string, description); \
        ENDCLASS(clientcommand_##id) \
     REGISTER(CLIENT_COMMANDS, CMD_CL, id, m_id, NEW(clientcommand_##id)); \
-       METHOD(clientcommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+       METHOD(clientcommand_##id, m_invokecmd, void(clientcommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(CLIENT_COMMANDS_aliases) {
        FOREACH(CLIENT_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_cl")));
 }
-
-#endif
diff --git a/qcsrc/client/credit.txt b/qcsrc/client/credit.txt
deleted file mode 100644 (file)
index b07ec4a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Credits go to Dresk for putting this CSQC scratch source together.
-
-and Urre :o
index d70de9cb3ff3c2720d9a0c26dab47293bde2d8e0..2ea1e746f7c60e12104563d3dd2751ff66bb2fcc 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_CSQC_CONSTANTS
-#define CLIENT_CSQC_CONSTANTS
+#pragma once
 
 // Mask Constants (set .drawmask on entities; use R_AddEntities to add all entities based on mask)
 const int              MASK_ENGINE                                             = BIT(0);
@@ -141,5 +140,3 @@ const int CAMERA_FREE = 1;
 const int CAMERA_CHASE = 2;
 
 const int EF_NOMODELFLAGS = BIT(23);
-
-#endif
index 8f8d65c986d65dfab427a3a7396aec227cdd5254..35f28bdca4dec5baea11b3a20dc3db4ca0a76322 100644 (file)
@@ -1,3 +1,4 @@
+#include "csqcmodel_hooks.qh"
 #include "mutators/events.qh"
 #include "player_skeleton.qh"
 #include "weapons/projectile.qh"
@@ -352,6 +353,7 @@ void CSQCPlayer_AnimDecide_PostUpdate(entity this, bool isnew)
 }
 int CSQCPlayer_FallbackFrame(entity this, int f)
 {
+    TC(int, f);
        if(frameduration(this.modelindex, f) > 0)
                return f; // goooooood
        if(frameduration(this.modelindex, 1) <= 0)
@@ -459,26 +461,6 @@ void CSQCModel_AutoTagIndex_Apply(entity this)
        }
 }
 
-// FEATURE: EF_NODRAW workalike
-const int EF_BRIGHTFIELD       = BIT(0);
-const int EF_BRIGHTLIGHT       = BIT(2);
-const int EF_DIMLIGHT          = BIT(3);
-const int EF_DOUBLESIDED       = BIT(15);
-const int EF_NOSELFSHADOW      = BIT(16);
-const int EF_DYNAMICMODELLIGHT = BIT(17);
-const int EF_RESTARTANIM_BIT = BIT(20);
-const int EF_TELEPORT_BIT = BIT(21);
-const int MF_ROCKET  =  BIT(0); // leave a trail
-const int MF_GRENADE =  BIT(1); // leave a trail
-const int MF_GIB     =  BIT(2); // leave a trail
-const int MF_ROTATE  =  BIT(3); // rotate (bonus items)
-const int MF_TRACER  =  BIT(4); // green split trail
-const int MF_ZOMGIB  =  BIT(5); // small blood trail
-const int MF_TRACER2 =  BIT(6); // orange split trail
-const int MF_TRACER3 = BIT(7); // purple trail
-.int csqcmodel_effects;
-.int csqcmodel_modelflags;
-.int csqcmodel_traileffect;
 void CSQCModel_Effects_PreUpdate(entity this)
 {
        this.effects = this.csqcmodel_effects;
diff --git a/qcsrc/client/csqcmodel_hooks.qh b/qcsrc/client/csqcmodel_hooks.qh
new file mode 100644 (file)
index 0000000..56a3fb4
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once
+
+// FEATURE: EF_NODRAW workalike
+const int EF_BRIGHTFIELD       = BIT(0);
+const int EF_BRIGHTLIGHT       = BIT(2);
+const int EF_DIMLIGHT          = BIT(3);
+const int EF_DOUBLESIDED       = BIT(15);
+const int EF_NOSELFSHADOW      = BIT(16);
+const int EF_DYNAMICMODELLIGHT = BIT(17);
+const int EF_RESTARTANIM_BIT   = BIT(20);
+const int EF_TELEPORT_BIT      = BIT(21);
+
+const int MF_ROCKET  =  BIT(0);  // leave a trail
+const int MF_GRENADE =  BIT(1);  // leave a trail
+const int MF_GIB     =  BIT(2);  // leave a trail
+const int MF_ROTATE  =  BIT(3);  // rotate (bonus items)
+const int MF_TRACER  =  BIT(4);  // green split trail
+const int MF_ZOMGIB  =  BIT(5);  // small blood trail
+const int MF_TRACER2 =  BIT(6);  // orange split trail
+const int MF_TRACER3 =  BIT(7);  // purple trail
+
+.int csqcmodel_effects;
+.int csqcmodel_modelflags;
+.int csqcmodel_traileffect;
+
+void CSQCModel_Effects_Apply(entity this);
index d3db0ebfde08cfdd0763fbe46b49b33cf9528ae2..84bcb2b3d1de61b9417c250c5f28d1ad4ce79270 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_DEFS_H
-#define CLIENT_DEFS_H
+#pragma once
 
 // Additional OPTIONAL Fields and Globals
 //float                intermission;
@@ -122,5 +121,3 @@ float uid2name_dialog;
 .bool csqcmodel_isdead; // used by shownames and miscfunctions (entcs_IsDead) to know when a player is dead
 
 #define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
-
-#endif
diff --git a/qcsrc/client/hud/_mod.inc b/qcsrc/client/hud/_mod.inc
new file mode 100644 (file)
index 0000000..73066c3
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "hud.qc"
+#include "hud_config.qc"
diff --git a/qcsrc/client/hud/all.qc b/qcsrc/client/hud/all.qc
deleted file mode 100644 (file)
index 680b023..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "hud.qc"
-#include "hud_config.qc"
index b0f2b9ea65d37bdb8c54e5a5e0ee05f8b53224e9..d89f3106454f1a29abbc5d015438b9cdbd94a679 100644 (file)
@@ -8,11 +8,11 @@
 #include <common/deathtypes/all.qh>
 #include <common/items/all.qc>
 #include <common/mapinfo.qh>
+#include <common/vehicles/all.qh>
 #include <common/mutators/mutator/waypoints/all.qh>
 #include <common/stats.qh>
 #include <lib/csqcmodel/cl_player.qh>
-// TODO: remove
-#include <server/mutators/mutator/gamemode_ctf.qc>
+#include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
 
 
 /*
@@ -68,12 +68,14 @@ vector HUD_Get_Num_Color (float x, float maxvalue)
 
 float HUD_GetRowCount(int item_count, vector size, float item_aspect)
 {
+    TC(int, item_count);
        float aspect = size_y / size_x;
        return bound(1, floor((sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) / 2), item_count);
 }
 
 vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
 {
+    TC(int, item_count);
        float columns, rows;
        float ratio, best_ratio = 0;
        float best_columns = 1, best_rows = 1;
@@ -112,85 +114,6 @@ vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspe
                return eX * best_columns + eY * best_rows;
 }
 
-// return the string of the onscreen race timer
-string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
-{
-       string col;
-       string timestr;
-       string cpname;
-       string lapstr;
-       lapstr = "";
-
-       if(theirtime == 0) // goal hit
-       {
-               if(mytime > 0)
-               {
-                       timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
-                       col = "^1";
-               }
-               else if(mytime == 0)
-               {
-                       timestr = "+0.0";
-                       col = "^3";
-               }
-               else
-               {
-                       timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
-                       col = "^2";
-               }
-
-               if(lapdelta > 0)
-               {
-                       lapstr = sprintf(_(" (-%dL)"), lapdelta);
-                       col = "^2";
-               }
-               else if(lapdelta < 0)
-               {
-                       lapstr = sprintf(_(" (+%dL)"), -lapdelta);
-                       col = "^1";
-               }
-       }
-       else if(theirtime > 0) // anticipation
-       {
-               if(mytime >= theirtime)
-                       timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
-               else
-                       timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
-               col = "^3";
-       }
-       else
-       {
-               col = "^7";
-               timestr = "";
-       }
-
-       if(cp == 254)
-               cpname = _("Start line");
-       else if(cp == 255)
-               cpname = _("Finish line");
-       else if(cp)
-               cpname = sprintf(_("Intermediate %d"), cp);
-       else
-               cpname = _("Finish line");
-
-       if(theirtime < 0)
-               return strcat(col, cpname);
-       else if(theirname == "")
-               return strcat(col, sprintf("%s (%s)", cpname, timestr));
-       else
-               return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
-}
-
-// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
-int race_CheckName(string net_name)
-{
-       int i;
-       for (i=RANKINGS_CNT-1;i>=0;--i)
-               if(grecordholder[i] == net_name)
-                       return i+1;
-       return 0;
-}
-
 /*
 ==================
 HUD panels
@@ -200,6 +123,7 @@ HUD panels
 //basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
 {
+    TC(bool, vertical); TC(int, drawflag);
        if(!length_ratio || !theAlpha)
                return;
        if(length_ratio > 1)
@@ -303,6 +227,7 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo
 
 void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag)
 {
+    TC(int, drawflag);
        if(!theAlpha)
                return;
 
@@ -318,8 +243,9 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA
        drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
 }
 
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp)
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
 {
+    TC(bool, vertical); TC(int, icon_right_align);
        vector newPos = '0 0 0', newSize = '0 0 0';
        vector picpos, numpos;
 
@@ -397,8 +323,9 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bo
        drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
 }
 
-void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha)
+void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha)
 {
+    TC(bool, vertical); TC(int, icon_right_align);
        DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0);
 }
 
@@ -410,6 +337,8 @@ Main HUD system
 ==================
 */
 
+void CSQC_BUMBLE_GUN_HUD();
+
 void HUD_Vehicle()
 {
        if(autocvar__hud_configure) return;
@@ -425,6 +354,7 @@ void HUD_Vehicle()
 
 bool HUD_Panel_CheckFlags(int showflags)
 {
+    TC(int, showflags);
        if ( HUD_Minigame_Showpanels() )
                return showflags & PANEL_SHOW_MINIGAME;
        if(intermission == 2)
index 45dd4887f2678ff435c54cb5a7b203d55c4f73b4..d46b11db571a7044d2acfec43562a8da05cbdb3f 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_HUD_H
-#define CLIENT_HUD_H
+#pragma once
 
 #include <common/weapons/all.qh>
 
@@ -42,9 +41,19 @@ bool radar_panel_modified;
 float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary);
 void HUD_Radar_Hide_Maximized();
 
+float HUD_GetRowCount(int item_count, vector size, float item_aspect);
+vector HUD_Get_Num_Color (float x, float maxvalue);
+void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
+void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
+vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);
+
 void HUD_Reset ();
 void HUD_Main ();
 
+int race_CheckName(string net_name);
+string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname);
+
 int vote_yescount;
 int vote_nocount;
 int vote_needed;
@@ -412,4 +421,3 @@ void HUD_Notify_Push(string icon, string attacker, string victim);
 
 var void HUD_ModIcons_GameType(vector pos, vector size);
 void HUD_ModIcons_SetFunc();
-#endif
index 2ba78f798a1e45816a03043bbcafe2251fc3efe5..07166105e5f6f043d99d65ccb57e95da60275e35 100644 (file)
@@ -641,8 +641,7 @@ float tab_backward;
 void HUD_Panel_FirstInDrawQ(float id);
 void reset_tab_panels()
 {
-       int i;
-       for(i = 0; i < hud_panels_COUNT; ++i)
+       for (int i = 0; i < hud_panels_COUNT; ++i)
                tab_panels[i] = world;
 }
 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
@@ -775,7 +774,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                vector candidate_pos = '0 0 0';
                const float LEVELS_NUM = 4;
                float level_height = vid_conheight / LEVELS_NUM;
-:find_tab_panel
+LABEL(find_tab_panel)
                level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
                candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
                start_posX = tab_panel_pos.x;
index 05792286da30ae888483227e59178f0065fb7c28..32c846076145def23fbe3bb769dfbbec2bb63473 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_HUD_CONFIG_H
-#define CLIENT_HUD_CONFIG_H
+#pragma once
 
 const int S_MOUSE1 = 1;
 const int S_MOUSE2 = 2;
@@ -18,5 +17,3 @@ void HUD_Configure_Frame();
 void HUD_Configure_PostDraw();
 
 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary);
-
-#endif
diff --git a/qcsrc/client/hud/panel.qh b/qcsrc/client/hud/panel.qh
new file mode 100644 (file)
index 0000000..66ca077
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "hud.qh"
+#include "hud_config.qh"
+#include <client/mutators/events.qh>
diff --git a/qcsrc/client/hud/panel/_mod.inc b/qcsrc/client/hud/panel/_mod.inc
new file mode 100644 (file)
index 0000000..2995164
--- /dev/null
@@ -0,0 +1,20 @@
+// generated file; do not modify
+#include "ammo.qc"
+#include "centerprint.qc"
+#include "chat.qc"
+#include "engineinfo.qc"
+#include "healtharmor.qc"
+#include "infomessages.qc"
+#include "minigame.qc"
+#include "modicons.qc"
+#include "notify.qc"
+#include "physics.qc"
+#include "powerups.qc"
+#include "pressedkeys.qc"
+#include "quickmenu.qc"
+#include "racetimer.qc"
+#include "radar.qc"
+#include "score.qc"
+#include "timer.qc"
+#include "vote.qc"
+#include "weapons.qc"
index 6c0621f42371af31916bb7d12c85323dea6bcef2..fda7887b1641d74d55f3b8a2e3c9ded8e36d7874 100644 (file)
@@ -1,3 +1,7 @@
+#include "ammo.qh"
+
+#include <common/t_items.qh>
+
 // Ammo (#1)
 
 void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color)
@@ -14,6 +18,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
 
 void DrawAmmoItem(vector myPos, vector mySize, .int ammoType, bool isCurrent, bool isInfinite)
 {
+    TC(bool, isCurrent); TC(bool, isInfinite);
        if(ammoType == ammo_none)
                return;
 
diff --git a/qcsrc/client/hud/panel/ammo.qh b/qcsrc/client/hud/panel/ammo.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 0c64aa00a9039eb6d74d0cb3f6a0a954289dc8ec..99e8baaa65807a2a390b85050a1f53a1c70838a7 100644 (file)
@@ -1,3 +1,7 @@
+#include "centerprint.qh"
+
+#include <client/scoreboard.qh>
+
 // CenterPrint (#16)
 
 const int CENTERPRINT_MAX_MSGS = 10;
@@ -13,6 +17,7 @@ bool centerprint_showing;
 
 void centerprint_generic(int new_id, string strMessage, float duration, int countdown_num)
 {
+    TC(int, new_id); TC(int, countdown_num);
        //printf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num);
        int i, j;
 
@@ -87,8 +92,9 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun
        centerprint_countdown_num[j] = countdown_num;
 }
 
-void centerprint_kill(float id)
+void centerprint_kill(int id)
 {
+    TC(int, id);
        centerprint_generic(id, "", 0, 0);
 }
 
@@ -99,8 +105,7 @@ void centerprint_hud(string strMessage)
 
 void reset_centerprint_messages()
 {
-       int i;
-       for (i=0; i<CENTERPRINT_MAX_MSGS; ++i)
+       for (int i=0; i<CENTERPRINT_MAX_MSGS; ++i)
        {
                centerprint_expire_time[i] = 0;
                centerprint_time[i] = 1;
diff --git a/qcsrc/client/hud/panel/centerprint.qh b/qcsrc/client/hud/panel/centerprint.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 02df4ed6290f1af6398b64e8b016cc699dd1b218..dd89b791ce2c2362513a86c03fee66894e68bb12 100644 (file)
@@ -1,3 +1,4 @@
+#include "chat.qh"
 /** Handle chat as a panel (#12) */
 void HUD_Chat()
 {
diff --git a/qcsrc/client/hud/panel/chat.qh b/qcsrc/client/hud/panel/chat.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 1a22c54e8420bb4d4c951541e49347939d420521..ea136a21489abd1c111b457ec27855cd23a673fc 100644 (file)
@@ -1,3 +1,4 @@
+#include "engineinfo.qh"
 // Engine info panel (#13)
 
 float prevfps;
diff --git a/qcsrc/client/hud/panel/engineinfo.qh b/qcsrc/client/hud/panel/engineinfo.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 3b094d39d9f6b40849e3eb146ea8b6b93762689a..3b03979177da96edf15e5c4a3ee0ed35f04b0ee1 100644 (file)
@@ -1,3 +1,7 @@
+#include "healtharmor.qh"
+
+#include <common/deathtypes/all.qh>
+
 /** Health/armor (#3) */
 void HUD_HealthArmor()
 {
diff --git a/qcsrc/client/hud/panel/healtharmor.qh b/qcsrc/client/hud/panel/healtharmor.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 74b962410c6f748014db3ff0a78ffa5eab52e44a..8199bd8dd6d82f10dfb9a031f3feea8266e63a02 100644 (file)
@@ -1,3 +1,8 @@
+#include "infomessages.qh"
+
+#include <common/ent_cs.qh>
+#include <common/mapinfo.qh>
+
 // Info messages panel (#14)
 
 #define drawInfoMessage(s) MACRO_BEGIN {                                                                                                                                                       \
diff --git a/qcsrc/client/hud/panel/infomessages.qh b/qcsrc/client/hud/panel/infomessages.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 6979ee4136eba4b7e356db960395a0f54ed68d15..933528a495f72f20d47b1f76dae0e9c50d05af4c 100644 (file)
@@ -1,3 +1,4 @@
+#include "minigame.qh"
 // Minigame
 
 #include <common/minigames/cl_minigames_hud.qc>
diff --git a/qcsrc/client/hud/panel/minigame.qh b/qcsrc/client/hud/panel/minigame.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 0705ddfe5c3091cf1fe2b48e72b2437da69dc664..5b4665f563f8f10ceb22f94316cb8562da5219d3 100644 (file)
@@ -1,9 +1,16 @@
+#include "modicons.qh"
+
+#include <common/mapinfo.qh>
+#include <common/ent_cs.qh>
+#include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
+
 // Mod icons panel (#10)
 
 bool mod_active; // is there any active mod icon?
 
 void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
 {
+    TC(int, layout); TC(int, i);
        int stat = -1;
        string pic = "";
        vector color = '0 0 0';
@@ -484,13 +491,33 @@ float srecordtime_change_time; // time when srecordtime last changed
 float race_status_time;
 int race_status_prev;
 string race_status_name_prev;
+
+// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
+int race_CheckName(string net_name)
+{
+       int i;
+       for (i=RANKINGS_CNT-1;i>=0;--i)
+               if(grecordholder[i] == net_name)
+                       return i+1;
+       return 0;
+}
+
+void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)
+{
+       drawstring_aspect(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawstring_aspect(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       if (f < 1) {
+               drawstring_aspect_expanding(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+               drawstring_aspect_expanding(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+       }
+}
+
 void HUD_Mod_Race(vector pos, vector mySize)
 {
        mod_active = 1; // race should never hide the mod icons panel
        entity me;
        me = playerslots[player_localnum];
        float score;
-       float f; // yet another function has this
        score = me.(scores[ps_primary]);
 
        if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD
@@ -508,7 +535,7 @@ void HUD_Mod_Race(vector pos, vector mySize)
                db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score));
                if(autocvar_cl_autodemo_delete_keeprecords)
                {
-                       f = autocvar_cl_autodemo_delete;
+                       float f = autocvar_cl_autodemo_delete;
                        f &= ~1;
                        cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
                }
@@ -532,18 +559,9 @@ void HUD_Mod_Race(vector pos, vector mySize)
                textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize);
                medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize);
        }
+       vector textSize = eX * squareSize + eY * 0.25 * squareSize;
 
-       f = time - crecordtime_change_time;
-
-       if (f > 1) {
-               drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       } else {
-               drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect_expanding(pos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
-               drawstring_aspect_expanding(pos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
-       }
+       race_showTime(_("Personal best"), textPos, eY * 0.25 * squareSize, t, textSize, time - crecordtime_change_time);
 
        // server record
        t = race_server_record;
@@ -551,17 +569,9 @@ void HUD_Mod_Race(vector pos, vector mySize)
                srecordtime_prev = t;
                srecordtime_change_time = time;
        }
-       f = time - srecordtime_change_time;
 
-       if (f > 1) {
-               drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       } else {
-               drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect_expanding(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
-               drawstring_aspect_expanding(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
-       }
+       textPos += eY * 0.5 * squareSize;
+       race_showTime(_("Server best"), textPos, eY * 0.25 * squareSize, t, textSize, time - srecordtime_change_time);
 
        if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
                race_status_time = time + 5;
@@ -624,6 +634,7 @@ void HUD_Mod_Race(vector pos, vector mySize)
 
 void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
 {
+    TC(int, layout); TC(int, i);
        float stat = -1;
        string pic = "";
        vector color = '0 0 0';
diff --git a/qcsrc/client/hud/panel/modicons.qh b/qcsrc/client/hud/panel/modicons.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 3c4b9c10514236a10d5be3f633ebe3c48587a5bb..1f0e26b9a5e7274f8559ab7c402e6d619519e478 100644 (file)
@@ -1,3 +1,4 @@
+#include "notify.qh"
 // Notification area (#4)
 
 void HUD_Notify_Push(string icon, string attacker, string victim)
diff --git a/qcsrc/client/hud/panel/notify.qh b/qcsrc/client/hud/panel/notify.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index e59b5e716466d31316b3df15d53678ffc19dd8ca..7a9f664eb233d89a9342d8838fb7f934f6a13299 100644 (file)
@@ -1,3 +1,8 @@
+#include "physics.qh"
+
+#include <common/mapinfo.qh>
+#include <lib/csqcmodel/cl_player.qh>
+
 // Physics panel (#15)
 
 vector acc_prevspeed;
diff --git a/qcsrc/client/hud/panel/physics.qh b/qcsrc/client/hud/panel/physics.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 854ed594a0de49904ab2544f501ec23ff4ce916e..31a00794e3ed7977c2eb4bb04480831a2791191b 100644 (file)
@@ -1,3 +1,7 @@
+#include "powerups.qh"
+
+#include <common/items/all.qc>
+
 // Powerups (#2)
 
 // Powerup item fields (reusing existing fields)
@@ -40,6 +44,7 @@ void addPowerupItem(string name, string icon, vector color, float currentTime, f
 
 int getPowerupItemAlign(int align, int column, int row, int columns, int rows, bool isVertical)
 {
+    TC(int, align); TC(int, column); TC(int, row); TC(int, columns); TC(int, rows); TC(bool, isVertical);
        if(align < 2)
                return align;
 
diff --git a/qcsrc/client/hud/panel/powerups.qh b/qcsrc/client/hud/panel/powerups.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 7d6955009764f5389424ed669955b0b6a1da4b99..3b512b1c33a622107fe73b558e32f8f425dd3a53 100644 (file)
@@ -1,3 +1,4 @@
+#include "pressedkeys.qh"
 /** Draw pressed keys (#11) */
 void HUD_PressedKeys()
 {
diff --git a/qcsrc/client/hud/panel/pressedkeys.qh b/qcsrc/client/hud/panel/pressedkeys.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 0ad5c4965b0141e0629b78634fac4b06db0629ab..de4a05f132d185505b08c7e34c2dfcc94e6839f9 100644 (file)
@@ -1,3 +1,878 @@
+#include "quickmenu.qh"
 // QuickMenu (#23)
 
-#include <client/quickmenu.qc>
+#include <common/ent_cs.qh>
+#include <client/hud/all.qh>
+#include <client/mapvoting.qh>
+
+// QUICKMENU_MAXLINES must be <= 10
+const int QUICKMENU_MAXLINES = 10;
+// visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
+string QuickMenu_Page_Command[QUICKMENU_MAXLINES];
+string QuickMenu_Page_Description[QUICKMENU_MAXLINES];
+int QuickMenu_Page_Command_Type[QUICKMENU_MAXLINES];
+int QuickMenu_Page_Entries;
+int QuickMenu_Page;
+int QuickMenu_Page_ActivatedEntry = -1;
+bool QuickMenu_Page_ActivatedEntry_Close;
+float QuickMenu_Page_ActivatedEntry_Time;
+bool QuickMenu_IsLastPage;
+// all the entries are loaded into QuickMenu_Buffer
+// each entry (submenu or command) is composed of 2 entries
+const int QUICKMENU_MAXENTRIES = 256;
+const int QUICKMENU_BUFFER_MAXENTRIES = 2 * QUICKMENU_MAXENTRIES;
+int QuickMenu_Buffer = -1;
+int QuickMenu_Buffer_Size;
+int QuickMenu_Buffer_Index;
+string QuickMenu_CurrentSubMenu;
+float QuickMenu_TimeOut;
+
+// QuickMenu_Buffer are labeled with these tags
+#define QM_TAG_TITLE "T"
+#define QM_TAG_SUBMENU "S"
+#define QM_TAG_COMMAND "C"
+#define QM_TAG_PLCOMMAND "P"
+
+#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
+#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
+
+// if s1 is not empty s will be displayed as command otherwise as submenu
+void QuickMenu_Page_LoadEntry(int i, string s, string s1)
+{
+    TC(int, i);
+       //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
+       if (QuickMenu_Page_Description[i])
+               strunzone(QuickMenu_Page_Description[i]);
+       QuickMenu_Page_Description[i] = strzone(s);
+       if (QuickMenu_Page_Command[i])
+               strunzone(QuickMenu_Page_Command[i]);
+       QuickMenu_Page_Command[i] = strzone(s1);
+}
+
+void QuickMenu_Page_ClearEntry(int i)
+{
+    TC(int, i);
+       if (QuickMenu_Page_Description[i])
+               strunzone(QuickMenu_Page_Description[i]);
+       QuickMenu_Page_Description[i] = string_null;
+       if (QuickMenu_Page_Command[i])
+               strunzone(QuickMenu_Page_Command[i]);
+       QuickMenu_Page_Command[i] = string_null;
+}
+
+float QuickMenu_Page_Load(string target_submenu, float new_page);
+void QuickMenu_Default(string submenu);
+bool QuickMenu_Open(string mode, string submenu)
+{
+       int fh = -1;
+       string s;
+
+       if(mode == "")
+       {
+               if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
+                       mode = "default";
+               else
+                       mode = "file";
+       }
+
+       if(mode == "file")
+       {
+               if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
+                       LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
+               else
+               {
+                       fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
+                       if(fh < 0)
+                               LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file);
+               }
+               if(fh < 0)
+                       mode = "default";
+       }
+
+       if(mode == "default")
+       {
+               QuickMenu_Buffer = buf_create();
+               if(QuickMenu_Buffer < 0)
+                       return false;
+
+               QuickMenu_Default(submenu);
+       }
+       else if(mode == "file")
+       {
+               QuickMenu_Buffer = buf_create();
+               if(QuickMenu_Buffer < 0)
+               {
+                       fclose(fh);
+                       return false;
+               }
+
+               QuickMenu_Buffer_Size = 0;
+               while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
+               {
+                       // first skip invalid entries, so we don't check them anymore
+                       float argc;
+                       argc = tokenize_console(s);
+                       if(argc == 0 || argv(0) == "")
+                               continue;
+                       if(argc == 1)
+                               QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+                       else if(argc == 2)
+                       {
+                               if(argv(1) == "")
+                                       continue;
+                               QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
+                               ++QuickMenu_Buffer_Size;
+                               QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
+                       }
+                       else if(argc == 3)
+                       {
+                               // check for special keywords
+                               float teamplayers = 0, without_me = 0;
+                               switch(argv(2))
+                               {
+                                       case "ALLPLAYERS_BUT_ME":               without_me = 1; // fall through
+                                       case "ALLPLAYERS":                              teamplayers = 0; break;
+                                       case "OWNTEAMPLAYERS_BUT_ME":   without_me = 1; // fall through
+                                       case "OWNTEAMPLAYERS":                  teamplayers = 1; break;
+                                       case "ENEMYTEAMPLAYERS":                teamplayers = 2; break;
+                                       default: continue;
+                               }
+
+                               if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES)
+                               {
+                                       QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+                                       ++QuickMenu_Buffer_Size;
+                                       QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); // put PLCOMMAND arguments in the title string
+                                       ++QuickMenu_Buffer_Size;
+                                       QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, argv(1));
+                                       ++QuickMenu_Buffer_Size;
+                                       QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+                               }
+                       }
+                       ++QuickMenu_Buffer_Size;
+               }
+               fclose(fh);
+       }
+       else
+       {
+               LOG_WARNINGF("Unrecognized mode %s\n", mode);
+               return false;
+       }
+
+       if (QuickMenu_Buffer_Size <= 0)
+       {
+               buf_del(QuickMenu_Buffer);
+               QuickMenu_Buffer = -1;
+               return false;
+       }
+
+       if(mode == "file")
+               QuickMenu_Page_Load(submenu, 0);
+       else
+               QuickMenu_Page_Load("", 0);
+
+       hud_panel_quickmenu = 1;
+       if(autocvar_hud_cursormode)
+               setcursormode(1);
+       hudShiftState = 0;
+
+       QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+       return true;
+}
+
+void QuickMenu_Buffer_Close()
+{
+       if (QuickMenu_Buffer >= 0)
+       {
+               buf_del(QuickMenu_Buffer);
+               QuickMenu_Buffer = -1;
+               QuickMenu_Buffer_Size = 0;
+       }
+}
+
+void QuickMenu_Close()
+{
+       if (QuickMenu_CurrentSubMenu)
+               strunzone(QuickMenu_CurrentSubMenu);
+       QuickMenu_CurrentSubMenu = string_null;
+       int i;
+       for (i = 0; i < QUICKMENU_MAXLINES; ++i)
+               QuickMenu_Page_ClearEntry(i);
+       QuickMenu_Page_Entries = 0;
+       hud_panel_quickmenu = 0;
+       mouseClicked = 0;
+       prevMouseClicked = 0;
+       QuickMenu_Buffer_Close();
+
+       if(autocvar_hud_cursormode)
+       if(!mv_active)
+               setcursormode(0);
+}
+
+// It assumes submenu open tag is already detected
+void QuickMenu_skip_submenu(string submenu)
+{
+       string s, z_submenu;
+       z_submenu = strzone(submenu);
+       for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+       {
+               s = QuickMenu_Buffer_Get();
+               if(substring(s, 0, 1) != QM_TAG_SUBMENU)
+                       continue;
+               if(substring(s, 1, -1) == z_submenu) // submenu end
+                       break;
+               QuickMenu_skip_submenu(substring(s, 1, -1));
+       }
+       strunzone(z_submenu);
+}
+
+bool QuickMenu_IsOpened()
+{
+       return (QuickMenu_Page_Entries > 0);
+}
+
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me);
+bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, bool without_me)
+{
+    TC(int, teamplayers); TC(bool, without_me);
+       int i;
+       for(i = 0; i < QUICKMENU_MAXLINES; ++i)
+               QuickMenu_Page_ClearEntry(i);
+       QuickMenu_Buffer_Close();
+
+       QuickMenu_Buffer = buf_create();
+       if(QuickMenu_Buffer < 0)
+               return false;
+
+       HUD_Quickmenu_PlayerListEntries(cmd, teamplayers, without_me);
+
+       if(QuickMenu_Buffer_Size <= 0)
+       {
+               buf_del(QuickMenu_Buffer);
+               QuickMenu_Buffer = -1;
+               return false;
+       }
+       return true;
+}
+
+// new_page 0 means page 0, new_page != 0 means next page
+int QuickMenu_Buffer_Index_Prev;
+bool QuickMenu_Page_Load(string target_submenu, bool new_page)
+{
+    TC(bool, new_page);
+       string s = string_null, cmd = string_null, z_submenu;
+
+       if (new_page == 0)
+               QuickMenu_Page = 0;
+       else
+               ++QuickMenu_Page;
+
+       z_submenu = strzone(target_submenu);
+       if (QuickMenu_CurrentSubMenu)
+               strunzone(QuickMenu_CurrentSubMenu);
+       QuickMenu_CurrentSubMenu = strzone(z_submenu);
+
+       QuickMenu_IsLastPage = true;
+       QuickMenu_Page_Entries = 0;
+
+       QuickMenu_Buffer_Index = 0;
+       if (z_submenu != "")
+       {
+               // skip everything until the submenu open tag is found
+               for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+               {
+                       s = QuickMenu_Buffer_Get();
+                       if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
+                       {
+                               // printf("^3 beginning of %s\n", z_submenu);
+                               ++QuickMenu_Buffer_Index;
+                               break; // target_submenu found!
+                       }
+                       // printf("^1 skipping %s\n", s);
+               }
+               if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
+                       LOG_WARNINGF("Couldn't find submenu \"%s\"\n", z_submenu);
+       }
+
+       // only the last page can contain up to QUICKMENU_MAXLINES entries
+       // the other ones contain only (QUICKMENU_MAXLINES - 2) entries
+       // so that the panel can show an empty row and "Continue..."
+       float first_entry = QuickMenu_Page * (QUICKMENU_MAXLINES - 2);
+       int entry_num = 0; // counts entries in target_submenu
+       for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+       {
+               s = QuickMenu_Buffer_Get();
+
+               if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
+               {
+                       // printf("^3 end of %s\n", z_submenu);
+                       break;
+               }
+
+               if(entry_num >= first_entry)
+               {
+                       ++QuickMenu_Page_Entries;
+                       if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES - 2)
+                               QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
+                       else if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES)
+                       {
+                               QuickMenu_Page_ClearEntry(QUICKMENU_MAXLINES - 1);
+                               QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
+                               QuickMenu_IsLastPage = false;
+                               break;
+                       }
+               }
+
+               // NOTE: entries are loaded starting from 1, not from 0
+               if(substring(s, 0, 1) == QM_TAG_SUBMENU)
+               {
+                       if(entry_num >= first_entry)
+                               QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
+                       QuickMenu_skip_submenu(substring(s, 1, -1));
+               }
+               else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
+               {
+                       ++QuickMenu_Buffer_Index;
+                       cmd = QuickMenu_Buffer_Get();
+                       string command_code = substring(cmd, 0, 1);
+                       if(command_code == QM_TAG_COMMAND)
+                               cmd = substring(cmd, 1, -1);
+                       else if(command_code == QM_TAG_PLCOMMAND)
+                       {
+                               // throw away the current quickmenu buffer and load a new one
+                               cmd = substring(cmd, 1, -1);
+                               strunzone(z_submenu);
+                               if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
+                                       return QuickMenu_Page_Load("", 0);
+                               QuickMenu_Close();
+                               return false;
+                       }
+
+                       tokenize_console(cmd);
+                       QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
+
+                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
+               }
+
+               ++entry_num;
+       }
+       strunzone(z_submenu);
+       if (QuickMenu_Page_Entries == 0)
+       {
+               QuickMenu_Close();
+               return false;
+       }
+       QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+       return true;
+}
+
+bool QuickMenu_ActionForNumber(int num)
+{
+    TC(int, num);
+       if (!QuickMenu_IsLastPage)
+       {
+               if (num < 0 || num >= QUICKMENU_MAXLINES)
+                       return false;
+               if (num == QUICKMENU_MAXLINES - 1)
+                       return false;
+               if (num == 0)
+               {
+                       QuickMenu_Page_Load(QuickMenu_CurrentSubMenu, +1);
+                       return false;
+               }
+       } else if (num <= 0 || num > QuickMenu_Page_Entries)
+               return false;
+
+       if (QuickMenu_Page_Command[num] != "")
+       {
+               localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
+               QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+               return true;
+       }
+       if (QuickMenu_Page_Description[num] != "")
+               QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
+       return false;
+}
+
+void QuickMenu_Page_ActiveEntry(int entry_num)
+{
+    TC(int, entry_num);
+       QuickMenu_Page_ActivatedEntry = entry_num;
+       QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
+       if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
+       {
+               bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
+               // toggle commands don't close the quickmenu
+               if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
+                       QuickMenu_Page_ActivatedEntry_Close = false;
+               else
+                       QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
+       }
+       else
+               QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
+}
+
+bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
+{
+    TC(int, bInputType);
+       // we only care for keyboard events
+       if(bInputType == 2)
+               return false;
+
+       if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
+               return false;
+
+       if(bInputType == 3)
+       {
+               mousepos.x = nPrimary;
+               mousepos.y = nSecondary;
+               return true;
+       }
+
+       // allow console bind to work
+       string con_keys;
+       float keys;
+       con_keys = findkeysforcommand("toggleconsole", 0);
+       keys = tokenize(con_keys); // findkeysforcommand returns data for this
+
+       bool hit_con_bind = false;
+       int i;
+       for (i = 0; i < keys; ++i)
+       {
+               if(nPrimary == stof(argv(i)))
+                       hit_con_bind = true;
+       }
+
+       if(bInputType == 0) {
+               if(nPrimary == K_ALT) hudShiftState |= S_ALT;
+               if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
+               if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+       }
+       else if(bInputType == 1) {
+               if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
+               if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
+               if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+       }
+
+       if(nPrimary == K_ESCAPE)
+       {
+               if (bInputType == 1)
+                       return true;
+               QuickMenu_Close();
+       }
+       else if(nPrimary >= '0' && nPrimary <= '9')
+       {
+               if (bInputType == 1)
+                       return true;
+               QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
+       }
+       if(nPrimary == K_MOUSE1)
+       {
+               if(bInputType == 0) // key pressed
+                       mouseClicked |= S_MOUSE1;
+               else if(bInputType == 1) // key released
+                       mouseClicked -= (mouseClicked & S_MOUSE1);
+       }
+       else if(nPrimary == K_MOUSE2)
+       {
+               if(bInputType == 0) // key pressed
+                       mouseClicked |= S_MOUSE2;
+               else if(bInputType == 1) // key released
+                       mouseClicked -= (mouseClicked & S_MOUSE2);
+       }
+       else if(hit_con_bind)
+               return false;
+
+       return true;
+}
+
+void QuickMenu_Mouse()
+{
+       if(mv_active) return;
+
+       if(!mouseClicked)
+       if(prevMouseClicked & S_MOUSE2)
+       {
+               QuickMenu_Close();
+               return;
+       }
+
+       if(!autocvar_hud_cursormode)
+       {
+               mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
+
+               mousepos.x = bound(0, mousepos.x, vid_conwidth);
+               mousepos.y = bound(0, mousepos.y, vid_conheight);
+       }
+
+       HUD_Panel_UpdateCvars();
+
+       if(panel_bg_padding)
+       {
+               panel_pos += '1 1 0' * panel_bg_padding;
+               panel_size -= '2 2 0' * panel_bg_padding;
+       }
+
+       float first_entry_pos, entries_height;
+       vector fontsize;
+       fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
+       first_entry_pos = panel_pos.y + ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
+       entries_height = panel_size.y - ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y);
+
+       if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
+       {
+               float entry_num;
+               entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
+               if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
+               {
+                       panel_pos.y = first_entry_pos + entry_num * fontsize.y;
+                       vector color;
+                       if(mouseClicked & S_MOUSE1)
+                               color = '0.5 1 0.5';
+                       else if(hudShiftState & S_CTRL)
+                               color = '1 1 0.3';
+                       else
+                               color = '1 1 1';
+                       drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
+
+                       if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
+                               QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
+               }
+       }
+
+       draw_cursor_normal(mousepos, '1 1 1', 0.8);
+
+       prevMouseClicked = mouseClicked;
+}
+
+void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
+{
+       string entry;
+       float offset;
+       float desc_width = panel_size.x;
+       if(option)
+       {
+               string pic = strcat(hud_skin_path, "/", option);
+               if(precache_pic(pic) == "")
+                       pic = strcat("gfx/hud/default/", option);
+               vector option_size = '1 1 0' * fontsize.y * 0.8;
+               desc_width -= option_size.x;
+               drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
+               desc_width -= fontsize.x / 4;
+       }
+       entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
+       if (autocvar_hud_panel_quickmenu_align > 0)
+       {
+               float real_desc_width = stringwidth_colors(entry, fontsize);
+               offset = (desc_width - real_desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
+
+               if(option)
+               {
+                       // when there's enough room align description regardless the checkbox
+                       float extra_offset = (panel_size.x - desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
+                       if(offset + real_desc_width + extra_offset < desc_width)
+                               offset += extra_offset;
+                       else
+                               offset = max(0, desc_width - real_desc_width);
+               }
+               drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+       }
+       else
+               drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+}
+
+void HUD_QuickMenu()
+{
+       if(!autocvar__hud_configure)
+       {
+               if (hud_configure_prev && hud_configure_prev != -1)
+                       QuickMenu_Close();
+
+               if(!hud_draw_maximized) return;
+               if(mv_active) return;
+               //if(!autocvar_hud_panel_quickmenu) return;
+               if(!hud_panel_quickmenu) return;
+
+               if(QuickMenu_TimeOut)
+               if(time > QuickMenu_TimeOut)
+               {
+                       QuickMenu_Close();
+                       return;
+               }
+       }
+       else
+       {
+               if(!QuickMenu_IsOpened())
+               {
+                       QuickMenu_Page_Entries = 1;
+                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
+                       ++QuickMenu_Page_Entries;
+                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
+                       ++QuickMenu_Page_Entries;
+                       // although real command doesn't matter here, it must not be empty
+                       // otherwise the entry is displayed like a submenu
+                       for (; QuickMenu_Page_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Page_Entries)
+                               QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Command%d"), QuickMenu_Page_Entries), "-");
+                       ++QuickMenu_Page_Entries;
+                       QuickMenu_Page_ClearEntry(QuickMenu_Page_Entries);
+                       QuickMenu_IsLastPage = false;
+               }
+       }
+
+       HUD_Panel_UpdateCvars();
+
+       HUD_Panel_DrawBg(1);
+
+       if(panel_bg_padding)
+       {
+               panel_pos += '1 1 0' * panel_bg_padding;
+               panel_size -= '2 2 0' * panel_bg_padding;
+       }
+
+       int i;
+       vector fontsize;
+       string color;
+       fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
+
+       if (!QuickMenu_IsLastPage)
+       {
+               color = "^5";
+               HUD_Quickmenu_DrawEntry(panel_pos + eY * (panel_size.y - fontsize.y), sprintf("%d: %s%s", 0, color, _("Continue...")), string_null, fontsize);
+       }
+       else
+               panel_pos.y += ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
+
+       for (i = 1; i <= QuickMenu_Page_Entries; ++i) {
+               if (QuickMenu_Page_Description[i] == "")
+                       break;
+               string option = string_null;
+               if (QuickMenu_Page_Command[i] == "")
+                       color = "^4";
+               else
+               {
+                       color = "^3";
+                       if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
+                       {
+                               int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
+                               if(end < 0)
+                                       tokenize_console(QuickMenu_Page_Command[i]);
+                               else
+                                       tokenize_console(substring(QuickMenu_Page_Command[i], 0, end));
+
+                               //if(argv(1) && argv(0) == "toggle") // already checked
+                               {
+                                       // "enable feature xxx" "toggle xxx" (or "toggle xxx 1 0")
+                                       // "disable feature xxx" "toggle xxx 0 1"
+                                       float ON_value = 1, OFF_value = 0;
+                                       if(argv(2))
+                                               ON_value = stof(argv(2));
+
+                                       if(argv(3))
+                                               OFF_value = stof(argv(3));
+                                       else
+                                               OFF_value = !ON_value;
+
+                                       float value = cvar(argv(1));
+                                       if(value == ON_value)
+                                               option = "checkbox_checked";
+                                       else if(value == OFF_value)
+                                               option = "checkbox_empty";
+                                       else
+                                               option = "checkbox_undefined";
+                               }
+                       }
+               }
+               HUD_Quickmenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Page_Description[i]), option, fontsize);
+
+               if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
+                       && QuickMenu_Page_ActivatedEntry == i)
+                       drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
+
+               panel_pos.y += fontsize.y;
+       }
+
+       if(QuickMenu_Page_ActivatedEntry >= 0 && time >= QuickMenu_Page_ActivatedEntry_Time)
+       {
+               if(!QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
+               {
+                       bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
+                       if(f && QuickMenu_Page_ActivatedEntry_Close)
+                               QuickMenu_Close();
+               }
+               else if(QuickMenu_Page_ActivatedEntry_Close)
+                       QuickMenu_Close();
+               QuickMenu_Page_ActivatedEntry = -1;
+               QuickMenu_Page_ActivatedEntry_Time = 0;
+       }
+}
+
+
+#define QUICKMENU_SMENU(submenu,eng_submenu) { \
+       if(target_submenu == eng_submenu && target_submenu_found) \
+               return; /* target_submenu entries are now loaded, exit */ \
+       if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \
+               QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \
+       ++QuickMenu_Buffer_Size; \
+       if(target_submenu == eng_submenu && !target_submenu_found) { \
+               QuickMenu_Buffer_Size = 0; /* enable load of next entries */ \
+               target_submenu_found = true; \
+       } \
+}
+
+#define QUICKMENU_ENTRY(title,command) { \
+       if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
+       { \
+               QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
+               ++QuickMenu_Buffer_Size; \
+               QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \
+       } \
+       ++QuickMenu_Buffer_Size; \
+}
+
+#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
+       if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
+               QUICKMENU_SMENU(submenu,eng_submenu) \
+               QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
+               ++QuickMenu_Buffer_Size; \
+               QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
+               ++QuickMenu_Buffer_Size; \
+               QUICKMENU_SMENU(submenu,eng_submenu) \
+       } \
+}
+
+
+
+// useful to Translate a string inside the Command
+#define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
+       if(prvm_language == "en") \
+               QUICKMENU_ENTRY(title, sprintf(command, text)) \
+       else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
+               QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
+       else \
+               QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
+}
+
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me)
+{
+    TC(int, teamplayers); TC(bool, without_me);
+       entity pl;
+       if(teamplayers && !team_count)
+               return;
+
+       for(pl = players.sort_next; pl; pl = pl.sort_next)
+       {
+               if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
+                       continue;
+               if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
+                       continue;
+               if(without_me && pl.sv_entnum == player_localnum)
+                       continue;
+               QUICKMENU_ENTRY(entcs_GetName(pl.sv_entnum), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
+       }
+
+       return;
+}
+
+
+// Specifying target_submenu, this function only loads entries inside target_submenu
+// NOTE: alternatively we could have loaded the whole default quickmenu and
+// then called QuickMenu_Page_Load(target_submenu, 0);
+// but this sytem is more reliable since we can always refer to target_submenu
+// with the English title even if a translation is active
+void QuickMenu_Default(string target_submenu)
+{
+       bool target_submenu_found = false;
+       if(target_submenu != "")
+               QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
+
+       QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
+       QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
+
+       if(teamplay)
+       {
+       QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^quad soon")), "say_team %s", "quad soon", CTX(_("QMCMD^quad soon")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^free item, icon")), "say_team %s; g_waypointsprite_team_here_p", "free item %x^7 (l:%y^7)", CTX(_("QMCMD^free item %x^7 (l:%y^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^took item, icon")), "say_team %s; g_waypointsprite_team_here", "took item (l:%l^7)", CTX(_("QMCMD^took item (l:%l^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^negative")), "say_team %s", "negative", CTX(_("QMCMD^negative")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^positive")), "say_team %s", "positive", CTX(_("QMCMD^positive")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^need help, icon")), "say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp", "need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^enemy seen, icon")), "say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming", "enemy seen (l:%y^7)", CTX(_("QMCMD^enemy seen (l:%y^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^flag seen, icon")), "say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag", "flag seen (l:%y^7)", CTX(_("QMCMD^flag seen (l:%y^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^defending, icon")), "say_team %s; g_waypointsprite_team_here", "defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^roaming, icon")), "say_team %s; g_waypointsprite_team_here", "roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^attacking, icon")), "say_team %s; g_waypointsprite_team_here", "attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^killed flag, icon")), "say_team %s; g_waypointsprite_team_here_p", "killed flagcarrier (l:%y^7)", CTX(_("QMCMD^killed flagcarrier (l:%y^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^dropped flag, icon")), "say_team %s; g_waypointsprite_team_here_d", "dropped flag (l:%d^7)", CTX(_("QMCMD^dropped flag (l:%d^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop gun, icon")), "say_team %s; g_waypointsprite_team_here; wait; dropweapon", "dropped gun %w^7 (l:%l^7)", CTX(_("QMCMD^dropped gun %w^7 (l:%l^7)")))
+               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop flag/key, icon")), "say_team %s; g_waypointsprite_team_here; wait; use", "dropped flag/key %w^7 (l:%l^7)", CTX(_("QMCMD^dropped flag/key %w^7 (l:%l^7)")))
+       QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
+       }
+
+       QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
+
+       QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
+               QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Player models like mine")), "toggle cl_forceplayermodels")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Names above players")), "toggle hud_shownames")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Crosshair per weapon")), "toggle crosshair_per_weapon")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^FPS")), "toggle hud_panel_engineinfo")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Net graph")), "toggle shownetgraph")
+               QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
+
+               QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Hit sound")), "toggle cl_hitsound")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Chat sound")), "toggle con_chatsound")
+               QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
+
+               if(spectatee_status > 0)
+               {
+               QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^1st person")), "chase_active 0; -use")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person around player")), "chase_active 1; +use")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person behind")), "chase_active 1; -use")
+               QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
+               }
+
+               if(spectatee_status == -1)
+               {
+               QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Increase speed")), "weapnext")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Decrease speed")), "weapprev")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision off")), "+use")
+                       QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision on")), "-use")
+               QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
+               }
+
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
+               if(prvm_language != "en")
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
+       QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
+
+       QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Restart the map")), "vcall restart")
+               QUICKMENU_ENTRY(CTX(_("QMCMD^End match")), "vcall endmatch")
+               if(STAT(TIMELIMIT) > 0)
+               {
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Reduce match time")), "vcall reducematchtime")
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Extend match time")), "vcall extendmatchtime")
+               }
+               if(teamplay)
+               QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
+       QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+
+       if(target_submenu != "" && !target_submenu_found)
+       {
+               LOG_WARNINGF("Couldn't find submenu \"%s\"\n", target_submenu);
+               if(prvm_language != "en")
+                       LOG_WARNINGF("^3Warning: submenu must be in English\n", target_submenu);
+               QuickMenu_Buffer_Size = 0;
+       }
+}
+#undef QUICKMENU_SMENU
+#undef QUICKMENU_ENTRY
+#undef QUICKMENU_ENTRY_TC
diff --git a/qcsrc/client/hud/panel/quickmenu.qh b/qcsrc/client/hud/panel/quickmenu.qh
new file mode 100644 (file)
index 0000000..aad86e6
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+#include "../panel.qh"
+
+bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
+bool QuickMenu_IsOpened();
+void QuickMenu_Mouse();
index 1fa216b9674fb3b821c0096ca2a500882e464965..365ba01dd74babd7540df066241633f9001255fe 100644 (file)
@@ -1,4 +1,79 @@
+#include "racetimer.qh"
+
+#include <common/mapinfo.qh>
+
 /** Race timer (#8) */
+
+// return the string of the onscreen race timer
+string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
+{
+       TC(int, cp);
+       string col;
+       string timestr;
+       string cpname;
+       string lapstr;
+       lapstr = "";
+
+       if(theirtime == 0) // goal hit
+       {
+               if(mytime > 0)
+               {
+                       timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
+                       col = "^1";
+               }
+               else if(mytime == 0)
+               {
+                       timestr = "+0.0";
+                       col = "^3";
+               }
+               else
+               {
+                       timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
+                       col = "^2";
+               }
+
+               if(lapdelta > 0)
+               {
+                       lapstr = sprintf(_(" (-%dL)"), lapdelta);
+                       col = "^2";
+               }
+               else if(lapdelta < 0)
+               {
+                       lapstr = sprintf(_(" (+%dL)"), -lapdelta);
+                       col = "^1";
+               }
+       }
+       else if(theirtime > 0) // anticipation
+       {
+               if(mytime >= theirtime)
+                       timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
+               else
+                       timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
+               col = "^3";
+       }
+       else
+       {
+               col = "^7";
+               timestr = "";
+       }
+
+       if(cp == 254)
+               cpname = _("Start line");
+       else if(cp == 255)
+               cpname = _("Finish line");
+       else if(cp)
+               cpname = sprintf(_("Intermediate %d"), cp);
+       else
+               cpname = _("Finish line");
+
+       if(theirtime < 0)
+               return strcat(col, cpname);
+       else if(theirname == "")
+               return strcat(col, sprintf("%s (%s)", cpname, timestr));
+       else
+               return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
+}
+
 void HUD_RaceTimer ()
 {
        if(!autocvar__hud_configure)
diff --git a/qcsrc/client/hud/panel/racetimer.qh b/qcsrc/client/hud/panel/racetimer.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index b4986e5e3e1376f867af2085c7ff70510e27eec7..4a2e7ee2b345165afc75e18399b9c1de8147ab2f 100644 (file)
@@ -1,3 +1,11 @@
+#include "radar.qh"
+
+#include <common/ent_cs.qh>
+#include <common/mapinfo.qh>
+#include <client/mapvoting.qh>
+#include <client/teamradar.qh>
+#include <common/mutators/mutator/waypoints/all.qh>
+
 // Radar (#6)
 
 float HUD_Radar_Clickable()
@@ -7,6 +15,7 @@ float HUD_Radar_Clickable()
 
 void HUD_Radar_Show_Maximized(bool doshow,float clickable)
 {
+    TC(bool, doshow);
        hud_panel_radar_maximized = doshow;
        hud_panel_radar_temp_hidden = 0;
 
@@ -34,8 +43,9 @@ void HUD_Radar_Hide_Maximized()
 }
 
 
-float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float HUD_Radar_InputEvent(int bInputType, float nPrimary, float nSecondary)
 {
+    TC(int, bInputType);
        if(!hud_panel_radar_maximized || !hud_panel_radar_mouse ||
                autocvar__hud_configure || mv_active)
                return false;
diff --git a/qcsrc/client/hud/panel/radar.qh b/qcsrc/client/hud/panel/radar.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 42d18ff62a92ef0876e70f6c1e08cb699aee1d73..12114b4e356a712d8306439c8df0708da753eb3a 100644 (file)
@@ -1,3 +1,9 @@
+#include "score.qh"
+
+#include <client/scoreboard.qh>
+#include <common/ent_cs.qh>
+#include <common/mapinfo.qh>
+
 // Score (#7)
 
 void HUD_UpdatePlayerTeams();
diff --git a/qcsrc/client/hud/panel/score.qh b/qcsrc/client/hud/panel/score.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 4de0c1e5f6ce76a51a72707db74acb1ad9ad8cbc..b61f3c4c177ff2b8bafa7d280167dac7b898548d 100644 (file)
@@ -1,3 +1,4 @@
+#include "timer.qh"
 void HUD_Timer()
 {
        if(!autocvar__hud_configure)
@@ -30,6 +31,17 @@ void HUD_Timer()
 
        minutesLeft = floor(timeleft / 60);
 
+       float warmup_timeleft = 0;
+       if(warmup_stage)
+       {
+               float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+               if(warmup_timelimit > 0)
+                       warmup_timeleft = max(0, warmup_timelimit - time);
+               else if(warmup_timelimit == 0)
+                       warmup_timeleft = timeleft;
+               warmup_timeleft = ceil(warmup_timeleft);
+       }
+
        vector timer_color;
        if(minutesLeft >= 5 || warmup_stage || timelimit == 0) //don't use red or yellow in warmup or when there is no timelimit
                timer_color = '1 1 1'; //white
@@ -38,16 +50,19 @@ void HUD_Timer()
        else
                timer_color = '1 0 0'; //red
 
-       if (autocvar_hud_panel_timer_increment || timelimit == 0 || warmup_stage) {
+       if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
                if (time < STAT(GAMESTARTTIME)) {
                        //while restart is still active, show 00:00
                        timer = seconds_tostring(0);
                } else {
-                       elapsedTime = floor(time - STAT(GAMESTARTTIME)); //127
+                       elapsedTime = floor(time - STAT(GAMESTARTTIME));
                        timer = seconds_tostring(elapsedTime);
                }
        } else {
-               timer = seconds_tostring(timeleft);
+               if(warmup_stage)
+                       timer = seconds_tostring(warmup_timeleft);
+               else
+                       timer = seconds_tostring(timeleft);
        }
 
        drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
diff --git a/qcsrc/client/hud/panel/timer.qh b/qcsrc/client/hud/panel/timer.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 5f286b24a42bd1bf1fa4c0d04450bb6edfdd5c1e..502b237f7882efdb22662e33398b63890b3037f1 100644 (file)
@@ -1,3 +1,7 @@
+#include "vote.qh"
+
+#include <common/mapinfo.qh>
+
 /** Vote window (#9) */
 void HUD_Vote()
 {
diff --git a/qcsrc/client/hud/panel/vote.qh b/qcsrc/client/hud/panel/vote.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index 6e9f13dac10cada4c1b604fdf43821eab94a91a6..c465caf4fddc3911ca2e997adaead177a2f6fa40 100644 (file)
@@ -1,8 +1,10 @@
+#include "weapons.qh"
 // Weapon icons (#0)
 
 entity weaponorder[Weapons_MAX];
 void weaponorder_swap(int i, int j, entity pass)
 {
+    TC(int, i); TC(int, j);
        entity h = weaponorder[i];
        weaponorder[i] = weaponorder[j];
        weaponorder[j] = h;
@@ -11,6 +13,7 @@ void weaponorder_swap(int i, int j, entity pass)
 string weaponorder_cmp_str;
 int weaponorder_cmp(int i, int j, entity pass)
 {
+    TC(int, i); TC(int, j);
        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)
@@ -18,7 +21,6 @@ int weaponorder_cmp(int i, int j, entity pass)
 
 void HUD_Weapons()
 {
-       SELFPARAM();
        // declarations
        WepSet weapons_stat = WepSet_GetFromStat();
        int i;
diff --git a/qcsrc/client/hud/panel/weapons.qh b/qcsrc/client/hud/panel/weapons.qh
new file mode 100644 (file)
index 0000000..6db88c6
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma once
+#include "../panel.qh"
index ded6d5b32a9f2d1d4321dbea3b8b37254533684b..98b266c6d18410a39a466a66b77b452ee10a9ef5 100644 (file)
@@ -4,7 +4,7 @@
 #include "hud/all.qh"
 #include "mapvoting.qh"
 #include "mutators/events.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
 #include "scoreboard.qh"
 #include "shownames.qh"
 #include <common/t_items.qh>
@@ -219,6 +219,7 @@ void Shutdown()
 .float has_team;
 float SetTeam(entity o, int Team)
 {
+    TC(int, Team);
        devassert_once(Team);
        entity tm;
        if(teamplay)
@@ -351,8 +352,9 @@ void PostInit()
 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
 // In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
-float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
 {
+    TC(int, bInputType);
        if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
                return true;
 
index 084dfba2f81ae92ca1a577c232b00353dedbf635..9d7c4068900967da4202dc23029f773d98566334 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_MAIN_H
-#define CLIENT_MAIN_H
+#pragma once
 
 #include <common/constants.qh>
 #include <common/weapons/all.qh>
@@ -7,13 +6,6 @@
 // --------------------------------------------------------------------------
 // MENU Functionality
 
-const float DATABUF_PING = 0;
-#define DATABUF_CAPTURES (1*maxclients)
-#define DATABUF_DEATHS (2*maxclients)
-#define DATABUF_RETURNS (3*maxclients)
-
-#define DATABUF_NEXT (5*maxclients)
-
 void setpredraw(entity this, void(entity) pdfunc);
 
 // --------------------------------------------------------------------------
@@ -152,5 +144,3 @@ float hud;
 float view_quality;
 int framecount;
 .float health;
-
-#endif
index 7071231651b2b69149bbbd2bf226abfe1df95496..3223bf120aa7cc012f9143e21bc671f12ee9031b 100644 (file)
@@ -41,6 +41,7 @@ int n_ssdirs;
 
 string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize)
 {
+    TC(int, id);
        string pre, post;
        pre = sprintf("%d. ", id+1);
        if(mv_detail)
@@ -61,6 +62,7 @@ string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, v
 
 vector MapVote_RGB(int id)
 {
+    TC(int, id);
        if(!(mv_flags[id] & GTV_AVAILABLE))
                return '1 1 1';
        if(id == mv_ownvote)
@@ -73,6 +75,7 @@ vector MapVote_RGB(int id)
 
 void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float _count, int id)
 {
+    TC(int, id);
        // Find the correct alpha
        float alpha;
        if(!(mv_flags_start[id] & GTV_AVAILABLE))
@@ -183,6 +186,7 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g
 
 void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float _count, int id)
 {
+    TC(int, id);
        vector img_size = '0 0 0';
        string label;
        float text_size;
@@ -256,6 +260,7 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin
 
 void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int id)
 {
+    TC(int, id);
        vector rgb;
        float text_size;
        string label;
@@ -272,6 +277,7 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int
 
 vector MapVote_GridVec(vector gridspec, int i, int m)
 {
+    TC(int, i); TC(int, m);
        int r = i % m;
        return
                '1 0 0' * (gridspec.x * r)
@@ -485,8 +491,9 @@ void MapVote_Draw()
        draw_cursor_normal(mv_mousepos, '1 1 1', 1 - autocvar__menu_alpha);
 }
 
-void Cmd_MapVote_MapDownload(float argc)
+void Cmd_MapVote_MapDownload(int argc)
 {
+    TC(int, argc);
        entity pak;
 
        if(argc != 2 || !mv_pk3list)
@@ -517,6 +524,7 @@ void Cmd_MapVote_MapDownload(float argc)
 
 void MapVote_CheckPK3(string pic, string pk3, int id)
 {
+    TC(int, id);
        entity pak;
        pak = spawn();
        pak.netname = pk3;
@@ -538,6 +546,7 @@ void MapVote_CheckPK3(string pic, string pk3, int id)
 
 void MapVote_CheckPic(string pic, string pk3, int id)
 {
+    TC(int, id);
        // never try to retrieve a pic for the "don't care" 'map'
        if(mv_abstain && id == mv_num_maps - 1)
                return;
@@ -580,6 +589,7 @@ void MapVote_ReadMask()
 
 void MapVote_ReadOption(int i)
 {
+    TC(int, i);
        string map = strzone(ReadString());
        string pk3 = strzone(ReadString());
        int j = bound(0, ReadByte(), n_ssdirs - 1);
@@ -596,6 +606,7 @@ void MapVote_ReadOption(int i)
 
 void GameTypeVote_ReadOption(int i)
 {
+    TC(int, i);
        string gt = strzone(ReadString());
 
        mv_maps[i] = gt;
@@ -687,13 +698,15 @@ void MapVote_Init()
        n_ssdirs = 0;
 }
 
-void MapVote_SendChoice(float index)
+void MapVote_SendChoice(int index)
 {
+    TC(int, index);
        localcmd(strcat("\nimpulse ", ftos(index+1), "\n"));
 }
 
 int MapVote_MoveLeft(int pos)
 {
+    TC(int, pos);
        int imp;
        if ( pos < 0 )
                imp = mv_num_maps - 1;
@@ -705,6 +718,7 @@ int MapVote_MoveLeft(int pos)
 }
 int MapVote_MoveRight(int pos)
 {
+    TC(int, pos);
        int imp;
        if ( pos < 0 )
                imp = 0;
@@ -716,6 +730,7 @@ int MapVote_MoveRight(int pos)
 }
 int MapVote_MoveUp(int pos)
 {
+    TC(int, pos);
        int imp;
        if ( pos < 0 )
                imp = mv_num_maps - 1;
@@ -735,6 +750,7 @@ int MapVote_MoveUp(int pos)
 }
 int MapVote_MoveDown(int pos)
 {
+    TC(int, pos);
        int imp;
        if ( pos < 0 )
                imp = 0;
@@ -749,8 +765,9 @@ int MapVote_MoveDown(int pos)
        return imp;
 }
 
-float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
 {
+    TC(int, bInputType);
        float imp;
 
        if (!mv_active)
index bbc05d884f9aa2e011b8f5bdd295063f0cf13c40..ebc107a0b2584196023b052fdb82c02470ed16f5 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_MAPVOTING_H
-#define CLIENT_MAPVOTING_H
+#pragma once
 
 #include <common/constants.qh>
 void MapVote_Draw();
@@ -11,4 +10,3 @@ float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary);
 void Net_MapVote_Picture();
 
 float mv_active;
-#endif
index fd83aa2d11ed8a9791a4f539a9b0045e111cf00a..970a681e37b202f9bfc2a49c6f2c6377b0a13715 100644 (file)
@@ -119,6 +119,7 @@ void RemoveTeam(entity Team)
 
 entity GetTeam(int Team, bool add)
 {
+    TC(int, Team); TC(bool, add);
        int num = (Team == NUM_SPECTATOR) ? 16 : Team;
        if(teamslots[num])
                return teamslots[num];
@@ -159,6 +160,7 @@ float PreviewExists(string name)
 // decolorizes and team colors the player name when needed
 string playername(string thename, float teamid)
 {
+    TC(int, teamid);
     string t;
     if (teamplay)
     {
@@ -483,8 +485,9 @@ void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector
 }
 
 /** engine callback */
-void URI_Get_Callback(int id, float status, string data)
+void URI_Get_Callback(int id, int status, string data)
 {
+    TC(int, id); TC(int, status);
        if(url_URI_Get_Callback(id, status, data))
        {
                // handled
index a2fa4edced358d7d6812ce5b5b7c38e7b4177eb2..32563598b3f79ad2189aa2f2b48d54c9ea0e3b24 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_MISCFUNCTIONS_H
-#define CLIENT_MISCFUNCTIONS_H
+#pragma once
 
 entity players;
 entity teams;
@@ -155,5 +154,3 @@ void Accuracy_LoadLevels();
 void Accuracy_LoadColors();
 
 vector Accuracy_GetColor(float accuracy);
-
-#endif
diff --git a/qcsrc/client/mutators/_mod.inc b/qcsrc/client/mutators/_mod.inc
new file mode 100644 (file)
index 0000000..98fb481
--- /dev/null
@@ -0,0 +1 @@
+// generated file; do not modify
index 7141e4455e1849f4ccbd0d12aa55d095b612d4ac..f86ef533361699e0e107f6b153d5687975f1ba7c 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_MUTATORS_EVENTS_H
-#define CLIENT_MUTATORS_EVENTS_H
+#pragma once
 
 #include <common/mutators/base.qh>
 
@@ -132,5 +131,3 @@ MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);
        /** also, argv() can be used */ i(int, cmd_argc) \
        /**/
 MUTATOR_HOOKABLE(HUD_Command, EV_HUD_Command);
-
-#endif
index 7fa065ca4a42d9912906be6e69697d7ce9968a10..c8abdc6f57b6cf7d62f20ae5c6288aae3397549f 100644 (file)
@@ -79,8 +79,9 @@ void skeleton_markbones(entity e)
        }
 }
 
-void skel_set_boneabs(float s, float bone, vector absorg)
+void skel_set_boneabs(float s, int bone, vector absorg)
 {
+    TC(int, bone);
        vector absang = fixedvectoangles2(v_forward, v_up);
 
        vector parentorg = skel_get_boneabs(s, skel_get_boneparent(s, bone));
@@ -108,8 +109,9 @@ void free_skeleton_from_frames(entity e)
        }
 }
 
-void skeleton_from_frames(entity e, float is_dead)
-{SELFPARAM();
+void skeleton_from_frames(entity e, bool is_dead)
+{
+    TC(bool, is_dead);
        float m = e.modelindex;
        if(!e.skeletonindex)
        {
index 48a3111d32210cd12b7d272b65f859137c719966..50462bdbb298948af6a8b61305eea2cf62b165be 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_PLAYER_SKELETON
-#define CLIENT_PLAYER_SKELETON
+#pragma once
 
 void free_skeleton_from_frames(entity e);
 void skeleton_from_frames(entity e, float is_dead);
@@ -11,4 +10,3 @@ class(Skeleton) .int bone_weapon;
 class(Skeleton) .float bone_aim[MAX_AIM_BONES];
 class(Skeleton) .float bone_aimweight[MAX_AIM_BONES];
 class(Skeleton) .float fixbone;
-#endif
index ca0078cdb8c50fdc75d7b3ed196944f516819cac..8817a2c71bfa14506774e73886ad3a00a93b5e43 100644 (file)
@@ -1,37 +1,24 @@
-#include "../lib/_all.inc"
+#include <lib/_all.inc>
 #include "_all.qh"
 
-#include "../common/effects/qc/all.qc"
+#include "_mod.inc"
+#include "commands/_mod.inc"
+#include "hud/_mod.inc"
+#include "mutators/_mod.inc"
+#include "weapons/_mod.inc"
 
-#include "announcer.qc"
-#include "bgmscript.qc"
-#include "csqcmodel_hooks.qc"
-#include "hud/all.qc"
-#include "main.qc"
-#include "mapvoting.qc"
-#include "miscfunctions.qc"
-#include "player_skeleton.qc"
-#include "scoreboard.qc"
-#include "shownames.qc"
-#include "teamradar.qc"
-#include "view.qc"
-#include "wall.qc"
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
 
-#include "commands/all.qc"
+#include <lib/csqcmodel/cl_model.qc>
+#include <lib/csqcmodel/cl_player.qc>
+#include <lib/csqcmodel/interpolate.qc>
 
-#include "weapons/projectile.qc" // TODO
-
-#include "../common/_all.inc"
-
-#include "../lib/csqcmodel/cl_model.qc"
-#include "../lib/csqcmodel/cl_player.qc"
-#include "../lib/csqcmodel/interpolate.qc"
-
-#include "../lib/warpzone/anglestransform.qc"
-#include "../lib/warpzone/client.qc"
-#include "../lib/warpzone/common.qc"
-#include "../lib/warpzone/server.qc"
-#include "../lib/warpzone/util_server.qc"
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/client.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
 
 #if BUILD_MOD
 #include "../../mod/client/progs.inc"
diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc
deleted file mode 100644 (file)
index 63416f2..0000000
+++ /dev/null
@@ -1,868 +0,0 @@
-#include "quickmenu.qh"
-
-#include "hud/all.qh"
-#include "mapvoting.qh"
-
-// QUICKMENU_MAXLINES must be <= 10
-const int QUICKMENU_MAXLINES = 10;
-// visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
-string QuickMenu_Page_Command[QUICKMENU_MAXLINES];
-string QuickMenu_Page_Description[QUICKMENU_MAXLINES];
-int QuickMenu_Page_Command_Type[QUICKMENU_MAXLINES];
-int QuickMenu_Page_Entries;
-int QuickMenu_Page;
-int QuickMenu_Page_ActivatedEntry = -1;
-bool QuickMenu_Page_ActivatedEntry_Close;
-float QuickMenu_Page_ActivatedEntry_Time;
-bool QuickMenu_IsLastPage;
-// all the entries are loaded into QuickMenu_Buffer
-// each entry (submenu or command) is composed of 2 entries
-const int QUICKMENU_MAXENTRIES = 256;
-const int QUICKMENU_BUFFER_MAXENTRIES = 2 * QUICKMENU_MAXENTRIES;
-int QuickMenu_Buffer = -1;
-int QuickMenu_Buffer_Size;
-int QuickMenu_Buffer_Index;
-string QuickMenu_CurrentSubMenu;
-float QuickMenu_TimeOut;
-
-// QuickMenu_Buffer are labeled with these tags
-#define QM_TAG_TITLE "T"
-#define QM_TAG_SUBMENU "S"
-#define QM_TAG_COMMAND "C"
-#define QM_TAG_PLCOMMAND "P"
-
-#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
-#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
-
-// if s1 is not empty s will be displayed as command otherwise as submenu
-void QuickMenu_Page_LoadEntry(int i, string s, string s1)
-{
-       //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
-       if (QuickMenu_Page_Description[i])
-               strunzone(QuickMenu_Page_Description[i]);
-       QuickMenu_Page_Description[i] = strzone(s);
-       if (QuickMenu_Page_Command[i])
-               strunzone(QuickMenu_Page_Command[i]);
-       QuickMenu_Page_Command[i] = strzone(s1);
-}
-
-void QuickMenu_Page_ClearEntry(int i)
-{
-       if (QuickMenu_Page_Description[i])
-               strunzone(QuickMenu_Page_Description[i]);
-       QuickMenu_Page_Description[i] = string_null;
-       if (QuickMenu_Page_Command[i])
-               strunzone(QuickMenu_Page_Command[i]);
-       QuickMenu_Page_Command[i] = string_null;
-}
-
-float QuickMenu_Page_Load(string target_submenu, float new_page);
-void QuickMenu_Default(string submenu);
-bool QuickMenu_Open(string mode, string submenu)
-{
-       int fh = -1;
-       string s;
-
-       if(mode == "")
-       {
-               if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
-                       mode = "default";
-               else
-                       mode = "file";
-       }
-
-       if(mode == "file")
-       {
-               if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
-                       LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
-               else
-               {
-                       fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
-                       if(fh < 0)
-                               LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file);
-               }
-               if(fh < 0)
-                       mode = "default";
-       }
-
-       if(mode == "default")
-       {
-               QuickMenu_Buffer = buf_create();
-               if(QuickMenu_Buffer < 0)
-                       return false;
-
-               QuickMenu_Default(submenu);
-       }
-       else if(mode == "file")
-       {
-               QuickMenu_Buffer = buf_create();
-               if(QuickMenu_Buffer < 0)
-               {
-                       fclose(fh);
-                       return false;
-               }
-
-               QuickMenu_Buffer_Size = 0;
-               while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
-               {
-                       // first skip invalid entries, so we don't check them anymore
-                       float argc;
-                       argc = tokenize_console(s);
-                       if(argc == 0 || argv(0) == "")
-                               continue;
-                       if(argc == 1)
-                               QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
-                       else if(argc == 2)
-                       {
-                               if(argv(1) == "")
-                                       continue;
-                               QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
-                               ++QuickMenu_Buffer_Size;
-                               QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
-                       }
-                       else if(argc == 3)
-                       {
-                               // check for special keywords
-                               float teamplayers = 0, without_me = 0;
-                               switch(argv(2))
-                               {
-                                       case "ALLPLAYERS_BUT_ME":               without_me = 1; // fall through
-                                       case "ALLPLAYERS":                              teamplayers = 0; break;
-                                       case "OWNTEAMPLAYERS_BUT_ME":   without_me = 1; // fall through
-                                       case "OWNTEAMPLAYERS":                  teamplayers = 1; break;
-                                       case "ENEMYTEAMPLAYERS":                teamplayers = 2; break;
-                                       default: continue;
-                               }
-
-                               if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES)
-                               {
-                                       QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
-                                       ++QuickMenu_Buffer_Size;
-                                       QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); // put PLCOMMAND arguments in the title string
-                                       ++QuickMenu_Buffer_Size;
-                                       QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, argv(1));
-                                       ++QuickMenu_Buffer_Size;
-                                       QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
-                               }
-                       }
-                       ++QuickMenu_Buffer_Size;
-               }
-               fclose(fh);
-       }
-       else
-       {
-               LOG_WARNINGF("Unrecognized mode %s\n", mode);
-               return false;
-       }
-
-       if (QuickMenu_Buffer_Size <= 0)
-       {
-               buf_del(QuickMenu_Buffer);
-               QuickMenu_Buffer = -1;
-               return false;
-       }
-
-       if(mode == "file")
-               QuickMenu_Page_Load(submenu, 0);
-       else
-               QuickMenu_Page_Load("", 0);
-
-       hud_panel_quickmenu = 1;
-       if(autocvar_hud_cursormode)
-               setcursormode(1);
-       hudShiftState = 0;
-
-       QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
-       return true;
-}
-
-void QuickMenu_Buffer_Close()
-{
-       if (QuickMenu_Buffer >= 0)
-       {
-               buf_del(QuickMenu_Buffer);
-               QuickMenu_Buffer = -1;
-               QuickMenu_Buffer_Size = 0;
-       }
-}
-
-void QuickMenu_Close()
-{
-       if (QuickMenu_CurrentSubMenu)
-               strunzone(QuickMenu_CurrentSubMenu);
-       QuickMenu_CurrentSubMenu = string_null;
-       int i;
-       for (i = 0; i < QUICKMENU_MAXLINES; ++i)
-               QuickMenu_Page_ClearEntry(i);
-       QuickMenu_Page_Entries = 0;
-       hud_panel_quickmenu = 0;
-       mouseClicked = 0;
-       prevMouseClicked = 0;
-       QuickMenu_Buffer_Close();
-
-       if(autocvar_hud_cursormode)
-       if(!mv_active)
-               setcursormode(0);
-}
-
-// It assumes submenu open tag is already detected
-void QuickMenu_skip_submenu(string submenu)
-{
-       string s, z_submenu;
-       z_submenu = strzone(submenu);
-       for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
-       {
-               s = QuickMenu_Buffer_Get();
-               if(substring(s, 0, 1) != QM_TAG_SUBMENU)
-                       continue;
-               if(substring(s, 1, -1) == z_submenu) // submenu end
-                       break;
-               QuickMenu_skip_submenu(substring(s, 1, -1));
-       }
-       strunzone(z_submenu);
-}
-
-bool QuickMenu_IsOpened()
-{
-       return (QuickMenu_Page_Entries > 0);
-}
-
-void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, float without_me);
-bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, float without_me)
-{
-       int i;
-       for(i = 0; i < QUICKMENU_MAXLINES; ++i)
-               QuickMenu_Page_ClearEntry(i);
-       QuickMenu_Buffer_Close();
-
-       QuickMenu_Buffer = buf_create();
-       if(QuickMenu_Buffer < 0)
-               return false;
-
-       HUD_Quickmenu_PlayerListEntries(cmd, teamplayers, without_me);
-
-       if(QuickMenu_Buffer_Size <= 0)
-       {
-               buf_del(QuickMenu_Buffer);
-               QuickMenu_Buffer = -1;
-               return false;
-       }
-       return true;
-}
-
-// new_page 0 means page 0, new_page != 0 means next page
-int QuickMenu_Buffer_Index_Prev;
-bool QuickMenu_Page_Load(string target_submenu, int new_page)
-{
-       string s = string_null, cmd = string_null, z_submenu;
-
-       if (new_page == 0)
-               QuickMenu_Page = 0;
-       else
-               ++QuickMenu_Page;
-
-       z_submenu = strzone(target_submenu);
-       if (QuickMenu_CurrentSubMenu)
-               strunzone(QuickMenu_CurrentSubMenu);
-       QuickMenu_CurrentSubMenu = strzone(z_submenu);
-
-       QuickMenu_IsLastPage = true;
-       QuickMenu_Page_Entries = 0;
-
-       QuickMenu_Buffer_Index = 0;
-       if (z_submenu != "")
-       {
-               // skip everything until the submenu open tag is found
-               for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
-               {
-                       s = QuickMenu_Buffer_Get();
-                       if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
-                       {
-                               // printf("^3 beginning of %s\n", z_submenu);
-                               ++QuickMenu_Buffer_Index;
-                               break; // target_submenu found!
-                       }
-                       // printf("^1 skipping %s\n", s);
-               }
-               if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
-                       LOG_WARNINGF("Couldn't find submenu \"%s\"\n", z_submenu);
-       }
-
-       // only the last page can contain up to QUICKMENU_MAXLINES entries
-       // the other ones contain only (QUICKMENU_MAXLINES - 2) entries
-       // so that the panel can show an empty row and "Continue..."
-       float first_entry = QuickMenu_Page * (QUICKMENU_MAXLINES - 2);
-       int entry_num = 0; // counts entries in target_submenu
-       for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
-       {
-               s = QuickMenu_Buffer_Get();
-
-               if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
-               {
-                       // printf("^3 end of %s\n", z_submenu);
-                       break;
-               }
-
-               if(entry_num >= first_entry)
-               {
-                       ++QuickMenu_Page_Entries;
-                       if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES - 2)
-                               QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
-                       else if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES)
-                       {
-                               QuickMenu_Page_ClearEntry(QUICKMENU_MAXLINES - 1);
-                               QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
-                               QuickMenu_IsLastPage = false;
-                               break;
-                       }
-               }
-
-               // NOTE: entries are loaded starting from 1, not from 0
-               if(substring(s, 0, 1) == QM_TAG_SUBMENU)
-               {
-                       if(entry_num >= first_entry)
-                               QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
-                       QuickMenu_skip_submenu(substring(s, 1, -1));
-               }
-               else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
-               {
-                       ++QuickMenu_Buffer_Index;
-                       cmd = QuickMenu_Buffer_Get();
-                       string command_code = substring(cmd, 0, 1);
-                       if(command_code == QM_TAG_COMMAND)
-                               cmd = substring(cmd, 1, -1);
-                       else if(command_code == QM_TAG_PLCOMMAND)
-                       {
-                               // throw away the current quickmenu buffer and load a new one
-                               cmd = substring(cmd, 1, -1);
-                               strunzone(z_submenu);
-                               if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
-                                       return QuickMenu_Page_Load("", 0);
-                               QuickMenu_Close();
-                               return false;
-                       }
-
-                       tokenize_console(cmd);
-                       QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
-
-                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
-               }
-
-               ++entry_num;
-       }
-       strunzone(z_submenu);
-       if (QuickMenu_Page_Entries == 0)
-       {
-               QuickMenu_Close();
-               return false;
-       }
-       QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
-       return true;
-}
-
-bool QuickMenu_ActionForNumber(int num)
-{
-       if (!QuickMenu_IsLastPage)
-       {
-               if (num < 0 || num >= QUICKMENU_MAXLINES)
-                       return false;
-               if (num == QUICKMENU_MAXLINES - 1)
-                       return false;
-               if (num == 0)
-               {
-                       QuickMenu_Page_Load(QuickMenu_CurrentSubMenu, +1);
-                       return false;
-               }
-       } else if (num <= 0 || num > QuickMenu_Page_Entries)
-               return false;
-
-       if (QuickMenu_Page_Command[num] != "")
-       {
-               localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
-               QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
-               return true;
-       }
-       if (QuickMenu_Page_Description[num] != "")
-               QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
-       return false;
-}
-
-void QuickMenu_Page_ActiveEntry(float entry_num)
-{
-       QuickMenu_Page_ActivatedEntry = entry_num;
-       QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
-       if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
-       {
-               bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
-               // toggle commands don't close the quickmenu
-               if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
-                       QuickMenu_Page_ActivatedEntry_Close = false;
-               else
-                       QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
-       }
-       else
-               QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
-}
-
-bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary)
-{
-       // we only care for keyboard events
-       if(bInputType == 2)
-               return false;
-
-       if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
-               return false;
-
-       if(bInputType == 3)
-       {
-               mousepos.x = nPrimary;
-               mousepos.y = nSecondary;
-               return true;
-       }
-
-       // allow console bind to work
-       string con_keys;
-       float keys;
-       con_keys = findkeysforcommand("toggleconsole", 0);
-       keys = tokenize(con_keys); // findkeysforcommand returns data for this
-
-       bool hit_con_bind = false;
-       int i;
-       for (i = 0; i < keys; ++i)
-       {
-               if(nPrimary == stof(argv(i)))
-                       hit_con_bind = true;
-       }
-
-       if(bInputType == 0) {
-               if(nPrimary == K_ALT) hudShiftState |= S_ALT;
-               if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
-               if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
-       }
-       else if(bInputType == 1) {
-               if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
-               if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
-               if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
-       }
-
-       if(nPrimary == K_ESCAPE)
-       {
-               if (bInputType == 1)
-                       return true;
-               QuickMenu_Close();
-       }
-       else if(nPrimary >= '0' && nPrimary <= '9')
-       {
-               if (bInputType == 1)
-                       return true;
-               QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
-       }
-       if(nPrimary == K_MOUSE1)
-       {
-               if(bInputType == 0) // key pressed
-                       mouseClicked |= S_MOUSE1;
-               else if(bInputType == 1) // key released
-                       mouseClicked -= (mouseClicked & S_MOUSE1);
-       }
-       else if(nPrimary == K_MOUSE2)
-       {
-               if(bInputType == 0) // key pressed
-                       mouseClicked |= S_MOUSE2;
-               else if(bInputType == 1) // key released
-                       mouseClicked -= (mouseClicked & S_MOUSE2);
-       }
-       else if(hit_con_bind)
-               return false;
-
-       return true;
-}
-
-void QuickMenu_Mouse()
-{
-       if(mv_active) return;
-
-       if(!mouseClicked)
-       if(prevMouseClicked & S_MOUSE2)
-       {
-               QuickMenu_Close();
-               return;
-       }
-
-       if(!autocvar_hud_cursormode)
-       {
-               mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
-               mousepos.x = bound(0, mousepos.x, vid_conwidth);
-               mousepos.y = bound(0, mousepos.y, vid_conheight);
-       }
-
-       HUD_Panel_UpdateCvars();
-
-       if(panel_bg_padding)
-       {
-               panel_pos += '1 1 0' * panel_bg_padding;
-               panel_size -= '2 2 0' * panel_bg_padding;
-       }
-
-       float first_entry_pos, entries_height;
-       vector fontsize;
-       fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
-       first_entry_pos = panel_pos.y + ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
-       entries_height = panel_size.y - ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y);
-
-       if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
-       {
-               float entry_num;
-               entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
-               if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
-               {
-                       panel_pos.y = first_entry_pos + entry_num * fontsize.y;
-                       vector color;
-                       if(mouseClicked & S_MOUSE1)
-                               color = '0.5 1 0.5';
-                       else if(hudShiftState & S_CTRL)
-                               color = '1 1 0.3';
-                       else
-                               color = '1 1 1';
-                       drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
-
-                       if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
-                               QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
-               }
-       }
-
-       draw_cursor_normal(mousepos, '1 1 1', 0.8);
-
-       prevMouseClicked = mouseClicked;
-}
-
-void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
-{
-       string entry;
-       float offset;
-       float desc_width = panel_size.x;
-       if(option)
-       {
-               string pic = strcat(hud_skin_path, "/", option);
-               if(precache_pic(pic) == "")
-                       pic = strcat("gfx/hud/default/", option);
-               vector option_size = '1 1 0' * fontsize.y * 0.8;
-               desc_width -= option_size.x;
-               drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
-               desc_width -= fontsize.x / 4;
-       }
-       entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
-       if (autocvar_hud_panel_quickmenu_align > 0)
-       {
-               float real_desc_width = stringwidth_colors(entry, fontsize);
-               offset = (desc_width - real_desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
-
-               if(option)
-               {
-                       // when there's enough room align description regardless the checkbox
-                       float extra_offset = (panel_size.x - desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
-                       if(offset + real_desc_width + extra_offset < desc_width)
-                               offset += extra_offset;
-                       else
-                               offset = max(0, desc_width - real_desc_width);
-               }
-               drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
-       }
-       else
-               drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
-}
-
-void HUD_QuickMenu()
-{
-       if(!autocvar__hud_configure)
-       {
-               if (hud_configure_prev && hud_configure_prev != -1)
-                       QuickMenu_Close();
-
-               if(!hud_draw_maximized) return;
-               if(mv_active) return;
-               //if(!autocvar_hud_panel_quickmenu) return;
-               if(!hud_panel_quickmenu) return;
-
-               if(QuickMenu_TimeOut)
-               if(time > QuickMenu_TimeOut)
-               {
-                       QuickMenu_Close();
-                       return;
-               }
-       }
-       else
-       {
-               if(!QuickMenu_IsOpened())
-               {
-                       QuickMenu_Page_Entries = 1;
-                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
-                       ++QuickMenu_Page_Entries;
-                       QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
-                       ++QuickMenu_Page_Entries;
-                       // although real command doesn't matter here, it must not be empty
-                       // otherwise the entry is displayed like a submenu
-                       for (; QuickMenu_Page_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Page_Entries)
-                               QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Command%d"), QuickMenu_Page_Entries), "-");
-                       ++QuickMenu_Page_Entries;
-                       QuickMenu_Page_ClearEntry(QuickMenu_Page_Entries);
-                       QuickMenu_IsLastPage = false;
-               }
-       }
-
-       HUD_Panel_UpdateCvars();
-
-       HUD_Panel_DrawBg(1);
-
-       if(panel_bg_padding)
-       {
-               panel_pos += '1 1 0' * panel_bg_padding;
-               panel_size -= '2 2 0' * panel_bg_padding;
-       }
-
-       int i;
-       vector fontsize;
-       string color;
-       fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
-
-       if (!QuickMenu_IsLastPage)
-       {
-               color = "^5";
-               HUD_Quickmenu_DrawEntry(panel_pos + eY * (panel_size.y - fontsize.y), sprintf("%d: %s%s", 0, color, _("Continue...")), string_null, fontsize);
-       }
-       else
-               panel_pos.y += ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
-
-       for (i = 1; i <= QuickMenu_Page_Entries; ++i) {
-               if (QuickMenu_Page_Description[i] == "")
-                       break;
-               string option = string_null;
-               if (QuickMenu_Page_Command[i] == "")
-                       color = "^4";
-               else
-               {
-                       color = "^3";
-                       if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
-                       {
-                               int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
-                               if(end < 0)
-                                       tokenize_console(QuickMenu_Page_Command[i]);
-                               else
-                                       tokenize_console(substring(QuickMenu_Page_Command[i], 0, end));
-
-                               //if(argv(1) && argv(0) == "toggle") // already checked
-                               {
-                                       // "enable feature xxx" "toggle xxx" (or "toggle xxx 1 0")
-                                       // "disable feature xxx" "toggle xxx 0 1"
-                                       float ON_value = 1, OFF_value = 0;
-                                       if(argv(2))
-                                               ON_value = stof(argv(2));
-
-                                       if(argv(3))
-                                               OFF_value = stof(argv(3));
-                                       else
-                                               OFF_value = !ON_value;
-
-                                       float value = cvar(argv(1));
-                                       if(value == ON_value)
-                                               option = "checkbox_checked";
-                                       else if(value == OFF_value)
-                                               option = "checkbox_empty";
-                                       else
-                                               option = "checkbox_undefined";
-                               }
-                       }
-               }
-               HUD_Quickmenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Page_Description[i]), option, fontsize);
-
-               if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
-                       && QuickMenu_Page_ActivatedEntry == i)
-                       drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
-
-               panel_pos.y += fontsize.y;
-       }
-
-       if(QuickMenu_Page_ActivatedEntry >= 0 && time >= QuickMenu_Page_ActivatedEntry_Time)
-       {
-               if(!QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
-               {
-                       bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
-                       if(f && QuickMenu_Page_ActivatedEntry_Close)
-                               QuickMenu_Close();
-               }
-               else if(QuickMenu_Page_ActivatedEntry_Close)
-                       QuickMenu_Close();
-               QuickMenu_Page_ActivatedEntry = -1;
-               QuickMenu_Page_ActivatedEntry_Time = 0;
-       }
-}
-
-
-#define QUICKMENU_SMENU(submenu,eng_submenu) { \
-       if(target_submenu == eng_submenu && target_submenu_found) \
-               return; /* target_submenu entries are now loaded, exit */ \
-       if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \
-               QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \
-       ++QuickMenu_Buffer_Size; \
-       if(target_submenu == eng_submenu && !target_submenu_found) { \
-               QuickMenu_Buffer_Size = 0; /* enable load of next entries */ \
-               target_submenu_found = true; \
-       } \
-}
-
-#define QUICKMENU_ENTRY(title,command) { \
-       if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
-       { \
-               QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
-               ++QuickMenu_Buffer_Size; \
-               QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \
-       } \
-       ++QuickMenu_Buffer_Size; \
-}
-
-#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
-       if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
-               QUICKMENU_SMENU(submenu,eng_submenu) \
-               QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
-               ++QuickMenu_Buffer_Size; \
-               QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
-               ++QuickMenu_Buffer_Size; \
-               QUICKMENU_SMENU(submenu,eng_submenu) \
-       } \
-}
-
-
-
-// useful to Translate a string inside the Command
-#define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
-       if(prvm_language == "en") \
-               QUICKMENU_ENTRY(title, sprintf(command, text)) \
-       else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
-               QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
-       else \
-               QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
-}
-
-void HUD_Quickmenu_PlayerListEntries(string cmd, float teamplayers, float without_me)
-{
-       entity pl;
-       if(teamplayers && !team_count)
-               return;
-
-       for(pl = players.sort_next; pl; pl = pl.sort_next)
-       {
-               if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
-                       continue;
-               if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
-                       continue;
-               if(without_me && pl.sv_entnum == player_localnum)
-                       continue;
-               QUICKMENU_ENTRY(entcs_GetName(pl.sv_entnum), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
-       }
-
-       return;
-}
-
-
-// Specifying target_submenu, this function only loads entries inside target_submenu
-// NOTE: alternatively we could have loaded the whole default quickmenu and
-// then called QuickMenu_Page_Load(target_submenu, 0);
-// but this sytem is more reliable since we can always refer to target_submenu
-// with the English title even if a translation is active
-void QuickMenu_Default(string target_submenu)
-{
-       bool target_submenu_found = false;
-       if(target_submenu != "")
-               QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
-
-       QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
-       QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
-
-       if(teamplay)
-       {
-       QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^quad soon")), "say_team %s", "quad soon", CTX(_("QMCMD^quad soon")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^free item, icon")), "say_team %s; g_waypointsprite_team_here_p", "free item %x^7 (l:%y^7)", CTX(_("QMCMD^free item %x^7 (l:%y^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^took item, icon")), "say_team %s; g_waypointsprite_team_here", "took item (l:%l^7)", CTX(_("QMCMD^took item (l:%l^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^negative")), "say_team %s", "negative", CTX(_("QMCMD^negative")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^positive")), "say_team %s", "positive", CTX(_("QMCMD^positive")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^need help, icon")), "say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp", "need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^enemy seen, icon")), "say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming", "enemy seen (l:%y^7)", CTX(_("QMCMD^enemy seen (l:%y^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^flag seen, icon")), "say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag", "flag seen (l:%y^7)", CTX(_("QMCMD^flag seen (l:%y^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^defending, icon")), "say_team %s; g_waypointsprite_team_here", "defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^roaming, icon")), "say_team %s; g_waypointsprite_team_here", "roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^attacking, icon")), "say_team %s; g_waypointsprite_team_here", "attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^killed flag, icon")), "say_team %s; g_waypointsprite_team_here_p", "killed flagcarrier (l:%y^7)", CTX(_("QMCMD^killed flagcarrier (l:%y^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^dropped flag, icon")), "say_team %s; g_waypointsprite_team_here_d", "dropped flag (l:%d^7)", CTX(_("QMCMD^dropped flag (l:%d^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop gun, icon")), "say_team %s; g_waypointsprite_team_here; wait; dropweapon", "dropped gun %w^7 (l:%l^7)", CTX(_("QMCMD^dropped gun %w^7 (l:%l^7)")))
-               QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop flag/key, icon")), "say_team %s; g_waypointsprite_team_here; wait; use", "dropped flag/key %w^7 (l:%l^7)", CTX(_("QMCMD^dropped flag/key %w^7 (l:%l^7)")))
-       QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
-       }
-
-       QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
-
-       QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
-               QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Player models like mine")), "toggle cl_forceplayermodels")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Names above players")), "toggle hud_shownames")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Crosshair per weapon")), "toggle crosshair_per_weapon")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^FPS")), "toggle hud_panel_engineinfo")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Net graph")), "toggle shownetgraph")
-               QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
-
-               QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Hit sound")), "toggle cl_hitsound")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Chat sound")), "toggle con_chatsound")
-               QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
-
-               if(spectatee_status > 0)
-               {
-               QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^1st person")), "chase_active 0; -use")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person around player")), "chase_active 1; +use")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person behind")), "chase_active 1; -use")
-               QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
-               }
-
-               if(spectatee_status == -1)
-               {
-               QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Increase speed")), "weapnext")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Decrease speed")), "weapprev")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision off")), "+use")
-                       QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision on")), "-use")
-               QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
-               }
-
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
-               if(prvm_language != "en")
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
-       QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
-
-       QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Restart the map")), "vcall restart")
-               QUICKMENU_ENTRY(CTX(_("QMCMD^End match")), "vcall endmatch")
-               if(STAT(TIMELIMIT) > 0)
-               {
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Reduce match time")), "vcall reducematchtime")
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Extend match time")), "vcall extendmatchtime")
-               }
-               if(teamplay)
-               QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
-       QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
-
-       if(target_submenu != "" && !target_submenu_found)
-       {
-               LOG_WARNINGF("Couldn't find submenu \"%s\"\n", target_submenu);
-               if(prvm_language != "en")
-                       LOG_WARNINGF("^3Warning: submenu must be in English\n", target_submenu);
-               QuickMenu_Buffer_Size = 0;
-       }
-}
-#undef QUICKMENU_SMENU
-#undef QUICKMENU_ENTRY
-#undef QUICKMENU_ENTRY_TC
diff --git a/qcsrc/client/quickmenu.qh b/qcsrc/client/quickmenu.qh
deleted file mode 100644 (file)
index cf5f666..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef CLIENT_QUICKMENU_H
-#define CLIENT_QUICKMENU_H
-
-bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
-bool QuickMenu_IsOpened();
-void QuickMenu_Mouse();
-
-#endif
index 3204af9f0815de1c819f035c66f44859a1b6d145..7dcf9876983761fb500f562da5fd62c026c1218f 100644 (file)
@@ -1,13 +1,14 @@
 #include "scoreboard.qh"
 
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
 #include "hud/all.qh"
 
-#include "../common/constants.qh"
-#include "../common/mapinfo.qh"
-#include "../common/minigames/cl_minigames.qh"
-#include "../common/stats.qh"
-#include "../common/teams.qh"
+#include <common/ent_cs.qh>
+#include <common/constants.qh>
+#include <common/mapinfo.qh>
+#include <common/minigames/cl_minigames.qh>
+#include <common/stats.qh>
+#include <common/teams.qh>
 
 float scoreboard_alpha_bg;
 float scoreboard_alpha_fg;
@@ -127,8 +128,9 @@ void HUD_UpdatePlayerTeams()
        */
 }
 
-int HUD_CompareScore(float vl, float vr, int f)
+int HUD_CompareScore(int vl, int vr, int f)
 {
+    TC(int, vl); TC(int, vr); TC(int, f);
        if(f & SFL_ZERO_IS_WORST)
        {
                if(vl == 0 && vr != 0)
@@ -312,8 +314,9 @@ void Cmd_HUD_Help()
 "+as/objectives +nb/faults +nb/goals +ka/pickups +ka/bckills +ka/bctime +ft/revivals " \
 "-lms,rc,nb/score"
 
-void Cmd_HUD_SetFields(float argc)
+void Cmd_HUD_SetFields(int argc)
 {
+    TC(int, argc);
        int i, j, slash;
        string str, pattern;
        float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0;
@@ -407,7 +410,7 @@ void Cmd_HUD_SetFields(float argc)
                                        if(str == strtolower(scores_label[j]))
                                                goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code"
 
-:notfound
+LABEL(notfound)
                                if(str == "frags")
                                        j = SP_FRAGS;
                                else
@@ -416,7 +419,7 @@ void Cmd_HUD_SetFields(float argc)
                                                LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str);
                                        continue;
                                }
-:found
+LABEL(found)
                                hud_field[hud_num_fields] = j;
                                if(j == ps_primary)
                                        have_primary = 1;
@@ -515,6 +518,7 @@ float hud_field_icon1_alpha;
 float hud_field_icon2_alpha;
 string HUD_GetField(entity pl, int field)
 {
+    TC(int, field);
        float tmp, num, denom;
        int f;
        string str;
@@ -639,6 +643,7 @@ float hud_fixscoreboardcolumnwidth_marginlen;
 
 string HUD_FixScoreboardColumnWidth(int i, string str)
 {
+    TC(int, i);
        float field, f;
        vector sz;
        field = hud_field[i];
@@ -703,8 +708,9 @@ string HUD_FixScoreboardColumnWidth(int i, string str)
        return str;
 }
 
-void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, int pl_number)
+void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, bool is_self, int pl_number)
 {
+    TC(bool, is_self); TC(int, pl_number);
        vector tmp, rgb;
        rgb = Team_ColorRGB(pl.team);
        string str;
@@ -996,7 +1002,6 @@ float HUD_WouldDrawScoreboard() {
 float average_accuracy;
 vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 {
-       SELFPARAM();
        WepSet weapons_stat = WepSet_GetFromStat();
        WepSet weapons_inmap = WepSet_GetFromStat_InMap();
        float initial_posx = pos.x;
@@ -1303,7 +1308,7 @@ void HUD_DrawScoreboard()
        pos.y += sb_heading_fontsize.y + hud_fontsize.y * 0.25;
 
        // Draw the scoreboard
-       vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale;
+       vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * ((autocvar_scoreboard_bg_scale > 0) ? autocvar_scoreboard_bg_scale : 0.25);
 
        if(teamplay)
        {
index 4e43cb65fd303ab7a1f1f6beb8e0b34d7ecfaac4..8fccae94845577193f1fbbb2997859707bf5e735 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_SCOREBOARD_H
-#define CLIENT_SCOREBOARD_H
+#pragma once
 
 float xmin, xmax, ymin, ymax, sbwidth;
 
@@ -12,4 +11,3 @@ void HUD_InitScores();
 void HUD_UpdatePlayerPos(entity pl);
 void HUD_UpdateTeamPos(entity Team);
 float HUD_WouldDrawScoreboard();
-#endif
index fc36c47274d6ebeefbd7a23d1aef31036ac289f1..5368cb6429177ef4130a10e45610596485cab269 100644 (file)
@@ -2,11 +2,12 @@
 
 #include "hud/all.qh"
 
-#include "../common/constants.qh"
-#include "../common/mapinfo.qh"
-#include "../common/teams.qh"
+#include <common/ent_cs.qh>
+#include <common/constants.qh>
+#include <common/mapinfo.qh>
+#include <common/teams.qh>
 
-#include "../lib/csqcmodel/cl_model.qh"
+#include <lib/csqcmodel/cl_model.qh>
 
 // this.isactive = player is in range and coordinates/status (health and armor) are up to date
 // this.origin = player origin
@@ -166,6 +167,7 @@ void Draw_ShowNames(entity this)
 
 void Draw_ShowNames_All()
 {
+    SELFPARAM();
        if (!autocvar_hud_shownames) return;
        LL_EACH(shownames_ent, true, {
                entity entcs = entcs_receiver(i);
@@ -176,7 +178,7 @@ void Draw_ShowNames_All()
                }
                make_impure(it);
                assert(entcs.think, eprint(entcs));
-               WITH(entity, self, entcs, entcs.think());
+               WITHSELF(entcs, entcs.think());
                if (!entcs.has_origin) continue;
                if (entcs.m_entcs_private)
                {
index 1304c537059f232cc8f82e60018b1f2d469eff3c..24f6568d26629396ff7322bfae3b97695f545d3d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_SHOWNAMES_H
-#define CLIENT_SHOWNAMES_H
+#pragma once
 
 entityclass(ShowNames);
 class(ShowNames) .float healthvalue;
@@ -9,5 +8,3 @@ class(ShowNames) .float fadedelay;
 class(ShowNames) .float pointtime;
 
 void Draw_ShowNames_All();
-
-#endif
index 96fd5ee977695877739119e0ba69427588649859..01388fdd2ff7ad69609cc6f00ea671df7df98724 100644 (file)
@@ -148,6 +148,7 @@ void draw_teamradar_icon(vector coord, entity icon, entity pingdata, vector rgb,
 
 void draw_teamradar_link(vector start, vector end, int colors)
 {
+    TC(int, colors);
        vector c0, c1, norm;
 
        start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start));
index ca7ec87b59f14e58deab8b41a291556e00379fcd..0b1884ccf3a713d8c77488bd7d809dcf3d013cb3 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_TEAMRADAR_H
-#define CLIENT_TEAMRADAR_H
+#pragma once
 
 const int MAX_TEAMRADAR_TIMES = 32;
 
@@ -44,5 +43,3 @@ void draw_teamradar_icon(vector coord, entity icon, entity pingdata, vector rgb,
 void draw_teamradar_link(vector start, vector end, int colors);
 
 void teamradar_loadcvars();
-
-#endif
index 70a4f2eeb1d579a0f894998cb4b999a902c5b5e2..f1b7a9be5ede7c8ccd4ca511bfb8cfc9851059b8 100644 (file)
@@ -1,33 +1,38 @@
+#include "view.qh"
 
 #include "announcer.qh"
 #include "hud/all.qh"
 #include "mapvoting.qh"
 #include "scoreboard.qh"
 #include "shownames.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
 
 #include "mutators/events.qh"
 
-#include "../common/anim.qh"
-#include "../common/constants.qh"
-#include "../common/debug.qh"
-#include "../common/mapinfo.qh"
+#include <common/animdecide.qh>
+#include <common/ent_cs.qh>
+#include <common/anim.qh>
+#include <common/constants.qh>
+#include <common/debug.qh>
+#include <common/mapinfo.qh>
 #include <common/gamemodes/all.qh>
-#include "../common/physics/player.qh"
-#include "../common/stats.qh"
-#include "../common/triggers/target/music.qh"
-#include "../common/teams.qh"
+#include <common/physics/player.qh>
+#include <common/stats.qh>
+#include <common/triggers/target/music.qh>
+#include <common/teams.qh>
 
 #include <common/vehicles/all.qh>
 #include <common/weapons/all.qh>
-#include "../common/viewloc.qh"
-#include "../common/minigames/cl_minigames.qh"
-#include "../common/minigames/cl_minigames_hud.qh"
+#include <common/viewloc.qh>
+#include <common/minigames/cl_minigames.qh>
+#include <common/minigames/cl_minigames_hud.qh>
 
-#include "../lib/csqcmodel/cl_player.qh"
+#include <lib/csqcmodel/cl_player.qh>
+#include <lib/csqcmodel/cl_model.qh>
+#include "csqcmodel_hooks.qh"
 
-#include "../lib/warpzone/client.qh"
-#include "../lib/warpzone/common.qh"
+#include <lib/warpzone/client.qh>
+#include <lib/warpzone/common.qh>
 
 #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT)
 
@@ -148,7 +153,7 @@ void viewmodel_animate(entity this)
                        vel = view.velocity;
                else
                {
-                       vector forward, right = '0 0 0', up = '0 0 0';
+                       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
                        MAKEVECTORS(makevectors, view_angles, forward, right, up);
                        vel.x = view.velocity * forward;
                        vel.y = view.velocity * right * -1;
@@ -174,7 +179,7 @@ void viewmodel_animate(entity this)
                if(autocvar_cl_followmodel_velocity_absolute)
                {
                        vector fixed_gunorg;
-                       vector forward, right = '0 0 0', up = '0 0 0';
+                       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
                        MAKEVECTORS(makevectors, view_angles, forward, right, up);
                        fixed_gunorg.x = gunorg * forward;
                        fixed_gunorg.y = gunorg * right * -1;
@@ -295,10 +300,11 @@ void viewmodel_draw(entity this)
        {
                static string name_last;
                string name = wep.mdl;
-               if (name != name_last)
+               bool swap = name != name_last;
+               // if (swap)
                {
                        name_last = name;
-                       CL_WeaponEntity_SetModel(this, name);
+                       CL_WeaponEntity_SetModel(this, name, swap);
                        this.viewmodel_origin = this.origin;
                        this.viewmodel_angles = this.angles;
                }
@@ -307,7 +313,8 @@ void viewmodel_draw(entity this)
                        anim_set(this, this.anim_idle, true, false, false);
        }
        float f = 0; // 0..1; 0: fully active
-       float eta = (this.weapon_nextthink - time) / STAT(WEAPONRATEFACTOR);
+       float rate = STAT(WEAPONRATEFACTOR);
+       float eta = rate ? ((this.weapon_nextthink - time) / rate) : 0;
        if (eta <= 0) f = this.weapon_eta_last;
        else switch (this.state)
        {
@@ -835,10 +842,88 @@ void HitSound()
        }
 }
 
-void HUD_Crosshair()
-{SELFPARAM();
+vector crosshair_getcolor(entity this, float health_stat)
+{
        static float rainbow_last_flicker;
        static vector rainbow_prev_color;
+       vector wcross_color = '0 0 0';
+       switch(autocvar_crosshair_color_special)
+       {
+               case 1: // crosshair_color_per_weapon
+               {
+                       if(this)
+                       {
+                               wcross_color = this.wpcolor;
+                               break;
+                       }
+                       else { goto normalcolor; }
+               }
+
+               case 2: // crosshair_color_by_health
+               {
+                       float x = health_stat;
+
+                       //x = red
+                       //y = green
+                       //z = blue
+
+                       wcross_color.z = 0;
+
+                       if(x > 200)
+                       {
+                               wcross_color.x = 0;
+                               wcross_color.y = 1;
+                       }
+                       else if(x > 150)
+                       {
+                               wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
+                               wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
+                       }
+                       else if(x > 100)
+                       {
+                               wcross_color.x = 1 - (x-100)*0.02 * 0.6;
+                               wcross_color.y = 1 - (x-100)*0.02 * 0.1;
+                               wcross_color.z = 1 - (x-100)*0.02;
+                       }
+                       else if(x > 50)
+                       {
+                               wcross_color.x = 1;
+                               wcross_color.y = 1;
+                               wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
+                       }
+                       else if(x > 20)
+                       {
+                               wcross_color.x = 1;
+                               wcross_color.y = (x-20)*90/27/100;
+                               wcross_color.z = (x-20)*90/27/100 * 0.2;
+                       }
+                       else
+                       {
+                               wcross_color.x = 1;
+                               wcross_color.y = 0;
+                       }
+                       break;
+               }
+
+               case 3: // crosshair_color_rainbow
+               {
+                       if(time >= rainbow_last_flicker)
+                       {
+                               rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
+                               rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
+                       }
+                       wcross_color = rainbow_prev_color;
+                       break;
+               }
+LABEL(normalcolor)
+               default: { wcross_color = stov(autocvar_crosshair_color); break; }
+       }
+
+       return wcross_color;
+}
+
+void HUD_Crosshair()
+{SELFPARAM();
        entity e = this;
        float f, i, j;
        vector v;
@@ -919,77 +1004,7 @@ void HUD_Crosshair()
                        wcross_name = strcat("gfx/crosshair", wcross_style);
 
                // MAIN CROSSHAIR COLOR DECISION
-               switch(autocvar_crosshair_color_special)
-               {
-                       case 1: // crosshair_color_per_weapon
-                       {
-                               if(e)
-                               {
-                                       wcross_color = e.wpcolor;
-                                       break;
-                               }
-                               else { goto normalcolor; }
-                       }
-
-                       case 2: // crosshair_color_by_health
-                       {
-                               float x = STAT(HEALTH);
-
-                               //x = red
-                               //y = green
-                               //z = blue
-
-                               wcross_color.z = 0;
-
-                               if(x > 200)
-                               {
-                                       wcross_color.x = 0;
-                                       wcross_color.y = 1;
-                               }
-                               else if(x > 150)
-                               {
-                                       wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
-                                       wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
-                               }
-                               else if(x > 100)
-                               {
-                                       wcross_color.x = 1 - (x-100)*0.02 * 0.6;
-                                       wcross_color.y = 1 - (x-100)*0.02 * 0.1;
-                                       wcross_color.z = 1 - (x-100)*0.02;
-                               }
-                               else if(x > 50)
-                               {
-                                       wcross_color.x = 1;
-                                       wcross_color.y = 1;
-                                       wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
-                               }
-                               else if(x > 20)
-                               {
-                                       wcross_color.x = 1;
-                                       wcross_color.y = (x-20)*90/27/100;
-                                       wcross_color.z = (x-20)*90/27/100 * 0.2;
-                               }
-                               else
-                               {
-                                       wcross_color.x = 1;
-                                       wcross_color.y = 0;
-                               }
-                               break;
-                       }
-
-                       case 3: // crosshair_color_rainbow
-                       {
-                               if(time >= rainbow_last_flicker)
-                               {
-                                       rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
-                                       rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
-                               }
-                               wcross_color = rainbow_prev_color;
-                               break;
-                       }
-                       :normalcolor
-                       default: { wcross_color = stov(autocvar_crosshair_color); break; }
-               }
+               wcross_color = crosshair_getcolor(e, STAT(HEALTH));
 
                if(autocvar_crosshair_effect_scalefade)
                {
@@ -1345,6 +1360,7 @@ float vh_notice_time;
 void WaypointSprite_Load();
 void CSQC_UpdateView(float w, float h)
 {SELFPARAM();
+    TC(int, w); TC(int, h);
        entity e;
        float fov;
        float f;
@@ -1452,13 +1468,13 @@ void CSQC_UpdateView(float w, float h)
                        if(!gen)
                                ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
                }
-               if(WantEventchase(self) || (!autocvar_cl_orthoview && ons_roundlost))
+               if(WantEventchase(this) || (!autocvar_cl_orthoview && ons_roundlost))
                {
                        eventchase_running = true;
 
                        entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
                        if(!local_player)
-                               local_player = self; // fall back!
+                               local_player = this; // fall back!
 
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
                        vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
@@ -1477,7 +1493,7 @@ void CSQC_UpdateView(float w, float h)
 
                        if(view_offset)
                        {
-                               WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+                               WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, this);
                                if(trace_fraction == 1) { current_view_origin += view_offset; }
                                else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
                        }
@@ -1506,14 +1522,14 @@ void CSQC_UpdateView(float w, float h)
                        makevectors(view_angles);
 
                        vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
-                       WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
+                       WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
 
                        // If the boxtrace fails, revert back to line tracing.
                        if(!local_player.viewloc)
                        if(trace_startsolid)
                        {
                                eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
-                               WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+                               WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
                                setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
                        }
                        else { setproperty(VF_ORIGIN, trace_endpos); }
diff --git a/qcsrc/client/view.qh b/qcsrc/client/view.qh
new file mode 100644 (file)
index 0000000..f8c8bd2
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+vector crosshair_getcolor(entity this, float health_stat);
index f93eb3ae1421ce8db213e1212713ec6a2fab89d0..11aebd0ed5e25df349f6fa12a8288e345e47f27f 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_WALL_H
-#define CLIENT_WALL_H
+#pragma once
 
 entityclass(Wall);
 class(Wall) .float lip;
@@ -19,5 +18,3 @@ class(Wall) .vector saved;
 void Ent_Wall_Draw(entity this);
 
 void Ent_Wall_Remove(entity this);
-
-#endif
diff --git a/qcsrc/client/weapons/_mod.inc b/qcsrc/client/weapons/_mod.inc
new file mode 100644 (file)
index 0000000..005158a
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "projectile.qc"
index c8e246a06e3dd6a0ab79170802846d19538c37e0..ea2f5f3d6dc87be3ac19515754715556755dd638 100644 (file)
@@ -171,6 +171,7 @@ void Projectile_Draw(entity this)
 
 void loopsound(entity e, int ch, string samp, float vol, float attn)
 {
+    TC(int, ch);
        if (e.silent)
                return;
 
index 1b0d313aa9cc9cea10a3c1d38d8e34790fa2d2f8..66e1be4707629bffeee90a18f694373958a4a2b1 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CLIENT_WEAPONS_PROJECTILE_H
-#define CLIENT_WEAPONS_PROJECTILE_H
+#pragma once
 
 entityclass(Projectile);
 class(Projectile).int traileffect;
@@ -30,5 +29,3 @@ void loopsound(entity e, int ch, string samp, float vol, float attn);
 void Ent_RemoveProjectile(entity this);
 
 const int FL_PROJECTILE = BIT(15);
-
-#endif
index 78d2373e2d59e508b7a0d7a175f2a3d976ff027e..b16c24fb47086179068f433c7b93a057f28836c0 100644 (file)
@@ -1,3 +1,5 @@
+float autocvar_net_connecttimeout = 30;
+
 #ifndef MENUQC
 #include "anim.qc"
 #include "animdecide.qc"
 #include "t_items.qc"
 #endif
 
-#include "items/all.qc"
+#include "items/_mod.inc"
     #include "weapons/all.qc"
         #include "monsters/all.qc"
         #include "turrets/all.qc"
         #include "vehicles/all.qc"
 
-#include "mutators/all.qc"
-    #include "gamemodes/all.qc"
+#include "mutators/_mod.inc"
+    #include "gamemodes/_mod.inc"
diff --git a/qcsrc/common/_mod.inc b/qcsrc/common/_mod.inc
new file mode 100644 (file)
index 0000000..0503213
--- /dev/null
@@ -0,0 +1,13 @@
+// generated file; do not modify
+#include "anim.qc"
+#include "animdecide.qc"
+#include "campaign_file.qc"
+#include "campaign_setup.qc"
+#include "ent_cs.qc"
+#include "mapinfo.qc"
+#include "net_notice.qc"
+#include "playerstats.qc"
+#include "state.qc"
+#include "t_items.qc"
+#include "util.qc"
+#include "viewloc.qc"
diff --git a/qcsrc/common/command/_mod.inc b/qcsrc/common/command/_mod.inc
new file mode 100644 (file)
index 0000000..57ff3f7
--- /dev/null
@@ -0,0 +1,5 @@
+// generated file; do not modify
+#include "all.qc"
+#include "generic.qc"
+#include "markup.qc"
+#include "rpn.qc"
index 9bbce5e14a67d6d57474de504b1b696d1c9281f5..129090d3ab442b0bfeaf468434a778fbe4f7147a 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, entity caller, int arguments, string command))
+       METHOD(genericcommand_##id, m_invokecmd, void(genericcommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(GENERIC_COMMANDS_aliases) {
        FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu")));
index beda2288c9ff97e9bc7ee2ad4fcdb2426b263b62..72eaa18dabb3189c7185ced9e66eeb686ddab832 100644 (file)
@@ -7,7 +7,10 @@ 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, entity caller, int arguments, string command)) { }
+       METHOD(Command, m_invokecmd, void(Command this, int request, entity caller, int arguments, string command))
+       {
+        TC(Command, this);
+       }
 ENDCLASS(Command)
 
 #endif
index 50cc49076d56b438c5d0d0e5f5df2eda6dd550a1..90d6cefe7bb4d0ac7819f9eecdb5edd859ab966b 100644 (file)
@@ -544,7 +544,7 @@ float GenericCommand_macro_command(float argc, string command)
 {
        string c = strtolower(argv(0));
        FOREACH(GENERIC_COMMANDS, it.m_name == c, {
-               it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+               it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
                return true;
        });
        return false;
@@ -554,7 +554,7 @@ float GenericCommand_macro_usage(float argc)
 {
        string c = strtolower(argv(1));
        FOREACH(GENERIC_COMMANDS, it.m_name == c, {
-               it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+               it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
                return true;
        });
        return false;
index 63e1dce83b9bfbabbf3b0a4aa0a779b622c6dd98..f8139aaf47e4a894bb803645628683b1168d5c96 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef COMMAND_GENERIC_H
 #define COMMAND_GENERIC_H
 
-#include "../constants.qh"
+#include <common/constants.qh>
 
 // =========================================================
 //  Declarations for common command code, written by Samual
index 1ca075bbbdf1f614652985039cf575182f13a149..12bb99d1d3e862b43904298c57627bb1e874b05c 100644 (file)
@@ -437,7 +437,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                                if(argv(i) == argv(j))
                                                                        goto skip_union;
                                                        s = strcat(s, " ", argv(i));
-                                                       :skip_union
+LABEL(skip_union)
                                                }
                                                if(substring(s, 0, 1) == " ")
                                                        s = substring(s, 1, 99999);
@@ -480,7 +480,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                                if(argv(i) == argv(j))
                                                                        goto skip_difference;
                                                        s = strcat(s, " ", argv(i));
-                                                       :skip_difference
+LABEL(skip_difference)
                                                }
                                                if(substring(s, 0, 1) == " ")
                                                        s = substring(s, 1, 99999);
diff --git a/qcsrc/common/deathtypes/_mod.inc b/qcsrc/common/deathtypes/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
index ae40ed811159b97b22db510bf46b6eda04e5a152..903087947416dfe6978a24900a72020fa3af3354 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DEATHTYPES_ALL_H
 #define DEATHTYPES_ALL_H
 
-#include "../notifications/all.qh"
+#include <common/notifications/all.qh>
 
 REGISTRY(Deathtypes, BITS(8))
 #define Deathtypes_from(i) _Deathtypes_from(i, NULL)
index 113019a7c7d125bf69a03b215e67739438220b3a..40b2b3547ef16116994ef2ce879f0a497fa6125d 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef CSQC
+.entity tag_entity;
+#endif
+
 #ifndef MENUQC
 .bool debug;
 .int sv_entnum;
@@ -239,7 +243,7 @@ MUTATOR_HOOKFUNCTION(trace, SV_StartFrame)
                    it.solid_prev = it.solid;
                        it.solid = SOLID_BBOX;
                });
-               vector forward; vector right; vector up;
+               vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0';
                MAKEVECTORS(makevectors, it.v_angle, forward, right, up);
                vector pos = it.origin + it.view_ofs;
                traceline(pos, pos + forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, it);
diff --git a/qcsrc/common/effects/_mod.inc b/qcsrc/common/effects/_mod.inc
new file mode 100644 (file)
index 0000000..25e9062
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "all.qc"
+#include "effectinfo.qc"
index da98946021b611dfc731f597b57ab60832c70249..07d76c480a07627cddc8b284c1e614c89e804e16 100644 (file)
@@ -197,7 +197,9 @@ CLASS(EffectInfo, Object)
     FIELDS(MY)
     #undef MY
 
-    METHOD(EffectInfo, describe, string(EffectInfo this)) {
+    METHOD(EffectInfo, describe, string(EffectInfo this))
+    {
+        TC(EffectInfo, this);
         string s = sprintf("SUB(%s) {\n", this.effectinfo_name);
         #define str_bool(it) (it ? "true" : "false")
         #define str_float(it) ftos(it)
@@ -209,7 +211,9 @@ CLASS(EffectInfo, Object)
         return strcat(s, "}\n");
     }
 
-    METHOD(EffectInfo, dump, string(EffectInfo this)) {
+    METHOD(EffectInfo, dump, string(EffectInfo this))
+    {
+        TC(EffectInfo, this);
         string s = sprintf("effect %s\n", this.effectinfo_name);
         #define MY(f) this.effectinfo_##f
         #define p(k, isset, parse, unparse) if (isset) { s = strcat(s, "\t", #k, unparse, "\n"); }
diff --git a/qcsrc/common/effects/qc/_mod.inc b/qcsrc/common/effects/qc/_mod.inc
new file mode 100644 (file)
index 0000000..fc5a14f
--- /dev/null
@@ -0,0 +1,8 @@
+// generated file; do not modify
+#include "all.qc"
+#include "casings.qc"
+#include "damageeffects.qc"
+#include "gibs.qc"
+#include "globalsound.qc"
+#include "lightningarc.qc"
+#include "modeleffects.qc"
index 6763519ef49b55543bac9a1d150c6054861beccf..ab217110b08a96352ea01185e63be7e38ff08134 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef SVQC
+void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner);
+#endif
+
 #ifdef IMPLEMENTATION
 
 #include <common/util.qh>
index ba60e51bd10cf3c483a24a3c818f52d2ab3ed476..c894ea15414f294ba8d5b6b1d62192b3558056c1 100644 (file)
@@ -73,33 +73,33 @@ void DamageEffect_Think()
 {SELFPARAM();
        // if particle distribution is enabled, slow ticrate by total number of damages
        if(autocvar_cl_damageeffect_distribute)
-               self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
+               this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
        else
-               self.nextthink = time + autocvar_cl_damageeffect_ticrate;
+               this.nextthink = time + autocvar_cl_damageeffect_ticrate;
 
-       if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
+       if(time >= this.cnt || !this.owner || !this.owner.modelindex || !this.owner.drawmask)
        {
                // time is up or the player got gibbed / disconnected
-               self.owner.total_damages = max(0, self.owner.total_damages - 1);
-               remove(self);
+               this.owner.total_damages = max(0, this.owner.total_damages - 1);
+               remove(this);
                return;
        }
-       if(self.state && !self.owner.csqcmodel_isdead)
+       if(this.state && !this.owner.csqcmodel_isdead)
        {
                // if the player was dead but is now alive, it means he respawned
                // if so, clear his damage effects, or damages from his dead body will be copied back
-               self.owner.total_damages = max(0, self.owner.total_damages - 1);
-               remove(self);
+               this.owner.total_damages = max(0, this.owner.total_damages - 1);
+               remove(this);
                return;
        }
-       self.state = self.owner.csqcmodel_isdead;
-       if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum) && !autocvar_chase_active)
+       this.state = this.owner.csqcmodel_isdead;
+       if(this.owner.isplayermodel && (this.owner.entnum == player_localentnum) && !autocvar_chase_active)
                return; // if we aren't using a third person camera, hide our own effects
 
        // now generate the particles
        vector org;
-       org = gettaginfo(self, 0); // origin at attached location
-       __pointparticles(self.team, org, '0 0 0', 1);
+       org = gettaginfo(this, 0); // origin at attached location
+       __pointparticles(this.team, org, '0 0 0', 1);
 }
 
 string species_prefix(int specnum)
@@ -117,8 +117,8 @@ string species_prefix(int specnum)
        }
 }
 
-void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{SELFPARAM();
+void DamageEffect(entity this, vector hitorg, float thedamage, int type, int specnum)
+{
        // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
 
        int nearestbone = 0;
@@ -128,13 +128,13 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 
        if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage)
                return;
-       if(!self || !self.modelindex || !self.drawmask)
+       if(!this || !this.modelindex || !this.drawmask)
                return;
 
        // if this is a rigged mesh, the effect will show on the bone where damage was dealt
        // we do this by choosing the skeletal bone closest to the impact, and attaching our entity to it
        // if there's no skeleton, object origin will automatically be selected
-       FOR_EACH_TAG(self)
+       FOR_EACH_TAG(this)
        {
                if(!tagnum)
                        continue; // skip empty bones
@@ -144,21 +144,21 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
                        continue; // player model bone blacklist
 
                // now choose the bone closest to impact origin
-               if(nearestbone == 0 || vlen2(hitorg - gettaginfo(self, tagnum)) <= vlen2(hitorg - gettaginfo(self, nearestbone)))
+               if(nearestbone == 0 || vlen2(hitorg - gettaginfo(this, tagnum)) <= vlen2(hitorg - gettaginfo(this, nearestbone)))
                        nearestbone = tagnum;
        }
-       gettaginfo(self, nearestbone); // set gettaginfo_name
+       gettaginfo(this, nearestbone); // set gettaginfo_name
 
        // return if we reached our damage effect limit or damages are disabled
        // TODO: When the limit is reached, it would be better if the oldest damage was removed instead of not adding a new one
        if(nearestbone)
        {
-               if(self.total_damages >= autocvar_cl_damageeffect_bones)
+               if(this.total_damages >= autocvar_cl_damageeffect_bones)
                        return; // allow multiple damages on skeletal models
        }
        else
        {
-               if(autocvar_cl_damageeffect < 2 || self.total_damages)
+               if(autocvar_cl_damageeffect < 2 || this.total_damages)
                        return; // allow a single damage on non-skeletal models
        }
 
@@ -168,7 +168,7 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 
        if(substring(effectname, strlen(effectname) - 5, 5) == "BLOOD")
        {
-               if(self.isplayermodel)
+               if(this.isplayermodel)
                {
                        specstr = species_prefix(specnum);
                        specstr = substring(specstr, 0, strlen(specstr) - 1);
@@ -179,18 +179,18 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 
        e = new(damage);
        setmodel(e, MDL_Null); // necessary to attach and read origin
-       setattachment(e, self, gettaginfo_name); // attach to the given bone
-       e.owner = self;
+       setattachment(e, this, gettaginfo_name); // attach to the given bone
+       e.owner = this;
        e.cnt = time + life;
        e.team = _particleeffectnum(effectname);
        e.think = DamageEffect_Think;
        e.nextthink = time;
-       self.total_damages += 1;
+       this.total_damages += 1;
 }
 
 NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
 {
-       make_pure(this);
+       const float ATTEN_LOW = 0.2;
        float thedamage, rad, edge, thisdmg;
        bool hitplayer = false;
        int species, forcemul;
@@ -224,11 +224,10 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                forcemul = 1;
 
     FOREACH_ENTITY_RADIUS(w_org, rad + MAX_DAMAGEEXTRARADIUS, !it.tag_entity, {
-               setself(it);
-               vector nearest = NearestPointOnBox(self, w_org);
+               vector nearest = NearestPointOnBox(it, w_org);
                if (rad)
                {
-                       thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
+                       thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
                        if(thisdmg >= 1)
                                continue;
                        if(thisdmg < 0)
@@ -236,42 +235,41 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        if(thedamage)
                        {
                                thisdmg = thedamage + (edge - thedamage) * thisdmg;
-                               thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(self.origin - w_org);
+                               thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(it.origin - w_org);
                        }
                        else
                        {
                                thisdmg = 0;
-                               thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
+                               thisforce = forcemul * vlen(force) * normalize(it.origin - w_org);
                        }
                }
                else
                {
-                       if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
+                       if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
                                continue;
 
                        thisdmg = thedamage;
                        thisforce = forcemul * force;
                }
 
-               if(self.damageforcescale)
+               if(it.damageforcescale)
                        if(vdist(thisforce, !=, 0))
                        {
-                               self.move_velocity = self.move_velocity + damage_explosion_calcpush(self.damageforcescale * thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
-                               self.move_flags &= ~FL_ONGROUND;
+                               it.move_velocity = it.move_velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.move_velocity, autocvar_g_balance_damagepush_speedfactor);
+                               it.move_flags &= ~FL_ONGROUND;
                        }
 
                if(w_issilent)
-                       self.silent = 1;
+                       it.silent = 1;
 
-               if(self.event_damage)
-                       self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
+               if(it.event_damage)
+                       it.event_damage(it, thisdmg, w_deathtype, w_org, thisforce);
 
-               DamageEffect(w_org, thisdmg, w_deathtype, species);
+               DamageEffect(it, w_org, thisdmg, w_deathtype, species);
 
-               if(self.isplayermodel)
+               if(it.isplayermodel)
                        hitplayer = true; // this impact damaged a player
        });
-       setself(this);
 
        if(DEATH_ISVEHICLE(w_deathtype))
        {
@@ -281,7 +279,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                else
                        w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
 
-               setorigin(self, w_org + w_backoff * 2); // for sound() calls
+               setorigin(this, w_org + w_backoff * 2); // for sound() calls
 
                switch(DEATH_ENT(w_deathtype))
                {
@@ -290,34 +288,34 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
 
                        // spiderbot
                        case DEATH_VH_SPID_MINIGUN:
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_SPID_ROCKET:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_SPID_DEATH:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
                                break;
 
                        case DEATH_VH_WAKI_GUN:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RACER_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RACER_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_WAKI_ROCKET:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RACER_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RACER_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_WAKI_DEATH:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
                                break;
 
                        case DEATH_VH_RAPT_CANNON:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_RAPT_FRAGMENT:
                                float i;
@@ -328,20 +326,20 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                                        ang = vectoangles(vel);
                                        RaptorCBShellfragToss(w_org, vel, ang + '0 0 1' * (120 * i));
                                }
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_RAPT_BOMB:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_RAPT_DEATH:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
                                break;
                        case DEATH_VH_BUMB_GUN:
-                               sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_BIGPLASMA_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_BIGPLASMA_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
                }
        }
@@ -355,49 +353,49 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                else
                        w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
 
-               setorigin(self, w_org + w_backoff * 2); // for sound() calls
+               setorigin(this, w_org + w_backoff * 2); // for sound() calls
 
                switch(DEATH_ENT(w_deathtype))
                {
                         case DEATH_TURRET_EWHEEL:
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_BLASTER_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_BLASTER_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_FLAC:
                                pointparticles(EFFECT_HAGAR_EXPLODE, w_org, '0 0 0', 1);
-                               sound(self, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
+                               sound(this, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
                                break;
 
                         case DEATH_TURRET_MLRS:
                         case DEATH_TURRET_HK:
                         case DEATH_TURRET_WALK_ROCKET:
                         case DEATH_TURRET_HELLION:
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_MACHINEGUN:
                         case DEATH_TURRET_WALK_GUN:
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-                               pointparticles(EFFECT_MACHINEGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+                               pointparticles(EFFECT_MACHINEGUN_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_PLASMA:
-                               sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_ELECTRO_IMPACT, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_ELECTRO_IMPACT, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_WALK_MELEE:
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_MIN);
-                               pointparticles(EFFECT_TE_SPARK, self.origin, w_backoff * 1000, 1);
+                               sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_LOW);
+                               pointparticles(EFFECT_TE_SPARK, this.origin, w_backoff * 1000, 1);
                                break;
 
                         case DEATH_TURRET_PHASER:
                                break;
 
                         case DEATH_TURRET_TESLA:
-                               te_smallflash(self.origin);
+                               te_smallflash(this.origin);
                                break;
 
                }
@@ -415,7 +413,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        w_backoff = trace_plane_normal;
                else
                        w_backoff = -1 * normalize(force);
-               setorigin(self, w_org + w_backoff * 2); // for sound() calls
+               setorigin(this, w_org + w_backoff * 2); // for sound() calls
 
                if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
                {
index aec66403575257b34cc6782e73974bb03bd0099b..bbe3ad934836e41c2ec671dedd2dee05e64335e7 100644 (file)
@@ -1,3 +1,5 @@
+#include "gibs.qh"
+
 #ifdef IMPLEMENTATION
 REGISTER_NET_TEMP(net_gibsplash)
 
@@ -111,6 +113,7 @@ void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany)
 
 void SUB_RemoveOnNoImpact()
 {
+    SELFPARAM();
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
                Gib_Delete(self);
 }
diff --git a/qcsrc/common/effects/qc/gibs.qh b/qcsrc/common/effects/qc/gibs.qh
new file mode 100644 (file)
index 0000000..40e0834
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+
+#ifdef SVQC
+void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker);
+void Violence_GibSplash(entity source, float type, float amount, entity attacker);
+#endif
index ae1ec74853fdecf3d2224ffbbf025ef2169eed44..b6ce6823dc46243d0bafab7ad394fc906704ae68 100644 (file)
        string GlobalSound_sample(string pair, float r);
 
        #ifdef SVQC
-               /** Use new sound handling. TODO: use when sounds play correctly on clients */
-               bool autocvar_g_debug_globalsounds = false;
                /**
                 * @param from the source entity, its position is sent
                 * @param gs the global sound def
                 * @param r a random number in 0..1
                 */
-               void globalsound(int channel, entity from, entity gs, float r, int chan, float vol, float atten)
+               void globalsound(int channel, entity from, entity gs, float r, int chan, float _vol, float _atten)
                {
-                       assert(IS_PLAYER(from), eprint(from));
+                       //assert(IS_PLAYER(from), eprint(from));
                        if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
                        if (!autocvar_g_debug_globalsounds) {
                                string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
                                switch (channel) {
                                        case MSG_ONE:
-                                               soundto(channel, from, chan, sample, vol, atten);
+                                               soundto(channel, from, chan, sample, _vol, _atten);
                                                break;
                                        case MSG_ALL:
-                                               _sound(from, chan, sample, vol, atten);
+                                               _sound(from, chan, sample, _vol, _atten);
                                                break;
                                }
                                return;
@@ -43,8 +41,8 @@
                        WriteByte(channel, r * 255);
                        WriteByte(channel, etof(from));
                        WriteByte(channel, chan);
-                       WriteByte(channel, floor(vol * 255));
-                       WriteByte(channel, floor(atten * 64));
+                       WriteByte(channel, floor(_vol * 255));
+                       WriteByte(channel, floor(_atten * 64));
                        entcs_force_origin(from);
                        vector o = from.origin + 0.5 * (from.mins + from.maxs);
                        WriteCoord(channel, o.x);
                * @param ps the player sound def
                * @param r a random number in 0..1
                */
-               void playersound(int channel, entity from, entity ps, float r, int chan, float vol, float atten)
+               void playersound(int channel, entity from, entity ps, float r, int chan, float _vol, float _atten)
                {
-                       assert(IS_PLAYER(from), eprint(from));
+                       //assert(IS_PLAYER(from), eprint(from));
                        if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
                        if (!autocvar_g_debug_globalsounds) {
-                               UpdatePlayerSounds(from);
+                               //UpdatePlayerSounds(from);
                                string s = from.(ps.m_playersoundfld);
                                string sample = GlobalSound_sample(s, r);
                                switch (channel) {
                                        case MSG_ONE:
-                                               soundto(channel, from, chan, sample, vol, atten);
+                                               soundto(channel, from, chan, sample, _vol, _atten);
                                                break;
                                        case MSG_ALL:
-                                               _sound(from, chan, sample, vol, atten);
+                                               _sound(from, chan, sample, _vol, _atten);
                                                break;
                                }
                                return;
@@ -80,8 +78,8 @@
                        WriteByte(channel, r * 255);
                        WriteByte(channel, etof(from));
                        WriteByte(channel, chan);
-                       WriteByte(channel, floor(vol * 255));
-                       WriteByte(channel, floor(atten * 64));
+                       WriteByte(channel, floor(_vol * 255));
+                       WriteByte(channel, floor(_atten * 64));
                        entcs_force_origin(from);
                        vector o = from.origin + 0.5 * (from.mins + from.maxs);
                        WriteCoord(channel, o.x);
                return NULL;
        }
 
-       string allvoicesamples;
-       STATIC_INIT(allvoicesamples)
-       {
-               FOREACH(PlayerSounds, it.instanceOfVoiceMessage, allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr));
-               allvoicesamples = strzone(substring(allvoicesamples, 1, -1));
-       }
-
        .string _GetPlayerSoundSampleField(string type, bool voice)
        {
                GetPlayerSoundSampleField_notFound = false;
                        this.skin_for_playersound = this.skin;
                        ClearPlayerSounds(this);
                        LoadPlayerSounds(this, "sound/player/default.sounds", true);
-                       if (this.model == "null" || autocvar_g_debug_defaultsounds) return;
+                       if (this.model == "null"
+                       #ifdef SVQC
+                           && autocvar_g_debug_globalsounds
+                       #endif
+                        ) return;
+                       if (autocvar_g_debug_defaultsounds) return;
                        if (LoadPlayerSounds(this, get_model_datafilename(this.model, this.skin, "sounds"), false)) return;
                        LoadPlayerSounds(this, get_model_datafilename(this.model, 0, "sounds"), true);
                }
index 64ef524ec3d8e71db319ba7f23cbf46d1196cd65..d4ec7f993713ee328f066174da1cc849b86f994d 100644 (file)
@@ -1,6 +1,11 @@
 #ifndef GLOBALSOUND_H
 #define GLOBALSOUND_H
 
+#ifdef SVQC
+       /** Use new sound handling. TODO: use when sounds play correctly on clients */
+       bool autocvar_g_debug_globalsounds = false;
+#endif
+
 // player sounds, voice messages
 
 .string m_playersoundstr;
@@ -113,6 +118,7 @@ void PrecachePlayerSounds(string f);
        float LoadPlayerSounds(entity this, string f, bool strict);
        void UpdatePlayerSounds(entity this);
 //#endif
+entity GetVoiceMessage(string type);
 
 #ifdef SVQC
 
@@ -136,4 +142,11 @@ void PrecachePlayerSounds(string f);
 
 #endif
 
+string allvoicesamples;
+STATIC_INIT(allvoicesamples)
+{
+    FOREACH(PlayerSounds, it.instanceOfVoiceMessage, allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr));
+    allvoicesamples = strzone(substring(allvoicesamples, 1, -1));
+}
+
 #endif
index 5c6b60e0ddef3cd8eec1b457c6a0e82f25fd5770..8a16a1dc3122c2d5d04507175328e52d5db25902 100644 (file)
@@ -1,3 +1,5 @@
+#include "lightningarc.qh"
+
 #ifdef IMPLEMENTATION
 REGISTER_NET_TEMP(TE_CSQC_ARC)
 
diff --git a/qcsrc/common/effects/qc/lightningarc.qh b/qcsrc/common/effects/qc/lightningarc.qh
new file mode 100644 (file)
index 0000000..2190975
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#ifdef SVQC
+void te_csqc_lightningarc(vector from, vector to);
+#endif
index 99272f8cc5fc1117c75ba078efb48b0909031916..84b083b952f272a3c3894fb2e6bc81d5218bafd2 100644 (file)
@@ -1,3 +1,5 @@
+#include "modeleffects.qh"
+
 #ifdef IMPLEMENTATION
 
 REGISTER_NET_LINKED(ENT_CLIENT_MODELEFFECT)
diff --git a/qcsrc/common/effects/qc/modeleffects.qh b/qcsrc/common/effects/qc/modeleffects.qh
new file mode 100644 (file)
index 0000000..afa353f
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#ifdef SVQC
+void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2);
+#endif
index 73744e6220c951086dd5c474d917c7f2255c4c73..6b36b2c53e4a283c43a2f6f5b9b8cd053cdb0d53 100644 (file)
@@ -8,7 +8,6 @@ class(Rubble).float creationtime;
 
 void RubbleLimit(string cname, float limit, void(entity) deleteproc)
 {
-       SELFPARAM();
        entity e;
        entity oldest;
        float c;
index 148d3883f031d436fb9acfff64fca5d496c75496..1310ff0343b8d98e0b82c1246d493fb4985162eb 100644 (file)
        #undef X
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
-               WITH(entity, self, this, this.think());
+               WITHSELF(this, this.think());
                return true;
        }
 
diff --git a/qcsrc/common/gamemodes/_mod.inc b/qcsrc/common/gamemodes/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
diff --git a/qcsrc/common/gamemodes/gamemode/_mod.inc b/qcsrc/common/gamemodes/gamemode/_mod.inc
new file mode 100644 (file)
index 0000000..98fb481
--- /dev/null
@@ -0,0 +1 @@
+// generated file; do not modify
diff --git a/qcsrc/common/gamemodes/gamemode/nexball/_mod.inc b/qcsrc/common/gamemodes/gamemode/nexball/_mod.inc
new file mode 100644 (file)
index 0000000..3e72142
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "nexball.qc"
+#include "weapon.qc"
index df062641a6126088cd15e84d732a9748d5448f6c..1d500c1a6d601b067e37ee5fadb0666b2ff21816 100644 (file)
@@ -498,7 +498,7 @@ void nb_spawnteams()
        }
 }
 
-void nb_delayedinit()
+void nb_delayedinit(entity this)
 {
        if(find(world, classname, "nexball_team") == world)
                nb_spawnteams();
@@ -755,7 +755,7 @@ void W_Nexball_Attack(float t)
        if(!(ball = self.ballcarried))
                return;
 
-       W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0);
+       W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
        tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
        if(trace_startsolid)
        {
@@ -791,7 +791,7 @@ void W_Nexball_Attack2()
        if(self.ballcarried.enemy)
        {
                entity _ball = self.ballcarried;
-               W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0);
+               W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
                DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
                _ball.think = W_Nexball_Think;
                _ball.nextthink = time;
@@ -801,7 +801,7 @@ void W_Nexball_Attack2()
        if(!autocvar_g_nexball_tackling)
                return;
 
-       W_SetupShot(self, false, 2, SND(NB_SHOOT2), CH_WEAPON_A, 0);
+       W_SetupShot(self, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
        entity missile = new(ballstealer);
 
        missile.owner = self;
@@ -854,6 +854,8 @@ float ball_customize()
 
 METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
 {
+    SELFPARAM();
+    TC(BallStealer, thiswep);
     if(fire & 1)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
             if(autocvar_g_nexball_basketball_meter)
@@ -883,18 +885,21 @@ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity we
     }
 }
 
-METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
+METHOD(BallStealer, wr_setup, void(BallStealer this))
 {
+    TC(BallStealer, this);
     //weapon_setup(WEP_PORTO.m_id);
 }
 
-METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer this))
 {
+    TC(BallStealer, this);
     return true;
 }
 
-METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer this))
 {
+    TC(BallStealer, this);
     return true;
 }
 
diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc b/qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc
new file mode 100644 (file)
index 0000000..d1aac78
--- /dev/null
@@ -0,0 +1,6 @@
+// generated file; do not modify
+#include "cl_controlpoint.qc"
+#include "cl_generator.qc"
+#include "onslaught.qc"
+#include "sv_controlpoint.qc"
+#include "sv_generator.qc"
index 6ded489c05d61d472561f2c49aea6e6234f44958..03e81f4bdea092deee9f965d104cf4f3d4c8f2af 100644 (file)
@@ -7,24 +7,24 @@
 
 void ons_generator_ray_draw(entity this)
 {
-       if(time < self.move_time)
+       if(time < this.move_time)
                return;
 
-       self.move_time = time + 0.05;
+       this.move_time = time + 0.05;
 
-       if(self.count > 10)
+       if(this.count > 10)
        {
-               remove(self);
+               remove(this);
                return;
        }
 
-       if(self.count > 5)
-               self.alpha -= 0.1;
+       if(this.count > 5)
+               this.alpha -= 0.1;
        else
-               self.alpha += 0.1;
+               this.alpha += 0.1;
 
-       self.scale += 0.2;
-       self.count +=1;
+       this.scale += 0.2;
+       this.count +=1;
 }
 
 void ons_generator_ray_spawn(vector org)
@@ -115,67 +115,67 @@ void generator_draw(entity this)
        this.count -= 1;
 }
 
-void generator_damage(float hp)
-{SELFPARAM();
+void generator_damage(entity this, float hp)
+{
        if(hp <= 0)
-               setmodel(self, MDL_ONS_GEN_DEAD);
-       else if(hp < self.max_health * 0.10)
-               setmodel(self, MDL_ONS_GEN9);
-       else if(hp < self.max_health * 0.20)
-               setmodel(self, MDL_ONS_GEN8);
-       else if(hp < self.max_health * 0.30)
-               setmodel(self, MDL_ONS_GEN7);
-       else if(hp < self.max_health * 0.40)
-               setmodel(self, MDL_ONS_GEN6);
-       else if(hp < self.max_health * 0.50)
-               setmodel(self, MDL_ONS_GEN5);
-       else if(hp < self.max_health * 0.60)
-               setmodel(self, MDL_ONS_GEN4);
-       else if(hp < self.max_health * 0.70)
-               setmodel(self, MDL_ONS_GEN3);
-       else if(hp < self.max_health * 0.80)
-               setmodel(self, MDL_ONS_GEN2);
-       else if(hp < self.max_health * 0.90)
-               setmodel(self, MDL_ONS_GEN1);
-       else if(hp <= self.max_health || hp >= self.max_health)
-               setmodel(self, MDL_ONS_GEN);
-
-       setsize(self, GENERATOR_MIN, GENERATOR_MAX);
+               setmodel(this, MDL_ONS_GEN_DEAD);
+       else if(hp < this.max_health * 0.10)
+               setmodel(this, MDL_ONS_GEN9);
+       else if(hp < this.max_health * 0.20)
+               setmodel(this, MDL_ONS_GEN8);
+       else if(hp < this.max_health * 0.30)
+               setmodel(this, MDL_ONS_GEN7);
+       else if(hp < this.max_health * 0.40)
+               setmodel(this, MDL_ONS_GEN6);
+       else if(hp < this.max_health * 0.50)
+               setmodel(this, MDL_ONS_GEN5);
+       else if(hp < this.max_health * 0.60)
+               setmodel(this, MDL_ONS_GEN4);
+       else if(hp < this.max_health * 0.70)
+               setmodel(this, MDL_ONS_GEN3);
+       else if(hp < this.max_health * 0.80)
+               setmodel(this, MDL_ONS_GEN2);
+       else if(hp < this.max_health * 0.90)
+               setmodel(this, MDL_ONS_GEN1);
+       else if(hp <= this.max_health || hp >= this.max_health)
+               setmodel(this, MDL_ONS_GEN);
+
+       setsize(this, GENERATOR_MIN, GENERATOR_MAX);
 }
 
-void generator_construct()
-{SELFPARAM();
-       self.netname = "Generator";
-       self.classname = "onslaught_generator";
-
-       setorigin(self, self.origin);
-       setmodel(self, MDL_ONS_GEN);
-       setsize(self, GENERATOR_MIN, GENERATOR_MAX);
-
-       self.move_movetype      = MOVETYPE_NOCLIP;
-       self.solid                      = SOLID_BBOX;
-       self.movetype           = MOVETYPE_NOCLIP;
-       self.move_origin        = self.origin;
-       self.move_time          = time;
-       self.drawmask           = MASK_NORMAL;
-       self.alpha                      = 1;
-       self.draw                       = generator_draw;
+void generator_construct(entity this)
+{
+       this.netname = "Generator";
+       this.classname = "onslaught_generator";
+
+       setorigin(this, this.origin);
+       setmodel(this, MDL_ONS_GEN);
+       setsize(this, GENERATOR_MIN, GENERATOR_MAX);
+
+       this.move_movetype      = MOVETYPE_NOCLIP;
+       this.solid                      = SOLID_BBOX;
+       this.movetype           = MOVETYPE_NOCLIP;
+       this.move_origin        = this.origin;
+       this.move_time          = time;
+       this.drawmask           = MASK_NORMAL;
+       this.alpha                      = 1;
+       this.draw                       = generator_draw;
 }
 
 .vector glowmod;
-void generator_changeteam()
-{SELFPARAM();
-       if(self.team)
+void generator_changeteam(entity this)
+{
+       if(this.team)
        {
-               self.glowmod = Team_ColorRGB(self.team - 1);
-               self.teamradar_color = Team_ColorRGB(self.team - 1);
-               self.colormap = 1024 + (self.team - 1) * 17;
+               this.glowmod = Team_ColorRGB(this.team - 1);
+               this.teamradar_color = Team_ColorRGB(this.team - 1);
+               this.colormap = 1024 + (this.team - 1) * 17;
        }
        else
        {
-               self.colormap = 1024;
-               self.glowmod = '1 1 0';
-               self.teamradar_color = '1 1 0';
+               this.colormap = 1024;
+               this.glowmod = '1 1 0';
+               this.teamradar_color = '1 1 0';
        }
 }
 
@@ -186,38 +186,38 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew)
 
        if(sf & GSF_SETUP)
        {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
-               setorigin(self, self.origin);
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
+               setorigin(this, this.origin);
 
-               self.health = ReadByte();
-               self.max_health = ReadByte();
-               self.count = ReadByte();
-               self.team = ReadByte();
+               this.health = ReadByte();
+               this.max_health = ReadByte();
+               this.count = ReadByte();
+               this.team = ReadByte();
 
-               if(!self.count)
-                       self.count = 40;
+               if(!this.count)
+                       this.count = 40;
 
-               generator_changeteam();
-               generator_construct();
+               generator_changeteam(this);
+               generator_construct(this);
        }
 
        if(sf & GSF_STATUS)
        {
                int _tmp;
                _tmp = ReadByte();
-               if(_tmp != self.team)
+               if(_tmp != this.team)
                {
-                       self.team = _tmp;
-                       generator_changeteam();
+                       this.team = _tmp;
+                       generator_changeteam(this);
                }
 
                _tmp = ReadByte();
 
-               if(_tmp != self.health)
-                       generator_damage(_tmp);
+               if(_tmp != this.health)
+                       generator_damage(this, _tmp);
 
-               self.health = _tmp;
+               this.health = _tmp;
        }
 }
index 0b030b251c8ba648fcb53d7e0fbbe4639b7dcd06..5271beba1fe51290edeb9fc4a0deba0373f7b9a2 100644 (file)
@@ -110,13 +110,13 @@ const int HAVOCBOT_ONS_ROLE_OFFENSE       = 8;
 .int havocbot_role_flags;
 .float havocbot_attack_time;
 
-void havocbot_role_ons_defense();
-void havocbot_role_ons_offense();
-void havocbot_role_ons_assistant();
+void havocbot_role_ons_defense(entity this);
+void havocbot_role_ons_offense(entity this);
+void havocbot_role_ons_assistant(entity this);
 
-void havocbot_ons_reset_role(entity bot);
-void havocbot_goalrating_items(float ratingscale, vector org, float sradius);
-void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius);
+void havocbot_ons_reset_role(entity this);
+void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius);
+void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius);
 
 // score rule declarations
 const int ST_ONS_CAPS = 1;
@@ -414,8 +414,8 @@ void ons_Link_CheckUpdate()
        self.nextthink = time;
 }
 
-void ons_DelayedLinkSetup()
-{SELFPARAM();
+void ons_DelayedLinkSetup(entity this)
+{
        self.goalentity = find(world, targetname, self.target);
        self.enemy = find(world, targetname, self.target2);
        if(!self.goalentity) { objerror("can not find target\n"); }
@@ -548,7 +548,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
                // Use targets now (somebody make sure this is in the right place..)
                setself(this.owner);
                activator = this;
-               WITH(entity, self, this, SUB_UseTargets());
+               WITHSELF(this, SUB_UseTargets());
                setself(this);
 
                this.owner.waslinked = this.owner.islinked;
@@ -855,8 +855,8 @@ void ons_ControlPoint_Reset(entity this)
        CSQCMODEL_AUTOUPDATE(this);
 }
 
-void ons_DelayedControlPoint_Setup()
-{SELFPARAM();
+void ons_DelayedControlPoint_Setup(entity this)
+{
        onslaught_updatelinks();
 
        // captureshield setup
@@ -1081,8 +1081,8 @@ void ons_GeneratorReset(entity this)
        onslaught_updatelinks();
 }
 
-void ons_DelayedGeneratorSetup()
-{SELFPARAM();
+void ons_DelayedGeneratorSetup(entity this)
+{
        // bot waypoints
        waypoint_spawnforitem_force(self, self.origin);
        self.nearestwaypointtimeout = 0; // activate waypointing again
@@ -1304,20 +1304,20 @@ void Onslaught_RoundStart()
 
 // NOTE: LEGACY CODE, needs to be re-written!
 
-void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius)
+{
        entity head;
        float t, c;
        bool needarmor = false, needweapons = false;
 
        // Needs armor/health?
-       if(self.health<100)
+       if(this.health<100)
                needarmor = true;
 
        // Needs weapons?
        c = 0;
        FOREACH(Weapons, it != WEP_Null, {
-               if(self.weapons & (it.m_wepset))
+               if(this.weapons & (it.m_wepset))
                if(++c >= 4)
                        break;
        });
@@ -1328,8 +1328,8 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
        if(!needweapons && !needarmor)
                return;
 
-       LOG_DEBUG(strcat(self.netname, " needs weapons ", ftos(needweapons) , "\n"));
-       LOG_DEBUG(strcat(self.netname, " needs armor ", ftos(needarmor) , "\n"));
+       LOG_DEBUG(strcat(this.netname, " needs weapons ", ftos(needweapons) , "\n"));
+       LOG_DEBUG(strcat(this.netname, " needs armor ", ftos(needarmor) , "\n"));
 
        // See what is around
        head = findchainfloat(bot_pickup, true);
@@ -1340,43 +1340,43 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
                if ( ((head.health || head.armorvalue) && needarmor) || (head.weapons && needweapons ) )
                if (vlen(head.origin - org) < sradius)
                {
-                       t = head.bot_pickupevalfunc(self, head);
+                       t = head.bot_pickupevalfunc(this, head);
                        if (t > 0)
-                               navigation_routerating(head, t * ratingscale, 500);
+                               navigation_routerating(this, head, t * ratingscale, 500);
                }
                head = head.chain;
        }
 }
 
-void havocbot_role_ons_setrole(entity bot, int role)
+void havocbot_role_ons_setrole(entity this, int role)
 {
-       LOG_DEBUG(strcat(bot.netname," switched to "));
+       LOG_DEBUG(strcat(this.netname," switched to "));
        switch(role)
        {
                case HAVOCBOT_ONS_ROLE_DEFENSE:
                        LOG_DEBUG("defense");
-                       bot.havocbot_role = havocbot_role_ons_defense;
-                       bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE;
-                       bot.havocbot_role_timeout = 0;
+                       this.havocbot_role = havocbot_role_ons_defense;
+                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE;
+                       this.havocbot_role_timeout = 0;
                        break;
                case HAVOCBOT_ONS_ROLE_ASSISTANT:
                        LOG_DEBUG("assistant");
-                       bot.havocbot_role = havocbot_role_ons_assistant;
-                       bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT;
-                       bot.havocbot_role_timeout = 0;
+                       this.havocbot_role = havocbot_role_ons_assistant;
+                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT;
+                       this.havocbot_role_timeout = 0;
                        break;
                case HAVOCBOT_ONS_ROLE_OFFENSE:
                        LOG_DEBUG("offense");
-                       bot.havocbot_role = havocbot_role_ons_offense;
-                       bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE;
-                       bot.havocbot_role_timeout = 0;
+                       this.havocbot_role = havocbot_role_ons_offense;
+                       this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE;
+                       this.havocbot_role_timeout = 0;
                        break;
        }
        LOG_DEBUG("\n");
 }
 
-void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale)
+{
        entity cp, cp1, cp2, best, wp;
        float radius, bestvalue;
        int c;
@@ -1392,13 +1392,13 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                        continue;
 
                // Ignore owned controlpoints
-               if(!(cp2.isgenneighbor[self.team] || cp2.iscpneighbor[self.team]))
+               if(!(cp2.isgenneighbor[this.team] || cp2.iscpneighbor[this.team]))
                        continue;
 
                // Count team mates interested in this control point
                // (easier and cleaner than keeping counters per cp and teams)
                FOREACH_CLIENT(IS_PLAYER(it), {
-                       if(SAME_TEAM(it, self))
+                       if(SAME_TEAM(it, this))
                        if(it.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE)
                        if(it.havocbot_ons_target == cp2)
                                ++c;
@@ -1421,14 +1421,14 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                {
                        bestvalue = cp1.wpcost;
                        cp = cp1;
-                       self.havocbot_ons_target = cp1;
+                       this.havocbot_ons_target = cp1;
                }
        }
 
        if (!cp)
                return;
 
-       LOG_DEBUG(strcat(self.netname, " chose cp ranked ", ftos(bestvalue), "\n"));
+       LOG_DEBUG(strcat(this.netname, " chose cp ranked ", ftos(bestvalue), "\n"));
 
        if(cp.goalentity)
        {
@@ -1457,24 +1457,24 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
 
                if(best)
                {
-                       navigation_routerating(best, ratingscale, 10000);
+                       navigation_routerating(this, best, ratingscale, 10000);
                        best.cnt += 1;
 
-                       self.havocbot_attack_time = 0;
-                       if(checkpvs(self.view_ofs,cp))
-                       if(checkpvs(self.view_ofs,best))
-                               self.havocbot_attack_time = time + 2;
+                       this.havocbot_attack_time = 0;
+                       if(checkpvs(this.view_ofs,cp))
+                       if(checkpvs(this.view_ofs,best))
+                               this.havocbot_attack_time = time + 2;
                }
                else
                {
-                       navigation_routerating(cp, ratingscale, 10000);
+                       navigation_routerating(this, cp, ratingscale, 10000);
                }
-               LOG_DEBUG(strcat(self.netname, " found an attackable controlpoint at ", vtos(cp.origin) ,"\n"));
+               LOG_DEBUG(strcat(this.netname, " found an attackable controlpoint at ", vtos(cp.origin) ,"\n"));
        }
        else
        {
                // Should be touched
-               LOG_DEBUG(strcat(self.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n"));
+               LOG_DEBUG(strcat(this.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n"));
                found = false;
 
                // Look for auto generated waypoint
@@ -1483,26 +1483,26 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                {
                        if(wp.classname=="waypoint")
                        {
-                               navigation_routerating(wp, ratingscale, 10000);
+                               navigation_routerating(this, wp, ratingscale, 10000);
                                found = true;
                        }
                }
 
                // Nothing found, rate the controlpoint itself
                if (!found)
-                       navigation_routerating(cp, ratingscale, 10000);
+                       navigation_routerating(this, cp, ratingscale, 10000);
        }
 }
 
-bool havocbot_goalrating_ons_generator_attack(float ratingscale)
-{SELFPARAM();
+bool havocbot_goalrating_ons_generator_attack(entity this, float ratingscale)
+{
        entity g, wp, bestwp;
        bool found;
        int best;
 
        for(g = ons_worldgeneratorlist; g; g = g.ons_worldgeneratornext)
        {
-               if(SAME_TEAM(g, self) || g.isshielded)
+               if(SAME_TEAM(g, this) || g.isshielded)
                        continue;
 
                // Should be attacked
@@ -1528,13 +1528,13 @@ bool havocbot_goalrating_ons_generator_attack(float ratingscale)
                if(bestwp)
                {
                        LOG_DEBUG("waypoints found around generator\n");
-                       navigation_routerating(bestwp, ratingscale, 10000);
+                       navigation_routerating(this, bestwp, ratingscale, 10000);
                        bestwp.cnt += 1;
 
-                       self.havocbot_attack_time = 0;
-                       if(checkpvs(self.view_ofs,g))
-                       if(checkpvs(self.view_ofs,bestwp))
-                               self.havocbot_attack_time = time + 5;
+                       this.havocbot_attack_time = 0;
+                       if(checkpvs(this.view_ofs,g))
+                       if(checkpvs(this.view_ofs,bestwp))
+                               this.havocbot_attack_time = time + 5;
 
                        return true;
                }
@@ -1542,69 +1542,69 @@ bool havocbot_goalrating_ons_generator_attack(float ratingscale)
                {
                        LOG_DEBUG("generator found without waypoints around\n");
                        // if there aren't waypoints near the generator go straight to it
-                       navigation_routerating(g, ratingscale, 10000);
-                       self.havocbot_attack_time = 0;
+                       navigation_routerating(this, g, ratingscale, 10000);
+                       this.havocbot_attack_time = 0;
                        return true;
                }
        }
        return false;
 }
 
-void havocbot_role_ons_offense()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_ons_offense(entity this)
+{
+       if(IS_DEAD(this))
        {
-               self.havocbot_attack_time = 0;
-               havocbot_ons_reset_role(self);
+               this.havocbot_attack_time = 0;
+               havocbot_ons_reset_role(this);
                return;
        }
 
        // Set the role timeout if necessary
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 120;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 120;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ons_reset_role(self);
+               havocbot_ons_reset_role(this);
                return;
        }
 
-       if(self.havocbot_attack_time>time)
+       if(this.havocbot_attack_time>time)
                return;
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               navigation_goalrating_start();
-               havocbot_goalrating_enemyplayers(20000, self.origin, 650);
-               if(!havocbot_goalrating_ons_generator_attack(20000))
-                       havocbot_goalrating_ons_controlpoints_attack(20000);
-               havocbot_goalrating_ons_offenseitems(10000, self.origin, 10000);
-               navigation_goalrating_end();
+               navigation_goalrating_start(this);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 650);
+               if(!havocbot_goalrating_ons_generator_attack(this, 20000))
+                       havocbot_goalrating_ons_controlpoints_attack(this, 20000);
+               havocbot_goalrating_ons_offenseitems(this, 10000, this.origin, 10000);
+               navigation_goalrating_end(this);
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
        }
 }
 
-void havocbot_role_ons_assistant()
-{SELFPARAM();
-       havocbot_ons_reset_role(self);
+void havocbot_role_ons_assistant(entity this)
+{
+       havocbot_ons_reset_role(this);
 }
 
-void havocbot_role_ons_defense()
-{SELFPARAM();
-       havocbot_ons_reset_role(self);
+void havocbot_role_ons_defense(entity this)
+{
+       havocbot_ons_reset_role(this);
 }
 
-void havocbot_ons_reset_role(entity bot)
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_ons_reset_role(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       bot.havocbot_ons_target = world;
+       this.havocbot_ons_target = world;
 
        // TODO: Defend control points or generator if necessary
 
-       havocbot_role_ons_setrole(bot, HAVOCBOT_ONS_ROLE_OFFENSE);
+       havocbot_role_ons_setrole(this, HAVOCBOT_ONS_ROLE_OFFENSE);
 }
 
 
@@ -1775,7 +1775,7 @@ MUTATOR_HOOKFUNCTION(ons, reset_map_global)
        FOREACH_CLIENT(IS_PLAYER(it), {
                it.ons_roundlost = false;
                it.ons_deathloc = '0 0 0';
-               WITH(entity, self, it, PutClientInServer());
+               WITHSELF(it, PutClientInServer());
        });
        return false;
 }
@@ -1923,7 +1923,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(ons, PlayerDies)
-{SELFPARAM();
+{
        frag_target.ons_deathloc = frag_target.origin;
        entity l;
        for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
@@ -1951,8 +1951,8 @@ MUTATOR_HOOKFUNCTION(ons, MonsterMove)
        return false;
 }
 
-void ons_MonsterSpawn_Delayed()
-{SELFPARAM();
+void ons_MonsterSpawn_Delayed(entity this)
+{
        entity e, own = self.owner;
 
        if(!own) { remove(self); return; }
@@ -1981,8 +1981,8 @@ MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
        return false;
 }
 
-void ons_TurretSpawn_Delayed()
-{SELFPARAM();
+void ons_TurretSpawn_Delayed(entity this)
+{
        entity e, own = self.owner;
 
        if(!own) { remove(self); return; }
@@ -2130,6 +2130,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
 
 MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
 {
+    SELFPARAM();
        if(wp_sendflags & 16)
        {
                if(self.owner.classname == "onslaught_controlpoint")
@@ -2163,6 +2164,7 @@ MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
 
 MUTATOR_HOOKFUNCTION(ons, TurretThink)
 {
+    SELFPARAM();
        // ONS uses somewhat backwards linking.
        if(self.target)
        {
@@ -2251,7 +2253,7 @@ void ons_ScoreRules()
        ScoreRules_basics_end();
 }
 
-void ons_DelayedInit() // Do this check with a delay so we can wait for teams to be set up
+void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
 {
        ons_ScoreRules();
 
diff --git a/qcsrc/common/impulses/_mod.inc b/qcsrc/common/impulses/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
diff --git a/qcsrc/common/items/_mod.inc b/qcsrc/common/items/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
diff --git a/qcsrc/common/items/all.inc b/qcsrc/common/items/all.inc
deleted file mode 100644 (file)
index 48b92be..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/** If you register a new item, make sure to add it to this list */
-#include "item/ammo.qc"
-#include "item/armor.qc"
-#include "item/health.qc"
-#include "item/jetpack.qc"
-#include "item/pickup.qc"
-#include "item/powerup.qc"
index 62dc0fe270be2d48efaf5ab54b3547aa41ed9665..9d7cfa8d32e428aed292e73b8a4d501cbfada5f9 100644 (file)
@@ -2,7 +2,7 @@
 #define ITEMS_ALL_C
 #include "all.qh"
 
-#include "all.inc"
+#include "item/_mod.inc"
 
 void Dump_Items()
 {
index eea1de9a4a7e3b1ce75694eafdbdcb9bd274b1ba..18cc5ae4f3b707dfd11caea3774cc2473d2587f2 100644 (file)
@@ -1,14 +1,13 @@
 #ifndef ITEMS_ALL_H
 #define ITEMS_ALL_H
 
-#include "../command/all.qh"
+#include <common/command/all.qh>
 
 #include "item.qh"
 
 REGISTRY(Items, BITS(5))
 #define Items_from(i) _Items_from(i, NULL)
 REGISTER_REGISTRY(Items)
-/** If you register a new item, make sure to add it to all.inc */
 #define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
 
 REGISTRY_SORT(Items)
index 7780a0054551c59d50150da9d0e6a5c8c90122be..934271059ba55ed6cc464e9c7122cdd970bc65eb 100644 (file)
@@ -4,11 +4,14 @@
 #include "all.qh"
 #include "item/pickup.qh"
 
-entityclass(Inventory);
-/** Stores counts of items, the id being the index */
-class(Inventory) .int inv_items[Items_MAX];
+CLASS(Inventory, Object)
+    /** Stores counts of items, the id being the index */
+    ATTRIBARRAY(Inventory, inv_items, int, Items_MAX)
+    /** Previous state */
+    ATTRIB(Inventory, inventory, Inventory, NULL)
+ENDCLASS(Inventory)
 
-/** Player inventory; Inventories also have one inventory for storing the previous state */
+/** Player inventory */
 .Inventory inventory;
 
 REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
@@ -31,6 +34,11 @@ NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew)
 #ifdef SVQC
 void Inventory_Write(Inventory data)
 {
+    if (!data) {
+        WriteInt24_t(MSG_ENTITY, 0);
+        return;
+    }
+    TC(Inventory, data);
     int bits = 0;
     FOREACH(Items, true, {
         .int fld = inv_items[it.m_id];
@@ -44,11 +52,13 @@ void Inventory_Write(Inventory data)
 #endif
 
 #ifdef SVQC
-bool Inventory_Send(entity this, entity to, int sf)
+bool Inventory_Send(Inventory this, Client to, int sf)
 {
+    TC(Inventory, this);
     WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY);
-    entity e = self.owner;
+    entity e = this.owner;
     if (IS_SPEC(e)) e = e.enemy;
+    TC(Player, e);
     Inventory data = e.inventory;
     Inventory_Write(data);
     return true;
@@ -56,7 +66,7 @@ bool Inventory_Send(entity this, entity to, int sf)
 
 void Inventory_new(entity e)
 {
-    Inventory inv = new_pure(Inventory), bak = new_pure(Inventory);
+    Inventory inv = NEW(Inventory), bak = NEW(Inventory);
     inv.inventory = bak;
     inv.drawonlytoclient = e;
     Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
index ba21efd96610624235ab8fadaee2fb31994f2c45..4ab7af4f2317341ebeb4d1f625dfb8659cecb3d8 100644 (file)
@@ -39,7 +39,6 @@ const int IT_UNLIMITED_AMMO                   = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITE
 const int IT_PICKUPMASK                        = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
 
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
-/** If you register a new item, make sure to add it to all.inc */
 CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0)
     ATTRIB(GameItem, m_name, string, string_null)
@@ -47,10 +46,16 @@ CLASS(GameItem, Object)
     ATTRIB(GameItem, m_color, vector, '1 1 1')
     ATTRIB(GameItem, m_waypoint, string, string_null)
     ATTRIB(GameItem, m_waypointblink, int, 1)
-    METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns)) {
+    METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns))
+    {
+        TC(GameItem, this);
         returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
     }
-    METHOD(GameItem, show, void(GameItem this)) { LOG_INFO("A game item\n"); }
+    METHOD(GameItem, show, void(GameItem this))
+    {
+        TC(GameItem, this);
+        LOG_INFO("A game item\n");
+    }
     void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
 ENDCLASS(GameItem)
 
diff --git a/qcsrc/common/items/item/_mod.inc b/qcsrc/common/items/item/_mod.inc
new file mode 100644 (file)
index 0000000..453cead
--- /dev/null
@@ -0,0 +1,7 @@
+// generated file; do not modify
+#include "ammo.qc"
+#include "armor.qc"
+#include "health.qc"
+#include "jetpack.qc"
+#include "pickup.qc"
+#include "powerup.qc"
index dbc74a0625621bee288da55c946ebbfaf6ab4704..08f7ff9c3d6b23c5c67cbfc6ee7595e9bd906625 100644 (file)
@@ -1,14 +1,18 @@
 #ifndef PICKUP_H
 #define PICKUP_H
-#include "../inventory.qh"
-#include "../item.qh"
+#include <common/items/inventory.qh>
+#include <common/items/item.qh>
 CLASS(Pickup, GameItem)
 #ifndef MENUQC
     ATTRIB(Pickup, m_model, Model, NULL)
     ATTRIB(Pickup, m_sound, Sound, SND_ITEMPICKUP)
 #endif
     ATTRIB(Pickup, m_name, string, string_null)
-    METHOD(Pickup, show, void(Pickup this)) { LOG_INFOF("%s: %s\n", etos(this), this.m_name); }
+    METHOD(Pickup, show, void(Pickup this))
+    {
+        TC(Pickup, this);
+        LOG_INFOF("%s: %s\n", etos(this), this.m_name);
+    }
 #ifdef SVQC
     ATTRIB(Pickup, m_mins, vector, '-16 -16 0')
     ATTRIB(Pickup, m_maxs, vector, '16 16 32')
@@ -22,6 +26,7 @@ CLASS(Pickup, GameItem)
     float Item_GiveTo(entity item, entity player);
     METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player))
     {
+        TC(Pickup, this);
         bool b = Item_GiveTo(item, player);
         if (b) {
             LOG_TRACEF("entity %i picked up %s\n", player, this.m_name);
index ab7233ef269cd60db277aa23c81588a9260b83df..b7115ef552522fd2786a3749166430e9a7ae8ea8 100644 (file)
@@ -28,9 +28,15 @@ CLASS(Gametype, Object)
     ATTRIB(Gametype, m_mutators, string, string_null)
     ATTRIB(Gametype, m_parse_mapinfo, bool(string k, string v), func_null)
 
-    METHOD(Gametype, describe, string(entity this)) { return this.gametype_description; }
+    METHOD(Gametype, describe, string(Gametype this))
+    {
+        TC(Gametype, this);
+        return this.gametype_description;
+    }
 
-    METHOD(Gametype, display, void(entity this, void(string name, string icon) returns)) {
+    METHOD(Gametype, display, void(Gametype this, void(string name, string icon) returns))
+    {
+        TC(Gametype, this);
         returns(this.message, strcat("gametype_", this.mdl));
     }
 
diff --git a/qcsrc/common/minigames/_mod.inc b/qcsrc/common/minigames/_mod.inc
new file mode 100644 (file)
index 0000000..47690d3
--- /dev/null
@@ -0,0 +1,5 @@
+// generated file; do not modify
+#include "cl_minigames.qc"
+#include "cl_minigames_hud.qc"
+#include "minigames.qc"
+#include "sv_minigames.qc"
index 596d9204c96c30aad48b72101421584aed9464a9..e3c7df18f34f778c58f1ba6d911d4711a6367d7e 100644 (file)
@@ -120,7 +120,7 @@ REGISTRY_CHECK(Minigames)
     void name##_hud_board(vector, vector); \
     void name##_hud_status(vector, vector); \
     int name##_client_event(entity, string, ...); \
-    REGISTER_INIT_POST(MINIGAME_##name) { \
+    REGISTER_INIT(MINIGAME_##name) { \
         this.netname = strzone(strtolower(#name)); \
         this.message = nicename; \
         this.minigame_hud_board = name##_hud_board; \
index 50fd2bab58660bb0139d594523c6df20631ad87d..ca2a0ed17c9234e306d03b4cabce5910cf9d79f8 100644 (file)
@@ -1,6 +1,14 @@
 #include "cl_minigames_hud.qh"
+
+#include <common/ent_cs.qh>
+
 #include "minigames.qh"
 
+.vector colormod;
+
+#include <client/hud/hud_config.qh>
+#include <client/mapvoting.qh>
+
 // whether the mouse is over the given panel
 bool HUD_mouse_over(entity somepanel)
 {
@@ -107,7 +115,7 @@ void HUD_MinigameMenu_Click(entity menuitem)
 {SELFPARAM();
        if ( menuitem )
        {
-               WITH(entity, self, menuitem, menuitem.use());
+               WITHSELF(menuitem, menuitem.use());
        }
 }
 
diff --git a/qcsrc/common/minigames/minigame/_mod.inc b/qcsrc/common/minigames/minigame/_mod.inc
new file mode 100644 (file)
index 0000000..f53fc0b
--- /dev/null
@@ -0,0 +1,9 @@
+// generated file; do not modify
+#include "bd.qc"
+#include "c4.qc"
+#include "nmm.qc"
+#include "pong.qc"
+#include "pp.qc"
+#include "ps.qc"
+#include "snake.qc"
+#include "ttt.qc"
index 5567b25681d4522cd38d3b9859ef70fdb80cd0ad..74df391de2cc7091c518ebe7c39a9551c1f711af 100644 (file)
@@ -1,9 +1,9 @@
 #pragma once
 
 #if defined(SVQC)
-#include "../sv_minigames.qh"
+#include <common/minigames/sv_minigames.qh>
 #elif defined(CSQC)
-#include "../cl_minigames.qh"
+#include <common/minigames/cl_minigames.qh>
 #endif
 
 /**
index 33868ad5702cbd9fa5633784e4fd01361a5f1a4d..d367472d8214f1a4296e4bbf3dcce47802c06e00 100644 (file)
@@ -155,6 +155,7 @@ void snake_check_winner(entity minigame)
 void snake_move_head(entity minigame, entity head);
 void snake_head_think()
 {
+    SELFPARAM();
        entity minigame = self.owner;
 
        if(minigame.minigame_flags & SNAKE_TURN_MOVE)
index 7c19c43dd6f4f2d037ac56dc7c0aa9ee54d601bb..991544189291e227cf6e6876d6cb7c15bfb9fff3 100644 (file)
@@ -146,7 +146,7 @@ int minigame_addplayer(entity minigame_session, entity player)
 
                if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
                {
-                       WITH(entity, self, player, PutObserverInServer());
+                       WITHSELF(player, PutObserverInServer());
                }
                if ( autocvar_sv_minigames_observer == 2 )
                        player.team_forced = -1;
index ecef028560062a64b672032eb12087c53c76c609..1e00fd1b3be536a4360454b967532724857db03d 100644 (file)
@@ -53,7 +53,7 @@ REGISTRY_CHECK(Minigames)
 #define REGISTER_MINIGAME(name,nicename) \
     REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \
     int name##_server_event(entity, string, ...); \
-    REGISTER_INIT_POST(MINIGAME_##name) { \
+    REGISTER_INIT(MINIGAME_##name) { \
         this.netname = strzone(strtolower(#name)); \
         this.message = nicename; \
                this.minigame_event = name##_server_event; \
diff --git a/qcsrc/common/models/_mod.inc b/qcsrc/common/models/_mod.inc
new file mode 100644 (file)
index 0000000..98fb481
--- /dev/null
@@ -0,0 +1 @@
+// generated file; do not modify
index b4005b77775f421a5dec31469f2797dbfbf5c64f..1c34a2547ee07117b1f52d5707bbebd3b1c80eae 100644 (file)
@@ -11,13 +11,15 @@ CLASS(Model, Object)
         CONSTRUCT(Model);
         this.model_str = path;
     }
-    METHOD(Model, model_precache, void(entity this)) {
+    METHOD(Model, model_precache, void(Model this))
+    {
+        TC(Model, this);
         string s = this.model_str();
         if (s != "" && s != "null" && !fexists(s)) {
             LOG_WARNINGF("Missing model: \"%s\"\n", s);
             return;
         }
-        LOG_TRACEF("precache_model(\"%s\")\n", s);
+        LOG_DEBUGF("precache_model(\"%s\")\n", s);
         precache_model(s);
     }
 ENDCLASS(Model)
diff --git a/qcsrc/common/monsters/_mod.inc b/qcsrc/common/monsters/_mod.inc
new file mode 100644 (file)
index 0000000..8dff76f
--- /dev/null
@@ -0,0 +1,4 @@
+// generated file; do not modify
+#include "all.qc"
+#include "spawn.qc"
+#include "sv_monsters.qc"
diff --git a/qcsrc/common/monsters/all.inc b/qcsrc/common/monsters/all.inc
deleted file mode 100644 (file)
index f44cabc..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef MENUQC
-#include "../animdecide.qh"
-vector animfixfps(entity e, vector a, vector b);
-#endif
-
-#include "monster/mage.qc"
-#include "monster/shambler.qc"
-#include "monster/spider.qc"
-#include "monster/wyvern.qc"
-#include "monster/zombie.qc"
index 2b15e4085734183ebe31053e327314d6bfc5f8e1..ce0a9023d494e2cf14367532c5305f9ec4d7af37 100644 (file)
@@ -15,7 +15,7 @@ string M_Model(string m_mdl)
 #include "all.qh"
 
 #define IMPLEMENTATION
-#include "all.inc"
+#include "monster/_mod.inc"
 #undef IMPLEMENTATION
 
 #ifdef SVQC
index b771984f212b1b4ef3a680099e19e7059600662e..1e23f3287940218b3c8a882033d3f12b42c88fd2 100644 (file)
@@ -12,12 +12,11 @@ REGISTER_REGISTRY(Monsters)
 REGISTRY_CHECK(Monsters)
 const int MON_FIRST = 1;
 #define MON_LAST (Monsters_COUNT - 1)
-/** If you register a new monster, make sure to add it to all.inc */
 #define REGISTER_MONSTER(id, inst) REGISTER(Monsters, MON, id, monsterid, inst)
 
 REGISTER_MONSTER(Null, NEW(Monster));
 
 
-#include "all.inc"
+#include "monster/_mod.inc"
 
 #endif
index 22e2072c08c630a6087591acd456b83c5930fce5..9ba1cde12941ac1777aa98c4a2f5868f8aa3a825 100644 (file)
 #include <lib/warpzone/server.qh>
 #endif
 
+#ifndef MENUQC
+#include "../animdecide.qh"
+#include "../anim.qh"
+vector animfixfps(entity e, vector a, vector b);
+#endif
+
 // special spawn flags
 const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
 const int MONSTER_TYPE_FLY = 32;
@@ -39,7 +45,6 @@ const int MONSTER_SIZE_QUAKE = 8192;
 .vector anim_walk;
 .vector anim_spawn;
 
-/** If you register a new monster, make sure to add it to all.inc */
 CLASS(Monster, Object)
     ATTRIB(Monster, monsterid, int, 0)
     /** attributes */
@@ -56,17 +61,17 @@ CLASS(Monster, Object)
     ATTRIB(Monster, maxs, vector, '0 0 0')
 
     /** (SERVER) setup monster data */
-    METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { return false; }
+    METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (SERVER) logic to run every frame */
-    METHOD(Monster, mr_think, bool(Monster this, entity actor)) { return false; }
+    METHOD(Monster, mr_think, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (SERVER) called when monster dies */
-    METHOD(Monster, mr_death, bool(Monster this, entity actor)) { return false; }
+    METHOD(Monster, mr_death, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (BOTH) precaches models/sounds used by this monster */
-    METHOD(Monster, mr_precache, bool(Monster this)) { return false; }
+    METHOD(Monster, mr_precache, bool(Monster this)) { TC(Monster, this); return false; }
     /** (SERVER) called when monster is damaged */
-    METHOD(Monster, mr_pain, bool(Monster this, entity actor)) { return false; }
+    METHOD(Monster, mr_pain, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (BOTH?) sets animations for monster */
-    METHOD(Monster, mr_anim, bool(Monster this, entity actor)) { return false; }
+    METHOD(Monster, mr_anim, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
 
 ENDCLASS(Monster)
 
diff --git a/qcsrc/common/monsters/monster/_mod.inc b/qcsrc/common/monsters/monster/_mod.inc
new file mode 100644 (file)
index 0000000..6b8a307
--- /dev/null
@@ -0,0 +1,6 @@
+// generated file; do not modify
+#include "mage.qc"
+#include "shambler.qc"
+#include "spider.qc"
+#include "wyvern.qc"
+#include "zombie.qc"
index c71e8c911ccfa1dde53e7aa85c926437fba453b8..66ea47f251abd8681c3bbe716cfd77a207a49e98 100644 (file)
@@ -42,12 +42,14 @@ REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike));
 SOUND(MageSpike_FIRE, W_Sound("electro_fire"));
 void M_Mage_Attack_Spike(entity this, vector dir);
 void M_Mage_Attack_Push(entity this);
-METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weaponentity, int fire))
+{
+    TC(MageSpike, thiswep);
     if (fire & 1)
     if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
         if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range;
         actor.enemy = Monster_FindTarget(actor);
-        W_SetupShot_Dir(actor, v_forward, false, 0, SND(MageSpike_FIRE), CH_WEAPON_B, 0);
+        W_SetupShot_Dir(actor, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0);
        if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
         M_Mage_Attack_Spike(actor, w_shotdir);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
@@ -65,6 +67,7 @@ CLASS(OffhandMageTeleport, OffhandWeapon)
     .bool OffhandMageTeleport_key_pressed;
     METHOD(OffhandMageTeleport, offhand_think, void(OffhandMageTeleport this, entity player, bool key_pressed))
     {
+        TC(OffhandMageTeleport, this);
         if (key_pressed && !player.OffhandMageTeleport_key_pressed)
                M_Mage_Attack_Teleport(player, player.enemy);
         player.OffhandMageTeleport_key_pressed = key_pressed;
@@ -159,6 +162,7 @@ void M_Mage_Attack_Spike_Explode(entity this)
 
 void M_Mage_Attack_Spike_Touch()
 {
+    SELFPARAM();
        PROJECTILE_TOUCH;
 
        M_Mage_Attack_Spike_Explode(self);
@@ -326,7 +330,7 @@ void M_Mage_Attack_Teleport(entity this, entity targ)
 
        Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
        Send_Effect(EFFECT_SPAWN_NEUTRAL, newpos, '0 0 0', 1);
-       
+
        setorigin(this, newpos);
 
        vector a = vectoangles(targ.origin - this.origin);
@@ -411,6 +415,7 @@ spawnfunc(monster_mage) { Monster_Spawn(this, MON_MAGE.monsterid); }
 #ifdef SVQC
 METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
 {
+    TC(Mage, thismon);
     bool need_help = false;
 
     FOREACH_ENTITY_FLOAT(iscreature, true,
@@ -441,21 +446,24 @@ METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
     return true;
 }
 
-METHOD(Mage, mr_pain, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_pain, bool(Mage this, entity actor))
 {
+    TC(Mage, this);
     return true;
 }
 
-METHOD(Mage, mr_death, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_death, bool(Mage this, entity actor))
 {
+    TC(Mage, this);
     setanim(actor, actor.anim_die1, false, true, true);
     return true;
 }
 
 #endif
 #ifndef MENUQC
-METHOD(Mage, mr_anim, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_anim, bool(Mage this, entity actor))
 {
+    TC(Mage, this);
     vector none = '0 0 0';
     actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
     actor.anim_walk = animfixfps(actor, '1 1 1', none);
@@ -469,8 +477,9 @@ METHOD(Mage, mr_anim, bool(Mage thismon, entity actor))
 #ifdef SVQC
 .float speed;
 spawnfunc(item_health_large);
-METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_setup, bool(Mage this, entity actor))
 {
+    TC(Mage, this);
     if(!actor.health) actor.health = (autocvar_g_monster_mage_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
@@ -483,8 +492,9 @@ METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
     return true;
 }
 
-METHOD(Mage, mr_precache, bool(Mage thismon))
+METHOD(Mage, mr_precache, bool(Mage this))
 {
+    TC(Mage, this);
     return true;
 }
 #endif
index b091712791b9c5001aeed10841458cbd92872fe1..3cfa18cdf4bc166e3f296cc11274a260acf3e050 100644 (file)
@@ -116,7 +116,7 @@ void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity at
        this.health = this.health - damage;
 
        if (this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
 }
 
 void M_Shambler_Attack_Lightning_Touch()
@@ -225,27 +225,31 @@ spawnfunc(monster_shambler) { Monster_Spawn(this, MON_SHAMBLER.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
-METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_think, bool(Shambler this, entity actor))
 {
+    TC(Shambler, this);
     return true;
 }
 
-METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_pain, bool(Shambler this, entity actor))
 {
+    TC(Shambler, this);
     actor.pain_finished = time + 0.5;
     setanim(actor, actor.anim_pain1, true, true, false);
     return true;
 }
 
-METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_death, bool(Shambler this, entity actor))
 {
+    TC(Shambler, this);
     setanim(actor, actor.anim_die1, false, true, true);
     return true;
 }
 #endif
 #ifndef MENUQC
-METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_anim, bool(Shambler this, entity actor))
 {
+    TC(Shambler, this);
     vector none = '0 0 0';
     actor.anim_die1 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
     actor.anim_walk = animfixfps(actor, '1 1 1', none);
@@ -262,8 +266,9 @@ METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
 #ifdef SVQC
 spawnfunc(item_health_mega);
 .float animstate_endtime;
-METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_setup, bool(Shambler this, entity actor))
 {
+    TC(Shambler, this);
     if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
     if(!actor.attack_range) actor.attack_range = 150;
     if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
@@ -282,8 +287,9 @@ METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
     return true;
 }
 
-METHOD(Shambler, mr_precache, bool(Shambler thismon))
+METHOD(Shambler, mr_precache, bool(Shambler this))
 {
+    TC(Shambler, this);
     return true;
 }
 #endif
index 512422d33b9c8227420106035d5b9e41991c3c9e..9b0541c14edb581a2f342337a8511b249c56c961 100644 (file)
@@ -56,17 +56,19 @@ REGISTER_MUTATOR(spiderweb, true);
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
 {
-       if (time >= self.spider_slowness)
+    SELFPARAM();
+       if (time >= this.spider_slowness)
                return false;
-       PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
-       PHYS_MAXAIRSPEED(self) *= 0.5;
-       PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
-       PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
+       PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
+       PHYS_MAXAIRSPEED(this) *= 0.5;
+       PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
+       PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 {
+    SELFPARAM();
        if(time < self.spider_slowness)
        {
                monster_speed_run *= 0.5;
@@ -77,18 +79,23 @@ MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
 {
+    SELFPARAM();
        self.spider_slowness = 0;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
 {
+    SELFPARAM();
        self.spider_slowness = 0;
        return false;
 }
 
 SOUND(SpiderAttack_FIRE, W_Sound("electro_fire"));
-METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire))
+{
+    SELFPARAM();
+    TC(SpiderAttack, thiswep);
     bool isPlayer = IS_PLAYER(actor);
     if (fire & 1)
     if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay)) {
@@ -99,7 +106,7 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity
                        actor.anim_finished = time + 1;
                }
         if (isPlayer) actor.enemy = Monster_FindTarget(actor);
-        W_SetupShot_Dir(actor, v_forward, false, 0, SND(SpiderAttack_FIRE), CH_WEAPON_B, 0);
+        W_SetupShot_Dir(actor, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0);
        if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
                M_Spider_Attack_Web(actor);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
@@ -215,26 +222,30 @@ spawnfunc(monster_spider) { Monster_Spawn(this, MON_SPIDER.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
-METHOD(Spider, mr_think, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_think, bool(Spider this, entity actor))
 {
+    TC(Spider, this);
     return true;
 }
 
-METHOD(Spider, mr_pain, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_pain, bool(Spider this, entity actor))
 {
+    TC(Spider, this);
     return true;
 }
 
-METHOD(Spider, mr_death, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_death, bool(Spider this, entity actor))
 {
+    TC(Spider, this);
     setanim(actor, actor.anim_melee, false, true, true);
     actor.angles_x = 180;
     return true;
 }
 #endif
 #ifndef MENUQC
-METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_anim, bool(Spider this, entity actor))
 {
+    TC(Spider, this);
     vector none = '0 0 0';
     actor.anim_walk = animfixfps(actor, '1 1 1', none);
     actor.anim_idle = animfixfps(actor, '0 1 1', none);
@@ -246,8 +257,9 @@ METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
 #endif
 #ifdef SVQC
 spawnfunc(item_health_medium);
-METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_setup, bool(Spider this, entity actor))
 {
+    TC(Spider, this);
     if(!actor.health) actor.health = (autocvar_g_monster_spider_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
@@ -260,8 +272,9 @@ METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
     return true;
 }
 
-METHOD(Spider, mr_precache, bool(Spider thismon))
+METHOD(Spider, mr_precache, bool(Spider this))
 {
+    TC(Spider, this);
     return true;
 }
 #endif
index fc13de40ffc314aa268794e00068ff9281c622fc..1adf8f84c85af71053b4d98cbf2e39ceaf7170c1 100644 (file)
@@ -49,10 +49,12 @@ void M_Wyvern_Attack_Fireball_Explode();
 void M_Wyvern_Attack_Fireball_Touch();
 
 SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
-METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
+{
+    TC(WyvernAttack, thiswep);
     if (fire & 1)
     if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
-        if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND(WyvernAttack_FIRE), CH_WEAPON_B, 0);
+        if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND_WyvernAttack_FIRE, CH_WEAPON_B, 0);
                if (IS_MONSTER(actor)) {
                        actor.attack_finished_single[0] = time + 1.2;
                        actor.anim_finished = time + 1.2;
@@ -78,7 +80,8 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
     }
 }
 
-METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack thiswep)) {
+METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this)) {
+    TC(WyvernAttack, this);
        return true;
 }
 
@@ -143,20 +146,23 @@ spawnfunc(monster_wyvern) { Monster_Spawn(this, MON_WYVERN.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
-METHOD(Wyvern, mr_think, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_think, bool(Wyvern this, entity actor))
 {
+    TC(Wyvern, this);
     return true;
 }
 
-METHOD(Wyvern, mr_pain, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_pain, bool(Wyvern this, entity actor))
 {
+    TC(Wyvern, this);
     actor.pain_finished = time + 0.5;
     setanim(actor, actor.anim_pain1, true, true, false);
     return true;
 }
 
-METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_death, bool(Wyvern this, entity actor))
 {
+    TC(Wyvern, this);
     setanim(actor, actor.anim_die1, false, true, true);
     actor.velocity_x = -200 + 400 * random();
     actor.velocity_y = -200 + 400 * random();
@@ -165,8 +171,9 @@ METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
 }
 #endif
 #ifndef MENUQC
-METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_anim, bool(Wyvern this, entity actor))
 {
+    TC(Wyvern, this);
     vector none = '0 0 0';
     actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
     actor.anim_walk = animfixfps(actor, '1 1 1', none);
@@ -179,8 +186,9 @@ METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
 #endif
 #ifdef SVQC
 spawnfunc(item_cells);
-METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_setup, bool(Wyvern this, entity actor))
 {
+    TC(Wyvern, this);
     if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
@@ -193,8 +201,9 @@ METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
     return true;
 }
 
-METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
+METHOD(Wyvern, mr_precache, bool(Wyvern this))
 {
+    TC(Wyvern, this);
     return true;
 }
 #endif
index 9163aaf071e5f9dea4f2d6f920abf43584d2a51e..b28bb8d84eaefa6fbb194bd293b35e48cc992702 100644 (file)
@@ -155,22 +155,25 @@ spawnfunc(monster_zombie) { Monster_Spawn(this, MON_ZOMBIE.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
-METHOD(Zombie, mr_think, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_think, bool(Zombie this, entity actor))
 {
+    TC(Zombie, this);
     if(time >= actor.spawn_time)
         actor.damageforcescale = autocvar_g_monster_zombie_damageforcescale;
     return true;
 }
 
-METHOD(Zombie, mr_pain, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_pain, bool(Zombie this, entity actor))
 {
+    TC(Zombie, this);
     actor.pain_finished = time + 0.34;
     setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false);
     return true;
 }
 
-METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_death, bool(Zombie this, entity actor))
 {
+    TC(Zombie, this);
     actor.armorvalue = autocvar_g_monsters_armor_blockpercent;
 
     setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
@@ -178,8 +181,9 @@ METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
 }
 #endif
 #ifndef MENUQC
-METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_anim, bool(Zombie this, entity actor))
 {
+    TC(Zombie, this);
     vector none = '0 0 0';
     actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
     actor.anim_die2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
@@ -199,8 +203,9 @@ METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
 }
 #endif
 #ifdef SVQC
-METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_setup, bool(Zombie this, entity actor))
 {
+    TC(Zombie, this);
     if(!actor.health) actor.health = (autocvar_g_monster_zombie_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
@@ -223,8 +228,9 @@ METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
     return true;
 }
 
-METHOD(Zombie, mr_precache, bool(Zombie thismon))
+METHOD(Zombie, mr_precache, bool(Zombie this))
 {
+    TC(Zombie, this);
     return true;
 }
 #endif
index 70459263f1087da264e10fe71d95b218bbf59279..5e1af3df7d305198f93ee75bf27875a78816454b 100644 (file)
@@ -9,7 +9,7 @@
     #include <server/defs.qh>
 #endif
 entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
-{SELFPARAM();
+{
        float i;
        entity e = spawn();
 
index 8f1d8027617fd7443794b47b41fac7ddbd6cce0c..9d1022fa36cd92fcda738a5477699a6f80cd74d4 100644 (file)
@@ -48,7 +48,7 @@ void monster_dropitem(entity this)
        if(e && e.monster_loot)
        {
                e.noalign = true;
-               WITH(entity, self, e, e.monster_loot(e));
+               WITHSELF(e, e.monster_loot(e));
                e.gravity = 1;
                e.movetype = MOVETYPE_TOSS;
                e.reset = SUB_Remove;
@@ -211,6 +211,7 @@ void Monster_Delay_Action(entity this)
 
 void Monster_Delay_Action_self()
 {
+    SELFPARAM();
        Monster_Delay_Action(self);
 }
 
@@ -903,6 +904,9 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
 
 void Monster_Remove(entity this)
 {
+       if(IS_CLIENT(this))
+               return; // don't remove it?
+
        .entity weaponentity = weaponentities[0];
        if(!this) { return; }
 
@@ -1100,7 +1104,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                // TODO: fix this?
                activator = attacker;
                other = this.enemy;
-               WITH(entity, self, this, SUB_UseTargets());
+               WITHSELF(this, SUB_UseTargets());
                this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
 
                Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
diff --git a/qcsrc/common/mutators/_mod.inc b/qcsrc/common/mutators/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
index 79cba7f927948707451f4707b52cb6f4e33975fd..4d92b5d40578c111b334ace23da86b39f560a60e 100644 (file)
@@ -112,7 +112,7 @@ ENDCLASS(CallbackChain)
 #define _MUTATOR_HANDLE_NOP(type, id)
 #define _MUTATOR_HANDLE_PARAMS(type, id) , type in_##id
 #define _MUTATOR_HANDLE_PREPARE(type, id) id = in_##id;
-#define _MUTATOR_HANDLE_PUSHTMP(type, id) type tmp_##id = id;
+#define _MUTATOR_HANDLE_PUSHTMP(type, id) TC(type, id); type tmp_##id = id;
 #define _MUTATOR_HANDLE_PUSHOUT(type, id) type out_##id = id;
 #define _MUTATOR_HANDLE_POPTMP(type, id) id = tmp_##id;
 #define _MUTATOR_HANDLE_POPOUT(type, id) id = out_##id;
@@ -144,7 +144,7 @@ enum {
     MUTATOR_ROLLING_BACK
 };
 
-typedef bool(int) mutatorfunc_t;
+USING(mutatorfunc_t, bool(int));
 
 CLASS(Mutator, Object)
     ATTRIB(Mutator, m_id, int, 0)
diff --git a/qcsrc/common/mutators/mutator/_mod.inc b/qcsrc/common/mutators/mutator/_mod.inc
new file mode 100644 (file)
index 0000000..14e0e3d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "itemstime.qc"
diff --git a/qcsrc/common/mutators/mutator/bloodloss/_mod.inc b/qcsrc/common/mutators/mutator/bloodloss/_mod.inc
new file mode 100644 (file)
index 0000000..791cd03
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "bloodloss.qc"
diff --git a/qcsrc/common/mutators/mutator/breakablehook/_mod.inc b/qcsrc/common/mutators/mutator/breakablehook/_mod.inc
new file mode 100644 (file)
index 0000000..ff8da62
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "breakablehook.qc"
diff --git a/qcsrc/common/mutators/mutator/buffs/_mod.inc b/qcsrc/common/mutators/mutator/buffs/_mod.inc
new file mode 100644 (file)
index 0000000..df0201d
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "all.qc"
+#include "buffs.qc"
index b45cb0621d87b85918358ada79411cf54905fdac..8e1319b39bdcfeb16e6b7f164735b773f7a71fde 100644 (file)
@@ -13,13 +13,7 @@ REGISTER_REGISTRY(Buffs)
 REGISTRY_CHECK(Buffs)
 
 #define REGISTER_BUFF(id) \
-    REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff)); \
-    REGISTER_INIT_POST(BUFF_##id) { \
-        this.netname = this.m_name; \
-        this.m_itemid = BIT(this.m_id - 1); \
-        this.m_sprite = strzone(strcat("buff-", this.m_name)); \
-    } \
-    REGISTER_INIT(BUFF_##id)
+    REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff))
 
 #include <common/items/item/pickup.qh>
 CLASS(Buff, Pickup)
@@ -39,6 +33,14 @@ CLASS(Buff, Pickup)
 #endif
 ENDCLASS(Buff)
 
+STATIC_INIT(REGISTER_BUFFS) {
+    FOREACH(Buffs, true, {
+        it.netname = it.m_name; \
+        it.m_itemid = BIT(it.m_id - 1); \
+        it.m_sprite = strzone(strcat("buff-", it.m_name)); \
+    });
+}
+
 #ifdef SVQC
        // .int buffs = _STAT(BUFFS);
        void buff_Init(entity ent);
index 30e19f0f5429ae82bc7c3864f041c575973eaeea..15b725ee4b18d2bcd934728a6e0b2c2c8b233496 100644 (file)
@@ -82,7 +82,7 @@ const vector BUFF_MAX = ('16 16 20');
 #include <common/gamemodes/all.qh>
 
 .float buff_time = _STAT(BUFF_TIME);
-void buffs_DelayedInit();
+void buffs_DelayedInit(entity this);
 
 REGISTER_MUTATOR(buffs, cvar("g_buffs"))
 {
@@ -785,8 +785,8 @@ bool buffs_RemovePlayer(entity player)
 
        return false;
 }
-MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { return buffs_RemovePlayer(self); }
-MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { return buffs_RemovePlayer(self); }
+MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { SELFPARAM(); return buffs_RemovePlayer(self); }
+MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { SELFPARAM(); return buffs_RemovePlayer(self); }
 
 MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint)
 {SELFPARAM();
@@ -892,7 +892,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                                {
                                        entity oldother = other;
                                        other = self;
-                                       WITH(entity, self, it, it.touch());
+                                       WITHSELF(it, it.touch());
 
                                        other = oldother;
                                }
@@ -1045,7 +1045,7 @@ MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsPrettyString)
        return false;
 }
 
-void buffs_DelayedInit()
+void buffs_DelayedInit(entity this)
 {
        if(autocvar_g_buffs_spawn_count > 0)
        if(find(world, classname, "item_buff") == world)
diff --git a/qcsrc/common/mutators/mutator/bugrigs/_mod.inc b/qcsrc/common/mutators/mutator/bugrigs/_mod.inc
new file mode 100644 (file)
index 0000000..cd18f33
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "bugrigs.qc"
index 796b3d3955c4cd02296117f31fcc65944908accc..0e7d5813e2a5755c0222e37eb6c1e36eda0f7e09 100644 (file)
@@ -271,6 +271,7 @@ void RaceCarPhysics(entity this)
 #endif
 MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics)
 {
+    SELFPARAM();
        if(!PHYS_BUGRIGS(self) || !IS_PLAYER(self)) { return false; }
 
 #ifdef SVQC
@@ -283,6 +284,9 @@ MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics)
 
 MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
 {
+#ifdef SVQC
+    SELFPARAM();
+#endif
        if(!PHYS_BUGRIGS(self)) { return false; }
 #ifdef SVQC
        self.bugrigs_prevangles = self.angles;
@@ -294,6 +298,7 @@ MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
 
 MUTATOR_HOOKFUNCTION(bugrigs, ClientConnect)
 {
+    SELFPARAM();
        stuffcmd(self, "cl_cmd settemp chase_active 1\n");
        return false;
 }
diff --git a/qcsrc/common/mutators/mutator/campcheck/_mod.inc b/qcsrc/common/mutators/mutator/campcheck/_mod.inc
new file mode 100644 (file)
index 0000000..2f61e45
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "campcheck.qc"
diff --git a/qcsrc/common/mutators/mutator/cloaked/_mod.inc b/qcsrc/common/mutators/mutator/cloaked/_mod.inc
new file mode 100644 (file)
index 0000000..4423f2b
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "cloaked.qc"
diff --git a/qcsrc/common/mutators/mutator/damagetext/_mod.inc b/qcsrc/common/mutators/mutator/damagetext/_mod.inc
new file mode 100644 (file)
index 0000000..ff53767
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "damagetext.qc"
index 70c57485314367a6eda9dfddd58d4336ca4c51c5..0b44b7346ea73328d8db3067becf0f7078bb3fe4 100644 (file)
@@ -2,7 +2,7 @@
 #define MUTATOR_DAMAGETEXT_H
 
 #ifdef MENUQC
-#include <menu/xonotic/tab.qc>
+#include <menu/xonotic/tab.qh>
 #endif
 
 #endif
@@ -14,6 +14,9 @@ REGISTER_MUTATOR(damagetext, true);
 // no translatable cvar description please
 AUTOCVAR_SAVE(cl_damagetext,                    bool,   false,      "Draw damage dealt where you hit the enemy");
 AUTOCVAR_SAVE(cl_damagetext_format,             string, "-{total}", "How to format the damage text. {health}, {armor}, {total}");
+STATIC_INIT(DamageText_LegacyFormat) {
+    if (strstrofs(autocvar_cl_damagetext_format, "{", 0) < 0) autocvar_cl_damagetext_format = "-{total}";
+}
 AUTOCVAR_SAVE(cl_damagetext_color,              vector, '1 1 0',    "Damage text color");
 AUTOCVAR_SAVE(cl_damagetext_color_per_weapon,   bool,   false,      "Damage text uses weapon color");
 AUTOCVAR_SAVE(cl_damagetext_size,               float,  8,          "Damage text font size");
diff --git a/qcsrc/common/mutators/mutator/dodging/_mod.inc b/qcsrc/common/mutators/mutator/dodging/_mod.inc
new file mode 100644 (file)
index 0000000..92244a5
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "dodging.qc"
index 1707d0a9d0084d95b927cab079aef6e69d4112e8..8e2ece08358a689de3a6c9a5f3da4dd48a9d7ccb 100644 (file)
@@ -267,6 +267,7 @@ void PM_dodging_GetPressedKeys(entity this)
 
 MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 {
+    SELFPARAM();
        // print("dodging_PlayerPhysics\n");
        PM_dodging_GetPressedKeys(self);
        PM_dodging(self);
@@ -279,6 +280,7 @@ REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
 
 MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
 {
+    SELFPARAM();
        PM_dodging_checkpressedkeys(self);
        return false;
 }
diff --git a/qcsrc/common/mutators/mutator/doublejump/_mod.inc b/qcsrc/common/mutators/mutator/doublejump/_mod.inc
new file mode 100644 (file)
index 0000000..8c1f531
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "doublejump.qc"
index cb89f32b01254e647be4de4e9ee20e6ff6d05170..144e87ae8ef691efa3617680a801c63a8bd81f48 100644 (file)
@@ -15,6 +15,7 @@ REGISTER_MUTATOR(doublejump, true);
 
 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
 {
+    SELFPARAM();
        if (PHYS_DOUBLEJUMP(self))
        {
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
diff --git a/qcsrc/common/mutators/mutator/hook/_mod.inc b/qcsrc/common/mutators/mutator/hook/_mod.inc
new file mode 100644 (file)
index 0000000..9eff27e
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "hook.qc"
index b298e7b2eaa88998d0351f5edbfda2a27655aabb..388ee81a042b22f3519eb47e0f3cffa5459b5c88 100644 (file)
@@ -35,6 +35,7 @@ MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(hook, FilterItem)
 {
+    SELFPARAM();
     return self.weapon == WEP_HOOK.m_id;
 }
 
diff --git a/qcsrc/common/mutators/mutator/instagib/_mod.inc b/qcsrc/common/mutators/mutator/instagib/_mod.inc
new file mode 100644 (file)
index 0000000..e5e4393
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "instagib.qc"
+#include "items.qc"
index 33773131a9911f1732244f92c2c48f4f576eb68b..f8f2e5a7dfb41ec821f611b8f8573a784e97d01c 100644 (file)
@@ -198,7 +198,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
 
        if (self.items & ITEM_Invisibility.m_itemid)
        {
-               play_countdown(self.strength_finished, SND(POWEROFF));
+               play_countdown(self.strength_finished, SND_POWEROFF);
                if (time > self.strength_finished)
                {
                        self.alpha = default_player_alpha;
@@ -221,7 +221,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
 
        if (self.items & ITEM_Speed.m_itemid)
        {
-               play_countdown(self.invincible_finished, SND(POWEROFF));
+               play_countdown(self.invincible_finished, SND_POWEROFF);
                if (time > self.invincible_finished)
                {
                        self.items &= ~ITEM_Speed.m_itemid;
@@ -302,7 +302,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
                {
                        if(frag_deathtype & HITTYPE_SECONDARY)
                        {
-                               if(!autocvar_g_instagib_blaster_keepdamage)
+                               if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
                                        frag_damage = frag_mirrordamage = 0;
 
                                if(frag_target != frag_attacker)
@@ -371,7 +371,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
         e.cnt = self.cnt;
         e.team = self.team;
         e.spawnfunc_checked = true;
-               WITH(entity, self, e, spawnfunc_item_minst_cells(e));
+               WITHSELF(e, spawnfunc_item_minst_cells(e));
                return true;
        }
 
index 46bda6b69b23d4d240d5538285724542e6cdd62e..269ec2d245ea02cc473e1345cd02aad9b585e598 100644 (file)
@@ -1,3 +1,5 @@
+#pragma once
+
 #include <common/items/all.qh>
 #include <common/items/item/ammo.qh>
 #include <common/items/item/powerup.qh>
diff --git a/qcsrc/common/mutators/mutator/invincibleproj/_mod.inc b/qcsrc/common/mutators/mutator/invincibleproj/_mod.inc
new file mode 100644 (file)
index 0000000..2783d09
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "invincibleproj.qc"
index 408bd6fc853b2aff6411efba26ea27c1bef243e2..6c7eb4d76f0f42d01a5dd25fd2c1a264e05c2ada 100644 (file)
@@ -149,7 +149,7 @@ float Item_ItemsTime_UpdateTime(entity e, float t)
 }
 
 MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
-{SELFPARAM();
+{
     Item_ItemsTime_ResetTimes();
     // ALL the times need to be reset before .reset()ing each item
     // since Item_Reset schedules respawn of superweapons and powerups
@@ -366,8 +366,8 @@ void HUD_ItemsTime()
     FOREACH(Items, Item_ItemsTime_Allow(it) && ItemsTime_time[it.m_id] != -1, LAMBDA(
        id = it.m_id;
        icon = it.m_icon;
-       
-       :iteration
+
+LABEL(iteration)
         float item_time = ItemsTime_time[id];
         if (item_time < -1)
         {
diff --git a/qcsrc/common/mutators/mutator/melee_only/_mod.inc b/qcsrc/common/mutators/mutator/melee_only/_mod.inc
new file mode 100644 (file)
index 0000000..d2132e6
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "melee_only.qc"
diff --git a/qcsrc/common/mutators/mutator/midair/_mod.inc b/qcsrc/common/mutators/mutator/midair/_mod.inc
new file mode 100644 (file)
index 0000000..aae84aa
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "midair.qc"
index 622572c365a6863d8c6dfd8f65d7a8c3500a3fa1..c02642dab4828cafa38262ba0742c48dba74cf73 100644 (file)
@@ -7,7 +7,7 @@ REGISTER_MUTATOR(midair, cvar("g_midair"));
 .float midair_shieldtime;
 
 MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
-{SELFPARAM();
+{
        if(IS_PLAYER(frag_attacker))
        if(IS_PLAYER(frag_target))
        if(time < frag_target.midair_shieldtime)
diff --git a/qcsrc/common/mutators/mutator/multijump/_mod.inc b/qcsrc/common/mutators/mutator/multijump/_mod.inc
new file mode 100644 (file)
index 0000000..a58cf85
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "multijump.qc"
index c4a2e40fcd0c55ff9fd8523cb63e3a06e6a8be49..50fd020213ae77ef64af5809798c42eba3593477 100644 (file)
@@ -99,19 +99,21 @@ bool PM_multijump_checkjump(entity this)
 
 MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
 {
+    SELFPARAM();
 #ifdef CSQC
-       self.multijump_count = PHYS_MULTIJUMP_COUNT(self);
+       this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
 #endif
        if(!PHYS_MULTIJUMP) { return; }
 
-       if(IS_ONGROUND(self))
-               self.multijump_count = 0;
+       if(IS_ONGROUND(this))
+               this.multijump_count = 0;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
 {
-       return PM_multijump_checkjump(self);
+    SELFPARAM();
+       return PM_multijump_checkjump(this);
 }
 
 #ifdef SVQC
diff --git a/qcsrc/common/mutators/mutator/nades/_mod.inc b/qcsrc/common/mutators/mutator/nades/_mod.inc
new file mode 100644 (file)
index 0000000..9055545
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "nades.qc"
+#include "net.qc"
index 250a3ef71a1797f10ffeb45467c65b695ef77f6c..8d17edb0b6c164b7114bf24b551b16c396bb7065 100644 (file)
@@ -44,6 +44,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
 }
 MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
 {
+    SELFPARAM();
        if (self.cnt == PROJECTILE_NAPALM_FOUNTAIN)
        {
                self.modelindex = 0;
@@ -60,6 +61,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
 }
 MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
 {
+    SELFPARAM();
        if (self.cnt == PROJECTILE_NAPALM_FOUNTAIN)
        {
                loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM);
@@ -256,7 +258,7 @@ void nade_napalm_ball()
        proj = new(grenade);
        proj.owner = self.owner;
        proj.realowner = self.realowner;
-       proj.team = self.team;
+       proj.team = self.owner.team;
        proj.bot_dodge = true;
        proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
        proj.movetype = MOVETYPE_BOUNCE;
@@ -374,7 +376,7 @@ void nade_ice_think()
        {
                if ( autocvar_g_nades_ice_explode )
                {
-                       entity expef = EFFECT_NADE_EXPLODE(self.team);
+                       entity expef = EFFECT_NADE_EXPLODE(self.realowner.team);
                        Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
                        sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
 
@@ -569,7 +571,7 @@ void nade_heal_boom()
        setorigin(healer, self.origin);
        healer.healer_lifetime = autocvar_g_nades_heal_time; // save the cvar
        healer.ltime = time + healer.healer_lifetime;
-       healer.team = self.team;
+       healer.team = self.realowner.team;
        healer.bot_dodge = false;
        healer.solid = SOLID_TRIGGER;
        healer.touch = nade_heal_touch;
@@ -616,7 +618,7 @@ void nade_boom()
                case NADE_TYPE_MONSTER:
                case NADE_TYPE_SPAWN:
                        nade_blast = false;
-                       switch(self.team)
+                       switch(self.realowner.team)
                        {
                                case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
                                case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
@@ -632,7 +634,7 @@ void nade_boom()
 
                default:
                case NADE_TYPE_NORMAL:
-                       expef = EFFECT_NADE_EXPLODE(self.team);
+                       expef = EFFECT_NADE_EXPLODE(self.realowner.team);
                        break;
        }
 
@@ -747,7 +749,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
                this.takedamage = DAMAGE_NO;
-               WITH(entity, self, this, nade_boom());
+               WITHSELF(this, nade_boom());
                return;
        }
 
@@ -799,13 +801,10 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        this.health -= damage;
 
        if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
-       {
-               this.team = attacker.team;
                this.realowner = attacker;
-       }
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
        else
                nade_burn_spawn(this);
 }
@@ -823,7 +822,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 
        makevectors(e.v_angle);
 
-       W_SetupShot(e, false, false, "", CH_WEAPON_A, 0);
+       W_SetupShot(e, false, false, SND_Null, CH_WEAPON_A, 0);
 
        Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
 
@@ -926,6 +925,7 @@ void nades_RemoveBonus(entity player)
 
 MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
 {
+    SELFPARAM();
        nades_RemoveBonus(self);
 }
 
@@ -962,8 +962,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
        n.customizeentityforclient = nade_customize;
-       n.team = player.team;
-       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], n.team).eent_eff_name);
+       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
        n.colormod = Nades_from(n.nade_type).m_color;
        n.realowner = nowner;
        n.colormap = player.colormap;
@@ -1132,6 +1131,7 @@ NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOff
 
 MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
 {
+    SELFPARAM();
        if (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
                nades_CheckThrow();
                return true;
diff --git a/qcsrc/common/mutators/mutator/new_toys/_mod.inc b/qcsrc/common/mutators/mutator/new_toys/_mod.inc
new file mode 100644 (file)
index 0000000..97665f5
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "new_toys.qc"
diff --git a/qcsrc/common/mutators/mutator/nix/_mod.inc b/qcsrc/common/mutators/mutator/nix/_mod.inc
new file mode 100644 (file)
index 0000000..b98eab4
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "nix.qc"
index d265d33185acfd7536e628e80be57903524eda3c..0b6908a8b31ed512f35330ea13c85110cf712b0b 100644 (file)
@@ -36,6 +36,7 @@ bool NIX_CanChooseWeapon(int wpn);
 
 REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"))
 {
+    SELFPARAM();
        MUTATOR_ONADD
        {
                g_nix_with_blaster = autocvar_g_nix_with_blaster;
@@ -54,7 +55,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
        MUTATOR_ONREMOVE
        {
                // as the PlayerSpawn hook will no longer run, NIX is turned off by this!
-               FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
                        it.ammo_cells = start_ammo_cells;
                        it.ammo_plasma = start_ammo_plasma;
                        it.ammo_shells = start_ammo_shells;
@@ -64,7 +65,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
                        it.weapons = start_weapons;
                        if(!client_hasweapon(it, PS(it).m_weapon, true, false))
                                PS(it).m_switchweapon = w_getbestweapon(self);
-               ));
+               });
        }
 
        return 0;
diff --git a/qcsrc/common/mutators/mutator/overkill/_mod.inc b/qcsrc/common/mutators/mutator/overkill/_mod.inc
new file mode 100644 (file)
index 0000000..19c25a0
--- /dev/null
@@ -0,0 +1,4 @@
+// generated file; do not modify
+#include "hmg.qc"
+#include "overkill.qc"
+#include "rpc.qc"
index 30473e09b8e71365a11db5561a196ade8e285534..ec8061c3d2f764a5ff2bf0b6c7a3ea90e7ea7193 100644 (file)
@@ -47,6 +47,7 @@ REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun));
 REGISTER_MUTATOR(hmg_nadesupport, true);
 MUTATOR_HOOKFUNCTION(hmg_nadesupport, Nade_Damage)
 {
+    SELFPARAM();
        if (MUTATOR_ARGV(0, entity) != WEP_HMG) return;
        return = true;
        MUTATOR_ARGV(0, float) /* damage */ = self.max_health * 0.1;
@@ -56,6 +57,7 @@ spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(this, WEP_HMG); }
 
 void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
+    SELFPARAM();
        if (!PHYS_INPUT_BUTTON_ATCK(actor))
        {
                w_ready(thiswep, actor, weaponentity, fire);
@@ -72,7 +74,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
        W_DecreaseAmmo(WEP_HMG, self, WEP_CVAR(hmg, ammo));
 
-       W_SetupShot (actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(hmg, damage));
+       W_SetupShot (actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(hmg, damage));
 
        if(!autocvar_g_norecoil)
        {
@@ -81,7 +83,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
        }
 
        float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
-       fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
+       fireBullet(actor, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
 
        actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
 
@@ -100,10 +102,11 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
 METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
     else
-        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
 }
 
 METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
@@ -123,6 +126,7 @@ METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity wea
 
 METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
 
     if(autocvar_g_balance_hmg_reload_ammo)
@@ -133,6 +137,7 @@ METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
 
 METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
 
     if(autocvar_g_balance_hmg_reload_ammo)
@@ -143,7 +148,8 @@ METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
 
 METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, WEP_CVAR(hmg, ammo), SND_RELOAD);
 }
 
 METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep))
@@ -164,6 +170,7 @@ METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep))
 
 METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
index 125025f205c40f8ce1908705ff831df50d18a252..45a7e77f3d21a002470f2c2bb84721f4ecb8eec1 100644 (file)
@@ -135,12 +135,14 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDies)
        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 - frag_target.origin) * 500;
-       SUB_SetFade(e, time + 5, 1);
+       if (!wasfreed(e)) { // might have been blocked by a mutator
+        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 - frag_target.origin) * 500;
+        SUB_SetFade(e, time + 5, 1);
+       }
 
        frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id;
 
index 50362a1de856c7f9faebe31e61e303ffad5fb796..5a06302d9f282fe5cc92a550dee40b90d9eaf21f 100644 (file)
@@ -80,7 +80,7 @@ void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity atta
        this.health = this.health - damage;
 
        if (this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
 }
 
 void W_RocketPropelledChainsaw_Think()
@@ -111,7 +111,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
        entity flash = spawn ();
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(rpc, ammo));
-       W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(rpc, damage));
+       W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage));
        Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
        PROJECTILE_MAKETRIGGER(missile);
 
@@ -152,7 +152,8 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
 
 METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
 {
-    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+    SELFPARAM();
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
 }
 
 METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
@@ -179,6 +180,7 @@ METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .en
 
 METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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;
@@ -191,7 +193,8 @@ METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
 
 METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, WEP_CVAR(rpc, ammo), SND_RELOAD);
 }
 
 METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
@@ -218,6 +221,7 @@ METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
 
 METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
diff --git a/qcsrc/common/mutators/mutator/physical_items/_mod.inc b/qcsrc/common/mutators/mutator/physical_items/_mod.inc
new file mode 100644 (file)
index 0000000..8174e85
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "physical_items.qc"
index e8e152a5bbdb1dbbd06e40daea047e07487483f8..aaad9d47be599b59c91a7c879014d0deb8dc6535 100644 (file)
@@ -127,7 +127,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
                setorigin(wep, wep.origin + '0 0 1');
                entity oldself;
                oldself = self;
-               WITH(entity, self, wep, builtin_droptofloor());
+               WITHSELF(wep, builtin_droptofloor());
        }
 
        wep.spawn_origin = wep.origin;
diff --git a/qcsrc/common/mutators/mutator/pinata/_mod.inc b/qcsrc/common/mutators/mutator/pinata/_mod.inc
new file mode 100644 (file)
index 0000000..a4017bd
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "pinata.qc"
diff --git a/qcsrc/common/mutators/mutator/random_gravity/_mod.inc b/qcsrc/common/mutators/mutator/random_gravity/_mod.inc
new file mode 100644 (file)
index 0000000..e07c8af
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "random_gravity.qc"
diff --git a/qcsrc/common/mutators/mutator/rocketflying/_mod.inc b/qcsrc/common/mutators/mutator/rocketflying/_mod.inc
new file mode 100644 (file)
index 0000000..92ef3cc
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "rocketflying.qc"
diff --git a/qcsrc/common/mutators/mutator/rocketminsta/_mod.inc b/qcsrc/common/mutators/mutator/rocketminsta/_mod.inc
new file mode 100644 (file)
index 0000000..e50a4ba
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "rocketminsta.qc"
diff --git a/qcsrc/common/mutators/mutator/running_guns/_mod.inc b/qcsrc/common/mutators/mutator/running_guns/_mod.inc
new file mode 100644 (file)
index 0000000..2550d2d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "running_guns.qc"
diff --git a/qcsrc/common/mutators/mutator/sandbox/_mod.inc b/qcsrc/common/mutators/mutator/sandbox/_mod.inc
new file mode 100644 (file)
index 0000000..c1e80d4
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "sandbox.qc"
diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc b/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc
new file mode 100644 (file)
index 0000000..612f5a0
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "spawn_near_teammate.qc"
diff --git a/qcsrc/common/mutators/mutator/superspec/_mod.inc b/qcsrc/common/mutators/mutator/superspec/_mod.inc
new file mode 100644 (file)
index 0000000..bb63a18
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "superspec.qc"
index b7a596cdf235e44efaecd244cf67280ebe13c619..5471bcbae06fac3e3e8422442d61f98136ffa908 100644 (file)
@@ -26,7 +26,7 @@ const float SSF_ITEMMSG = 4;
 bool superspec_Spectate(entity _player)
 {SELFPARAM();
        if(Spectate(_player) == 1)
-               self.classname = STR_SPECTATOR;
+           TRANSMUTE(Spectator, self);
 
        return true;
 }
@@ -440,6 +440,7 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
 
 MUTATOR_HOOKFUNCTION(superspec, PlayerDies)
 {
+    SELFPARAM();
        FOREACH_CLIENT(IS_SPEC(it), LAMBDA(
                setself(it);
                if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == frag_target)
diff --git a/qcsrc/common/mutators/mutator/touchexplode/_mod.inc b/qcsrc/common/mutators/mutator/touchexplode/_mod.inc
new file mode 100644 (file)
index 0000000..06bb8d3
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "touchexplode.qc"
diff --git a/qcsrc/common/mutators/mutator/vampire/_mod.inc b/qcsrc/common/mutators/mutator/vampire/_mod.inc
new file mode 100644 (file)
index 0000000..c0164ea
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "vampire.qc"
diff --git a/qcsrc/common/mutators/mutator/vampirehook/_mod.inc b/qcsrc/common/mutators/mutator/vampirehook/_mod.inc
new file mode 100644 (file)
index 0000000..4f2e935
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "vampirehook.qc"
diff --git a/qcsrc/common/mutators/mutator/waypoints/_mod.inc b/qcsrc/common/mutators/mutator/waypoints/_mod.inc
new file mode 100644 (file)
index 0000000..a5ebe76
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "waypointsprites.qc"
diff --git a/qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc b/qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc
new file mode 100644 (file)
index 0000000..c110d3f
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "weaponarena_random.qc"
index d67a1de3d8f7a230d8620f1ffd9b815d834a8ddf..1e1726ae452fe716041d291f30581eb3a1d3cab9 100644 (file)
@@ -3,9 +3,8 @@
 REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
 
 #ifdef SVQC
-void sv_notice_join_think()
+void sv_notice_join_think(entity this)
 {
-    SELFPARAM();
     int argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
     if (argc <= 0) return;
     for (int i = 0; i < argc; ++i)
diff --git a/qcsrc/common/notifications/_mod.inc b/qcsrc/common/notifications/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
index 60fd625992b8de78200b6bf3fea00ee868a664c8..ad2013dfa5b9d214128165e81281e345b868b668 100644 (file)
@@ -1548,7 +1548,7 @@ void Send_Notification(
        MSG net_type, Notification net_name,
        ...count)
 {
-    if (!IS_REAL_CLIENT(client)) return;
+    if (broadcast != NOTIF_ALL && broadcast != NOTIF_ALL_EXCEPT && !IS_REAL_CLIENT(client)) return;
        entity notif = net_name;
        string parms = sprintf("%s, '%s', %s, %s",
                Get_Notif_BroadcastName(broadcast),
index 8f00087c0870a33bd57662a7941fca43045f0091..525fc98e9627afcadd126f881ee88f6b77f1cd6c 100644 (file)
@@ -72,7 +72,7 @@ ENUMCLASS(CPID)
        CASE(CPID, LAST)
 ENUMCLASS_END(CPID)
 
-typedef entity Notification;
+USING(Notification, entity);
 
 // used for notification system multi-team identifiers
 #define APP_TEAM_NUM(num, prefix) ((num == NUM_TEAM_1) ? prefix##_RED : ((num == NUM_TEAM_2) ? prefix##_BLUE : ((num == NUM_TEAM_3) ? prefix##_YELLOW : prefix##_PINK)))
diff --git a/qcsrc/common/physics/_mod.inc b/qcsrc/common/physics/_mod.inc
new file mode 100644 (file)
index 0000000..fb423ec
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "movelib.qc"
+#include "player.qc"
index 26c70daf60f2690119e73a4b213f92ff91787c37..a27b8666eedf0a716c4f5743dd844bdfd2593c76 100644 (file)
@@ -182,41 +182,41 @@ Yed need to set v_up and v_forward (generally by calling makevectors) before cal
 **/
 #endif
 
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{SELFPARAM();
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
+{
     vector a, b, c, d, e, r, push_angle, ahead, side;
 
     push_angle.y = 0;
-    r = (self.absmax + self.absmin) * 0.5 + (v_up * spring_up);
+    r = (this.absmax + this.absmin) * 0.5 + (v_up * spring_up);
     e = v_up * spring_length;
 
     // Put springs slightly inside bbox
-    ahead = v_forward * (self.maxs.x * 0.8);
-    side  = v_right   * (self.maxs.y * 0.8);
+    ahead = v_forward * (this.maxs.x * 0.8);
+    side  = v_right   * (this.maxs.y * 0.8);
 
     a = r + ahead + side;
     b = r + ahead - side;
     c = r - ahead + side;
     d = r - ahead - side;
 
-    traceline(a, a - e,MOVE_NORMAL,self);
+    traceline(a, a - e,MOVE_NORMAL,this);
     a.z =  (1 - trace_fraction);
     r = trace_endpos;
 
-    traceline(b, b - e,MOVE_NORMAL,self);
+    traceline(b, b - e,MOVE_NORMAL,this);
     b.z =  (1 - trace_fraction);
     r += trace_endpos;
 
-    traceline(c, c - e,MOVE_NORMAL,self);
+    traceline(c, c - e,MOVE_NORMAL,this);
     c.z =  (1 - trace_fraction);
     r += trace_endpos;
 
-    traceline(d, d - e,MOVE_NORMAL,self);
+    traceline(d, d - e,MOVE_NORMAL,this);
     d.z =  (1 - trace_fraction);
     r += trace_endpos;
 
     a.x = r.z;
-    r = self.origin;
+    r = this.origin;
     r.z = r.z;
 
     push_angle.x = (a.z - c.z) * _max;
@@ -225,13 +225,13 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend
     push_angle.z = (b.z - a.z) * _max;
     push_angle.z += (d.z - c.z) * _max;
 
-    //self.angles_x += push_angle_x * 0.95;
-    //self.angles_z += push_angle_z * 0.95;
+    //this.angles_x += push_angle_x * 0.95;
+    //this.angles_z += push_angle_z * 0.95;
 
-    self.angles_x = ((1-blendrate) *  self.angles.x)  + (push_angle.x * blendrate);
-    self.angles_z = ((1-blendrate) *  self.angles.z)  + (push_angle.z * blendrate);
+    this.angles_x = ((1-blendrate) *  this.angles.x)  + (push_angle.x * blendrate);
+    this.angles_z = ((1-blendrate) *  this.angles.z)  + (push_angle.z * blendrate);
 
-    //a = self.origin;
-    setorigin(self,r);
+    //a = this.origin;
+    setorigin(this,r);
 }
 
index 86cb7338509c0dad21121f4af8b7d2cfd743190f..90ea4b4160e12d79ce24e4b00e60fc9582c424f0 100644 (file)
@@ -48,6 +48,6 @@ Yed need to set v_up and v_forward (generally by calling makevectors) before cal
 **/
 #endif
 
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max);
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max);
 
 #endif
diff --git a/qcsrc/common/physics/movetypes/_mod.inc b/qcsrc/common/physics/movetypes/_mod.inc
new file mode 100644 (file)
index 0000000..674b829
--- /dev/null
@@ -0,0 +1,7 @@
+// generated file; do not modify
+#include "follow.qc"
+#include "movetypes.qc"
+#include "push.qc"
+#include "step.qc"
+#include "toss.qc"
+#include "walk.qc"
index 2c9c5894bfecfdbfefe763562e840cf4f05f0233..33c56216a5d71b8ad053f9c3a05236af65ae5509 100644 (file)
@@ -321,7 +321,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = oth;
 
-               WITH(entity, self, this, this.move_touch());
+               WITHSELF(this, this.move_touch());
 
                other = oldother;
        }
@@ -330,7 +330,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = this;
 
-               WITH(entity, self, oth, oth.move_touch());
+               WITHSELF(oth, oth.move_touch());
 
                other = oldother;
        }
@@ -360,7 +360,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this)  // SV_LinkEdict_TouchAreaGr
                        trace_plane_dist = 0;
                        trace_ent = this;
 
-                       WITH(entity, self, it, it.move_touch());
+                       WITHSELF(it, it.move_touch());
                }
     });
 
index dd89a4099dfa6e9c3a38d001a49a618ea204932f..b3cfb875da28a318c6585bd1a91df2f8e1ff64ef 100644 (file)
@@ -149,6 +149,6 @@ void _Movetype_Physics_Pusher(entity this, float dt)  // SV_Physics_Pusher
                this.move_nextthink = 0;
                this.move_time = time;
                other = world;
-               WITH(entity, self, this, this.move_think());
+               WITHSELF(this, this.move_think());
        }
 }
index af3f87c158a4bb259dc9d7868b6fc82e03ff30d8..0ecfa180f45bc143e6d11c831bdbbc41bc0a7b60 100644 (file)
@@ -128,7 +128,17 @@ void PM_ClientMovement_UpdateStatus(entity this, bool ground)
                PM_ClientMovement_Unstick(this);
 
        // set crouched
-       if (PHYS_INPUT_BUTTON_CROUCH(this))
+       bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+       if(this.hook && !wasfreed(this.hook))
+               do_crouch = false;
+       if(hud != HUD_NORMAL)
+               do_crouch = false;
+       if(STAT(FROZEN, this))
+               do_crouch = false;
+       if((activeweapon == WEP_SHOCKWAVE || activeweapon == WEP_SHOTGUN) && viewmodel.animstate_startframe == viewmodel.anim_fire2_x && time < viewmodel.weapon_nextthink)
+               do_crouch = false;
+
+       if (do_crouch)
        {
                // wants to crouch, this always works
                if (!IS_DUCKED(this)) SET_DUCKED(this);
@@ -1247,8 +1257,10 @@ void PM_air(entity this, float buttons_prev, float maxspd_mod)
 
                if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && this.movement.y == 0 && this.movement.x != 0)
                        PM_AirAccelerate(this, wishdir, wishspeed2);
-               else
-                       PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd, PHYS_AIRSPEEDLIMIT_NONQW(this));
+               else {
+                   float sidefric = maxairspd ? (PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd) : 0;
+                       PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), sidefric, PHYS_AIRSPEEDLIMIT_NONQW(this));
+        }
 
                if (PHYS_AIRCONTROL(this))
                        CPM_PM_Aircontrol(this, wishdir, wishspeed2);
@@ -1314,7 +1326,7 @@ void PM_Main(entity this)
 
 
 #ifdef SVQC
-       WarpZone_PlayerPhysics_FixVAngle();
+       WarpZone_PlayerPhysics_FixVAngle(this);
 #endif
        float maxspeed_mod = 1;
        maxspeed_mod *= PHYS_HIGHSPEED(this);
@@ -1323,7 +1335,7 @@ void PM_Main(entity this)
        Physics_UpdateStats(this, maxspeed_mod);
 
        if (this.PlayerPhysplug)
-               if (this.PlayerPhysplug())
+               if (this.PlayerPhysplug(this))
                        return;
 #elif defined(CSQC)
        if(autocvar_slowmo != STAT(MOVEVARS_TIMESCALE))
@@ -1356,7 +1368,7 @@ void PM_Main(entity this)
        {
                if (playerdemo_read(this))
                        return;
-               WITH(entity, self, this, bot_think());
+               bot_think(this);
        }
 #endif
 
@@ -1530,7 +1542,7 @@ void PM_Main(entity this)
        else
                PM_air(this, buttons_prev, maxspeed_mod);
 
-:end
+LABEL(end)
        if (IS_ONGROUND(this))
                this.lastground = time;
 
index 252b157cdf0f8dfd9c22d873db7630275c57a796..fd1b610de68811c11c405afdd6eef9f8eed43b58 100644 (file)
@@ -23,7 +23,7 @@
 .vector v_angle_old;
 .string lastclassname;
 
-.float() PlayerPhysplug;
+.float(entity) PlayerPhysplug;
 float AdjustAirAccelQW(float accelqw, float factor);
 
 bool IsFlying(entity a);
@@ -155,6 +155,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
 
 #define ITEMS_STAT(s)                       ((s).items)
 
+.float teleport_time;
+
 #ifdef CSQC
 
        string autocvar_cl_jumpspeedcap_min;
@@ -172,6 +174,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
        .vector movement;
        .vector v_angle;
 
+       .entity hook;
+
 // TODO
        #define IS_CLIENT(s)                        ((s).isplayermodel)
        #define IS_PLAYER(s)                        ((s).isplayermodel)
diff --git a/qcsrc/common/sounds/_mod.inc b/qcsrc/common/sounds/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
index 5d6c57f21e55ff9b1caade97b37cf93376df9fae..a462861f29b8401452b3c1d75becd2a4de24e555 100644 (file)
@@ -120,11 +120,12 @@ CLASS(Sound, Object)
                return string_null;
 #endif
        }
-       METHOD(Sound, sound_precache, void(entity this))
+       METHOD(Sound, sound_precache, void(Sound this))
        {
+           TC(Sound, this);
                string s = Sound_fixpath(this);
                if (!s) return;
-               LOG_TRACEF("precache_sound(\"%s\")\n", s);
+               LOG_DEBUGF("precache_sound(\"%s\")\n", s);
                precache_sound(s);
        }
 ENDCLASS(Sound)
index 226ff1ba5680135cf45db7b6db3b34d6ead38a83..d75e08027171aee5cf812333cb56367bb974a3e8 100644 (file)
@@ -12,15 +12,17 @@ void PlayerState_attach(entity this)
 
 void PlayerState_detach(entity this)
 {
-       if (!PS(this)) return;  // initial connect
-       FOREACH_CLIENT(PS(it) == PS(this), { PS(it) = NULL; });
-       remove(PS(this));
-       this._ps = NULL;
-
-    Inventory_delete(self);
+    PlayerState ps = PS(this);
+       if (!ps) return;  // initial connect
+       PS(this) = NULL;
+       if (ps.m_client != this) return;  // don't own state, spectator
+       FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
+       remove(ps);
+
+    Inventory_delete(this);
 }
 
-void GetCvars(int);
+void GetCvars(entity this, int);
 void DecodeLevelParms(entity this);
 void PlayerScore_Attach(entity this);
 void ClientData_Attach(entity this);
@@ -35,7 +37,7 @@ void ClientState_attach(entity this)
 {
        this._cs = NEW(ClientState, this);
 
-    GetCvars(0);  // get other cvars from player
+    GetCvars(this, 0);  // get other cvars from player
 
        // TODO: xonstat elo.txt support, until then just 404s
        if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
@@ -55,9 +57,9 @@ void ClientState_attach(entity this)
        bot_clientconnect(this);
 }
 
-void bot_clientdisconnect();
+void bot_clientdisconnect(entity this);
 void W_HitPlotClose(entity this);
-void anticheat_report();
+void anticheat_report(entity this);
 void playerdemo_shutdown();
 void entcs_detach(entity this);
 void accuracy_free(entity this);
@@ -69,12 +71,12 @@ void ClientState_detach(entity this)
        remove(CS(this));
        this._cs = NULL;
 
-    GetCvars(-1);  // free cvars
+    GetCvars(this, -1);  // free cvars
 
-    bot_clientdisconnect();
+    bot_clientdisconnect(this);
 
     W_HitPlotClose(this);
-    anticheat_report();
+    anticheat_report(this);
     playerdemo_shutdown();
     entcs_detach(this);
     accuracy_free(self);
index 64ae3e7fe62f087accb4e01d0cfd65ba428940eb..110df1c575840421fb05a47ebb66cc16c89f8efa 100644 (file)
@@ -17,6 +17,7 @@ CLASS(PlayerState, Object)
        ATTRIB(PlayerState, m_weapon, Weapon, Weapons_from(-1))
        METHOD(PlayerState, ps_push, void(PlayerState this, entity cl))
        {
+           TC(PlayerState, this);
                STAT(ACTIVEWEAPON, cl) = this.m_weapon.m_id;
                STAT(SWITCHINGWEAPON, cl) = this.m_switchingweapon.m_id;
                STAT(SWITCHWEAPON, cl) = this.m_switchweapon.m_id;
@@ -24,11 +25,7 @@ CLASS(PlayerState, Object)
 ENDCLASS(PlayerState)
 
 .PlayerState _ps;
-#if NDEBUG
-       #define PS(this) (this._ps)
-#else
-       PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
-#endif
+#define PS(this) ((this)._ps)
 
 // TODO: renew on death
 void PlayerState_attach(entity this);
@@ -53,7 +50,7 @@ ENDCLASS(ClientState)
 #if NDEBUG
        #define CS(this) (this._cs)
 #else
-       ClientState CS(entity this) { assert(IS_CLIENT(this)); assert(this._cs); return this._cs; }
+       ClientState CS(Client this) { TC(Client, this); assert(this._cs); return this._cs; }
 #endif
 
 void ClientState_attach(entity this);
index 7c29df469bdfce1e4a7596bbff0b642df4e9a782..e9828c69ee4329575a11715eff10594efdc8c069 100644 (file)
@@ -2,7 +2,7 @@
 #define STATS_H
 
 #ifdef SVQC
-#include "../server/cl_client.qh"
+#include <server/cl_client.qh>
 #endif
 
 // Full list of all stat constants, included in a single location for easy reference
@@ -273,6 +273,7 @@ REGISTER_STAT(MOVEVARS_MAXAIRSTRAFESPEED, float)
 REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
 REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
 REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
+REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
 #ifdef SVQC
 float autocvar_sv_wallfriction;
 #endif
index e2bafb82fe5d1921eaa363f4f6f0d8a0d344fcd3..87623da3630d62f7a98e1e20bea14cbf960accf6 100644 (file)
@@ -644,7 +644,7 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
 
        return false;
 
-:YEAH
+LABEL(YEAH)
        switch(mode)
        {
                case ITEM_MODE_FUEL:
@@ -740,7 +740,7 @@ float Item_GiveTo(entity item, entity player)
                player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
        }
 
-:skip
+LABEL(skip)
 
        // always eat teamed entities
        if(item.team)
@@ -811,7 +811,7 @@ void Item_Touch()
                return;
        }
 
-       :pickup
+LABEL(pickup)
 
        other.last_pickup = time;
 
@@ -863,8 +863,8 @@ void Item_Reset(entity this)
 }
 void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
 
-void Item_FindTeam()
-{SELFPARAM();
+void Item_FindTeam(entity this)
+{
        entity e;
 
        if(self.effects & EF_NODRAW)
@@ -1030,7 +1030,7 @@ float commodity_pickupevalfunc(entity player, entity item)
 void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
-               WITH(entity, self, this, RemoveItem());
+               WITHSELF(this, RemoveItem());
 }
 
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
@@ -1135,7 +1135,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                        this.SendFlags |= ISF_SIZE;
                        // note droptofloor returns false if stuck/or would fall too far
                        if (!this.noalign)
-                               WITH(entity, self, this, droptofloor());
+                               WITHSELF(this, droptofloor());
                        waypoint_spawnforitem(this);
                }
 
index d6c97445f6be572cbe87f2ebcf7d2cfbbf6cb4f1..1eb4b182dee07359b7fd7d0baf8b2948c877071a 100644 (file)
@@ -92,7 +92,7 @@ void Item_Touch();
 
 void Item_Reset(entity this);
 
-void Item_FindTeam();
+void Item_FindTeam(entity this);
 // Savage: used for item garbage-collection
 
 bool ItemSend(entity this, entity to, int sf);
diff --git a/qcsrc/common/triggers/_mod.inc b/qcsrc/common/triggers/_mod.inc
new file mode 100644 (file)
index 0000000..8c5a22c
--- /dev/null
@@ -0,0 +1,6 @@
+// generated file; do not modify
+#include "include.qc"
+#include "platforms.qc"
+#include "subs.qc"
+#include "teleporters.qc"
+#include "triggers.qc"
diff --git a/qcsrc/common/triggers/func/_mod.inc b/qcsrc/common/triggers/func/_mod.inc
new file mode 100644 (file)
index 0000000..2497d85
--- /dev/null
@@ -0,0 +1,19 @@
+// generated file; do not modify
+#include "bobbing.qc"
+#include "breakable.qc"
+#include "button.qc"
+#include "conveyor.qc"
+#include "door.qc"
+#include "door_rotating.qc"
+#include "door_secret.qc"
+#include "fourier.qc"
+#include "include.qc"
+#include "ladder.qc"
+#include "pendulum.qc"
+#include "plat.qc"
+#include "pointparticles.qc"
+#include "rainsnow.qc"
+#include "rotating.qc"
+#include "stardust.qc"
+#include "train.qc"
+#include "vectormamamam.qc"
index e3c74b35626ba894f03335c432b91b64ecf4a38b..feaf8785093d97b9663d67096ae3c8d22d853394 100644 (file)
@@ -243,7 +243,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
                WaypointSprite_Ping(this.sprite);
                WaypointSprite_UpdateHealth(this.sprite, this.health);
        }
-       WITH(entity, self, this, func_breakable_colormod());
+       WITHSELF(this, func_breakable_colormod());
 
        if(this.health <= 0)
        {
index 41cdb44dafc3237fb9063bd5aafffce77cb1f314..e9ae0a5472042f24cfbada02a1ce52cdbd9fd07d 100644 (file)
@@ -92,7 +92,7 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage,
        if (this.health <= 0)
        {
                this.enemy = damage_attacker;
-               WITH(entity, self, this, button_fire());
+               WITHSELF(this, button_fire());
        }
 }
 
index fb50a6613c14ce5dab6c3ea43d54978fd6e4822b..583c737438ac3fae10131e2497018df65789ca38 100644 (file)
@@ -147,7 +147,7 @@ spawnfunc(func_conveyor)
 
 #elif defined(CSQC)
 
-void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
 
 void conveyor_init()
 {SELFPARAM();
index 1bd36df4bf0957ae6e6e27a0178e6753d8e85eef..1e19dfafc7205e3e74d9c1aad7daa23f34adf567 100644 (file)
@@ -268,7 +268,7 @@ void door_use()
 
        if (self.owner)
        {
-               WITH(entity, self, self.owner, door_fire());
+               WITHSELF(self.owner, door_fire());
        }
 }
 
@@ -289,7 +289,7 @@ void door_damage(entity this, entity inflictor, entity attacker, float damage, i
        {
                this.owner.health = this.owner.max_health;
                this.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
-               WITH(entity, self, this.owner, door_use());
+               WITHSELF(this.owner, door_use());
        }
 }
 
@@ -506,8 +506,8 @@ bool LinkDoors_isconnected(entity e1, entity e2, entity pass)
 #ifdef SVQC
 void door_link();
 #endif
-void LinkDoors()
-{SELFPARAM();
+void LinkDoors(entity this)
+{
        entity  t;
        vector  cmins, cmaxs;
 
@@ -693,8 +693,8 @@ void door_link()
 }
 #endif
 
-void door_init_startopen()
-{SELFPARAM();
+void door_init_startopen(entity this)
+{
        SUB_SETORIGIN(self, self.pos2);
        self.pos2 = self.pos1;
        self.pos1 = self.origin;
@@ -850,10 +850,10 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew)
                this.drawmask = MASK_NORMAL;
                this.use = door_use;
 
-               LinkDoors();
+               LinkDoors(this);
 
                if(this.spawnflags & DOOR_START_OPEN)
-                       door_init_startopen();
+                       door_init_startopen(this);
 
                this.move_time = time;
                this.move_origin = this.origin;
index 4f88e9e9b5ae02c595511f9a96625ee1406d72e2..4c97fe6a8aa7c1d7584c4fb63d7c024a247c968e 100644 (file)
@@ -36,8 +36,8 @@ void door_rotating_reset(entity this)
        this.nextthink = 0;
 }
 
-void door_rotating_init_startopen()
-{SELFPARAM();
+void door_rotating_init_startopen(entity this)
+{
        self.angles = self.movedir;
        self.pos2 = '0 0 0';
        self.pos1 = self.movedir;
index e32ed7e50c308c66627c434bc8eebfaf66bc081a..70b5a0a09e884f3a3aac039b42fb8a55e973ea02 100644 (file)
@@ -65,7 +65,7 @@ void fd_secret_use()
 
 void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       WITH(entity, self, this, fd_secret_use());
+       WITHSELF(this, fd_secret_use());
 }
 
 // Wait after first movement...
index 44687de4a163a57aa63156d38b7bea582610202d..04c5c2563d785a665685bd9d8888393f9a2ad9cb 100644 (file)
@@ -34,6 +34,7 @@ bool func_ladder_send(entity to, int sf)
 
 void func_ladder_link()
 {
+    SELFPARAM();
        self.SendEntity = func_ladder_send;
        self.SendFlags = 0xFFFFFF;
        //self.model = "null";
@@ -41,6 +42,7 @@ void func_ladder_link()
 
 void func_ladder_init()
 {
+    SELFPARAM();
        self.touch = func_ladder_touch;
 
        trigger_init(self);
index ea546164ce71fb0589b03f12f8fea3962c82f214..14cfa564134b74e0c6633ac53d5862a05c4db6d7 100644 (file)
@@ -3,7 +3,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_PLAT)
 #ifdef SVQC
 void plat_link();
 
-void plat_delayedinit()
+void plat_delayedinit(entity this)
 {
        plat_link();
        plat_spawn_inside_trigger(); // the "start moving" trigger
index 28f6812c2d224827debc2fc3245d0f19d0bd4bfb..62b4d5a3629e846bc063e1368f55c189e890df50 100644 (file)
@@ -58,6 +58,7 @@ bool pointparticles_SendEntity(entity this, entity to, float fl)
                        }
                }
                WriteShort(MSG_ENTITY, self.cnt);
+               WriteString(MSG_ENTITY, self.mdl);
                if(fl & 0x20)
                {
                        WriteShort(MSG_ENTITY, compressShortVector(self.velocity));
@@ -112,8 +113,9 @@ void pointparticles_reset(entity this)
 
 spawnfunc(func_pointparticles)
 {
-       if(this.model != "") _setmodel(this, this.model);
+       if(this.model != "") { precache_model(this.model); _setmodel(this, this.model); }
        if(this.noise != "") precache_sound(this.noise);
+       if(this.mdl != "") this.cnt = 0; // use a good handler
 
        if(!this.bgmscriptsustain) this.bgmscriptsustain = 1;
        else if(this.bgmscriptsustain < 0) this.bgmscriptsustain = 0;
@@ -129,7 +131,7 @@ spawnfunc(func_pointparticles)
                setorigin(this, this.origin + this.mins);
                setsize(this, '0 0 0', this.maxs - this.mins);
        }
-       if(!this.cnt) this.cnt = _particleeffectnum(this.mdl);
+       //if(!this.cnt) this.cnt = _particleeffectnum(this.mdl);
 
        Net_LinkEntity(this, (this.spawnflags & 4), 0, pointparticles_SendEntity);
 
@@ -224,11 +226,21 @@ void Draw_PointParticles(entity this)
                        {
                                traceline(p, p + normalize(self.movedir) * 4096, 0, world);
                                p = trace_endpos;
-                               __pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
+                               int eff_num;
+                               if(self.cnt)
+                                       eff_num = self.cnt;
+                               else
+                                       eff_num = _particleeffectnum(self.mdl);
+                               __pointparticles(eff_num, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
                        }
                        else
                        {
-                               __pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count);
+                               int eff_num;
+                               if(self.cnt)
+                                       eff_num = self.cnt;
+                               else
+                                       eff_num = _particleeffectnum(self.mdl);
+                               __pointparticles(eff_num, p, self.velocity + randomvec() * self.waterlevel, self.count);
                        }
                        if(self.noise != "")
                        {
@@ -254,6 +266,9 @@ void Ent_PointParticles_Remove(entity this)
        if(this.bgmscript)
                strunzone(this.bgmscript);
        this.bgmscript = string_null;
+       if(this.mdl)
+               strunzone(this.mdl);
+       this.mdl = string_null;
 }
 
 NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
@@ -264,7 +279,7 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
        if(f & 2)
        {
                i = ReadCoord(); // density (<0: point, >0: volume)
-               if(i && !self.impulse && self.cnt) // self.cnt check is so it only happens if the ent already existed
+               if(i && !self.impulse && (self.cnt || self.mdl)) // self.cnt check is so it only happens if the ent already existed
                        self.just_toggled = 1;
                self.impulse = i;
        }
@@ -302,6 +317,7 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
                }
 
                self.cnt = ReadShort(); // effect number
+               self.mdl = strzone(ReadString()); // effect string
 
                if(f & 0x20)
                {
index e7567c5009dd5fbcff1fcd9de355e4302ff1a1cf..2b27c7355ce5b814bc1ceac5dff541aacee79a4e 100644 (file)
@@ -5,7 +5,7 @@ void train_use();
 #endif
 void train_wait()
 {SELFPARAM();
-       WITH(entity, self, self.enemy, SUB_UseTargets());
+       WITHSELF(self.enemy, SUB_UseTargets());
        self.enemy = world;
 
        // if turning is enabled, the train will turn toward the next point while waiting
@@ -178,13 +178,14 @@ void train_link()
 
 void train_use()
 {
+    SELFPARAM();
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
        self.SUB_THINK = train_next;
        self.use = func_null; // not again
 }
 
-void func_train_find()
-{SELFPARAM();
+void func_train_find(entity this)
+{
        entity targ;
        targ = find(world, targetname, self.target);
        self.target = targ.target;
index 5c2086477475abe8e6541374f1d6b12843a996a9..2dfa1ac98f9817d4b4cc07b1d245416db3ca00ee 100644 (file)
@@ -71,8 +71,8 @@ void func_vectormamamam_controller_think()
                self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
 }
 
-void func_vectormamamam_findtarget()
-{SELFPARAM();
+void func_vectormamamam_findtarget(entity this)
+{
        if(self.target != "")
                self.wp00 = find(world, targetname, self.target);
 
diff --git a/qcsrc/common/triggers/misc/_mod.inc b/qcsrc/common/triggers/misc/_mod.inc
new file mode 100644 (file)
index 0000000..5a6a06a
--- /dev/null
@@ -0,0 +1,6 @@
+// generated file; do not modify
+#include "corner.qc"
+#include "follow.qc"
+#include "include.qc"
+#include "laser.qc"
+#include "teleport_dest.qc"
index 842248a4b31f0acc93a7b91f32a784dea7c1978c..2ac304a212d08fbfaa28183353538040cee7716f 100644 (file)
@@ -1,8 +1,8 @@
 // the way this entity works makes it no use to CSQC, as it removes itself instantly
 
 #ifdef SVQC
-void follow_init()
-{SELFPARAM();
+void follow_init(entity this)
+{
        entity src, dst;
        src = world;
        dst = world;
index bcd6f2807675e89db6ea3ebd05e9ae95dd70e449..48e23a287d68de3c00eeeb1af9bf9a1531da0882 100644 (file)
@@ -49,8 +49,8 @@ void misc_laser_aim()
        }
 }
 
-void misc_laser_init()
-{SELFPARAM();
+void misc_laser_init(entity this)
+{
        if(self.target != "")
                self.enemy = find(world, targetname, self.target);
 }
@@ -98,7 +98,7 @@ void misc_laser_think()
                                self.count = 1;
 
                                activator = self.enemy.pusher;
-                               WITH(entity, self, self.enemy, SUB_UseTargets());
+                               WITHSELF(self.enemy, SUB_UseTargets());
                        }
                }
                else
@@ -108,7 +108,7 @@ void misc_laser_think()
                                self.count = 0;
 
                                activator = self.enemy.pusher;
-                               WITH(entity, self, self.enemy, SUB_UseTargets());
+                               WITHSELF(self.enemy, SUB_UseTargets());
                        }
                }
        }
index f6919006d47c40b8e25893d582743c7705999969..33401930d8d929c836ee4f16273ae5aa6d90d669 100644 (file)
@@ -26,8 +26,8 @@ bool teleport_dest_send(entity this, entity to, int sf)
 
 void teleport_dest_link()
 {SELFPARAM();
-       //Net_LinkEntity(self, false, 0, teleport_dest_send);
-       //self.SendFlags |= 1; // update
+       Net_LinkEntity(self, false, 0, teleport_dest_send);
+       self.SendFlags |= 1; // update
 }
 
 spawnfunc(info_teleport_destination)
index c834a06a29c5ffb205366067c2c130de624957d7..a2efc1142e316aeee6e4cd5b4ab740cc72a924ea 100644 (file)
@@ -1,6 +1,7 @@
 void generic_plat_blocked()
-{SELFPARAM();
+{
 #ifdef SVQC
+    SELFPARAM();
        if(self.dmg && other.takedamage != DAMAGE_NO)
        {
                if(self.dmgtime2 < time)
index a0f60bb32f03a2f3cd99da0924d6e02c4cd6db09..87c9c329099641e2c1cab962c2f5b8d55d4f26de 100644 (file)
@@ -47,15 +47,15 @@ void SUB_VanishOrRemove (entity ent)
 
 void SUB_SetFade_Think ()
 {SELFPARAM();
-       if(self.alpha == 0)
-               self.alpha = 1;
-       self.SUB_THINK = SUB_SetFade_Think;
-       self.SUB_NEXTTHINK = time;
-       self.alpha -= frametime * self.fade_rate;
-       if (self.alpha < 0.01)
-               SUB_VanishOrRemove(self);
+       if(this.alpha == 0)
+               this.alpha = 1;
+       this.SUB_THINK = SUB_SetFade_Think;
+       this.SUB_NEXTTHINK = time;
+       this.alpha -= frametime * this.fade_rate;
+       if (this.alpha < 0.01)
+               SUB_VanishOrRemove(this);
        else
-               self.SUB_NEXTTHINK = time;
+               this.SUB_NEXTTHINK = time;
 }
 
 /*
@@ -295,7 +295,7 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
 
 void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
 {SELFPARAM();
-       WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
+       WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
 }
 
 /*
@@ -363,5 +363,5 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
 
 void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
 {SELFPARAM();
-       WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
+       WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
 }
index 19ccde9dca08ec764fa86fd5a0a788e915642d36..aebda5d0a33b5a9ac3709b157f2e21a22d69b893 100644 (file)
@@ -29,7 +29,7 @@
 .vector move_origin;
 
        void SUB_SETORIGIN(entity s, vector v)
-       {SELFPARAM();
+       {
                s.move_origin = v;
                _Movetype_LinkEdict(s, true);
        }
diff --git a/qcsrc/common/triggers/target/_mod.inc b/qcsrc/common/triggers/target/_mod.inc
new file mode 100644 (file)
index 0000000..fdfabf7
--- /dev/null
@@ -0,0 +1,8 @@
+// generated file; do not modify
+#include "changelevel.qc"
+#include "include.qc"
+#include "location.qc"
+#include "music.qc"
+#include "spawn.qc"
+#include "speaker.qc"
+#include "voicescript.qc"
index 14512c794cfc960d92555e9e327c4c25f6c71d40..642c72cdbb13645fddb3da24e05e6aeffb47a139 100644 (file)
@@ -1,14 +1,20 @@
 #ifdef SVQC
+void target_push_init(entity this);
+
 spawnfunc(target_location)
 {
     self.classname = "target_location";
     // location name in netname
     // eventually support: count, teamgame selectors, line of sight?
+
+    target_push_init(this);
 }
 
 spawnfunc(info_location)
 {
-    self.classname = "target_location";
-    self.message = self.netname;
+    this.classname = "target_location";
+    this.message = this.netname;
+
+    target_push_init(this);
 }
 #endif
index 52f1fca0e27a723ecf5804b40700ee42074a9394..5a4e86c48b370d0dd65baa1f0553abfc433eefb0 100644 (file)
@@ -36,14 +36,13 @@ void target_music_reset(entity this)
 }
 void target_music_kill()
 {
-       for(self = world; (self = find(self, classname, "target_music")); )
-       {
-               self.volume = 0;
-               if(self.targetname == "")
-                       target_music_sendto(MSG_ALL, 1);
-               else
-                       target_music_sendto(MSG_ALL, 0);
-       }
+       FOREACH_ENTITY_CLASS("target_music", true, {
+               it.volume = 0;
+        if (it.targetname == "")
+            WITHSELF(it, target_music_sendto(MSG_ALL, 1));
+        else
+            WITHSELF(it, target_music_sendto(MSG_ALL, 0));
+       });
 }
 void target_music_use()
 {
index 96c266f6cc57315e2436e3f752321b83405a5ab8..82793c9367f969c04b4ecc6a7361e84cc89d9923 100644 (file)
@@ -221,7 +221,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                        oldactivator = activator;
 
                        activator = act;
-                       WITH(entity, self, e, e.target_spawn_spawnfunc(e));
+                       WITHSELF(e, e.target_spawn_spawnfunc(e));
                        activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.
@@ -297,8 +297,8 @@ void target_spawn_use()
        }
 }
 
-void target_spawn_spawnfirst()
-{SELFPARAM();
+void target_spawn_spawnfirst(entity this)
+{
        activator = self.target_spawn_activator;
        if(self.spawnflags & 2)
                target_spawn_use();
index 40ba61f6519bb96ff5a9f87d6815f154a959a4c7..04667f4cc228391eefab47954ab56695e99d3f10 100644 (file)
@@ -68,7 +68,7 @@ void spawn_tdeath(vector v0, entity e, vector v)
 #endif
 
 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
-{SELFPARAM();
+{
        entity telefragger;
        vector from;
 
@@ -80,6 +80,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
        makevectors (to_angles);
 
 #ifdef SVQC
+    SELFPARAM();
        if(player.teleportable == TELEPORT_NORMAL) // don't play sounds or show particles for anything that isn't a player, maybe change later to block only observers
        {
                if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
@@ -246,7 +247,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
        return e;
 }
 
-void teleport_findtarget()
+void teleport_findtarget(entity this)
 {
        int n = 0;
        entity e;
@@ -298,7 +299,7 @@ entity Teleport_Find(vector mi, vector ma)
 }
 
 void WarpZone_PostTeleportPlayer_Callback(entity pl)
-{SELFPARAM();
+{
 #ifdef SVQC
        makevectors(pl.angles);
        Reset_ArcBeam(pl, v_forward);
index 0e9e23572f323df37678c4bb9eacd98a9b85c361..b0571dc310b4e2c333d8dab4142b62bf0a425f15 100644 (file)
@@ -19,7 +19,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player);
 
 void Teleport_Touch ();
 
-void teleport_findtarget();
+void teleport_findtarget(entity this);
 
 entity Teleport_Find(vector mi, vector ma);
 
diff --git a/qcsrc/common/triggers/trigger/_mod.inc b/qcsrc/common/triggers/trigger/_mod.inc
new file mode 100644 (file)
index 0000000..03fa001
--- /dev/null
@@ -0,0 +1,25 @@
+// generated file; do not modify
+#include "counter.qc"
+#include "delay.qc"
+#include "disablerelay.qc"
+#include "flipflop.qc"
+#include "gamestart.qc"
+#include "gravity.qc"
+#include "heal.qc"
+#include "hurt.qc"
+#include "impulse.qc"
+#include "include.qc"
+#include "jumppads.qc"
+#include "keylock.qc"
+#include "magicear.qc"
+#include "monoflop.qc"
+#include "multi.qc"
+#include "multivibrator.qc"
+#include "relay.qc"
+#include "relay_activators.qc"
+#include "relay_if.qc"
+#include "relay_teamcheck.qc"
+#include "secret.qc"
+#include "swamp.qc"
+#include "teleport.qc"
+#include "viewloc.qc"
index d90e3418caab154454fbafeb36a6c350827bd177..9c0c0791ab3443c3b25672c1dda77b42add84dba 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
-void gamestart_use()
-{SELFPARAM();
+void gamestart_use(entity this)
+{
        activator = self;
        SUB_UseTargets();
        remove(self);
@@ -9,7 +9,7 @@ void gamestart_use()
 void self_spawnfunc_trigger_gamestart();
 spawnfunc(trigger_gamestart)
 {
-       this.use = gamestart_use;
+       setuse(this, gamestart_use);
        this.reset2 = self_spawnfunc_trigger_gamestart;
 
        if(this.wait)
index c2b59a3e0b40b348b25b8ca6f09f8b61955e54e5..b7cd57272dce363c57e103f755e6a126c165019a 100644 (file)
@@ -181,6 +181,7 @@ bool trigger_impulse_send(entity this, entity to, int sf)
 
 void trigger_impulse_link()
 {
+    SELFPARAM();
        trigger_link(self, trigger_impulse_send);
 }
 
@@ -217,24 +218,24 @@ spawnfunc(trigger_impulse)
 #elif defined(CSQC)
 NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
 {
-       self.spawnflags = ReadInt24_t();
-       self.radius = ReadCoord();
-       self.strength = ReadCoord();
-       self.falloff = ReadByte();
-       self.active = ReadByte();
+       this.spawnflags = ReadInt24_t();
+       this.radius = ReadCoord();
+       this.strength = ReadCoord();
+       this.falloff = ReadByte();
+       this.active = ReadByte();
 
        trigger_common_read(true);
        return = true;
 
-       self.classname = "trigger_impulse";
-       self.solid = SOLID_TRIGGER;
-       self.entremove = trigger_remove_generic;
-       //self.draw = trigger_draw_generic;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
+       this.classname = "trigger_impulse";
+       this.solid = SOLID_TRIGGER;
+       this.entremove = trigger_remove_generic;
+       //this.draw = trigger_draw_generic;
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
 
-       if(self.radius) { self.move_touch = trigger_impulse_touch3; }
-       else if(self.target) { self.move_touch = trigger_impulse_touch1; }
-       else { self.move_touch = trigger_impulse_touch2; }
+       if(this.radius) { this.move_touch = trigger_impulse_touch3; }
+       else if(this.target) { this.move_touch = trigger_impulse_touch1; }
+       else { this.move_touch = trigger_impulse_touch2; }
 }
 #endif
index 141fd458f4c865ea878786f61886516e328bdb6a..556fe66358ed00fae0eda7d5bd4786824b43f8d1 100644 (file)
@@ -237,7 +237,7 @@ void trigger_push_touch()
        if(this.enemy.target)
        {
                activator = other;
-               WITH(entity, self, this.enemy, SUB_UseTargets());
+               WITHSELF(this.enemy, SUB_UseTargets());
        }
 
        if (other.flags & FL_PROJECTILE)
@@ -274,31 +274,31 @@ void trigger_push_touch()
 
 #ifdef SVQC
 void trigger_push_link();
-void trigger_push_updatelink();
+void trigger_push_updatelink(entity this);
 #endif
-void trigger_push_findtarget()
-{SELFPARAM();
+void trigger_push_findtarget(entity this)
+{
        entity t;
        vector org;
 
        // first calculate a typical start point for the jump
-       org = (self.absmin + self.absmax) * 0.5;
-       org_z = self.absmax.z - STAT(PL_MIN, NULL).z;
+       org = (this.absmin + this.absmax) * 0.5;
+       org_z = this.absmax.z - STAT(PL_MIN, NULL).z;
 
-       if (self.target)
+       if (this.target)
        {
                float n = 0;
-               for(t = world; (t = find(t, targetname, self.target)); )
+               for(t = world; (t = find(t, targetname, this.target)); )
                {
                        ++n;
 #ifdef SVQC
                        entity e = spawn();
                        setorigin(e, org);
                        setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
-                       e.velocity = trigger_push_calculatevelocity(org, t, self.height);
+                       e.velocity = trigger_push_calculatevelocity(org, t, this.height);
                        tracetoss(e, e);
                        if(e.movetype == MOVETYPE_NONE)
-                               waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+                               waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
                        remove(e);
 #endif
                }
@@ -314,12 +314,12 @@ void trigger_push_findtarget()
                else if(n == 1)
                {
                        // exactly one dest - bots love that
-                       self.enemy = find(world, targetname, self.target);
+                       this.enemy = find(world, targetname, this.target);
                }
                else
                {
                        // have to use random selection every single time
-                       self.enemy = world;
+                       this.enemy = world;
                }
        }
 #ifdef SVQC
@@ -328,14 +328,14 @@ void trigger_push_findtarget()
                entity e = spawn();
                setorigin(e, org);
                setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
-               e.velocity = self.movedir;
+               e.velocity = this.movedir;
                tracetoss(e, e);
-               waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+               waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
                remove(e);
        }
 
        trigger_push_link();
-       defer(self, 0.1, trigger_push_updatelink);
+       defer(this, 0.1, trigger_push_updatelink);
 #endif
 }
 
@@ -344,24 +344,25 @@ float trigger_push_send(entity this, entity to, float sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
 
-       WriteByte(MSG_ENTITY, self.team);
-       WriteInt24_t(MSG_ENTITY, self.spawnflags);
-       WriteByte(MSG_ENTITY, self.active);
-       WriteCoord(MSG_ENTITY, self.height);
+       WriteByte(MSG_ENTITY, this.team);
+       WriteInt24_t(MSG_ENTITY, this.spawnflags);
+       WriteByte(MSG_ENTITY, this.active);
+       WriteCoord(MSG_ENTITY, this.height);
 
-       trigger_common_write(self, true);
+       trigger_common_write(this, true);
 
        return true;
 }
 
-void trigger_push_updatelink()
-{SELFPARAM();
-       self.SendFlags |= 1;
+void trigger_push_updatelink(entity this)
+{
+       this.SendFlags |= 1;
 }
 
 void trigger_push_link()
 {
-       trigger_link(self, trigger_push_send);
+    SELFPARAM();
+       trigger_link(this, trigger_push_send);
 }
 
 /*
@@ -378,25 +379,25 @@ void trigger_push_link()
  */
 spawnfunc(trigger_push)
 {
-       SetMovedir(self);
+       SetMovedir(this);
 
-       trigger_init(self);
+       trigger_init(this);
 
-       self.active = ACTIVE_ACTIVE;
-       self.use = trigger_push_use;
-       self.touch = trigger_push_touch;
+       this.active = ACTIVE_ACTIVE;
+       this.use = trigger_push_use;
+       this.touch = trigger_push_touch;
 
        // normal push setup
-       if (!self.speed)
-               self.speed = 1000;
-       self.movedir = self.movedir * self.speed * 10;
+       if (!this.speed)
+               this.speed = 1000;
+       this.movedir = this.movedir * this.speed * 10;
 
-       if (!self.noise)
-               self.noise = "misc/jumppad.wav";
-       precache_sound (self.noise);
+       if (!this.noise)
+               this.noise = "misc/jumppad.wav";
+       precache_sound (this.noise);
 
        // this must be called to spawn the teleport waypoints for bots
-       InitializeEntity(self, trigger_push_findtarget, INITPRIO_FINDTARGET);
+       InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
 }
 
 
@@ -404,15 +405,15 @@ bool target_push_send(entity this, entity to, float sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
 
-       WriteByte(MSG_ENTITY, self.cnt);
-       WriteString(MSG_ENTITY, self.targetname);
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
+       WriteByte(MSG_ENTITY, this.cnt);
+       WriteString(MSG_ENTITY, this.targetname);
+       WriteCoord(MSG_ENTITY, this.origin_x);
+       WriteCoord(MSG_ENTITY, this.origin_y);
+       WriteCoord(MSG_ENTITY, this.origin_z);
 
-       WriteAngle(MSG_ENTITY, self.angles_x);
-       WriteAngle(MSG_ENTITY, self.angles_y);
-       WriteAngle(MSG_ENTITY, self.angles_z);
+       WriteAngle(MSG_ENTITY, this.angles_x);
+       WriteAngle(MSG_ENTITY, this.angles_y);
+       WriteAngle(MSG_ENTITY, this.angles_z);
 
        return true;
 }
@@ -441,21 +442,21 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
 {
        make_pure(this);
 
-       self.classname = "jumppad";
-       int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
-       self.spawnflags = ReadInt24_t();
-       self.active = ReadByte();
-       self.height = ReadCoord();
+       this.classname = "jumppad";
+       int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
+       this.spawnflags = ReadInt24_t();
+       this.active = ReadByte();
+       this.height = ReadCoord();
 
        trigger_common_read(true);
 
-       self.entremove = trigger_remove_generic;
-       self.solid = SOLID_TRIGGER;
-       //self.draw = trigger_draw_generic;
-       self.move_touch = trigger_push_touch;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
-       defer(self, 0.25, trigger_push_findtarget);
+       this.entremove = trigger_remove_generic;
+       this.solid = SOLID_TRIGGER;
+       //this.draw = trigger_draw_generic;
+       this.move_touch = trigger_push_touch;
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
+       defer(this, 0.25, trigger_push_findtarget);
 
        return true;
 }
@@ -473,22 +474,22 @@ void target_push_remove(entity this)
 
 NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
 {
-       self.classname = "push_target";
-       self.cnt = ReadByte();
-       self.targetname = strzone(ReadString());
-       self.origin_x = ReadCoord();
-       self.origin_y = ReadCoord();
-       self.origin_z = ReadCoord();
+       this.classname = "push_target";
+       this.cnt = ReadByte();
+       this.targetname = strzone(ReadString());
+       this.origin_x = ReadCoord();
+       this.origin_y = ReadCoord();
+       this.origin_z = ReadCoord();
 
-       self.angles_x = ReadAngle();
-       self.angles_y = ReadAngle();
-       self.angles_z = ReadAngle();
+       this.angles_x = ReadAngle();
+       this.angles_y = ReadAngle();
+       this.angles_z = ReadAngle();
 
        return = true;
 
-       setorigin(self, self.origin);
+       setorigin(this, this.origin);
 
-       self.drawmask = MASK_NORMAL;
-       self.entremove = target_push_remove;
+       this.drawmask = MASK_NORMAL;
+       this.entremove = target_push_remove;
 }
 #endif
index 0c4180849667aeef916314c2c128486052954367..07973614b88a23ae9a24ed8a6a70030706ede592 100644 (file)
@@ -38,7 +38,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
 void trigger_push_touch();
 
 .vector dest;
-void trigger_push_findtarget();
+void trigger_push_findtarget(entity this);
 
 /*
  * ENTITY PARAMETERS:
index 500f8f32f8f5f251d13bbedccd0f16c45d23ca84..3f0a4b27fef60d5058fba15f2298da394ae14950 100644 (file)
@@ -111,7 +111,7 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
        {
                this.enemy = attacker;
                this.goalentity = inflictor;
-               WITH(entity, self, this, multi_trigger());
+               WITHSELF(this, multi_trigger());
        }
 }
 
@@ -147,19 +147,14 @@ spawnfunc(trigger_multiple)
 {
        self.reset = multi_reset;
        if (self.sounds == 1)
-       {
-               precache_sound ("misc/secret.wav");
                self.noise = "misc/secret.wav";
-       }
        else if (self.sounds == 2)
-       {
                self.noise = strzone(SND(TALK));
-       }
        else if (self.sounds == 3)
-       {
-               precache_sound ("misc/trigger1.wav");
                self.noise = "misc/trigger1.wav";
-       }
+
+       if(self.noise)
+               precache_sound(self.noise);
 
        if (!self.wait)
                self.wait = 0.2;
index 9be241e7f49e2c0b56b8ca50740334abb24b5ed2..f94cd00ad9680e5b61b203c2c2b4e9eeaa10c3eb 100644 (file)
@@ -10,8 +10,8 @@
 
 void secrets_setstatus()
 {SELFPARAM();
-       self.stat_secrets_total = secrets_total;
-       self.stat_secrets_found = secrets_found;
+       this.stat_secrets_total = secrets_total;
+       this.stat_secrets_found = secrets_found;
 }
 
 /**
index be8040079b91f36670492816498228debff65bfa..92ae805b5259641dd9e8cb3bd174b5df9b642a3e 100644 (file)
@@ -54,7 +54,7 @@ void Teleport_Touch ()
        SUB_UseTargets();
        if (!self.target) self.target = s;
 
-       WITH(entity, self, e, SUB_UseTargets());
+       WITHSELF(e, SUB_UseTargets());
 #endif
 }
 
index f7e69495228b97987d3dbd636c93015c1ca2e4b8..db75434bfb6f98bd226f81bc72c07bbec718683b 100644 (file)
@@ -55,8 +55,8 @@ bool trigger_viewloc_send(entity this, entity to, int sf)
        return true;
 }
 
-void viewloc_init()
-{SELFPARAM();
+void viewloc_init(entity this)
+{
        entity e;
        for(e = world; (e = find(e, targetname, self.target)); )
                if(e.classname == "target_viewlocation_start")
index 29cb70a7dcc935990309119f1acf2e403806ff18..1ca03fd4fefc819113b7b6aaae62ba1c9009d8aa 100644 (file)
@@ -4,9 +4,9 @@ void() SUB_UseTargets;
 
 void DelayThink()
 {SELFPARAM();
-       activator = self.enemy;
+       activator = this.enemy;
        SUB_UseTargets ();
-       remove(self);
+       remove(this);
 }
 
 void FixSize(entity e)
@@ -25,7 +25,7 @@ void FixSize(entity e)
 void trigger_init(entity this)
 {
        string m = this.model;
-       WITH(entity, self, this, WarpZoneLib_ExactTrigger_Init());
+       WITHSELF(this, WarpZoneLib_ExactTrigger_Init());
        if(m != "")
        {
                precache_model(m);
@@ -96,51 +96,51 @@ void trigger_common_write(entity this, bool withtarget)
 void trigger_common_read(bool withtarget)
 {SELFPARAM();
        int f = ReadByte();
-       self.warpzone_isboxy = (f & 1);
+       this.warpzone_isboxy = (f & 1);
 
        if(withtarget)
        {
-               if(self.target) { strunzone(self.target); }
-               self.target = strzone(ReadString());
-               if(self.target2) { strunzone(self.target2); }
-               self.target2 = strzone(ReadString());
-               if(self.target3) { strunzone(self.target3); }
-               self.target3 = strzone(ReadString());
-               if(self.target4) { strunzone(self.target4); }
-               self.target4 = strzone(ReadString());
-               if(self.targetname) { strunzone(self.targetname); }
-               self.targetname = strzone(ReadString());
-               if(self.killtarget) { strunzone(self.killtarget); }
-               self.killtarget = strzone(ReadString());
+               if(this.target) { strunzone(this.target); }
+               this.target = strzone(ReadString());
+               if(this.target2) { strunzone(this.target2); }
+               this.target2 = strzone(ReadString());
+               if(this.target3) { strunzone(this.target3); }
+               this.target3 = strzone(ReadString());
+               if(this.target4) { strunzone(this.target4); }
+               this.target4 = strzone(ReadString());
+               if(this.targetname) { strunzone(this.targetname); }
+               this.targetname = strzone(ReadString());
+               if(this.killtarget) { strunzone(this.killtarget); }
+               this.killtarget = strzone(ReadString());
        }
 
        if(f & 4)
        {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
        }
        else
-               self.origin = '0 0 0';
-       setorigin(self, self.origin);
-
-       self.modelindex = ReadShort();
-       self.mins_x = ReadCoord();
-       self.mins_y = ReadCoord();
-       self.mins_z = ReadCoord();
-       self.maxs_x = ReadCoord();
-       self.maxs_y = ReadCoord();
-       self.maxs_z = ReadCoord();
-       self.scale = ReadByte() / 16;
-       setsize(self, self.mins, self.maxs);
-
-       self.movedir_x = ReadCoord();
-       self.movedir_y = ReadCoord();
-       self.movedir_z = ReadCoord();
-
-       self.angles_x = ReadCoord();
-       self.angles_y = ReadCoord();
-       self.angles_z = ReadCoord();
+               this.origin = '0 0 0';
+       setorigin(this, this.origin);
+
+       this.modelindex = ReadShort();
+       this.mins_x = ReadCoord();
+       this.mins_y = ReadCoord();
+       this.mins_z = ReadCoord();
+       this.maxs_x = ReadCoord();
+       this.maxs_y = ReadCoord();
+       this.maxs_z = ReadCoord();
+       this.scale = ReadByte() / 16;
+       setsize(this, this.mins, this.maxs);
+
+       this.movedir_x = ReadCoord();
+       this.movedir_y = ReadCoord();
+       this.movedir_z = ReadCoord();
+
+       this.angles_x = ReadCoord();
+       this.angles_y = ReadCoord();
+       this.angles_z = ReadCoord();
 }
 
 void trigger_remove_generic(entity this)
@@ -193,19 +193,19 @@ void SUB_UseTargets()
 //
 // check for a delay
 //
-       if (self.delay)
+       if (this.delay)
        {
        // create a temp object to fire at a later time
                t = new(DelayedUse);
-               t.nextthink = time + self.delay;
+               t.nextthink = time + this.delay;
                t.think = DelayThink;
                t.enemy = activator;
-               t.message = self.message;
-               t.killtarget = self.killtarget;
-               t.target = self.target;
-               t.target2 = self.target2;
-               t.target3 = self.target3;
-               t.target4 = self.target4;
+               t.message = this.message;
+               t.killtarget = this.killtarget;
+               t.target = this.target;
+               t.target2 = this.target2;
+               t.target3 = this.target3;
+               t.target4 = this.target4;
                return;
        }
 
@@ -214,19 +214,19 @@ void SUB_UseTargets()
 // print the message
 //
 #ifdef SVQC
-       if(self)
-       if(IS_PLAYER(activator) && self.message != "")
+       if(this)
+       if(IS_PLAYER(activator) && this.message != "")
        if(IS_REAL_CLIENT(activator))
        {
-               centerprint(activator, self.message);
-               if (self.noise == "")
+               centerprint(activator, this.message);
+               if (this.noise == "")
                        play2(activator, SND(TALK));
        }
 
 //
 // kill the killtagets
 //
-       s = self.killtarget;
+       s = this.killtarget;
        if (s != "")
        {
                for(t = world; (t = find(t, targetname, s)); )
@@ -257,7 +257,7 @@ void SUB_UseTargets()
                {
                        // Flag to set func_clientwall state
                        // 1 == deactivate, 2 == activate, 0 == do nothing
-                       float aw_flag = self.antiwall_flag;
+                       float aw_flag = this.antiwall_flag;
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
@@ -308,7 +308,7 @@ void trigger_touch_generic(entity this, void() touchfunc)
                if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
                {
                        other = e;
-                       WITH(entity, self, this, touchfunc());
+                       WITHSELF(this, touchfunc());
                }
        }
 }
diff --git a/qcsrc/common/turrets/_mod.inc b/qcsrc/common/turrets/_mod.inc
new file mode 100644 (file)
index 0000000..552a805
--- /dev/null
@@ -0,0 +1,8 @@
+// generated file; do not modify
+#include "all.qc"
+#include "checkpoint.qc"
+#include "cl_turrets.qc"
+#include "config.qc"
+#include "sv_turrets.qc"
+#include "targettrigger.qc"
+#include "util.qc"
diff --git a/qcsrc/common/turrets/all.inc b/qcsrc/common/turrets/all.inc
deleted file mode 100644 (file)
index 5c9f1e1..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "turret/ewheel.qc"
-#include "turret/flac.qc"
-#include "turret/fusionreactor.qc"
-#include "turret/hellion.qc"
-#include "turret/hk.qc"
-#include "turret/machinegun.qc"
-#include "turret/mlrs.qc"
-#include "turret/phaser.qc"
-#include "turret/plasma.qc"
-#include "turret/plasma_dual.qc"
-#include "turret/tesla.qc"
-#include "turret/walker.qc"
index 2d40f17d01eb3037eb201451905bde4cf0b6bd7f..469a64c9274b240758ebd40eeeb8d4f19576d767 100644 (file)
@@ -7,7 +7,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_TURRET)
 #endif
 
 #define IMPLEMENTATION
-#include "all.inc"
+#include "turret/_mod.inc"
 #undef IMPLEMENTATION
 
 #ifdef CSQC
index 29e1fb5a66aed5db580e1fa606a93b1c701f715c..a993b9218a22cf77ae2df4f80870d2115b3b9fde 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRETS_ALL_H
 #define TURRETS_ALL_H
 
-#include "../command/all.qh"
+#include <common/command/all.qh>
 #include "config.qh"
 
 #include "turret.qh"
@@ -74,6 +74,6 @@ const int TUR_FIRST = 1;
 
 REGISTER_TURRET(Null, NEW(Turret));
 
-#include "all.inc"
+#include "turret/_mod.inc"
 
 #endif
index fec1e885f1e0cce7d1b5c3fac6ad2fdb48372336..1502be25114f1ddfb5bf90192c796d9f37d2febb 100644 (file)
@@ -455,14 +455,15 @@ void turret_projectile_damage(entity this, entity inflictor, entity attacker, fl
        this.health     -= damage;
        //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
 }
 
-entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
+entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
 {SELFPARAM();
+    TC(Sound, _snd);
        entity proj;
 
-       _sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
+       sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
        proj                             = spawn ();
        setorigin(proj, self.tur_shotorg);
        setsize(proj, '-0.5 -0.5 -0.5' * _size, '0.5 0.5 0.5' * _size);
index 2d5a5f5f9d00526e67b110d8f9849a42a203efb2..622f2360f7d0aec8fd6ad109129a04e98972ffa8 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SV_TURRETS_H
 #define SV_TURRETS_H
 
-entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
+entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
 void turret_projectile_explode();
 float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
 float turret_firecheck();
index 9e315e271aeef05864d8f55d0be42261dd62f426..5ac3c2ef6446cbdc865f6d3a0d774edc2ab96f8f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_H
 #define TURRET_H
 
-#include "../weapons/all.qh"
+#include <common/weapons/all.qh>
 
 CLASS(Turret, Object)
     ATTRIB(Turret, m_id, int, 0)
diff --git a/qcsrc/common/turrets/turret/_mod.inc b/qcsrc/common/turrets/turret/_mod.inc
new file mode 100644 (file)
index 0000000..3673214
--- /dev/null
@@ -0,0 +1,23 @@
+// generated file; do not modify
+#include "ewheel.qc"
+#include "ewheel_weapon.qc"
+#include "flac.qc"
+#include "flac_weapon.qc"
+#include "fusionreactor.qc"
+#include "hellion.qc"
+#include "hellion_weapon.qc"
+#include "hk.qc"
+#include "hk_weapon.qc"
+#include "machinegun.qc"
+#include "machinegun_weapon.qc"
+#include "mlrs.qc"
+#include "mlrs_weapon.qc"
+#include "phaser.qc"
+#include "phaser_weapon.qc"
+#include "plasma.qc"
+#include "plasma_dual.qc"
+#include "plasma_weapon.qc"
+#include "tesla.qc"
+#include "tesla_weapon.qc"
+#include "walker.qc"
+#include "walker_weapon.qc"
index 2a537d4e98fdc889f94ebb10ad1b2c1873637925..798e141ecd2e5caa4e12765eee020ab8830a0f6c 100644 (file)
@@ -3,7 +3,7 @@
 
 //#define EWHEEL_FANCYPATH
 
-#include "ewheel_weapon.qc"
+#include "ewheel_weapon.qh"
 
 CLASS(EWheel, Turret)
 /* spawnflags */ ATTRIB(EWheel, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE | TUR_FLAG_ROAM);
@@ -22,8 +22,6 @@ REGISTER_TURRET(EWHEEL, NEW(EWheel));
 
 #ifdef IMPLEMENTATION
 
-#include "ewheel_weapon.qc"
-
 #ifdef SVQC
 
 float autocvar_g_turrets_unit_ewheel_speed_fast;
index e7ce7050021ac175bac93a5e8f25bacc4a5cedb2..50212458f22ef14b41e37dd1230c824a2f1590a1 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_EWHEEL_WEAPON_H
-#define TURRET_EWHEEL_WEAPON_H
-
-CLASS(EWheelAttack, PortoLaunch)
-/* flags     */ ATTRIB(EWheelAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(EWheelAttack, impulse, int, 5);
-/* refname   */ ATTRIB(EWheelAttack, netname, string, "turret_ewheel");
-/* wepname   */ ATTRIB(EWheelAttack, m_name, string, _("eWheel"));
-ENDCLASS(EWheelAttack)
-REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
-
-#endif
+#include "ewheel_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -23,7 +12,7 @@ METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, .entity weapon
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(EWheelAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_EWheelAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
@@ -32,7 +21,7 @@ METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, .entity weapon
 
         turret_do_updates(actor);
 
-        entity missile = turret_projectile(SND(LASERGUN_FIRE), 1, 0, DEATH_TURRET_EWHEEL.m_id, PROJECTILE_BLASTER, true, true);
+        entity missile = turret_projectile(SND_LASERGUN_FIRE, 1, 0, DEATH_TURRET_EWHEEL.m_id, PROJECTILE_BLASTER, true, true);
         missile.missile_flags = MIF_SPLASH;
 
         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
diff --git a/qcsrc/common/turrets/turret/ewheel_weapon.qh b/qcsrc/common/turrets/turret/ewheel_weapon.qh
new file mode 100644 (file)
index 0000000..974a32c
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(EWheelAttack, PortoLaunch)
+/* flags     */ ATTRIB(EWheelAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(EWheelAttack, impulse, int, 5);
+/* refname   */ ATTRIB(EWheelAttack, netname, string, "turret_ewheel");
+/* wepname   */ ATTRIB(EWheelAttack, m_name, string, _("eWheel"));
+ENDCLASS(EWheelAttack)
+REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
index faaf89ffc0348ed7816ec11ca6a996c4ad07cfaa..6bd6a3ff1462389ec9eb65649826614722e7470a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_FLAC_H
 #define TURRET_FLAC_H
 
-#include "flac_weapon.qc"
+#include "flac_weapon.qh"
 
 CLASS(Flac, Turret)
 /* spawnflags */ ATTRIB(Flac, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_MISSILE);
@@ -20,8 +20,6 @@ REGISTER_TURRET(FLAC, NEW(Flac));
 
 #ifdef IMPLEMENTATION
 
-#include "flac_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_flac) { if (!turret_initialize(TUR_FLAC)) remove(self); }
index f4bc70ccc1853acf8d2d381a2941c026e6e5ac61..175fa7617ffdc24812da3130256d2fc7561dadfe 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_FLAC_WEAPON_H
-#define TURRET_FLAC_WEAPON_H
-
-CLASS(FlacAttack, PortoLaunch)
-/* flags     */ ATTRIB(FlacAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(FlacAttack, impulse, int, 5);
-/* refname   */ ATTRIB(FlacAttack, netname, string, "turret_flac");
-/* wepname   */ ATTRIB(FlacAttack, m_name, string, _("FLAC"));
-ENDCLASS(FlacAttack)
-REGISTER_WEAPON(FLAC, NEW(FlacAttack));
-
-#endif
+#include "flac_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -23,7 +12,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(FlacAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_FlacAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
@@ -33,7 +22,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen
 
         turret_tag_fire_update();
 
-        entity proj = turret_projectile(SND(HAGAR_FIRE), 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true);
+        entity proj = turret_projectile(SND_HAGAR_FIRE, 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true);
         proj.missile_flags = MIF_SPLASH | MIF_PROXY;
         proj.think       = turret_flac_projectile_think_explode;
         proj.nextthink  = time + actor.tur_impacttime + (random() * 0.01 - random() * 0.01);
diff --git a/qcsrc/common/turrets/turret/flac_weapon.qh b/qcsrc/common/turrets/turret/flac_weapon.qh
new file mode 100644 (file)
index 0000000..7857f2f
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(FlacAttack, PortoLaunch)
+/* flags     */ ATTRIB(FlacAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(FlacAttack, impulse, int, 5);
+/* refname   */ ATTRIB(FlacAttack, netname, string, "turret_flac");
+/* wepname   */ ATTRIB(FlacAttack, m_name, string, _("FLAC"));
+ENDCLASS(FlacAttack)
+REGISTER_WEAPON(FLAC, NEW(FlacAttack));
index 8ea1cbbd47f28f0e8b08b3bb268f4e58c9dd4ada..5c253d4c571ab9df1a7025f3f1b5a4136fd9618a 100644 (file)
@@ -56,6 +56,7 @@ METHOD(FusionReactor, tr_attack, void(FusionReactor this, entity it))
 }
 METHOD(FusionReactor, tr_think, void(FusionReactor thistur, entity it))
 {
+    SELFPARAM();
     self.tur_head.avelocity = '0 250 0' * (self.ammo / self.ammo_max);
 }
 METHOD(FusionReactor, tr_setup, void(FusionReactor this, entity it))
index 6f5d6f6bd8dd05ff0907bc1c3a3ec375076cc6f8..ef279f7611fd767cbdcc2e289489b91edf68579b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_HELLION_H
 #define TURRET_HELLION_H
 
-#include "hellion_weapon.qc"
+#include "hellion_weapon.qh"
 
 CLASS(Hellion, Turret)
 /* spawnflags */ ATTRIB(Hellion, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
@@ -20,14 +20,13 @@ REGISTER_TURRET(HELLION, NEW(Hellion));
 
 #ifdef IMPLEMENTATION
 
-#include "hellion_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_hellion) { if (!turret_initialize(TUR_HELLION)) remove(self); }
 
 METHOD(Hellion, tr_think, void(Hellion thistur, entity it))
 {
+    SELFPARAM();
     if (self.tur_head.frame != 0)
         self.tur_head.frame += 1;
 
index 0b118be1364e74cef956fe16448f940e47fe6faf..7df79c8c7e03d41f1c1fc214047b51b8abac9674 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_HELLION_WEAPON_H
-#define TURRET_HELLION_WEAPON_H
-
-CLASS(HellionAttack, PortoLaunch)
-/* flags     */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(HellionAttack, impulse, int, 9);
-/* refname   */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
-/* wepname   */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
-ENDCLASS(HellionAttack)
-REGISTER_WEAPON(HELLION, NEW(HellionAttack));
-
-#endif
+#include "hellion_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -26,7 +15,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(HellionAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_HellionAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
@@ -40,7 +29,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo
                 actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire2"));
         }
 
-        entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
+        entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
         te_explosion (missile.origin);
         missile.think          = turret_hellion_missile_think;
         missile.nextthink      = time;
diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qh b/qcsrc/common/turrets/turret/hellion_weapon.qh
new file mode 100644 (file)
index 0000000..88ac336
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(HellionAttack, PortoLaunch)
+/* flags     */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(HellionAttack, impulse, int, 9);
+/* refname   */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
+/* wepname   */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
+ENDCLASS(HellionAttack)
+REGISTER_WEAPON(HELLION, NEW(HellionAttack));
index 945dd48afae83a919094508a027de25644a37bd0..4e7b4513818e1b0e264e080fdf23a44361541bf6 100644 (file)
@@ -3,7 +3,7 @@
 
 //#define TURRET_DEBUG_HK
 
-#include "hk_weapon.qc"
+#include "hk_weapon.qh"
 
 CLASS(HunterKiller, Turret)
 /* spawnflags */ ATTRIB(HunterKiller, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER | TUR_FLAG_RECIEVETARGETS);
@@ -22,8 +22,6 @@ REGISTER_TURRET(HK, NEW(HunterKiller));
 
 #ifdef IMPLEMENTATION
 
-#include "hk_weapon.qc"
-
 #ifdef SVQC
 
 #ifdef TURRET_DEBUG_HK
@@ -34,6 +32,7 @@ spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK)) remove(self); }
 
 METHOD(HunterKiller, tr_think, void(HunterKiller thistur, entity it))
 {
+    SELFPARAM();
     if (self.tur_head.frame != 0)
         self.tur_head.frame = self.tur_head.frame + 1;
 
index 5060e577238abd5048ea7dedb5cf389705b1dd60..319a579cf2bac4d537e4d2c497f329f75bd2d409 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_HK_WEAPON_H
-#define TURRET_HK_WEAPON_H
-
-CLASS(HunterKillerAttack, PortoLaunch)
-/* flags     */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(HunterKillerAttack, impulse, int, 9);
-/* refname   */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
-/* wepname   */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
-ENDCLASS(HunterKillerAttack)
-REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
-
-#endif
+#include "hk_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -31,13 +20,13 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity
        if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
                if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(HunterKillerAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_HunterKillerAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
-        entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
+        entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
         te_explosion (missile.origin);
 
         missile.think = turret_hk_missile_think;
diff --git a/qcsrc/common/turrets/turret/hk_weapon.qh b/qcsrc/common/turrets/turret/hk_weapon.qh
new file mode 100644 (file)
index 0000000..87e0c88
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(HunterKillerAttack, PortoLaunch)
+/* flags     */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(HunterKillerAttack, impulse, int, 9);
+/* refname   */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
+/* wepname   */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
+ENDCLASS(HunterKillerAttack)
+REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
index 61f256d7acbb4eb41568dcb8843a16bda569d390..e919026570af16da0598a4dbb9dbaff79b2473ac 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_MACHINEGUN_H
 #define TURRET_MACHINEGUN_H
 
-#include "machinegun_weapon.qc"
+#include "machinegun_weapon.qh"
 
 CLASS(MachineGunTurret, Turret)
 /* spawnflags */ ATTRIB(MachineGunTurret, spawnflags, int, TUR_FLAG_PLAYER);
@@ -20,8 +20,6 @@ REGISTER_TURRET(MACHINEGUN, NEW(MachineGunTurret));
 
 #ifdef IMPLEMENTATION
 
-#include "machinegun_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_machinegun) { if (!turret_initialize(TUR_MACHINEGUN)) remove(self); }
index 7bd8b4086890ac2c65433cfe17358afb5f3a8db1..853750f6caf7fd839b3a7d4e50d4d38ec0b23440 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_MACHINEGUN_WEAPON_H
-#define TURRET_MACHINEGUN_WEAPON_H
-
-CLASS(MachineGunTurretAttack, PortoLaunch)
-/* flags     */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
-/* refname   */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
-/* wepname   */ ATTRIB(MachineGunTurretAttack, m_name, string, _("Machinegun"));
-ENDCLASS(MachineGunTurretAttack)
-REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
-
-#endif
+#include "machinegun_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -24,13 +13,13 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .ent
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(MachineGunTurretAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_MachineGunTurretAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
         }
-        fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
+        fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
         W_MachineGun_MuzzleFlash();
         setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
     }
diff --git a/qcsrc/common/turrets/turret/machinegun_weapon.qh b/qcsrc/common/turrets/turret/machinegun_weapon.qh
new file mode 100644 (file)
index 0000000..30163bc
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(MachineGunTurretAttack, PortoLaunch)
+/* flags     */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
+/* refname   */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
+/* wepname   */ ATTRIB(MachineGunTurretAttack, m_name, string, _("Machinegun"));
+ENDCLASS(MachineGunTurretAttack)
+REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
index c1302548d83fec358ac20bad5d9acd335e099049..43710b6c02f91e6b82ee5eb220b8a41874484d6a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_MLRS_H
 #define TURRET_MLRS_H
 
-#include "mlrs_weapon.qc"
+#include "mlrs_weapon.qh"
 
 CLASS(MLRSTurret, Turret)
 /* spawnflags */ ATTRIB(MLRSTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
@@ -20,14 +20,13 @@ REGISTER_TURRET(MLRS, NEW(MLRSTurret));
 
 #ifdef IMPLEMENTATION
 
-#include "mlrs_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(self); }
 
 METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur, entity it))
 {
+    SELFPARAM();
     // 0 = full, 6 = empty
     self.tur_head.frame = bound(0, 6 - floor(0.1 + self.ammo / self.shot_dmg), 6);
     if(self.tur_head.frame < 0)
index 864c37cda2784804a5aeeed472e23c950be2868e..2f8dd65e9f48fae08d4c6e53a704cc95bb4365dd 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_MLRS_WEAPON_H
-#define TURRET_MLRS_WEAPON_H
-
-CLASS(MLRSTurretAttack, PortoLaunch)
-/* flags     */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
-/* refname   */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
-/* wepname   */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
-ENDCLASS(MLRSTurretAttack)
-REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
-
-#endif
+#include "mlrs_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -22,7 +11,7 @@ METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, .entity we
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(MLRSTurretAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_MLRSTurretAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
@@ -30,7 +19,7 @@ METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, .entity we
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
         }
         turret_tag_fire_update();
-        entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_MLRS.m_id, PROJECTILE_ROCKET, true, true);
+        entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_MLRS.m_id, PROJECTILE_ROCKET, true, true);
         missile.nextthink = time + max(actor.tur_impacttime,(actor.shot_radius * 2) / actor.shot_speed);
         missile.missile_flags = MIF_SPLASH;
         te_explosion (missile.origin);
diff --git a/qcsrc/common/turrets/turret/mlrs_weapon.qh b/qcsrc/common/turrets/turret/mlrs_weapon.qh
new file mode 100644 (file)
index 0000000..c583842
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(MLRSTurretAttack, PortoLaunch)
+/* flags     */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
+/* refname   */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
+/* wepname   */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
+ENDCLASS(MLRSTurretAttack)
+REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
index edfa88f521c867870b38fabf4f915d2afc6bfa09..e4c0c119a434af41591fd94a3527a06a35af226a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_PHASER_H
 #define TURRET_PHASER_H
 
-#include "phaser_weapon.qc"
+#include "phaser_weapon.qh"
 
 CLASS(PhaserTurret, Turret)
 /* spawnflags */ ATTRIB(PhaserTurret, spawnflags, int, TUR_FLAG_SNIPER | TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER);
@@ -20,14 +20,15 @@ REGISTER_TURRET(PHASER, NEW(PhaserTurret));
 
 #ifdef IMPLEMENTATION
 
-#include "phaser_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); }
 
+.int fireflag;
+
 METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it))
 {
+    SELFPARAM();
     if (self.tur_head.frame != 0)
     {
         if (self.fireflag == 1)
index 8c1134eaf0baeb1e7f0fdfbebfaa0cf6212355f8..440bdf6a7299a6271363f3968b03a55d258d0db5 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_PHASER_WEAPON_H
-#define TURRET_PHASER_WEAPON_H
-
-CLASS(PhaserTurretAttack, PortoLaunch)
-/* flags     */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
-/* refname   */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
-/* wepname   */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
-ENDCLASS(PhaserTurretAttack)
-REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
-
-#endif
+#include "phaser_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -25,7 +14,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(PhaserTurretAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qh b/qcsrc/common/turrets/turret/phaser_weapon.qh
new file mode 100644 (file)
index 0000000..326a90e
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(PhaserTurretAttack, PortoLaunch)
+/* flags     */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
+/* refname   */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
+/* wepname   */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
+ENDCLASS(PhaserTurretAttack)
+REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
index 37bdd93299978f50f11671369fccdd897a8618ba..5b2fd0f35fc363602e0abb9d20e2437385b94401 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_PLASMA_H
 #define TURRET_PLASMA_H
 
-#include "plasma_weapon.qc"
+#include "plasma_weapon.qh"
 
 CLASS(PlasmaTurret, Turret)
 /* spawnflags */ ATTRIB(PlasmaTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
@@ -20,8 +20,6 @@ REGISTER_TURRET(PLASMA, NEW(PlasmaTurret));
 
 #ifdef IMPLEMENTATION
 
-#include "plasma_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_plasma) { if (!turret_initialize(TUR_PLASMA)) remove(self); }
@@ -48,6 +46,7 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it))
 }
 METHOD(PlasmaTurret, tr_think, void(PlasmaTurret thistur, entity it))
 {
+    SELFPARAM();
     if (self.tur_head.frame != 0)
         self.tur_head.frame = self.tur_head.frame + 1;
 
index 183d4d96512a564139a8789cf12526add639742e..55226bd864d47f87d92c9caa3fa819bb6b5a7cc9 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef TURRET_PLASMA_DUAL_H
 #define TURRET_PLASMA_DUAL_H
 
+#include "plasma_weapon.qh"
+
 CLASS(PlasmaDualAttack, PlasmaAttack)
 /* refname   */ ATTRIB(PlasmaDualAttack, netname, string, "turret_plasma_dual");
 /* wepname   */ ATTRIB(PlasmaDualAttack, m_name, string, _("Dual plasma"));
@@ -28,8 +30,9 @@ REGISTER_TURRET(PLASMA_DUAL, NEW(DualPlasmaTurret));
 
 spawnfunc(turret_plasma_dual) { if (!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
 
-METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this, entity it))
+METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it))
 {
+    SELFPARAM();
     if (g_instagib) {
         FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
@@ -41,12 +44,13 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this, entity it))
         vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
         WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
     } else {
-        SUPER(PlasmaTurret).tr_attack(this, it);
+        SUPER(PlasmaTurret).tr_attack(thistur, it);
     }
     self.tur_head.frame += 1;
 }
 METHOD(DualPlasmaTurret, tr_think, void(DualPlasmaTurret thistur, entity it))
 {
+    SELFPARAM();
     if ((self.tur_head.frame != 0) && (self.tur_head.frame != 3))
         self.tur_head.frame = self.tur_head.frame + 1;
 
index 65e182be387b25781eef23f05f1a166f70ab67d2..0d61df550c45e9161900af00547f3bd1981b307a 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_PLASMA_WEAPON_H
-#define TURRET_PLASMA_WEAPON_H
-
-CLASS(PlasmaAttack, PortoLaunch)
-/* flags     */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(PlasmaAttack, impulse, int, 5);
-/* refname   */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
-/* wepname   */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
-ENDCLASS(PlasmaAttack)
-REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
-
-#endif
+#include "plasma_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -21,13 +10,13 @@ METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, .entity weapon
        if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
                if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(PlasmaAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_PlasmaAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
-        entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true);
+        entity missile = turret_projectile(SND_HAGAR_FIRE, 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true);
         missile.missile_flags = MIF_SPLASH;
         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
        }
diff --git a/qcsrc/common/turrets/turret/plasma_weapon.qh b/qcsrc/common/turrets/turret/plasma_weapon.qh
new file mode 100644 (file)
index 0000000..5c73384
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(PlasmaAttack, PortoLaunch)
+/* flags     */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(PlasmaAttack, impulse, int, 5);
+/* refname   */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
+/* wepname   */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
+ENDCLASS(PlasmaAttack)
+REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
index 1b61b4ae833c1a6fcd515a5c141c84c8c0eca92f..510331c637400fe19586cee4767fff7cffaabd81 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TURRET_TESLA_H
 #define TURRET_TESLA_H
 
-#include "tesla_weapon.qc"
+#include "tesla_weapon.qh"
 
 CLASS(TeslaCoil, Turret)
 /* spawnflags */ ATTRIB(TeslaCoil, spawnflags, int, TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
@@ -20,14 +20,13 @@ REGISTER_TURRET(TESLA, NEW(TeslaCoil));
 
 #ifdef IMPLEMENTATION
 
-#include "tesla_weapon.qc"
-
 #ifdef SVQC
 
 spawnfunc(turret_tesla) { if (!turret_initialize(TUR_TESLA)) remove(self); }
 
 METHOD(TeslaCoil, tr_think, void(TeslaCoil thistur, entity it))
 {
+    SELFPARAM();
     if(!self.active)
     {
         self.tur_head.avelocity = '0 0 0';
index 7e9108cb423750d3e9fb2a76e4be50c94531e7e5..a283a738f2c79c93737698d02d86ff849c7e52c6 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_TESLA_WEAPON_H
-#define TURRET_TESLA_WEAPON_H
-
-CLASS(TeslaCoilTurretAttack, PortoLaunch)
-/* flags     */ ATTRIB(TeslaCoilTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(TeslaCoilTurretAttack, impulse, int, 9);
-/* refname   */ ATTRIB(TeslaCoilTurretAttack, netname, string, "turret_tesla");
-/* wepname   */ ATTRIB(TeslaCoilTurretAttack, m_name, string, _("Tesla Coil"));
-ENDCLASS(TeslaCoilTurretAttack)
-REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
-
-#endif
+#include "tesla_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -23,7 +12,7 @@ METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .enti
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(TeslaCoilTurretAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_TeslaCoilTurretAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
diff --git a/qcsrc/common/turrets/turret/tesla_weapon.qh b/qcsrc/common/turrets/turret/tesla_weapon.qh
new file mode 100644 (file)
index 0000000..7e3879b
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(TeslaCoilTurretAttack, PortoLaunch)
+/* flags     */ ATTRIB(TeslaCoilTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(TeslaCoilTurretAttack, impulse, int, 9);
+/* refname   */ ATTRIB(TeslaCoilTurretAttack, netname, string, "turret_tesla");
+/* wepname   */ ATTRIB(TeslaCoilTurretAttack, m_name, string, _("Tesla Coil"));
+ENDCLASS(TeslaCoilTurretAttack)
+REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
index bf68e85fd207459861fec6e164e5b7abb0b217a6..918ce4ca3a1bbc91c1c14de41af6595399379855 100644 (file)
@@ -3,7 +3,7 @@
 
 //#define WALKER_FANCYPATHING
 
-#include "walker_weapon.qc"
+#include "walker_weapon.qh"
 
 CLASS(WalkerTurret, Turret)
 /* spawnflags */ ATTRIB(WalkerTurret, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE);
@@ -22,8 +22,6 @@ REGISTER_TURRET(WALKER, NEW(WalkerTurret));
 
 #ifdef IMPLEMENTATION
 
-#include "walker_weapon.qc"
-
 #ifdef SVQC
 
 float autocvar_g_turrets_unit_walker_melee_damage;
@@ -75,8 +73,8 @@ float walker_firecheck()
     return turret_firecheck();
 }
 
-void walker_melee_do_dmg()
-{SELFPARAM();
+void walker_melee_do_dmg(entity this)
+{
     vector where;
     entity e;
 
@@ -94,8 +92,8 @@ void walker_melee_do_dmg()
     }
 }
 
-void walker_setnoanim()
-{SELFPARAM();
+void walker_setnoanim(entity this)
+{
     turrets_setframe(ANIM_NO, false);
     self.animflag = self.frame;
 }
@@ -111,7 +109,7 @@ void walker_rocket_damage(entity this, entity inflictor, entity attacker, float
     this.velocity = this.velocity + vforce;
 
     if (this.health <= 0)
-        WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
+        WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
 }
 
 #define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
@@ -350,6 +348,7 @@ spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
 
 METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
 {
+    SELFPARAM();
     fixedmakevectors(self.angles);
 
     if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
@@ -642,7 +641,7 @@ void walker_draw(entity this)
         return;
 
     fixedmakevectors(this.angles);
-    movelib_groundalign4point(300, 100, 0.25, 45);
+    movelib_groundalign4point(this, 300, 100, 0.25, 45);
     setorigin(this, this.origin + this.velocity * dt);
     this.tur_head.angles += dt * this.tur_head.move_avelocity;
     this.angles_y = this.move_angles_y;
index a3150d820d5ab6aaea18c829fabb9ea42ddee072..91e4345a95b3f6c6c0e58f79dfe8d7b5198c5867 100644 (file)
@@ -1,15 +1,4 @@
-#ifndef TURRET_WALKER_WEAPON_H
-#define TURRET_WALKER_WEAPON_H
-
-CLASS(WalkerTurretAttack, PortoLaunch)
-/* flags     */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
-/* refname   */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
-/* wepname   */ ATTRIB(WalkerTurretAttack, m_name, string, _("Walker"));
-ENDCLASS(WalkerTurretAttack)
-REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
-
-#endif
+#include "walker_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -22,14 +11,14 @@ METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND(WalkerTurretAttack_FIRE), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_WalkerTurretAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
         sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
-        fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
+        fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
     }
 }
diff --git a/qcsrc/common/turrets/turret/walker_weapon.qh b/qcsrc/common/turrets/turret/walker_weapon.qh
new file mode 100644 (file)
index 0000000..4e20785
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+CLASS(WalkerTurretAttack, PortoLaunch)
+/* flags     */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
+/* refname   */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
+/* wepname   */ ATTRIB(WalkerTurretAttack, m_name, string, _("Walker"));
+ENDCLASS(WalkerTurretAttack)
+REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
index 2a6d28e8e295672169956599e0e386fe0b8e916a..7bc8675335958fef698d3c06692b63a0eb7edb86 100644 (file)
@@ -114,8 +114,8 @@ string rgb_to_hexcolor(vector rgb);
 float boxesoverlap(vector m1, vector m2, vector m3, vector m4);
 float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs);
 
-typedef float(string s, vector size) textLengthUpToWidth_widthFunction_t;
-typedef float(string s) textLengthUpToLength_lenFunction_t;
+USING(textLengthUpToWidth_widthFunction_t, float(string s, vector size));
+USING(textLengthUpToLength_lenFunction_t, float(string s));
 float textLengthUpToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
 string textShortenToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
 float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_lenFunction_t tw);
@@ -247,8 +247,8 @@ float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x);
 // as it may exceed 0..1 bounds, or go in reverse
 float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor);
 
-typedef entity(entity cur, entity near, entity pass) findNextEntityNearFunction_t;
-typedef float(entity a, entity b, entity pass) isConnectedFunction_t;
+USING(findNextEntityNearFunction_t, entity(entity cur, entity near, entity pass));
+USING(isConnectedFunction_t, float(entity a, entity b, entity pass));
 void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass);
 
 // expand multiple arguments into one argument by stripping parenthesis
diff --git a/qcsrc/common/vehicles/_mod.inc b/qcsrc/common/vehicles/_mod.inc
new file mode 100644 (file)
index 0000000..e80489b
--- /dev/null
@@ -0,0 +1,4 @@
+// generated file; do not modify
+#include "all.qc"
+#include "cl_vehicles.qc"
+#include "sv_vehicles.qc"
diff --git a/qcsrc/common/vehicles/all.inc b/qcsrc/common/vehicles/all.inc
deleted file mode 100644 (file)
index e4c73a4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "vehicle/spiderbot.qc"
-#include "vehicle/raptor.qc"
-#include "vehicle/racer.qc"
-#ifndef VEHICLES_NO_UNSTABLE
-       #include "vehicle/bumblebee.qc"
-#endif
index 44178f92f8178486eee45abbe90c2fff72345544..251df22839e750646abef244455aa63d7e846df5 100644 (file)
@@ -12,7 +12,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_AUXILIARYXHAIR)
 #endif
 
 #define IMPLEMENTATION
-#include "all.inc"
+#include "vehicle/_mod.inc"
 #undef IMPLEMENTATION
 
 #endif
index f4e837f784694d841ca78b60c8a43d1c6d22990b..b58389d4abb7955feb7c3c80934583fadd4f6f1b 100644 (file)
@@ -11,7 +11,6 @@ REGISTRY_CHECK(Vehicles)
 const int VEH_FIRST = 1;
 #define VEH_LAST (Vehicles_COUNT - 1)
 
-/** If you register a new vehicle, make sure to add it to all.inc */
 #define REGISTER_VEHICLE(id, inst) REGISTER(Vehicles, VEH, id, vehicleid, inst)
 
 #if defined(SVQC)
@@ -22,6 +21,6 @@ const int VEH_FIRST = 1;
 
 REGISTER_VEHICLE(Null, NEW(Vehicle));
 
-#include "all.inc"
+#include "vehicle/_mod.inc"
 
 #endif
index a3c07a03ddbcb61f0c283f5c702d660852a3a508..e2187290d97910574b1b51a2537e2eefd42538ac 100644 (file)
@@ -18,12 +18,13 @@ entity AuxiliaryXhair[MAX_AXH];
 float alarm1time;
 float alarm2time;
 
-void vehicle_alarm(entity e, int ch, string s0und)
+void vehicle_alarm(entity e, int ch, Sound s0und)
 {
+    TC(Sound, s0und);
        if(!autocvar_cl_vehicles_alarm)
                return;
 
-       _sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
+       sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
 }
 
 void AuxiliaryXhair_Draw2D(entity this)
@@ -231,7 +232,7 @@ void Vehicles_drawHUD(
                if(alarm1time < time)
                {
                        alarm1time = time + 2;
-                       vehicle_alarm(self, CH_PAIN_SINGLE, SND(VEH_ALARM));
+                       vehicle_alarm(self, CH_PAIN_SINGLE, SND_VEH_ALARM);
                }
                drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
        }
@@ -239,7 +240,7 @@ void Vehicles_drawHUD(
        {
                if(alarm1time)
                {
-                       vehicle_alarm(self, CH_PAIN_SINGLE, SND(Null));
+                       vehicle_alarm(self, CH_PAIN_SINGLE, SND_Null);
                        alarm1time = 0;
                }
                drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL);
@@ -253,7 +254,7 @@ void Vehicles_drawHUD(
                if(alarm2time < time)
                {
                        alarm2time = time + 1;
-                       vehicle_alarm(self, CH_TRIGGER_SINGLE, SND(VEH_ALARM_SHIELD));
+                       vehicle_alarm(self, CH_TRIGGER_SINGLE, SND_VEH_ALARM_SHIELD);
                }
                drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
        }
@@ -261,7 +262,7 @@ void Vehicles_drawHUD(
        {
                if(alarm2time)
                {
-                       vehicle_alarm(self, CH_TRIGGER_SINGLE, SND(Null));
+                       vehicle_alarm(self, CH_TRIGGER_SINGLE, SND_Null);
                        alarm2time = 0;
                }
                drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL);
@@ -293,7 +294,6 @@ void Vehicles_drawHUD(
 
 void Vehicles_drawCrosshair(string crosshair)
 {
-       SELFPARAM();
        vector tmpSize = '0 0 0';
        vector tmpPos  = '0 0 0';
 
@@ -304,6 +304,10 @@ void Vehicles_drawCrosshair(string crosshair)
                tmpPos.x = (vid_conwidth - tmpSize.x) / 2;
                tmpPos.y = (vid_conheight - tmpSize.y) / 2;
 
-               drawpic(tmpPos, crosshair, tmpSize, '1 1 1', autocvar_crosshair_alpha, DRAWFLAG_NORMAL);
+               vector wcross_color = '1 1 1';
+               if(autocvar_cl_vehicles_crosshair_colorize)
+                       wcross_color = crosshair_getcolor(NULL, STAT(VEHICLESTAT_HEALTH));
+
+               drawpic(tmpPos, crosshair, tmpSize, wcross_color, autocvar_crosshair_alpha, DRAWFLAG_NORMAL);
        }
 }
index 3e75ae53016281ffd724fd85325d2499b3b5a60d..35b6c677f957de6fbfe84ee53ad28a78ce4aa3e7 100644 (file)
@@ -232,12 +232,13 @@ void vehicles_projectile_explode()
        remove (self);
 }
 
-entity vehicles_projectile(string _mzlfx, string _mzlsound,
+entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
                                                   vector _org, vector _vel,
                                                   float _dmg, float _radi, float _force,  float _size,
                                                   int _deahtype, float _projtype, float _health,
                                                   bool _cull, bool _clianim, entity _owner)
-{SELFPARAM();
+{
+    TC(Sound, _mzlsound);
        entity proj;
 
        proj = spawn();
@@ -257,7 +258,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
        proj.velocity            = _vel;
        proj.touch                      = vehicles_projectile_explode;
        proj.use                          = vehicles_projectile_explode;
-       proj.owner                      = self;
+       proj.owner                      = this;
        proj.realowner          = _owner;
        proj.think                      = SUB_Remove_self;
        proj.nextthink          = time + 30;
@@ -271,8 +272,8 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
        else
                proj.flags                 = FL_PROJECTILE | FL_NOTARGET;
 
-       if(_mzlsound)
-               _sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
+       if(_mzlsound != SND_Null)
+               sound (this, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
 
        if(_mzlfx)
                Send_Effect_(_mzlfx, proj.origin, proj.velocity, 1);
@@ -301,11 +302,11 @@ void vehicles_gib_think()
                self.nextthink = time + 0.1;
 }
 
-entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
-{SELFPARAM();
+entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
+{
        entity _gib = spawn();
        _setmodel(_gib, _template.model);
-       vector org = gettaginfo(self, gettagindex(self, _tag));
+       vector org = gettaginfo(this, gettagindex(this, _tag));
        setorigin(_gib, org);
        _gib.velocity = _vel;
        _gib.movetype = MOVETYPE_TOSS;
@@ -336,9 +337,9 @@ entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, b
 bool vehicle_addplayerslot(    entity _owner,
                                                                entity _slot,
                                                                int _hud,
-                                                               string _hud_model,
-                                                               bool() _framefunc,
-                                                               void(bool) _exitfunc, float() _enterfunc)
+                                                               Model _hud_model,
+                                                               bool(entity) _framefunc,
+                                                               void(bool) _exitfunc, float(entity, entity) _enterfunc)
 {
        if(!(_owner.vehicle_flags & VHF_MULTISLOT))
                _owner.vehicle_flags |= VHF_MULTISLOT;
@@ -353,7 +354,7 @@ bool vehicle_addplayerslot( entity _owner,
        _slot.vehicle_hudmodel.viewmodelforclient = _slot;
        _slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
 
-       _setmodel(_slot.vehicle_hudmodel, _hud_model);
+       setmodel(_slot.vehicle_hudmodel, _hud_model);
        setmodel(_slot.vehicle_viewport, MDL_Null);
 
        setattachment(_slot.vehicle_hudmodel, _slot, "");
@@ -380,62 +381,52 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string
        return vtag;
 }
 
-void vehicles_reset_colors()
-{SELFPARAM();
-       entity e;
-       float _effects = 0, _colormap;
-       vector _glowmod, _colormod;
-
+void vehicles_reset_colors(entity this)
+{
+       int eff = 0, cmap;
+       const vector cmod = '0 0 0';
+       if(this.team && teamplay)
+               cmap = 1024 + (this.team - 1) * 17;
+       else
+               cmap = 1024;
        if(autocvar_g_nodepthtestplayers)
-               _effects |= EF_NODEPTHTEST;
-
+               eff |= EF_NODEPTHTEST;
        if(autocvar_g_fullbrightplayers)
-               _effects |= EF_FULLBRIGHT;
-
-       if(self.team)
-               _colormap = 1024 + (self.team - 1) * 17;
-       else
-               _colormap = 1024;
-
-       _glowmod  = '0 0 0';
-       _colormod = '0 0 0';
+               eff |= EF_FULLBRIGHT;
 
        // Find all ents attacked to main model and setup effects, colormod etc.
-       e = findchainentity(tag_entity, self);
-       while(e)
+       FOREACH_ENTITY_ENT(tag_entity, this,
        {
-               if(e != self.vehicle_shieldent)
+               if(it != this.vehicle_shieldent)
                {
-                       e.effects   = _effects; //  | EF_LOWPRECISION;
-                       e.colormod  = _colormod;
-                       e.colormap  = _colormap;
-                       e.alpha  = 1;
+                       it.effects = eff;
+                       it.colormod = cmod;
+                       it.colormap = cmap;
+                       it.alpha = 1;
                }
-               e = e.chain;
-       }
+       });
+
        // Also check head tags
-       e = findchainentity(tag_entity, self.tur_head);
-       while(e)
+       FOREACH_ENTITY_ENT(tag_entity, this.tur_head,
        {
-               if(e != self.vehicle_shieldent)
+               if(it != this.vehicle_shieldent)
                {
-                       e.effects   = _effects; //  | EF_LOWPRECISION;
-                       e.colormod  = _colormod;
-                       e.colormap  = _colormap;
-                       e.alpha  = 1;
+                       it.effects = eff;
+                       it.colormod = cmod;
+                       it.colormap = cmap;
+                       it.alpha = 1;
                }
-               e = e.chain;
-       }
+       });
 
-       self.vehicle_hudmodel.effects  = self.effects  = _effects; // | EF_LOWPRECISION;
-       self.vehicle_hudmodel.colormod = self.colormod = _colormod;
-       self.vehicle_hudmodel.colormap = self.colormap = _colormap;
-       self.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
+       this.vehicle_hudmodel.effects  = this.effects  = eff; // | EF_LOWPRECISION;
+       this.vehicle_hudmodel.colormod = this.colormod = cmod;
+       this.vehicle_hudmodel.colormap = this.colormap = cmap;
+       this.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
 
-       self.alpha       = 1;
-       self.avelocity = '0 0 0';
-       self.velocity  = '0 0 0';
-       self.effects   = _effects;
+       this.alpha       = 1;
+       this.avelocity = '0 0 0';
+       this.velocity  = '0 0 0';
+       this.effects   = eff;
 }
 
 void vehicles_clearreturn(entity veh)
@@ -572,23 +563,23 @@ void vehicle_use()
                else
                {
                        vehicles_setreturn(self);
-                       vehicles_reset_colors();
+                       vehicles_reset_colors(self);
                }
        }
 }
 
-void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
-{SELFPARAM();
-       if(self.(regen_field) < field_max)
+void vehicles_regen(entity this, float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
+{
+       if(this.(regen_field) < field_max)
        if(timer + rpause < time)
        {
                if(_healthscale)
-                       regen = regen * (self.vehicle_health / self.max_health);
+                       regen = regen * (this.vehicle_health / this.max_health);
 
-               self.(regen_field) = min(self.(regen_field) + regen * delta_time, field_max);
+               this.(regen_field) = min(this.(regen_field) + regen * delta_time, field_max);
 
-               if(self.owner)
-                       self.owner.(regen_field) = (self.(regen_field) / field_max) * 100;
+               if(this.owner)
+                       this.owner.(regen_field) = (this.(regen_field) / field_max) * 100;
        }
 }
 
@@ -715,12 +706,12 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        {
                if(this.owner)
                        if(this.vehicle_flags & VHF_DEATHEJECT)
-                               WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
+                               WITHSELF(this, vehicles_exit(VHEF_EJECT));
                        else
-                               WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
+                               WITHSELF(this, vehicles_exit(VHEF_RELEASE));
 
 
-               antilag_clear(this);
+               antilag_clear(this, this);
 
                Vehicle info = Vehicles_from(this.vehicleid);
                info.vr_death(info, this);
@@ -739,21 +730,21 @@ float vehicles_crushable(entity e)
        return false;
 }
 
-void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
-{SELFPARAM();
+void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
+{
        if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
                return;
 
-       if(self.play_time < time)
+       if(this.play_time < time)
        {
-               float wc = vlen(self.velocity - self.oldvelocity);
-               //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
-               //dprint("vel: ", vtos(self.velocity), "\n");
+               float wc = vlen(this.velocity - this.oldvelocity);
+               //dprint("oldvel: ", vtos(this.oldvelocity), "\n");
+               //dprint("vel: ", vtos(this.velocity), "\n");
                if(_minspeed < wc)
                {
                        float take = min(_speedfac * wc, _maxpain);
-                       Damage (self, world, world, take, DEATH_FALL.m_id, self.origin, '0 0 0');
-                       self.play_time = time + 0.25;
+                       Damage (this, world, world, take, DEATH_FALL.m_id, this.origin, '0 0 0');
+                       this.play_time = time + 0.25;
 
                        //dprint("wc: ", ftos(wc), "\n");
                        //dprint("take: ", ftos(take), "\n");
@@ -900,7 +891,7 @@ void vehicles_exit(bool eject)
        _vehicle.vehicle_exit(eject);
 
        vehicles_setreturn(_vehicle);
-       vehicles_reset_colors();
+       vehicles_reset_colors(_vehicle);
        _vehicle.owner = world;
 
        CSQCMODEL_AUTOINIT(self);
@@ -961,7 +952,10 @@ bool vehicle_impulse(entity this, int imp)
 }
 
 void vehicles_enter(entity pl, entity veh)
-{SELFPARAM();
+{
+    SELFPARAM();
+       entity oldself = self;
+
    // Remove this when bots know how to use vehicles
        if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots))
                return;
@@ -978,28 +972,17 @@ void vehicles_enter(entity pl, entity veh)
        if(veh.vehicle_flags & VHF_MULTISLOT)
        if(veh.owner)
        {
-               setself(veh);
-               other = pl; // TODO: fix
-
                if(!veh.gunner1)
                if(time >= veh.gun1.phase)
                if(veh.gun1.vehicle_enter)
-               if(veh.gun1.vehicle_enter())
-               {
-                       setself(this);
+               if(veh.gun1.vehicle_enter(veh, pl))
                        return;
-               }
 
                if(!veh.gunner2)
                if(time >= veh.gun2.phase)
                if(veh.gun2.vehicle_enter)
-               if(veh.gun2.vehicle_enter())
-               {
-                       setself(this);
+               if(veh.gun2.vehicle_enter(veh, pl))
                        return;
-               }
-
-               setself(this);
        }
 
        if(teamplay)
@@ -1105,9 +1088,9 @@ void vehicles_enter(entity pl, entity veh)
        CSQCModel_UnlinkEntity(veh);
        Vehicle info = Vehicles_from(veh.vehicleid);
        info.vr_enter(info, veh);
-       setself(this);
+       setself(oldself);
 
-       antilag_clear(pl);
+       antilag_clear(pl, CS(pl));
 }
 
 void vehicles_think()
@@ -1166,7 +1149,7 @@ void vehicles_spawn()
 
        FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == self, RemoveGrapplingHook(it));
 
-       vehicles_reset_colors();
+       vehicles_reset_colors(self);
 
        Vehicle info = Vehicles_from(self.vehicleid);
        info.vr_spawn(info, self);
@@ -1174,121 +1157,118 @@ void vehicles_spawn()
        CSQCMODEL_AUTOINIT(self);
 }
 
-bool vehicle_initialize(entity veh, bool nodrop)
-{SELFPARAM();
+bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
+{
        if(!autocvar_g_vehicles)
                return false;
 
-       if(!veh.vehicleid)
+       if(!info.vehicleid)
                return false;
 
-       if(!veh.tur_head) {
-               Vehicle info = Vehicles_from(veh.vehicleid);
+       if(!this.tur_head)
                info.vr_precache(info);
-       }
 
-       if(self.targetname && self.targetname != "")
+       if(this.targetname && this.targetname != "")
        {
-               self.vehicle_controller = find(world, target, self.targetname);
-               if(!self.vehicle_controller)
+               this.vehicle_controller = find(world, target, this.targetname);
+               if(!this.vehicle_controller)
                {
                        bprint("^1WARNING: ^7Vehicle with invalid .targetname\n");
-                       self.active = ACTIVE_ACTIVE;
+                       this.active = ACTIVE_ACTIVE;
                }
                else
                {
-                       self.team = self.vehicle_controller.team;
-                       self.use = vehicle_use;
+                       this.team = this.vehicle_controller.team;
+                       this.use = vehicle_use;
 
                        if(teamplay)
                        {
-                               if(self.vehicle_controller.team == 0)
-                                       self.active = ACTIVE_NOT;
+                               if(this.vehicle_controller.team == 0)
+                                       this.active = ACTIVE_NOT;
                                else
-                                       self.active = ACTIVE_ACTIVE;
+                                       this.active = ACTIVE_ACTIVE;
                        }
                }
        }
-       else { self.active = ACTIVE_ACTIVE; }
+       else { this.active = ACTIVE_ACTIVE; }
 
-       if(self.team && (!teamplay || !autocvar_g_vehicles_teams))
-               self.team = 0;
+       if(this.team && (!teamplay || !autocvar_g_vehicles_teams))
+               this.team = 0;
 
-       if(self.mdl == "" || !self.mdl)
-               _setmodel(self, veh.model);
+       if(this.mdl == "" || !this.mdl)
+               _setmodel(this, info.model);
        else
-               _setmodel(self, self.mdl);
-
-       self.vehicle_flags |= VHF_ISVEHICLE;
-
-       self.vehicle_viewport           = new(vehicle_viewport);
-       self.vehicle_hudmodel           = new(vehicle_hudmodel);
-       self.tur_head                           = new(tur_head);
-       self.tur_head.owner                     = self;
-       self.takedamage                         = DAMAGE_NO;
-       self.bot_attack                         = true;
-       self.iscreature                         = true;
-       self.teleportable                       = false; // no teleporting for vehicles, too buggy
-       self.damagedbycontents          = true;
-       self.vehicleid                          = veh.vehicleid;
-       self.PlayerPhysplug                     = veh.PlayerPhysplug;
-       self.event_damage                       = func_null;
-       self.touch                                      = vehicles_touch;
-       self.think                                      = vehicles_spawn;
-       self.nextthink                          = time;
-       self.effects                            = EF_NODRAW;
-       self.dphitcontentsmask          = DPCONTENTS_BODY | DPCONTENTS_SOLID;
+               _setmodel(this, this.mdl);
+
+       this.vehicle_flags |= VHF_ISVEHICLE;
+
+       this.vehicle_viewport           = new(vehicle_viewport);
+       this.vehicle_hudmodel           = new(vehicle_hudmodel);
+       this.tur_head                           = new(tur_head);
+       this.tur_head.owner                     = this;
+       this.takedamage                         = DAMAGE_NO;
+       this.bot_attack                         = true;
+       this.iscreature                         = true;
+       this.teleportable                       = false; // no teleporting for vehicles, too buggy
+       this.damagedbycontents          = true;
+       this.vehicleid                          = info.vehicleid;
+       this.PlayerPhysplug                     = info.PlayerPhysplug;
+       this.event_damage                       = func_null;
+       this.touch                                      = vehicles_touch;
+       this.think                                      = vehicles_spawn;
+       this.nextthink                          = time;
+       this.effects                            = EF_NODRAW;
+       this.dphitcontentsmask          = DPCONTENTS_BODY | DPCONTENTS_SOLID;
 
        if(autocvar_g_playerclip_collisions)
-               self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+               this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
 
        if(autocvar_g_nodepthtestplayers)
-               self.effects |= EF_NODEPTHTEST;
+               this.effects |= EF_NODEPTHTEST;
 
        if(autocvar_g_fullbrightplayers)
-               self.effects |= EF_FULLBRIGHT;
+               this.effects |= EF_FULLBRIGHT;
 
-       _setmodel(self.vehicle_hudmodel, veh.hud_model);
-       setmodel(self.vehicle_viewport, MDL_Null);
+       _setmodel(this.vehicle_hudmodel, info.hud_model);
+       setmodel(this.vehicle_viewport, MDL_Null);
 
-       if(veh.head_model != "")
+       if(info.head_model != "")
        {
-               _setmodel(self.tur_head, veh.head_model);
-               setattachment(self.tur_head, self, veh.tag_head);
-               setattachment(self.vehicle_hudmodel, self.tur_head, veh.tag_hud);
-               setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+               _setmodel(this.tur_head, info.head_model);
+               setattachment(this.tur_head, this, info.tag_head);
+               setattachment(this.vehicle_hudmodel, this.tur_head, info.tag_hud);
+               setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
        }
        else
        {
-               setattachment(self.tur_head, self, "");
-               setattachment(self.vehicle_hudmodel, self, veh.tag_hud);
-               setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+               setattachment(this.tur_head, this, "");
+               setattachment(this.vehicle_hudmodel, this, info.tag_hud);
+               setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
        }
 
-       setsize(self, veh.mins, veh.maxs);
+       setsize(this, info.mins, info.maxs);
 
        if(!nodrop)
        {
-               setorigin(self, self.origin);
-               tracebox(self.origin + '0 0 100', veh.mins, veh.maxs, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
-               setorigin(self, trace_endpos);
+               setorigin(this, this.origin);
+               tracebox(this.origin + '0 0 100', info.mins, info.maxs, this.origin - '0 0 10000', MOVE_WORLDONLY, this);
+               setorigin(this, trace_endpos);
        }
 
-       self.pos1 = self.origin;
-       self.pos2 = self.angles;
-       self.tur_head.team = self.team;
+       this.pos1 = this.origin;
+       this.pos2 = this.angles;
+       this.tur_head.team = this.team;
 
-       Vehicle info = Vehicles_from(veh.vehicleid);
-       info.vr_setup(info, veh);
+       info.vr_setup(info, this);
 
-       if(self.active == ACTIVE_NOT)
-               self.nextthink = 0; // wait until activated
+       if(this.active == ACTIVE_NOT)
+               this.nextthink = 0; // wait until activated
        else if(autocvar_g_vehicles_delayspawn)
-               self.nextthink = time + self.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+               this.nextthink = time + this.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
        else
-               self.nextthink = time + game_starttime;
+               this.nextthink = time + game_starttime;
 
-       if(MUTATOR_CALLHOOK(VehicleSpawn))
+       if(MUTATOR_CALLHOOK(VehicleSpawn, this))
                return false;
 
        return true;
index aee4bf6c6df75f60f712e1a641cb0894adf3263b..6cc322ef9ca610a8ead5dcd8543723d5a059aa4a 100644 (file)
@@ -2,20 +2,22 @@
 #define VEHICLES_DEF_H
 #ifdef SVQC
 
-#include "../turrets/sv_turrets.qh"
+#include <common/turrets/sv_turrets.qh>
+#include "vehicle.qh"
 
 // vehicle cvars
-float autocvar_g_vehicles;
-float autocvar_g_vehicles_enter;
-float autocvar_g_vehicles_enter_radius;
-float autocvar_g_vehicles_steal;
-float autocvar_g_vehicles_steal_show_waypoint;
-float autocvar_g_vehicles_crush_dmg;
-float autocvar_g_vehicles_crush_force;
-float autocvar_g_vehicles_delayspawn;
-float autocvar_g_vehicles_delayspawn_jitter;
+bool autocvar_g_vehicles = true;
+AUTOCVAR(g_vehicles_enter, bool, false, "require pressing use key to enter a vehicle");
+float autocvar_g_vehicles_enter_radius = 250;
+AUTOCVAR(g_vehicles_steal, bool, true, "allow stealing enemy vehicles in teamplay modes");
+AUTOCVAR(g_vehicles_steal_show_waypoint, bool, true, "show a waypoint above the thief");
+float autocvar_g_vehicles_crush_dmg = 70;
+float autocvar_g_vehicles_crush_force = 50;
+bool autocvar_g_vehicles_delayspawn = true;
+float autocvar_g_vehicles_delayspawn_jitter = 10;
 float autocvar_g_vehicles_allow_bots;
-float autocvar_g_vehicles_teams;
+
+AUTOCVAR(g_vehicles_teams, bool, true, "allow team specific vehicles");
 float autocvar_g_vehicles_teleportable;
 float autocvar_g_vehicles_vortex_damagerate = 0.5;
 float autocvar_g_vehicles_machinegun_damagerate = 0.5;
@@ -80,7 +82,7 @@ const float   DAMAGE_TARGETDRONE = 10;
 .bool(int _imp) vehicles_impulse;
 .int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
 .void(int exit_flags) vehicle_exit;
-.bool() vehicle_enter;
+.bool(entity this, entity player) vehicle_enter;
 const int VHEF_NORMAL = 0;  /// User pressed exit key
 const int VHEF_EJECT  = 1;  /// User pressed exit key 3 times fast (not implemented) or vehile is dying
 const int VHEF_RELEASE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
@@ -92,13 +94,13 @@ vector force_fromtag_origin;
 float vehicles_exit_running;
 
 // macros
-#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
-       ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
+#define VEHICLE_UPDATE_PLAYER(ply,vehi,fld,vhname) \
+       ply.vehicle_##fld = (vehi.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
 
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
 void vehicles_exit(float eject);
-float vehicle_initialize(entity vehicle, float nodrop);
+bool vehicle_initialize(entity this, Vehicle info, float nodrop);
 bool vehicle_impulse(entity this, int imp);
 bool vehicles_crushable(entity e);
 
index 723a98518ae651857a4409afc1d4cce3c300c8ec..c49218db18eb297b1eec933804b307a4d3b83759 100644 (file)
@@ -24,7 +24,7 @@ CLASS(Vehicle, Object)
     /** cockpit model tag */
     ATTRIB(Vehicle, tag_view, string, string_null)
     /** player physics mod */
-    ATTRIB(Vehicle, PlayerPhysplug, int(), func_null)
+    ATTRIB(Vehicle, PlayerPhysplug, bool(entity), func_null)
     /**  */
     ATTRIB(Vehicle, spawnflags, int, 0)
     /** vehicle hitbox size */
diff --git a/qcsrc/common/vehicles/vehicle/_mod.inc b/qcsrc/common/vehicles/vehicle/_mod.inc
new file mode 100644 (file)
index 0000000..fbead47
--- /dev/null
@@ -0,0 +1,9 @@
+// generated file; do not modify
+#include "bumblebee.qc"
+#include "bumblebee_weapons.qc"
+#include "racer.qc"
+#include "racer_weapon.qc"
+#include "raptor.qc"
+#include "raptor_weapons.qc"
+#include "spiderbot.qc"
+#include "spiderbot_weapons.qc"
index 323e485dc5ee737dac65d12062cf5252dcf7a7df..c3c0861e95ef257187904119fc0a3938a0e604ac 100644 (file)
@@ -2,7 +2,7 @@
 #define VEHICLE_BUMBLEBEE
 #include "bumblebee.qh"
 
-#include "bumblebee_weapons.qc"
+#include "bumblebee_weapons.qh"
 
 CLASS(Bumblebee, Vehicle)
 /* spawnflags */ ATTRIB(Bumblebee, spawnflags, int, VHF_DMGSHAKE);
@@ -23,6 +23,10 @@ CLASS(Bumblebee, Vehicle)
 ENDCLASS(Bumblebee)
 REGISTER_VEHICLE(BUMBLEBEE, NEW(Bumblebee));
 
+#ifndef MENUQC
+       MODEL(VEH_BUMBLEBEE_GUNCOCKPIT, "models/vehicles/wakizashi_cockpit.dpm");
+#endif
+
 #endif
 
 #ifdef IMPLEMENTATION
@@ -31,84 +35,81 @@ const float BRG_SETUP = 2;
 const float BRG_START = 4;
 const float BRG_END = 8;
 
-#include "bumblebee_weapons.qc"
-
 #ifdef SVQC
-float autocvar_g_vehicle_bumblebee_speed_forward;
-float autocvar_g_vehicle_bumblebee_speed_strafe;
-float autocvar_g_vehicle_bumblebee_speed_up;
-float autocvar_g_vehicle_bumblebee_speed_down;
-float autocvar_g_vehicle_bumblebee_turnspeed;
-float autocvar_g_vehicle_bumblebee_pitchspeed;
-float autocvar_g_vehicle_bumblebee_pitchlimit;
-float autocvar_g_vehicle_bumblebee_friction;
-
-float autocvar_g_vehicle_bumblebee_energy;
-float autocvar_g_vehicle_bumblebee_energy_regen;
-float autocvar_g_vehicle_bumblebee_energy_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_health;
-float autocvar_g_vehicle_bumblebee_health_regen;
-float autocvar_g_vehicle_bumblebee_health_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_shield;
-float autocvar_g_vehicle_bumblebee_shield_regen;
-float autocvar_g_vehicle_bumblebee_shield_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_cannon_ammo;
-float autocvar_g_vehicle_bumblebee_cannon_ammo_regen;
-float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause;
+float autocvar_g_vehicle_bumblebee_respawntime = 60;
 
-float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
+float autocvar_g_vehicle_bumblebee_speed_forward = 350;
+float autocvar_g_vehicle_bumblebee_speed_strafe = 350;
+float autocvar_g_vehicle_bumblebee_speed_up = 350;
+float autocvar_g_vehicle_bumblebee_speed_down = 350;
+float autocvar_g_vehicle_bumblebee_turnspeed = 120;
+float autocvar_g_vehicle_bumblebee_pitchspeed = 60;
+float autocvar_g_vehicle_bumblebee_pitchlimit = 60;
+float autocvar_g_vehicle_bumblebee_friction = 0.5;
 
-float autocvar_g_vehicle_bumblebee_cannon_turnspeed;
-float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down;
-float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up;
-float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
-float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
+float autocvar_g_vehicle_bumblebee_energy = 500;
+float autocvar_g_vehicle_bumblebee_energy_regen = 50;
+float autocvar_g_vehicle_bumblebee_energy_regen_pause = 1;
 
+float autocvar_g_vehicle_bumblebee_health = 1000;
+float autocvar_g_vehicle_bumblebee_health_regen = 65;
+float autocvar_g_vehicle_bumblebee_health_regen_pause = 10;
 
-float autocvar_g_vehicle_bumblebee_raygun_turnspeed;
-float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down;
-float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up;
-float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides;
+float autocvar_g_vehicle_bumblebee_shield = 400;
+float autocvar_g_vehicle_bumblebee_shield_regen = 150;
+float autocvar_g_vehicle_bumblebee_shield_regen_pause = 0.75;
 
-float autocvar_g_vehicle_bumblebee_raygun_range;
-float autocvar_g_vehicle_bumblebee_raygun_dps;
-float autocvar_g_vehicle_bumblebee_raygun_aps;
-float autocvar_g_vehicle_bumblebee_raygun_fps;
+float autocvar_g_vehicle_bumblebee_cannon_ammo = 100;
+float autocvar_g_vehicle_bumblebee_cannon_ammo_regen = 100;
+float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause = 1;
 
-float autocvar_g_vehicle_bumblebee_raygun;
-float autocvar_g_vehicle_bumblebee_healgun_hps;
-float autocvar_g_vehicle_bumblebee_healgun_hmax;
-float autocvar_g_vehicle_bumblebee_healgun_aps;
-float autocvar_g_vehicle_bumblebee_healgun_amax;
-float autocvar_g_vehicle_bumblebee_healgun_sps;
-float autocvar_g_vehicle_bumblebee_healgun_locktime;
+float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
 
-float autocvar_g_vehicle_bumblebee_respawntime;
+float autocvar_g_vehicle_bumblebee_cannon_turnspeed = 160;
+float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down = 60;
+float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up = 60;
+float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in = 20;
+float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out = 80;
 
-float autocvar_g_vehicle_bumblebee_blowup_radius;
-float autocvar_g_vehicle_bumblebee_blowup_coredamage;
-float autocvar_g_vehicle_bumblebee_blowup_edgedamage;
-float autocvar_g_vehicle_bumblebee_blowup_forceintensity;
-vector autocvar_g_vehicle_bumblebee_bouncepain;
 
-bool autocvar_g_vehicle_bumblebee = 0;
+float autocvar_g_vehicle_bumblebee_raygun_turnspeed = 180;
+float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down = 20;
+float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up = 5;
+float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides = 35;
 
-float bumblebee_gunner_frame()
-{SELFPARAM();
-       entity vehic    = self.vehicle.owner;
-       entity gun      = self.vehicle;
-       entity gunner   = self;
-       setself(vehic);
+bool autocvar_g_vehicle_bumblebee_raygun = false;
+float autocvar_g_vehicle_bumblebee_raygun_range = 2048;
+float autocvar_g_vehicle_bumblebee_raygun_dps = 250;
+float autocvar_g_vehicle_bumblebee_raygun_aps = 100;
+float autocvar_g_vehicle_bumblebee_raygun_fps = 100;
+
+float autocvar_g_vehicle_bumblebee_healgun_hps = 150;
+float autocvar_g_vehicle_bumblebee_healgun_hmax = 100;
+float autocvar_g_vehicle_bumblebee_healgun_aps = 75;
+float autocvar_g_vehicle_bumblebee_healgun_amax = 100;
+float autocvar_g_vehicle_bumblebee_healgun_sps = 100;
+float autocvar_g_vehicle_bumblebee_healgun_locktime = 2.5;
+
+float autocvar_g_vehicle_bumblebee_blowup_radius = 500;
+float autocvar_g_vehicle_bumblebee_blowup_coredamage = 500;
+float autocvar_g_vehicle_bumblebee_blowup_edgedamage = 100;
+float autocvar_g_vehicle_bumblebee_blowup_forceintensity = 600;
+vector autocvar_g_vehicle_bumblebee_bouncepain = '1 100 200';
+
+bool autocvar_g_vehicle_bumblebee = true;
+
+bool bumblebee_gunner_frame(entity this)
+{
+       entity vehic = this.vehicle.owner;
+       entity gun = this.vehicle;
+       return = true;
 
        // this isn't technically a vehicle (yet), let's not do frame functions on it (yet)
        //vehicles_frame(gun, player);
 
        vehic.solid = SOLID_NOT;
-       //setorigin(gunner, vehic.origin);
-       gunner.velocity = vehic.velocity;
+       //setorigin(this, vehic.origin);
+       this.velocity = vehic.velocity;
 
        float _in, _out;
        vehic.angles_x *= -1;
@@ -118,16 +119,16 @@ float bumblebee_gunner_frame()
        {
                _in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
                _out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
-               setorigin(gunner, vehic.origin + v_up * -16 + v_forward * -16 + v_right * 128);
+               setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * 128);
        }
        else
        {
                _in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
                _out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
-               setorigin(gunner, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
+               setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
        }
 
-       crosshair_trace(gunner);
+       crosshair_trace(this);
        vector _ct = trace_endpos;
        vector ad;
 
@@ -141,7 +142,7 @@ float bumblebee_gunner_frame()
                                if(trace_ent.takedamage)
                                        if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
                                        {
-                                               if(DIFF_TEAM(trace_ent, gunner))
+                                               if(DIFF_TEAM(trace_ent, this))
                                                {
                                                        gun.enemy = trace_ent;
                                                        gun.lock_time = time + 5;
@@ -160,13 +161,13 @@ float bumblebee_gunner_frame()
 
 
                ad = vf;
-               distance = vlen(ad - gunner.origin);
+               distance = vlen(ad - this.origin);
                impact_time = distance / autocvar_g_vehicle_bumblebee_cannon_speed;
                ad = vf + _vel * impact_time;
                trace_endpos = ad;
 
 
-               UpdateAuxiliaryXhair(gunner, ad, '1 0 1', 1);
+               UpdateAuxiliaryXhair(this, ad, '1 0 1', 1);
                vehicle_aimturret(vehic, trace_endpos, gun, "fire",
                                                  autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
                                                  _out * -1,  _in,  autocvar_g_vehicle_bumblebee_cannon_turnspeed);
@@ -177,36 +178,33 @@ float bumblebee_gunner_frame()
                                                  autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
                                                  _out * -1,  _in,  autocvar_g_vehicle_bumblebee_cannon_turnspeed);
 
-       if(!forbidWeaponUse(gunner))
-       if(PHYS_INPUT_BUTTON_ATCK(gunner))
+       if(!forbidWeaponUse(this))
+       if(PHYS_INPUT_BUTTON_ATCK(this))
                if(time > gun.attack_finished_single[0])
                        if(gun.vehicle_energy >= autocvar_g_vehicle_bumblebee_cannon_cost)
                        {
                                gun.vehicle_energy -= autocvar_g_vehicle_bumblebee_cannon_cost;
-                               bumblebee_fire_cannon(gun, "fire", gunner);
+                               bumblebee_fire_cannon(vehic, gun, "fire", this);
                                gun.delay = time;
                                gun.attack_finished_single[0] = time + autocvar_g_vehicle_bumblebee_cannon_refire;
                        }
 
-       VEHICLE_UPDATE_PLAYER(gunner, health, bumblebee);
+       VEHICLE_UPDATE_PLAYER(this, vehic, health, bumblebee);
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
-               VEHICLE_UPDATE_PLAYER(gunner, shield, bumblebee);
+               VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
 
        ad = gettaginfo(gun, gettagindex(gun, "fire"));
        traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, gun);
 
-       UpdateAuxiliaryXhair(gunner, trace_endpos, ('1 0 0' * gunner.vehicle_reload1) + ('0 1 0' *(1 - gunner.vehicle_reload1)), 0);
+       UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), 0);
 
        if(vehic.owner)
-               UpdateAuxiliaryXhair(vehic.owner, trace_endpos, ('1 0 0' * gunner.vehicle_reload1) + ('0 1 0' *(1 - gunner.vehicle_reload1)), ((gunner == vehic.gunner1) ? 1 : 2));
+               UpdateAuxiliaryXhair(vehic.owner, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), ((this == vehic.gunner1) ? 1 : 2));
 
        vehic.solid = SOLID_BBOX;
-       PHYS_INPUT_BUTTON_ATCK(gunner) = PHYS_INPUT_BUTTON_ATCK2(gunner) = PHYS_INPUT_BUTTON_CROUCH(gunner) = false;
-       gunner.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
-
-       setself(gunner);
-       return 1;
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
+       this.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
 }
 
 vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity player)
@@ -291,10 +289,9 @@ void bumblebee_gunner_exit(int _exitflag)
        player.vehicle = world;
 }
 
-bool bumblebee_gunner_enter()
-{SELFPARAM();
-       entity vehic = self;
-       entity player = other;
+bool bumblebee_gunner_enter(entity this, entity player)
+{
+       entity vehic = this;
        entity gunner = world;
 
        if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
@@ -387,68 +384,60 @@ void bumblebee_touch()
                float phase_time = (time >= self.gun1.phase) + (time >= self.gun2.phase);
 
                if(time >= other.vehicle_enter_delay && phase_time)
-               if(bumblebee_gunner_enter())
+               if(bumblebee_gunner_enter(self, other))
                        return;
        }
 
        vehicles_touch();
 }
 
-void bumblebee_regen()
-{SELFPARAM();
-       if(self.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
-               self.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
-                                                                          self.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
+void bumblebee_regen(entity this)
+{
+       if(this.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
+               this.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
+                                                                          this.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
 
-       if(self.gun2.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
-               self.gun2.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
-                                                                          self.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
+       if(this.gun2.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
+               this.gun2.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
+                                                                          this.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
 
-       if(self.vehicle_flags  & VHF_SHIELDREGEN)
-               vehicles_regen(self.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, true);
+       if(this.vehicle_flags  & VHF_SHIELDREGEN)
+               vehicles_regen(this, this.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, true);
 
-       if(self.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen(self.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, false);
+       if(this.vehicle_flags  & VHF_HEALTHREGEN)
+               vehicles_regen(this, this.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, false);
 
-       if(self.vehicle_flags  & VHF_ENERGYREGEN)
-               vehicles_regen(self.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, false);
+       if(this.vehicle_flags  & VHF_ENERGYREGEN)
+               vehicles_regen(this, this.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, false);
 
 }
 
-float bumblebee_pilot_frame()
-{SELFPARAM();
-       entity pilot, vehic;
-       vector newvel;
+bool bumblebee_pilot_frame(entity this)
+{
+       entity vehic = this.vehicle;
+       return = true;
 
        if(intermission_running)
        {
-               self.vehicle.velocity = '0 0 0';
-               self.vehicle.avelocity = '0 0 0';
-               return 1;
+               vehic.velocity = '0 0 0';
+               vehic.avelocity = '0 0 0';
+               return;
        }
 
-       pilot = self;
-       vehic = self.vehicle;
-       setself(vehic);
-
-       vehicles_frame(vehic, pilot);
+       vehicles_frame(vehic, this);
 
        if(IS_DEAD(vehic))
        {
-               setself(pilot);
-               PHYS_INPUT_BUTTON_ATCK(pilot) = PHYS_INPUT_BUTTON_ATCK2(pilot) = false;
-               return 1;
+               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+               return;
        }
 
-       bumblebee_regen();
+       bumblebee_regen(vehic);
 
-       crosshair_trace(pilot);
+       crosshair_trace(this);
 
-       vector vang;
-       float ftmp;
-
-       vang = vehic.angles;
-       newvel = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
+       vector vang = vehic.angles;
+       vector newvel = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
        vang.x *= -1;
        newvel.x *= -1;
        if(newvel.x > 180)  newvel.x -= 360;
@@ -456,16 +445,16 @@ float bumblebee_pilot_frame()
        if(newvel.y > 180)  newvel.y -= 360;
        if(newvel.y < -180) newvel.y += 360;
 
-       ftmp = shortangle_f(pilot.v_angle.y - vang.y, vang.y);
+       float ftmp = shortangle_f(this.v_angle.y - vang.y, vang.y);
        if(ftmp > 180)  ftmp -= 360;
        if(ftmp < -180) ftmp += 360;
        vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity.y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed);
 
        // Pitch
        ftmp = 0;
-       if(pilot.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
+       if(this.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = 4;
-       else if(pilot.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+       else if(this.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = -8;
 
        newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
@@ -479,19 +468,19 @@ float bumblebee_pilot_frame()
        makevectors('0 1 0' * vehic.angles.y);
        newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
 
-       if(pilot.movement.x != 0)
+       if(this.movement.x != 0)
        {
-               if(pilot.movement.x > 0)
+               if(this.movement.x > 0)
                        newvel += v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
-               else if(pilot.movement.x < 0)
+               else if(this.movement.x < 0)
                        newvel -= v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
        }
 
-       if(pilot.movement.y != 0)
+       if(this.movement.y != 0)
        {
-               if(pilot.movement.y < 0)
+               if(this.movement.y < 0)
                        newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
-               else if(pilot.movement.y > 0)
+               else if(this.movement.y > 0)
                        newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
                ftmp = newvel * v_right;
                ftmp *= frametime * 0.1;
@@ -504,13 +493,13 @@ float bumblebee_pilot_frame()
                        vehic.angles_z = 0;
        }
 
-       if(PHYS_INPUT_BUTTON_CROUCH(pilot))
+       if(PHYS_INPUT_BUTTON_CROUCH(this))
                newvel -=   v_up * autocvar_g_vehicle_bumblebee_speed_down;
-       else if(PHYS_INPUT_BUTTON_JUMP(pilot))
+       else if(PHYS_INPUT_BUTTON_JUMP(this))
                newvel +=  v_up * autocvar_g_vehicle_bumblebee_speed_up;
 
        vehic.velocity  += newvel * frametime;
-       pilot.velocity = pilot.movement  = vehic.velocity;
+       this.velocity = this.movement  = vehic.velocity;
 
 
        if(autocvar_g_vehicle_bumblebee_healgun_locktime)
@@ -525,7 +514,7 @@ float bumblebee_pilot_frame()
                {
                        if(teamplay)
                        {
-                               if(trace_ent.team == pilot.team)
+                               if(trace_ent.team == this.team)
                                {
                                        vehic.tur_head.enemy = trace_ent;
                                        vehic.tur_head.lock_time = time + autocvar_g_vehicle_bumblebee_healgun_locktime;
@@ -541,18 +530,18 @@ float bumblebee_pilot_frame()
                if(vehic.tur_head.enemy)
                {
                        trace_endpos = real_origin(vehic.tur_head.enemy);
-                       UpdateAuxiliaryXhair(pilot, trace_endpos, '0 0.75 0', 0);
+                       UpdateAuxiliaryXhair(this, trace_endpos, '0 0.75 0', 0);
                }
        }
 
-       vang = vehicle_aimturret(vehic, trace_endpos, self.gun3, "fire",
+       vang = vehicle_aimturret(vehic, trace_endpos, vehic.gun3, "fire",
                                          autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down * -1,  autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up,
                                          autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1,  autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides,  autocvar_g_vehicle_bumblebee_raygun_turnspeed);
 
-       if(!forbidWeaponUse(pilot))
-       if((PHYS_INPUT_BUTTON_ATCK(pilot) || PHYS_INPUT_BUTTON_ATCK2(pilot)) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime || autocvar_g_vehicle_bumblebee_raygun == 0))
+       if(!forbidWeaponUse(this))
+       if((PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this)) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime || autocvar_g_vehicle_bumblebee_raygun == 0))
        {
-               vehic.gun3.enemy.realowner = pilot;
+               vehic.gun3.enemy.realowner = this;
                vehic.gun3.enemy.effects &= ~EF_NODRAW;
 
                vehic.gun3.enemy.hook_start = gettaginfo(vehic.gun3, gettagindex(vehic.gun3, "fire"));
@@ -564,13 +553,13 @@ float bumblebee_pilot_frame()
                {
                        if(autocvar_g_vehicle_bumblebee_raygun)
                        {
-                               Damage(trace_ent, vehic, pilot, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC.m_id, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime);
+                               Damage(trace_ent, vehic, this, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC.m_id, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime);
                                vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_raygun_aps * sys_frametime;
                        }
                        else
                        {
                                if(!IS_DEAD(trace_ent))
-                                       if((teamplay && trace_ent.team == pilot.team) || !teamplay)
+                                       if((teamplay && trace_ent.team == this.team) || !teamplay)
                                        {
 
                                                if(trace_ent.vehicle_flags & VHF_ISVEHICLE)
@@ -619,24 +608,21 @@ float bumblebee_pilot_frame()
        }
        */
 
-       VEHICLE_UPDATE_PLAYER(pilot, health, bumblebee);
-       VEHICLE_UPDATE_PLAYER(pilot, energy, bumblebee);
+       VEHICLE_UPDATE_PLAYER(this, vehic, health, bumblebee);
+       VEHICLE_UPDATE_PLAYER(this, vehic, energy, bumblebee);
 
-       pilot.vehicle_ammo1 = (vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
-       pilot.vehicle_ammo2 = (vehic.gun2.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
+       this.vehicle_ammo1 = (vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
+       this.vehicle_ammo2 = (vehic.gun2.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
-               VEHICLE_UPDATE_PLAYER(pilot, shield, bumblebee);
+               VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
 
        vehic.angles_x *= -1;
        makevectors(vehic.angles);
        vehic.angles_x *= -1;
-       setorigin(pilot, vehic.origin + v_up * 48 + v_forward * 160);
-
-       PHYS_INPUT_BUTTON_ATCK(pilot) = PHYS_INPUT_BUTTON_ATCK2(pilot) = PHYS_INPUT_BUTTON_CROUCH(pilot) = false;
-       setself(pilot);
+       setorigin(this, vehic.origin + v_up * 48 + v_forward * 160);
 
-       return 1;
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 }
 
 void bumblebee_land()
@@ -695,7 +681,7 @@ void bumblebee_exit(float eject)
        self.owner.velocity_z += 10;
        setorigin(self.owner, spot);
 
-       antilag_clear(self.owner);
+       antilag_clear(self.owner, CS(self.owner));
        self.owner = world;
 }
 
@@ -732,14 +718,14 @@ void bumblebee_diethink()
 
 spawnfunc(vehicle_bumblebee)
 {
-       if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
-       if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
+       if(!autocvar_g_vehicle_bumblebee) { remove(this); return; }
+       if(!vehicle_initialize(this, VEH_BUMBLEBEE, false)) { remove(this); return; }
 }
 
 METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
 {
     if(autocvar_g_vehicle_bumblebee_bouncepain)
-        vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+        vehicles_impact(instance, autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
 }
 METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
 {
@@ -788,6 +774,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
 }
 METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
 {
+    SELFPARAM();
     entity oldself = self;
     setself(instance);
 
@@ -814,11 +801,11 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
     self.vehicle_exit(VHEF_EJECT);
 
     fixedmakevectors(self.angles);
-    vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
-    vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
-    vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+    vehicle_tossgib(instance, self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(instance, self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(instance, self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
 
-    entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+    entity _body = vehicle_tossgib(instance, self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
 
     if(random() > 0.5)
         _body.touch = bumblebee_blowup;
@@ -894,8 +881,8 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
         setorigin(self.gun3, ofs);
         self.angles = self.gun3.pos1;
 
-        vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
-        vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+        vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+        vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
 
         setorigin(self.vehicle_hudmodel, '50 0 -5');    // Move cockpit forward - down.
         setorigin(self.vehicle_viewport, '5 0 2');    // Move camera forward up
@@ -932,25 +919,24 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
 }
 METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
 {
-    SELFPARAM();
     if(autocvar_g_vehicle_bumblebee_energy)
     if(autocvar_g_vehicle_bumblebee_energy_regen)
-        self.vehicle_flags |= VHF_ENERGYREGEN;
+        instance.vehicle_flags |= VHF_ENERGYREGEN;
 
     if(autocvar_g_vehicle_bumblebee_shield)
-        self.vehicle_flags |= VHF_HASSHIELD;
+        instance.vehicle_flags |= VHF_HASSHIELD;
 
     if(autocvar_g_vehicle_bumblebee_shield_regen)
-        self.vehicle_flags |= VHF_SHIELDREGEN;
+        instance.vehicle_flags |= VHF_SHIELDREGEN;
 
     if(autocvar_g_vehicle_bumblebee_health_regen)
-        self.vehicle_flags |= VHF_HEALTHREGEN;
+        instance.vehicle_flags |= VHF_HEALTHREGEN;
 
-    self.vehicle_exit = bumblebee_exit;
-    self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
-    self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
-    self.max_health = self.vehicle_health;
-    self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+    instance.vehicle_exit = bumblebee_exit;
+    instance.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
+    instance.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+    instance.max_health = instance.vehicle_health;
+    instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
 }
 
 #endif // SVQC
index b043038921460bb2768aca34238932a49352e566..37dfaef1d9c8599ba644f9fbe9093f5db9680c06 100644 (file)
@@ -6,4 +6,8 @@
 void CSQC_BUMBLE_GUN_HUD();
 #endif
 
+#ifdef SVQC
+float raptor_altitude(float amax);
+#endif
+
 #endif
index 1114c11025d436d2aa33669ad4c0ebc328528ddf..00b796dda059a9bd7905b88c5f39d364de8ac2c8 100644 (file)
@@ -1,9 +1,4 @@
-#ifndef VEHICLE_BUMBLEBEE_WEAPONS_H
-#define VEHICLE_BUMBLEBEE_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-#endif
+#include "bumblebee_weapons.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -11,20 +6,10 @@ REGISTER_NET_LINKED(ENT_CLIENT_BUMBLE_RAYGUN)
 
 #ifdef SVQC
 
-float autocvar_g_vehicle_bumblebee_cannon_cost;
-float autocvar_g_vehicle_bumblebee_cannon_damage;
-float autocvar_g_vehicle_bumblebee_cannon_radius;
-float autocvar_g_vehicle_bumblebee_cannon_refire;
-float autocvar_g_vehicle_bumblebee_cannon_speed;
-float autocvar_g_vehicle_bumblebee_cannon_spread;
-float autocvar_g_vehicle_bumblebee_cannon_force;
-
-bool bumble_raygun_send(entity this, entity to, int sf);
-
-void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner)
+void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner)
 {
     vector v = gettaginfo(_gun, gettagindex(_gun, _tagname));
-    vehicles_projectile(EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND(VEH_BUMBLEBEE_FIRE),
+    vehicles_projectile(this, EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND_VEH_BUMBLEBEE_FIRE,
                         v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed,
                         autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force,  0,
                         DEATH_VH_BUMB_GUN.m_id, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner);
diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qh b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qh
new file mode 100644 (file)
index 0000000..73fed55
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <common/weapons/all.qh>
+
+float autocvar_g_vehicle_bumblebee_cannon_cost = 2;
+float autocvar_g_vehicle_bumblebee_cannon_damage = 60;
+float autocvar_g_vehicle_bumblebee_cannon_radius = 225;
+float autocvar_g_vehicle_bumblebee_cannon_refire = 0.2;
+float autocvar_g_vehicle_bumblebee_cannon_speed = 20000;
+float autocvar_g_vehicle_bumblebee_cannon_spread = 0.02;
+float autocvar_g_vehicle_bumblebee_cannon_force = -35;
+
+#ifdef SVQC
+void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner);
+bool bumble_raygun_send(entity this, entity to, int sf);
+#endif
index b9a1a71744b4ac487dc68e0cd4bf80de8f79620d..da259784f64a5c7c45a2bfe5192571b49b96a3d8 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef VEHICLE_RACER
 #define VEHICLE_RACER
 
-#include "racer_weapon.qc"
+#include "racer_weapon.qh"
 
 CLASS(Racer, Vehicle)
 /* spawnflags */ ATTRIB(Racer, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
@@ -26,72 +26,78 @@ REGISTER_VEHICLE(RACER, NEW(Racer));
 
 #ifdef IMPLEMENTATION
 
-#include "racer_weapon.qc"
-
 #ifdef SVQC
 #include <common/triggers/trigger/impulse.qh>
 
-bool autocvar_g_vehicle_racer;
+bool autocvar_g_vehicle_racer = true;
 
-float autocvar_g_vehicle_racer_speed_afterburn;
-float autocvar_g_vehicle_racer_afterburn_cost;
+float autocvar_g_vehicle_racer_speed_afterburn = 3000;
+// energy consumed per second
+float autocvar_g_vehicle_racer_afterburn_cost = 100;
 
-float autocvar_g_vehicle_racer_waterburn_cost;
-float autocvar_g_vehicle_racer_waterburn_speed;
+float autocvar_g_vehicle_racer_waterburn_cost = 5;
+float autocvar_g_vehicle_racer_waterburn_speed = 750;
 
-float autocvar_g_vehicle_racer_water_speed_forward;
-float autocvar_g_vehicle_racer_water_speed_strafe;
+float autocvar_g_vehicle_racer_water_speed_forward = 600;
+float autocvar_g_vehicle_racer_water_speed_strafe = 600;
 
 float autocvar_g_vehicle_racer_pitchlimit = 30;
 
 float autocvar_g_vehicle_racer_water_downforce = 0.03;
 float autocvar_g_vehicle_racer_water_upforcedamper = 15;
 
-float autocvar_g_vehicle_racer_anglestabilizer;
-float autocvar_g_vehicle_racer_downforce;
+float autocvar_g_vehicle_racer_anglestabilizer = 1.75;
+float autocvar_g_vehicle_racer_downforce = 0.01;
 
-float autocvar_g_vehicle_racer_speed_forward;
-float autocvar_g_vehicle_racer_speed_strafe;
-float autocvar_g_vehicle_racer_springlength;
-float autocvar_g_vehicle_racer_upforcedamper;
-float autocvar_g_vehicle_racer_friction;
+float autocvar_g_vehicle_racer_speed_forward = 650;
+float autocvar_g_vehicle_racer_speed_strafe = 650;
+float autocvar_g_vehicle_racer_springlength = 70;
+float autocvar_g_vehicle_racer_upforcedamper = 10;
+float autocvar_g_vehicle_racer_friction = 0.45;
 
 float autocvar_g_vehicle_racer_water_time = 5;
 
-float autocvar_g_vehicle_racer_hovertype;
-float autocvar_g_vehicle_racer_hoverpower;
+float autocvar_g_vehicle_racer_collision_multiplier = 0.05;
+
+// 0 = hover, != 0 = maglev
+int autocvar_g_vehicle_racer_hovertype = 0;
+// NOTE!! x 4 (4 engines)
+float autocvar_g_vehicle_racer_hoverpower = 8000;
 
-float autocvar_g_vehicle_racer_turnroll;
-float autocvar_g_vehicle_racer_turnspeed;
-float autocvar_g_vehicle_racer_pitchspeed;
+float autocvar_g_vehicle_racer_turnroll = 30;
+float autocvar_g_vehicle_racer_turnspeed = 220;
+float autocvar_g_vehicle_racer_pitchspeed = 125;
 
-float autocvar_g_vehicle_racer_energy;
-float autocvar_g_vehicle_racer_energy_regen;
-float autocvar_g_vehicle_racer_energy_regen_pause;
+float autocvar_g_vehicle_racer_energy = 100;
+float autocvar_g_vehicle_racer_energy_regen = 50;
+float autocvar_g_vehicle_racer_energy_regen_pause = 1;
 
-float autocvar_g_vehicle_racer_health;
-float autocvar_g_vehicle_racer_health_regen;
-float autocvar_g_vehicle_racer_health_regen_pause;
+float autocvar_g_vehicle_racer_health = 200;
+float autocvar_g_vehicle_racer_health_regen = 0;
+float autocvar_g_vehicle_racer_health_regen_pause = 0;
 
-float autocvar_g_vehicle_racer_shield;
-float autocvar_g_vehicle_racer_shield_regen;
-float autocvar_g_vehicle_racer_shield_regen_pause;
+float autocvar_g_vehicle_racer_shield = 100;
+float autocvar_g_vehicle_racer_shield_regen = 30;
+float autocvar_g_vehicle_racer_shield_regen_pause = 1;
 
-float autocvar_g_vehicle_racer_rocket_locktarget;
-float autocvar_g_vehicle_racer_rocket_locking_time;
-float autocvar_g_vehicle_racer_rocket_locking_releasetime;
-float autocvar_g_vehicle_racer_rocket_locked_time;
+bool autocvar_g_vehicle_racer_rocket_locktarget = true;
+float autocvar_g_vehicle_racer_rocket_locking_time = 0.9;
+float autocvar_g_vehicle_racer_rocket_locking_releasetime = 0.5;
+float autocvar_g_vehicle_racer_rocket_locked_time = 4;
 
-float autocvar_g_vehicle_racer_respawntime;
+float autocvar_g_vehicle_racer_respawntime = 35;
 
-float autocvar_g_vehicle_racer_blowup_radius;
-float autocvar_g_vehicle_racer_blowup_coredamage;
-float autocvar_g_vehicle_racer_blowup_edgedamage;
-float autocvar_g_vehicle_racer_blowup_forceintensity;
+float autocvar_g_vehicle_racer_blowup_radius = 250;
+float autocvar_g_vehicle_racer_blowup_coredamage = 250;
+float autocvar_g_vehicle_racer_blowup_edgedamage = 15;
+float autocvar_g_vehicle_racer_blowup_forceintensity = 250;
 
-float autocvar_g_vehicle_racer_bouncefactor;
-float autocvar_g_vehicle_racer_bouncestop;
-vector autocvar_g_vehicle_racer_bouncepain;
+// Factor of old velocity to keep after collision
+float autocvar_g_vehicle_racer_bouncefactor = 0.25;
+// if != 0, New veloctiy after bounce = 0 if new velocity < this
+float autocvar_g_vehicle_racer_bouncestop = 0;
+// "minspeed_for_pain speedchange_to_pain_factor max_damage"
+vector autocvar_g_vehicle_racer_bouncepain = '60 0.75 300';
 
 .float racer_watertime;
 
@@ -162,240 +168,234 @@ void racer_fire_rocket_aim(entity player, string tagname, entity trg)
        racer_fire_rocket(player, v, v_forward, trg);
 }
 
-float racer_frame()
-{SELFPARAM();
-       entity player, racer;
-       vector df;
-       float ftmp;
+bool racer_frame(entity this)
+{
+       entity vehic = this.vehicle;
+       return = true;
 
        if(intermission_running)
        {
-               self.vehicle.velocity = '0 0 0';
-               self.vehicle.avelocity = '0 0 0';
-               return 1;
+               vehic.velocity = '0 0 0';
+               vehic.avelocity = '0 0 0';
+               return;
        }
 
-       player  = self;
-       racer   = self.vehicle;
-       setself(racer);
-
-       vehicles_frame(racer, player);
+       vehicles_frame(vehic, this);
 
-       if(pointcontents(racer.origin) != CONTENT_WATER)
-               racer.air_finished = time + autocvar_g_vehicle_racer_water_time;
+       if(pointcontents(vehic.origin) != CONTENT_WATER)
+               vehic.air_finished = time + autocvar_g_vehicle_racer_water_time;
 
-       if(IS_DEAD(racer))
+       if(IS_DEAD(vehic))
        {
-               setself(player);
-               PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
-               return 1;
+               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+               return;
        }
 
-       racer_align4point(self, PHYS_INPUT_TIMELENGTH);
+       racer_align4point(vehic, PHYS_INPUT_TIMELENGTH);
 
-       PHYS_INPUT_BUTTON_ZOOM(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
+       PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 
-       crosshair_trace(player);
+       crosshair_trace(this);
 
-       racer.angles_x *= -1;
+       vehic.angles_x *= -1;
 
        // Yaw
-       ftmp = autocvar_g_vehicle_racer_turnspeed * PHYS_INPUT_TIMELENGTH;
-       ftmp = bound(-ftmp, shortangle_f(player.v_angle_y - racer.angles_y, racer.angles_y), ftmp);
-       racer.angles_y = anglemods(racer.angles_y + ftmp);
+       float ftmp = autocvar_g_vehicle_racer_turnspeed * PHYS_INPUT_TIMELENGTH;
+       ftmp = bound(-ftmp, shortangle_f(this.v_angle_y - vehic.angles_y, vehic.angles_y), ftmp);
+       vehic.angles_y = anglemods(vehic.angles_y + ftmp);
 
        // Roll
-       racer.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * PHYS_INPUT_TIMELENGTH;
+       vehic.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * PHYS_INPUT_TIMELENGTH;
 
        // Pitch
        ftmp = autocvar_g_vehicle_racer_pitchspeed  * PHYS_INPUT_TIMELENGTH;
-       ftmp = bound(-ftmp, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp);
-       racer.angles_x = bound(-autocvar_g_vehicle_racer_pitchlimit, anglemods(racer.angles_x + ftmp), autocvar_g_vehicle_racer_pitchlimit);
+       ftmp = bound(-ftmp, shortangle_f(this.v_angle_x - vehic.angles_x, vehic.angles_x), ftmp);
+       vehic.angles_x = bound(-autocvar_g_vehicle_racer_pitchlimit, anglemods(vehic.angles_x + ftmp), autocvar_g_vehicle_racer_pitchlimit);
 
-       makevectors(racer.angles);
-       racer.angles_x *= -1;
+       makevectors(vehic.angles);
+       vehic.angles_x *= -1;
 
-       //ftmp = racer.velocity_z;
-       df = racer.velocity * -autocvar_g_vehicle_racer_friction;
-       //racer.velocity_z = ftmp;
+       //ftmp = vehic.velocity_z;
+       vector df = vehic.velocity * -autocvar_g_vehicle_racer_friction;
+       //vehic.velocity_z = ftmp;
 
-       int cont = pointcontents(racer.origin);
-       if(player.movement)
+       int cont = pointcontents(vehic.origin);
+       if(this.movement)
        {
                if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
                {
-                       if(player.movement_x) { df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
-                       if(player.movement_y) { df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
+                       if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
+                       if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
                }
                else
                {
-                       if(player.movement_x) { df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
-                       if(player.movement_y) { df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
+                       if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
+                       if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
                }
 
 #ifdef SVQC
-               if(self.sound_nexttime < time || self.sounds != 1)
+               if(vehic.sound_nexttime < time || vehic.sounds != 1)
                {
-                       self.sounds = 1;
-                       self.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
-                       sound (self, CH_TRIGGER_SINGLE, SND_VEH_RACER_MOVE, VOL_VEHICLEENGINE, ATTEN_NORM);
+                       vehic.sounds = 1;
+                       vehic.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
+                       sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RACER_MOVE, VOL_VEHICLEENGINE, ATTEN_NORM);
                }
 #endif
        }
 #ifdef SVQC
        else
        {
-               if(self.sound_nexttime < time || self.sounds != 0)
+               if(vehic.sound_nexttime < time || vehic.sounds != 0)
                {
-                       self.sounds = 0;
-                       self.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
-                       sound (self, CH_TRIGGER_SINGLE, SND_VEH_RACER_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
+                       vehic.sounds = 0;
+                       vehic.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
+                       sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RACER_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
                }
        }
 #endif
 
        // Afterburn
-       if (PHYS_INPUT_BUTTON_JUMP(player) && racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH))
+       if (PHYS_INPUT_BUTTON_JUMP(this) && vehic.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH))
        {
 #ifdef SVQC
-               if(time - racer.wait > 0.2)
-                       pointparticles(EFFECT_RACER_BOOSTER, self.origin - v_forward * 32, v_forward  * vlen(self.velocity), 1);
+               if(time - vehic.wait > 0.2)
+                       pointparticles(EFFECT_RACER_BOOSTER, vehic.origin - v_forward * 32, v_forward  * vlen(vehic.velocity), 1);
 #endif
 
-               racer.wait = time;
+               vehic.wait = time;
 
                if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
                {
-                       racer.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * PHYS_INPUT_TIMELENGTH;
+                       vehic.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * PHYS_INPUT_TIMELENGTH;
                        df += (v_forward * autocvar_g_vehicle_racer_waterburn_speed);
                }
                else
                {
-                       racer.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH;
+                       vehic.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH;
                        df += (v_forward * autocvar_g_vehicle_racer_speed_afterburn);
                }
 
 #ifdef SVQC
-               if(racer.invincible_finished < time)
+               if(vehic.invincible_finished < time)
                {
-                       traceline(racer.origin, racer.origin - '0 0 256', MOVE_NORMAL, self);
+                       traceline(vehic.origin, vehic.origin - '0 0 256', MOVE_NORMAL, vehic);
                        if(trace_fraction != 1.0)
                                pointparticles(EFFECT_SMOKE_SMALL, trace_endpos, '0 0 0', 1);
 
-                       racer.invincible_finished = time + 0.1 + (random() * 0.1);
+                       vehic.invincible_finished = time + 0.1 + (random() * 0.1);
                }
 
-               if(racer.strength_finished < time)
+               if(vehic.strength_finished < time)
                {
-                       racer.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
-                       sound (racer.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RACER_BOOST, VOL_VEHICLEENGINE, ATTEN_NORM);
+                       vehic.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
+                       sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RACER_BOOST, VOL_VEHICLEENGINE, ATTEN_NORM);
                }
 #endif
        }
        else
        {
-               racer.strength_finished = 0;
-               sound (racer.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
+               vehic.strength_finished = 0;
+               sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
        }
 
        if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
-               racer.racer_watertime = time;
+               vehic.racer_watertime = time;
 
        float dforce = autocvar_g_vehicle_racer_downforce;
-       if(time - racer.racer_watertime <= 3)
+       if(time - vehic.racer_watertime <= 3)
                dforce = autocvar_g_vehicle_racer_water_downforce;
 
-       df -= v_up * (vlen(racer.velocity) * dforce);
-       player.movement = racer.velocity += df * PHYS_INPUT_TIMELENGTH;
+       df -= v_up * (vlen(vehic.velocity) * dforce);
+       this.movement = vehic.velocity += df * PHYS_INPUT_TIMELENGTH;
 
 #ifdef SVQC
+       setself(vehic);
+
        Weapon wep1 = WEP_RACER;
-       if (!forbidWeaponUse(player))
-       if (PHYS_INPUT_BUTTON_ATCK(player))
+       if (!forbidWeaponUse(this))
+       if (PHYS_INPUT_BUTTON_ATCK(this))
        if (wep1.wr_checkammo1(wep1))
        {
-               string tagname = (racer.cnt)
-                   ? (racer.cnt = 0, "tag_fire1")
-                   : (racer.cnt = 1, "tag_fire2");
-               vector org = gettaginfo(self, gettagindex(self, tagname));
+               string tagname = (vehic.cnt)
+                   ? (vehic.cnt = 0, "tag_fire1")
+                   : (vehic.cnt = 1, "tag_fire2");
+               vector org = gettaginfo(vehic, gettagindex(vehic, tagname));
                w_shotorg = org;
                w_shotdir = v_forward;
                // Fix z-aim (for chase mode)
-               crosshair_trace(player);
+               crosshair_trace(this);
                w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
                .entity weaponentity = weaponentities[0];
-               wep1.wr_think(wep1, self, weaponentity, 1);
+               wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
+       setself(this);
+
        if(autocvar_g_vehicle_racer_rocket_locktarget)
        {
-               vehicles_locktarget(self, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
+               vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
                                                 (1 / autocvar_g_vehicle_racer_rocket_locking_releasetime) * frametime,
                                                 autocvar_g_vehicle_racer_rocket_locked_time);
 
-               if(self.lock_target)
+               if(vehic.lock_target)
                {
-                       if(racer.lock_strength == 1)
-                               UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '1 0 0', 0);
-                       else if(self.lock_strength > 0.5)
-                               UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '0 1 0', 0);
-                       else if(self.lock_strength < 0.5)
-                               UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '0 0 1', 0);
+                       if(vehic.lock_strength == 1)
+                               UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 0);
+                       else if(vehic.lock_strength > 0.5)
+                               UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 0);
+                       else if(vehic.lock_strength < 0.5)
+                               UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 0);
                }
        }
 
-       if(!forbidWeaponUse(player))
-       if(time > racer.delay)
-       if(PHYS_INPUT_BUTTON_ATCK2(player))
+       if(!forbidWeaponUse(this))
+       if(time > vehic.delay)
+       if(PHYS_INPUT_BUTTON_ATCK2(this))
        {
-               racer.misc_bulletcounter += 1;
-               racer.delay = time + 0.3;
+               vehic.misc_bulletcounter += 1;
+               vehic.delay = time + 0.3;
 
-               if(racer.misc_bulletcounter == 1)
+               if(vehic.misc_bulletcounter == 1)
                {
-                       racer_fire_rocket_aim(player, "tag_rocket_r", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
-                       player.vehicle_ammo2 = 50;
+                       racer_fire_rocket_aim(this, "tag_rocket_r", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : world);
+                       this.vehicle_ammo2 = 50;
                }
-               else if(racer.misc_bulletcounter == 2)
+               else if(vehic.misc_bulletcounter == 2)
                {
-                       racer_fire_rocket_aim(player, "tag_rocket_l", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
-                       racer.lock_strength  = 0;
-                       racer.lock_target       = world;
-                       racer.misc_bulletcounter = 0;
-                       racer.delay = time + autocvar_g_vehicle_racer_rocket_refire;
-                       racer.lip = time;
-                       player.vehicle_ammo2 = 0;
+                       racer_fire_rocket_aim(this, "tag_rocket_l", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : world);
+                       vehic.lock_strength  = 0;
+                       vehic.lock_target       = world;
+                       vehic.misc_bulletcounter = 0;
+                       vehic.delay = time + autocvar_g_vehicle_racer_rocket_refire;
+                       vehic.lip = time;
+                       this.vehicle_ammo2 = 0;
                }
        }
-       else if(racer.misc_bulletcounter == 0)
-               player.vehicle_ammo2 = 100;
-
-       player.vehicle_reload2 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
+       else if(vehic.misc_bulletcounter == 0)
+               this.vehicle_ammo2 = 100;
 
-       if(racer.vehicle_flags  & VHF_SHIELDREGEN)
-               vehicles_regen(racer.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
+       this.vehicle_reload2 = bound(0, 100 * ((time - vehic.lip) / (vehic.delay - vehic.lip)), 100);
 
-       if(racer.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen(racer.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
 
-       if(racer.vehicle_flags  & VHF_ENERGYREGEN)
-               vehicles_regen(racer.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, false);
 
+       if(vehic.vehicle_flags  & VHF_ENERGYREGEN)
+               vehicles_regen(vehic, vehic.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, false);
 
-       VEHICLE_UPDATE_PLAYER(player, health, racer);
-       VEHICLE_UPDATE_PLAYER(player, energy, racer);
+       VEHICLE_UPDATE_PLAYER(this, vehic, health, racer);
+       VEHICLE_UPDATE_PLAYER(this, vehic, energy, racer);
 
-       if(racer.vehicle_flags & VHF_HASSHIELD)
-               VEHICLE_UPDATE_PLAYER(player, shield, racer);
+       if(vehic.vehicle_flags & VHF_HASSHIELD)
+               VEHICLE_UPDATE_PLAYER(this, vehic, shield, racer);
 
-       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
 #endif
 
-       setorigin(player,racer.origin + '0 0 32');
-       player.velocity = racer.velocity;
-
-       setself(player);
-       return 1;
+       setorigin(this, vehic.origin + '0 0 32');
+       this.velocity = vehic.velocity;
 }
 
 void racer_think()
@@ -471,7 +471,7 @@ void racer_exit(float eject)
                self.owner.oldvelocity = self.owner.velocity;
                setorigin(self.owner , spot);
        }
-       antilag_clear(self.owner);
+       antilag_clear(self.owner, CS(self.owner));
        self.owner = world;
 }
 
@@ -519,8 +519,8 @@ void racer_deadtouch()
 
 spawnfunc(vehicle_racer)
 {
-       if(!autocvar_g_vehicle_racer) { remove(self); return; }
-       if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
+       if(!autocvar_g_vehicle_racer) { remove(this); return; }
+       if(!vehicle_initialize(this, VEH_RACER, false)) { remove(this); return; }
 }
 
 #endif // SVQC
@@ -564,13 +564,14 @@ METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
     if(autocvar_g_vehicle_racer_bouncepain)
-        vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+        vehicles_impact(instance, autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
 #endif
 }
 
 METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
+    SELFPARAM();
     self.movetype = MOVETYPE_BOUNCE;
     self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
     self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
@@ -578,7 +579,7 @@ METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
     if(self.owner.flagcarried)
        setorigin(self.owner.flagcarried, '-190 0 96');
 #elif defined(CSQC)
-
+    SELFPARAM();
     self.move_movetype = MOVETYPE_BOUNCE;
 #endif
 }
@@ -586,6 +587,7 @@ METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
 METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
+    SELFPARAM();
     if(self.scale != 0.5)
     {
         if(autocvar_g_vehicle_racer_hovertype != 0)
@@ -667,28 +669,26 @@ METHOD(Racer, vr_crosshair, void(Racer thisveh))
 METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
-    self.vehicle_exit = racer_exit;
-#endif
+    instance.vehicle_exit = racer_exit;
 
-#ifdef SVQC
     // we have no need to network energy
     if(autocvar_g_vehicle_racer_energy)
     if(autocvar_g_vehicle_racer_energy_regen)
-        self.vehicle_flags |= VHF_ENERGYREGEN;
+        instance.vehicle_flags |= VHF_ENERGYREGEN;
 
     if(autocvar_g_vehicle_racer_shield)
-        self.vehicle_flags |= VHF_HASSHIELD;
+        instance.vehicle_flags |= VHF_HASSHIELD;
 
     if(autocvar_g_vehicle_racer_shield_regen)
-        self.vehicle_flags |= VHF_SHIELDREGEN;
+        instance.vehicle_flags |= VHF_SHIELDREGEN;
 
     if(autocvar_g_vehicle_racer_health_regen)
-        self.vehicle_flags |= VHF_HEALTHREGEN;
+        instance.vehicle_flags |= VHF_HEALTHREGEN;
 
-    self.respawntime = autocvar_g_vehicle_racer_respawntime;
-    self.vehicle_health = autocvar_g_vehicle_racer_health;
-    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-    self.max_health = self.vehicle_health;
+    instance.respawntime = autocvar_g_vehicle_racer_respawntime;
+    instance.vehicle_health = autocvar_g_vehicle_racer_health;
+    instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
+    instance.max_health = instance.vehicle_health;
 #endif
 
 #ifdef CSQC
index 675d8f17bd70a66560c0c9bc4aaa880b9b53f391..ee86a622974ef0bff1fc37826730ff1978a69565 100644 (file)
@@ -1,46 +1,9 @@
-#ifndef VEHICLE_RACER_WEAPON_H
-#define VEHICLE_RACER_WEAPON_H
-
-#include <common/weapons/all.qh>
-
-CLASS(RacerAttack, PortoLaunch)
-/* flags     */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(RacerAttack, impulse, int, 3);
-/* refname   */ ATTRIB(RacerAttack, netname, string, "racercannon");
-/* wepname   */ ATTRIB(RacerAttack, m_name, string, _("Racer cannon"));
-ENDCLASS(RacerAttack)
-REGISTER_WEAPON(RACER, NEW(RacerAttack));
-
-// TODO: move into implementation
-#ifdef SVQC
-float autocvar_g_vehicle_racer_rocket_refire;
-void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
-#endif
-
-#endif
+#include "racer_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
 #ifdef SVQC
 
-float autocvar_g_vehicle_racer_cannon_cost;
-float autocvar_g_vehicle_racer_cannon_damage;
-float autocvar_g_vehicle_racer_cannon_radius;
-float autocvar_g_vehicle_racer_cannon_refire;
-float autocvar_g_vehicle_racer_cannon_speed;
-float autocvar_g_vehicle_racer_cannon_spread;
-float autocvar_g_vehicle_racer_cannon_force;
-
-float autocvar_g_vehicle_racer_rocket_accel;
-float autocvar_g_vehicle_racer_rocket_damage;
-float autocvar_g_vehicle_racer_rocket_radius;
-float autocvar_g_vehicle_racer_rocket_force;
-float autocvar_g_vehicle_racer_rocket_speed;
-float autocvar_g_vehicle_racer_rocket_turnrate;
-
-float autocvar_g_vehicle_racer_rocket_climbspeed;
-float autocvar_g_vehicle_racer_rocket_locked_maxangle;
-
 void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
 METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -53,10 +16,10 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone
             veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
             veh.wait = time;
         }
-        if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+        if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0);
         vector org = w_shotorg;
         vector dir = w_shotdir;
-        entity bolt = vehicles_projectile(EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE),
+        entity bolt = vehicles_projectile(veh, EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND_LASERGUN_FIRE,
                                org, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed,
                                autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force,  0,
                                DEATH_VH_WAKI_GUN.m_id, PROJECTILE_WAKICANNON, 0, true, true, player);
@@ -65,7 +28,7 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone
     }
     if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
-        if (isPlayer) W_SetupShot_Dir(actor, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+        if (isPlayer) W_SetupShot_Dir(actor, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0);
         racer_fire_rocket(player, w_shotorg, w_shotdir, NULL);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, 0, w_ready);
     }
@@ -84,8 +47,8 @@ void racer_rocket_tracker();
 void racer_rocket_groundhugger();
 
 void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
-{SELFPARAM();
-    entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+{
+    entity rocket = vehicles_projectile(player.vehicle, EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                            org, dir * autocvar_g_vehicle_racer_rocket_speed,
                            autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
                            DEATH_VH_WAKI_ROCKET.m_id, PROJECTILE_WAKIROCKET, 20, false, false, player);
diff --git a/qcsrc/common/vehicles/vehicle/racer_weapon.qh b/qcsrc/common/vehicles/vehicle/racer_weapon.qh
new file mode 100644 (file)
index 0000000..fc9e352
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <common/weapons/all.qh>
+
+CLASS(RacerAttack, PortoLaunch)
+/* flags     */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(RacerAttack, impulse, int, 3);
+/* refname   */ ATTRIB(RacerAttack, netname, string, "racercannon");
+/* wepname   */ ATTRIB(RacerAttack, m_name, string, _("Racer cannon"));
+ENDCLASS(RacerAttack)
+REGISTER_WEAPON(RACER, NEW(RacerAttack));
+
+// TODO: move into implementation
+#ifdef SVQC
+void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
+#endif
+
+float autocvar_g_vehicle_racer_cannon_cost = 2;
+float autocvar_g_vehicle_racer_cannon_damage = 15;
+float autocvar_g_vehicle_racer_cannon_radius = 100;
+float autocvar_g_vehicle_racer_cannon_refire = 0.05;
+float autocvar_g_vehicle_racer_cannon_speed = 15000;
+float autocvar_g_vehicle_racer_cannon_spread = 0.0125;
+float autocvar_g_vehicle_racer_cannon_force = 50;
+
+float autocvar_g_vehicle_racer_rocket_accel = 1600;
+float autocvar_g_vehicle_racer_rocket_damage = 100;
+float autocvar_g_vehicle_racer_rocket_radius = 125;
+float autocvar_g_vehicle_racer_rocket_force = 350;
+float autocvar_g_vehicle_racer_rocket_speed = 900;
+float autocvar_g_vehicle_racer_rocket_turnrate = 0.2;
+float autocvar_g_vehicle_racer_rocket_refire = 3;
+
+float autocvar_g_vehicle_racer_rocket_climbspeed = 1600;
+float autocvar_g_vehicle_racer_rocket_locked_maxangle = 1.8;
index 8f8f3cf72f70ea4ccad7b1a799e0ac034505f749..8b2f9e01b89a7160ade80bf7d2a90f5ac992d5c4 100644 (file)
@@ -2,7 +2,7 @@
 #define VEHICLE_RAPTOR
 #include "raptor.qh"
 
-#include "raptor_weapons.qc"
+#include "raptor_weapons.qh"
 
 CLASS(Raptor, Vehicle)
 /* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
@@ -27,52 +27,52 @@ REGISTER_VEHICLE(RAPTOR, NEW(Raptor));
 
 #ifdef IMPLEMENTATION
 
-#include "raptor_weapons.qc"
-
 #ifdef SVQC
 
-bool autocvar_g_vehicle_raptor;
+bool autocvar_g_vehicle_raptor = true;
 
-float autocvar_g_vehicle_raptor_respawntime;
-float autocvar_g_vehicle_raptor_takeofftime;
+float autocvar_g_vehicle_raptor_respawntime = 40;
+float autocvar_g_vehicle_raptor_takeofftime = 1.5;
 
-float autocvar_g_vehicle_raptor_movestyle;
-float autocvar_g_vehicle_raptor_turnspeed;
-float autocvar_g_vehicle_raptor_pitchspeed;
-float autocvar_g_vehicle_raptor_pitchlimit;
+// 0: go where player aims, +forward etc relative to aim angles
+// 1: ignore aim for up/down movement. +forward always moved forward, +jump always moves up
+int autocvar_g_vehicle_raptor_movestyle = 1;
+float autocvar_g_vehicle_raptor_turnspeed = 200;
+float autocvar_g_vehicle_raptor_pitchspeed = 50;
+float autocvar_g_vehicle_raptor_pitchlimit = 45;
 
-float autocvar_g_vehicle_raptor_speed_forward;
-float autocvar_g_vehicle_raptor_speed_strafe;
-float autocvar_g_vehicle_raptor_speed_up;
-float autocvar_g_vehicle_raptor_speed_down;
-float autocvar_g_vehicle_raptor_friction;
+float autocvar_g_vehicle_raptor_speed_forward = 1700;
+float autocvar_g_vehicle_raptor_speed_strafe = 900;
+float autocvar_g_vehicle_raptor_speed_up = 1700;
+float autocvar_g_vehicle_raptor_speed_down = 1700;
+float autocvar_g_vehicle_raptor_friction = 2;
 
-float autocvar_g_vehicle_raptor_cannon_turnspeed;
-float autocvar_g_vehicle_raptor_cannon_turnlimit;
-float autocvar_g_vehicle_raptor_cannon_pitchlimit_up;
-float autocvar_g_vehicle_raptor_cannon_pitchlimit_down;
+float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
+float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
+float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
+float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32;
 
-float autocvar_g_vehicle_raptor_cannon_locktarget;
-float autocvar_g_vehicle_raptor_cannon_locking_time;
-float autocvar_g_vehicle_raptor_cannon_locking_releasetime;
-float autocvar_g_vehicle_raptor_cannon_locked_time;
-float autocvar_g_vehicle_raptor_cannon_predicttarget;
+float autocvar_g_vehicle_raptor_cannon_locktarget = 0;
+float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2;
+float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45;
+float autocvar_g_vehicle_raptor_cannon_locked_time = 1;
+float autocvar_g_vehicle_raptor_cannon_predicttarget = 1;
 
-float autocvar_g_vehicle_raptor_energy;
-float autocvar_g_vehicle_raptor_energy_regen;
-float autocvar_g_vehicle_raptor_energy_regen_pause;
+float autocvar_g_vehicle_raptor_energy = 100;
+float autocvar_g_vehicle_raptor_energy_regen = 25;
+float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25;
 
-float autocvar_g_vehicle_raptor_health;
-float autocvar_g_vehicle_raptor_health_regen;
-float autocvar_g_vehicle_raptor_health_regen_pause;
+float autocvar_g_vehicle_raptor_health = 150;
+float autocvar_g_vehicle_raptor_health_regen = 0;
+float autocvar_g_vehicle_raptor_health_regen_pause = 0;
 
-float autocvar_g_vehicle_raptor_shield;
-float autocvar_g_vehicle_raptor_shield_regen;
-float autocvar_g_vehicle_raptor_shield_regen_pause;
+float autocvar_g_vehicle_raptor_shield = 75;
+float autocvar_g_vehicle_raptor_shield_regen = 25;
+float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5;
 
-float autocvar_g_vehicle_raptor_bouncefactor;
-float autocvar_g_vehicle_raptor_bouncestop;
-vector autocvar_g_vehicle_raptor_bouncepain;
+float autocvar_g_vehicle_raptor_bouncefactor = 0.2;
+float autocvar_g_vehicle_raptor_bouncestop = 0;
+vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000';
 
 .entity bomb1;
 .entity bomb2;
@@ -154,76 +154,71 @@ void raptor_exit(float eject)
                setorigin(self.owner , spot);
        }
 
-       antilag_clear(self.owner);
+       antilag_clear(self.owner, CS(self.owner));
        self.owner = world;
 }
 
-float raptor_frame()
-{SELFPARAM();
-       entity player, raptor;
-       float ftmp = 0;
-       vector df;
+bool raptor_frame(entity this)
+{
+       entity vehic = this.vehicle;
+       return = true;
 
        if(intermission_running)
        {
-               self.vehicle.velocity = '0 0 0';
-               self.vehicle.avelocity = '0 0 0';
-               return 1;
+               vehic.velocity = '0 0 0';
+               vehic.avelocity = '0 0 0';
+               return;
        }
 
-       player = self;
-       raptor = self.vehicle;
-       setself(raptor);
-
-       vehicles_frame(raptor, player);
+       vehicles_frame(vehic, this);
 
+       float ftmp = 0;
        /*
-       ftmp = vlen(self.velocity);
+       ftmp = vlen(vehic.velocity);
        if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
                ftmp = 1;
        else
                ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
        */
 
-       if(self.sound_nexttime < time)
+       if(vehic.sound_nexttime < time)
        {
-               self.sound_nexttime = time + 7.955812;
-               //sound (self.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp,   ATTEN_NORM );
-               sound (self, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
-               self.wait = ftmp;
+               vehic.sound_nexttime = time + 7.955812;
+               //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp,   ATTEN_NORM );
+               sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
+               vehic.wait = ftmp;
        }
        /*
-       else if(fabs(ftmp - self.wait) > 0.2)
+       else if(fabs(ftmp - vehic.wait) > 0.2)
        {
-               sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp,   ATTEN_NORM );
-               sound (self, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
-               self.wait = ftmp;
+               sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp,   ATTEN_NORM );
+               sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
+               vehic.wait = ftmp;
        }
        */
 
-       if(IS_DEAD(raptor))
+       if(IS_DEAD(vehic))
        {
-               setself(player);
-               PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
-               return 1;
+               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+               return;
        }
-       crosshair_trace(player);
+       crosshair_trace(this);
 
-       //if(time - self.lastteleporttime < 1)
+       //if(time - vehic.lastteleporttime < 1)
        //{
-               if(raptor.angles_z > 50 || raptor.angles_z < -50)
+               if(vehic.angles_z > 50 || vehic.angles_z < -50)
                {
-                       if(PHYS_INPUT_BUTTON_JUMP(player))
+                       if(PHYS_INPUT_BUTTON_JUMP(this))
                        {
-                               PHYS_INPUT_BUTTON_CROUCH(player) = true;
-                               PHYS_INPUT_BUTTON_JUMP(player) = false;
+                               PHYS_INPUT_BUTTON_CROUCH(this) = true;
+                               PHYS_INPUT_BUTTON_JUMP(this) = false;
                        }
                }
        //}
 
        vector vang;
-       vang = raptor.angles;
-       df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
+       vang = vehic.angles;
+       vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
        vang_x *= -1;
        df_x *= -1;
        if(df_x > 180)  df_x -= 360;
@@ -231,71 +226,71 @@ float raptor_frame()
        if(df_y > 180)  df_y -= 360;
        if(df_y < -180) df_y += 360;
 
-       ftmp = shortangle_f(player.v_angle_y - vang_y, vang_y);
+       ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
        if(ftmp > 180)  ftmp -= 360; if(ftmp < -180) ftmp += 360;
-       raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
+       vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
 
        // Pitch
        ftmp = 0;
-       if(player.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
-       else if(player.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
+       if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
+       else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
 
        df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
        ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
-       raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
+       vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
 
-       raptor.angles_x = anglemods(raptor.angles_x);
-       raptor.angles_y = anglemods(raptor.angles_y);
-       raptor.angles_z = anglemods(raptor.angles_z);
+       vehic.angles_x = anglemods(vehic.angles_x);
+       vehic.angles_y = anglemods(vehic.angles_y);
+       vehic.angles_z = anglemods(vehic.angles_z);
 
        if(autocvar_g_vehicle_raptor_movestyle == 1)
-               makevectors('0 1 0' * raptor.angles_y);
+               makevectors('0 1 0' * vehic.angles_y);
        else
-               makevectors(player.v_angle);
+               makevectors(this.v_angle);
 
-       df = raptor.velocity * -autocvar_g_vehicle_raptor_friction;
+       df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
 
-       if(player.movement_x != 0)
+       if(this.movement_x != 0)
        {
-               if(player.movement_x > 0)
+               if(this.movement_x > 0)
                        df += v_forward  * autocvar_g_vehicle_raptor_speed_forward;
-               else if(player.movement_x < 0)
+               else if(this.movement_x < 0)
                        df -= v_forward  * autocvar_g_vehicle_raptor_speed_forward;
        }
 
-       if(player.movement_y != 0)
+       if(this.movement_y != 0)
        {
-               if(player.movement_y < 0)
+               if(this.movement_y < 0)
                        df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
-               else if(player.movement_y > 0)
+               else if(this.movement_y > 0)
                        df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
 
-               raptor.angles_z = bound(-30,raptor.angles_z + (player.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
+               vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
        }
        else
        {
-               raptor.angles_z *= 0.95;
-               if(raptor.angles_z >= -1 && raptor.angles_z <= -1)
-                       raptor.angles_z = 0;
+               vehic.angles_z *= 0.95;
+               if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
+                       vehic.angles_z = 0;
        }
 
-       if(PHYS_INPUT_BUTTON_CROUCH(player))
+       if(PHYS_INPUT_BUTTON_CROUCH(this))
                df -=   v_up * autocvar_g_vehicle_raptor_speed_down;
-       else if (PHYS_INPUT_BUTTON_JUMP(player))
+       else if (PHYS_INPUT_BUTTON_JUMP(this))
                df +=  v_up * autocvar_g_vehicle_raptor_speed_up;
 
-       raptor.velocity  += df * frametime;
-       player.velocity = player.movement  = raptor.velocity;
-       setorigin(player, raptor.origin + '0 0 32');
+       vehic.velocity  += df * frametime;
+       this.velocity = this.movement  = vehic.velocity;
+       setorigin(this, vehic.origin + '0 0 32');
 
-       player.vehicle_weapon2mode = raptor.vehicle_weapon2mode;
+       this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
 
        vector vf, ad;
        // Target lock & predict
        if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
        {
-               if(raptor.gun1.lock_time < time || IS_DEAD(raptor.gun1.enemy) || STAT(FROZEN, raptor.gun1.enemy))
-                       raptor.gun1.enemy = world;
+               if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
+                       vehic.gun1.enemy = world;
 
                if(trace_ent)
                if(trace_ent.movetype)
@@ -304,33 +299,33 @@ float raptor_frame()
                {
                        if(teamplay)
                        {
-                               if(trace_ent.team != player.team)
+                               if(trace_ent.team != this.team)
                                {
-                                       raptor.gun1.enemy = trace_ent;
-                                       raptor.gun1.lock_time = time + 5;
+                                       vehic.gun1.enemy = trace_ent;
+                                       vehic.gun1.lock_time = time + 5;
                                }
                        }
                        else
                        {
-                               raptor.gun1.enemy = trace_ent;
-                               raptor.gun1.lock_time = time + 0.5;
+                               vehic.gun1.enemy = trace_ent;
+                               vehic.gun1.lock_time = time + 0.5;
                        }
                }
 
-               if(raptor.gun1.enemy)
+               if(vehic.gun1.enemy)
                {
                        float distance, impact_time;
 
-                       vf = real_origin(raptor.gun1.enemy);
-                       UpdateAuxiliaryXhair(player, vf, '1 0 0', 1);
-                       vector _vel = raptor.gun1.enemy.velocity;
-                       if(raptor.gun1.enemy.movetype == MOVETYPE_WALK)
+                       vf = real_origin(vehic.gun1.enemy);
+                       UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
+                       vector _vel = vehic.gun1.enemy.velocity;
+                       if(vehic.gun1.enemy.movetype == MOVETYPE_WALK)
                                _vel_z *= 0.1;
 
                        if(autocvar_g_vehicle_raptor_cannon_predicttarget)
                        {
                                ad = vf;
-                               distance = vlen(ad - player.origin);
+                               distance = vlen(ad - this.origin);
                                impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
                                ad = vf + _vel * impact_time;
                                trace_endpos = ad;
@@ -342,188 +337,188 @@ float raptor_frame()
        else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
        {
 
-               vehicles_locktarget(self, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
+               vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
                                                         (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime,
                                                         autocvar_g_vehicle_raptor_cannon_locked_time);
 
-               if(self.lock_target != world)
+               if(vehic.lock_target != world)
                if(autocvar_g_vehicle_raptor_cannon_predicttarget)
-               if(self.lock_strength == 1)
+               if(vehic.lock_strength == 1)
                {
                        float i, distance, impact_time;
 
-                       vf = real_origin(raptor.lock_target);
+                       vf = real_origin(vehic.lock_target);
                        ad = vf;
                        for(i = 0; i < 4; ++i)
                        {
-                               distance = vlen(ad - raptor.origin);
+                               distance = vlen(ad - vehic.origin);
                                impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
-                               ad = vf + raptor.lock_target.velocity * impact_time;
+                               ad = vf + vehic.lock_target.velocity * impact_time;
                        }
                        trace_endpos = ad;
                }
 
-               if(self.lock_target)
+               if(vehic.lock_target)
                {
-                       if(raptor.lock_strength == 1)
-                               UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '1 0 0', 1);
-                       else if(self.lock_strength > 0.5)
-                               UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '0 1 0', 1);
-                       else if(self.lock_strength < 0.5)
-                               UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '0 0 1', 1);
+                       if(vehic.lock_strength == 1)
+                               UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
+                       else if(vehic.lock_strength > 0.5)
+                               UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
+                       else if(vehic.lock_strength < 0.5)
+                               UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
                }
        }
 
 
-       vehicle_aimturret(raptor, trace_endpos, raptor.gun1, "fire1",
+       vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
                                                  autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1,  autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
                                                  autocvar_g_vehicle_raptor_cannon_turnlimit * -1,  autocvar_g_vehicle_raptor_cannon_turnlimit,  autocvar_g_vehicle_raptor_cannon_turnspeed);
 
-       vehicle_aimturret(raptor, trace_endpos, raptor.gun2, "fire1",
+       vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
                                                  autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1,  autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
                                                  autocvar_g_vehicle_raptor_cannon_turnlimit * -1,  autocvar_g_vehicle_raptor_cannon_turnlimit,  autocvar_g_vehicle_raptor_cannon_turnspeed);
 
        /*
        ad = ad * 0.5;
        v_forward = vf * 0.5;
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, raptor);
-       UpdateAuxiliaryXhair(player, trace_endpos, '0 1 0', 0);
+       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
        */
 
+       // TODO: fix wr_checkammo and its use of self!
+       setself(vehic);
+
        Weapon wep1 = WEP_RAPTOR;
-       if(!forbidWeaponUse(player))
-       if(PHYS_INPUT_BUTTON_ATCK(player))
+       if(!forbidWeaponUse(this))
+       if(PHYS_INPUT_BUTTON_ATCK(this))
        if (wep1.wr_checkammo1(wep1))
        {
            .entity weaponentity = weaponentities[0];
-               wep1.wr_think(wep1, self, weaponentity, 1);
+               wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
-       if(self.vehicle_flags  & VHF_SHIELDREGEN)
-               vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
+       if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
 
-       if(self.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
 
-       if(self.vehicle_flags  & VHF_ENERGYREGEN)
-               vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_ENERGYREGEN)
+               vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
 
        Weapon wep2a = WEP_RAPTOR_BOMB;
-       if(!forbidWeaponUse(player))
-       if(raptor.vehicle_weapon2mode == RSM_BOMB)
+       if(!forbidWeaponUse(this))
+       if(vehic.vehicle_weapon2mode == RSM_BOMB)
        {
-               if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire)
-               if(PHYS_INPUT_BUTTON_ATCK2(player))
+               if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
+               if(PHYS_INPUT_BUTTON_ATCK2(this))
                {
                    .entity weaponentity = weaponentities[1];
-                       wep2a.wr_think(wep2a, self, weaponentity, 2);
-                       raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
-                       raptor.lip   = time;
+                       wep2a.wr_think(wep2a, vehic, weaponentity, 2);
+                       vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
+                       vehic.lip   = time;
                }
        }
        else
        {
                Weapon wep2b = WEP_RAPTOR_FLARE;
-               if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire)
-               if(PHYS_INPUT_BUTTON_ATCK2(player))
+               if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
+               if(PHYS_INPUT_BUTTON_ATCK2(this))
                {
                    .entity weaponentity = weaponentities[1];
-                       wep2b.wr_think(wep2b, self, weaponentity, 2);
-                       raptor.delay = time + autocvar_g_vehicle_raptor_flare_refire;
-                       raptor.lip   = time;
+                       wep2b.wr_think(wep2b, vehic, weaponentity, 2);
+                       vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
+                       vehic.lip   = time;
                }
        }
 
-       raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
-       player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
-       player.vehicle_ammo2 = (player.vehicle_reload2 == 100) ? 100 : 0;
+       setself(this);
 
-       if(self.bomb1.cnt < time)
+       vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
+       this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
+       this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
+
+       if(vehic.bomb1.cnt < time)
        {
-               entity _missile = findchainentity(enemy, raptor);
-               float _incomming = 0;
-               while(_missile)
+               bool incoming = false;
+               FOREACH_ENTITY_ENT(enemy, vehic,
                {
-                       if(_missile.flags & FL_PROJECTILE)
-                       if(MISSILE_IS_TRACKING(_missile))
-                       if(vdist(self.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
-                               ++_incomming;
+                       if(it.flags & FL_PROJECTILE)
+                       if(MISSILE_IS_TRACKING(it))
+                       if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
+                       {
+                               incoming = true;
+                               break;
+                       }
+               });
 
-                       _missile = _missile.chain;
+               if(incoming)
+               {
+                       msg_entity = this;
+                       soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
                }
 
-               if(_incomming)
-                       sound(self, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE);
-
-               self.bomb1.cnt = time + 1;
+               vehic.bomb1.cnt = time + 1;
        }
 
 
-       VEHICLE_UPDATE_PLAYER(player, health, raptor);
-       VEHICLE_UPDATE_PLAYER(player, energy, raptor);
-       if(self.vehicle_flags & VHF_HASSHIELD)
-               VEHICLE_UPDATE_PLAYER(player, shield, raptor);
+       VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
+       VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
+       if(vehic.vehicle_flags & VHF_HASSHIELD)
+               VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
-       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
-
-       setself(player);
-       return 1;
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 }
 
-float raptor_takeoff()
-{SELFPARAM();
-       entity player, raptor;
-
-       player = self;
-       raptor = self.vehicle;
-       setself(raptor);
+bool raptor_takeoff(entity this)
+{
+       entity vehic = this.vehicle;
+       return = true;
 
-       self.nextthink = time;
-       CSQCMODEL_AUTOUPDATE(self);
-       self.nextthink = 0; // will this work?
+       vehic.nextthink = time;
+       CSQCMODEL_AUTOUPDATE(vehic);
+       vehic.nextthink = 0; // will this work?
 
-       if(self.sound_nexttime < time)
+       if(vehic.sound_nexttime < time)
        {
-               self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
-               sound (self, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
+               vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
+               sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
        }
 
        // Takeoff sequense
-       if(raptor.frame < 25)
+       if(vehic.frame < 25)
        {
-               raptor.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
-               raptor.velocity_z = min(raptor.velocity_z * 1.5, 256);
-               self.bomb1.gun1.avelocity_y = 90 + ((raptor.frame / 25) * 25000);
-               self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
-               PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
+               vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
+               vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
+               vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
+               vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
+               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 
-               setorigin(player, raptor.origin + '0 0 32');
+               setorigin(this, vehic.origin + '0 0 32');
        }
        else
-               player.PlayerPhysplug = raptor_frame;
+               this.PlayerPhysplug = raptor_frame;
 
-       if(self.vehicle_flags  & VHF_SHIELDREGEN)
-               vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
+       if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
 
-       if(self.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
 
-       if(self.vehicle_flags  & VHF_ENERGYREGEN)
-               vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_ENERGYREGEN)
+               vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
 
 
-       raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
-       player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
-       player.vehicle_ammo2 = (player.vehicle_reload2 == 100) ? 100 : 0;
+       vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
+       this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
+       this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
 
-       VEHICLE_UPDATE_PLAYER(player, health, raptor);
-       VEHICLE_UPDATE_PLAYER(player, energy, raptor);
-       if(self.vehicle_flags & VHF_HASSHIELD)
-               VEHICLE_UPDATE_PLAYER(player, shield, raptor);
+       VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
+       VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
+       if(vehic.vehicle_flags & VHF_HASSHIELD)
+               VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
-       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
-       setself(player);
-       return 1;
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 }
 
 void raptor_blowup()
@@ -613,17 +608,18 @@ float raptor_impulse(float _imp)
 
 spawnfunc(vehicle_raptor)
 {
-       if(!autocvar_g_vehicle_raptor) { remove(self); return; }
-       if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
+       if(!autocvar_g_vehicle_raptor) { remove(this); return; }
+       if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
 }
 
 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
 {
     if(autocvar_g_vehicle_raptor_bouncepain)
-        vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+        vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
 }
 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
 {
+    SELFPARAM();
     self.vehicle_weapon2mode = RSM_BOMB;
     self.owner.PlayerPhysplug = raptor_takeoff;
     self.movetype         = MOVETYPE_BOUNCEMISSILE;
@@ -665,6 +661,7 @@ METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
 }
 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
 {
+    SELFPARAM();
     if(!self.gun1)
     {
         entity spinner;
@@ -757,22 +754,22 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
 {
     if(autocvar_g_vehicle_raptor_shield)
-        self.vehicle_flags |= VHF_HASSHIELD;
+        instance.vehicle_flags |= VHF_HASSHIELD;
 
     if(autocvar_g_vehicle_raptor_shield_regen)
-        self.vehicle_flags |= VHF_SHIELDREGEN;
+        instance.vehicle_flags |= VHF_SHIELDREGEN;
 
     if(autocvar_g_vehicle_raptor_health_regen)
-        self.vehicle_flags |= VHF_HEALTHREGEN;
+        instance.vehicle_flags |= VHF_HEALTHREGEN;
 
     if(autocvar_g_vehicle_raptor_energy_regen)
-        self.vehicle_flags |= VHF_ENERGYREGEN;
+        instance.vehicle_flags |= VHF_ENERGYREGEN;
 
-    self.vehicle_exit = raptor_exit;
-    self.respawntime = autocvar_g_vehicle_raptor_respawntime;
-    self.vehicle_health = autocvar_g_vehicle_raptor_health;
-    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-    self.max_health = self.vehicle_health;
+    instance.vehicle_exit = raptor_exit;
+    instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
+    instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+    instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+    instance.max_health = instance.vehicle_health;
 }
 
 #endif
@@ -786,6 +783,7 @@ METHOD(Raptor, vr_hud, void(Raptor thisveh))
 }
 METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
 {
+    SELFPARAM();
     string crosshair;
 
     switch(weapon2mode)
index 175dbd0995348a055bd010518052f3506dc4e4dc..c51fa154f7925155680db346c788409e6e02c9b0 100644 (file)
@@ -1,56 +1,9 @@
-#ifndef VEHICLE_RAPTOR_WEAPONS_H
-#define VEHICLE_RAPTOR_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-CLASS(RaptorCannon, PortoLaunch)
-/* flags     */ ATTRIB(RaptorCannon, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(RaptorCannon, impulse, int, 3);
-/* refname   */ ATTRIB(RaptorCannon, netname, string, "raptorcannon");
-/* wepname   */ ATTRIB(RaptorCannon, m_name, string, _("Raptor cannon"));
-ENDCLASS(RaptorCannon)
-REGISTER_WEAPON(RAPTOR, NEW(RaptorCannon));
-
-CLASS(RaptorBomb, PortoLaunch)
-/* flags     */ ATTRIB(RaptorBomb, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(RaptorBomb, impulse, int, 3);
-/* refname   */ ATTRIB(RaptorBomb, netname, string, "raptorbomb");
-/* wepname   */ ATTRIB(RaptorBomb, m_name, string, _("Raptor bomb"));
-ENDCLASS(RaptorBomb)
-REGISTER_WEAPON(RAPTOR_BOMB, NEW(RaptorBomb));
-
-CLASS(RaptorFlare, PortoLaunch)
-/* flags     */ ATTRIB(RaptorFlare, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(RaptorFlare, impulse, int, 3);
-/* refname   */ ATTRIB(RaptorFlare, netname, string, "raptorflare");
-/* wepname   */ ATTRIB(RaptorFlare, m_name, string, _("Raptor flare"));
-ENDCLASS(RaptorFlare)
-REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
-
-#endif
+#include "raptor_weapons.qh"
 
 #ifdef IMPLEMENTATION
 
 #ifdef SVQC
 
-float autocvar_g_vehicle_raptor_cannon_cost;
-float autocvar_g_vehicle_raptor_cannon_damage;
-float autocvar_g_vehicle_raptor_cannon_radius;
-float autocvar_g_vehicle_raptor_cannon_refire;
-float autocvar_g_vehicle_raptor_cannon_speed;
-float autocvar_g_vehicle_raptor_cannon_spread;
-float autocvar_g_vehicle_raptor_cannon_force;
-
-float autocvar_g_vehicle_raptor_bomblets;
-float autocvar_g_vehicle_raptor_bomblet_alt;
-float autocvar_g_vehicle_raptor_bomblet_time;
-float autocvar_g_vehicle_raptor_bomblet_damage;
-float autocvar_g_vehicle_raptor_bomblet_spread;
-float autocvar_g_vehicle_raptor_bomblet_edgedamage;
-float autocvar_g_vehicle_raptor_bomblet_radius;
-float autocvar_g_vehicle_raptor_bomblet_force;
-float autocvar_g_vehicle_raptor_bomblet_explode_delay;
-
 METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
     entity player = isPlayer ? actor : actor.owner;
@@ -59,7 +12,7 @@ METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weapon
     float t = autocvar_g_vehicle_raptor_cannon_refire * (1 + veh.misc_bulletcounter == 4);
     if (fire & 1)
     if (weapon_prepareattack(thiswep, player, weaponentity, false, t)) {
-        if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+        if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0);
         vector org = w_shotorg;
         vector dir = w_shotdir;
         if (veh) {
@@ -70,7 +23,7 @@ METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weapon
             veh.vehicle_energy -= autocvar_g_vehicle_raptor_cannon_cost;
             actor.cnt = time;
         }
-        vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE),
+        vehicles_projectile(veh, EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND_LASERGUN_FIRE,
                                org, normalize(dir + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
                                autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force,  0,
                                DEATH_VH_RAPT_CANNON.m_id, PROJECTILE_RAPTORCANNON, 0, true, true, player);
@@ -85,7 +38,6 @@ METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep)) {
     return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_raptor_cannon_cost;
 }
 
-float autocvar_g_vehicle_raptor_bombs_refire;
 
 void raptor_bombdrop();
 METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
@@ -100,11 +52,6 @@ METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponen
     }
 }
 
-float autocvar_g_vehicle_raptor_flare_refire;
-float autocvar_g_vehicle_raptor_flare_lifetime;
-float autocvar_g_vehicle_raptor_flare_chase;
-float autocvar_g_vehicle_raptor_flare_range;
-
 void raptor_flare_think();
 void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 void raptor_flare_touch();
diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qh b/qcsrc/common/vehicles/vehicle/raptor_weapons.qh
new file mode 100644 (file)
index 0000000..0b3af41
--- /dev/null
@@ -0,0 +1,53 @@
+#pragma once
+
+#include <common/weapons/all.qh>
+
+CLASS(RaptorCannon, PortoLaunch)
+/* flags     */ ATTRIB(RaptorCannon, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(RaptorCannon, impulse, int, 3);
+/* refname   */ ATTRIB(RaptorCannon, netname, string, "raptorcannon");
+/* wepname   */ ATTRIB(RaptorCannon, m_name, string, _("Raptor cannon"));
+ENDCLASS(RaptorCannon)
+REGISTER_WEAPON(RAPTOR, NEW(RaptorCannon));
+
+CLASS(RaptorBomb, PortoLaunch)
+/* flags     */ ATTRIB(RaptorBomb, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(RaptorBomb, impulse, int, 3);
+/* refname   */ ATTRIB(RaptorBomb, netname, string, "raptorbomb");
+/* wepname   */ ATTRIB(RaptorBomb, m_name, string, _("Raptor bomb"));
+ENDCLASS(RaptorBomb)
+REGISTER_WEAPON(RAPTOR_BOMB, NEW(RaptorBomb));
+
+CLASS(RaptorFlare, PortoLaunch)
+/* flags     */ ATTRIB(RaptorFlare, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse   */ ATTRIB(RaptorFlare, impulse, int, 3);
+/* refname   */ ATTRIB(RaptorFlare, netname, string, "raptorflare");
+/* wepname   */ ATTRIB(RaptorFlare, m_name, string, _("Raptor flare"));
+ENDCLASS(RaptorFlare)
+REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
+
+
+float autocvar_g_vehicle_raptor_cannon_cost = 1;
+float autocvar_g_vehicle_raptor_cannon_damage = 10;
+float autocvar_g_vehicle_raptor_cannon_radius = 60;
+float autocvar_g_vehicle_raptor_cannon_refire = 0.03;
+float autocvar_g_vehicle_raptor_cannon_speed = 24000;
+float autocvar_g_vehicle_raptor_cannon_spread = 0.01;
+float autocvar_g_vehicle_raptor_cannon_force = 25;
+
+float autocvar_g_vehicle_raptor_bomblets = 8;
+float autocvar_g_vehicle_raptor_bomblet_alt = 750;
+float autocvar_g_vehicle_raptor_bomblet_time = 0.5;
+float autocvar_g_vehicle_raptor_bomblet_damage = 55;
+float autocvar_g_vehicle_raptor_bomblet_spread = 0.4;
+float autocvar_g_vehicle_raptor_bomblet_edgedamage = 25;
+float autocvar_g_vehicle_raptor_bomblet_radius = 350;
+float autocvar_g_vehicle_raptor_bomblet_force = 150;
+float autocvar_g_vehicle_raptor_bomblet_explode_delay = 0.4;
+
+float autocvar_g_vehicle_raptor_bombs_refire = 5;
+
+float autocvar_g_vehicle_raptor_flare_refire = 5;
+float autocvar_g_vehicle_raptor_flare_lifetime = 10;
+float autocvar_g_vehicle_raptor_flare_chase = 0.9;
+float autocvar_g_vehicle_raptor_flare_range = 2000;
index 589f6ff9e83635b160f535a8f86056654220e352..57f1310c4b8cf618f21b8f12b2f2ba39aa13e7a4 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef VEHICLE_SPIDERBOT
 #define VEHICLE_SPIDERBOT
 
-#include "spiderbot_weapons.qc"
+#include "spiderbot_weapons.qh"
 
 CLASS(Spiderbot, Vehicle)
 /* spawnflags */ ATTRIB(Spiderbot, spawnflags, int, VHF_DMGSHAKE);
@@ -33,238 +33,231 @@ const int SBRM_GUIDE = 2;
 const int SBRM_ARTILLERY = 3;
 const int SBRM_LAST = 3;
 
-#include "spiderbot_weapons.qc"
-
 #ifdef SVQC
-bool autocvar_g_vehicle_spiderbot;
+bool autocvar_g_vehicle_spiderbot = true;
 
-float autocvar_g_vehicle_spiderbot_respawntime;
+float autocvar_g_vehicle_spiderbot_respawntime = 45;
 
-float autocvar_g_vehicle_spiderbot_speed_stop;
-float autocvar_g_vehicle_spiderbot_speed_strafe;
-float autocvar_g_vehicle_spiderbot_speed_walk;
+float autocvar_g_vehicle_spiderbot_speed_stop = 50;
+float autocvar_g_vehicle_spiderbot_speed_strafe = 400;
+float autocvar_g_vehicle_spiderbot_speed_walk = 500;
 float autocvar_g_vehicle_spiderbot_speed_run = 700;
-float autocvar_g_vehicle_spiderbot_turnspeed;
-float autocvar_g_vehicle_spiderbot_turnspeed_strafe;
-float autocvar_g_vehicle_spiderbot_movement_inertia;
+float autocvar_g_vehicle_spiderbot_turnspeed = 90;
+float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300;
+float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15;
 
-float autocvar_g_vehicle_spiderbot_springlength;
-float autocvar_g_vehicle_spiderbot_springup;
-float autocvar_g_vehicle_spiderbot_springblend;
-float autocvar_g_vehicle_spiderbot_tiltlimit;
+float autocvar_g_vehicle_spiderbot_springlength = 150;
+float autocvar_g_vehicle_spiderbot_springup = 20;
+float autocvar_g_vehicle_spiderbot_springblend = 0.1;
+float autocvar_g_vehicle_spiderbot_tiltlimit = 90;
 
-float autocvar_g_vehicle_spiderbot_head_pitchlimit_down;
-float autocvar_g_vehicle_spiderbot_head_pitchlimit_up;
-float autocvar_g_vehicle_spiderbot_head_turnlimit;
-float autocvar_g_vehicle_spiderbot_head_turnspeed;
+float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20;
+float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30;
+float autocvar_g_vehicle_spiderbot_head_turnlimit = 90;
+float autocvar_g_vehicle_spiderbot_head_turnspeed = 110;
 
-int autocvar_g_vehicle_spiderbot_health;
-float autocvar_g_vehicle_spiderbot_health_regen;
-float autocvar_g_vehicle_spiderbot_health_regen_pause;
+int autocvar_g_vehicle_spiderbot_health = 800;
+float autocvar_g_vehicle_spiderbot_health_regen = 10;
+float autocvar_g_vehicle_spiderbot_health_regen_pause = 5;
 
-int autocvar_g_vehicle_spiderbot_shield;
-float autocvar_g_vehicle_spiderbot_shield_regen;
-float autocvar_g_vehicle_spiderbot_shield_regen_pause;
+int autocvar_g_vehicle_spiderbot_shield = 200;
+float autocvar_g_vehicle_spiderbot_shield_regen = 25;
+float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35;
 
-vector autocvar_g_vehicle_spiderbot_bouncepain;
+// 'minspeed_for_pain speedchange_to_pain_factor max_damage'
+vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0';
 
 .float jump_delay;
-float spiderbot_frame()
-{SELFPARAM();
-       vector ad, vf;
-       entity player, spider;
-       float ftmp;
+bool spiderbot_frame(entity this)
+{
+       entity vehic = this.vehicle;
+       return = true;
 
        if(intermission_running)
        {
-               self.vehicle.velocity = '0 0 0';
-               self.vehicle.avelocity = '0 0 0';
-               return 1;
+               vehic.velocity = '0 0 0';
+               vehic.avelocity = '0 0 0';
+               return;
        }
 
-       player = self;
-       spider = self.vehicle;
-
-       vehicles_frame(spider, player);
-
-       setself(spider);
+       vehicles_frame(vehic, this);
 
-       PHYS_INPUT_BUTTON_ZOOM(player) = false;
-       PHYS_INPUT_BUTTON_CROUCH(player) = false;
-       PS(player).m_switchweapon = WEP_Null;
-       player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
+       PHYS_INPUT_BUTTON_ZOOM(this) = false;
+       PHYS_INPUT_BUTTON_CROUCH(this) = false;
+       PS(this).m_switchweapon = WEP_Null;
+       this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
 
 
 #if 1 // 0 to enable per-gun impact aux crosshairs
        // Avarage gun impact point's -> aux cross
-       ad = gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint01"));
-       vf = v_forward;
-       ad += gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint02"));
+       vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
+       vector vf = v_forward;
+       ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
        vf += v_forward;
        ad = ad * 0.5;
        v_forward = vf * 0.5;
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
-       UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
+       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
 #else
-       ad = gettaginfo(spider.gun1, gettagindex(spider.gun1, "barrels"));
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
-       UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
-       vf = ad;
-       ad = gettaginfo(spider.gun2, gettagindex(spider.gun2, "barrels"));
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
-       UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 1);
+       vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
+       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
+       vector vf = ad;
+       ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
+       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
        ad = 0.5 * (ad + vf);
 #endif
 
-       crosshair_trace(player);
+       crosshair_trace(this);
        ad = vectoangles(normalize(trace_endpos - ad));
-       ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
+       ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(vehic.angles), AnglesTransform_FromAngles(ad))) - vehic.tur_head.angles;
        ad = AnglesTransform_Normalize(ad, true);
-       //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
+       //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
 
        // Rotate head
-       ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
+       float ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
        ad_y = bound(-ftmp, ad_y, ftmp);
-       spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
+       vehic.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, vehic.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
 
        // Pitch head
        ad_x = bound(ftmp * -1, ad_x, ftmp);
-       spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
+       vehic.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, vehic.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
 
 
-       //fixedmakevectors(spider.angles);
-       makevectors(spider.angles + '-2 0 0' * spider.angles_x);
+       //fixedmakevectors(vehic.angles);
+       makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
 
-       movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
+       movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
 
-       if(IS_ONGROUND(spider))
-               spider.jump_delay = time; // reset now so movement can begin
+       if(IS_ONGROUND(vehic))
+               vehic.jump_delay = time; // reset now so movement can begin
 
-       //if(IS_ONGROUND(spider))
+       //if(IS_ONGROUND(vehic))
        {
-               if(IS_ONGROUND(spider))
-               if(spider.frame == 4 && self.tur_head.wait != 0)
+               if(IS_ONGROUND(vehic))
+               if(vehic.frame == 4 && vehic.tur_head.wait != 0)
                {
-                       sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
-                       spider.frame = 5;
+                       sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
+                       vehic.frame = 5;
                }
 
-               if (!PHYS_INPUT_BUTTON_JUMP(player))
-                       PHYS_INPUT_BUTTON_JUMP(spider) = false;
+               if (!PHYS_INPUT_BUTTON_JUMP(this))
+                       PHYS_INPUT_BUTTON_JUMP(vehic) = false;
 
-               if((IS_ONGROUND(spider)) && PHYS_INPUT_BUTTON_JUMP(player) && !PHYS_INPUT_BUTTON_JUMP(spider) && self.tur_head.wait < time)
+               if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !PHYS_INPUT_BUTTON_JUMP(vehic) && vehic.tur_head.wait < time)
                {
-                       sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
+                       sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
                        //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
-                       self.delay = 0;
+                       vehic.delay = 0;
 
-                       self.tur_head.wait = time + 2;
-                       spider.jump_delay = time + 2;
-                       PHYS_INPUT_BUTTON_JUMP(spider) = true; // set spider's jump
-                       //PHYS_INPUT_BUTTON_JUMP(player) = false;
+                       vehic.tur_head.wait = time + 2;
+                       vehic.jump_delay = time + 2;
+                       PHYS_INPUT_BUTTON_JUMP(vehic) = true; // set spider's jump
+                       //PHYS_INPUT_BUTTON_JUMP(this) = false;
 
                        vector movefix = '0 0 0';
-                       if(player.movement_x > 0) movefix_x = 1;
-                       if(player.movement_x < 0) movefix_x = -1;
-                       if(player.movement_y > 0) movefix_y = 1;
-                       if(player.movement_y < 0) movefix_y = -1;
+                       if(this.movement_x > 0) movefix_x = 1;
+                       if(this.movement_x < 0) movefix_x = -1;
+                       if(this.movement_y > 0) movefix_y = 1;
+                       if(this.movement_y < 0) movefix_y = -1;
 
                        vector rt = movefix_y * v_right;
                        vector sd = movefix_x * v_forward;
                        if(movefix_y == 0 && movefix_x == 0)
                                sd = v_forward; // always do forward
 
-                       UNSET_ONGROUND(spider);
+                       UNSET_ONGROUND(vehic);
 
-                       spider.velocity = sd * 700 + rt * 600 + v_up * 600;
-                       spider.frame = 4;
+                       vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
+                       vehic.frame = 4;
                }
-               else if(time >= spider.jump_delay)
+               else if(time >= vehic.jump_delay)
                {
-                       if(!player.movement)
+                       if(!this.movement)
                        {
-                               if(IS_ONGROUND(spider))
+                               if(IS_ONGROUND(vehic))
                                {
-                                       if(self.sound_nexttime < time || self.delay != 3)
+                                       if(vehic.sound_nexttime < time || vehic.delay != 3)
                                        {
-                                               self.delay = 3;
-                                               self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
+                                               vehic.delay = 3;
+                                               vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
                                                //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
-                                               sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
+                                               sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
                                        }
-                                       movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
-                                       spider.frame = 5;
+                                       movelib_brake_simple(vehic, autocvar_g_vehicle_spiderbot_speed_stop);
+                                       vehic.frame = 5;
                                }
                        }
                        else
                        {
                                // Turn Body
-                               if(player.movement_x == 0 && player.movement_y != 0)
+                               if(this.movement_x == 0 && this.movement_y != 0)
                                        ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
                                else
                                        ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
 
-                               ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
-                               spider.angles_y = anglemods(spider.angles_y + ftmp);
-                               spider.tur_head.angles_y -= ftmp;
+                               ftmp = bound(-ftmp, vehic.tur_head.angles_y, ftmp);
+                               vehic.angles_y = anglemods(vehic.angles_y + ftmp);
+                               vehic.tur_head.angles_y -= ftmp;
 
-                               if(player.movement_x != 0)
+                               if(this.movement_x != 0)
                                {
-                                       if(player.movement_x > 0)
+                                       if(this.movement_x > 0)
                                        {
-                                               player.movement_x = 1;
-                                               if(IS_ONGROUND(spider))
-                                                       spider.frame = 0;
+                                               this.movement_x = 1;
+                                               if(IS_ONGROUND(vehic))
+                                                       vehic.frame = 0;
                                        }
-                                       else if(player.movement_x < 0)
+                                       else if(this.movement_x < 0)
                                        {
-                                               player.movement_x = -1;
-                                               if(IS_ONGROUND(spider))
-                                                       spider.frame = 1;
+                                               this.movement_x = -1;
+                                               if(IS_ONGROUND(vehic))
+                                                       vehic.frame = 1;
                                        }
-                                       player.movement_y = 0;
-                                       float oldvelz = spider.velocity_z;
-                                       movelib_move_simple(self, normalize(v_forward * player.movement_x),((PHYS_INPUT_BUTTON_JUMP(player)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
-                                       spider.velocity_z = oldvelz;
+                                       this.movement_y = 0;
+                                       float oldvelz = vehic.velocity_z;
+                                       movelib_move_simple(vehic, normalize(v_forward * this.movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       vehic.velocity_z = oldvelz;
                                        float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
-                                       if(spider.velocity_z <= 20) // not while jumping
-                                               spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
-                                       if(IS_ONGROUND(spider))
-                                       if(self.sound_nexttime < time || self.delay != 1)
+                                       if(vehic.velocity_z <= 20) // not while jumping
+                                               vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+                                       if(IS_ONGROUND(vehic))
+                                       if(vehic.sound_nexttime < time || vehic.delay != 1)
                                        {
-                                               self.delay = 1;
-                                               self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
-                                               sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
+                                               vehic.delay = 1;
+                                               vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
+                                               sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
                                                //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
                                        }
                                }
-                               else if(player.movement_y != 0)
+                               else if(this.movement_y != 0)
                                {
-                                       if(player.movement_y < 0)
+                                       if(this.movement_y < 0)
                                        {
-                                               player.movement_y = -1;
-                                               if(IS_ONGROUND(spider))
-                                                       spider.frame = 2;
+                                               this.movement_y = -1;
+                                               if(IS_ONGROUND(vehic))
+                                                       vehic.frame = 2;
                                        }
-                                       else if(player.movement_y > 0)
+                                       else if(this.movement_y > 0)
                                        {
-                                               player.movement_y = 1;
-                                               if(IS_ONGROUND(spider))
-                                                       spider.frame = 3;
+                                               this.movement_y = 1;
+                                               if(IS_ONGROUND(vehic))
+                                                       vehic.frame = 3;
                                        }
 
-                                       float oldvelz = spider.velocity_z;
-                                       movelib_move_simple(self, normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
-                                       spider.velocity_z = oldvelz;
+                                       float oldvelz = vehic.velocity_z;
+                                       movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       vehic.velocity_z = oldvelz;
                                        float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
-                                       if(spider.velocity_z <= 20) // not while jumping
-                                               spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
-                                       if(IS_ONGROUND(spider))
-                                       if(self.sound_nexttime < time || self.delay != 2)
+                                       if(vehic.velocity_z <= 20) // not while jumping
+                                               vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+                                       if(IS_ONGROUND(vehic))
+                                       if(vehic.sound_nexttime < time || vehic.delay != 2)
                                        {
-                                               self.delay = 2;
-                                               self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
-                                               sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
+                                               vehic.delay = 2;
+                                               vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
+                                               sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
                                                //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
                                        }
                                }
@@ -272,81 +265,74 @@ float spiderbot_frame()
                }
        }
 
-       self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
-       self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
+       vehic.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
+       vehic.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
 
-       if(!forbidWeaponUse(player))
-       if(PHYS_INPUT_BUTTON_ATCK(player))
+       if(!forbidWeaponUse(this))
+       if(PHYS_INPUT_BUTTON_ATCK(this))
        {
-               spider.cnt = time;
-               if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single[0] <= time)
+               vehic.cnt = time;
+               if(vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <= time)
                {
                        entity gun;
                        vector v;
-                       spider.misc_bulletcounter += 1;
+                       vehic.misc_bulletcounter += 1;
 
-                       setself(player);
-
-                       gun = (spider.misc_bulletcounter % 2) ? spider.gun1 : spider.gun2;
+                       gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
 
                        v = gettaginfo(gun, gettagindex(gun, "barrels"));
                        v_forward = normalize(v_forward);
                        v += v_forward * 50;
 
-                       fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
-                                autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
+                       fireBullet(this, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+                               autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
 
                        sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
                        //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
-                       pointparticles(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
-
-                       setself(spider);
-
-                       spider.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
-                       spider.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
-                       player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
-                       spider.gun1.angles_z += 45;
-                       spider.gun2.angles_z -= 45;
-                       if(spider.gun1.angles_z >= 360)
+                       Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
+
+                       vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
+                       vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
+                       this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
+                       vehic.gun1.angles_z += 45;
+                       vehic.gun2.angles_z -= 45;
+                       if(vehic.gun1.angles_z >= 360)
                        {
-                               spider.gun1.angles_z = 0;
-                               spider.gun2.angles_z = 0;
+                               vehic.gun1.angles_z = 0;
+                               vehic.gun2.angles_z = 0;
                        }
                }
        }
        else
-               vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
+               vehicles_regen(vehic, vehic.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
                                                                                   autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
                                                                                   autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
 
 
-       spiderbot_rocket_do();
+       spiderbot_rocket_do(vehic);
 
-       if(self.vehicle_flags  & VHF_SHIELDREGEN)
-               vehicles_regen(spider.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
+       if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
 
-       if(self.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
+       if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
+               vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
 
-       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
-       //player.vehicle_ammo2 = spider.tur_head.frame;
-       player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
+       PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+       //this.vehicle_ammo2 = vehic.tur_head.frame;
+       this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
 
-       if(spider.gun2.cnt <= time)
-               player.vehicle_reload2 = 100;
+       if(vehic.gun2.cnt <= time)
+               this.vehicle_reload2 = 100;
        else
-               player.vehicle_reload2 = 100 - ((spider.gun2.cnt - time) / spider.attack_finished_single[0]) * 100;
+               this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
 
-       setorigin(player, spider.origin + '0 0 1' * spider.maxs_z);
-       player.velocity = spider.velocity;
+       setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z);
+       this.velocity = vehic.velocity;
 
-       VEHICLE_UPDATE_PLAYER(player, health, spiderbot);
+       VEHICLE_UPDATE_PLAYER(this, vehic, health, spiderbot);
 
-       if(self.vehicle_flags & VHF_HASSHIELD)
-               VEHICLE_UPDATE_PLAYER(player, shield, spiderbot);
-
-       setself(player);
-       return 1;
+       if(vehic.vehicle_flags & VHF_HASSHIELD)
+               VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
 }
 
 void spiderbot_exit(float eject)
@@ -402,7 +388,7 @@ void spiderbot_exit(float eject)
                setorigin(self.owner , spot);
        }
 
-       antilag_clear(self.owner);
+       antilag_clear(self.owner, CS(self.owner));
        self.owner = world;
 }
 
@@ -550,17 +536,18 @@ bool spiderbot_impulse(int _imp)
 
 spawnfunc(vehicle_spiderbot)
 {
-       if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
-       if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
+       if(!autocvar_g_vehicle_spiderbot) { remove(this); return; }
+       if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { remove(this); return; }
 }
 
 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
 {
     if(autocvar_g_vehicle_spiderbot_bouncepain)
-        vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+        vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
 }
 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
 {
+    SELFPARAM();
     self.vehicle_weapon2mode = SBRM_GUIDE;
     self.movetype = MOVETYPE_WALK;
     CSQCVehicleSetup(self.owner, 0);
@@ -575,6 +562,7 @@ METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
 }
 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
 {
+    SELFPARAM();
     if(IS_ONGROUND(self))
         movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
 }
@@ -598,6 +586,7 @@ METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
 }
 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
 {
+    SELFPARAM();
     if(!self.gun1)
     {
         self.vehicles_impulse = spiderbot_impulse;
@@ -630,19 +619,19 @@ METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
 {
     if(autocvar_g_vehicle_spiderbot_shield)
-        self.vehicle_flags |= VHF_HASSHIELD;
+        instance.vehicle_flags |= VHF_HASSHIELD;
 
     if(autocvar_g_vehicle_spiderbot_shield_regen)
-        self.vehicle_flags |= VHF_SHIELDREGEN;
+        instance.vehicle_flags |= VHF_SHIELDREGEN;
 
     if(autocvar_g_vehicle_spiderbot_health_regen)
-        self.vehicle_flags |= VHF_HEALTHREGEN;
+        instance.vehicle_flags |= VHF_HEALTHREGEN;
 
-    self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
-    self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
-    self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-    self.max_health = self.vehicle_health;
-    self.pushable = true; // spiderbot can use jumppads
+    instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
+    instance.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+    instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+    instance.max_health = instance.vehicle_health;
+    instance.pushable = true; // spiderbot can use jumppads
 }
 
 #endif // SVQC
index 9dfc72c13e30929ef30746212079fe674183874f..afa57de2dad1f0fa328520996595a4892b716b0d 100644 (file)
@@ -1,37 +1,9 @@
-#ifndef VEHICLE_SPIDERBOT_WEAPONS_H
-#define VEHICLE_SPIDERBOT_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-#endif
+#include "spiderbot_weapons.qh"
 
 #ifdef IMPLEMENTATION
 
 #ifdef SVQC
 
-float autocvar_g_vehicle_spiderbot_minigun_damage;
-float autocvar_g_vehicle_spiderbot_minigun_refire;
-float autocvar_g_vehicle_spiderbot_minigun_spread;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_max;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
-float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
-float autocvar_g_vehicle_spiderbot_minigun_force;
-float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
-
-float autocvar_g_vehicle_spiderbot_rocket_damage;
-float autocvar_g_vehicle_spiderbot_rocket_force;
-float autocvar_g_vehicle_spiderbot_rocket_radius;
-float autocvar_g_vehicle_spiderbot_rocket_speed;
-float autocvar_g_vehicle_spiderbot_rocket_spread;
-float autocvar_g_vehicle_spiderbot_rocket_refire;
-float autocvar_g_vehicle_spiderbot_rocket_refire2;
-float autocvar_g_vehicle_spiderbot_rocket_reload;
-float autocvar_g_vehicle_spiderbot_rocket_health;
-float autocvar_g_vehicle_spiderbot_rocket_noise;
-float autocvar_g_vehicle_spiderbot_rocket_turnrate;
-float autocvar_g_vehicle_spiderbot_rocket_lifetime;
-
 void spiderbot_rocket_artillery()
 {SELFPARAM();
     self.nextthink = time;
@@ -74,14 +46,14 @@ void spiderbot_rocket_guided()
         self.use();
 }
 
-void spiderbot_guide_release()
-{SELFPARAM();
+void spiderbot_guide_release(entity this)
+{
     entity rkt;
-    rkt = findchainentity(realowner, self.owner);
+    rkt = findchainentity(realowner, this.owner);
     if(!rkt)
         return;
 
-    crosshair_trace(self.owner);
+    crosshair_trace(this.owner);
     while(rkt)
     {
         if(rkt.think == spiderbot_rocket_guided)
@@ -167,74 +139,74 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht)
     return sdir * vs + '0 0 1' * vz;
 }
 
-void spiderbot_rocket_do()
-{SELFPARAM();
+void spiderbot_rocket_do(entity this)
+{;
     vector v;
     entity rocket = world;
 
-    if (self.wait != -10)
+    if (this.wait != -10)
     {
-        if (PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.vehicle_weapon2mode == SBRM_GUIDE)
+        if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.vehicle_weapon2mode == SBRM_GUIDE)
         {
-            if (self.wait == 1)
-            if (self.tur_head.frame == 9 || self.tur_head.frame == 1)
+            if (this.wait == 1)
+            if (this.tur_head.frame == 9 || this.tur_head.frame == 1)
             {
-                if(self.gun2.cnt < time && self.tur_head.frame == 9)
-                    self.tur_head.frame = 1;
+                if(this.gun2.cnt < time && this.tur_head.frame == 9)
+                    this.tur_head.frame = 1;
 
                 return;
             }
-            self.wait = 1;
+            this.wait = 1;
         }
         else
         {
-            if(self.wait)
-                spiderbot_guide_release();
+            if(this.wait)
+                spiderbot_guide_release(this);
 
-            self.wait = 0;
+            this.wait = 0;
         }
     }
 
-    if(self.gun2.cnt > time)
+    if(this.gun2.cnt > time)
         return;
 
-    if (self.tur_head.frame >= 9)
+    if (this.tur_head.frame >= 9)
     {
-        self.tur_head.frame = 1;
-        self.wait = 0;
+        this.tur_head.frame = 1;
+        this.wait = 0;
     }
 
-    if(self.wait != -10)
-    if(!PHYS_INPUT_BUTTON_ATCK2(self.owner))
+    if(this.wait != -10)
+    if(!PHYS_INPUT_BUTTON_ATCK2(this.owner))
         return;
 
-    if(forbidWeaponUse(self.owner))
+    if(forbidWeaponUse(this.owner))
         return;
 
-    v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
+    v = gettaginfo(this.tur_head,gettagindex(this.tur_head,"tag_fire"));
 
-    switch(self.vehicle_weapon2mode)
+    switch(this.vehicle_weapon2mode)
     {
         case SBRM_VOLLY:
-            rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+            rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                                    v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
                                    autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
-                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
-            crosshair_trace(self.owner);
+                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
+            crosshair_trace(this.owner);
             float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
             _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
             rocket.nextthink  = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
             rocket.think        = vehicles_projectile_explode;
 
-            if(PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.tur_head.frame == 1)
-                self.wait = -10;
+            if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
+                this.wait = -10;
             break;
         case SBRM_GUIDE:
-            rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+            rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                                    v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
                                    autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
-                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner);
-            crosshair_trace(self.owner);
+                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, this.owner);
+            crosshair_trace(this.owner);
             rocket.pos1           = trace_endpos;
             rocket.nextthink  = time;
             rocket.think         = spiderbot_rocket_guided;
@@ -242,21 +214,21 @@ void spiderbot_rocket_do()
 
         break;
         case SBRM_ARTILLERY:
-            rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+            rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                                    v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
                                    autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
-                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
+                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
 
-            crosshair_trace(self.owner);
+            crosshair_trace(this.owner);
 
             rocket.pos1           = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
             rocket.pos1_z         = trace_endpos_z;
 
-            traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+            traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
             float h1 = 0.75 * vlen(v - trace_endpos);
 
             //v = trace_endpos;
-            traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+            traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
             float h2 = 0.75 * vlen(rocket.pos1 - v);
 
             rocket.velocity  = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
@@ -269,13 +241,13 @@ void spiderbot_rocket_do()
 
     rocket.cnt = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
 
-    self.tur_head.frame += 1;
-    if (self.tur_head.frame == 9)
-        self.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
+    this.tur_head.frame += 1;
+    if (this.tur_head.frame == 9)
+        this.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
     else
-        self.attack_finished_single[0] = ((self.vehicle_weapon2mode ==  SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
+        this.attack_finished_single[0] = ((this.vehicle_weapon2mode ==  SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
 
-    self.gun2.cnt = time + self.attack_finished_single[0];
+    this.gun2.cnt = time + this.attack_finished_single[0];
 }
 
 #endif
diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh
new file mode 100644 (file)
index 0000000..61e2b02
--- /dev/null
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <common/weapons/all.qh>
+
+#ifdef SVQC
+void spiderbot_rocket_do(entity this);
+#endif
+
+// 400 (x2) DPS
+float autocvar_g_vehicle_spiderbot_minigun_damage = 24;
+float autocvar_g_vehicle_spiderbot_minigun_refire = 0.06;
+float autocvar_g_vehicle_spiderbot_minigun_spread = 0.015;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_cost = 1;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_max = 100;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_regen = 40;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause = 1;
+float autocvar_g_vehicle_spiderbot_minigun_force = 9;
+float autocvar_g_vehicle_spiderbot_minigun_solidpenetration = 32;
+
+float autocvar_g_vehicle_spiderbot_rocket_damage = 50;
+float autocvar_g_vehicle_spiderbot_rocket_force = 150;
+float autocvar_g_vehicle_spiderbot_rocket_radius = 250;
+float autocvar_g_vehicle_spiderbot_rocket_speed = 3500;
+float autocvar_g_vehicle_spiderbot_rocket_spread = 0.05;
+float autocvar_g_vehicle_spiderbot_rocket_refire = 0.1;
+// volley
+float autocvar_g_vehicle_spiderbot_rocket_refire2 = 0.025;
+float autocvar_g_vehicle_spiderbot_rocket_reload = 4;
+float autocvar_g_vehicle_spiderbot_rocket_health = 100;
+float autocvar_g_vehicle_spiderbot_rocket_noise = 0.2;
+float autocvar_g_vehicle_spiderbot_rocket_turnrate = 0.25;
+float autocvar_g_vehicle_spiderbot_rocket_lifetime = 20;
diff --git a/qcsrc/common/weapons/_mod.inc b/qcsrc/common/weapons/_mod.inc
new file mode 100644 (file)
index 0000000..d2c6fb8
--- /dev/null
@@ -0,0 +1,4 @@
+// generated file; do not modify
+#include "all.qc"
+#include "calculations.qc"
+#include "config.qc"
index b126005eb0e3c93fd6dedf367b561303d54aaa86..4eef9e788ad7be9b2570803b99c6551b2d517765 100644 (file)
@@ -387,7 +387,7 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn
  *   call again with ""
  *   remove the ent
  */
-void CL_WeaponEntity_SetModel(entity this, string name)
+void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
 {
        if (name == "")
        {
@@ -540,6 +540,7 @@ void CL_WeaponEntity_SetModel(entity this, string name)
 
        // check if an instant weapon switch occurred
        setorigin(this, this.view_ofs);
+       if (!_anim) return;
        // reset animstate now
        this.wframe = WFRAME_IDLE;
        setanim(this, this.anim_idle, true, false, true);
index 5e87a3c3a9cbe4ee132921a0d25fcc1698edbf0e..9b9046aa4c668b126bb023f9ff157517f5b3d3c3 100644 (file)
@@ -1,12 +1,12 @@
 #ifndef WEAPONS_ALL_H
 #define WEAPONS_ALL_H
 
-#include "../command/all.qh"
-#include "../stats.qh"
+#include <common/command/all.qh>
+#include <common/stats.qh>
 #include "config.qh"
 
 // weapon sets
-typedef vector WepSet;
+USING(WepSet, vector);
 #ifdef SVQC
 void WriteWepSet(float dest, WepSet w);
 #endif
@@ -24,7 +24,7 @@ WepSet ReadWepSet();
 #include <common/models/all.qh>
 #endif
 
-#include "../util.qh"
+#include <common/util.qh>
 
 #ifdef SVQC
 #include <server/bot/aim.qh>
@@ -113,8 +113,9 @@ void W_PROP_think()
 }
 STATIC_INIT_LATE(W_PROP_reloader)
 {
+    SELFPARAM();
     entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
-    WITH(entity, self, e, (e.think = W_PROP_think)());
+    WITHSELF(e, (e.think = W_PROP_think)());
 }
 #endif
 
@@ -355,7 +356,7 @@ ENUMCLASS_END(WFRAME)
 .WFRAME wframe;
 
 vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn);
-void CL_WeaponEntity_SetModel(entity this, string name);
+void CL_WeaponEntity_SetModel(entity this, string name, bool _anim);
 #endif
 
 #endif
index 4a12dee270e0189597058f49ef1fa1e43c2754fe..ef115b220d5e699df07c440c59bb2fc528fc8587 100644 (file)
@@ -1,7 +1,11 @@
 #ifndef WEAPON_H
 #define WEAPON_H
-#include "../items/item/pickup.qh"
-#include "../stats.qh"
+#include <common/items/item/pickup.qh>
+#include <common/stats.qh>
+
+#ifdef SVQC
+#include <common/effects/qc/all.qh>
+#endif
 
 const int MAX_WEAPONSLOTS = 2;
 .entity weaponentities[MAX_WEAPONSLOTS];
@@ -126,7 +130,7 @@ CLASS(Weapon, Object)
        }
 ENDCLASS(Weapon)
 
-#include "../items/all.qh"
+#include <common/items/all.qh>
 CLASS(WeaponPickup, Pickup)
     ATTRIB(WeaponPickup, m_weapon, Weapon, NULL)
     ATTRIB(WeaponPickup, m_name, string, string_null)
diff --git a/qcsrc/common/weapons/weapon/_mod.inc b/qcsrc/common/weapons/weapon/_mod.inc
new file mode 100644 (file)
index 0000000..7852f1e
--- /dev/null
@@ -0,0 +1,21 @@
+// generated file; do not modify
+#include "arc.qc"
+#include "blaster.qc"
+#include "crylink.qc"
+#include "devastator.qc"
+#include "electro.qc"
+#include "fireball.qc"
+#include "hagar.qc"
+#include "hlac.qc"
+#include "hook.qc"
+#include "machinegun.qc"
+#include "minelayer.qc"
+#include "mortar.qc"
+#include "porto.qc"
+#include "rifle.qc"
+#include "seeker.qc"
+#include "shockwave.qc"
+#include "shotgun.qc"
+#include "tuba.qc"
+#include "vaporizer.qc"
+#include "vortex.qc"
index 6ac3e9274d9b88df0648c2474b551d1a8f5e165d..3c23e33e779ffb64c059d6742210d6965514d91b 100644 (file)
@@ -251,7 +251,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
 }
 
 void W_Arc_Bolt_Touch()
@@ -266,7 +266,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
 
-       W_SetupShot(self, false, 2, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
+       W_SetupShot(self, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
 
        Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -405,7 +405,7 @@ void W_Arc_Beam_Think()
                self.owner,
                true,
                0,
-               "",
+               SND_Null,
                0,
                WEP_CVAR(arc, beam_damage) * coefficient,
                WEP_CVAR(arc, beam_range)
@@ -687,13 +687,13 @@ void W_Arc_Beam(float burst)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITH(entity, self, beam, beam.think());
+       WITHSELF(beam, beam.think());
 }
 
 void Arc_Smoke()
 {SELFPARAM();
        makevectors(self.v_angle);
-       W_SetupShot_Range(self,true,0,"",0,0,0);
+       W_SetupShot_Range(self,true,0,SND_Null,0,0,0);
 
        vector smoke_origin = w_shotorg + self.velocity*frametime;
        if ( self.arc_overheat > time )
@@ -732,6 +732,7 @@ METHOD(Arc, wr_aim, void(entity thiswep))
     if(WEP_CVAR(arc, beam_botaimspeed))
     {
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+               self,
             WEP_CVAR(arc, beam_botaimspeed),
             0,
             WEP_CVAR(arc, beam_botaimlifetime),
@@ -741,6 +742,7 @@ METHOD(Arc, wr_aim, void(entity thiswep))
     else
     {
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+               self,
             1000000,
             0,
             0.001,
@@ -851,6 +853,7 @@ METHOD(Arc, wr_killmessage, Notification(entity thiswep))
 }
 METHOD(Arc, wr_drop, void(entity thiswep))
 {
+    SELFPARAM();
     weapon_dropevent_item.arc_overheat = self.arc_overheat;
     weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
     self.arc_overheat = 0;
@@ -858,6 +861,7 @@ METHOD(Arc, wr_drop, void(entity thiswep))
 }
 METHOD(Arc, wr_pickup, void(entity thiswep))
 {
+    SELFPARAM();
     if ( !client_hasweapon(self, thiswep, false, false) &&
         weapon_dropevent_item.arc_overheat > time )
     {
@@ -871,6 +875,7 @@ bool autocvar_cl_arcbeam_teamcolor = true;
 
 METHOD(Arc, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     if(w_deathtype & HITTYPE_SECONDARY)
     {
         vector org2;
index 362666d27c2bc98f48d1cb6f0d0ebb10554980df..f9f3008ff834c80ab1cdec6758d5e1f93178c395 100644 (file)
@@ -101,7 +101,7 @@ void W_Blaster_Attack(
 {SELFPARAM();
        vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
 
-       W_SetupShot_Dir(actor, s_forward, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, atk_damage);
+       W_SetupShot_Dir(actor, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage);
        Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        entity missile = new(blasterbolt);
@@ -146,21 +146,22 @@ void W_Blaster_Attack(
 
        if (time >= missile.nextthink)
        {
-               WITH(entity, self, missile, missile.think());
+               WITHSELF(missile, missile.think());
        }
 }
 
 METHOD(Blaster, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(WEP_CVAR(blaster, secondary))
     {
         if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
-            { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
+            { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
         else
-            { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+            { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
     }
     else
-        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
 }
 
 METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
@@ -224,6 +225,7 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti
 
 METHOD(Blaster, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.ammo_field = ammo_none;
 }
 
@@ -252,6 +254,7 @@ METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Blaster, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
index 6ad5f957ad70e5e81ab527df505e8e1fc74dc04c..9e2bb47416b890eded0d598ae31b485202557ef7 100644 (file)
@@ -359,7 +359,7 @@ void W_Crylink_Attack(Weapon thiswep)
        if(WEP_CVAR_PRI(crylink, joinexplode))
                maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage);
 
-       W_SetupShot(self, false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, maxdmg);
+       W_SetupShot(self, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg);
        forward = v_forward;
        right = v_right;
        up = v_up;
@@ -467,7 +467,7 @@ void W_Crylink_Attack2(Weapon thiswep)
        if(WEP_CVAR_SEC(crylink, joinexplode))
                maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage);
 
-       W_SetupShot(self, false, 2, SND(CRYLINK_FIRE2), CH_WEAPON_A, maxdmg);
+       W_SetupShot(self, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg);
        forward = v_forward;
        right = v_right;
        up = v_up;
@@ -571,9 +571,9 @@ METHOD(Crylink, wr_aim, void(entity thiswep))
 {
     SELFPARAM();
     if(random() < 0.10)
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
     else
-        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
 }
 METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -655,7 +655,8 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD);
 }
 METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
 {
index 53d4b8e946b7a057655e1a63df106336255aae4f..2d930ad7212a8b83920e659e8b6992b0e81ef7c2 100644 (file)
@@ -344,7 +344,7 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
 }
 
 void W_Devastator_Attack(Weapon thiswep)
@@ -354,7 +354,7 @@ void W_Devastator_Attack(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(devastator, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(devastator, damage));
+       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage));
        Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        missile = WarpZone_RefSys_SpawnSameRefSys(self);
@@ -408,7 +408,7 @@ void W_Devastator_Attack(Weapon thiswep)
 METHOD(Devastator, wr_aim, void(entity thiswep))
 {
     // aim and decide to fire if appropriate
-    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
     if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
     {
         // decide whether to detonate rockets
@@ -434,8 +434,9 @@ METHOD(Devastator, wr_aim, void(entity thiswep))
 #else
 METHOD(Devastator, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     // aim and decide to fire if appropriate
-    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
     if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
     {
         // decide whether to detonate rockets
@@ -464,7 +465,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep))
                     selfdamage = selfdamage + d;
                 else if(targ.team == self.team && teamplay)
                     teamdamage = teamdamage + d;
-                else if(bot_shouldattack(targ))
+                else if(bot_shouldattack(self, targ))
                     enemydamage = enemydamage + d;
                 targ = targ.chain;
             }
@@ -557,10 +558,12 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen
 }
 METHOD(Devastator, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.rl_release = 1;
 }
 METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     #if 0
     // don't switch while guiding a missile
     if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
@@ -601,12 +604,14 @@ METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Devastator, wr_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
     self.rl_release = 0;
 }
 METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, WEP_CVAR(devastator, ammo), SND_RELOAD);
 }
 METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -625,6 +630,7 @@ METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Devastator, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
index f539b1492c56b7e4c5876de232687adc9b2fdf1f..b75106806269d839cd7af02118a72bbf9cc14a08 100644 (file)
@@ -261,7 +261,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep)
                '0 0 -3',
                false,
                2,
-               SND(ELECTRO_FIRE),
+               SND_ELECTRO_FIRE,
                CH_WEAPON_A,
                WEP_CVAR_PRI(electro, damage)
        );
@@ -358,7 +358,7 @@ void W_Electro_Attack_Orb(Weapon thiswep)
                '0 0 -4',
                false,
                2,
-               SND(ELECTRO_FIRE2),
+               SND_ELECTRO_FIRE2,
                CH_WEAPON_A,
                WEP_CVAR_SEC(electro, damage)
        );
@@ -427,6 +427,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
 
 METHOD(Electro, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
     if(self.bot_secondary_electromooth == 0)
@@ -434,9 +435,9 @@ METHOD(Electro, wr_aim, void(entity thiswep))
         float shoot;
 
         if(WEP_CVAR_PRI(electro, speed))
-            shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
+            shoot = bot_aim(self, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
         else
-            shoot = bot_aim(1000000, 0, 0.001, false);
+            shoot = bot_aim(self, 1000000, 0, 0.001, false);
 
         if(shoot)
         {
@@ -446,7 +447,7 @@ METHOD(Electro, wr_aim, void(entity thiswep))
     }
     else
     {
-        if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
+        if(bot_aim(self, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
         {
             PHYS_INPUT_BUTTON_ATCK2(self) = true;
             if(random() < 0.03) self.bot_secondary_electromooth = 0;
@@ -492,12 +493,14 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
 }
 METHOD(Electro, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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;
 }
 METHOD(Electro, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     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.
     {
@@ -513,11 +516,13 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Electro, wr_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     self.electro_secondarytime = time;
 }
 METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
 }
 METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -546,6 +551,7 @@ METHOD(Electro, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Electro, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 6;
     if(w_deathtype & HITTYPE_SECONDARY)
index 8c0d928db883e5e03d4342f1237402eaf80dcb6c..a6db7c9b71ce578845d5058793ed29a1444a340b 100644 (file)
@@ -179,7 +179,7 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam
        if(this.health <= 0)
        {
                this.cnt = 1;
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
        }
 }
 
@@ -187,7 +187,7 @@ void W_Fireball_Attack1()
 {SELFPARAM();
        entity proj;
 
-       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND(FIREBALL_FIRE2), CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
+       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
 
        Send_Effect(EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -223,7 +223,7 @@ void W_Fireball_Attack1()
 
 void W_Fireball_AttackEffect(float i, vector f_diff)
 {SELFPARAM();
-       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, "", 0, 0);
+       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0);
        w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
        Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 }
@@ -320,7 +320,7 @@ void W_Fireball_Attack2()
                        f_diff = '+1.25 +3.75 0';
                        break;
        }
-       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, SND(FIREBALL_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage));
+       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage));
        traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self);
        w_shotorg = trace_endpos;
 
@@ -353,11 +353,12 @@ void W_Fireball_Attack2()
 
 METHOD(Fireball, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(self.bot_primary_fireballmooth == 0)
     {
-        if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
+        if(bot_aim(self, WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
         {
             PHYS_INPUT_BUTTON_ATCK(self) = true;
             if(random() < 0.02) self.bot_primary_fireballmooth = 0;
@@ -365,7 +366,7 @@ METHOD(Fireball, wr_aim, void(entity thiswep))
     }
     else
     {
-        if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
+        if(bot_aim(self, WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
         {
             PHYS_INPUT_BUTTON_ATCK2(self) = true;
             if(random() < 0.01) self.bot_primary_fireballmooth = 1;
@@ -394,6 +395,7 @@ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponenti
 }
 METHOD(Fireball, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.ammo_field = ammo_none;
 }
 METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
@@ -406,6 +408,7 @@ METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Fireball, wr_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     self.fireball_primarytime = time;
 }
 METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
@@ -428,6 +431,7 @@ METHOD(Fireball, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Fireball, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     if(w_deathtype & HITTYPE_SECONDARY)
     {
index c66e4a438344f57ab1f304a5f3bfae0c150e6cd6..b764a9e66f679984fd056c539c698cd0bd7feb5e 100644 (file)
@@ -100,7 +100,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
 }
 
 void W_Hagar_Touch()
@@ -130,7 +130,7 @@ void W_Hagar_Attack(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo));
 
-       W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
+       W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
 
        Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -172,7 +172,7 @@ void W_Hagar_Attack2(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
 
-       W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
+       W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
 
        Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -224,7 +224,7 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity)
 
        weapon_prepareattack_do(self, weaponentity, true, WEP_CVAR_SEC(hagar, refire));
 
-       W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
+       W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
        Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        forward = v_forward;
@@ -399,10 +399,11 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
 
 METHOD(Hagar, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(random()>0.15)
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
     else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
-        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
 }
 METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -432,6 +433,7 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 }
 METHOD(Hagar, wr_gonethink, void(entity thiswep))
 {
+    SELFPARAM();
     // we lost the weapon and want to prepare switching away
     if(self.hagar_load)
     {
@@ -442,6 +444,7 @@ METHOD(Hagar, wr_gonethink, void(entity thiswep))
 }
 METHOD(Hagar, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.hagar_loadblock = false;
 
     if(self.hagar_load)
@@ -452,22 +455,26 @@ METHOD(Hagar, wr_setup, void(entity thiswep))
 }
 METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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))
 {
+    SELFPARAM();
     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_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     self.hagar_load = 0;
 }
 METHOD(Hagar, wr_playerdeath, void(entity thiswep))
 {
+    SELFPARAM();
     .entity weaponentity = weaponentities[0]; // TODO: unhardcode
     // if we have any rockets loaded when we die, release them
     if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
@@ -475,8 +482,9 @@ METHOD(Hagar, wr_playerdeath, void(entity thiswep))
 }
 METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
+    SELFPARAM();
     if(!self.hagar_load) // require releasing loaded rockets first
-        W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+        W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD);
 }
 METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -495,6 +503,7 @@ METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Hagar, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
index 901634506057566d96024b525f7e7eae0f54d8a0..4be78821cde2ff5dcd0e3a8e4fffa1b655ab8cd7 100644 (file)
@@ -81,7 +81,7 @@ void W_HLAC_Attack(Weapon thiswep)
     if(self.crouch)
         spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
 
-       W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
+       W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
        Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
        if(!autocvar_g_norecoil)
        {
@@ -128,7 +128,7 @@ void W_HLAC_Attack2()
     if(self.crouch)
         spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
 
-       W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
+       W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
        Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        missile = new(hlacbolt);
@@ -209,7 +209,8 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
 
 METHOD(HLAC, wr_aim, void(entity thiswep))
 {
-    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
+    SELFPARAM();
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
 }
 METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -236,19 +237,22 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 }
 METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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))
 {
+    SELFPARAM();
     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_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD);
 }
 METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -264,6 +268,7 @@ METHOD(HLAC, wr_killmessage, Notification(entity thiswep))
 
 METHOD(HLAC, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
index 5af5a9ad1f95a84b0dd7414fc4250a8e5becd2f4..91c2840e6d35e47fefeb0dc3a1a12905949f3c7c 100644 (file)
@@ -129,7 +129,7 @@ void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage,
        this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
+               WITHSELF(this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
 }
 
 void W_Hook_Touch2()
@@ -141,7 +141,7 @@ void W_Hook_Touch2()
 void W_Hook_Attack2(Weapon thiswep, entity actor)
 {
        //W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
-       W_SetupShot(actor, false, 4, SND(HOOKBOMB_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
+       W_SetupShot(actor, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
 
        entity gren = new(hookbomb);
        gren.owner = gren.realowner = actor;
@@ -182,6 +182,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
 
 METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
+    SELFPARAM();
     if (fire & 1) {
         if(!actor.hook)
         if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
@@ -261,7 +262,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     {
         if (actor.hook)
             RemoveGrapplingHook(actor);
-        WITH(entity, self, actor, FireGrapplingHook());
+        WITHSELF(actor, FireGrapplingHook());
         actor.hook_state &= ~HOOK_FIRING;
         actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
     }
@@ -274,10 +275,12 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 }
 METHOD(Hook, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
 }
 METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
 {
+    SELFPARAM();
     if (!thiswep.ammo_factor) return true;
     if(self.hook)
         return self.ammo_fuel > 0;
@@ -291,6 +294,7 @@ METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
 }
 METHOD(Hook, wr_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     RemoveGrapplingHook(self);
     self.hook_time = 0;
     self.hook_refire = time;
@@ -305,6 +309,7 @@ METHOD(Hook, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Hook, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
@@ -479,6 +484,9 @@ void Draw_GrapplingHook(entity this)
 void Remove_GrapplingHook(entity this)
 {
        sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+
+       if(csqcplayer && csqcplayer.hook == this)
+               csqcplayer.hook = NULL;
 }
 
 NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
@@ -497,6 +505,8 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
                int myowner = ReadByte();
                self.owner = playerslots[myowner - 1];
                self.sv_entnum = myowner;
+               if(csqcplayer && myowner == player_localentnum)
+                       csqcplayer.hook = self;
                switch(self.HookType)
                {
                        default:
index 1b1af4df45475c0c6615c91bbcab42072c840ca5..355eada3c7b9f6c31cddd8675dc745b9c4d669a6 100644 (file)
@@ -108,7 +108,7 @@ void W_MachineGun_MuzzleFlash()
 
 void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
 {SELFPARAM();
-       W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
+       W_SetupShot(self, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -119,9 +119,9 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
        ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
 
        if(self.misc_bulletcounter == 1)
-               fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
+               fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
        else
-               fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
+               fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -184,7 +184,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 
        W_DecreaseAmmo(WEP_MACHINEGUN, actor, WEP_CVAR(machinegun, sustained_ammo));
 
-       W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+       W_SetupShot(actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
        {
                actor.punchangle_x = random() - 0.5;
@@ -192,7 +192,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
        }
 
        machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
-       fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+       fireBullet(actor, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
 
        actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
 
@@ -211,14 +211,14 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 
 void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+       W_SetupShot(actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
        {
                actor.punchangle_x = random() - 0.5;
                actor.punchangle_y = random() - 0.5;
        }
 
-       fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+       fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -244,10 +244,11 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
 METHOD(MachineGun, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
     else
-        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
 }
 METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -302,6 +303,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
 }
 METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(machinegun, mode) == 1)
         ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
@@ -319,6 +321,7 @@ METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
 }
 METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(machinegun, mode) == 1)
         ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
@@ -336,7 +339,8 @@ METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD);
 }
 METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -355,6 +359,7 @@ METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
 
 METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
index 78aabc4510d111d15532563f2f25bbd3a7d4266b..c6e0fb86bce692d211e72ec39a24f89f29886060 100644 (file)
@@ -308,7 +308,7 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
 }
 
 void W_MineLayer_Attack(Weapon thiswep)
@@ -330,7 +330,7 @@ void W_MineLayer_Attack(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(minelayer, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND(MINE_FIRE), CH_WEAPON_A, WEP_CVAR(minelayer, damage));
+       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage));
        Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        mine = WarpZone_RefSys_SpawnSameRefSys(self);
@@ -406,11 +406,12 @@ float W_MineLayer_PlacedMines(float detonate)
 
 METHOD(MineLayer, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     // aim and decide to fire if appropriate
     if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
         PHYS_INPUT_BUTTON_ATCK(self) = false;
     else
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
     if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
     {
         // decide whether to detonate mines
@@ -443,7 +444,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep))
                     selfdamage = selfdamage + d;
                 else if(targ.team == self.team && teamplay)
                     teamdamage = teamdamage + d;
-                else if(bot_shouldattack(targ))
+                else if(bot_shouldattack(self, targ))
                     enemydamage = enemydamage + d;
                 targ = targ.chain;
             }
@@ -528,6 +529,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
 }
 METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     int slot = 0; // TODO: unhardcode
     // don't switch while placing a mine
     if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
@@ -547,11 +549,13 @@ METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
 {
+    SELFPARAM();
     self.minelayer_mines = 0;
 }
 METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, WEP_CVAR(minelayer, ammo), SND_RELOAD);
 }
 METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -567,6 +571,7 @@ METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
 
 METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
index 639de3f4c8f83df67db12e593bbc4db40b8d2e5f..7c9b908947e31fd78e40e0613d7aa38147a68906 100644 (file)
@@ -116,7 +116,7 @@ void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, flo
        this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
 }
 
 void W_Mortar_Grenade_Think1()
@@ -207,7 +207,7 @@ void W_Mortar_Attack(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
+       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
        w_shotdir = v_forward; // no TrueAim for grenades please
 
        Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -255,7 +255,7 @@ void W_Mortar_Attack2(Weapon thiswep)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
+       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
        w_shotdir = v_forward; // no TrueAim for grenades please
 
        Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -300,11 +300,12 @@ void W_Mortar_Attack2(Weapon thiswep)
 
 METHOD(Mortar, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
     {
-        if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
+        if(bot_aim(self, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
         {
             PHYS_INPUT_BUTTON_ATCK(self) = true;
             if(random() < 0.01) self.bot_secondary_grenademooth = 1;
@@ -312,7 +313,7 @@ METHOD(Mortar, wr_aim, void(entity thiswep))
     }
     else
     {
-        if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
+        if(bot_aim(self, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
         {
             PHYS_INPUT_BUTTON_ATCK2(self) = true;
             if(random() < 0.02) self.bot_secondary_grenademooth = 0;
@@ -373,19 +374,22 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity
 }
 METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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))
 {
+    SELFPARAM();
     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_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO
 }
 METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -407,6 +411,7 @@ METHOD(Mortar, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Mortar, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
index 0e667419d009503e88029ce4d8d55cf6a66e65aa..b9488889ddf69c81d639e522905c6906d8685c3f 100644 (file)
@@ -105,7 +105,7 @@ void W_Porto_Remove(entity p)
 {SELFPARAM();
        if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
        {
-               WITH(entity, self, p.porto_current, W_Porto_Fail(1));
+               WITHSELF(p.porto_current, W_Porto_Fail(1));
        }
 }
 
@@ -244,7 +244,7 @@ void W_Porto_Attack(float type)
 {SELFPARAM();
        entity gren;
 
-       W_SetupShot(self, false, 4, SND(PORTO_FIRE), CH_WEAPON_A, 0);
+       W_SetupShot(self, false, 4, SND_PORTO_FIRE, CH_WEAPON_A, 0);
        // always shoot from the eye
        w_shotdir = v_forward;
        w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;
@@ -298,7 +298,7 @@ METHOD(PortoLaunch, wr_aim, void(entity thiswep))
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(!WEP_CVAR(porto, secondary))
-        if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
+        if(bot_aim(self, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
             PHYS_INPUT_BUTTON_ATCK(self) = true;
 }
 METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
index c0734d77dd87b235902d94a1d15901f029873390..606770579880aa4f177ec878bc8c30ace0eb53c7 100644 (file)
@@ -56,7 +56,7 @@ spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(this, WEP_RIFLE); }
 spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
 spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
 
-void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound)
+void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound)
 {SELFPARAM();
        float i;
 
@@ -73,7 +73,7 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor
        }
 
        for(i = 0; i < pShots; ++i)
-               fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
+               fireBullet(self, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
 
        if(autocvar_g_casings >= 2)
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
@@ -81,12 +81,12 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor
 
 void W_Rifle_Attack()
 {
-       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND(CAMPINGRIFLE_FIRE));
+       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE);
 }
 
 void W_Rifle_Attack2()
 {
-       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND(CAMPINGRIFLE_FIRE2));
+       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2);
 }
 
 .void() rifle_bullethail_attackfunc;
@@ -140,13 +140,14 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
 
 METHOD(Rifle, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(vdist(self.origin - self.enemy.origin, >, 1000))
         self.bot_secondary_riflemooth = 0;
     if(self.bot_secondary_riflemooth == 0)
     {
-        if(bot_aim(1000000, 0, 0.001, false))
+        if(bot_aim(self, 1000000, 0, 0.001, false))
         {
             PHYS_INPUT_BUTTON_ATCK(self) = true;
             if(random() < 0.01) self.bot_secondary_riflemooth = 1;
@@ -154,7 +155,7 @@ METHOD(Rifle, wr_aim, void(entity thiswep))
     }
     else
     {
-        if(bot_aim(1000000, 0, 0.001, false))
+        if(bot_aim(self, 1000000, 0, 0.001, false))
         {
             PHYS_INPUT_BUTTON_ATCK2(self) = true;
             if(random() < 0.03) self.bot_secondary_riflemooth = 0;
@@ -198,23 +199,27 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 }
 METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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))
 {
+    SELFPARAM();
     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_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
 }
 METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD);
 }
 METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -243,6 +248,7 @@ METHOD(Rifle, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Rifle, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
index a2019025624f2e717bc9256d25ca1c5a3224785a..34b6e895f3af59977f130f90b9cd8ec3f83fcc90 100644 (file)
@@ -220,7 +220,7 @@ void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, flo
                this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
+               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
 }
 
 /*
@@ -255,7 +255,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo));
 
        makevectors(self.v_angle);
-       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(SEEKER_FIRE), CH_WEAPON_A, 0);
+       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0);
        w_shotorg += f_diff;
        Send_Effect(EFFECT_SEEKER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -345,7 +345,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep)
                        f_diff = '+1.25 +3.75 0';
                        break;
        }
-       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(FLAC_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
+       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
        w_shotorg += f_diff;
 
        Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -562,7 +562,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
        entity missile;
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo));
 
-       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(TAG_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
+       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
 
        missile                 = new(seeker_tag);
        missile.owner           = missile.realowner = self;
@@ -600,13 +600,14 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
 
 METHOD(Seeker, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(WEP_CVAR(seeker, type) == 1)
         if(W_Seeker_Tagged_Info(self, self.enemy) != world)
-            PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
+            PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
         else
-            PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+            PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
     else
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
 }
 METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -654,6 +655,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity
 }
 METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(seeker, type) == 1)
     {
@@ -669,6 +671,7 @@ METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
 }
 METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     float ammo_amount;
     if(WEP_CVAR(seeker, type) == 1)
     {
@@ -684,7 +687,8 @@ METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD);
 }
 METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -703,6 +707,7 @@ METHOD(Seeker, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Seeker, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 6;
     if(w_deathtype & HITTYPE_BOUNCE)
index 6c6e8e736ff7aa8ade5eec892a8993bf0ae4fa2d..444f96894fa1f44e1e3c3e939c4de8005b249382 100644 (file)
@@ -243,7 +243,7 @@ void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int f
        meleetemp.owner = meleetemp.realowner = actor;
        meleetemp.think = W_Shockwave_Melee_Think;
        meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
-       W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
+       W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
 }
 
 // SHOCKWAVE ATTACK MODE
@@ -365,7 +365,7 @@ void W_Shockwave_Attack()
        float i, queue = 0;
 
        // set up the shot direction
-       W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
+       W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
        vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
        WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
        vector attack_hitpos = trace_endpos;
@@ -673,10 +673,11 @@ void W_Shockwave_Attack()
 
 METHOD(Shockwave, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
-        { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
+        { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); }
     else
-        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); }
 }
 METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
index 234aaadaf635daf3cbd48d7b69a39fa92582209e..1a23189402d8c28f6d52e62b54d39d94b83ec378 100644 (file)
@@ -65,9 +65,9 @@ void W_Shotgun_Attack(Weapon thiswep, float isprimary)
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(shotgun, ammo));
 
-       W_SetupShot(self, true, 5, SND(SHOTGUN_FIRE), ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
+       W_SetupShot(self, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
        for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
-               fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
+               fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
 
        Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));
 
@@ -192,7 +192,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f
        meleetemp.realowner = actor;
        meleetemp.think = W_Shotgun_Melee_Think;
        meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
-       W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
+       W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
 }
 
 // alternate secondary weapon frames
@@ -228,10 +228,11 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
 
 METHOD(Shotgun, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
-        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
     else
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
 }
 METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -281,16 +282,19 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
 }
 METHOD(Shotgun, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.ammo_field = ammo_none;
 }
 METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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;
 }
 METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     if(IS_BOT_CLIENT(self))
     if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
         return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
@@ -308,7 +312,8 @@ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
+    SELFPARAM();
+    W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO
 }
 METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -328,6 +333,7 @@ METHOD(Shotgun, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
     if(!w_issilent && time - self.prevric > 0.25)
index 593af851828da87d95b3935c533cc3d725edcbdf..4cb5ded982424f0973129251320b10f840258ccf 100644 (file)
@@ -314,7 +314,7 @@ void W_Tuba_NoteOn(float hittype)
        vector o;
        float n;
 
-       W_SetupShot(self, false, 2, "", 0, WEP_CVAR(tuba, damage));
+       W_SetupShot(self, false, 2, SND_Null, 0, WEP_CVAR(tuba, damage));
 
        n = W_Tuba_GetNote(self, hittype);
 
@@ -413,7 +413,7 @@ NET_HANDLE(tuba_instrument, bool)
        string s = (i == 0) ? "tuba" :
                   (i == 1) ? "akordeon" :
                              "kleinbottle" ;
-       CL_WeaponEntity_SetModel(viewmodel, s);
+       CL_WeaponEntity_SetModel(viewmodel, s, true);
 }
 #endif
 #ifdef SVQC
@@ -450,7 +450,7 @@ METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
                                break;
                }
                tuba_instrument_send(actor, actor.tuba_instrument);
-               W_SetupShot(actor, false, 0, "", 0, 0);
+               W_SetupShot(actor, false, 0, SND_Null, 0, 0);
                Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
                actor.(weaponentity).state = WS_INUSE;
                weapon_thinkf(actor, weaponentity, WFRAME_RELOAD, 0.5, w_ready);
@@ -588,7 +588,7 @@ void Ent_TubaNote_StopSound(entity this)
        this.enemy = NULL;
 }
 
-void Ent_TubaNote_StopSound_self() { Ent_TubaNote_StopSound(self); }
+void Ent_TubaNote_StopSound_self() { SELFPARAM(); Ent_TubaNote_StopSound(self); }
 
 NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
 {
index 92c795421a401cb88e6d50490e28e48a5bf73d31..933124564c1c37d5c6a1e118b85aafa7d5855421 100644 (file)
@@ -183,7 +183,7 @@ void W_Vaporizer_Attack(Weapon thiswep)
        bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
        float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
 
-       W_SetupShot(self, true, 0, "", CH_WEAPON_A, vaporizer_damage);
+       W_SetupShot(self, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage);
        // handle sound separately so we can change the volume
        // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
        sound (self, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
@@ -247,7 +247,7 @@ void W_RocketMinsta_Attack2()
 
        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);
+       W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage);
        PS(self).m_weapon = w;
 
        Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -299,7 +299,7 @@ void W_RocketMinsta_Attack3 ()
 
        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);
+       W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage);
        PS(self).m_weapon = w;
 
        Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -341,10 +341,11 @@ void W_RocketMinsta_Attack3 ()
 
 METHOD(Vaporizer, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(self.(thiswep.ammo_field) > 0)
-        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false);
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false);
     else
-        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
 }
 METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -422,11 +423,13 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
 }
 METHOD(Vaporizer, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.ammo_field = (thiswep.ammo_field);
     self.vaporizer_lasthit = 0;
 }
 METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
     float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
     ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
@@ -434,6 +437,7 @@ METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
 }
 METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     if(!WEP_CVAR_SEC(vaporizer, ammo))
         return true;
     float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
@@ -442,10 +446,12 @@ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     self.vaporizer_lasthit = 0;
 }
 METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
+    SELFPARAM();
     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
     float used_ammo;
     if(WEP_CVAR_SEC(vaporizer, ammo))
@@ -453,7 +459,7 @@ METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponen
     else
         used_ammo = vaporizer_ammo;
 
-    W_Reload(self, used_ammo, SND(RELOAD));
+    W_Reload(self, used_ammo, SND_RELOAD);
 }
 METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -469,6 +475,7 @@ METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2 = w_org + w_backoff * 6;
     if(w_deathtype & HITTYPE_SECONDARY)
     {
index d14457b2e9c35c7f80f019a4af1e20153c908598..c0c434561736764acd3231140665e0152774b647 100644 (file)
@@ -144,14 +144,14 @@ REGISTER_MUTATOR(vortex_charge, true);
 MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
 {SELFPARAM();
        // WEAPONTODO
-       float xyspeed = vlen(vec2(self.velocity));
-       if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+       float xyspeed = vlen(vec2(this.velocity));
+       if (PS(this).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));
                float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
                // add the extra charge
-               self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+               this.vortex_charge = min(1, this.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
        }
 }
 
@@ -182,7 +182,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
        mydmg *= charge;
        myforce *= charge;
 
-       W_SetupShot(self, true, 5, SND(NEXFIRE), CH_WEAPON_A, mydmg);
+       W_SetupShot(self, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg);
        if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound
        {
                sound(self, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM);
@@ -212,7 +212,8 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
 METHOD(Vortex, wr_aim, void(entity thiswep))
 {
-    if(bot_aim(1000000, 0, 1, false))
+    SELFPARAM();
+    if(bot_aim(self, 1000000, 0, 1, false))
         PHYS_INPUT_BUTTON_ATCK(self) = true;
     else
     {
@@ -322,16 +323,19 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity
 }
 METHOD(Vortex, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.vortex_lasthit = 0;
 }
 METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
 {
+    SELFPARAM();
     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;
 }
 METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
 {
+    SELFPARAM();
     if(WEP_CVAR(vortex, secondary))
     {
         // don't allow charging if we don't have enough ammo
@@ -346,6 +350,7 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
 }
 METHOD(Vortex, wr_resetplayer, void(entity thiswep))
 {
+    SELFPARAM();
     if (WEP_CVAR(vortex, charge)) {
         if (WEP_CVAR_SEC(vortex, chargepool)) {
             self.vortex_chargepool_ammo = 1;
@@ -356,7 +361,8 @@ METHOD(Vortex, wr_resetplayer, void(entity thiswep))
 }
 METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
+    SELFPARAM();
+    W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD);
 }
 METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -372,10 +378,11 @@ METHOD(Vortex, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Vortex, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
     if(!w_issilent)
-        sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+        sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
 }
 METHOD(Vortex, wr_init, void(entity thiswep))
 {
index 302c5d806a0678b88ed925cef074815a9c0b0af2..d279ced478d0c48df33ffc0cc8e43837687c73ee 100644 (file)
@@ -86,12 +86,14 @@ void ClientKill();
 //   self
 void RestoreGame();
 
+// Called when a client connects to the server
 // input:
 //   time
 //   self
 //   parm1..n
 void ClientConnect();
 
+// Called when a client spawns in the server
 // input:
 //   time
 //   self
@@ -122,6 +124,7 @@ void SV_OnEntityPostSpawnFunction();
 //   parm1..n
 void SetNewParms();
 
+// Runs every frame
 // input:
 //
 .bool customizeentityforclient();
index 535c3b6f7c3504e8ba3113a385ec7e489bcb29fa..783ac036faf07c3e645cce833b78c3bb6ab5e1d1 100644 (file)
 #undef spawn
 #undef setmodel
 
+#define stuffcmd(cl, ...) MACRO_BEGIN \
+    entity _cl = (cl); \
+    if (IS_REAL_CLIENT(_cl)) stuffcmd(_cl, __VA_ARGS__); \
+MACRO_END
+
 #pragma noref 0
 
 #endif
index 9aaf524493719d0171363d086cfd29db0944bf05..0fee57ec18e87aac641444bd8d424cb82afa106c 100644 (file)
        #include <dpdefs/keycodes.qh>
 #endif
 
+#define USING(name, T) typedef T name
+
+#include "bool.qh"
+#include "int.qh"
+
 #include "macro.qh"
 
+#if NDEBUG
+    #define TC(T, sym) MACRO_BEGIN MACRO_END
+#else
+    #define TC(T, sym) MACRO_BEGIN \
+        if (!is_##T(sym)) { \
+            LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+            isnt_##T(sym); \
+        } \
+    MACRO_END
+#endif
+
+#define   is_float(        this) (true || ftoe(this))
+#define isnt_float(        this)
+#define   is_vector(       this) (true || vtos(this))
+#define isnt_vector(       this)
+#define   is_string(       this) (true || stof(this))
+#define isnt_string(       this)
+#define   is_entity(       this) (true || etof(this))
+#define isnt_entity(       this)
+bool      is_int(    float this) { return this == floor(this); }
+void    isnt_int(    float this) { print(ftos(this)); }
+bool      is_bool(   float this) { return this == true || this == false; }
+void    isnt_bool(   float this) { print(ftos(this)); }
+
 #include "warpzone/mathlib.qc"
 
 #include "accumulate.qh"
 #include "angle.qc"
 #include "arraylist.qh"
 #include "bits.qh"
-#include "bool.qh"
 #include "color.qh"
 #include "counting.qh"
 #include "cvar.qh"
@@ -43,7 +71,6 @@
 #include "file.qh"
 #include "functional.qh"
 #include "i18n.qh"
-#include "int.qh"
 #include "iter.qh"
 #include "lazy.qh"
 #include "linkedlist.qh"
diff --git a/qcsrc/lib/_mod.inc b/qcsrc/lib/_mod.inc
new file mode 100644 (file)
index 0000000..fd811e7
--- /dev/null
@@ -0,0 +1,7 @@
+// generated file; do not modify
+#include "angle.qc"
+#include "p2mathlib.qc"
+#include "random.qc"
+#include "sortlist.qc"
+#include "test.qc"
+#include "urllib.qc"
index 209004b64839c018a4d4ab2287033d4f7a6b12db..c0809ecdf88d242e03fbd329dd648e636ee881a1 100644 (file)
@@ -1,6 +1,6 @@
 #pragma once
 
-typedef entity ArrayList;
+USING(ArrayList, entity);
 .int al_buf;
 .int al_len;
 
index 14824dc5a78362a5f0de8516601eb2f9f139fc7a..7cd34bc8487bfae058f168ca4471a07e07156077 100644 (file)
@@ -11,3 +11,9 @@
                #define QCC_SUPPORT_NIL
        #endif
 #endif
+
+#ifdef GMQCC
+    #define LABEL(id) :id
+#else
+    #define LABEL(id) id:
+#endif
diff --git a/qcsrc/lib/csqcmodel/_mod.inc b/qcsrc/lib/csqcmodel/_mod.inc
new file mode 100644 (file)
index 0000000..1d4c6ec
--- /dev/null
@@ -0,0 +1,5 @@
+// generated file; do not modify
+#include "cl_model.qc"
+#include "cl_player.qc"
+#include "interpolate.qc"
+#include "sv_model.qc"
index 4c7d2da726ddaf01cfbbc4c144e8961ee25b3535..789f115d14ac960b3c361bac06ce8229e7960e0b 100644 (file)
@@ -220,14 +220,14 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew)
        int sf = ReadInt24_t();
 
        // some nice flags for CSQCMODEL_IF and the hooks
-       bool isplayer = (this.entnum >= 1 && this.entnum <= maxclients);
+       bool isplayer = ReadByte() || (this.entnum >= 1 && this.entnum <= maxclients);
        if (isnew && isplayer)
        {
                CSQCModel_players[this.entnum - 1] = this;
                this.entremove = CSQCModel_remove;
        }
        bool islocalplayer = (this.entnum == player_localnum + 1);
-       noref bool isnolocalplayer = (isplayer && (this.entnum != player_localnum + 1));
+       noref bool isnolocalplayer = (isplayer && !islocalplayer);
 
        this.classname = "csqcmodel";
        this.iflags |= IFLAG_ORIGIN; // interpolate origin too
index 3f9dea125957db861a749f86bf4a8ffd21b5f6ab..dc2e4021fbc405283e1de904b13b9546ebbc648a 100644 (file)
 
 bool CSQCModel_Send(entity to, int sf)
 {
+    SELFPARAM();
        // some nice flags for CSQCMODEL_IF
-       float isplayer = (IS_CLIENT(self));
-       float islocalplayer = (self == to);
-       float isnolocalplayer = (isplayer && (self != to));
-
-       unused_float = isplayer;
-       unused_float = islocalplayer;
-       unused_float = isnolocalplayer;
+       noref bool isplayer = IS_CLIENT(this);
+       noref bool islocalplayer = (this == to);
+       noref bool isnolocalplayer = (isplayer && (this != to));
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_MODEL);
        WriteInt24_t(MSG_ENTITY, sf);
+       WriteByte(MSG_ENTITY, isplayer);
 
 #define CSQCMODEL_IF(cond) if(cond) {
 #define CSQCMODEL_ENDIF }
 #define CSQCMODEL_PROPERTY(flag,t,r,w,f) \
        if(sf & flag) \
        { \
-               w(MSG_ENTITY, self.csqcmodel_##f); \
+               w(MSG_ENTITY, this.csqcmodel_##f); \
        }
 #define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f)
        ALLPROPERTIES
@@ -67,7 +65,7 @@ bool CSQCModel_Send(entity to, int sf)
 void CSQCModel_CheckUpdate(entity e)
 {
        // some nice flags for CSQCMODEL_IF
-       float isplayer = (IS_CLIENT(e));
+       float isplayer = IS_CLIENT(e);
        float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
        float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
 
index b923062bc9a9a35115ea48cbec1aef192d27ccff..d4c1eadac75db7a4dbbd87a738892b7e0f039565 100644 (file)
                SELFPARAM();
                this.think     = SUB_Remove_self;
                this.nextthink = time;
-               WITH(entity, self, this.owner, this.use());
+               WITHSELF(this.owner, this.selfthink(this));
        }
 
-/*
-    Execute func() after time + fdelay.
-    self when func is executed = self when defer is called
-*/
-       void defer(entity this, float fdelay, void() func)
+    /**
+     * Execute func() after time + fdelay.
+     * self when func is executed = self when defer is called
+     */
+       void defer(entity this, float fdelay, void(entity this) func)
        {
                entity e    = new_pure(deferred);
                e.owner     = this;
-               e.use       = func;
+               setthink(e, func);
                e.think     = defer_think;
                e.nextthink = time + fdelay;
        }
index 68b106a5ca490829b8898284cd8b3ba70d9a08df..532db1deb613bad7d39293f39b458fe437f416d1 100644 (file)
@@ -8,7 +8,7 @@
 
 // zero overhead mode, use this for releases
 
-#define ENUMCLASS(id) typedef int id; enum { CASE(id, Null)
+#define ENUMCLASS(id) USING(id, int); enum { CASE(id, Null)
 #define CASE(class, id) class##_##id,
 #define ENUMCLASS_END(id) };
 #define ORDINAL(it) (it)
index 89b455ab56f9f6ea3d25a6850a36d0f8fb961b5e..fae834b49fa684b8f973ec9730c7047d0e6ae59b 100644 (file)
@@ -1,12 +1,18 @@
 #pragma once
 
+#if 1
+#define ITER_CONST const
+#else
+#define ITER_CONST
+#endif
+
 #define FOREACH_ARRAY(arr, start, end, cond, body) \
        MACRO_BEGIN \
        { \
                for (int _i = start; _i < end; ++_i) \
                { \
                        const noref int i = _i; \
-                       const noref entity it = arr[i]; \
+                       ITER_CONST noref entity it = arr[i]; \
                        if (cond) { LAMBDA(body) } \
                } \
        } MACRO_END
@@ -20,7 +26,7 @@
                for (entity _it = list##_first; _it; (_it = _it.next, ++_i)) \
                { \
                        const noref int i = _i; \
-                       const noref entity it = _it; \
+                       ITER_CONST noref entity it = _it; \
                        if (cond) { LAMBDA(body) } \
                } \
        } MACRO_END
        } MACRO_END
 
 #if defined(CSQC)
+    entity(entity start, .string fld, string match) _findstring = #18;
        entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+    entity(entity start, .entity fld, entity match) _findentity = #98;
        entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+    entity(entity start, .float fld, float match) _findfloat = #98;
        entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+       entity(entity start, .float fld, float match) _findflags = #449;
        entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
 #elif defined(SVQC)
+    entity(entity start, .string fld, string match) _findstring = #18;
        entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+    entity(entity start, .entity fld, entity match) _findentity = #98;
        entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+    entity(entity start, .float fld, float match) _findfloat = #98;
        entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+       entity(entity start, .float fld, float match) _findflags = #449;
        entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
 #elif defined(MENUQC)
+    entity(entity start, .string fld, string match) _findstring = #24;
        entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #26;
+
+    entity(entity start, .entity fld, entity match) _findentity = #25;
        entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #27;
+
+    entity(entity start, .float fld, float match) _findfloat = #25;
        entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #27;
+
+       entity(entity start, .float fld, float match) _findflags = #87;
        entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #88;
 #endif
 
 #define ORDERED(F) F##_UNORDERED
+#define _FOREACH_ENTITY_FIND_ORDERED(T, fld, match, cond, body) \
+    MACRO_BEGIN { \
+        int _i = 0; \
+        for (entity _it = NULL; (_it = _find##T(_it, fld, match)); ++_i) \
+        { \
+            const noref int i = _i; \
+            ITER_CONST noref entity it = _it; \
+            if (cond) LAMBDA(body) \
+        } \
+    } MACRO_END
+#define _FOREACH_ENTITY_FIND_UNORDERED(id, T, fld, match, cond, body) \
+       MACRO_BEGIN { \
+               if (_FOREACH_ENTITY_FIND_##T##_##id##mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FIND_##T##_##id##mutex); \
+               _FOREACH_ENTITY_FIND_##T##_##id##mutex = __FUNC__; \
+               entity _foundchain_first = _findchain##T##_tofield(fld, match, _FOREACH_ENTITY_FIND_##T##_next##id); \
+               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FIND_##T##_next##id, cond, body); \
+               _FOREACH_ENTITY_FIND_##T##_##id##mutex = string_null; \
+       } MACRO_END
 
 #define FOREACH_ENTITY(cond, body) ORDERED(FOREACH_ENTITY)(cond, body)
 #define FOREACH_ENTITY_ORDERED(cond, body) \
                for (entity _it = NULL; (_it = nextent(_it)); ++_i) \
                { \
                        const noref int i = _i; \
-                       const noref entity it = _it; \
-                       if (cond) { LAMBDA(body) } \
+                       ITER_CONST noref entity it = _it; \
+                       if (cond) LAMBDA(body) \
                } \
        } MACRO_END
 /** marker field, always NULL */
 .entity _FOREACH_ENTITY_fld;
+.entity _FOREACH_ENTITY_FIND_entity_nextall; noref string _FOREACH_ENTITY_FIND_entity_allmutex;
+#define FOREACH_ENTITY_UNORDERED(cond, body) _FOREACH_ENTITY_FIND_UNORDERED(all, entity, _FOREACH_ENTITY_fld, NULL, cond, body)
 
-.entity _FOREACH_ENTITY_next;
-noref string _FOREACH_ENTITY_mutex;
-#define FOREACH_ENTITY_UNORDERED(cond, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_mutex); \
-               _FOREACH_ENTITY_mutex = __FUNC__; \
-               entity _foundchain_first = _findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_next, cond, body); \
-               _FOREACH_ENTITY_mutex = string_null; \
-       } MACRO_END
-
+#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
+#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(flags, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_flags_next; noref string _FOREACH_ENTITY_FIND_flags_mutex;
+#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, flags, fld, match, true, body)
 
 #ifndef MENUQC
-entity(vector org, float rad, .entity tofield) _findradius_tofield = #22;
+entity(vector org, float rad, .entity tofield) _findchainradius_tofield = #22;
 #define FOREACH_ENTITY_RADIUS(org, dist, cond, body) FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body)
-.entity _FOREACH_ENTITY_RADIUS_next;
-noref string _FOREACH_ENTITY_RADIUS_mutex;
-#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_RADIUS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_RADIUS_mutex); \
-               _FOREACH_ENTITY_RADIUS_mutex = __FUNC__; \
-               entity _foundchain_first = _findradius_tofield(org, dist, _FOREACH_ENTITY_RADIUS_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_RADIUS_next, cond, body); \
-               _FOREACH_ENTITY_RADIUS_mutex = string_null; \
-       } MACRO_END
+.entity _FOREACH_ENTITY_FIND_radius_next; noref string _FOREACH_ENTITY_FIND_radius_mutex;
+#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(, radius, org, dist, cond, body)
 #endif
 
-
-#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
-#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) FOREACH_ENTITY_ORDERED(it.classname == class && (cond), body)
-.entity _FOREACH_ENTITY_CLASS_next;
-noref string _FOREACH_ENTITY_CLASS_mutex;
-#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_CLASS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_CLASS_mutex); \
-               _FOREACH_ENTITY_CLASS_mutex = __FUNC__; \
-               entity _foundchain_first = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_CLASS_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_CLASS_next, cond, body); \
-               _FOREACH_ENTITY_CLASS_mutex = string_null; \
-       } MACRO_END
-
-
-
 #define FOREACH_ENTITY_FLOAT(fld, match, body) ORDERED(FOREACH_ENTITY_FLOAT)(fld, match, body)
-#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_FLOAT_next;
-noref string _FOREACH_ENTITY_FLOAT_mutex;
-#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_FLOAT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLOAT_mutex); \
-               _FOREACH_ENTITY_FLOAT_mutex = __FUNC__; \
-               entity _foundchain_first = _findchainfloat_tofield(fld, match, _FOREACH_ENTITY_FLOAT_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLOAT_next, true, body); \
-               _FOREACH_ENTITY_FLOAT_mutex = string_null; \
-       } MACRO_END
-
-
-
-#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
-#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld & match, body)
-.entity _FOREACH_ENTITY_FLAGS_next;
-noref string _FOREACH_ENTITY_FLAGS_mutex;
-#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_FLAGS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLAGS_mutex); \
-               _FOREACH_ENTITY_FLAGS_mutex = __FUNC__; \
-               entity _foundchain_first = _findchainflags_tofield(fld, match, _FOREACH_ENTITY_FLAGS_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLAGS_next, true, body); \
-               _FOREACH_ENTITY_FLAGS_mutex = string_null; \
-       } MACRO_END
-
-
+#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(float, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_float_next; noref string _FOREACH_ENTITY_FIND_float_mutex;
+#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, float, fld, match, true, body)
 
 #define FOREACH_ENTITY_ENT(fld, match, body) ORDERED(FOREACH_ENTITY_ENT)(fld, match, body)
-#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_ENT_next;
-noref string _FOREACH_ENTITY_ENT_mutex;
-#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_ENT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_ENT_mutex); \
-               _FOREACH_ENTITY_ENT_mutex = __FUNC__; \
-               entity _foundchain_first = _findchainentity_tofield(fld, match, _FOREACH_ENTITY_ENT_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_ENT_next, true, body); \
-               _FOREACH_ENTITY_ENT_mutex = string_null; \
-       } MACRO_END
-
-
+#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(entity, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_entity_next; noref string _FOREACH_ENTITY_FIND_entity_mutex;
+#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, entity, fld, match, true, body)
 
 #define FOREACH_ENTITY_STRING(fld, match, body) ORDERED(FOREACH_ENTITY_STRING)(fld, match, body)
-#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_STRING_next;
-noref string _FOREACH_ENTITY_STRING_mutex;
-#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) \
-       MACRO_BEGIN { \
-               if (_FOREACH_ENTITY_STRING_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_STRING_mutex); \
-               _FOREACH_ENTITY_STRING_mutex = __FUNC__; \
-               entity _foundchain_first = _findchainstring_tofield(fld, match, _FOREACH_ENTITY_STRING_next); \
-               FOREACH_LIST(_foundchain, _FOREACH_ENTITY_STRING_next, true, body); \
-               _FOREACH_ENTITY_STRING_mutex = string_null; \
-       } MACRO_END
+#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(string, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_string_next; noref string _FOREACH_ENTITY_FIND_string_mutex;
+#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, string, fld, match, true, body)
+
+#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
+#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) _FOREACH_ENTITY_FIND_ORDERED(string, classname, class, cond, body)
+.entity _FOREACH_ENTITY_FIND_string_nextclazz; noref string _FOREACH_ENTITY_FIND_string_clazzmutex;
+#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(clazz, string, classname, class, cond, body)
index 07d99b4f1226f73d843d0304e302d2439d6947e3..6afc862ed0a6306b97e2ad5ca02702b3a79a4817 100644 (file)
@@ -78,7 +78,7 @@ entity LL_POP(LinkedList this)
                noref int i = 0;                                                \
                for (entity _it = list.ll_head; _it; (_it = _it.ll_next, ++i))  \
                {                                                               \
-                       noref entity it = _it.ll_data;                              \
+                       ITER_CONST noref entity it = _it.ll_data;                   \
                        if (cond) { body }                                          \
                }                                                               \
        } MACRO_END
index 68c974dc31adc66faf5728c455fbaed42f8f1d1b..02a25cdad0d0679d577c00191a9835e4750f5084 100644 (file)
@@ -38,9 +38,11 @@ string(string...) strcat0n = #53;
 string(string...) strcat0n = #115;
 #endif
 
+#define __SOURCELOC__ (sprintf("^9"__FILE__"^7"  ":"  "^9%s^7"  ":"  "^9"STR(__LINE__)"^7", __FUNC__))
+
 #define _LOG(f, level, s) \
        MACRO_BEGIN { \
-               f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [" __FILE__ "^7:^9%s^7:^9" STR(__LINE__) "] \n^7%s\n", __FUNC__, s)); \
+               f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [%s^9]\n^7%s\n", __SOURCELOC__, s)); \
        } MACRO_END
 
 #define  LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
index 0ff16e13dd5844cd8bf1e34ac182079c6444f1a6..57b8f8c67939a113fee43e48d3f00b65673eac67 100644 (file)
@@ -18,7 +18,7 @@ void db_save(int db, string filename)
        fclose(fh);
 }
 
-typedef int HashMap;
+USING(HashMap, int);
 
 int db_create()
 {
index b364ced54fefa584aeb63e014452f5436c03e9c6..03e5c9dd8941d6a1143effdf28ce3290638f9333 100644 (file)
@@ -41,7 +41,7 @@ STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id
        #define REGISTER_NET_LINKED(id) \
                [[accumulate]] NET_HANDLE(id, bool isnew) \
                { \
-                       this = self; \
+                       this = __self; \
                        this.sourceLoc = __FILE__ ":" STR(__LINE__); \
                        if (!this) isnew = true; \
                } \
@@ -101,7 +101,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
        /** return false to remove from the client */
        .bool(entity this, entity to, int sendflags) SendEntity3;
 
-       bool SendEntity_self(entity to, int sendflags) { return self.SendEntity3(self, to, sendflags); }
+       bool SendEntity_self(entity to, int sendflags) { SELFPARAM(); return this.SendEntity3(this, to, sendflags); }
 
        void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
        {
@@ -145,7 +145,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
 
        void UncustomizeEntitiesRun()
        {
-               FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITH(entity, self, it, it.uncustomizeentityforclient()));
+               FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITHSELF(it, it.uncustomizeentityforclient()));
        }
 
        STRING_ITERATOR(g_buf, string_null, 0);
index 8d50d2b929db771755e413826a5bee44b428c758..e1e3193308c4a0fe021301445e827dedd97a4ec8 100644 (file)
@@ -5,14 +5,15 @@
 #include "static.qh"
 
 #ifdef MENUQC
-       #define NULL (null_entity)
+       #define NULL (0, null_entity)
+       #define world NULL
 #else
-       #define NULL (world)
+       #define NULL (0, world)
 #endif
 
 .vector origin;
 .bool pure_data;
-/** @deprecated, use new_pure or NEW(class) */
+/** @deprecated use new_pure or NEW(class) */
 #define make_pure(e) \
        MACRO_BEGIN \
        { \
@@ -63,7 +64,7 @@ entity __spawn(string _classname, string _sourceLoc, bool pure)
 #define EVAL_entityclass(...) __VA_ARGS__
 #define entityclass_1(name) entityclass_2(name, Object)
 #ifndef QCC_SUPPORT_ENTITYCLASS
-       #define entityclass_2(name, base) typedef entity name
+       #define entityclass_2(name, base) USING(name, entity)
        #define class(name)
        #define _new(class, pure) __spawn( #class, __FILE__ ":" STR(__LINE__), pure)
 #else
@@ -77,6 +78,13 @@ entity __spawn(string _classname, string _sourceLoc, bool pure)
 #define new_pure(class) _new(class, true)
 #define spawn() __spawn("entity", __FILE__ ":" STR(__LINE__), false)
 
+#define delete(this) MACRO_BEGIN { \
+    entity _this = (this); \
+    void(entity) _dtor = _this.dtor; \
+    if (_dtor) _dtor(_this); else remove(_this); \
+    /* this = NULL; */  \
+} MACRO_END
+
 entity _clearentity_ent;
 STATIC_INIT(clearentity)
 {
@@ -98,20 +106,38 @@ void clearentity(entity e)
 // Classes have a `spawn##cname(entity)` constructor
 // The parameter is used across [[accumulate]] functions
 
+.bool transmute;
+
 // Macros to hide this implementation detail:
 #ifdef __STDC__
        #define NEW(cname, ...) \
                OVERLOAD_(spawn##cname, new_pure(cname) P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
+
+    #define _TRANSMUTE(cname, this, ...) \
+        OVERLOAD_(spawn##cname, this P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
+
        #define CONSTRUCT(cname, ...) \
                OVERLOAD_(spawn##cname, this P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
 #else
        #define NEW(cname, ...) \
                OVERLOAD(spawn##cname, new_pure(cname),##__VA_ARGS__)
 
+    #define _TRANSMUTE(cname, this, ...) \
+        OVERLOAD(spawn##cname, this,##__VA_ARGS__)
+
        #define CONSTRUCT(cname, ...) \
                OVERLOAD(spawn##cname, this,##__VA_ARGS__)
 #endif
 
+#define TRANSMUTE(cname, this, ...) MACRO_BEGIN \
+    entity _e = (this); \
+    if (_e.vtblbase != cname##_vtbl) { \
+        _e.transmute = true; \
+        _e.classname = #cname; \
+        _TRANSMUTE(cname, _e, __VA_ARGS__); \
+    } \
+    MACRO_END
+
 #define CONSTRUCTOR(cname, ...) \
        cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \
        { \
@@ -129,7 +155,7 @@ STATIC_INIT(RegisterClasses)
 }
 
 #define VTBL(cname, base) \
-       INIT_STATIC(cname); \
+       _INIT_STATIC(cname); \
        entity cname##_vtbl; \
        void cname##_vtbl_init() \
        { \
@@ -142,29 +168,32 @@ STATIC_INIT(RegisterClasses)
        } \
        ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
 
-#define INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
+#define _INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
 #define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this)
 
 #define CLASS(cname, base)                  \
        entityclass(cname, base);               \
-       class(cname).bool instanceOf##cname;   \
+       class(cname).bool instanceOf##cname;    \
+    bool is_##cname(entity e) { return e.instanceOf##cname; } \
+    void isnt_##cname(entity e) { eprint(e); } \
        VTBL(cname, base)                       \
-       INIT_STATIC(cname) \
-       {                    \
-               if (cname##_vtbl\
-               {                 \
+       _INIT_STATIC(cname)                     \
+       {                                       \
+               if (cname##_vtbl && !this.transmute)\
+               {                                   \
                        copyentity(cname##_vtbl, this); \
                        return;                         \
                }                                   \
                spawn##base##_static(this);         \
                this.instanceOf##cname = true;      \
        }                                       \
-       INIT(cname) \
-       {                           \
+       INIT(cname)                             \
+       {                                       \
                /* Only statically initialize the current class, it contains everything it inherits */ \
                if (cname##_vtbl.vtblname == this.classname) \
-               { \
+               {                                   \
                        spawn##cname##_static(this);    \
+                       this.transmute = false;         \
                        this.classname = #cname;        \
                        this.vtblname = string_null;    \
                        this.vtblbase = cname##_vtbl;   \
@@ -181,12 +210,23 @@ STATIC_INIT(RegisterClasses)
 #define METHOD(cname, name, prototype) \
        STATIC_METHOD(cname, name, prototype); \
        class(cname) .prototype name; \
-       INIT_STATIC(cname) \
+       _INIT_STATIC(cname) \
        { \
                this.name = METHOD_REFERENCE(cname, name); \
        } \
        STATIC_METHOD(cname, name, prototype)
 
+#define DESTRUCTOR(cname) \
+       STATIC_METHOD(cname, dtorimpl, void(cname this)); \
+    METHOD(cname, dtor, void(cname this)) \
+    { \
+        METHOD_REFERENCE(cname, dtorimpl)(this); \
+        this.instanceOf##cname = false; \
+        entity super = SUPER(cname); \
+        if (super != cname##_vtbl) super.dtor(this); \
+    } \
+       STATIC_METHOD(cname, dtorimpl, void(cname this))
+
 #define ATTRIB(cname, name, type, val)      \
        class(cname).type name;                \
        INIT(cname) \
@@ -195,6 +235,16 @@ STATIC_INIT(RegisterClasses)
                this.name = val; \
        }
 
+#define STATIC_ATTRIB(cname, name, type, val) \
+       type cname##_##name; \
+       _INIT_STATIC(cname) \
+       { \
+               noref bool strzone; /* Error on strzone() calls. */ \
+               cname##_##name = val; \
+       }
+
+// cleanup potentially zoned strings from base classes
+
 #define ATTRIB_STRZONE(cname, name, type, val)      \
        class(cname).type name;                \
        INIT(cname) \
@@ -204,6 +254,15 @@ STATIC_INIT(RegisterClasses)
                this.name = strzone(val); \
        }
 
+#define STATIC_ATTRIB_STRZONE(cname, name, type, val) \
+       type cname##_##name; \
+       _INIT_STATIC(cname) \
+       { \
+        if (cname##_##name) \
+            strunzone(cname##_##name); \
+               cname##_##name = val; \
+       }
+
 #define ATTRIBARRAY(cname, name, type, cnt) \
        class(cname).type name[cnt];
 
@@ -219,8 +278,11 @@ STATIC_INIT(RegisterClasses)
 #define spawn_1(this)
 #define _vtbl NULL
 CLASS(Object, );
-       METHOD(Object, describe, string(entity this))
+    DESTRUCTOR(Object) { remove(this); }
+    #define remove(this) delete(this)
+       METHOD(Object, describe, string(Object this))
        {
+           TC(Object, this);
                string s = _("No description");
                if (cvar("developer"))
                {
@@ -232,8 +294,9 @@ CLASS(Object, );
                }
                return s;
        }
-       METHOD(Object, display, void(entity this, void(string name, string icon) returns))
+       METHOD(Object, display, void(Object this, void(string name, string icon) returns))
        {
+           TC(Object, this);
                returns(sprintf("entity %i", this), "nopreview_map");
        }
 ENDCLASS(Object)
index 434473a862147d46fc5676fce61631b409106fc7..7ce923c537d8242ff77cd73f336ab438d173f57b 100644 (file)
@@ -51,8 +51,7 @@ REGISTRY(Registries, BITS(8))
  * Must be followed by a semicolon or a function body with a `this` parameter.
  * Wrapper macros may perform actions after user initialization like so:
  *     #define REGISTER_FOO(id) \
- *         REGISTER(Foos, FOO, id, m_id, NEW(Foo)); \
- *         REGISTER_INIT_POST(FOO, id) { \
+ *         REGISTER(Foos, FOO, id, m_id, NEW(Foo)) { \
  *             print("Registering foo #", this.m_id + 1, "\n"); \
  *         } \
  *         REGISTER_INIT(FOO, id)
@@ -70,7 +69,6 @@ REGISTRY(Registries, BITS(8))
 #define REGISTER_4(registry, id, fld, inst) \
        entity id; \
        REGISTER_INIT(id) {} \
-       REGISTER_INIT_POST(id) {} \
        void Register_##id() \
        { \
                if (registry##_COUNT >= registry##_MAX) LOG_FATALF("Registry capacity exceeded (%d)", registry##_MAX); \
@@ -78,7 +76,6 @@ REGISTRY(Registries, BITS(8))
                this.registered_id = #id; \
                REGISTRY_PUSH(registry, fld, this); \
                Register_##id##_init(this); \
-               Register_##id##_init_post(this); \
        } \
        ACCUMULATE_FUNCTION(_Register##registry, Register_##id) \
        REGISTER_INIT(id)
@@ -99,7 +96,6 @@ REGISTRY(Registries, BITS(8))
 } 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)
 
 /** internal next pointer */
 #define REGISTRY_NEXT enemy
@@ -161,7 +157,7 @@ void Registry_send(string id, string hash);
                FOREACH(id, true, s = strcat(s, join, it.registered_id)); \
                s = substring(s, strlen(join), -1); \
                string h = REGISTRY_HASH(id) = strzone(digest_hex(algo, s)); \
-               LOG_TRACEF(#id ": %s\n[%s]\n", h, s); \
+               LOG_DEBUGF(#id ": %s\n[%s]\n", h, s); \
        } \
        void Registry_check(string r, string sv) \
        { \
index 99bea5be7cd7ca5b0b8bc02963e4398d9ca0755c..31d7d07c80db730f1db4f376a71c3f6f6dae1de9 100644 (file)
@@ -2,33 +2,45 @@
 
 // Transition from global 'self' to local 'this'
 
-[[alias("self")]] entity __self;
-
 // Step 1: auto oldself
 #if 1
-       #define SELFPARAM() noref entity this = __self
-       #define setself(s) (__self = s)
-       #define self __self
+    #define SELFPARAM() noref const entity this = self
 #endif
 
-// Step 2: check SELFPARAM() is present for functions that use self
-#if 0
-       #define SELFPARAM() [[alias("__self")]] noref entity this = __self
-       #define setself(s) (__self = s)
-       #define self this
+// Step 2: const self
+#if 1
+    #define self (0, self)
+    [[alias("self")]] entity __self;
+    #define setself(s) (__self = s)
+    #define WITHSELF(value, block) WITH(entity, __self, value, (0, block))
+#endif
+
+// Step 3: propagate SELFPARAM()
+#if 1
+    #undef self
+    #define self (this, self)
 #endif
 
-// Step 3: const self
+// Step 4: kill unstructured setself
 #if 0
-       #define SELFPARAM() noref const entity this = __self
-       entity setself(entity e) { return self = e; }
-       entity getself() { return self; }
-       #define self getself()
+    #undef setself
 #endif
 
-// Step 4: enable when possible
-// TODO: Remove SELFPARAM in favor of a parameter
+// Step 5: this should work
 #if 0
-       #define SELFPARAM() noref const entity this = __self
-       #define self this
+    #define self (0, this)
 #endif
+
+// Step 6: Remove SELFPARAM in favor of a parameter
+
+.void(entity this) selftouch;
+void touch_self() { SELFPARAM(); this.selftouch(this); }
+#define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
+
+.void(entity this) selfuse;
+void use_self() { SELFPARAM(); this.selfuse(this); }
+#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+
+.void(entity this) selfthink;
+void think_self() { SELFPARAM(); this.selfthink(this); }
+#define setthink(e, f) (e.think = think_self, e.selfthink = f)
index 4313954cdc91c9a8497339d12af4dcaead45b665..2790cdf2dc3cc760dbe814bc8c8edb3be2322695 100644 (file)
@@ -1,9 +1,9 @@
 #pragma once
 
 /** is only ever called for i1 < i2 */
-typedef void (int i1, int i2, entity pass) swapfunc_t;
+USING(swapfunc_t, void (int i1, int i2, entity pass));
 /** <0 for <, ==0 for ==, >0 for > (like strcmp) */
-typedef int (int i1, int i2, entity pass) comparefunc_t;
+USING(comparefunc_t, int (int i1, int i2, entity pass));
 
 void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
 {
index 9d1090bac1dbe40711a6ed10139894a5fca96ba4..22047bbc9daac0d285478015cbecbcf14ceb6303 100644 (file)
@@ -35,11 +35,11 @@ noref bool require_spawnfunc_prefix;
                void __spawnfunc_##id(entity this); \
                [[accumulate]] void spawnfunc_##id(entity this) \
                { \
-                       if (self == __spawnfunc_expect) \
+                       if (__self == __spawnfunc_expect) \
                        { \
                                /* engine call */ \
                                __spawnfunc_expect = NULL; \
-                               this = self; \
+                               this = __self; \
                        } \
                        else \
                        { \
index 2d10d9c464ab3f2b9fa9101e4a6d7990b30e00fb..228e604a281444e3cd16e6fb0f032e5c94272c5d 100644 (file)
@@ -6,7 +6,7 @@
 #include "sort.qh"
 
 .int m_id;
-typedef vector vectori;
+USING(vectori, vector);
 
 #define REGISTER_STAT(...) EVAL_REGISTER_STAT(OVERLOAD(REGISTER_STAT, __VA_ARGS__))
 #define EVAL_REGISTER_STAT(...) __VA_ARGS__
index 41e1f294ae4c7eb0fc48684490e02615eba4c9e7..0997e53a4964fe1657c045ce01f4f698f1a7259b 100644 (file)
@@ -22,7 +22,8 @@ bool TEST_Run(string s)
        TEST_failed = 0;
        TEST_fatal = 0;
        TEST_ok = false;
-       callfunction(strcat("_TEST_", s));
+       string fn = strcat("_TEST_", s);
+       if (isfunction(fn)) callfunction(fn);
        if (TEST_failed > 0)
        {
                LOG_INFOF("%s: %d items failed.\n", s, TEST_failed);
index e506ea51891d1137a8abb55a595a1a90c1065034..97e1c7958493f1c5ba6caa3403c7b9ea9e84020d 100644 (file)
@@ -7,7 +7,7 @@ X(int)
 X(float)
 X(entity)
 X(string)
-typedef float(...) rawfunc;
+USING(rawfunc, float(...));
 X(rawfunc)
 #undef X
 
index 8746409405c6f8cc96fb3d6caf6bfd833efd4d0e..00523a84f137adb1e9d1a393d7da07008070bfa7 100644 (file)
@@ -15,7 +15,7 @@ const float URL_READY_CLOSED   =  0;
 const float URL_READY_CANWRITE =  1;
 const float URL_READY_CANREAD  =  2;
 // errors: -1, or negative HTTP status code
-typedef void (entity handle, entity pass, float status) url_ready_func;
+USING(url_ready_func, void (entity handle, entity pass, float status));
 
 void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass);
 void url_fclose(entity e);
diff --git a/qcsrc/lib/warpzone/_mod.inc b/qcsrc/lib/warpzone/_mod.inc
new file mode 100644 (file)
index 0000000..ef257d6
--- /dev/null
@@ -0,0 +1,7 @@
+// generated file; do not modify
+#include "anglestransform.qc"
+#include "client.qc"
+#include "common.qc"
+#include "mathlib.qc"
+#include "server.qc"
+#include "util_server.qc"
index 89f6b84afcef4d306989867fe4c2bb6160247922..6467dad35a4d57b4fcebe762166b70216ef2fbec 100644 (file)
@@ -29,139 +29,139 @@ void WarpZone_Touch ();
 NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
 {
        warpzone_warpzones_exist = 1;
-       if (!self.enemy)
+       if (!this.enemy)
        {
-               self.enemy = new(warpzone_from);
+               this.enemy = new(warpzone_from);
        }
-       self.classname = "trigger_warpzone";
+       this.classname = "trigger_warpzone";
 
        int f = ReadByte();
-       self.warpzone_isboxy = (f & 1);
+       this.warpzone_isboxy = (f & 1);
        if(f & 4)
        {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
        }
        else
-               self.origin = '0 0 0';
-       self.modelindex = ReadShort();
-       self.mins_x = ReadCoord();
-       self.mins_y = ReadCoord();
-       self.mins_z = ReadCoord();
-       self.maxs_x = ReadCoord();
-       self.maxs_y = ReadCoord();
-       self.maxs_z = ReadCoord();
-       self.scale = ReadByte() / 16;
-       self.enemy.oldorigin_x = ReadCoord();
-       self.enemy.oldorigin_y = ReadCoord();
-       self.enemy.oldorigin_z = ReadCoord();
-       self.enemy.avelocity_x = ReadCoord();
-       self.enemy.avelocity_y = ReadCoord();
-       self.enemy.avelocity_z = ReadCoord();
-       self.oldorigin_x = ReadCoord();
-       self.oldorigin_y = ReadCoord();
-       self.oldorigin_z = ReadCoord();
-       self.avelocity_x = ReadCoord();
-       self.avelocity_y = ReadCoord();
-       self.avelocity_z = ReadCoord();
+               this.origin = '0 0 0';
+       this.modelindex = ReadShort();
+       this.mins_x = ReadCoord();
+       this.mins_y = ReadCoord();
+       this.mins_z = ReadCoord();
+       this.maxs_x = ReadCoord();
+       this.maxs_y = ReadCoord();
+       this.maxs_z = ReadCoord();
+       this.scale = ReadByte() / 16;
+       this.enemy.oldorigin_x = ReadCoord();
+       this.enemy.oldorigin_y = ReadCoord();
+       this.enemy.oldorigin_z = ReadCoord();
+       this.enemy.avelocity_x = ReadCoord();
+       this.enemy.avelocity_y = ReadCoord();
+       this.enemy.avelocity_z = ReadCoord();
+       this.oldorigin_x = ReadCoord();
+       this.oldorigin_y = ReadCoord();
+       this.oldorigin_z = ReadCoord();
+       this.avelocity_x = ReadCoord();
+       this.avelocity_y = ReadCoord();
+       this.avelocity_z = ReadCoord();
 
        if(f & 2)
        {
-               self.warpzone_fadestart = ReadShort();
-               self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+               this.warpzone_fadestart = ReadShort();
+               this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
        }
        else
        {
-               self.warpzone_fadestart = 0;
-               self.warpzone_fadeend = 0;
+               this.warpzone_fadestart = 0;
+               this.warpzone_fadeend = 0;
        }
 
        // common stuff
-       WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity);
+       WarpZone_SetUp(this, this.enemy.oldorigin, this.enemy.avelocity, this.oldorigin, this.avelocity);
 
        // link me
-       //setmodel(self, self.model);
-       setorigin(self, self.origin);
-       setsize(self, self.mins, self.maxs);
+       //setmodel(this, this.model);
+       setorigin(this, this.origin);
+       setsize(this, this.mins, this.maxs);
 
        // how to draw
        // engine currently wants this
-       setpredraw(self, WarpZone_Fade_PreDraw);
+       setpredraw(this, WarpZone_Fade_PreDraw);
 
-       //self.move_touch = WarpZone_Touch;
+       //this.move_touch = WarpZone_Touch;
        return true;
 }
 
 NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew)
 {
        warpzone_cameras_exist = 1;
-       self.classname = "func_warpzone_camera";
+       this.classname = "func_warpzone_camera";
 
        int f = ReadByte();
        if(f & 4)
        {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
        }
        else
-               self.origin = '0 0 0';
-       self.modelindex = ReadShort();
-       self.mins_x = ReadCoord();
-       self.mins_y = ReadCoord();
-       self.mins_z = ReadCoord();
-       self.maxs_x = ReadCoord();
-       self.maxs_y = ReadCoord();
-       self.maxs_z = ReadCoord();
-       self.scale = ReadByte() / 16;
-       self.oldorigin_x = ReadCoord();
-       self.oldorigin_y = ReadCoord();
-       self.oldorigin_z = ReadCoord();
-       self.avelocity_x = ReadCoord();
-       self.avelocity_y = ReadCoord();
-       self.avelocity_z = ReadCoord();
+               this.origin = '0 0 0';
+       this.modelindex = ReadShort();
+       this.mins_x = ReadCoord();
+       this.mins_y = ReadCoord();
+       this.mins_z = ReadCoord();
+       this.maxs_x = ReadCoord();
+       this.maxs_y = ReadCoord();
+       this.maxs_z = ReadCoord();
+       this.scale = ReadByte() / 16;
+       this.oldorigin_x = ReadCoord();
+       this.oldorigin_y = ReadCoord();
+       this.oldorigin_z = ReadCoord();
+       this.avelocity_x = ReadCoord();
+       this.avelocity_y = ReadCoord();
+       this.avelocity_z = ReadCoord();
 
        if(f & 2)
        {
-               self.warpzone_fadestart = ReadShort();
-               self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+               this.warpzone_fadestart = ReadShort();
+               this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
        }
        else
        {
-               self.warpzone_fadestart = 0;
-               self.warpzone_fadeend = 0;
+               this.warpzone_fadestart = 0;
+               this.warpzone_fadeend = 0;
        }
 
        // common stuff
-       WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity);
+       WarpZone_Camera_SetUp(this, this.oldorigin, this.avelocity);
 
        // engine currently wants this
-       self.drawmask = MASK_NORMAL;
+       this.drawmask = MASK_NORMAL;
 
        // link me
-       //setmodel(self, self.model);
-       setorigin(self, self.origin);
-       setsize(self, self.mins, self.maxs);
+       //setmodel(this, this.model);
+       setorigin(this, this.origin);
+       setsize(this, this.mins, this.maxs);
 
        // how to draw
        // engine currently wants this
-       setpredraw(self, WarpZone_Fade_PreDraw);
+       setpredraw(this, WarpZone_Fade_PreDraw);
        return true;
 }
 
 void CL_RotateMoves(vector ang) = #638;
 NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew)
 {
-       self.classname = "warpzone_teleported";
+       this.classname = "warpzone_teleported";
        vector v;
        v.x = ReadCoord();
        v.y = ReadCoord();
        v.z = ReadCoord();
        return = true;
        if (!isnew) return;
-       self.warpzone_transform = v;
-       setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, getpropertyvec(VF_CL_VIEWANGLES)));
+       this.warpzone_transform = v;
+       setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(this, getpropertyvec(VF_CL_VIEWANGLES)));
        if(checkextension("DP_CSQC_ROTATEMOVES"))
                CL_RotateMoves(v);
                //CL_RotateMoves('0 90 0');
@@ -226,8 +226,7 @@ vector WarpZone_FixNearClip(vector o, vector c0, vector c1, vector c2, vector c3
 
 void WarpZone_FixPMove()
 {
-       entity e;
-       e = WarpZone_Find(pmove_org, pmove_org);
+       entity e = WarpZone_Find(pmove_org, pmove_org);
        if(e)
        {
                pmove_org = WarpZone_TransformOrigin(e, pmove_org);
index 99332dba673b649b3862035afd20076bfa0ee48a..130e1b2d14b82be54b0619811c6f0cb553a056d2 100644 (file)
@@ -42,22 +42,22 @@ float autocvar_cl_warpzone_usetrace = 1;
 vector WarpZone_camera_transform(vector org, vector ang)
 {SELFPARAM();
        vector vf, vr, vu;
-       if(self.warpzone_fadestart)
-               if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+       if(this.warpzone_fadestart)
+               if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
                        return org;
                        // don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
                        // unneeded on client, on server this helps a lot
        vf = v_forward;
        vr = v_right;
        vu = v_up;
-       org = WarpZone_TransformOrigin(self, org);
-       vf = WarpZone_TransformVelocity(self, vf);
-       vr = WarpZone_TransformVelocity(self, vr);
-       vu = WarpZone_TransformVelocity(self, vu);
+       org = WarpZone_TransformOrigin(this, org);
+       vf = WarpZone_TransformVelocity(this, vf);
+       vr = WarpZone_TransformVelocity(this, vr);
+       vu = WarpZone_TransformVelocity(this, vu);
        if(autocvar_cl_warpzone_usetrace)
-               traceline(self.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
+               traceline(this.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
        else
-               trace_endpos = self.warpzone_targetorigin;
+               trace_endpos = this.warpzone_targetorigin;
        v_forward = vf;
        v_right = vr;
        v_up = vu;
@@ -80,14 +80,14 @@ void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, ve
 vector WarpZone_Camera_camera_transform(vector org, vector ang)
 {SELFPARAM();
        // a fixed camera view
-       if(self.warpzone_fadestart)
-               if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+       if(this.warpzone_fadestart)
+               if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
                        return org;
                        // don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
                        // unneeded on client, on server this helps a lot
-       trace_endpos = self.warpzone_origin;
-       makevectors(self.warpzone_angles);
-       return self.warpzone_origin;
+       trace_endpos = this.warpzone_origin;
+       makevectors(this.warpzone_angles);
+       return this.warpzone_origin;
 }
 
 void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang) // we assume that e.oldorigin and e.avelocity point to view origin and direction
@@ -320,7 +320,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                org = trace_endpos;
        }
        WarpZone_MakeAllOther();
-:fail
+LABEL(fail)
        if(contentshack)
                BITCLR_ASSIGN(WarpZone_trace_forent.dphitcontentsmask, DPCONTENTS_SOLID);
        trace_startsolid = sol;
@@ -438,7 +438,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                e.velocity = -e.velocity;
        }
        WarpZone_MakeAllOther();
-:fail
+LABEL(fail)
        WarpZone_tracetoss_velocity = e.velocity;
        v_forward = vf;
        v_right = vr;
@@ -658,7 +658,8 @@ void WarpZone_FindRadius_Recurse(
 }
 entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
 {
-    if (!warpzone_warpzones_exist && !needlineofsight) return findradius(org, rad);
+    // FIXME: why can't we do this? (sometimes finds nothing, breaking explosions)
+    // if (!warpzone_warpzones_exist && !needlineofsight) return findradius(org, rad);
        WarpZone_FindRadius_Recurse(org, rad, org, '0 0 0', '0 0 0', needlineofsight);
        entity list_first = findchainfloat(WarpZone_findradius_hit, 1);
        FOREACH_LIST(list, chain, true, it.WarpZone_findradius_hit = 0);
@@ -669,9 +670,9 @@ entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
 void WarpZone_RefSys_GC()
 {SELFPARAM();
        // garbage collect unused reference systems
-       self.nextthink = time + 1;
-       if(self.owner.WarpZone_refsys != self)
-               remove(self);
+       this.nextthink = time + 1;
+       if(this.owner.WarpZone_refsys != this)
+               remove(this);
 }
 void WarpZone_RefSys_CheckCreate(entity me)
 {
@@ -787,7 +788,7 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me)
 
 float WarpZoneLib_ExactTrigger_Touch()
 {SELFPARAM();
-       return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, self, other);
+       return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, this, other);
 }
 
 
index d0c1f22ea8deb1d108e10c34d2dd45d9f0fe3d08..ebea01108dc72927c5180964e4599ed85e2262ff 100644 (file)
@@ -30,7 +30,7 @@ void WarpZone_MakeAllOther();
 
 #define MOVE_NOTHING -1
 entity WarpZone_trace_forent; // temp, callback is allowed to change it
-typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace
+USING(WarpZone_trace_callback_t, void(vector start, vector hit, vector end)); // called on every elementary trace
 var WarpZone_trace_callback_t WarpZone_trace_callback_t_null;
 entity WarpZone_trace_transform; // transform accumulator during a trace
 entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
index 4f15d62123d366ad2c6d00bb5d4598798e817265..2b860d6f4311283a905d8d48c760402513ba06e6 100644 (file)
@@ -71,12 +71,12 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
 }
 
 #ifdef SVQC
-bool WarpZone_Teleported_Send(entity to, int sf)
-{SELFPARAM();
+bool WarpZone_Teleported_Send(entity this, entity to, int sf)
+{
        WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
-       WriteCoord(MSG_ENTITY, self.angles.x);
-       WriteCoord(MSG_ENTITY, self.angles.y);
-       WriteCoord(MSG_ENTITY, self.angles.z);
+       WriteCoord(MSG_ENTITY, this.angles.x);
+       WriteCoord(MSG_ENTITY, this.angles.y);
+       WriteCoord(MSG_ENTITY, this.angles.z);
        return true;
 }
 #endif
@@ -169,7 +169,8 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
 
                entity ts = new(warpzone_teleported);
                setmodel(ts, MDL_Null);
-               ts.SendEntity = WarpZone_Teleported_Send;
+               ts.SendEntity = SendEntity_self;
+               ts.SendEntity3 = WarpZone_Teleported_Send;
                ts.SendFlags = 0xFFFFFF;
                ts.drawonlytoclient = player;
                ts.think = SUB_Remove_self;
@@ -209,9 +210,9 @@ void WarpZone_Touch ()
                return;
 
 #ifdef SVQC
-       if(WarpZone_PlaneDist(self, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+       if(WarpZone_PlaneDist(this, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
 #elif defined(CSQC)
-       if(WarpZone_PlaneDist(self, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+       if(WarpZone_PlaneDist(this, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
 #endif
                return;
 
@@ -236,24 +237,24 @@ void WarpZone_Touch ()
        #endif
        else
                f = -1;
-       if(WarpZone_Teleport(self, other, f, 0))
+       if(WarpZone_Teleport(this, other, f, 0))
        {
 #ifdef SVQC
                string save1, save2;
                activator = other;
 
-               save1 = self.target; self.target = string_null;
-               save2 = self.target3; self.target3 = string_null;
+               save1 = this.target; this.target = string_null;
+               save2 = this.target3; this.target3 = string_null;
                SUB_UseTargets();
-               if (!self.target) self.target = save1;
-               if (!self.target3) self.target3 = save2;
+               if (!this.target) this.target = save1;
+               if (!this.target3) this.target3 = save2;
 
-               setself(self.enemy);
-               save1 = self.target; self.target = string_null;
-               save2 = self.target2; self.target2 = string_null;
+               setself(this.enemy);
+               save1 = this.target; this.target = string_null;
+               save2 = this.target2; this.target2 = string_null;
                SUB_UseTargets();
-               if (!self.target) self.target = save1;
-               if (!self.target2) self.target2 = save2;
+               if (!this.target) this.target = save1;
+               if (!this.target2) this.target2 = save2;
                setself(this);
 #endif
        }
@@ -264,100 +265,100 @@ void WarpZone_Touch ()
 }
 
 #ifdef SVQC
-bool WarpZone_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Send(entity this, entity to, int sendflags)
+{
        WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE);
 
        // we must send this flag for clientside to match properly too
        int f = 0;
-       if(self.warpzone_isboxy)
+       if(this.warpzone_isboxy)
                BITSET_ASSIGN(f, 1);
-       if(self.warpzone_fadestart)
+       if(this.warpzone_fadestart)
                BITSET_ASSIGN(f, 2);
-       if(self.origin != '0 0 0')
+       if(this.origin != '0 0 0')
                BITSET_ASSIGN(f, 4);
        WriteByte(MSG_ENTITY, f);
 
        // we need THESE to render the warpzone (and cull properly)...
        if(f & 4)
        {
-               WriteCoord(MSG_ENTITY, self.origin.x);
-               WriteCoord(MSG_ENTITY, self.origin.y);
-               WriteCoord(MSG_ENTITY, self.origin.z);
+               WriteCoord(MSG_ENTITY, this.origin.x);
+               WriteCoord(MSG_ENTITY, this.origin.y);
+               WriteCoord(MSG_ENTITY, this.origin.z);
        }
 
-       WriteShort(MSG_ENTITY, self.modelindex);
-       WriteCoord(MSG_ENTITY, self.mins.x);
-       WriteCoord(MSG_ENTITY, self.mins.y);
-       WriteCoord(MSG_ENTITY, self.mins.z);
-       WriteCoord(MSG_ENTITY, self.maxs.x);
-       WriteCoord(MSG_ENTITY, self.maxs.y);
-       WriteCoord(MSG_ENTITY, self.maxs.z);
-       WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+       WriteShort(MSG_ENTITY, this.modelindex);
+       WriteCoord(MSG_ENTITY, this.mins.x);
+       WriteCoord(MSG_ENTITY, this.mins.y);
+       WriteCoord(MSG_ENTITY, this.mins.z);
+       WriteCoord(MSG_ENTITY, this.maxs.x);
+       WriteCoord(MSG_ENTITY, this.maxs.y);
+       WriteCoord(MSG_ENTITY, this.maxs.z);
+       WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
 
        // we need THESE to calculate the proper transform
-       WriteCoord(MSG_ENTITY, self.warpzone_origin.x);
-       WriteCoord(MSG_ENTITY, self.warpzone_origin.y);
-       WriteCoord(MSG_ENTITY, self.warpzone_origin.z);
-       WriteCoord(MSG_ENTITY, self.warpzone_angles.x);
-       WriteCoord(MSG_ENTITY, self.warpzone_angles.y);
-       WriteCoord(MSG_ENTITY, self.warpzone_angles.z);
-       WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.x);
-       WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.y);
-       WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.z);
-       WriteCoord(MSG_ENTITY, self.warpzone_targetangles.x);
-       WriteCoord(MSG_ENTITY, self.warpzone_targetangles.y);
-       WriteCoord(MSG_ENTITY, self.warpzone_targetangles.z);
+       WriteCoord(MSG_ENTITY, this.warpzone_origin.x);
+       WriteCoord(MSG_ENTITY, this.warpzone_origin.y);
+       WriteCoord(MSG_ENTITY, this.warpzone_origin.z);
+       WriteCoord(MSG_ENTITY, this.warpzone_angles.x);
+       WriteCoord(MSG_ENTITY, this.warpzone_angles.y);
+       WriteCoord(MSG_ENTITY, this.warpzone_angles.z);
+       WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.x);
+       WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.y);
+       WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.z);
+       WriteCoord(MSG_ENTITY, this.warpzone_targetangles.x);
+       WriteCoord(MSG_ENTITY, this.warpzone_targetangles.y);
+       WriteCoord(MSG_ENTITY, this.warpzone_targetangles.z);
 
        if(f & 2)
        {
-               WriteShort(MSG_ENTITY, self.warpzone_fadestart);
-               WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+               WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+               WriteShort(MSG_ENTITY, this.warpzone_fadeend);
        }
 
        return true;
 }
 
-bool WarpZone_Camera_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Camera_Send(entity this, entity to, int sendflags)
+{
        int f = 0;
        WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
 
-       if(self.warpzone_fadestart)
+       if(this.warpzone_fadestart)
                BITSET_ASSIGN(f, 2);
-       if(self.origin != '0 0 0')
+       if(this.origin != '0 0 0')
                BITSET_ASSIGN(f, 4);
        WriteByte(MSG_ENTITY, f);
 
        // we need THESE to render the warpzone (and cull properly)...
        if(f & 4)
        {
-               WriteCoord(MSG_ENTITY, self.origin.x);
-               WriteCoord(MSG_ENTITY, self.origin.y);
-               WriteCoord(MSG_ENTITY, self.origin.z);
+               WriteCoord(MSG_ENTITY, this.origin.x);
+               WriteCoord(MSG_ENTITY, this.origin.y);
+               WriteCoord(MSG_ENTITY, this.origin.z);
        }
 
-       WriteShort(MSG_ENTITY, self.modelindex);
-       WriteCoord(MSG_ENTITY, self.mins.x);
-       WriteCoord(MSG_ENTITY, self.mins.y);
-       WriteCoord(MSG_ENTITY, self.mins.z);
-       WriteCoord(MSG_ENTITY, self.maxs.x);
-       WriteCoord(MSG_ENTITY, self.maxs.y);
-       WriteCoord(MSG_ENTITY, self.maxs.z);
-       WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+       WriteShort(MSG_ENTITY, this.modelindex);
+       WriteCoord(MSG_ENTITY, this.mins.x);
+       WriteCoord(MSG_ENTITY, this.mins.y);
+       WriteCoord(MSG_ENTITY, this.mins.z);
+       WriteCoord(MSG_ENTITY, this.maxs.x);
+       WriteCoord(MSG_ENTITY, this.maxs.y);
+       WriteCoord(MSG_ENTITY, this.maxs.z);
+       WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
 
        // we need THESE to calculate the proper transform
-       WriteCoord(MSG_ENTITY, self.enemy.origin.x);
-       WriteCoord(MSG_ENTITY, self.enemy.origin.y);
-       WriteCoord(MSG_ENTITY, self.enemy.origin.z);
-       WriteCoord(MSG_ENTITY, self.enemy.angles.x);
-       WriteCoord(MSG_ENTITY, self.enemy.angles.y);
-       WriteCoord(MSG_ENTITY, self.enemy.angles.z);
+       WriteCoord(MSG_ENTITY, this.enemy.origin.x);
+       WriteCoord(MSG_ENTITY, this.enemy.origin.y);
+       WriteCoord(MSG_ENTITY, this.enemy.origin.z);
+       WriteCoord(MSG_ENTITY, this.enemy.angles.x);
+       WriteCoord(MSG_ENTITY, this.enemy.angles.y);
+       WriteCoord(MSG_ENTITY, this.enemy.angles.z);
 
        if(f & 2)
        {
-               WriteShort(MSG_ENTITY, self.warpzone_fadestart);
-               WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+               WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+               WriteShort(MSG_ENTITY, this.warpzone_fadeend);
        }
 
        return true;
@@ -456,7 +457,7 @@ float WarpZone_Projectile_Touch()
        // engine now aborts moves on teleport, so this SHOULD not happen any more
        // but if this is called from TouchAreaGrid of the projectile moving,
        // then this won't do
-       if(time == self.warpzone_teleport_time)
+       if(time == this.warpzone_teleport_time)
                return true;
 
 #ifdef SVQC
@@ -490,7 +491,7 @@ float WarpZone_Projectile_Touch()
                save_inopen = trace_inopen;
                save_inwater = trace_inwater;
                float f;
-               if((f = WarpZone_CheckProjectileImpact(self)) != 0)
+               if((f = WarpZone_CheckProjectileImpact(this)) != 0)
                        return (f > 0);
                trace_dpstartcontents = save_dpstartcontents;
                trace_dphitcontents = save_dphitcontents;
@@ -517,116 +518,116 @@ float WarpZone_Projectile_Touch()
 
 #ifdef SVQC
 
-void WarpZone_InitStep_FindOriginTarget()
-{SELFPARAM();
-       if(self.killtarget != "")
+void WarpZone_InitStep_FindOriginTarget(entity this)
+{
+       if(this.killtarget != "")
        {
-               self.aiment = find(world, targetname, self.killtarget);
-               if(self.aiment == world)
+               this.aiment = find(world, targetname, this.killtarget);
+               if(this.aiment == world)
                {
                        error("Warp zone with nonexisting killtarget");
                        return;
                }
-               self.killtarget = string_null;
+               this.killtarget = string_null;
        }
 }
 
-void WarpZonePosition_InitStep_FindTarget()
-{SELFPARAM();
-       if(self.target == "")
+void WarpZonePosition_InitStep_FindTarget(entity this)
+{
+       if(this.target == "")
        {
                error("Warp zone position with no target");
                return;
        }
-       self.enemy = find(world, targetname, self.target);
-       if(self.enemy == world)
+       this.enemy = find(world, targetname, this.target);
+       if(this.enemy == world)
        {
                error("Warp zone position with nonexisting target");
                return;
        }
-       if(self.enemy.aiment)
+       if(this.enemy.aiment)
        {
                // already is positioned
                error("Warp zone position targeting already oriented warpzone");
                return;
        }
-       self.enemy.aiment = self;
+       this.enemy.aiment = this;
 }
 
 void WarpZoneCamera_Think()
 {SELFPARAM();
-       if(self.warpzone_save_origin != self.origin
-       || self.warpzone_save_angles != self.angles
-       || self.warpzone_save_eorigin != self.enemy.origin
-       || self.warpzone_save_eangles != self.enemy.angles)
+       if(this.warpzone_save_origin != this.origin
+       || this.warpzone_save_angles != this.angles
+       || this.warpzone_save_eorigin != this.enemy.origin
+       || this.warpzone_save_eangles != this.enemy.angles)
        {
-               WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
-               self.warpzone_save_origin = self.origin;
-               self.warpzone_save_angles = self.angles;
-               self.warpzone_save_eorigin = self.enemy.origin;
-               self.warpzone_save_eangles = self.enemy.angles;
+               WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+               this.warpzone_save_origin = this.origin;
+               this.warpzone_save_angles = this.angles;
+               this.warpzone_save_eorigin = this.enemy.origin;
+               this.warpzone_save_eangles = this.enemy.angles;
        }
-       self.nextthink = time;
+       this.nextthink = time;
 }
 
-void WarpZoneCamera_InitStep_FindTarget()
-{SELFPARAM();
+void WarpZoneCamera_InitStep_FindTarget(entity this)
+{
        entity e;
        float i;
-       if(self.target == "")
+       if(this.target == "")
        {
                error("Camera with no target");
                return;
        }
-       self.enemy = world;
-       for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+       this.enemy = world;
+       for(e = world, i = 0; (e = find(e, targetname, this.target)); )
                if(random() * ++i < 1)
-                       self.enemy = e;
-       if(self.enemy == world)
+                       this.enemy = e;
+       if(this.enemy == world)
        {
                error("Camera with nonexisting target");
                return;
        }
        warpzone_cameras_exist = 1;
-       WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
-       self.SendFlags = 0xFFFFFF;
-       if(self.spawnflags & 1)
+       WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+       this.SendFlags = 0xFFFFFF;
+       if(this.spawnflags & 1)
        {
-               self.think = WarpZoneCamera_Think;
-               self.nextthink = time;
+               this.think = WarpZoneCamera_Think;
+               this.nextthink = time;
        }
        else
-               self.nextthink = 0;
+               this.nextthink = 0;
 }
 
-void WarpZone_InitStep_UpdateTransform()
-{SELFPARAM();
+void WarpZone_InitStep_UpdateTransform(entity this)
+{
        vector org, ang, norm, point;
        float area;
        vector tri, a, b, c, n;
        float i_s, i_t, n_t;
        string tex;
 
-       org = self.origin;
+       org = this.origin;
        if(org == '0 0 0')
-               org = 0.5 * (self.mins + self.maxs);
+               org = 0.5 * (this.mins + this.maxs);
 
        norm = point = '0 0 0';
        area = 0;
        for(i_s = 0; ; ++i_s)
        {
-               tex = getsurfacetexture(self, i_s);
+               tex = getsurfacetexture(this, i_s);
                if (!tex)
                        break; // this is beyond the last one
                if(tex == "textures/common/trigger" || tex == "trigger")
                        continue;
-               n_t = getsurfacenumtriangles(self, i_s);
+               n_t = getsurfacenumtriangles(this, i_s);
                for(i_t = 0; i_t < n_t; ++i_t)
                {
-                       tri = getsurfacetriangle(self, i_s, i_t);
-                       a = getsurfacepoint(self, i_s, tri.x);
-                       b = getsurfacepoint(self, i_s, tri.y);
-                       c = getsurfacepoint(self, i_s, tri.z);
+                       tri = getsurfacetriangle(this, i_s, i_t);
+                       a = getsurfacepoint(this, i_s, tri.x);
+                       b = getsurfacepoint(this, i_s, tri.y);
+                       c = getsurfacepoint(this, i_s, tri.z);
                        n = cross(c - a, b - a);
                        area = area + vlen(n);
                        norm = norm + n;
@@ -639,32 +640,32 @@ void WarpZone_InitStep_UpdateTransform()
                point = point * (1 / (3 * area));
                if(vdist(norm, <, 0.99))
                {
-                       LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " is nonplanar. BEWARE.\n");
+                       LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.\n");
                        area = 0; // no autofixing in this case
                }
                norm = normalize(norm);
        }
 
        ang = '0 0 0';
-       if(self.aiment)
+       if(this.aiment)
        {
-               org = self.aiment.origin;
-               ang = self.aiment.angles;
+               org = this.aiment.origin;
+               ang = this.aiment.angles;
                if(area > 0)
                {
                        org = org - ((org - point) * norm) * norm; // project to plane
                        makevectors(ang);
                        if(norm * v_forward < 0)
                        {
-                               LOG_INFO("Position target of trigger_warpzone near ", vtos(self.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
+                               LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
                                norm = -1 * norm;
                        }
                        ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
                        ang.x = -ang.x;
                        if(norm * v_forward < 0.99)
-                               LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
-                       if(vdist(org - self.aiment.origin, >, 0.5))
-                               LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been moved to match the plane (", vtos(self.aiment.origin), " -> ", vtos(org), ").\n");
+                               LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang), "\n");
+                       if(vdist(org - this.aiment.origin, >, 0.5))
+                               LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").\n");
                }
        }
        else if(area > 0)
@@ -676,68 +677,68 @@ void WarpZone_InitStep_UpdateTransform()
        else
                error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
 
-       self.warpzone_origin = org;
-       self.warpzone_angles = ang;
+       this.warpzone_origin = org;
+       this.warpzone_angles = ang;
 }
 
-void WarpZone_InitStep_ClearTarget()
-{SELFPARAM();
-       if(self.enemy)
-               self.enemy.enemy = world;
-       self.enemy = world;
+void WarpZone_InitStep_ClearTarget(entity this)
+{
+       if(this.enemy)
+               this.enemy.enemy = world;
+       this.enemy = world;
 }
 
 entity warpzone_first; .entity warpzone_next;
-void WarpZone_InitStep_FindTarget()
-{SELFPARAM();
+void WarpZone_InitStep_FindTarget(entity this)
+{
        float i;
        entity e, e2;
 
-       if(self.enemy)
+       if(this.enemy)
                return;
 
        // this way only one of the two ents needs to target
-       if(self.target != "")
+       if(this.target != "")
        {
-               self.enemy = self; // so the if(!e.enemy) check also skips self, saves one IF
+               this.enemy = this; // so the if(!e.enemy) check also skips this, saves one IF
 
                e2 = world;
-               for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+               for(e = world, i = 0; (e = find(e, targetname, this.target)); )
                        if(!e.enemy)
-                               if(e.classname == self.classname) // possibly non-warpzones may use the same targetname!
+                               if(e.classname == this.classname) // possibly non-warpzones may use the same targetname!
                                        if(random() * ++i < 1)
                                                e2 = e;
                if(!e2)
                {
-                       self.enemy = world;
+                       this.enemy = world;
                        error("Warpzone with non-existing target");
                        return;
                }
-               self.enemy = e2;
-               e2.enemy = self;
+               this.enemy = e2;
+               e2.enemy = this;
        }
 }
 
 void WarpZone_Think();
-void WarpZone_InitStep_FinalizeTransform()
-{SELFPARAM();
-       if(!self.enemy || self.enemy.enemy != self)
+void WarpZone_InitStep_FinalizeTransform(entity this)
+{
+       if(!this.enemy || this.enemy.enemy != this)
        {
                error("Invalid warp zone detected. Killed.");
                return;
        }
 
        warpzone_warpzones_exist = 1;
-       WarpZone_SetUp(self, self.warpzone_origin, self.warpzone_angles, self.enemy.warpzone_origin, self.enemy.warpzone_angles);
-       self.touch = WarpZone_Touch;
-       self.SendFlags = 0xFFFFFF;
-       if(self.spawnflags & 1)
+       WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
+       this.touch = WarpZone_Touch;
+       this.SendFlags = 0xFFFFFF;
+       if(this.spawnflags & 1)
        {
-               self.think = WarpZone_Think;
-               self.nextthink = time;
+               this.think = WarpZone_Think;
+               this.nextthink = time;
        }
        else
-               self.nextthink = 0;
+               this.nextthink = 0;
 }
 
 float warpzone_initialized;
@@ -748,8 +749,8 @@ entity warpzone_camera_first;
 spawnfunc(misc_warpzone_position)
 {
        // "target", "angles", "origin"
-       self.warpzone_next = warpzone_position_first;
-       warpzone_position_first = self;
+       this.warpzone_next = warpzone_position_first;
+       warpzone_position_first = this;
 }
 spawnfunc(trigger_warpzone_position)
 {
@@ -765,88 +766,85 @@ spawnfunc(trigger_warpzone)
        //              the map, with another killtarget to designate its
        //              orientation
 
-       if(!self.scale)
-               self.scale = self.modelscale;
-       if(!self.scale)
-               self.scale = 1;
+       if(!this.scale)
+               this.scale = this.modelscale;
+       if(!this.scale)
+               this.scale = 1;
        string m;
-       m = self.model;
+       m = this.model;
        WarpZoneLib_ExactTrigger_Init();
        if(m != "")
        {
                precache_model(m);
-               _setmodel(self, m); // no precision needed
+               _setmodel(this, m); // no precision needed
        }
-       setorigin(self, self.origin);
-       if(self.scale)
-               setsize(self, self.mins * self.scale, self.maxs * self.scale);
+       setorigin(this, this.origin);
+       if(this.scale)
+               setsize(this, this.mins * this.scale, this.maxs * this.scale);
        else
-               setsize(self, self.mins, self.maxs);
-       self.SendEntity = WarpZone_Send;
-       self.SendFlags = 0xFFFFFF;
-       BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
-       self.warpzone_next = warpzone_first;
-       warpzone_first = self;
+               setsize(this, this.mins, this.maxs);
+       this.SendEntity = SendEntity_self;
+       this.SendEntity3 = WarpZone_Send;
+       this.SendFlags = 0xFFFFFF;
+       BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
+       this.warpzone_next = warpzone_first;
+       warpzone_first = this;
 }
 spawnfunc(func_camera)
 {
-       if(!self.scale)
-               self.scale = self.modelscale;
-       if(!self.scale)
-               self.scale = 1;
-       if(self.model != "")
+       if(!this.scale)
+               this.scale = this.modelscale;
+       if(!this.scale)
+               this.scale = 1;
+       if(this.model != "")
        {
-               precache_model(self.model);
-               _setmodel(self, self.model); // no precision needed
+               precache_model(this.model);
+               _setmodel(this, this.model); // no precision needed
        }
-       setorigin(self, self.origin);
-       if(self.scale)
-               setsize(self, self.mins * self.scale, self.maxs * self.scale);
+       setorigin(this, this.origin);
+       if(this.scale)
+               setsize(this, this.mins * this.scale, this.maxs * this.scale);
        else
-               setsize(self, self.mins, self.maxs);
-       if(!self.solid)
-               self.solid = SOLID_BSP;
-       else if(self.solid < 0)
-               self.solid = SOLID_NOT;
-       self.SendEntity = WarpZone_Camera_Send;
-       self.SendFlags = 0xFFFFFF;
-       self.warpzone_next = warpzone_camera_first;
-       warpzone_camera_first = self;
+               setsize(this, this.mins, this.maxs);
+       if(!this.solid)
+               this.solid = SOLID_BSP;
+       else if(this.solid < 0)
+               this.solid = SOLID_NOT;
+       this.SendEntity = SendEntity_self;
+       this.SendEntity3 = WarpZone_Camera_Send;
+       this.SendFlags = 0xFFFFFF;
+       this.warpzone_next = warpzone_camera_first;
+       warpzone_camera_first = this;
 }
 void WarpZones_Reconnect()
-{SELFPARAM();
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               WarpZone_InitStep_ClearTarget();
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               WarpZone_InitStep_FindTarget();
-       for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
-               WarpZoneCamera_InitStep_FindTarget();
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               WarpZone_InitStep_FinalizeTransform();
-       setself(this);
+{
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               WarpZone_InitStep_ClearTarget(e);
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               WarpZone_InitStep_FindTarget(e);
+       for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+               WarpZoneCamera_InitStep_FindTarget(e);
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               WarpZone_InitStep_FinalizeTransform(e);
 }
 
 void WarpZone_Think()
 {SELFPARAM();
-       if(self.warpzone_save_origin != self.origin
-       || self.warpzone_save_angles != self.angles
-       || self.warpzone_save_eorigin != self.enemy.origin
-       || self.warpzone_save_eangles != self.enemy.angles)
+       if(this.warpzone_save_origin != this.origin
+       || this.warpzone_save_angles != this.angles
+       || this.warpzone_save_eorigin != this.enemy.origin
+       || this.warpzone_save_eangles != this.enemy.angles)
        {
-               WarpZone_InitStep_UpdateTransform();
-               setself(self.enemy);
-               WarpZone_InitStep_UpdateTransform();
-               setself(this);
-               WarpZone_InitStep_FinalizeTransform();
-               setself(self.enemy);
-               WarpZone_InitStep_FinalizeTransform();
-               setself(this);
-               self.warpzone_save_origin = self.origin;
-               self.warpzone_save_angles = self.angles;
-               self.warpzone_save_eorigin = self.enemy.origin;
-               self.warpzone_save_eangles = self.enemy.angles;
-       }
-       self.nextthink = time;
+               WarpZone_InitStep_UpdateTransform(this);
+               WarpZone_InitStep_UpdateTransform(this.enemy);
+               WarpZone_InitStep_FinalizeTransform(this);
+               WarpZone_InitStep_FinalizeTransform(this.enemy);
+               this.warpzone_save_origin = this.origin;
+               this.warpzone_save_angles = this.angles;
+               this.warpzone_save_eorigin = this.enemy.origin;
+               this.warpzone_save_eangles = this.enemy.angles;
+       }
+       this.nextthink = time;
 }
 
 void WarpZone_StartFrame()
@@ -855,25 +853,24 @@ void WarpZone_StartFrame()
        if (!warpzone_initialized)
        {
                warpzone_initialized = true;
-               for (setself(warpzone_first); self; setself(self.warpzone_next))
-                       WarpZone_InitStep_FindOriginTarget();
-               for (setself(warpzone_position_first); self; setself(self.warpzone_next))
-                       WarpZonePosition_InitStep_FindTarget();
-               for (setself(warpzone_first); self; setself(self.warpzone_next))
-                       WarpZone_InitStep_UpdateTransform();
-               setself(this);
+               for(entity e = warpzone_first; e; e = e.warpzone_next)
+                       WarpZone_InitStep_FindOriginTarget(e);
+               for(entity e = warpzone_position_first; e; e = e.warpzone_next)
+                       WarpZonePosition_InitStep_FindTarget(e);
+               for(entity e = warpzone_first; e; e = e.warpzone_next)
+                       WarpZone_InitStep_UpdateTransform(e);
                WarpZones_Reconnect();
                WarpZone_PostInitialize_Callback();
        }
 
        entity oldother = other;
 
-       FOREACH_ENTITY(true,
+       FOREACH_ENTITY(!is_pure(it),
        {
                if(warpzone_warpzones_exist)
                        WarpZone_StoreProjectileData(it);
 
-               if((IS_OBSERVER(it) || it.solid == SOLID_NOT))
+               if(IS_OBSERVER(it) || it.solid == SOLID_NOT)
                if(IS_CLIENT(it)) // we don't care about it being a bot
                {
                        other = it; // player
@@ -888,10 +885,13 @@ void WarpZone_StartFrame()
                        }
 
                        // teleporters
-                       setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
-                       if (self)
-                       if (!WarpZoneLib_ExactTrigger_Touch())
-                               Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+                       if(other.teleportable)
+                       {
+                               setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
+                               if (self)
+                               if (!WarpZoneLib_ExactTrigger_Touch())
+                                       Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+                       }
                }
        });
        setself(this);
@@ -908,32 +908,29 @@ bool visible_to_some_client(entity ent)
 }
 void trigger_warpzone_reconnect_use()
 {SELFPARAM();
-       entity e;
-       e = self;
        // NOTE: this matches for target, not targetname, but of course
        // targetname must be set too on the other entities
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && (visible_to_some_client(self) || visible_to_some_client(self.enemy))));
-       for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
-               self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && visible_to_some_client(self)));
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               if(self.warpzone_reconnecting)
-                       WarpZone_InitStep_ClearTarget();
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               if(self.warpzone_reconnecting)
-                       WarpZone_InitStep_FindTarget();
-       for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
-               if(self.warpzone_reconnecting)
-                       WarpZoneCamera_InitStep_FindTarget();
-       for(setself(warpzone_first); self; setself(self.warpzone_next))
-               if(self.warpzone_reconnecting || self.enemy.warpzone_reconnecting)
-                       WarpZone_InitStep_FinalizeTransform();
-       setself(e);
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               e.warpzone_reconnecting = ((this.target == "" || e.target == this.target) && !((this.spawnflags & 1) && (visible_to_some_client(e) || visible_to_some_client(e.enemy))));
+       for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+               e.warpzone_reconnecting = ((this.target == "" || e.target == this.target) && !((this.spawnflags & 1) && visible_to_some_client(e)));
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               if(e.warpzone_reconnecting)
+                       WarpZone_InitStep_ClearTarget(e);
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               if(e.warpzone_reconnecting)
+                       WarpZone_InitStep_FindTarget(e);
+       for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+               if(e.warpzone_reconnecting)
+                       WarpZoneCamera_InitStep_FindTarget(e);
+       for(entity e = warpzone_first; e; e = e.warpzone_next)
+               if(e.warpzone_reconnecting || e.enemy.warpzone_reconnecting)
+                       WarpZone_InitStep_FinalizeTransform(e);
 }
 
 spawnfunc(trigger_warpzone_reconnect)
 {
-       self.use = trigger_warpzone_reconnect_use;
+       this.use = trigger_warpzone_reconnect_use;
 }
 
 spawnfunc(target_warpzone_reconnect)
@@ -941,15 +938,15 @@ spawnfunc(target_warpzone_reconnect)
        spawnfunc_trigger_warpzone_reconnect(this); // both names make sense here :(
 }
 
-void WarpZone_PlayerPhysics_FixVAngle()
-{SELFPARAM();
+void WarpZone_PlayerPhysics_FixVAngle(entity this)
+{
 #ifndef WARPZONE_DONT_FIX_VANGLE
-       if(IS_REAL_CLIENT(self))
-       if(self.v_angle.z <= 360) // if not already adjusted
-       if(time - self.ping * 0.001 < self.warpzone_teleport_time)
+       if(IS_REAL_CLIENT(this))
+       if(this.v_angle.z <= 360) // if not already adjusted
+       if(time - this.ping * 0.001 < this.warpzone_teleport_time)
        {
-               self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle);
-               self.v_angle_z += 720; // mark as adjusted
+               this.v_angle = WarpZone_TransformVAngles(this.warpzone_teleport_zone, this.v_angle);
+               this.v_angle_z += 720; // mark as adjusted
        }
 #endif
 }
index 0e0594a1ba403d0ea422a6e8a66a9f9e8a464ae7..db0ba59cc0c812f76a74290b110c2a6471ec13aa 100644 (file)
@@ -13,7 +13,7 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback();
 //const float ENT_CLIENT_WARPZONE;
 //const float ENT_CLIENT_WARPZONE_CAMERA;
 
-void WarpZone_PlayerPhysics_FixVAngle();
+void WarpZone_PlayerPhysics_FixVAngle(entity this);
 
 void WarpZone_PostInitialize_Callback();
 #endif
index 92c347a153dbd782b2a4828356f3015405ea8196..be232a28187af10a9f059ea2044eff531160be82 100644 (file)
 void WarpZoneLib_ExactTrigger_Init()
 {SELFPARAM();
        vector mi, ma;
-       if (self.movedir == '0 0 0')
-       if (self.angles != '0 0 0')
+       if (this.movedir == '0 0 0')
+       if (this.angles != '0 0 0')
        {
-               makevectors (self.angles);
-               self.movedir = v_forward;
+               makevectors (this.angles);
+               this.movedir = v_forward;
        }
-       if(self.model == "")
+       if(this.model == "")
        {
                // It's a box! No need to match with exacttriggers.
-               self.warpzone_isboxy = 1;
+               this.warpzone_isboxy = 1;
        }
        else
        {
-               mi = self.mins;
-               ma = self.maxs;
-               precache_model(self.model);
-               _setmodel(self, self.model);
+               mi = this.mins;
+               ma = this.maxs;
+               precache_model(this.model);
+               _setmodel(this, this.model);
                // let mapper-set mins/maxs override the model's bounds if set
                if(mi != '0 0 0' || ma != '0 0 0')
                {
                        // It's a box! No need to match with exacttriggers.
-                       self.mins = mi;
-                       self.maxs = ma;
-                       self.warpzone_isboxy = 1;
+                       this.mins = mi;
+                       this.maxs = ma;
+                       this.warpzone_isboxy = 1;
                }
        }
-       setorigin(self, self.origin);
-       if(self.scale)
-               setsize(self, self.mins * self.scale, self.maxs * self.scale);
+       setorigin(this, this.origin);
+       if(this.scale)
+               setsize(this, this.mins * this.scale, this.maxs * this.scale);
        else
-               setsize(self, self.mins, self.maxs);
-       self.movetype = MOVETYPE_NONE;
-       self.solid = SOLID_TRIGGER;
-       self.model = "";
+               setsize(this, this.mins, this.maxs);
+       this.movetype = MOVETYPE_NONE;
+       this.solid = SOLID_TRIGGER;
+       this.model = "";
 }
index 0c4f926dd95c7bf76107bd2eeb972c7a17230788..21f784e32dfbdad2e2bcb747cf32ca0ef734add9 100644 (file)
@@ -1,7 +1,5 @@
-#ifndef MENU_ALL_H
-#define MENU_ALL_H
+#pragma once
 
 #include "draw.qh"
 #include "xonotic/util.qh"
-
-#endif
+#include "menu.qh"
diff --git a/qcsrc/menu/_mod.inc b/qcsrc/menu/_mod.inc
new file mode 100644 (file)
index 0000000..589808e
--- /dev/null
@@ -0,0 +1,4 @@
+// generated file; do not modify
+#include "draw.qc"
+#include "item.qc"
+#include "menu.qc"
diff --git a/qcsrc/menu/anim/_mod.inc b/qcsrc/menu/anim/_mod.inc
new file mode 100644 (file)
index 0000000..c8048a1
--- /dev/null
@@ -0,0 +1,5 @@
+// generated file; do not modify
+#include "animation.qc"
+#include "animhost.qc"
+#include "easing.qc"
+#include "keyframe.qc"
index 09bf77217f142c28d62c491df1e86241af3b8e2f..72bcc5e94ec44a294f1b9eaa86b5cad566b0a22d 100644 (file)
@@ -1,34 +1,7 @@
-#ifndef ANIM_ANIMATION_H
-       #define ANIM_ANIMATION_H
-       CLASS(Animation, Object)
-               METHOD(Animation, configureAnimation, void(entity, entity, void(entity, float), float, float, float, float));
-               METHOD(Animation, update, void(entity, float, float, float));
-               METHOD(Animation, setTimeStartEnd, void(entity, float, float));
-               METHOD(Animation, setTimeStartDuration, void(entity, float, float));
-               METHOD(Animation, setValueStartEnd, void(entity, float, float));
-               METHOD(Animation, setValueStartDelta, void(entity, float, float));
-               METHOD(Animation, setObjectSetter, void(entity, entity, void(entity, float)));
-               METHOD(Animation, tick, void(entity, float));
-               METHOD(Animation, calcValue, float(entity, float, float, float, float));
-               METHOD(Animation, isStopped, float(entity));
-               METHOD(Animation, stopAnim, void(entity));
-               METHOD(Animation, resumeAnim, void(entity));
-               METHOD(Animation, isFinished, float(entity));
-               METHOD(Animation, finishAnim, void(entity));
-               ATTRIB(Animation, object, entity, NULL)
-               void setterDummy(entity, float) {}
-               ATTRIB(Animation, setter, void(entity, float), setterDummy)
-               ATTRIB(Animation, value, float, 0)
-               ATTRIB(Animation, startTime, float, 0)
-               ATTRIB(Animation, duration, float, 0)
-               ATTRIB(Animation, startValue, float, 0)
-               ATTRIB(Animation, delta, float, 0)
-               ATTRIB(Animation, stopped, float, false)
-               ATTRIB(Animation, finished, float, false)
-       ENDCLASS(Animation)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "animation.qh"
+
+#include "../menu.qh"
+
        METHOD(Animation, configureAnimation, void(entity this, entity obj, void(entity, float) objSetter, float animStartTime, float animDuration, float animStartValue, float animEndValue))
        {
                this.setObjectSetter(this, obj, objSetter);
                this.finished = true;
                this.setter(this.object, this.value);
        }
-
-#endif
diff --git a/qcsrc/menu/anim/animation.qh b/qcsrc/menu/anim/animation.qh
new file mode 100644 (file)
index 0000000..0427f32
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+CLASS(Animation, Object)
+       METHOD(Animation, configureAnimation, void(Animation this, entity, void(entity, float), float, float, float, float));
+       METHOD(Animation, update, void(Animation this, float, float, float));
+       METHOD(Animation, setTimeStartEnd, void(Animation this, float, float));
+       METHOD(Animation, setTimeStartDuration, void(Animation this, float, float));
+       METHOD(Animation, setValueStartEnd, void(Animation this, float, float));
+       METHOD(Animation, setValueStartDelta, void(Animation this, float, float));
+       METHOD(Animation, setObjectSetter, void(Animation this, entity, void(entity, float)));
+       METHOD(Animation, tick, void(Animation this, float));
+       METHOD(Animation, calcValue, float(Animation this, float, float, float, float));
+       METHOD(Animation, isStopped, float(Animation this));
+       METHOD(Animation, stopAnim, void(Animation this));
+       METHOD(Animation, resumeAnim, void(Animation this));
+       METHOD(Animation, isFinished, float(Animation this));
+       METHOD(Animation, finishAnim, void(Animation this));
+       ATTRIB(Animation, object, entity, NULL)
+       void setterDummy(Animation this, float) {}
+       ATTRIB(Animation, setter, void(Animation this, float), setterDummy)
+       ATTRIB(Animation, value, float, 0)
+       ATTRIB(Animation, startTime, float, 0)
+       ATTRIB(Animation, duration, float, 0)
+       ATTRIB(Animation, startValue, float, 0)
+       ATTRIB(Animation, delta, float, 0)
+       ATTRIB(Animation, stopped, float, false)
+       ATTRIB(Animation, finished, float, false)
+ENDCLASS(Animation)
index 7826a47b79523f3de5ac730be832bf1fbe6b7423..5e39191dd658c71d38dd363393483854ba7cb3e4 100644 (file)
@@ -1,27 +1,10 @@
+#include "animhost.qh"
+
 #include "../menu.qh"
 
-#ifndef ANIM_ANIMHOST_H
-       #define ANIM_ANIMHOST_H
-       CLASS(AnimHost, Object)
-               METHOD(AnimHost, addAnim, void(entity, entity));
-               METHOD(AnimHost, removeAnim, void(entity, entity));
-               METHOD(AnimHost, removeAllAnim, void(entity));
-               METHOD(AnimHost, removeObjAnim, void(entity, entity));
-               METHOD(AnimHost, stopAllAnim, void(entity));
-               METHOD(AnimHost, stopObjAnim, void(entity, entity));
-               METHOD(AnimHost, resumeAllAnim, void(entity));
-               METHOD(AnimHost, resumeObjAnim, void(entity, entity));
-               METHOD(AnimHost, finishAllAnim, void(entity));
-               METHOD(AnimHost, finishObjAnim, void(entity, entity));
-               METHOD(AnimHost, tickAll, void(entity));
-               ATTRIB(AnimHost, firstChild, entity, NULL)
-               ATTRIB(AnimHost, lastChild, entity, NULL)
-       ENDCLASS(AnimHost)
-       .entity nextSibling;
-       .entity prevSibling;
-#endif
-
-#ifdef IMPLEMENTATION
+#include "animation.qh"
+
+    .entity parent;
        METHOD(AnimHost, addAnim, void(entity this, entity other))
        {
                if (other.parent) error("Can't add already added anim!");
                        }
                }
        }
-#endif
diff --git a/qcsrc/menu/anim/animhost.qh b/qcsrc/menu/anim/animhost.qh
new file mode 100644 (file)
index 0000000..1292b7d
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "../item/container.qh"
+
+CLASS(AnimHost, Object)
+       METHOD(AnimHost, addAnim, void(entity, entity));
+       METHOD(AnimHost, removeAnim, void(entity, entity));
+       METHOD(AnimHost, removeAllAnim, void(entity));
+       METHOD(AnimHost, removeObjAnim, void(entity, entity));
+       METHOD(AnimHost, stopAllAnim, void(entity));
+       METHOD(AnimHost, stopObjAnim, void(entity, entity));
+       METHOD(AnimHost, resumeAllAnim, void(entity));
+       METHOD(AnimHost, resumeObjAnim, void(entity, entity));
+       METHOD(AnimHost, finishAllAnim, void(entity));
+       METHOD(AnimHost, finishObjAnim, void(entity, entity));
+       METHOD(AnimHost, tickAll, void(entity));
+       ATTRIB(AnimHost, firstChild, entity, NULL)
+       ATTRIB(AnimHost, lastChild, entity, NULL)
+ENDCLASS(AnimHost)
index 080f390ba9314245cff104f5761d9976d455a6a6..3014fa80873a8aa479dcb8cb986c19bf54d9ea35 100644 (file)
@@ -1,20 +1,8 @@
-#ifndef ANIM_EASING_H
-       #define ANIM_EASING_H
-       #include "animation.qc"
-       entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
-       entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
-       float easingLinear(float, float, float, float);
-       float easingQuadIn(float, float, float, float);
-       float easingQuadOut(float, float, float, float);
-       float easingQuadInOut(float, float, float, float);
-       CLASS(Easing, Animation)
-               METHOD(Easing, calcValue, float(entity, float, float, float, float));
-               METHOD(Easing, setMath, void(entity, float(float, float, float, float)));
-               ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
-       ENDCLASS(Easing)
-#endif
+#include "easing.qh"
+
+#include "../menu.qh"
+#include "keyframe.qh"
 
-#ifdef IMPLEMENTATION
        entity makeHostedEasing(entity obj, void(entity, float) objSetter, float(float, float, float, float) func, float animDuration, float animStartValue, float animEnd)
        {
                entity this = makeEasing(obj, objSetter, func, time, animDuration, animStartValue, animEnd);
@@ -62,5 +50,3 @@
                if (tickTime < (animDuration / 2)) return easingQuadIn(tickTime, (animDuration / 2), animStart, (animDelta / 2));
                else return easingQuadOut((tickTime - (animDuration / 2)), (animDuration / 2), (animStart + (animDelta / 2)), (animDelta / 2));
        }
-
-#endif
diff --git a/qcsrc/menu/anim/easing.qh b/qcsrc/menu/anim/easing.qh
new file mode 100644 (file)
index 0000000..832a87c
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "animation.qh"
+entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
+entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
+float easingLinear(float, float, float, float);
+float easingQuadIn(float, float, float, float);
+float easingQuadOut(float, float, float, float);
+float easingQuadInOut(float, float, float, float);
+CLASS(Easing, Animation)
+       METHOD(Easing, calcValue, float(entity, float, float, float, float));
+       METHOD(Easing, setMath, void(entity, float(float, float, float, float)));
+       ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
+ENDCLASS(Easing)
index eec5c03aec2698f33db516d7c671fec3c86e9274..12c0c9acadecd7e26c9922157ee50188e0fbc4af 100644 (file)
@@ -1,22 +1,12 @@
-#ifndef ANIM_KEYFRAME_H
-       #define ANIM_KEYFRAME_H
-       #include "animation.qc"
-       CLASS(Keyframe, Animation)
-               METHOD(Keyframe, addEasing, entity(entity, float, float, float(float, float, float, float)));
-               METHOD(Keyframe, addAnim, void(entity, entity));
-               METHOD(Keyframe, calcValue, float(entity, float, float, float, float));
-               ATTRIB(Keyframe, currentChild, entity, NULL)
-               ATTRIB(Keyframe, firstChild, entity, NULL)
-               ATTRIB(Keyframe, lastChild, entity, NULL)
-       ENDCLASS(Keyframe)
-       entity makeHostedKeyframe(entity, void(entity, float), float, float, float);
-       entity makeKeyframe(entity, void(entity, float), float, float, float);
-       float getNewChildStart(entity);
-       float getNewChildDuration(entity, float);
-       float getNewChildValue(entity);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "keyframe.qh"
+
+#include "../menu.qh"
+#include "easing.qh"
+
+#include "../item/container.qh"
+
+.entity parent;
+
        entity makeHostedKeyframe(entity obj, void(entity, float) objSetter, float animDuration, float animStart, float animEnd)
        {
                entity this = makeKeyframe(obj, objSetter, animDuration, animStart, animEnd);
@@ -97,4 +87,3 @@
 
                return animStartValue + animDelta;
        }
-#endif
diff --git a/qcsrc/menu/anim/keyframe.qh b/qcsrc/menu/anim/keyframe.qh
new file mode 100644 (file)
index 0000000..d21db69
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "animation.qh"
+CLASS(Keyframe, Animation)
+       METHOD(Keyframe, addEasing, entity(entity, float, float, float(float, float, float, float)));
+       METHOD(Keyframe, addAnim, void(entity, entity));
+       METHOD(Keyframe, calcValue, float(entity, float, float, float, float));
+       ATTRIB(Keyframe, currentChild, entity, NULL)
+       ATTRIB(Keyframe, firstChild, entity, NULL)
+       ATTRIB(Keyframe, lastChild, entity, NULL)
+ENDCLASS(Keyframe)
+entity makeHostedKeyframe(entity, void(entity, float), float, float, float);
+entity makeKeyframe(entity, void(entity, float), float, float, float);
+float getNewChildStart(entity);
+float getNewChildDuration(entity, float);
+float getNewChildValue(entity);
index 3aa3e43057447ea63b43a8bb996d5881b36369f4..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 (file)
@@ -1,137 +1 @@
-#include "anim/animation.qc"
-#include "anim/animhost.qc"
-#include "anim/easing.qc"
-#include "anim/keyframe.qc"
 
-#include "item.qc"
-#include "item/borderimage.qc"
-#include "item/button.qc"
-#include "item/checkbox.qc"
-#include "item/container.qc"
-#include "item/dialog.qc"
-#include "item/image.qc"
-#include "item/inputbox.qc"
-#include "item/inputcontainer.qc"
-#include "item/label.qc"
-#include "item/listbox.qc"
-#include "item/modalcontroller.qc"
-#include "item/nexposee.qc"
-#include "item/radiobutton.qc"
-#include "item/slider.qc"
-#include "item/tab.qc"
-#include "item/textslider.qc"
-
-#include "xonotic/bigbutton.qc"
-#include "xonotic/bigcommandbutton.qc"
-#include "xonotic/button.qc"
-#include "xonotic/campaign.qc"
-#include "xonotic/charmap.qc"
-#include "xonotic/checkbox.qc"
-#include "xonotic/checkbox_slider_invalid.qc"
-#include "xonotic/checkbox_string.qc"
-#include "xonotic/colorbutton.qc"
-#include "xonotic/colorpicker.qc"
-#include "xonotic/colorpicker_string.qc"
-#include "xonotic/commandbutton.qc"
-#include "xonotic/credits.qc"
-#include "xonotic/crosshairpicker.qc"
-#include "xonotic/crosshairpreview.qc"
-#include "xonotic/cvarlist.qc"
-#include "xonotic/datasource.qc"
-#include "xonotic/demolist.qc"
-#include "xonotic/dialog.qc"
-#include "xonotic/dialog_credits.qc"
-#include "xonotic/dialog_firstrun.qc"
-#include "xonotic/dialog_hudpanel_ammo.qc"
-#include "xonotic/dialog_hudpanel_centerprint.qc"
-#include "xonotic/dialog_hudpanel_chat.qc"
-#include "xonotic/dialog_hudpanel_engineinfo.qc"
-#include "xonotic/dialog_hudpanel_healtharmor.qc"
-#include "xonotic/dialog_hudpanel_infomessages.qc"
-#include "xonotic/dialog_hudpanel_itemstime.qc"
-#include "xonotic/dialog_hudpanel_modicons.qc"
-#include "xonotic/dialog_hudpanel_notification.qc"
-#include "xonotic/dialog_hudpanel_physics.qc"
-#include "xonotic/dialog_hudpanel_powerups.qc"
-#include "xonotic/dialog_hudpanel_pressedkeys.qc"
-#include "xonotic/dialog_hudpanel_quickmenu.qc"
-#include "xonotic/dialog_hudpanel_racetimer.qc"
-#include "xonotic/dialog_hudpanel_radar.qc"
-#include "xonotic/dialog_hudpanel_score.qc"
-#include "xonotic/dialog_hudpanel_timer.qc"
-#include "xonotic/dialog_hudpanel_vote.qc"
-#include "xonotic/dialog_hudpanel_weapons.qc"
-#include "xonotic/dialog_hudsetup_exit.qc"
-#include "xonotic/dialog_monstertools.qc"
-#include "xonotic/dialog_multiplayer.qc"
-#include "xonotic/dialog_multiplayer_create.qc"
-#include "xonotic/dialog_multiplayer_create_mapinfo.qc"
-#include "xonotic/dialog_multiplayer_create_mutators.qc"
-#include "xonotic/dialog_multiplayer_join.qc"
-#include "xonotic/dialog_multiplayer_join_serverinfo.qc"
-#include "xonotic/dialog_multiplayer_media.qc"
-#include "xonotic/dialog_multiplayer_media_demo.qc"
-#include "xonotic/dialog_multiplayer_media_demo_startconfirm.qc"
-#include "xonotic/dialog_multiplayer_media_demo_timeconfirm.qc"
-#include "xonotic/dialog_multiplayer_media_musicplayer.qc"
-#include "xonotic/dialog_multiplayer_media_screenshot.qc"
-#include "xonotic/dialog_multiplayer_media_screenshot_viewer.qc"
-#include "xonotic/dialog_multiplayer_profile.qc"
-#include "xonotic/dialog_quit.qc"
-#include "xonotic/dialog_sandboxtools.qc"
-#include "xonotic/dialog_settings.qc"
-#include "xonotic/dialog_settings_audio.qc"
-#include "xonotic/dialog_settings_effects.qc"
-#include "xonotic/dialog_settings_game.qc"
-#include "xonotic/dialog_settings_game_crosshair.qc"
-#include "xonotic/dialog_settings_game_hudconfirm.qc"
-#include "xonotic/dialog_settings_game_hud.qc"
-#include "xonotic/dialog_settings_game_messages.qc"
-#include "xonotic/dialog_settings_game_model.qc"
-#include "xonotic/dialog_settings_game_view.qc"
-#include "xonotic/dialog_settings_game_weapons.qc"
-#include "xonotic/dialog_settings_input.qc"
-#include "xonotic/dialog_settings_input_userbind.qc"
-#include "xonotic/dialog_settings_misc.qc"
-#include "xonotic/dialog_settings_misc_cvars.qc"
-#include "xonotic/dialog_settings_misc_reset.qc"
-#include "xonotic/dialog_settings_user.qc"
-#include "xonotic/dialog_settings_user_languagewarning.qc"
-#include "xonotic/dialog_settings_video.qc"
-#include "xonotic/dialog_singleplayer.qc"
-#include "xonotic/dialog_singleplayer_winner.qc"
-#include "xonotic/dialog_teamselect.qc"
-#include "xonotic/gametypelist.qc"
-#include "xonotic/hudskinlist.qc"
-#include "xonotic/image.qc"
-#include "xonotic/inputbox.qc"
-#include "xonotic/keybinder.qc"
-#include "xonotic/languagelist.qc"
-#include "xonotic/listbox.qc"
-#include "xonotic/mainwindow.qc"
-#include "xonotic/maplist.qc"
-#include "xonotic/nexposee.qc"
-#include "xonotic/picker.qc"
-#include "xonotic/playerlist.qc"
-#include "xonotic/playermodel.qc"
-#include "xonotic/playlist.qc"
-#include "xonotic/radiobutton.qc"
-#include "xonotic/rootdialog.qc"
-#include "xonotic/screenshotimage.qc"
-#include "xonotic/screenshotlist.qc"
-#include "xonotic/serverlist.qc"
-#include "xonotic/skinlist.qc"
-#include "xonotic/slider.qc"
-#include "xonotic/slider_decibels.qc"
-#include "xonotic/slider_particles.qc"
-#include "xonotic/slider_picmip.qc"
-#include "xonotic/slider_resolution.qc"
-#include "xonotic/slider_sbfadetime.qc"
-#include "xonotic/soundlist.qc"
-#include "xonotic/statslist.qc"
-#include "xonotic/tabcontroller.qc"
-#include "xonotic/tab.qc"
-#include "xonotic/textlabel.qc"
-#include "xonotic/textslider.qc"
-#include "xonotic/weaponarenacheckbox.qc"
-#include "xonotic/weaponslist.qc"
diff --git a/qcsrc/menu/classes.qc b/qcsrc/menu/classes.qc
deleted file mode 100644 (file)
index 9454a31..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef CLASSES_H
-#define CLASSES_H
-
-#include "classes.inc"
-#define IMPLEMENTATION
-#include "classes.inc"
-#undef IMPLEMENTATION
-
-#endif
diff --git a/qcsrc/menu/command/_mod.inc b/qcsrc/menu/command/_mod.inc
new file mode 100644 (file)
index 0000000..061d60a
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "all.qc"
+#include "menu_cmd.qc"
index a08a1cee154bd56fc344c788c3a205240ab056b7..283cca0c1b98b1d0c5dfc61917c00c946175c43f 100644 (file)
@@ -1,5 +1 @@
-#include "../menu.qh"
-
 #include <common/command/all.qc>
-
-#include "menu_cmd.qc"
diff --git a/qcsrc/menu/command/all.qh b/qcsrc/menu/command/all.qh
deleted file mode 100644 (file)
index f42a64f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef MENU_COMMANDS_ALL_H
-#define MENU_COMMANDS_ALL_H
-
-#include <common/command/commands.qh>
-
-#include "menu_cmd.qh"
-
-#endif
index c76beca04bf34a7c51b847fa627fc215cef25e17..0f87cbb0959cb38df039f1cac70f796cabd0185b 100644 (file)
@@ -1,7 +1,7 @@
 #include "menu_cmd.qh"
 
 #include "../menu.qh"
-#include "../classes.qc"
+#include "../item.qh"
 
 #include "../mutators/events.qh"
 
@@ -78,7 +78,7 @@ void GameCommand(string theCommand)
                {
                        LOG_INFO(_("Available options:\n"));
 
-                       FOREACH_ENTITY_ORDERED(it.name != "", LAMBDA(
+                       FOREACH_ENTITY_ORDERED(it.name != "", {
                                if (it.classname == "vtbl") continue;
                                string s = it.name;
                                if (filter)
@@ -87,7 +87,7 @@ void GameCommand(string theCommand)
                                        s = substring(s, strlen(filter), strlen(s) - strlen(filter));
                                }
                                LOG_INFOF(" %s\n", s);
-                       ));
+                       });
                }
                else if (argc == 2 && !isdemo())     // don't allow this command in demos
                {
index 364b13690a08e1336733b5669c24856ca9b7ca96..31537bd40f96da7d2ae4b5902a59040c617fe406 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef MENU_CMD_H
-#define MENU_CMD_H
+#pragma once
 
 void GameCommand(string command);
-#endif
index 74bcae3042dfd886529aff28737462144e193272..b12534f7d73756d49d5a2703f036562a4bf76d85 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef DRAW_H
-#define DRAW_H
+#pragma once
 
 // from the engine
 vector drawfontscale;
@@ -41,4 +40,3 @@ vector globalToBoxSize(vector v, vector scale);
 
 float draw_TextWidth_WithColors(string s, vector size);
 float draw_TextWidth_WithoutColors(string s, vector size);
-#endif
index 868ac0fe3182570457360c000511704b21e3bb7d..80133b8b374dd7bb9d7dfa86373cfa3a984f06e3 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifdef MENUQC
 
-#include "xonotic/tab.qc"
+#include "xonotic/tab.qh"
 
 REGISTRY(Settings, BITS(3))
 #define Settings_from(i) _Settings_from(i, NULL)
index 12132affb4a267baf6124ee9cb7ff73b0321392a..1d31e95a9c7d5c513ea9f2766da4c574a1d7eca3 100644 (file)
@@ -1,34 +1,8 @@
-#ifndef ITEM_H
-#define ITEM_H
-#include "skin.qh"
-CLASS(Item, Object)
-       METHOD(Item, draw, void(Item));
-       METHOD(Item, keyDown, float(Item, float, float, float));
-       METHOD(Item, keyUp, float(Item, float, float, float));
-       METHOD(Item, mouseMove, float(Item, vector));
-       METHOD(Item, mousePress, float(Item, vector));
-       METHOD(Item, mouseDrag, float(Item, vector));
-       METHOD(Item, mouseRelease, float(Item, vector));
-       METHOD(Item, focusEnter, void(Item));
-       METHOD(Item, focusLeave, void(Item));
-       METHOD(Item, resizeNotify, void(Item, vector, vector, vector, vector));
-       METHOD(Item, relinquishFocus, void(Item));
-       METHOD(Item, showNotify, void(Item));
-       METHOD(Item, hideNotify, void(Item));
-       METHOD(Item, toString, string(Item));
-       METHOD(Item, destroy, void(Item));
-       ATTRIB(Item, focused, float, 0)
-       ATTRIB(Item, focusable, float, 0)
-       ATTRIB(Item, allowFocusSound, float, 0)
-       ATTRIB(Item, parent, entity, NULL)
-       ATTRIB(Item, preferredFocusPriority, float, 0)
-       ATTRIB(Item, origin, vector, '0 0 0')
-       ATTRIB(Item, size, vector, '0 0 0')
-       ATTRIB(Item, tooltip, string, string_null)
-ENDCLASS(Item)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "item.qh"
+
+#include "item/container.qh"
+#include "item/borderimage.qh"
+
        METHOD(Item, destroy, void(Item this))
        {
                // free memory associated with this
@@ -115,6 +89,8 @@ ENDCLASS(Item)
                return 0;  // unhandled
        }
 
+    void m_play_focus_sound();
+
        METHOD(Item, focusEnter, void(Item this))
        {
                if (this.allowFocusSound) m_play_focus_sound();
@@ -127,4 +103,3 @@ ENDCLASS(Item)
        {
                return string_null;
        }
-#endif
diff --git a/qcsrc/menu/item.qh b/qcsrc/menu/item.qh
new file mode 100644 (file)
index 0000000..118a454
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once
+
+// convenience
+#include "skin.qh"
+
+CLASS(Item, Object)
+       METHOD(Item, draw, void(Item));
+       METHOD(Item, keyDown, float(Item, float, float, float));
+       METHOD(Item, keyUp, float(Item, float, float, float));
+       METHOD(Item, mouseMove, float(Item, vector));
+       METHOD(Item, mousePress, float(Item, vector));
+       METHOD(Item, mouseDrag, float(Item, vector));
+       METHOD(Item, mouseRelease, float(Item, vector));
+       METHOD(Item, focusEnter, void(Item));
+       METHOD(Item, focusLeave, void(Item));
+       METHOD(Item, resizeNotify, void(Item, vector, vector, vector, vector));
+       METHOD(Item, relinquishFocus, void(Item));
+       METHOD(Item, showNotify, void(Item));
+       METHOD(Item, hideNotify, void(Item));
+       METHOD(Item, toString, string(Item));
+       METHOD(Item, destroy, void(Item));
+       ATTRIB(Item, focused, float, 0)
+       ATTRIB(Item, focusable, float, 0)
+       ATTRIB(Item, allowFocusSound, float, 0)
+       ATTRIB(Item, parent, entity, NULL)
+       ATTRIB(Item, preferredFocusPriority, float, 0)
+       ATTRIB(Item, origin, vector, '0 0 0')
+       ATTRIB(Item, size, vector, '0 0 0')
+       ATTRIB(Item, tooltip, string, string_null)
+ENDCLASS(Item)
diff --git a/qcsrc/menu/item/_mod.inc b/qcsrc/menu/item/_mod.inc
new file mode 100644 (file)
index 0000000..a470788
--- /dev/null
@@ -0,0 +1,17 @@
+// generated file; do not modify
+#include "borderimage.qc"
+#include "button.qc"
+#include "checkbox.qc"
+#include "container.qc"
+#include "dialog.qc"
+#include "image.qc"
+#include "inputbox.qc"
+#include "inputcontainer.qc"
+#include "label.qc"
+#include "listbox.qc"
+#include "modalcontroller.qc"
+#include "nexposee.qc"
+#include "radiobutton.qc"
+#include "slider.qc"
+#include "tab.qc"
+#include "textslider.qc"
index 4acf33d86115c50f3f787cc6ddc6b48256d1574d..ff37b4b86fed56b31d239dd42b3e1e7a2bc75810 100644 (file)
@@ -1,29 +1,7 @@
-#ifndef ITEM_BORDERIMAGE_H
-       #define ITEM_BORDERIMAGE_H
-       #include "label.qc"
-       CLASS(BorderImage, Label)
-               METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float));
-               METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(BorderImage, recalcPositionWithText, void(entity, string));
-               ATTRIB(BorderImage, isBold, float, 1)
-               METHOD(BorderImage, draw, void(entity));
-               ATTRIB(BorderImage, src, string, string_null)
-               ATTRIB(BorderImage, borderHeight, float, 0)
-               ATTRIB(BorderImage, borderVec, vector, '0 0 0')
-               ATTRIB(BorderImage, color, vector, '1 1 1')
-               ATTRIB(BorderImage, closeButton, entity, NULL)
-               ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
-               ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
-               ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
-               ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
-               ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
-               ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
-               ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
-               ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
-       ENDCLASS(BorderImage)
-#endif
+#include "borderimage.qh"
 
-#ifdef IMPLEMENTATION
+#include "nexposee.qh"
+#include "dialog.qh"
        void BorderImage_recalcPositionWithText(entity me, string t)
        {
                if (me.isNexposeeTitleBar)
                        SUPER(BorderImage).draw(me);
                }
        }
-#endif
diff --git a/qcsrc/menu/item/borderimage.qh b/qcsrc/menu/item/borderimage.qh
new file mode 100644 (file)
index 0000000..c956d36
--- /dev/null
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "label.qh"
+CLASS(BorderImage, Label)
+       METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float));
+       METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(BorderImage, recalcPositionWithText, void(entity, string));
+       ATTRIB(BorderImage, isBold, float, 1)
+       METHOD(BorderImage, draw, void(entity));
+       ATTRIB(BorderImage, src, string, string_null)
+       ATTRIB(BorderImage, borderHeight, float, 0)
+       ATTRIB(BorderImage, borderVec, vector, '0 0 0')
+       ATTRIB(BorderImage, color, vector, '1 1 1')
+       ATTRIB(BorderImage, closeButton, entity, NULL)
+       ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
+       ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
+       ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
+       ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
+       ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
+       ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
+       ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
+       ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
+ENDCLASS(BorderImage)
+
+.vector colorC, colorF;
index a81a0a22f78a3cb5d57479eae08f23cd4a565258..8299a6859f539c097404e15184437e0903b44c4f 100644 (file)
@@ -1,46 +1,5 @@
-#ifndef ITEM_BUTTON_H
-       #define ITEM_BUTTON_H
-       #include "label.qc"
-       CLASS(Button, Label)
-               METHOD(Button, configureButton, void(entity, string, float, string));
-               METHOD(Button, draw, void(entity));
-               METHOD(Button, showNotify, void(entity));
-               METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Button, keyDown, float(entity, float, float, float));
-               METHOD(Button, mousePress, float(entity, vector));
-               METHOD(Button, mouseDrag, float(entity, vector));
-               METHOD(Button, mouseRelease, float(entity, vector));
-               METHOD(Button, playClickSound, void(entity));
-               ATTRIB(Button, onClick, void(entity, entity), func_null)
-               ATTRIB(Button, onClickEntity, entity, NULL)
-               ATTRIB(Button, src, string, string_null)
-               ATTRIB(Button, srcSuffix, string, string_null)
-               ATTRIB(Button, src2, string, string_null) // is centered, same aspect, and stretched to label size
-               ATTRIB(Button, src2scale, float, 1)
-               ATTRIB(Button, srcMulti, float, 1)        // 0: button square left, text right; 1: button stretched, text over it
-               ATTRIB(Button, buttonLeftOfText, float, 0)
-               ATTRIB(Button, focusable, float, 1)
-               ATTRIB(Button, allowFocusSound, float, 1)
-               ATTRIB(Button, pressed, float, 0)
-               ATTRIB(Button, clickTime, float, 0)
-               ATTRIB(Button, applyButton, entity, NULL)
-               ATTRIB(Button, disableOnClick, bool, false)
-               ATTRIB(Button, disabled, float, 0)
-               ATTRIB(Button, disabledAlpha, float, 0.3)
-               ATTRIB(Button, forcePressed, float, 0)
-               ATTRIB(Button, color, vector, '1 1 1')
-               ATTRIB(Button, colorC, vector, '1 1 1')
-               ATTRIB(Button, colorF, vector, '1 1 1')
-               ATTRIB(Button, colorD, vector, '1 1 1')
-               ATTRIB(Button, color2, vector, '1 1 1')
-               ATTRIB(Button, alpha2, float, 1)
+#include "button.qh"
 
-               ATTRIB(Button, origin, vector, '0 0 0')
-               ATTRIB(Button, size, vector, '0 0 0')
-       ENDCLASS(Button)
-#endif
-
-#ifdef IMPLEMENTATION
        void Button_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
        {
                if (me.srcMulti) me.keepspaceLeft = 0;
                else if (me.onClick == Dialog_Close) m_play_click_sound(MENU_SOUND_CLOSE);
                else m_play_click_sound(MENU_SOUND_EXECUTE);
        }
-#endif
diff --git a/qcsrc/menu/item/button.qh b/qcsrc/menu/item/button.qh
new file mode 100644 (file)
index 0000000..6fd2bc8
--- /dev/null
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "modalcontroller.qh"
+
+#include "label.qh"
+CLASS(Button, Label)
+       METHOD(Button, configureButton, void(entity, string, float, string));
+       METHOD(Button, draw, void(entity));
+       METHOD(Button, showNotify, void(entity));
+       METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Button, keyDown, float(entity, float, float, float));
+       METHOD(Button, mousePress, float(entity, vector));
+       METHOD(Button, mouseDrag, float(entity, vector));
+       METHOD(Button, mouseRelease, float(entity, vector));
+       METHOD(Button, playClickSound, void(entity));
+       ATTRIB(Button, onClick, void(entity, entity), func_null)
+       ATTRIB(Button, onClickEntity, entity, NULL)
+       ATTRIB(Button, src, string, string_null)
+       ATTRIB(Button, srcSuffix, string, string_null)
+       ATTRIB(Button, src2, string, string_null) // is centered, same aspect, and stretched to label size
+       ATTRIB(Button, src2scale, float, 1)
+       ATTRIB(Button, srcMulti, float, 1)        // 0: button square left, text right; 1: button stretched, text over it
+       ATTRIB(Button, buttonLeftOfText, float, 0)
+       ATTRIB(Button, focusable, float, 1)
+       ATTRIB(Button, allowFocusSound, float, 1)
+       ATTRIB(Button, pressed, float, 0)
+       ATTRIB(Button, clickTime, float, 0)
+       ATTRIB(Button, applyButton, entity, NULL)
+       ATTRIB(Button, disableOnClick, bool, false)
+       ATTRIB(Button, disabled, float, 0)
+       ATTRIB(Button, disabledAlpha, float, 0.3)
+       ATTRIB(Button, forcePressed, float, 0)
+       ATTRIB(Button, color, vector, '1 1 1')
+       ATTRIB(Button, colorC, vector, '1 1 1')
+       ATTRIB(Button, colorF, vector, '1 1 1')
+       ATTRIB(Button, colorD, vector, '1 1 1')
+       ATTRIB(Button, color2, vector, '1 1 1')
+       ATTRIB(Button, alpha2, float, 1)
+
+       ATTRIB(Button, origin, vector, '0 0 0')
+       ATTRIB(Button, size, vector, '0 0 0')
+ENDCLASS(Button)
index 17bc50103e262850a8707a281fa9615f0af060c9..79cfe7a9961ca34c49e4f139a4f0864169dcd4bb 100644 (file)
@@ -1,22 +1,5 @@
-#ifndef ITEM_CHECKBOX_H
-       #define ITEM_CHECKBOX_H
-       #include "button.qc"
-       void CheckBox_Click(entity me, entity other);
-       CLASS(CheckBox, Button)
-               METHOD(CheckBox, configureCheckBox, void(entity, string, float, string));
-               METHOD(CheckBox, draw, void(entity));
-               METHOD(CheckBox, playClickSound, void(entity));
-               METHOD(CheckBox, toString, string(entity));
-               METHOD(CheckBox, setChecked, void(entity, float));
-               ATTRIB(CheckBox, useDownAsChecked, float, 0)
-               ATTRIB(CheckBox, checked, float, 0)
-               ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click)
-               ATTRIB(CheckBox, srcMulti, float, 0)
-               ATTRIB(CheckBox, disabled, float, 0)
-       ENDCLASS(CheckBox)
-#endif
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
        void CheckBox_setChecked(entity me, float val)
        {
                me.checked = val;
@@ -54,4 +37,3 @@
        {
                m_play_click_sound(MENU_SOUND_SELECT);
        }
-#endif
diff --git a/qcsrc/menu/item/checkbox.qh b/qcsrc/menu/item/checkbox.qh
new file mode 100644 (file)
index 0000000..32f6b0f
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "button.qh"
+CLASS(CheckBox, Button)
+       METHOD(CheckBox, configureCheckBox, void(entity, string, float, string));
+       METHOD(CheckBox, draw, void(entity));
+       METHOD(CheckBox, playClickSound, void(entity));
+       METHOD(CheckBox, toString, string(entity));
+       METHOD(CheckBox, setChecked, void(entity, float));
+       ATTRIB(CheckBox, useDownAsChecked, float, 0)
+       ATTRIB(CheckBox, checked, float, 0)
+    void CheckBox_Click(entity me, entity other);
+       ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click)
+       ATTRIB(CheckBox, srcMulti, float, 0)
+       ATTRIB(CheckBox, disabled, float, 0)
+ENDCLASS(CheckBox)
index 17412cd0fbffef4e4c7c73a131b627d56c4cfa6b..56535bf71c18f5ddd24202dc534642568948c1c2 100644 (file)
@@ -1,54 +1,5 @@
-#ifndef ITEM_CONTAINER_H
-       #define ITEM_CONTAINER_H
-       #include "../item.qc"
-       CLASS(Container, Item)
-               METHOD(Container, draw, void(entity));
-               METHOD(Container, keyUp, float(entity, float, float, float));
-               METHOD(Container, keyDown, float(entity, float, float, float));
-               METHOD(Container, mouseMove, float(entity, vector));
-               METHOD(Container, mousePress, float(entity, vector));
-               METHOD(Container, mouseDrag, float(entity, vector));
-               METHOD(Container, mouseRelease, float(entity, vector));
-               METHOD(Container, focusLeave, void(entity));
-               METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector));
-               METHOD(Container, addItem, void(entity, entity, vector, vector, float));
-               METHOD(Container, addItemCentered, void(entity, entity, vector, float));
-               METHOD(Container, addItemRightCentered, void(entity, entity, vector, float));
-               METHOD(Container, moveItemAfter, void(entity, entity, entity));
-               METHOD(Container, removeItem, void(entity, entity));
-               METHOD(Container, setFocus, void(entity, entity));
-               METHOD(Container, saveFocus, void(entity));
-               METHOD(Container, setAlphaOf, void(entity, entity, float));
-               METHOD(Container, itemFromPoint, entity(entity, vector));
-               METHOD(Container, showNotify, void(entity));
-               METHOD(Container, hideNotify, void(entity));
-               METHOD(Container, preferredFocusedGrandChild, entity(entity));
-               ATTRIB(Container, focusable, float, 0)
-               ATTRIB(Container, firstChild, entity, NULL)
-               ATTRIB(Container, lastChild, entity, NULL)
-               ATTRIB(Container, focusedChild, entity, NULL)
-               ATTRIB(Container, savedFocus, entity, NULL)
-               ATTRIB(Container, shown, float, 0)
-
-               METHOD(Container, enterSubitem, void(entity, entity));
-               METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float));
-               METHOD(Container, leaveSubitem, void(entity));
-       ENDCLASS(Container)
-       .entity nextSibling;
-       .entity prevSibling;
-       .float resized;
-       .vector Container_origin;
-       .vector Container_size;
-       .vector Container_fontscale;
-       .float Container_alpha;
-       .vector Container_save_shift;
-       .vector Container_save_scale;
-       .vector Container_save_fontscale;
-       .float Container_save_alpha;
-#endif
-
-#ifdef IMPLEMENTATION
+#include "container.qh"
+
        void Container_enterSubitem(entity me, entity sub)
        {
                me.enterLieSubitem(me, sub.Container_origin, sub.Container_size, sub.Container_fontscale, sub.Container_alpha);
 
                return best;
        }
-#endif
diff --git a/qcsrc/menu/item/container.qh b/qcsrc/menu/item/container.qh
new file mode 100644 (file)
index 0000000..dbb4cf2
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <menu/item.qh>
+
+CLASS(Container, Item)
+       METHOD(Container, draw, void(entity));
+       METHOD(Container, keyUp, float(entity, float, float, float));
+       METHOD(Container, keyDown, float(entity, float, float, float));
+       METHOD(Container, mouseMove, float(entity, vector));
+       METHOD(Container, mousePress, float(entity, vector));
+       METHOD(Container, mouseDrag, float(entity, vector));
+       METHOD(Container, mouseRelease, float(entity, vector));
+       METHOD(Container, focusLeave, void(entity));
+       METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector));
+       METHOD(Container, addItem, void(entity, entity, vector, vector, float));
+       METHOD(Container, addItemCentered, void(entity, entity, vector, float));
+       METHOD(Container, addItemRightCentered, void(entity, entity, vector, float));
+       METHOD(Container, moveItemAfter, void(entity, entity, entity));
+       METHOD(Container, removeItem, void(entity, entity));
+       METHOD(Container, setFocus, void(entity, entity));
+       METHOD(Container, saveFocus, void(entity));
+       METHOD(Container, setAlphaOf, void(entity, entity, float));
+       METHOD(Container, itemFromPoint, entity(entity, vector));
+       METHOD(Container, showNotify, void(entity));
+       METHOD(Container, hideNotify, void(entity));
+       METHOD(Container, preferredFocusedGrandChild, entity(entity));
+       ATTRIB(Container, focusable, float, 0)
+       ATTRIB(Container, firstChild, entity, NULL)
+       ATTRIB(Container, lastChild, entity, NULL)
+       ATTRIB(Container, focusedChild, entity, NULL)
+       ATTRIB(Container, savedFocus, entity, NULL)
+       ATTRIB(Container, shown, float, 0)
+
+       METHOD(Container, enterSubitem, void(entity, entity));
+       METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float));
+       METHOD(Container, leaveSubitem, void(entity));
+ENDCLASS(Container)
+
+.entity nextSibling;
+.entity prevSibling;
+.float resized;
+.vector Container_origin;
+.vector Container_size;
+.vector Container_fontscale;
+.float Container_alpha;
+.vector Container_save_shift;
+.vector Container_save_scale;
+.vector Container_save_fontscale;
+.float Container_save_alpha;
index fc14d9222b1a76f1bd8535333da563d1cc54626c..c4a78fa568802c305e763aedca9e96eb59bfb595 100644 (file)
@@ -1,76 +1,9 @@
-// Note: this class is called Dialog, but it can also handle a tab under the following conditions:
-// - isTabRoot is 0
-// - backgroundImage is the tab's background
-// - closable is 0
-// - rootDialog is 0
-// - title is ""
-// - marginTop is
-// - intendedHeight ends up to be the tab's actual height, or at least close
-// - titleFontSize is 0
-// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
-// To ensure the latter, you best create all tabs FIRST and insert the tabbed
-// control to your dialog THEN - with the right height
-//
-// a subclass may help with using this as a tab
-
-#ifndef ITEM_DIALOG_H
-       #define ITEM_DIALOG_H
-       #include "inputcontainer.qc"
-       CLASS(Dialog, InputContainer)
-               METHOD(Dialog, configureDialog, void(entity)); // no runtime configuration, all parameters are given in the code!
-               METHOD(Dialog, fill, void(entity));            // to be overridden by user to fill the dialog with controls
-               METHOD(Dialog, keyDown, float(entity, float, float, float));
-               METHOD(Dialog, close, void(entity));
-               METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector));
-
-               METHOD(Dialog, TD, void(entity, float, float, entity));
-               METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector));
-               METHOD(Dialog, TDempty, void(entity, float));
-               METHOD(Dialog, setFirstColumn, void(entity, float));
-               METHOD(Dialog, TR, void(entity));
-               METHOD(Dialog, gotoRC, void(entity, float, float));
-
-               ATTRIB(Dialog, isTabRoot, float, 1)
-               ATTRIB(Dialog, closeButton, entity, NULL)
-               ATTRIB(Dialog, intendedHeight, float, 0)
-               ATTRIB(Dialog, itemOrigin, vector, '0 0 0')
-               ATTRIB(Dialog, itemSize, vector, '0 0 0')
-               ATTRIB(Dialog, itemSpacing, vector, '0 0 0')
-               ATTRIB(Dialog, currentRow, float, 0)
-               ATTRIB(Dialog, currentColumn, float, 0)
-               ATTRIB(Dialog, firstColumn, float, 0)
-
-               // to be customized
-               ATTRIB(Dialog, closable, float, 1)
-               ATTRIB(Dialog, title, string, "Form1")  // ;)
-               ATTRIB(Dialog, color, vector, '1 0.5 1')
-               ATTRIB(Dialog, intendedWidth, float, 0)
-               ATTRIB(Dialog, rows, float, 3)
-               ATTRIB(Dialog, columns, float, 2)
-
-               ATTRIB(Dialog, marginTop, float, 0)     // pixels
-               ATTRIB(Dialog, marginBottom, float, 0)  // pixels
-               ATTRIB(Dialog, marginLeft, float, 0)    // pixels
-               ATTRIB(Dialog, marginRight, float, 0)   // pixels
-               ATTRIB(Dialog, columnSpacing, float, 0) // pixels
-               ATTRIB(Dialog, rowSpacing, float, 0)    // pixels
-               ATTRIB(Dialog, rowHeight, float, 0)     // pixels
-               ATTRIB(Dialog, titleHeight, float, 0)   // pixels
-               ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
-               ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
-               ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
-
-               ATTRIB(Dialog, requiresConnection, float, 0)  // set to true if the dialog requires a connection to be opened
-
-               ATTRIB(Dialog, backgroundImage, string, string_null)
-               ATTRIB(Dialog, borderLines, float, 1)
-               ATTRIB(Dialog, closeButtonImage, string, string_null)
-
-               ATTRIB(Dialog, frame, entity, NULL)
-       ENDCLASS(Dialog)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "dialog.qh"
+
+#include "borderimage.qh"
+#include "button.qh"
+#include "nexposee.qh"
+
        void Dialog_Close(entity button, entity me)
        {
                me.close(me);
                }
                return SUPER(Dialog).keyDown(me, key, ascii, shift);
        }
-#endif
diff --git a/qcsrc/menu/item/dialog.qh b/qcsrc/menu/item/dialog.qh
new file mode 100644 (file)
index 0000000..17343e7
--- /dev/null
@@ -0,0 +1,72 @@
+#pragma once
+
+// Note: this class is called Dialog, but it can also handle a tab under the following conditions:
+// - isTabRoot is 0
+// - backgroundImage is the tab's background
+// - closable is 0
+// - rootDialog is 0
+// - title is ""
+// - marginTop is
+// - intendedHeight ends up to be the tab's actual height, or at least close
+// - titleFontSize is 0
+// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
+// To ensure the latter, you best create all tabs FIRST and insert the tabbed
+// control to your dialog THEN - with the right height
+//
+// a subclass may help with using this as a tab
+
+#include "inputcontainer.qh"
+CLASS(Dialog, InputContainer)
+       METHOD(Dialog, configureDialog, void(entity)); // no runtime configuration, all parameters are given in the code!
+       METHOD(Dialog, fill, void(entity));            // to be overridden by user to fill the dialog with controls
+       METHOD(Dialog, keyDown, float(entity, float, float, float));
+       METHOD(Dialog, close, void(entity));
+       METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector));
+
+       METHOD(Dialog, TD, void(entity, float, float, entity));
+       METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector));
+       METHOD(Dialog, TDempty, void(entity, float));
+       METHOD(Dialog, setFirstColumn, void(entity, float));
+       METHOD(Dialog, TR, void(entity));
+       METHOD(Dialog, gotoRC, void(entity, float, float));
+
+       ATTRIB(Dialog, isTabRoot, float, 1)
+       ATTRIB(Dialog, closeButton, entity, NULL)
+       ATTRIB(Dialog, intendedHeight, float, 0)
+       ATTRIB(Dialog, itemOrigin, vector, '0 0 0')
+       ATTRIB(Dialog, itemSize, vector, '0 0 0')
+       ATTRIB(Dialog, itemSpacing, vector, '0 0 0')
+       ATTRIB(Dialog, currentRow, float, 0)
+       ATTRIB(Dialog, currentColumn, float, 0)
+       ATTRIB(Dialog, firstColumn, float, 0)
+
+       // to be customized
+       ATTRIB(Dialog, closable, float, 1)
+       ATTRIB(Dialog, title, string, "Form1")  // ;)
+       ATTRIB(Dialog, color, vector, '1 0.5 1')
+       ATTRIB(Dialog, intendedWidth, float, 0)
+       ATTRIB(Dialog, rows, float, 3)
+       ATTRIB(Dialog, columns, float, 2)
+
+       ATTRIB(Dialog, marginTop, float, 0)     // pixels
+       ATTRIB(Dialog, marginBottom, float, 0)  // pixels
+       ATTRIB(Dialog, marginLeft, float, 0)    // pixels
+       ATTRIB(Dialog, marginRight, float, 0)   // pixels
+       ATTRIB(Dialog, columnSpacing, float, 0) // pixels
+       ATTRIB(Dialog, rowSpacing, float, 0)    // pixels
+       ATTRIB(Dialog, rowHeight, float, 0)     // pixels
+       ATTRIB(Dialog, titleHeight, float, 0)   // pixels
+       ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
+       ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
+       ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
+
+       ATTRIB(Dialog, requiresConnection, float, 0)  // set to true if the dialog requires a connection to be opened
+
+       ATTRIB(Dialog, backgroundImage, string, string_null)
+       ATTRIB(Dialog, borderLines, float, 1)
+       ATTRIB(Dialog, closeButtonImage, string, string_null)
+
+       ATTRIB(Dialog, frame, entity, NULL)
+ENDCLASS(Dialog)
+
+void Dialog_Close(entity button, entity me);
index 2a28c78b1d89d94b1edfc50a03c1077a57c7b5ac..06ac91f025fcb53c80804f4dcb2f4ac0f56e2838 100644 (file)
@@ -1,34 +1,5 @@
-#ifndef ITEM_IMAGE_H
-       #define ITEM_IMAGE_H
-       #include "../item.qc"
-       CLASS(Image, Item)
-               METHOD(Image, configureImage, void(entity, string));
-               METHOD(Image, draw, void(entity));
-               METHOD(Image, toString, string(entity));
-               METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Image, updateAspect, void(entity));
-               METHOD(Image, initZoom, void(entity));
-               METHOD(Image, setZoom, void(entity, float, float));
-               METHOD(Image, drag_setStartPos, float(entity, vector));
-               METHOD(Image, drag, float(entity, vector));
-               ATTRIB(Image, src, string, string_null)
-               ATTRIB(Image, color, vector, '1 1 1')
-               ATTRIB(Image, forcedAspect, float, 0)        // special values: -1 keep image aspect ratio, -2 keep image size but bound to the containing box, -3 always keep image size
-               ATTRIB(Image, zoomBox, float, 0)             // used by forcedAspect -2 when the image is larger than the containing box
-               ATTRIB(Image, zoomFactor, float, 1)
-               ATTRIB(Image, zoomOffset, vector, '0.5 0.5 0')
-               ATTRIB(Image, zoomSnapToTheBox, float, 1)    // snap the zoomed in image to the box borders when zooming/dragging it
-               ATTRIB(Image, zoomTime, float, 0)
-               ATTRIB(Image, zoomLimitedByTheBox, float, 0) // forbids zoom if image would be larger than the containing box
-               ATTRIB(Image, zoomMax, float, 0)
-               ATTRIB(Image, start_zoomOffset, vector, '0 0 0')
-               ATTRIB(Image, start_coords, vector, '0 0 0')
-               ATTRIB(Image, imgOrigin, vector, '0 0 0')
-               ATTRIB(Image, imgSize, vector, '0 0 0')
-       ENDCLASS(Image)
-#endif
+#include "image.qh"
 
-#ifdef IMPLEMENTATION
        string Image_toString(entity me)
        {
                return me.src;
                SUPER(Image).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
                me.updateAspect(me);
        }
-#endif
diff --git a/qcsrc/menu/item/image.qh b/qcsrc/menu/item/image.qh
new file mode 100644 (file)
index 0000000..35bca59
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "../item.qh"
+CLASS(Image, Item)
+       METHOD(Image, configureImage, void(entity, string));
+       METHOD(Image, draw, void(entity));
+       METHOD(Image, toString, string(entity));
+       METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Image, updateAspect, void(entity));
+       METHOD(Image, initZoom, void(entity));
+       METHOD(Image, setZoom, void(entity, float, float));
+       METHOD(Image, drag_setStartPos, float(entity, vector));
+       METHOD(Image, drag, float(entity, vector));
+       ATTRIB(Image, src, string, string_null)
+       ATTRIB(Image, color, vector, '1 1 1')
+       ATTRIB(Image, forcedAspect, float, 0)        // special values: -1 keep image aspect ratio, -2 keep image size but bound to the containing box, -3 always keep image size
+       ATTRIB(Image, zoomBox, float, 0)             // used by forcedAspect -2 when the image is larger than the containing box
+       ATTRIB(Image, zoomFactor, float, 1)
+       ATTRIB(Image, zoomOffset, vector, '0.5 0.5 0')
+       ATTRIB(Image, zoomSnapToTheBox, float, 1)    // snap the zoomed in image to the box borders when zooming/dragging it
+       ATTRIB(Image, zoomTime, float, 0)
+       ATTRIB(Image, zoomLimitedByTheBox, float, 0) // forbids zoom if image would be larger than the containing box
+       ATTRIB(Image, zoomMax, float, 0)
+       ATTRIB(Image, start_zoomOffset, vector, '0 0 0')
+       ATTRIB(Image, start_coords, vector, '0 0 0')
+       ATTRIB(Image, imgOrigin, vector, '0 0 0')
+       ATTRIB(Image, imgSize, vector, '0 0 0')
+ENDCLASS(Image)
index 522801f818d92a37747560dc1da201fdc79b2574..6f7ed9f24309b7d7556d5d594144acf642198a83 100644 (file)
@@ -1,50 +1,8 @@
-#ifndef ITEM_INPUTBOX_H
-       #define ITEM_INPUTBOX_H
-       #include "label.qc"
-       CLASS(InputBox, Label)
-               METHOD(InputBox, configureInputBox, void(entity, string, float, float, string));
-               METHOD(InputBox, draw, void(entity));
-               METHOD(InputBox, setText, void(entity, string));
-               METHOD(InputBox, enterText, void(entity, string));
-               METHOD(InputBox, keyDown, float(entity, float, float, float));
-               METHOD(InputBox, mouseMove, float(entity, vector));
-               METHOD(InputBox, mouseRelease, float(entity, vector));
-               METHOD(InputBox, mousePress, float(entity, vector));
-               METHOD(InputBox, mouseDrag, float(entity, vector));
-               METHOD(InputBox, showNotify, void(entity));
-               METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector));
+#include "inputbox.qh"
 
-               ATTRIB(InputBox, src, string, string_null)
+.float cb_offset;
+.string cb_src;
 
-               ATTRIB(InputBox, cursorPos, float, 0)  // characters
-               ATTRIB(InputBox, scrollPos, float, 0)  // widths
-
-               ATTRIB(InputBox, focusable, float, 1)
-               ATTRIB(InputBox, allowFocusSound, float, 1)
-               ATTRIB(InputBox, disabled, float, 0)
-               ATTRIB(InputBox, lastChangeTime, float, 0)
-               ATTRIB(InputBox, dragScrollTimer, float, 0)
-               ATTRIB(InputBox, dragScrollPos, vector, '0 0 0')
-               ATTRIB(InputBox, pressed, float, 0)
-               ATTRIB(InputBox, editColorCodes, float, 1)
-               ATTRIB(InputBox, forbiddenCharacters, string, "")
-               ATTRIB(InputBox, color, vector, '1 1 1')
-               ATTRIB(InputBox, colorF, vector, '1 1 1')
-               ATTRIB(InputBox, maxLength, float, 255)  // if negative, it counts bytes, not chars
-               ATTRIB(InputBox, applyButton, entity, NULL)
-
-               ATTRIB(InputBox, enableClearButton, float, 1)
-               ATTRIB(InputBox, clearButton, entity, NULL)
-               ATTRIB(InputBox, cb_width, float, 0)
-               ATTRIB(InputBox, cb_pressed, float, 0)
-               ATTRIB(InputBox, cb_focused, float, 0)
-               ATTRIB(InputBox, cb_color, vector, '1 1 1')
-               ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
-               ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
-       ENDCLASS(InputBox)
-#endif
-
-#ifdef IMPLEMENTATION
        void InputBox_configureInputBox(entity me, string theText, float theCursorPos, float theFontSize, string gfx)
        {
                SUPER(InputBox).configureLabel(me, theText, theFontSize, 0.0);
        {
                me.focusable = !me.disabled;
        }
-#endif
diff --git a/qcsrc/menu/item/inputbox.qh b/qcsrc/menu/item/inputbox.qh
new file mode 100644 (file)
index 0000000..cfb576c
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once
+
+#include "label.qh"
+CLASS(InputBox, Label)
+       METHOD(InputBox, configureInputBox, void(entity, string, float, float, string));
+       METHOD(InputBox, draw, void(entity));
+       METHOD(InputBox, setText, void(entity, string));
+       METHOD(InputBox, enterText, void(entity, string));
+       METHOD(InputBox, keyDown, float(entity, float, float, float));
+       METHOD(InputBox, mouseMove, float(entity, vector));
+       METHOD(InputBox, mouseRelease, float(entity, vector));
+       METHOD(InputBox, mousePress, float(entity, vector));
+       METHOD(InputBox, mouseDrag, float(entity, vector));
+       METHOD(InputBox, showNotify, void(entity));
+       METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector));
+
+       ATTRIB(InputBox, src, string, string_null)
+
+       ATTRIB(InputBox, cursorPos, float, 0)  // characters
+       ATTRIB(InputBox, scrollPos, float, 0)  // widths
+
+       ATTRIB(InputBox, focusable, float, 1)
+       ATTRIB(InputBox, allowFocusSound, float, 1)
+       ATTRIB(InputBox, disabled, float, 0)
+       ATTRIB(InputBox, lastChangeTime, float, 0)
+       ATTRIB(InputBox, dragScrollTimer, float, 0)
+       ATTRIB(InputBox, dragScrollPos, vector, '0 0 0')
+       ATTRIB(InputBox, pressed, float, 0)
+       ATTRIB(InputBox, editColorCodes, float, 1)
+       ATTRIB(InputBox, forbiddenCharacters, string, "")
+       ATTRIB(InputBox, color, vector, '1 1 1')
+       ATTRIB(InputBox, colorF, vector, '1 1 1')
+       ATTRIB(InputBox, maxLength, float, 255)  // if negative, it counts bytes, not chars
+       ATTRIB(InputBox, applyButton, entity, NULL)
+
+       ATTRIB(InputBox, enableClearButton, float, 1)
+       ATTRIB(InputBox, clearButton, entity, NULL)
+       ATTRIB(InputBox, cb_width, float, 0)
+       ATTRIB(InputBox, cb_pressed, float, 0)
+       ATTRIB(InputBox, cb_focused, float, 0)
+       ATTRIB(InputBox, cb_color, vector, '1 1 1')
+       ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
+       ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
+ENDCLASS(InputBox)
index 45f60854f9499308bb9dc8af1694fedc1a794195..3840721e35f9a032ab3f008471bb53e22a806802 100644 (file)
@@ -1,22 +1,5 @@
-#ifndef ITEM_INPUTCONTAINER_H
-       #define ITEM_INPUTCONTAINER_H
-       #include "container.qc"
-       CLASS(InputContainer, Container)
-               METHOD(InputContainer, keyDown, float(entity, float, float, float));
-               METHOD(InputContainer, mouseMove, float(entity, vector));
-               METHOD(InputContainer, mousePress, float(entity, vector));
-               METHOD(InputContainer, mouseRelease, float(entity, vector));
-               METHOD(InputContainer, mouseDrag, float(entity, vector));
-               METHOD(InputContainer, focusLeave, void(entity));
-               METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector));
+#include "inputcontainer.qh"
 
-               METHOD(InputContainer, _changeFocusXY, bool(entity this, vector pos));
-               ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
-               ATTRIB(InputContainer, isTabRoot, float, 0)
-       ENDCLASS(InputContainer)
-#endif
-
-#ifdef IMPLEMENTATION
        void InputContainer_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
        {
                SUPER(InputContainer).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
                if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
                return 0;
        }
-#endif
diff --git a/qcsrc/menu/item/inputcontainer.qh b/qcsrc/menu/item/inputcontainer.qh
new file mode 100644 (file)
index 0000000..5d84189
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "container.qh"
+CLASS(InputContainer, Container)
+       METHOD(InputContainer, keyDown, float(entity, float, float, float));
+       METHOD(InputContainer, mouseMove, float(entity, vector));
+       METHOD(InputContainer, mousePress, float(entity, vector));
+       METHOD(InputContainer, mouseRelease, float(entity, vector));
+       METHOD(InputContainer, mouseDrag, float(entity, vector));
+       METHOD(InputContainer, focusLeave, void(entity));
+       METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector));
+
+       METHOD(InputContainer, _changeFocusXY, bool(entity this, vector pos));
+       ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
+       ATTRIB(InputContainer, isTabRoot, float, 0)
+ENDCLASS(InputContainer)
index 6d9b9cda1f4953bd7bebf68d44a8f22286a25923..ca9ec00b09dd0f90618c935575e47e9108b239b7 100644 (file)
@@ -1,40 +1,5 @@
-#ifndef ITEM_LABEL_H
-       #define ITEM_LABEL_H
-       #include "../item.qc"
-       CLASS(Label, Item)
-               METHOD(Label, configureLabel, void(entity, string, float, float));
-               METHOD(Label, draw, void(entity));
-               METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Label, setText, void(entity, string));
-               METHOD(Label, toString, string(entity));
-               METHOD(Label, recalcPositionWithText, void(entity, string));
-               ATTRIB(Label, isBold, float, 0)
-               ATTRIB(Label, text, string, string_null)
-               ATTRIB(Label, currentText, string, string_null)
-               ATTRIB(Label, fontSize, float, 8)
-               ATTRIB(Label, align, float, 0.5)
-               ATTRIB(Label, allowCut, float, 0)
-               ATTRIB(Label, allowColors, float, 0)
-               ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
-               ATTRIB(Label, keepspaceRight, float, 0)
-               ATTRIB(Label, marginLeft, float, 0)    // alternate way to specify keepspace* (in characters from the font)
-               ATTRIB(Label, marginRight, float, 0)
-               ATTRIB(Label, realFontSize, vector, '0 0 0')
-               ATTRIB(Label, realOrigin, vector, '0 0 0')
-               ATTRIB(Label, alpha, float, 0.7)
-               ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
-               ATTRIB(Label, disabled, float, 0)
-               ATTRIB(Label, disabledAlpha, float, 0.3)
-               ATTRIB(Label, textEntity, entity, NULL)
-               ATTRIB(Label, allowWrap, float, 0)
-               ATTRIB(Label, recalcPos, float, 0)
-               ATTRIB(Label, condenseFactor, float, 1)
-               ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
-               ATTRIB(Label, overrideCondenseFactor, float, 0)
-       ENDCLASS(Label)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "label.qh"
+
        string Label_toString(entity me)
        {
                return me.text;
 
                SUPER(Label).draw(me);
        }
-#endif
diff --git a/qcsrc/menu/item/label.qh b/qcsrc/menu/item/label.qh
new file mode 100644 (file)
index 0000000..428958c
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "../item.qh"
+CLASS(Label, Item)
+       METHOD(Label, configureLabel, void(entity, string, float, float));
+       METHOD(Label, draw, void(entity));
+       METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Label, setText, void(entity, string));
+       METHOD(Label, toString, string(entity));
+       METHOD(Label, recalcPositionWithText, void(entity, string));
+       ATTRIB(Label, isBold, float, 0)
+       ATTRIB(Label, text, string, string_null)
+       ATTRIB(Label, currentText, string, string_null)
+       ATTRIB(Label, fontSize, float, 8)
+       ATTRIB(Label, align, float, 0.5)
+       ATTRIB(Label, allowCut, float, 0)
+       ATTRIB(Label, allowColors, float, 0)
+       ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
+       ATTRIB(Label, keepspaceRight, float, 0)
+       ATTRIB(Label, marginLeft, float, 0)    // alternate way to specify keepspace* (in characters from the font)
+       ATTRIB(Label, marginRight, float, 0)
+       ATTRIB(Label, realFontSize, vector, '0 0 0')
+       ATTRIB(Label, realOrigin, vector, '0 0 0')
+       ATTRIB(Label, alpha, float, 0.7)
+       ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
+       ATTRIB(Label, disabled, float, 0)
+       ATTRIB(Label, disabledAlpha, float, 0.3)
+       ATTRIB(Label, textEntity, entity, NULL)
+       ATTRIB(Label, allowWrap, float, 0)
+       ATTRIB(Label, recalcPos, float, 0)
+       ATTRIB(Label, condenseFactor, float, 1)
+       ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
+       ATTRIB(Label, overrideCondenseFactor, float, 0)
+ENDCLASS(Label)
index d6ea7d85958d7f994d1231e5ccd34cd5506921ee..d9d63ab8c5abe2a6958b8c463fecdd985313ff4d 100644 (file)
@@ -1,92 +1,5 @@
-#ifndef ITEM_LISTBOX_H
-       #define ITEM_LISTBOX_H
-       #include "../item.qc"
-       CLASS(ListBox, Item)
-               METHOD(ListBox, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(ListBox, configureListBox, void(entity, float, float));
-               METHOD(ListBox, draw, void(entity));
-               METHOD(ListBox, keyDown, float(entity, float, float, float));
-               METHOD(ListBox, mouseMove, float(entity, vector));
-               METHOD(ListBox, mousePress, float(entity, vector));
-               METHOD(ListBox, mouseDrag, float(entity, vector));
-               METHOD(ListBox, mouseRelease, float(entity, vector));
-               METHOD(ListBox, focusLeave, void(entity));
-               ATTRIB(ListBox, focusable, float, 1)
-               ATTRIB(ListBox, focusedItem, int, -1)
-               ATTRIB(ListBox, focusedItemAlpha, float, 0.3)
-               METHOD(ListBox, setFocusedItem, void(entity, int));
-               ATTRIB(ListBox, mouseMoveOffset, float, -1)  // let know where the cursor is when the list scrolls without moving the cursor
-               ATTRIB(ListBox, allowFocusSound, float, 1)
-               ATTRIB(ListBox, selectedItem, int, 0)
-               ATTRIB(ListBox, size, vector, '0 0 0')
-               ATTRIB(ListBox, origin, vector, '0 0 0')
-               ATTRIB(ListBox, scrollPos, float, 0)  // measured in window heights, fixed when needed
-               ATTRIB(ListBox, scrollPosTarget, float, 0)
-               METHOD(ListBox, isScrolling, bool(entity));
-               ATTRIB(ListBox, needScrollToItem, float, -1)
-               METHOD(ListBox, scrollToItem, void(entity, int));
-               ATTRIB(ListBox, previousValue, float, 0)
-               ATTRIB(ListBox, pressed, float, 0)  // 0 = normal, 1 = scrollbar dragging, 2 = item dragging, 3 = released
-               ATTRIB(ListBox, pressOffset, float, 0)
+#include "listbox.qh"
 
-               METHOD(ListBox, updateControlTopBottom, void(entity));
-               ATTRIB(ListBox, controlTop, float, 0)
-               ATTRIB(ListBox, controlBottom, float, 0)
-               ATTRIB(ListBox, controlWidth, float, 0)
-               ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
-               ATTRIB(ListBox, selectionDoesntMatter, bool, false) // improves scrolling by keys for lists that don't need to show an active selection
-
-               ATTRIB(ListBox, src, string, string_null)           // scrollbar
-               ATTRIB(ListBox, color, vector, '1 1 1')
-               ATTRIB(ListBox, color2, vector, '1 1 1')
-               ATTRIB(ListBox, colorC, vector, '1 1 1')
-               ATTRIB(ListBox, colorF, vector, '1 1 1')
-               ATTRIB(ListBox, tolerance, vector, '0 0 0') // drag tolerance
-               ATTRIB(ListBox, scrollbarWidth, float, 0)   // pixels
-               ATTRIB(ListBox, nItems, float, 42) // FIXME: why?!?
-               ATTRIB(ListBox, itemHeight, float, 0)
-               ATTRIB(ListBox, colorBG, vector, '0 0 0')
-               ATTRIB(ListBox, alphaBG, float, 0)
-
-               ATTRIB(ListBox, lastClickedItem, float, -1)
-               ATTRIB(ListBox, lastClickedTime, float, 0)
-
-               METHOD(ListBox, drawListBoxItem, void(entity, int, vector, bool, bool)); // item number, width/height, isSelected, isFocused
-               METHOD(ListBox, clickListBoxItem, void(entity, float, vector));          // item number, relative clickpos
-               METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector));    // item number, relative clickpos
-               METHOD(ListBox, setSelected, void(entity, float));
-               METHOD(ListBox, focusedItemChangeNotify, void(entity));
-
-               METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float));
-               METHOD(ListBox, getFirstFullyVisibleItemAtScrollPos, float(entity, float));
-
-               // NOTE: override these four methods if you want variable sized list items
-               METHOD(ListBox, getTotalHeight, float(entity));
-               METHOD(ListBox, getItemAtPos, float(entity, float));
-               METHOD(ListBox, getItemStart, float(entity, float));
-               METHOD(ListBox, getItemHeight, float(entity, float));
-               // NOTE: if getItemAt* are overridden, it may make sense to cache the
-               // start and height of the last item returned by getItemAtPos and fast
-               // track returning their properties for getItemStart and getItemHeight.
-               // The "hot" code path calls getItemAtPos first, then will query
-               // getItemStart and getItemHeight on it soon.
-               // When overriding, the following consistency rules must hold:
-               // getTotalHeight() == SUM(getItemHeight(i), i, 0, me.nItems-1)
-               // getItemStart(i+1) == getItemStart(i) + getItemHeight(i)
-               //   for 0 <= i < me.nItems-1
-               // getItemStart(0) == 0
-               // getItemStart(getItemAtPos(p)) <= p
-               //   if p >= 0
-               // getItemAtPos(p) == 0
-               //   if p < 0
-               // getItemStart(getItemAtPos(p)) + getItemHeight(getItemAtPos(p)) > p
-               //   if p < getTotalHeigt()
-               // getItemAtPos(p) == me.nItems - 1
-               //   if p >= getTotalHeight()
-       ENDCLASS(ListBox)
-#endif
-
-#ifdef IMPLEMENTATION
        bool ListBox_isScrolling(entity me)
        {
                return me.scrollPos != me.scrollPosTarget;
        {
                draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (isSelected ? '0 1 0' : '1 1 1'), 1, 0);
        }
-#endif
diff --git a/qcsrc/menu/item/listbox.qh b/qcsrc/menu/item/listbox.qh
new file mode 100644 (file)
index 0000000..461125e
--- /dev/null
@@ -0,0 +1,87 @@
+#pragma once
+
+#include "../item.qh"
+CLASS(ListBox, Item)
+       METHOD(ListBox, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(ListBox, configureListBox, void(entity, float, float));
+       METHOD(ListBox, draw, void(entity));
+       METHOD(ListBox, keyDown, float(entity, float, float, float));
+       METHOD(ListBox, mouseMove, float(entity, vector));
+       METHOD(ListBox, mousePress, float(entity, vector));
+       METHOD(ListBox, mouseDrag, float(entity, vector));
+       METHOD(ListBox, mouseRelease, float(entity, vector));
+       METHOD(ListBox, focusLeave, void(entity));
+       ATTRIB(ListBox, focusable, float, 1)
+       ATTRIB(ListBox, focusedItem, int, -1)
+       ATTRIB(ListBox, focusedItemAlpha, float, 0.3)
+       METHOD(ListBox, setFocusedItem, void(entity, int));
+       ATTRIB(ListBox, mouseMoveOffset, float, -1)  // let know where the cursor is when the list scrolls without moving the cursor
+       ATTRIB(ListBox, allowFocusSound, float, 1)
+       ATTRIB(ListBox, selectedItem, int, 0)
+       ATTRIB(ListBox, size, vector, '0 0 0')
+       ATTRIB(ListBox, origin, vector, '0 0 0')
+       ATTRIB(ListBox, scrollPos, float, 0)  // measured in window heights, fixed when needed
+       ATTRIB(ListBox, scrollPosTarget, float, 0)
+       METHOD(ListBox, isScrolling, bool(entity));
+       ATTRIB(ListBox, needScrollToItem, float, -1)
+       METHOD(ListBox, scrollToItem, void(entity, int));
+       ATTRIB(ListBox, previousValue, float, 0)
+       ATTRIB(ListBox, pressed, float, 0)  // 0 = normal, 1 = scrollbar dragging, 2 = item dragging, 3 = released
+       ATTRIB(ListBox, pressOffset, float, 0)
+
+       METHOD(ListBox, updateControlTopBottom, void(entity));
+       ATTRIB(ListBox, controlTop, float, 0)
+       ATTRIB(ListBox, controlBottom, float, 0)
+       ATTRIB(ListBox, controlWidth, float, 0)
+       ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
+       ATTRIB(ListBox, selectionDoesntMatter, bool, false) // improves scrolling by keys for lists that don't need to show an active selection
+
+       ATTRIB(ListBox, src, string, string_null)           // scrollbar
+       ATTRIB(ListBox, color, vector, '1 1 1')
+       ATTRIB(ListBox, color2, vector, '1 1 1')
+       ATTRIB(ListBox, colorC, vector, '1 1 1')
+       ATTRIB(ListBox, colorF, vector, '1 1 1')
+       ATTRIB(ListBox, tolerance, vector, '0 0 0') // drag tolerance
+       ATTRIB(ListBox, scrollbarWidth, float, 0)   // pixels
+       ATTRIB(ListBox, nItems, float, 42)          // FIXME: why?!?
+       ATTRIB(ListBox, itemHeight, float, 0)
+    ATTRIB(ListBox, itemAbsSize, vector, '0 0 0')
+       ATTRIB(ListBox, colorBG, vector, '0 0 0')
+       ATTRIB(ListBox, alphaBG, float, 0)
+
+       ATTRIB(ListBox, lastClickedItem, float, -1)
+       ATTRIB(ListBox, lastClickedTime, float, 0)
+
+       METHOD(ListBox, drawListBoxItem, void(entity, int, vector, bool, bool)); // item number, width/height, isSelected, isFocused
+       METHOD(ListBox, clickListBoxItem, void(entity, float, vector));          // item number, relative clickpos
+       METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector));    // item number, relative clickpos
+       METHOD(ListBox, setSelected, void(entity, float));
+       METHOD(ListBox, focusedItemChangeNotify, void(entity));
+
+       METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float));
+       METHOD(ListBox, getFirstFullyVisibleItemAtScrollPos, float(entity, float));
+
+       // NOTE: override these four methods if you want variable sized list items
+       METHOD(ListBox, getTotalHeight, float(entity));
+       METHOD(ListBox, getItemAtPos, float(entity, float));
+       METHOD(ListBox, getItemStart, float(entity, float));
+       METHOD(ListBox, getItemHeight, float(entity, float));
+       // NOTE: if getItemAt* are overridden, it may make sense to cache the
+       // start and height of the last item returned by getItemAtPos and fast
+       // track returning their properties for getItemStart and getItemHeight.
+       // The "hot" code path calls getItemAtPos first, then will query
+       // getItemStart and getItemHeight on it soon.
+       // When overriding, the following consistency rules must hold:
+       // getTotalHeight() == SUM(getItemHeight(i), i, 0, me.nItems-1)
+       // getItemStart(i+1) == getItemStart(i) + getItemHeight(i)
+       //   for 0 <= i < me.nItems-1
+       // getItemStart(0) == 0
+       // getItemStart(getItemAtPos(p)) <= p
+       //   if p >= 0
+       // getItemAtPos(p) == 0
+       //   if p < 0
+       // getItemStart(getItemAtPos(p)) + getItemHeight(getItemAtPos(p)) > p
+       //   if p < getTotalHeigt()
+       // getItemAtPos(p) == me.nItems - 1
+       //   if p >= getTotalHeight()
+ENDCLASS(ListBox)
index ed02a0cef3249260c3a8d015cd39fc02bba9cada..660431d60dd5cdd5a90a99cbc8c93b70cb0bae6d 100644 (file)
@@ -1,55 +1,6 @@
-#ifndef ITEM_MODALCONTROLLER_H
-       #define ITEM_MODALCONTROLLER_H
-       #include "container.qc"
-       CLASS(ModalController, Container)
-               METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(ModalController, draw, void(entity));
-               METHOD(ModalController, showChild, void(entity, entity, vector, vector, float));
-               METHOD(ModalController, hideChild, void(entity, entity, float));
-               METHOD(ModalController, hideAll, void(entity, float));
-               METHOD(ModalController, addItem, void(entity, entity, vector, vector, float));
-               METHOD(ModalController, addTab, void(entity, entity, entity));
+#include "modalcontroller.qh"
 
-               METHOD(ModalController, initializeDialog, void(entity, entity));
-
-               METHOD(ModalController, switchState, void(entity, entity, float, float));
-               ATTRIB(ModalController, origin, vector, '0 0 0')
-               ATTRIB(ModalController, size, vector, '0 0 0')
-               ATTRIB(ModalController, previousButton, entity, NULL)
-               ATTRIB(ModalController, fadedAlpha, float, 0.3)
-       ENDCLASS(ModalController)
-
-       .entity tabSelectingButton;
-       .vector origin;
-       .vector size;
-       void TabButton_Click(entity button, entity tab);         // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
-       void DialogOpenButton_Click(entity button, entity tab);  // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
-       void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
-       void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
-#endif
-
-#ifdef IMPLEMENTATION
-
-// modal dialog controller
-// handles a stack of dialog elements
-// each element can have one of the following states:
-//   0: hidden (fading out)
-//   1: visible (zooming in)
-//   2: greyed out (inactive)
-// While an animation is running, no item has focus. When an animation is done,
-// the topmost item gets focus.
-// The items are assumed to be added in overlapping order, that is, the lowest
-// window must get added first.
-//
-// Possible uses:
-// - to control a modal dialog:
-//   - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
-//   - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
-//   - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
-// - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
-// - as a tabbed dialog control:
-//   - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
-//   - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
+#include "button.qh"
 
        .vector ModalController_initialSize;
        .vector ModalController_initialOrigin;
                        }
                }  // just alpha fade out (factor increases and decreases alpha)
        }
-#endif
diff --git a/qcsrc/menu/item/modalcontroller.qh b/qcsrc/menu/item/modalcontroller.qh
new file mode 100644 (file)
index 0000000..27faaa8
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+
+// modal dialog controller
+// handles a stack of dialog elements
+// each element can have one of the following states:
+//   0: hidden (fading out)
+//   1: visible (zooming in)
+//   2: greyed out (inactive)
+// While an animation is running, no item has focus. When an animation is done,
+// the topmost item gets focus.
+// The items are assumed to be added in overlapping order, that is, the lowest
+// window must get added first.
+//
+// Possible uses:
+// - to control a modal dialog:
+//   - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
+//   - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
+//   - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
+// - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
+// - as a tabbed dialog control:
+//   - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
+//   - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
+
+#include "container.qh"
+CLASS(ModalController, Container)
+       METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(ModalController, draw, void(entity));
+       METHOD(ModalController, showChild, void(entity, entity, vector, vector, float));
+       METHOD(ModalController, hideChild, void(entity, entity, float));
+       METHOD(ModalController, hideAll, void(entity, float));
+       METHOD(ModalController, addItem, void(entity, entity, vector, vector, float));
+       METHOD(ModalController, addTab, void(entity, entity, entity));
+
+       METHOD(ModalController, initializeDialog, void(entity, entity));
+
+       METHOD(ModalController, switchState, void(entity, entity, float, float));
+       ATTRIB(ModalController, origin, vector, '0 0 0')
+       ATTRIB(ModalController, size, vector, '0 0 0')
+       ATTRIB(ModalController, previousButton, entity, NULL)
+       ATTRIB(ModalController, fadedAlpha, float, 0.3)
+ENDCLASS(ModalController)
+
+.float ModalController_state;
+.entity tabSelectingButton;
+.vector origin;
+.vector size;
+void TabButton_Click(entity button, entity tab);         // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
+void DialogOpenButton_Click(entity button, entity tab);  // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
+void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
+void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
index e35909493c635e08918fbe98b7bc0dba6955b42d..c0f18cf859476eff528f0f9a9ebb10a1eee3acdd 100644 (file)
@@ -1,53 +1,5 @@
-#ifndef ITEM_NEXPOSEE_H
-       #define ITEM_NEXPOSEE_H
-       #include "container.qc"
-       CLASS(Nexposee, Container)
-               METHOD(Nexposee, draw, void(entity));
-               METHOD(Nexposee, keyDown, float(entity, float, float, float));
-               METHOD(Nexposee, keyUp, float(entity, float, float, float));
-               METHOD(Nexposee, mousePress, float(entity, vector));
-               METHOD(Nexposee, mouseMove, float(entity, vector));
-               METHOD(Nexposee, mouseRelease, float(entity, vector));
-               METHOD(Nexposee, mouseDrag, float(entity, vector));
-               METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Nexposee, focusEnter, void(entity));
-               METHOD(Nexposee, close, void(entity));
+#include "nexposee.qh"
 
-               ATTRIB(Nexposee, animationState, float, -1)
-               ATTRIB(Nexposee, animationFactor, float, 0)
-               ATTRIB(Nexposee, selectedChild, entity, NULL)
-               ATTRIB(Nexposee, mouseFocusedChild, entity, NULL)
-               METHOD(Nexposee, addItem, void(entity, entity, vector, vector, float));
-               METHOD(Nexposee, calc, void(entity));
-               METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float));
-               ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
-               METHOD(Nexposee, pullNexposee, void(entity, entity, vector));
-       ENDCLASS(Nexposee)
-
-       void ExposeeCloseButton_Click(entity button, entity other);  // un-exposees the current state
-
-// animation states:
-//   0 = thumbnails seen
-//   1 = zooming in
-//   2 = zoomed in
-//   3 = zooming out
-// animation factor: 0 = minimum theSize, 1 = maximum theSize
-       .vector Nexposee_initialSize;
-       .vector Nexposee_initialFontScale;
-       .vector Nexposee_initialOrigin;
-       .float Nexposee_initialAlpha;
-
-       .vector Nexposee_smallSize;
-       .vector Nexposee_smallOrigin;
-       .float Nexposee_smallAlpha;
-       .float Nexposee_mediumAlpha;
-       .vector Nexposee_scaleCenter;
-       .vector Nexposee_align;
-       .float Nexposee_animationFactor;
-
-#endif
-
-#ifdef IMPLEMENTATION
        void Nexposee_close(entity me)
        {
                // user must override this
                        }
 
                        break;
-                       : have_overlap
+LABEL(have_overlap)
                }
 
                scale *= 0.95;
        {
                other.Nexposee_align = theAlign;
        }
-#endif
diff --git a/qcsrc/menu/item/nexposee.qh b/qcsrc/menu/item/nexposee.qh
new file mode 100644 (file)
index 0000000..2d8e3ec
--- /dev/null
@@ -0,0 +1,46 @@
+#pragma once
+
+#include "container.qh"
+CLASS(Nexposee, Container)
+       METHOD(Nexposee, draw, void(entity));
+       METHOD(Nexposee, keyDown, float(entity, float, float, float));
+       METHOD(Nexposee, keyUp, float(entity, float, float, float));
+       METHOD(Nexposee, mousePress, float(entity, vector));
+       METHOD(Nexposee, mouseMove, float(entity, vector));
+       METHOD(Nexposee, mouseRelease, float(entity, vector));
+       METHOD(Nexposee, mouseDrag, float(entity, vector));
+       METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Nexposee, focusEnter, void(entity));
+       METHOD(Nexposee, close, void(entity));
+
+       ATTRIB(Nexposee, animationState, float, -1)
+       ATTRIB(Nexposee, animationFactor, float, 0)
+       ATTRIB(Nexposee, selectedChild, entity, NULL)
+       ATTRIB(Nexposee, mouseFocusedChild, entity, NULL)
+       METHOD(Nexposee, addItem, void(entity, entity, vector, vector, float));
+       METHOD(Nexposee, calc, void(entity));
+       METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float));
+       ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
+       METHOD(Nexposee, pullNexposee, void(entity, entity, vector));
+ENDCLASS(Nexposee)
+
+void ExposeeCloseButton_Click(entity button, entity other);  // un-exposees the current state
+
+// animation states:
+//   0 = thumbnails seen
+//   1 = zooming in
+//   2 = zoomed in
+//   3 = zooming out
+// animation factor: 0 = minimum theSize, 1 = maximum theSize
+.vector Nexposee_initialSize;
+.vector Nexposee_initialFontScale;
+.vector Nexposee_initialOrigin;
+.float Nexposee_initialAlpha;
+
+.vector Nexposee_smallSize;
+.vector Nexposee_smallOrigin;
+.float Nexposee_smallAlpha;
+.float Nexposee_mediumAlpha;
+.vector Nexposee_scaleCenter;
+.vector Nexposee_align;
+.float Nexposee_animationFactor;
index dac17b1415643f8c522cd100a668ad719f78c5aa..00dcb680ad0d7e652000719d8312e02eacdaab95 100644 (file)
@@ -1,17 +1,5 @@
-#ifndef ITEM_RADIOBUTTON_H
-       #define ITEM_RADIOBUTTON_H
-       #include "checkbox.qc"
-       void RadioButton_Click(entity me, entity other);
-       CLASS(RadioButton, CheckBox)
-               METHOD(RadioButton, configureRadioButton, void(entity, string, float, string, float, float));
-               ATTRIB(RadioButton, checked, float, 0)
-               ATTRIB(RadioButton, group, float, 0)
-               ATTRIB(RadioButton, allowDeselect, float, 0)
-               ATTRIB(RadioButton, onClick, void(entity, entity), RadioButton_Click)
-       ENDCLASS(RadioButton)
-#endif
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
        void RadioButton_configureRadioButton(entity me, string txt, float sz, string gfx, float theGroup, float doAllowDeselect)
        {
                me.configureCheckBox(me, txt, sz, gfx);
@@ -34,4 +22,3 @@
                        me.setChecked(me, 1);
                }
        }
-#endif
diff --git a/qcsrc/menu/item/radiobutton.qh b/qcsrc/menu/item/radiobutton.qh
new file mode 100644 (file)
index 0000000..53aa7ff
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "checkbox.qh"
+void RadioButton_Click(entity me, entity other);
+CLASS(RadioButton, CheckBox)
+       METHOD(RadioButton, configureRadioButton, void(entity, string, float, string, float, float));
+       ATTRIB(RadioButton, checked, float, 0)
+       ATTRIB(RadioButton, group, float, 0)
+       ATTRIB(RadioButton, allowDeselect, float, 0)
+       ATTRIB(RadioButton, onClick, void(entity, entity), RadioButton_Click)
+ENDCLASS(RadioButton)
index dcfe68a75ff718c929c0babfcbc0a38c79503f48..2e89bb68ee21e7356dcc906653a73c9a35b385c1 100644 (file)
@@ -1,56 +1,10 @@
-// Note:
-//   to use this, you FIRST call configureSliderVisuals, then configureSliderValues
-#ifndef ITEM_SLIDER_H
-       #define ITEM_SLIDER_H
-       #include "label.qc"
-       CLASS(Slider, Label)
-               METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Slider, configureSliderVisuals, void(entity, float, float, float, string));
-               METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float));
-               METHOD(Slider, draw, void(entity));
-               METHOD(Slider, keyDown, float(entity, float, float, float));
-               METHOD(Slider, keyUp, float(entity, float, float, float));
-               METHOD(Slider, mousePress, float(entity, vector));
-               METHOD(Slider, mouseDrag, float(entity, vector));
-               METHOD(Slider, mouseRelease, float(entity, vector));
-               METHOD(Slider, valueToText, string(entity, float));
-               METHOD(Slider, toString, string(entity));
-               METHOD(Slider, setValue_allowAnim, void(entity, float, bool));
-               METHOD(Slider, setValue_noAnim, void(entity, float));
-               METHOD(Slider, setValue, void(entity, float));
-               METHOD(Slider, setSliderValue, void(entity, float));
-               METHOD(Slider, showNotify, void(entity));
-               ATTRIB(Slider, src, string, string_null)
-               ATTRIB(Slider, focusable, float, 1)
-               ATTRIB(Slider, allowFocusSound, float, 1)
-               ATTRIB(Slider, value, float, 0)
-               ATTRIB(Slider, animated, float, 1)
-               ATTRIB(Slider, sliderValue, float, 0)
-               ATTRIB(Slider, sliderAnim, entity, NULL)
-               ATTRIB(Slider, valueMin, float, 0)
-               ATTRIB(Slider, valueMax, float, 0)
-               ATTRIB(Slider, valueStep, float, 0)
-               ATTRIB(Slider, valueDigits, float, 0)
-               ATTRIB(Slider, valueKeyStep, float, 0)
-               ATTRIB(Slider, valuePageStep, float, 0)
-               ATTRIB(Slider, valueDisplayMultiplier, float, 1.0)
-               ATTRIB(Slider, textSpace, float, 0)
-               ATTRIB(Slider, controlWidth, float, 0)
-               ATTRIB(Slider, pressed, float, 0)
-               ATTRIB(Slider, pressOffset, float, 0)
-               ATTRIB(Slider, previousValue, float, 0)
-               ATTRIB(Slider, tolerance, vector, '0 0 0')
-               ATTRIB(Slider, disabled, float, 0)
-               ATTRIB(Slider, color, vector, '1 1 1')
-               ATTRIB(Slider, color2, vector, '1 1 1')
-               ATTRIB(Slider, colorD, vector, '1 1 1')
-               ATTRIB(Slider, colorC, vector, '1 1 1')
-               ATTRIB(Slider, colorF, vector, '1 1 1')
-               ATTRIB(Slider, disabledAlpha, float, 0.3)
-       ENDCLASS(Slider)
-#endif
+#include "slider.qh"
+
+#include "../anim/easing.qh"
+#include "../anim/animhost.qh"
+
+.entity applyButton;
 
-#ifdef IMPLEMENTATION
        void Slider_setValue_allowAnim(entity me, float val, bool allowAnim)
        {
                if (allowAnim && me.animated)
                SUPER(Slider).draw(me);
                me.text = string_null;  // TEMPSTRING!
        }
-#endif
diff --git a/qcsrc/menu/item/slider.qh b/qcsrc/menu/item/slider.qh
new file mode 100644 (file)
index 0000000..f5e8fd4
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+
+// Note:
+//   to use this, you FIRST call configureSliderVisuals, then configureSliderValues
+#include "label.qh"
+CLASS(Slider, Label)
+       METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Slider, configureSliderVisuals, void(entity, float, float, float, string));
+       METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float));
+       METHOD(Slider, draw, void(entity));
+       METHOD(Slider, keyDown, float(entity, float, float, float));
+       METHOD(Slider, keyUp, float(entity, float, float, float));
+       METHOD(Slider, mousePress, float(entity, vector));
+       METHOD(Slider, mouseDrag, float(entity, vector));
+       METHOD(Slider, mouseRelease, float(entity, vector));
+       METHOD(Slider, valueToText, string(entity, float));
+       METHOD(Slider, toString, string(entity));
+       METHOD(Slider, setValue_allowAnim, void(entity, float, bool));
+       METHOD(Slider, setValue_noAnim, void(entity, float));
+       METHOD(Slider, setValue, void(entity, float));
+       METHOD(Slider, setSliderValue, void(entity, float));
+       METHOD(Slider, showNotify, void(entity));
+       ATTRIB(Slider, src, string, string_null)
+       ATTRIB(Slider, focusable, float, 1)
+       ATTRIB(Slider, allowFocusSound, float, 1)
+       ATTRIB(Slider, value, float, 0)
+       ATTRIB(Slider, animated, float, 1)
+       ATTRIB(Slider, sliderValue, float, 0)
+       ATTRIB(Slider, sliderAnim, entity, NULL)
+       ATTRIB(Slider, valueMin, float, 0)
+       ATTRIB(Slider, valueMax, float, 0)
+       ATTRIB(Slider, valueStep, float, 0)
+       ATTRIB(Slider, valueDigits, float, 0)
+       ATTRIB(Slider, valueKeyStep, float, 0)
+       ATTRIB(Slider, valuePageStep, float, 0)
+       ATTRIB(Slider, valueDisplayMultiplier, float, 1.0)
+       ATTRIB(Slider, textSpace, float, 0)
+       ATTRIB(Slider, controlWidth, float, 0)
+       ATTRIB(Slider, pressed, float, 0)
+       ATTRIB(Slider, pressOffset, float, 0)
+       ATTRIB(Slider, previousValue, float, 0)
+       ATTRIB(Slider, tolerance, vector, '0 0 0')
+       ATTRIB(Slider, disabled, float, 0)
+       ATTRIB(Slider, color, vector, '1 1 1')
+       ATTRIB(Slider, color2, vector, '1 1 1')
+       ATTRIB(Slider, colorD, vector, '1 1 1')
+       ATTRIB(Slider, colorC, vector, '1 1 1')
+       ATTRIB(Slider, colorF, vector, '1 1 1')
+       ATTRIB(Slider, disabledAlpha, float, 0.3)
+ENDCLASS(Slider)
index 7564f02cf8a783fed8e7fb8f1f145837328b54bb..72bcaadbb806ea3e5485f54c2e90483608a92daf 100644 (file)
@@ -1,30 +1 @@
-#ifndef ITEM_TAB_H
-       #define ITEM_TAB_H
-       #include "dialog.qc"
-       CLASS(Tab, Dialog)
-               ATTRIB(Tab, isTabRoot, float, 0)
-               ATTRIB(Tab, closable, float, 0)
-               ATTRIB(Tab, rootDialog, float, 0)
-               ATTRIB(Tab, title, string, string_null)
-               ATTRIB(Tab, titleFontSize, float, 0)  // pixels
-
-               // still to be customized
-               ATTRIB(Tab, intendedWidth, float, 0)
-               ATTRIB(Tab, rows, float, 3)
-               ATTRIB(Tab, columns, float, 2)
-
-               ATTRIB(Tab, marginTop, float, 0)     // pixels
-               ATTRIB(Tab, marginBottom, float, 0)  // pixels
-               ATTRIB(Tab, marginLeft, float, 0)    // pixels
-               ATTRIB(Tab, marginRight, float, 0)   // pixels
-               ATTRIB(Tab, columnSpacing, float, 0) // pixels
-               ATTRIB(Tab, rowSpacing, float, 0)    // pixels
-               ATTRIB(Tab, rowHeight, float, 0)     // pixels
-               ATTRIB(Tab, titleHeight, float, 0)   // pixels
-
-               ATTRIB(Tab, backgroundImage, string, string_null)
-       ENDCLASS(Tab)
-#endif
-
-#ifdef IMPLEMENTATION
-#endif
+#include "tab.qh"
diff --git a/qcsrc/menu/item/tab.qh b/qcsrc/menu/item/tab.qh
new file mode 100644 (file)
index 0000000..e9ba81a
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(Tab, Dialog)
+       ATTRIB(Tab, isTabRoot, float, 0)
+       ATTRIB(Tab, closable, float, 0)
+       ATTRIB(Tab, rootDialog, float, 0)
+       ATTRIB(Tab, title, string, string_null)
+       ATTRIB(Tab, titleFontSize, float, 0)  // pixels
+
+       // still to be customized
+       ATTRIB(Tab, intendedWidth, float, 0)
+       ATTRIB(Tab, rows, float, 3)
+       ATTRIB(Tab, columns, float, 2)
+
+       ATTRIB(Tab, marginTop, float, 0)     // pixels
+       ATTRIB(Tab, marginBottom, float, 0)  // pixels
+       ATTRIB(Tab, marginLeft, float, 0)    // pixels
+       ATTRIB(Tab, marginRight, float, 0)   // pixels
+       ATTRIB(Tab, columnSpacing, float, 0) // pixels
+       ATTRIB(Tab, rowSpacing, float, 0)    // pixels
+       ATTRIB(Tab, rowHeight, float, 0)     // pixels
+       ATTRIB(Tab, titleHeight, float, 0)   // pixels
+
+       ATTRIB(Tab, backgroundImage, string, string_null)
+ENDCLASS(Tab)
index 4c23ff9a095b65c766bb137d0736a9042f6dc640..01f89fc4d8c6fd2779ecce4fb5203c5ab6b35110 100644 (file)
@@ -1,26 +1,5 @@
-// Note:
-//   to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
-#ifndef ITEM_TEXTSLIDER_H
-       #define ITEM_TEXTSLIDER_H
-       #include "slider.qc"
-       CLASS(TextSlider, Slider)
-               METHOD(TextSlider, valueToText, string(entity, float));
-               METHOD(TextSlider, valueToIdentifier, string(entity, float));
-               METHOD(TextSlider, setValueFromIdentifier_allowAnim, void(entity, string, bool));
-               METHOD(TextSlider, setValueFromIdentifier_noAnim, void(entity, string));
-               METHOD(TextSlider, setValueFromIdentifier, void(entity, string));
-               METHOD(TextSlider, getIdentifier, string(entity));
-               METHOD(TextSlider, clearValues, void(entity));
-               METHOD(TextSlider, addValue, void(entity, string, string));
-               METHOD(TextSlider, insertValue, void(entity, float, string, string));
-               METHOD(TextSlider, configureTextSliderValues, void(entity, string));
-               ATTRIBARRAY(TextSlider, valueStrings, string, 256)
-               ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
-               ATTRIB(TextSlider, nValues, int, 0)
-       ENDCLASS(TextSlider)
-#endif
+#include "textslider.qh"
 
-#ifdef IMPLEMENTATION
        string TextSlider_valueToIdentifier(entity me, int val)
        {
                if (val >= me.nValues) return "custom";
@@ -83,4 +62,3 @@
                me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
                me.setValueFromIdentifier_noAnim(me, theDefault);
        }
-#endif
diff --git a/qcsrc/menu/item/textslider.qh b/qcsrc/menu/item/textslider.qh
new file mode 100644 (file)
index 0000000..0703942
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once
+
+// Note:
+//   to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
+#include "slider.qh"
+CLASS(TextSlider, Slider)
+       METHOD(TextSlider, valueToText, string(entity, float));
+       METHOD(TextSlider, valueToIdentifier, string(entity, float));
+       METHOD(TextSlider, setValueFromIdentifier_allowAnim, void(entity, string, bool));
+       METHOD(TextSlider, setValueFromIdentifier_noAnim, void(entity, string));
+       METHOD(TextSlider, setValueFromIdentifier, void(entity, string));
+       METHOD(TextSlider, getIdentifier, string(entity));
+       METHOD(TextSlider, clearValues, void(entity));
+       METHOD(TextSlider, addValue, void(entity, string, string));
+       METHOD(TextSlider, insertValue, void(entity, float, string, string));
+       METHOD(TextSlider, configureTextSliderValues, void(entity, string));
+       ATTRIBARRAY(TextSlider, valueStrings, string, 256)
+       ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
+       ATTRIB(TextSlider, nValues, int, 0)
+ENDCLASS(TextSlider)
index 1c7ed0386f5d63b90a1655c2e202ef639a7d40d8..913cdbe34b43f6bb068c7e8748e301da57386397 100644 (file)
@@ -1,9 +1,24 @@
 #include "menu.qh"
-#include "classes.qc"
+
+#include "item.qh"
+
+#include "anim/animhost.qh"
+
+#include "item/dialog.qh"
+#include "item/listbox.qh"
+#include "item/nexposee.qh"
+
+#include "xonotic/commandbutton.qh"
+#include "xonotic/mainwindow.qh"
+#include "xonotic/serverlist.qh"
+#include "xonotic/slider_resolution.qh"
+
+.string cvarName;
+
 #include "xonotic/util.qh"
 
 #include "../common/items/all.qh"
-#include "../common/weapons/all.qh"
+#include <common/weapons/all.qh>
 #include "../common/mapinfo.qh"
 #include "../common/mutators/base.qh"
 
@@ -384,7 +399,7 @@ void drawBackground(string img, float a, string algn, float force1)
                        draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l + 1)), a);
                }
                ++l;
-               : nopic
+LABEL(nopic)
        }
 }
 
@@ -528,7 +543,7 @@ void m_tooltip(vector pos)
                {
                        it = m_findtooltipitem(main, pos);
 
-                       if (it.instanceOfListBox && it.isScrolling(it)) it = world;
+                       if (it.instanceOfListBox && it.isScrolling(it)) it = NULL;
 
                        if (it && prev_tooltip != it.tooltip)
                        {
@@ -656,6 +671,7 @@ void m_tooltip(vector pos)
 
 void m_draw(float width, float height)
 {
+       if (clientstate() == CS_DISCONNECTED) m_toggle(true);
        m_gamestatus();
 
        execute_next_frame();
@@ -862,10 +878,10 @@ void m_toggle(int mode)
 void Shutdown()
 {
        m_hide();
-       FOREACH_ENTITY_ORDERED(it.destroy, LAMBDA(
+       FOREACH_ENTITY_ORDERED(it.destroy, {
                if (it.classname == "vtbl") continue;
                it.destroy(it);
-       ));
+       });
 }
 
 void m_focus_item_chain(entity outermost, entity innermost)
index a4cdbc5f512bea1eba011c2dd64f30ea00b11c6f..2df331950848c1dcdab9c53b63d9ebd553a3cb9a 100644 (file)
@@ -1,13 +1,12 @@
-#ifndef MENU_H
-#define MENU_H
+#pragma once
 
 #include "draw.qh"
 #include "skin.qh"
 
 #include "xonotic/util.qh"
 
-#include "../common/constants.qh"
-#include "../common/util.qh"
+#include <common/constants.qh>
+#include <common/util.qh>
 
 const int GAME_ISSERVER     = BIT(0);
 const int GAME_CONNECTED    = BIT(1);
@@ -58,4 +57,3 @@ const string MENU_SOUND_WINNER  = "sound/menu/winner.wav";
 
 void m_play_focus_sound();
 void m_play_click_sound(string soundfile);
-#endif
diff --git a/qcsrc/menu/mutators/_mod.inc b/qcsrc/menu/mutators/_mod.inc
new file mode 100644 (file)
index 0000000..98fb481
--- /dev/null
@@ -0,0 +1 @@
+// generated file; do not modify
index 2b881992ee6a5177b9585ea12ffdacdec01d1c00..f43199ceada1ca00caea4851bb42302c38cc445d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef MENU_MUTATORS_EVENTS_H
-#define MENU_MUTATORS_EVENTS_H
+#pragma once
 
 #include <common/mutators/base.qh>
 
@@ -34,4 +33,3 @@ string cmd_string;
        /** whole command, use only if you really have to */ i(string, cmd_string) \
        /**/
 MUTATOR_HOOKABLE(Menu_ConsoleCommand, EV_Menu_ConsoleCommand);
-#endif
index 621c1a4899cb104e142858b254207d8e558f111f..57a34c36c7d9c0776876957a32968222b36e8f45 100644 (file)
@@ -1,17 +1,13 @@
-#include "../lib/_all.inc"
+#include <lib/_all.inc>
 
-#define world NULL
+#include "_mod.inc"
+#include "anim/_mod.inc"
+#include "command/_mod.inc"
+#include "item/_mod.inc"
+#include "mutators/_mod.inc"
+#include "xonotic/_mod.inc"
 
-#include "classes.qc"
-
-#include "draw.qc"
-#include "menu.qc"
-
-#include "command/all.qc"
-
-#include "xonotic/util.qc"
-
-#include "../common/_all.inc"
+#include <common/_all.inc>
 
 #if BUILD_MOD
 #include "../../mod/menu/progs.inc"
index ebb622b0a1ecb89e9eb8c599362515576344a609..7cc2d2d3b4d49084f8bbbd2c4fce75cdf100c3d6 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SKIN_H
-#define SKIN_H
+#pragma once
 
 #define SKINBEGIN
 #define SKINVECTOR(name,def) vector SKIN##name = def
@@ -27,4 +26,3 @@
 #undef SKINFLOAT
 #undef SKINVECTOR
 #undef SKINBEGIN
-#endif
diff --git a/qcsrc/menu/xonotic/_mod.inc b/qcsrc/menu/xonotic/_mod.inc
new file mode 100644 (file)
index 0000000..4702bbf
--- /dev/null
@@ -0,0 +1,116 @@
+// generated file; do not modify
+#include "bigbutton.qc"
+#include "bigcommandbutton.qc"
+#include "button.qc"
+#include "campaign.qc"
+#include "charmap.qc"
+#include "checkbox.qc"
+#include "checkbox_slider_invalid.qc"
+#include "checkbox_string.qc"
+#include "colorbutton.qc"
+#include "colorpicker.qc"
+#include "colorpicker_string.qc"
+#include "commandbutton.qc"
+#include "credits.qc"
+#include "crosshairpicker.qc"
+#include "crosshairpreview.qc"
+#include "cvarlist.qc"
+#include "datasource.qc"
+#include "demolist.qc"
+#include "dialog.qc"
+#include "dialog_credits.qc"
+#include "dialog_firstrun.qc"
+#include "dialog_hudpanel_ammo.qc"
+#include "dialog_hudpanel_centerprint.qc"
+#include "dialog_hudpanel_chat.qc"
+#include "dialog_hudpanel_engineinfo.qc"
+#include "dialog_hudpanel_healtharmor.qc"
+#include "dialog_hudpanel_infomessages.qc"
+#include "dialog_hudpanel_itemstime.qc"
+#include "dialog_hudpanel_modicons.qc"
+#include "dialog_hudpanel_notification.qc"
+#include "dialog_hudpanel_physics.qc"
+#include "dialog_hudpanel_powerups.qc"
+#include "dialog_hudpanel_pressedkeys.qc"
+#include "dialog_hudpanel_quickmenu.qc"
+#include "dialog_hudpanel_racetimer.qc"
+#include "dialog_hudpanel_radar.qc"
+#include "dialog_hudpanel_score.qc"
+#include "dialog_hudpanel_timer.qc"
+#include "dialog_hudpanel_vote.qc"
+#include "dialog_hudpanel_weapons.qc"
+#include "dialog_hudsetup_exit.qc"
+#include "dialog_monstertools.qc"
+#include "dialog_multiplayer.qc"
+#include "dialog_multiplayer_create.qc"
+#include "dialog_multiplayer_create_mapinfo.qc"
+#include "dialog_multiplayer_create_mutators.qc"
+#include "dialog_multiplayer_join.qc"
+#include "dialog_multiplayer_join_serverinfo.qc"
+#include "dialog_multiplayer_media.qc"
+#include "dialog_multiplayer_media_demo.qc"
+#include "dialog_multiplayer_media_demo_startconfirm.qc"
+#include "dialog_multiplayer_media_demo_timeconfirm.qc"
+#include "dialog_multiplayer_media_musicplayer.qc"
+#include "dialog_multiplayer_media_screenshot.qc"
+#include "dialog_multiplayer_media_screenshot_viewer.qc"
+#include "dialog_multiplayer_profile.qc"
+#include "dialog_quit.qc"
+#include "dialog_sandboxtools.qc"
+#include "dialog_settings.qc"
+#include "dialog_settings_audio.qc"
+#include "dialog_settings_effects.qc"
+#include "dialog_settings_game.qc"
+#include "dialog_settings_game_crosshair.qc"
+#include "dialog_settings_game_hud.qc"
+#include "dialog_settings_game_hudconfirm.qc"
+#include "dialog_settings_game_messages.qc"
+#include "dialog_settings_game_model.qc"
+#include "dialog_settings_game_view.qc"
+#include "dialog_settings_game_weapons.qc"
+#include "dialog_settings_input.qc"
+#include "dialog_settings_input_userbind.qc"
+#include "dialog_settings_misc.qc"
+#include "dialog_settings_misc_cvars.qc"
+#include "dialog_settings_misc_reset.qc"
+#include "dialog_settings_user.qc"
+#include "dialog_settings_user_languagewarning.qc"
+#include "dialog_settings_video.qc"
+#include "dialog_singleplayer.qc"
+#include "dialog_singleplayer_winner.qc"
+#include "dialog_teamselect.qc"
+#include "gametypelist.qc"
+#include "hudskinlist.qc"
+#include "image.qc"
+#include "inputbox.qc"
+#include "keybinder.qc"
+#include "languagelist.qc"
+#include "listbox.qc"
+#include "mainwindow.qc"
+#include "maplist.qc"
+#include "nexposee.qc"
+#include "picker.qc"
+#include "playerlist.qc"
+#include "playermodel.qc"
+#include "playlist.qc"
+#include "radiobutton.qc"
+#include "rootdialog.qc"
+#include "screenshotimage.qc"
+#include "screenshotlist.qc"
+#include "serverlist.qc"
+#include "skinlist.qc"
+#include "slider.qc"
+#include "slider_decibels.qc"
+#include "slider_particles.qc"
+#include "slider_picmip.qc"
+#include "slider_resolution.qc"
+#include "slider_sbfadetime.qc"
+#include "soundlist.qc"
+#include "statslist.qc"
+#include "tab.qc"
+#include "tabcontroller.qc"
+#include "textlabel.qc"
+#include "textslider.qc"
+#include "util.qc"
+#include "weaponarenacheckbox.qc"
+#include "weaponslist.qc"
index c0a5caa12177308e7a1f82d0cbcb4afbf2fc5234..0022aad5a4fd33ebd8c0de63b0bcf5e9d4f10093 100644 (file)
@@ -1,15 +1,5 @@
-#ifndef BIGBUTTON_H
-#define BIGBUTTON_H
-#include "button.qc"
-CLASS(XonoticBigButton, XonoticButton)
-       METHOD(XonoticBigButton, configureXonoticBigButton, void(entity, string, vector));
-       ATTRIB(XonoticBigButton, image, string, SKINGFX_BUTTON_BIG)
-       ATTRIB(XonoticBigButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
-ENDCLASS(XonoticBigButton)
-entity makeXonoticBigButton(string theText, vector theColor);
-#endif
+#include "bigbutton.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticBigButton(string theText, vector theColor)
 {
        entity me;
@@ -22,4 +12,3 @@ void XonoticBigButton_configureXonoticBigButton(entity me, string theText, vecto
 {
        me.configureXonoticButton(me, theText, theColor, string_null);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/bigbutton.qh b/qcsrc/menu/xonotic/bigbutton.qh
new file mode 100644 (file)
index 0000000..14b6893
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "button.qh"
+CLASS(XonoticBigButton, XonoticButton)
+       METHOD(XonoticBigButton, configureXonoticBigButton, void(entity, string, vector));
+       ATTRIB(XonoticBigButton, image, string, SKINGFX_BUTTON_BIG)
+       ATTRIB(XonoticBigButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
+ENDCLASS(XonoticBigButton)
+entity makeXonoticBigButton(string theText, vector theColor);
index 68941771708b212522e86c8e7b651635762cbbd4..a6f8615de4b26c47f3f714cd625caed14fa3a53a 100644 (file)
@@ -1,16 +1,5 @@
-#ifndef BIGCOMMANDBUTTON_H
-#define BIGCOMMANDBUTTON_H
-#include "commandbutton.qc"
-CLASS(XonoticBigCommandButton, XonoticCommandButton)
-       METHOD(XonoticBigCommandButton, configureXonoticBigCommandButton, void(entity, string, vector, string, float, string));
-       ATTRIB(XonoticBigCommandButton, image, string, SKINGFX_BUTTON_BIG)
-       ATTRIB(XonoticBigCommandButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
-ENDCLASS(XonoticBigCommandButton)
-entity makeXonoticBigCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
-entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#endif
+#include "bigcommandbutton.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticBigCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
 {
        entity me;
@@ -27,4 +16,3 @@ void XonoticBigCommandButton_configureXonoticBigCommandButton(entity me, string
 {
        me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags, theTooltip);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/bigcommandbutton.qh b/qcsrc/menu/xonotic/bigcommandbutton.qh
new file mode 100644 (file)
index 0000000..4713fa3
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "commandbutton.qh"
+CLASS(XonoticBigCommandButton, XonoticCommandButton)
+       METHOD(XonoticBigCommandButton, configureXonoticBigCommandButton, void(entity, string, vector, string, float, string));
+       ATTRIB(XonoticBigCommandButton, image, string, SKINGFX_BUTTON_BIG)
+       ATTRIB(XonoticBigCommandButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
+ENDCLASS(XonoticBigCommandButton)
+entity makeXonoticBigCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
+entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
index a9a8fe2160773595473d5e5cb5754c3105396e00..d86c4a4537b062fab660bbe5e180cd82976fb266 100644 (file)
@@ -1,25 +1,5 @@
-#ifndef BUTTON_H
-#define BUTTON_H
-#include "../item/button.qc"
-CLASS(XonoticButton, Button)
-       METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector, string));
-       ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
-       ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
-       ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
-       ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
-       ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
-       ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
-       ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
-       ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
-       ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
-ENDCLASS(XonoticButton)
-entity makeXonoticButton_T(string theText, vector theColor, string theTooltip);
-entity makeXonoticButton(string theText, vector theColor);
-#endif
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticButton_T(string theText, vector theColor, string theTooltip)
 {
        entity me;
@@ -47,4 +27,3 @@ void XonoticButton_configureXonoticButton(entity me, string theText, vector theC
        }
        setZonedTooltip(me, theTooltip, string_null);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/button.qh b/qcsrc/menu/xonotic/button.qh
new file mode 100644 (file)
index 0000000..c7e85fa
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "../item/button.qh"
+CLASS(XonoticButton, Button)
+       METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector, string));
+       ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
+       ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
+       ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
+       ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
+       ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
+       ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
+       ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
+       ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON)  // chars
+       ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
+ENDCLASS(XonoticButton)
+
+entity makeXonoticButton_T(string theText, vector theColor, string theTooltip);
+entity makeXonoticButton(string theText, vector theColor);
index 5947c3e7376d112230226a05ab08d35660b3a5b0..cb418a4e1834fcce6076672f337e818fef681ca5 100644 (file)
@@ -1,53 +1,8 @@
-#include <common/campaign_common.qh>
-
-#ifndef CAMPAIGN_H
-#define CAMPAIGN_H
-#include "listbox.qc"
-CLASS(XonoticCampaignList, XonoticListBox)
-       METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity));
-       ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
-       METHOD(XonoticCampaignList, draw, void(entity));
-       METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticCampaignList, setSelected, void(entity, float));
-       METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticCampaignList, campaignGo, void(entity, float));
-       METHOD(XonoticCampaignList, destroy, void(entity));
-
-       ATTRIB(XonoticCampaignList, campaignGlob, float, 0)
-       ATTRIB(XonoticCampaignList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, columnPreviewOrigin, float, 0)
-       ATTRIB(XonoticCampaignList, columnPreviewSize, float, 0)
-       ATTRIB(XonoticCampaignList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticCampaignList, columnNameSize, float, 0)
-       ATTRIB(XonoticCampaignList, columnCheckMarkOrigin, float, 0)
-       ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0)
-       ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
-       ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
+#include "campaign.qh"
 
-       ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
-
-       ATTRIB(XonoticCampaignList, campaignIndex, float, 0)
-       ATTRIB(XonoticCampaignList, cvarName, string, string_null)
-       METHOD(XonoticCampaignList, loadCvars, void(entity));
-       METHOD(XonoticCampaignList, saveCvars, void(entity));
-
-       ATTRIB(XonoticCampaignList, buttonNext, entity, NULL)
-       ATTRIB(XonoticCampaignList, buttonPrev, entity, NULL)
-       ATTRIB(XonoticCampaignList, labelTitle, entity, NULL)
-ENDCLASS(XonoticCampaignList)
-entity makeXonoticCampaignList();
-void CampaignList_LoadMap(entity btn, entity me);
-void MultiCampaign_Next(entity btn, entity me);
-void MultiCampaign_Prev(entity btn, entity me);
-#endif
+#include <common/campaign_common.qh>
+#include "inputbox.qh"
 
-#ifdef IMPLEMENTATION
 string campaign_longdesc_wrapped[CAMPAIGN_MAX_ENTRIES];
 
 void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
@@ -82,11 +37,11 @@ void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
                        }
                }
                goto nottoolong;
-:toolong
+LABEL(toolong)
                while(substring(r, strlen(r) - 1, 1) == "\n")
                        r = substring(r, 0, strlen(r) - 1);
                r = strcat(r, "...\n");
-:nottoolong
+LABEL(nottoolong)
                campaign_longdesc_wrapped[i] = strzone(substring(r, 0, strlen(r) - 1));
        }
 }
@@ -322,4 +277,3 @@ float XonoticCampaignList_keyDown(entity me, float scan, float ascii, float shif
                return SUPER(XonoticCampaignList).keyDown(me, scan, ascii, shift);
        return 1;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/campaign.qh b/qcsrc/menu/xonotic/campaign.qh
new file mode 100644 (file)
index 0000000..17585a8
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticCampaignList, XonoticListBox)
+       METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity));
+       ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
+       METHOD(XonoticCampaignList, draw, void(entity));
+       METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticCampaignList, setSelected, void(entity, float));
+       METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticCampaignList, campaignGo, void(entity, float));
+       METHOD(XonoticCampaignList, destroy, void(entity));
+
+       ATTRIB(XonoticCampaignList, campaignGlob, float, 0)
+       ATTRIB(XonoticCampaignList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, columnPreviewOrigin, float, 0)
+       ATTRIB(XonoticCampaignList, columnPreviewSize, float, 0)
+       ATTRIB(XonoticCampaignList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticCampaignList, columnNameSize, float, 0)
+       ATTRIB(XonoticCampaignList, columnCheckMarkOrigin, float, 0)
+       ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0)
+       ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
+       ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
+
+       ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
+
+       ATTRIB(XonoticCampaignList, campaignIndex, float, 0)
+       ATTRIB(XonoticCampaignList, cvarName, string, string_null)
+       METHOD(XonoticCampaignList, loadCvars, void(entity));
+       METHOD(XonoticCampaignList, saveCvars, void(entity));
+
+       ATTRIB(XonoticCampaignList, buttonNext, entity, NULL)
+       ATTRIB(XonoticCampaignList, buttonPrev, entity, NULL)
+       ATTRIB(XonoticCampaignList, labelTitle, entity, NULL)
+ENDCLASS(XonoticCampaignList)
+entity makeXonoticCampaignList();
+void CampaignList_LoadMap(entity btn, entity me);
+void MultiCampaign_Next(entity btn, entity me);
+void MultiCampaign_Prev(entity btn, entity me);
index f13c8bc83c51dec555d727992749d83cb2d86284..28f67d9f5b5bd1f163f10589a754b773c1720e81 100644 (file)
@@ -1,26 +1,6 @@
-#ifndef CHARMAP_H
-#define CHARMAP_H
-#include "picker.qc"
-CLASS(XonoticCharmap, XonoticPicker)
-       METHOD(XonoticCharmap, configureXonoticCharmap, void(entity, entity));
-       METHOD(XonoticCharmap, focusLeave, void(entity));
-       METHOD(XonoticCharmap, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticCharmap, keyDown, float(entity, float, float, float));
-       ATTRIB(XonoticCharmap, inputBox, entity, NULL)
-       ATTRIB(XonoticCharmap, realFontSize, vector, '0 0 0')
-
-       ATTRIB(XonoticCharmap, rows, float, 10)
-       ATTRIB(XonoticCharmap, columns, float, 14)
-
-       METHOD(XonoticCharmap, cellSelect, void(entity, vector));
-       METHOD(XonoticCharmap, cellIsValid, bool(entity, vector));
-       METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector));
-       ATTRIB(XonoticCharmap, charOffset, vector, '0 0 0')
-ENDCLASS(XonoticCharmap)
-entity makeXonoticCharmap(entity controlledInputBox);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "charmap.qh"
+
+#include "inputbox.qh"
 
 string CHARMAP =
        "★◆■▮▰▬◣◤◥◢◀▲▶▼"
@@ -121,4 +101,3 @@ void XonoticCharmap_focusLeave(entity me)
 {
        me.inputBox.saveCvars(me.inputBox);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/charmap.qh b/qcsrc/menu/xonotic/charmap.qh
new file mode 100644 (file)
index 0000000..c8d5b31
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "picker.qh"
+CLASS(XonoticCharmap, XonoticPicker)
+       METHOD(XonoticCharmap, configureXonoticCharmap, void(entity, entity));
+       METHOD(XonoticCharmap, focusLeave, void(entity));
+       METHOD(XonoticCharmap, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticCharmap, keyDown, float(entity, float, float, float));
+       ATTRIB(XonoticCharmap, inputBox, entity, NULL)
+       ATTRIB(XonoticCharmap, realFontSize, vector, '0 0 0')
+
+       ATTRIB(XonoticCharmap, rows, float, 10)
+       ATTRIB(XonoticCharmap, columns, float, 14)
+
+       METHOD(XonoticCharmap, cellSelect, void(entity, vector));
+       METHOD(XonoticCharmap, cellIsValid, bool(entity, vector));
+       METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector));
+       ATTRIB(XonoticCharmap, charOffset, vector, '0 0 0')
+ENDCLASS(XonoticCharmap)
+entity makeXonoticCharmap(entity controlledInputBox);
index bb63bffe43517679bd9bd279e398b64318aca232..21743b9a1506801ea9a4a86bce1843c706d85447 100644 (file)
@@ -1,34 +1,5 @@
-#ifndef CHECKBOX_H
-#define CHECKBOX_H
-#include "../item/checkbox.qc"
-CLASS(XonoticCheckBox, CheckBox)
-       METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string, string));
-       METHOD(XonoticCheckBox, setChecked, void(entity, float));
-       ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticCheckBox, yesValue, float, 1)
-       ATTRIB(XonoticCheckBox, noValue, float, 0)
+#include "checkbox.qh"
 
-       ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
-       ATTRIB(XonoticCheckBox, cvarName, string, string_null)
-       METHOD(XonoticCheckBox, loadCvars, void(entity));
-       METHOD(XonoticCheckBox, saveCvars, void(entity));
-       ATTRIB(XonoticCheckBox, sendCvars, float, 0)
-
-       ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBox)
-entity makeXonoticCheckBox_T(float, string, string, string);
-entity makeXonoticCheckBox(float, string, string);
-entity makeXonoticCheckBoxEx_T(float, float, string, string, string);
-entity makeXonoticCheckBoxEx(float, float, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
 {
        float y, n;
@@ -112,4 +83,3 @@ void XonoticCheckBox_saveCvars(entity me)
 
        CheckSendCvars(me, me.cvarName);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/checkbox.qh b/qcsrc/menu/xonotic/checkbox.qh
new file mode 100644 (file)
index 0000000..a188f4c
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticCheckBox, CheckBox)
+       METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string, string));
+       METHOD(XonoticCheckBox, setChecked, void(entity, float));
+       ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticCheckBox, yesValue, float, 1)
+       ATTRIB(XonoticCheckBox, noValue, float, 0)
+
+       ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
+       ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
+       ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
+       ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+       ATTRIB(XonoticCheckBox, cvarName, string, string_null)
+       METHOD(XonoticCheckBox, loadCvars, void(entity));
+       METHOD(XonoticCheckBox, saveCvars, void(entity));
+       ATTRIB(XonoticCheckBox, sendCvars, float, 0)
+
+       ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBox)
+entity makeXonoticCheckBox_T(float, string, string, string);
+entity makeXonoticCheckBox(float, string, string);
+entity makeXonoticCheckBoxEx_T(float, float, string, string, string);
+entity makeXonoticCheckBoxEx(float, float, string, string);
index 9dae25a35bb214d138c9a8c4c57ad3f54c5de3c7..839e66b215dc45765a64e4f9aa52902bed9e9a20 100644 (file)
@@ -1,30 +1,7 @@
-#ifndef CHECKBOX_SLIDER_INVALID_H
-#define CHECKBOX_SLIDER_INVALID_H
-#include "../item/checkbox.qc"
-CLASS(XonoticSliderCheckBox, CheckBox)
-       METHOD(XonoticSliderCheckBox, configureXonoticSliderCheckBox, void(entity, float, float, entity, string));
-       METHOD(XonoticSliderCheckBox, setChecked, void(entity, float));
-       METHOD(XonoticSliderCheckBox, draw, void(entity));
-       ATTRIB(XonoticSliderCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticSliderCheckBox, image, string, SKINGFX_CHECKBOX)
+#include "checkbox_slider_invalid.qh"
 
-       ATTRIB(XonoticSliderCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticSliderCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticSliderCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticSliderCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+#include "slider.qh"
 
-       ATTRIB(XonoticSliderCheckBox, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticSliderCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
-
-       ATTRIB(XonoticSliderCheckBox, controlledSlider, entity, NULL)
-       ATTRIB(XonoticSliderCheckBox, offValue, float, -1)
-       ATTRIB(XonoticSliderCheckBox, inverted, float, 0)
-       ATTRIB(XonoticSliderCheckBox, savedValue, float, -1)
-ENDCLASS(XonoticSliderCheckBox)
-entity makeXonoticSliderCheckBox(float, float, entity, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticSliderCheckBox(float theOffValue, float isInverted, entity theControlledSlider, string theText)
 {
        entity me;
@@ -63,5 +40,3 @@ void XonoticSliderCheckBox_setChecked(entity me, float val)
        else
                me.controlledSlider.setValue(me.controlledSlider, me.offValue);
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/checkbox_slider_invalid.qh b/qcsrc/menu/xonotic/checkbox_slider_invalid.qh
new file mode 100644 (file)
index 0000000..d9c144c
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticSliderCheckBox, CheckBox)
+       METHOD(XonoticSliderCheckBox, configureXonoticSliderCheckBox, void(entity, float, float, entity, string));
+       METHOD(XonoticSliderCheckBox, setChecked, void(entity, float));
+       METHOD(XonoticSliderCheckBox, draw, void(entity));
+       ATTRIB(XonoticSliderCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticSliderCheckBox, image, string, SKINGFX_CHECKBOX)
+
+       ATTRIB(XonoticSliderCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
+       ATTRIB(XonoticSliderCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
+       ATTRIB(XonoticSliderCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
+       ATTRIB(XonoticSliderCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+       ATTRIB(XonoticSliderCheckBox, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticSliderCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+
+       ATTRIB(XonoticSliderCheckBox, controlledSlider, entity, NULL)
+       ATTRIB(XonoticSliderCheckBox, offValue, float, -1)
+       ATTRIB(XonoticSliderCheckBox, inverted, float, 0)
+       ATTRIB(XonoticSliderCheckBox, savedValue, float, -1)
+ENDCLASS(XonoticSliderCheckBox)
+entity makeXonoticSliderCheckBox(float, float, entity, string);
index a93c9acf5d666a56611e30b01eb5b8f7acb4b322..99db16e35bd483bb6e4136a2d017cd2d4e003065 100644 (file)
@@ -1,31 +1,5 @@
-#ifndef CHECKBOX_STRING_H
-#define CHECKBOX_STRING_H
-#include "../item/checkbox.qc"
-CLASS(XonoticCheckBoxString, CheckBox)
-       METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string));
-       METHOD(XonoticCheckBoxString, setChecked, void(entity, float));
-       ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
-       ATTRIB(XonoticCheckBoxString, noString, string, string_null)
+#include "checkbox_string.qh"
 
-       ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
-       ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
-       METHOD(XonoticCheckBoxString, loadCvars, void(entity));
-       METHOD(XonoticCheckBoxString, saveCvars, void(entity));
-       ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
-
-       ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBoxString)
-entity makeXonoticCheckBoxString(string, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticCheckBoxString(string theYesValue, string theNoValue, string theCvar, string theText)
 {
        entity me;
@@ -67,4 +41,3 @@ void XonoticCheckBoxString_saveCvars(entity me)
 
        CheckSendCvars(me, me.cvarName);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/checkbox_string.qh b/qcsrc/menu/xonotic/checkbox_string.qh
new file mode 100644 (file)
index 0000000..b4dc8e5
--- /dev/null
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticCheckBoxString, CheckBox)
+       METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string));
+       METHOD(XonoticCheckBoxString, setChecked, void(entity, float));
+       ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
+       ATTRIB(XonoticCheckBoxString, noString, string, string_null)
+
+       ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
+       ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
+       ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
+       ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+       ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
+       METHOD(XonoticCheckBoxString, loadCvars, void(entity));
+       METHOD(XonoticCheckBoxString, saveCvars, void(entity));
+       ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
+
+       ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBoxString)
+entity makeXonoticCheckBoxString(string, string, string, string);
index 4efa4a2bda317af8227b57ea0ef717f7168a2ead..6675c1aee789ec2b0ab1291e3fce46bd423347f8 100644 (file)
@@ -1,25 +1,5 @@
-#ifndef COLORBUTTON_H
-#define COLORBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticColorButton, RadioButton)
-       METHOD(XonoticColorButton, configureXonoticColorButton, void(entity, float, float, float));
-       METHOD(XonoticColorButton, setChecked, void(entity, float));
-       METHOD(XonoticColorButton, draw, void(entity));
-       ATTRIB(XonoticColorButton, fontSize, float, 0)
-       ATTRIB(XonoticColorButton, image, string, SKINGFX_COLORBUTTON)
+#include "colorbutton.qh"
 
-       ATTRIB(XonoticColorButton, useDownAsChecked, float, 1)
-
-       ATTRIB(XonoticColorButton, cvarPart, float, 0)
-       ATTRIB(XonoticColorButton, cvarName, string, string_null)
-       ATTRIB(XonoticColorButton, cvarValueFloat, float, 0)
-       METHOD(XonoticColorButton, loadCvars, void(entity));
-       METHOD(XonoticColorButton, saveCvars, void(entity));
-ENDCLASS(XonoticColorButton)
-entity makeXonoticColorButton(float, float, float);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticColorButton(float theGroup, float theColor, float theValue)
 {
        entity me;
@@ -99,4 +79,3 @@ void XonoticColorButton_draw(entity me)
        me.colorD = me.color;
        SUPER(XonoticColorButton).draw(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/colorbutton.qh b/qcsrc/menu/xonotic/colorbutton.qh
new file mode 100644 (file)
index 0000000..c253f8f
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "../item/radiobutton.qh"
+CLASS(XonoticColorButton, RadioButton)
+       METHOD(XonoticColorButton, configureXonoticColorButton, void(entity, float, float, float));
+       METHOD(XonoticColorButton, setChecked, void(entity, float));
+       METHOD(XonoticColorButton, draw, void(entity));
+       ATTRIB(XonoticColorButton, fontSize, float, 0)
+       ATTRIB(XonoticColorButton, image, string, SKINGFX_COLORBUTTON)
+
+       ATTRIB(XonoticColorButton, useDownAsChecked, float, 1)
+
+       ATTRIB(XonoticColorButton, cvarPart, float, 0)
+       ATTRIB(XonoticColorButton, cvarName, string, string_null)
+       ATTRIB(XonoticColorButton, cvarValueFloat, float, 0)
+       METHOD(XonoticColorButton, loadCvars, void(entity));
+       METHOD(XonoticColorButton, saveCvars, void(entity));
+ENDCLASS(XonoticColorButton)
+entity makeXonoticColorButton(float, float, float);
index f7d72439db5f2011dba96eb14aeab8269159abfd..b88d5d9a7d8f3973e5d828c0da66cac207db309a 100644 (file)
@@ -1,23 +1,7 @@
-#ifndef COLORPICKER_H
-#define COLORPICKER_H
-#include "../item/image.qc"
-CLASS(XonoticColorpicker, Image)
-       METHOD(XonoticColorpicker, configureXonoticColorpicker, void(entity, entity));
-       METHOD(XonoticColorpicker, mousePress, float(entity, vector));
-       METHOD(XonoticColorpicker, mouseRelease, float(entity, vector));
-       METHOD(XonoticColorpicker, mouseDrag, float(entity, vector));
-       ATTRIB(XonoticColorpicker, controlledTextbox, entity, NULL)
-       ATTRIB(XonoticColorpicker, image, string, SKINGFX_COLORPICKER)
-       ATTRIB(XonoticColorpicker, imagemargin, vector, SKINMARGIN_COLORPICKER)
-       ATTRIB(XonoticColorpicker, focusable, float, 1)
-       METHOD(XonoticColorpicker, focusLeave, void(entity));
-       METHOD(XonoticColorpicker, keyDown, float(entity, float, float, float));
-       METHOD(XonoticColorpicker, draw, void(entity));
-ENDCLASS(XonoticColorpicker)
-entity makeXonoticColorpicker(entity theTextbox);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "colorpicker.qh"
+
+#include "inputbox.qh"
+
 entity makeXonoticColorpicker(entity theTextbox)
 {
        entity me;
@@ -174,4 +158,3 @@ void XonoticColorpicker_draw(entity me)
        draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, '0 0 0', aC);
        draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, me.color, B);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/colorpicker.qh b/qcsrc/menu/xonotic/colorpicker.qh
new file mode 100644 (file)
index 0000000..03567df
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "../item/image.qh"
+CLASS(XonoticColorpicker, Image)
+       METHOD(XonoticColorpicker, configureXonoticColorpicker, void(entity, entity));
+       METHOD(XonoticColorpicker, mousePress, float(entity, vector));
+       METHOD(XonoticColorpicker, mouseRelease, float(entity, vector));
+       METHOD(XonoticColorpicker, mouseDrag, float(entity, vector));
+       ATTRIB(XonoticColorpicker, controlledTextbox, entity, NULL)
+       ATTRIB(XonoticColorpicker, image, string, SKINGFX_COLORPICKER)
+       ATTRIB(XonoticColorpicker, imagemargin, vector, SKINMARGIN_COLORPICKER)
+       ATTRIB(XonoticColorpicker, focusable, float, 1)
+       METHOD(XonoticColorpicker, focusLeave, void(entity));
+       METHOD(XonoticColorpicker, keyDown, float(entity, float, float, float));
+       METHOD(XonoticColorpicker, draw, void(entity));
+ENDCLASS(XonoticColorpicker)
+entity makeXonoticColorpicker(entity theTextbox);
+
+vector color_hslimage(vector v, vector margin);
+vector hslimage_color(vector v, vector margin);
index c8c26e4f365da0d1a90a48fa00d6f00c3831e6f7..200204c00d131cc9fb3e62615215fd74a6577b1f 100644 (file)
@@ -1,27 +1,7 @@
-#ifndef COLORPICKER_STRING_H
-#define COLORPICKER_STRING_H
-#include "../item/image.qc"
-CLASS(XonoticColorpickerString, Image)
-       METHOD(XonoticColorpickerString, configureXonoticColorpickerString, void(entity, string, string));
-       METHOD(XonoticColorpickerString, mousePress, float(entity, vector));
-       METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector));
-       METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector));
-
-       ATTRIB(XonoticColorpickerString, cvarName, string, string_null)
-       METHOD(XonoticColorpickerString, loadCvars, void(entity));
-       METHOD(XonoticColorpickerString, saveCvars, void(entity));
-
-       ATTRIB(XonoticColorpickerString, prevcoords, vector, '0 0 0')
-       ATTRIB(XonoticColorpickerString, image, string, SKINGFX_COLORPICKER)
-       ATTRIB(XonoticColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
-       ATTRIB(XonoticColorpickerString, focusable, float, 1)
-       METHOD(XonoticColorpickerString, draw, void(entity));
-       ATTRIB(XonoticColorpickerString, disabledAlpha, float, 0.3)
-ENDCLASS(XonoticColorpickerString)
-entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "colorpicker_string.qh"
+
+.bool disabled;
+
 entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar)
 {
        entity me;
@@ -119,4 +99,3 @@ void XonoticColorpickerString_draw(entity me)
 
        draw_alpha = save;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/colorpicker_string.qh b/qcsrc/menu/xonotic/colorpicker_string.qh
new file mode 100644 (file)
index 0000000..3caf9d9
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "colorpicker.qh"
+
+#include "../item/image.qh"
+CLASS(XonoticColorpickerString, Image)
+       METHOD(XonoticColorpickerString, configureXonoticColorpickerString, void(entity, string, string));
+       METHOD(XonoticColorpickerString, mousePress, float(entity, vector));
+       METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector));
+       METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector));
+
+       ATTRIB(XonoticColorpickerString, cvarName, string, string_null)
+       METHOD(XonoticColorpickerString, loadCvars, void(entity));
+       METHOD(XonoticColorpickerString, saveCvars, void(entity));
+
+       ATTRIB(XonoticColorpickerString, prevcoords, vector, '0 0 0')
+       ATTRIB(XonoticColorpickerString, image, string, SKINGFX_COLORPICKER)
+       ATTRIB(XonoticColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
+       ATTRIB(XonoticColorpickerString, focusable, float, 1)
+       METHOD(XonoticColorpickerString, draw, void(entity));
+       ATTRIB(XonoticColorpickerString, disabledAlpha, float, 0.3)
+ENDCLASS(XonoticColorpickerString)
+entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
index 0a4943e41acba2c543bf4b0ae83e7876c3c5b086..8e691a036bab1d97301c55b229aec9afa47cdb04 100644 (file)
@@ -1,22 +1,5 @@
-#ifndef COMMANDBUTTON_CLOSE
-# define COMMANDBUTTON_CLOSE 1
-# define COMMANDBUTTON_APPLY 2
-//# define COMMANDBUTTON_REVERT 4
-#endif
+#include "commandbutton.qh"
 
-#ifndef COMMANDBUTTON_H
-#define COMMANDBUTTON_H
-#include "button.qc"
-CLASS(XonoticCommandButton, XonoticButton)
-       METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float, string));
-       ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
-       ATTRIB(XonoticCommandButton, flags, float, 0)
-ENDCLASS(XonoticCommandButton)
-entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
-entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
 {
        entity me;
@@ -48,4 +31,3 @@ void XonoticCommandButton_configureXonoticCommandButton(entity me, string theTex
        me.onClick = XonoticCommandButton_Click;
        me.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/commandbutton.qh b/qcsrc/menu/xonotic/commandbutton.qh
new file mode 100644 (file)
index 0000000..072890a
--- /dev/null
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "button.qh"
+CLASS(XonoticCommandButton, XonoticButton)
+       METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float, string));
+       ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
+       ATTRIB(XonoticCommandButton, flags, float, 0)
+ENDCLASS(XonoticCommandButton)
+
+entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
+entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
+
+#ifndef COMMANDBUTTON_CLOSE
+# define COMMANDBUTTON_CLOSE 1
+# define COMMANDBUTTON_APPLY 2
+//# define COMMANDBUTTON_REVERT 4
+#endif
index d9a1ecb2e5b3893943f7f343a73a69c3b62b0eb6..d30ab3d447bb57d9343e21551aabc9a68b755d63 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CREDITS_H
-#define CREDITS_H
+#include "credits.qh"
 
 #define CREDITS(TITLE, FUNCTION, PERSON, PERSON_, NL) \
        TITLE(_("Core Team")) \
@@ -367,28 +366,6 @@ int credits_get()
 
 #undef CREDITS
 
-#include "listbox.qc"
-CLASS(XonoticCreditsList, XonoticListBox)
-       METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity));
-       ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
-       METHOD(XonoticCreditsList, draw, void(entity));
-       METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticCreditsList, destroy, void(entity));
-       ATTRIB(XonoticCreditsList, selectionDoesntMatter, bool, true)
-
-       ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
-       ATTRIB(XonoticCreditsList, bufferIndex, float, 0)
-       ATTRIB(XonoticCreditsList, scrolling, float, 0)
-
-       ATTRIB(XonoticCreditsList, alphaBG, float, 0)
-ENDCLASS(XonoticCreditsList)
-entity makeXonoticCreditsList();
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticCreditsList()
 {
        entity me;
@@ -458,4 +435,3 @@ float XonoticCreditsList_keyDown(entity me, float key, float ascii, float shift)
        me.scrolling = 0;
        return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/credits.qh b/qcsrc/menu/xonotic/credits.qh
new file mode 100644 (file)
index 0000000..d376bea
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticCreditsList, XonoticListBox)
+       METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity));
+       ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
+       METHOD(XonoticCreditsList, draw, void(entity));
+       METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticCreditsList, destroy, void(entity));
+       ATTRIB(XonoticCreditsList, selectionDoesntMatter, bool, true)
+
+       ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
+       ATTRIB(XonoticCreditsList, bufferIndex, float, 0)
+       ATTRIB(XonoticCreditsList, scrolling, float, 0)
+
+       ATTRIB(XonoticCreditsList, alphaBG, float, 0)
+ENDCLASS(XonoticCreditsList)
+entity makeXonoticCreditsList();
+
+int credits_get();
index 63da9cd92ae56980bf6db6ba9c29925eb08ab54e..31814125904ae84ee663c892c7ea6de98ba11c48 100644 (file)
@@ -1,20 +1,4 @@
-#ifndef CROSSHAIRPICKER_H
-#define CROSSHAIRPICKER_H
-#include "picker.qc"
-CLASS(XonoticCrosshairPicker, XonoticPicker)
-       METHOD(XonoticCrosshairPicker, configureXonoticCrosshairPicker, void(entity));
-
-       ATTRIB(XonoticCrosshairPicker, rows, float, 3)
-       ATTRIB(XonoticCrosshairPicker, columns, float, 12)
-
-       METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector));
-       METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector));
-       METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector));
-ENDCLASS(XonoticCrosshairPicker)
-entity makeXonoticCrosshairPicker();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "crosshairpicker.qh"
 
 string crosshairpicker_cellToCrosshair(entity me, vector cell)
 {
@@ -75,4 +59,3 @@ void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos)
        if(cvar("crosshair_dot"))
                draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/crosshairpicker.qh b/qcsrc/menu/xonotic/crosshairpicker.qh
new file mode 100644 (file)
index 0000000..b6f3945
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "picker.qh"
+CLASS(XonoticCrosshairPicker, XonoticPicker)
+       METHOD(XonoticCrosshairPicker, configureXonoticCrosshairPicker, void(entity));
+
+       ATTRIB(XonoticCrosshairPicker, rows, float, 3)
+       ATTRIB(XonoticCrosshairPicker, columns, float, 12)
+
+       METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector));
+       METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector));
+       METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector));
+ENDCLASS(XonoticCrosshairPicker)
+entity makeXonoticCrosshairPicker();
index 90694ca8c3a607ade663a6afe1906cab796751ca..e11d7dcc0f04d4f9401edbb4d16273b823162542 100644 (file)
@@ -1,18 +1,5 @@
-#ifndef CROSSHAIRPREVIEW_H
-#define CROSSHAIRPREVIEW_H
-#include "../item.qc"
-CLASS(XonoticCrosshairPreview, Item)
-       METHOD(XonoticCrosshairPreview, configureXonoticCrosshairPreview, void(entity));
-       METHOD(XonoticCrosshairPreview, draw, void(entity));
-       ATTRIB(XonoticCrosshairPreview, src, string, string_null)
-       ATTRIB(XonoticCrosshairPreview, src2, string, string_null)
-       ATTRIB(XonoticCrosshairPreview, disabled, float, 0)
-       ATTRIB(XonoticCrosshairPreview, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCrosshairPreview)
-entity makeXonoticCrosshairPreview();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "crosshairpreview.qh"
+
 entity makeXonoticCrosshairPreview()
 {
        entity me;
@@ -59,4 +46,3 @@ void XonoticCrosshairPreview_draw(entity me)
 
        SUPER(XonoticCrosshairPreview).draw(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/crosshairpreview.qh b/qcsrc/menu/xonotic/crosshairpreview.qh
new file mode 100644 (file)
index 0000000..dcc7be5
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "../item.qh"
+CLASS(XonoticCrosshairPreview, Item)
+       METHOD(XonoticCrosshairPreview, configureXonoticCrosshairPreview, void(entity));
+       METHOD(XonoticCrosshairPreview, draw, void(entity));
+       ATTRIB(XonoticCrosshairPreview, src, string, string_null)
+       ATTRIB(XonoticCrosshairPreview, src2, string, string_null)
+       ATTRIB(XonoticCrosshairPreview, disabled, float, 0)
+       ATTRIB(XonoticCrosshairPreview, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCrosshairPreview)
+entity makeXonoticCrosshairPreview();
index 11e88a4e688a6b92cb075c6f11c58419b5023c6d..956285ec8b71f218da1e95ef9ddca1658c22b8ac 100644 (file)
@@ -1,49 +1,8 @@
-#ifndef CVARLIST_H
-#define CVARLIST_H
-#include "listbox.qc"
-CLASS(XonoticCvarList, XonoticListBox)
-       METHOD(XonoticCvarList, configureXonoticCvarList, void(entity));
-       ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
-       METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticCvarList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticCvarList, showNotify, void(entity));
+#include "cvarlist.qh"
 
-       METHOD(XonoticCvarList, destroy, void(entity));
+#include "inputbox.qh"
+#include "../item/container.qh"
 
-       ATTRIB(XonoticCvarList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCvarList, realUpperMargin, float, 0)
-       ATTRIB(XonoticCvarList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticCvarList, columnNameSize, float, 0)
-       ATTRIB(XonoticCvarList, columnValueOrigin, float, 0)
-       ATTRIB(XonoticCvarList, columnValueSize, float, 0)
-
-       METHOD(XonoticCvarList, mouseRelease, float(entity, vector));
-       METHOD(XonoticCvarList, setSelected, void(entity, float));
-       METHOD(XonoticCvarList, updateCvarType, float(entity));
-
-       ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarTypeBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarValueBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarDefaultBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarNeedsForcing, float, 0)
-
-       ATTRIB(XonoticCvarList, handle, float, -1)
-       ATTRIB(XonoticCvarList, cvarName, string, string_null)
-       ATTRIB(XonoticCvarList, cvarDescription, string, string_null)
-       ATTRIB(XonoticCvarList, cvarType, string, string_null)
-       ATTRIB(XonoticCvarList, cvarDefault, string, string_null)
-ENDCLASS(XonoticCvarList)
-entity makeXonoticCvarList();
-void CvarList_Filter_Change(entity box, entity me);
-void CvarList_Value_Change(entity box, entity me);
-void CvarList_Revert_Click(entity btn, entity me);
-void CvarList_End_Editing(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticCvarList()
 {
        entity me;
@@ -265,5 +224,3 @@ void CvarList_End_Editing(entity box, entity me)
 {
        box.parent.setFocus(box.parent, me);
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/cvarlist.qh b/qcsrc/menu/xonotic/cvarlist.qh
new file mode 100644 (file)
index 0000000..4bc56b3
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticCvarList, XonoticListBox)
+       METHOD(XonoticCvarList, configureXonoticCvarList, void(entity));
+       ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
+       METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticCvarList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticCvarList, showNotify, void(entity));
+
+       METHOD(XonoticCvarList, destroy, void(entity));
+
+       ATTRIB(XonoticCvarList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCvarList, realUpperMargin, float, 0)
+       ATTRIB(XonoticCvarList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticCvarList, columnNameSize, float, 0)
+       ATTRIB(XonoticCvarList, columnValueOrigin, float, 0)
+       ATTRIB(XonoticCvarList, columnValueSize, float, 0)
+
+       METHOD(XonoticCvarList, mouseRelease, float(entity, vector));
+       METHOD(XonoticCvarList, setSelected, void(entity, float));
+       METHOD(XonoticCvarList, updateCvarType, float(entity));
+
+       ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarTypeBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarValueBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarDefaultBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarNeedsForcing, float, 0)
+
+       ATTRIB(XonoticCvarList, handle, float, -1)
+       ATTRIB(XonoticCvarList, cvarName, string, string_null)
+       ATTRIB(XonoticCvarList, cvarDescription, string, string_null)
+       ATTRIB(XonoticCvarList, cvarType, string, string_null)
+       ATTRIB(XonoticCvarList, cvarDefault, string, string_null)
+ENDCLASS(XonoticCvarList)
+entity makeXonoticCvarList();
+void CvarList_Filter_Change(entity box, entity me);
+void CvarList_Value_Change(entity box, entity me);
+void CvarList_Revert_Click(entity btn, entity me);
+void CvarList_End_Editing(entity box, entity me);
index 3b8be8d27b0a4d57bb441136688e2411b392223b..d51a1f74893682130152f79b07a742747165fcc2 100644 (file)
@@ -1,30 +1,5 @@
-#ifndef DATASOURCE_H
-#define DATASOURCE_H
-CLASS(DataSource, Object)
-    entity DataSource_true;
-    entity DataSource_false;
-    INIT_STATIC(DataSource) {
-        DataSource_true = NEW(Object);
-        DataSource_false = NULL;
-    }
-    /**
-     * get entry `i` passing `name` and `icon` through `returns` if it is not null
-     * returns `DataSource_false` if out of bounds
-     * otherwise returns an entity or `DataSource_true`
-     */
-    METHOD(DataSource, getEntry, entity(entity this, int i, void(string name, string icon) returns)) { return DataSource_false; }
-    /** return the index of the first match for `find`. optional */
-    METHOD(DataSource, indexOf, int(entity this, string find)) { return -1; }
-    /** reload all entries matching `filter` returning how many matches were found */
-    METHOD(DataSource, reload, int(entity this, string filter)) { return 0; }
-    /** cleanup on shutdown. optional */
-    METHOD(DataSource, destroy, void(entity this)) { }
-ENDCLASS(DataSource)
-
+#include "datasource.qh"
 
-CLASS(StringSource, DataSource)
-    ATTRIB(StringSource, StringSource_str, string, string_null)
-    ATTRIB(StringSource, StringSource_sep, string, string_null)
     CONSTRUCTOR(StringSource, string str, string sep)
     {
         CONSTRUCT(StringSource);
@@ -43,10 +18,7 @@ CLASS(StringSource, DataSource)
     {
         return tokenizebyseparator(this.StringSource_str, this.StringSource_sep);
     }
-ENDCLASS(StringSource)
 
-CLASS(CvarStringSource, StringSource)
-    ATTRIB(CvarStringSource, CvarStringSource_cvar, string, string_null)
     CONSTRUCTOR(CvarStringSource, string cv, string sep)
     {
         CONSTRUCT(CvarStringSource);
@@ -65,5 +37,3 @@ CLASS(CvarStringSource, StringSource)
         this.StringSource_str = s ? cvar_string(s) : string_null;
         return SUPER(CvarStringSource).reload(this, filter);
     }
-ENDCLASS(CvarStringSource)
-#endif
diff --git a/qcsrc/menu/xonotic/datasource.qh b/qcsrc/menu/xonotic/datasource.qh
new file mode 100644 (file)
index 0000000..1ca3d58
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once
+
+CLASS(DataSource, Object)
+    STATIC_ATTRIB(DataSource, true, entity, NEW(Object));
+    STATIC_ATTRIB(DataSource, false, entity, NULL);
+    /**
+     * get entry `i` passing `name` and `icon` through `returns` if it is not null
+     * returns `DataSource_false` if out of bounds
+     * otherwise returns an entity or `DataSource_true`
+     */
+    METHOD(DataSource, getEntry, entity(entity this, int i, void(string name, string icon) returns)) { return DataSource_false; }
+    /** return the index of the first match for `find`. optional */
+    METHOD(DataSource, indexOf, int(entity this, string find)) { return -1; }
+    /** reload all entries matching `filter` returning how many matches were found */
+    METHOD(DataSource, reload, int(entity this, string filter)) { return 0; }
+    /** cleanup on shutdown. optional */
+    METHOD(DataSource, destroy, void(entity this)) { }
+ENDCLASS(DataSource)
+
+
+CLASS(StringSource, DataSource)
+    ATTRIB(StringSource, StringSource_str, string, string_null)
+    ATTRIB(StringSource, StringSource_sep, string, string_null)
+    CONSTRUCTOR(StringSource, string str, string sep);
+    METHOD(StringSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
+    METHOD(StringSource, reload, int(entity this, string filter));
+ENDCLASS(StringSource)
+
+CLASS(CvarStringSource, StringSource)
+    ATTRIB(CvarStringSource, CvarStringSource_cvar, string, string_null)
+    CONSTRUCTOR(CvarStringSource, string cv, string sep);
+    METHOD(CvarStringSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
+    METHOD(CvarStringSource, reload, int(entity this, string filter));
+ENDCLASS(CvarStringSource)
index 9f8978c14b1159e7d589fb23ed7c2d561a0be8e0..b527542a5965b1408ed6e299c856ccb414b846df 100644 (file)
@@ -1,41 +1,6 @@
-#ifndef DEMOLIST_H
-#define DEMOLIST_H
-#include "listbox.qc"
-CLASS(XonoticDemoList, XonoticListBox)
-       METHOD(XonoticDemoList, configureXonoticDemoList, void(entity));
-       ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
-       METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticDemoList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticDemoList, getDemos, void(entity));
-       METHOD(XonoticDemoList, startDemo, void(entity));
-       METHOD(XonoticDemoList, timeDemo, void(entity));
-       METHOD(XonoticDemoList, demoName, string(entity, float));
-       METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticDemoList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticDemoList, destroy, void(entity));
-       METHOD(XonoticDemoList, showNotify, void(entity));
-
-       ATTRIB(XonoticDemoList, listDemo, float, -1)
-       ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticDemoList, columnNameSize, float, 0)
-       ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
-       ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
-       ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticDemoList, filterString, string, string_null)
-ENDCLASS(XonoticDemoList)
-
-#ifndef IMPLEMENTATION
-// public:
-entity demolist; // for reference elsewhere
-entity makeXonoticDemoList();
-#endif
-void DemoList_Refresh_Click(entity btn, entity me);
-void DemoList_Filter_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "demolist.qh"
+
+#include "inputbox.qh"
 
 entity makeXonoticDemoList()
 {
@@ -232,5 +197,3 @@ float XonoticDemoList_keyDown(entity me, float scan, float ascii, float shift)
                return SUPER(XonoticDemoList).keyDown(me, scan, ascii, shift);
        }
 }
-#endif
-
diff --git a/qcsrc/menu/xonotic/demolist.qh b/qcsrc/menu/xonotic/demolist.qh
new file mode 100644 (file)
index 0000000..547bf66
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "mainwindow.qh"
+#include "listbox.qh"
+CLASS(XonoticDemoList, XonoticListBox)
+       METHOD(XonoticDemoList, configureXonoticDemoList, void(entity));
+       ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
+       METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticDemoList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticDemoList, getDemos, void(entity));
+       METHOD(XonoticDemoList, startDemo, void(entity));
+       METHOD(XonoticDemoList, timeDemo, void(entity));
+       METHOD(XonoticDemoList, demoName, string(entity, float));
+       METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticDemoList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticDemoList, destroy, void(entity));
+       METHOD(XonoticDemoList, showNotify, void(entity));
+
+       ATTRIB(XonoticDemoList, listDemo, float, -1)
+       ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticDemoList, columnNameSize, float, 0)
+       ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
+       ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
+       ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticDemoList, filterString, string, string_null)
+ENDCLASS(XonoticDemoList)
+
+entity demolist;  // for reference elsewhere
+entity makeXonoticDemoList();
+void DemoList_Refresh_Click(entity btn, entity me);
+void DemoList_Filter_Change(entity box, entity me);
index 7395071344cfa9b5b7d083b2229e9366e843f52e..6b5e7a1c82d732c4dd5b179d790032f9916ef31c 100644 (file)
@@ -1,45 +1,7 @@
-#ifndef DIALOG_H
-#define DIALOG_H
-#include "../item/dialog.qc"
-CLASS(XonoticDialog, Dialog)
-       // still to be customized by user
-       /*
-       ATTRIB(XonoticDialog, closable, float, 1)
-       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
-       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
-       ATTRIB(XonoticDialog, intendedWidth, float, 0)
-       ATTRIB(XonoticDialog, rows, float, 3)
-       ATTRIB(XonoticDialog, columns, float, 2)
-       */
-       ATTRIB(XonoticDialog, marginTop, float, SKINMARGIN_TOP) // pixels
-       ATTRIB(XonoticDialog, marginBottom, float, SKINMARGIN_BOTTOM) // pixels
-       ATTRIB(XonoticDialog, marginLeft, float, SKINMARGIN_LEFT) // pixels
-       ATTRIB(XonoticDialog, marginRight, float, SKINMARGIN_RIGHT) // pixels
-       ATTRIB(XonoticDialog, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
-       ATTRIB(XonoticDialog, rowSpacing, float, SKINMARGIN_ROWS) // pixels
-       ATTRIB(XonoticDialog, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
-       ATTRIB(XonoticDialog, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
-       ATTRIB(XonoticDialog, titleFontSize, float, SKINFONTSIZE_TITLE) // pixels
+#include "dialog.qh"
 
-       ATTRIB(XonoticDialog, backgroundImage, string, SKINGFX_DIALOGBORDER)
-       ATTRIB(XonoticDialog, borderLines, float, SKINHEIGHT_DIALOGBORDER)
-       ATTRIB(XonoticDialog, closeButtonImage, string, SKINGFX_CLOSEBUTTON)
-       ATTRIB(XonoticDialog, zoomedOutTitleBarPosition, float, SKINHEIGHT_ZOOMEDTITLE * 0.5 - 0.5)
-       ATTRIB(XonoticDialog, zoomedOutTitleBar, float, SKINHEIGHT_ZOOMEDTITLE != 0)
-
-       ATTRIB(XonoticDialog, alpha, float, SKINALPHA_TEXT)
-
-       METHOD(XonoticDialog, configureDialog, void(entity));
-ENDCLASS(XonoticDialog)
-#ifndef IMPLEMENTATION
-entity currentDialog;
-#endif
-#endif
-
-#ifdef IMPLEMENTATION
 void XonoticDialog_configureDialog(entity me)
 {
        currentDialog = me;
        SUPER(XonoticDialog).configureDialog(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog.qh b/qcsrc/menu/xonotic/dialog.qh
new file mode 100644 (file)
index 0000000..a361269
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "../item/dialog.qh"
+CLASS(XonoticDialog, Dialog)
+       // still to be customized by user
+       /*
+       ATTRIB(XonoticDialog, closable, float, 1)
+       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
+       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
+       ATTRIB(XonoticDialog, intendedWidth, float, 0)
+       ATTRIB(XonoticDialog, rows, float, 3)
+       ATTRIB(XonoticDialog, columns, float, 2)
+       */
+       ATTRIB(XonoticDialog, marginTop, float, SKINMARGIN_TOP)                          // pixels
+       ATTRIB(XonoticDialog, marginBottom, float, SKINMARGIN_BOTTOM)                    // pixels
+       ATTRIB(XonoticDialog, marginLeft, float, SKINMARGIN_LEFT)                        // pixels
+       ATTRIB(XonoticDialog, marginRight, float, SKINMARGIN_RIGHT)                      // pixels
+       ATTRIB(XonoticDialog, columnSpacing, float, SKINMARGIN_COLUMNS)                  // pixels
+       ATTRIB(XonoticDialog, rowSpacing, float, SKINMARGIN_ROWS)                        // pixels
+       ATTRIB(XonoticDialog, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+       ATTRIB(XonoticDialog, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
+       ATTRIB(XonoticDialog, titleFontSize, float, SKINFONTSIZE_TITLE)                  // pixels
+
+       ATTRIB(XonoticDialog, backgroundImage, string, SKINGFX_DIALOGBORDER)
+       ATTRIB(XonoticDialog, borderLines, float, SKINHEIGHT_DIALOGBORDER)
+       ATTRIB(XonoticDialog, closeButtonImage, string, SKINGFX_CLOSEBUTTON)
+       ATTRIB(XonoticDialog, zoomedOutTitleBarPosition, float, SKINHEIGHT_ZOOMEDTITLE * 0.5 - 0.5)
+       ATTRIB(XonoticDialog, zoomedOutTitleBar, float, SKINHEIGHT_ZOOMEDTITLE != 0)
+
+       ATTRIB(XonoticDialog, alpha, float, SKINALPHA_TEXT)
+
+       METHOD(XonoticDialog, configureDialog, void(entity));
+ENDCLASS(XonoticDialog)
+
+entity currentDialog;
index 9559211b05bf08384481e9866be6d7f5b0b26a1a..16469dbdd2cbdb53f4bfaf7cdcc8bf43bda71012 100644 (file)
@@ -1,20 +1,9 @@
-#ifndef DIALOG_CREDITS_H
-#define DIALOG_CREDITS_H
-#include "dialog.qc"
-CLASS(XonoticCreditsDialog, XonoticDialog)
-       METHOD(XonoticCreditsDialog, fill, void(entity));
-       METHOD(XonoticCreditsDialog, focusEnter, void(entity));
-       ATTRIB(XonoticCreditsDialog, title, string, _("Credits"))
-       ATTRIB(XonoticCreditsDialog, tooltip, string, _("The Xonotic credits"))
-       ATTRIB(XonoticCreditsDialog, color, vector, SKINCOLOR_DIALOG_CREDITS)
-       ATTRIB(XonoticCreditsDialog, intendedWidth, float, SKINWIDTH_CREDITS)
-       ATTRIB(XonoticCreditsDialog, rows, float, SKINROWS_CREDITS)
-       ATTRIB(XonoticCreditsDialog, columns, float, 2)
-       ATTRIB(XonoticCreditsDialog, creditsList, entity, NULL)
-ENDCLASS(XonoticCreditsDialog)
-#endif
+#include "dialog_credits.qh"
+
+#include "credits.qh"
+#include "button.qh"
+#include "../item/dialog.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticCreditsDialog_fill(entity me)
 {
        entity e;
@@ -29,4 +18,3 @@ void XonoticCreditsDialog_focusEnter(entity me)
 {
        me.creditsList.scrolling = time + 1;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_credits.qh b/qcsrc/menu/xonotic/dialog_credits.qh
new file mode 100644 (file)
index 0000000..90d722e
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticCreditsDialog, XonoticDialog)
+       METHOD(XonoticCreditsDialog, fill, void(entity));
+       METHOD(XonoticCreditsDialog, focusEnter, void(entity));
+       ATTRIB(XonoticCreditsDialog, title, string, _("Credits"))
+       ATTRIB(XonoticCreditsDialog, tooltip, string, _("The Xonotic credits"))
+       ATTRIB(XonoticCreditsDialog, color, vector, SKINCOLOR_DIALOG_CREDITS)
+       ATTRIB(XonoticCreditsDialog, intendedWidth, float, SKINWIDTH_CREDITS)
+       ATTRIB(XonoticCreditsDialog, rows, float, SKINROWS_CREDITS)
+       ATTRIB(XonoticCreditsDialog, columns, float, 2)
+       ATTRIB(XonoticCreditsDialog, creditsList, entity, NULL)
+ENDCLASS(XonoticCreditsDialog)
index 6b597a7a33893b460966e2778b394af80a2bc1fe..0d3b5c97512ef212be117cebc8f90ae6424be842 100644 (file)
@@ -1,22 +1,13 @@
-#ifndef DIALOG_FIRSTRUN_H
-#define DIALOG_FIRSTRUN_H
-#include "rootdialog.qc"
-CLASS(XonoticFirstRunDialog, XonoticRootDialog)
-       METHOD(XonoticFirstRunDialog, fill, void(entity));
-       ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
-       ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
-       ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.7)
-       ATTRIB(XonoticFirstRunDialog, rows, float, 16)
-       ATTRIB(XonoticFirstRunDialog, columns, float, 6)
-       ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
-       ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
-       ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
+#include "dialog_firstrun.qh"
 
-       ATTRIB(XonoticFirstRunDialog, closable, float, 0)
-ENDCLASS(XonoticFirstRunDialog)
-#endif
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "languagelist.qh"
+#include "radiobutton.qh"
+#include "colorpicker.qh"
+#include "charmap.qh"
+#include "commandbutton.qh"
 
-#ifdef IMPLEMENTATION
 float CheckFirstRunButton(entity me)
 {
        if(cvar_string("_cl_name") != cvar_defstring("_cl_name"))
@@ -97,4 +88,3 @@ void XonoticFirstRunDialog_fill(entity me)
        me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart", COMMANDBUTTON_APPLY));
                setDependentWeird(e, CheckFirstRunButton);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_firstrun.qh b/qcsrc/menu/xonotic/dialog_firstrun.qh
new file mode 100644 (file)
index 0000000..ff7099b
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticFirstRunDialog, XonoticRootDialog)
+       METHOD(XonoticFirstRunDialog, fill, void(entity));
+       ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
+       ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
+       ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.7)
+       ATTRIB(XonoticFirstRunDialog, rows, float, 16)
+       ATTRIB(XonoticFirstRunDialog, columns, float, 6)
+       ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
+       ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
+       ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
+
+       ATTRIB(XonoticFirstRunDialog, closable, float, 0)
+ENDCLASS(XonoticFirstRunDialog)
index dd54f14efc423796ff215ee3bc176033250c1345..2e67e7acf861294bb39a6d97bf2a5155e008eaac 100644 (file)
@@ -1,19 +1,10 @@
-#ifndef DIALOG_HUDPANEL_AMMO_H
-#define DIALOG_HUDPANEL_AMMO_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDAmmoDialog, XonoticRootDialog)
-       METHOD(XonoticHUDAmmoDialog, fill, void(entity));
-       ATTRIB(XonoticHUDAmmoDialog, title, string, _("Ammo Panel"))
-       ATTRIB(XonoticHUDAmmoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDAmmoDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDAmmoDialog, rows, float, 15)
-       ATTRIB(XonoticHUDAmmoDialog, columns, float, 4)
-       ATTRIB(XonoticHUDAmmoDialog, name, string, "HUDammo")
-       ATTRIB(XonoticHUDAmmoDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDAmmoDialog)
-#endif
+#include "dialog_hudpanel_ammo.qh"
+
+#include "slider.qh"
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDAmmoDialog_fill(entity me)
 {
        entity e;
@@ -40,4 +31,3 @@ void XonoticHUDAmmoDialog_fill(entity me)
                        me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "0", _("Left")));
                        me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "1", _("Right")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_ammo.qh b/qcsrc/menu/xonotic/dialog_hudpanel_ammo.qh
new file mode 100644 (file)
index 0000000..237bcbb
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDAmmoDialog, XonoticRootDialog)
+       METHOD(XonoticHUDAmmoDialog, fill, void(entity));
+       ATTRIB(XonoticHUDAmmoDialog, title, string, _("Ammo Panel"))
+       ATTRIB(XonoticHUDAmmoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDAmmoDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDAmmoDialog, rows, float, 15)
+       ATTRIB(XonoticHUDAmmoDialog, columns, float, 4)
+       ATTRIB(XonoticHUDAmmoDialog, name, string, "HUDammo")
+       ATTRIB(XonoticHUDAmmoDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDAmmoDialog)
index c888fa733627436b254f9f03f297f77069a43987..332f6753f76d62273411801ab6cd584f46077a9a 100644 (file)
@@ -1,19 +1,10 @@
-#ifndef DIALOG_HUDPANEL_CENTERPRINT_H
-#define DIALOG_HUDPANEL_CENTERPRINT_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDCenterprintDialog, XonoticRootDialog)
-       METHOD(XonoticHUDCenterprintDialog, fill, void(entity));
-       ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel"))
-       ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDCenterprintDialog, rows, float, 15)
-       ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4)
-       ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint")
-       ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDCenterprintDialog)
-#endif
+#include "dialog_hudpanel_centerprint.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDCenterprintDialog_fill(entity me)
 {
        entity e;
@@ -44,4 +35,3 @@ void XonoticHUDCenterprintDialog_fill(entity me)
                me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Font scale:")));
                me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 2, 0.1, "hud_panel_centerprint_fontscale"));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh
new file mode 100644 (file)
index 0000000..370dbe4
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDCenterprintDialog, XonoticRootDialog)
+       METHOD(XonoticHUDCenterprintDialog, fill, void(entity));
+       ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel"))
+       ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDCenterprintDialog, rows, float, 15)
+       ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4)
+       ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint")
+       ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDCenterprintDialog)
index 4c18f206653265318b5fa2d37a20f2be29650f7c..1ffa41f68c802d9c1cdb96995f2aa50619db762e 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_CHAT_H
-#define DIALOG_HUDPANEL_CHAT_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDChatDialog, XonoticRootDialog)
-       METHOD(XonoticHUDChatDialog, fill, void(entity));
-       ATTRIB(XonoticHUDChatDialog, title, string, _("Chat Panel"))
-       ATTRIB(XonoticHUDChatDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDChatDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDChatDialog, rows, float, 15)
-       ATTRIB(XonoticHUDChatDialog, columns, float, 4)
-       ATTRIB(XonoticHUDChatDialog, name, string, "HUDchat")
-       ATTRIB(XonoticHUDChatDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDChatDialog)
-#endif
+#include "dialog_hudpanel_chat.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDChatDialog_fill(entity me)
 {
        entity e;
@@ -35,4 +25,3 @@ void XonoticHUDChatDialog_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "con_chatsound", _("Chat beep sound")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_chat.qh b/qcsrc/menu/xonotic/dialog_hudpanel_chat.qh
new file mode 100644 (file)
index 0000000..b30ea9f
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDChatDialog, XonoticRootDialog)
+       METHOD(XonoticHUDChatDialog, fill, void(entity));
+       ATTRIB(XonoticHUDChatDialog, title, string, _("Chat Panel"))
+       ATTRIB(XonoticHUDChatDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDChatDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDChatDialog, rows, float, 15)
+       ATTRIB(XonoticHUDChatDialog, columns, float, 4)
+       ATTRIB(XonoticHUDChatDialog, name, string, "HUDchat")
+       ATTRIB(XonoticHUDChatDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDChatDialog)
index df9165e814871f689574dff9f2618a052c72d4aa..b46d3aa02eff1fbd791331d3ac731c394506f426 100644 (file)
@@ -1,19 +1,8 @@
-#ifndef DIALOG_HUDPANEL_ENGINEINFO_H
-#define DIALOG_HUDPANEL_ENGINEINFO_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDEngineInfoDialog, XonoticRootDialog)
-       METHOD(XonoticHUDEngineInfoDialog, fill, void(entity));
-       ATTRIB(XonoticHUDEngineInfoDialog, title, string, _("Engine Info Panel"))
-       ATTRIB(XonoticHUDEngineInfoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDEngineInfoDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDEngineInfoDialog, rows, float, 15)
-       ATTRIB(XonoticHUDEngineInfoDialog, columns, float, 4)
-       ATTRIB(XonoticHUDEngineInfoDialog, name, string, "HUDengineinfo")
-       ATTRIB(XonoticHUDEngineInfoDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDEngineInfoDialog)
-#endif
+#include "dialog_hudpanel_engineinfo.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDEngineInfoDialog_fill(entity me)
 {
        entity e;
@@ -27,4 +16,3 @@ void XonoticHUDEngineInfoDialog_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_engineinfo_framecounter_exponentialmovingaverage", _("Use an averaging algorithm for fps")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qh b/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qh
new file mode 100644 (file)
index 0000000..a28897d
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDEngineInfoDialog, XonoticRootDialog)
+       METHOD(XonoticHUDEngineInfoDialog, fill, void(entity));
+       ATTRIB(XonoticHUDEngineInfoDialog, title, string, _("Engine Info Panel"))
+       ATTRIB(XonoticHUDEngineInfoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDEngineInfoDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDEngineInfoDialog, rows, float, 15)
+       ATTRIB(XonoticHUDEngineInfoDialog, columns, float, 4)
+       ATTRIB(XonoticHUDEngineInfoDialog, name, string, "HUDengineinfo")
+       ATTRIB(XonoticHUDEngineInfoDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDEngineInfoDialog)
index d576e237249c65bd367fae42a58f59b1811a4759..c158ebabfca0309288fbc2f1537434b450bc2bba 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_HEALTHARMOR_H
-#define DIALOG_HUDPANEL_HEALTHARMOR_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDHealthArmorDialog, XonoticRootDialog)
-       METHOD(XonoticHUDHealthArmorDialog, fill, void(entity));
-       ATTRIB(XonoticHUDHealthArmorDialog, title, string, _("Health/Armor Panel"))
-       ATTRIB(XonoticHUDHealthArmorDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDHealthArmorDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDHealthArmorDialog, rows, float, 15)
-       ATTRIB(XonoticHUDHealthArmorDialog, columns, float, 4)
-       ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
-       ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDHealthArmorDialog)
-#endif
+#include "dialog_hudpanel_healtharmor.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDHealthArmorDialog_fill(entity me)
 {
        entity e;
@@ -47,4 +37,3 @@ void XonoticHUDHealthArmorDialog_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_flip", _("Flip health and armor positions")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qh b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qh
new file mode 100644 (file)
index 0000000..68ffe79
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDHealthArmorDialog, XonoticRootDialog)
+       METHOD(XonoticHUDHealthArmorDialog, fill, void(entity));
+       ATTRIB(XonoticHUDHealthArmorDialog, title, string, _("Health/Armor Panel"))
+       ATTRIB(XonoticHUDHealthArmorDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDHealthArmorDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDHealthArmorDialog, rows, float, 15)
+       ATTRIB(XonoticHUDHealthArmorDialog, columns, float, 4)
+       ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
+       ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDHealthArmorDialog)
index 33b4ca9b7ace930fe8d2793bd5ef06095ee9272b..d758ad206643dcdba154fbfe48be74eca5726b58 100644 (file)
@@ -1,19 +1,8 @@
-#ifndef DIALOG_HUDPANEL_INFOMESSAGES_H
-#define DIALOG_HUDPANEL_INFOMESSAGES_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDInfoMessagesDialog, XonoticRootDialog)
-       METHOD(XonoticHUDInfoMessagesDialog, fill, void(entity));
-       ATTRIB(XonoticHUDInfoMessagesDialog, title, string, _("Info Messages Panel"))
-       ATTRIB(XonoticHUDInfoMessagesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDInfoMessagesDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDInfoMessagesDialog, rows, float, 15)
-       ATTRIB(XonoticHUDInfoMessagesDialog, columns, float, 4)
-       ATTRIB(XonoticHUDInfoMessagesDialog, name, string, "HUDinfomessages")
-       ATTRIB(XonoticHUDInfoMessagesDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDInfoMessagesDialog)
-#endif
+#include "dialog_hudpanel_infomessages.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDInfoMessagesDialog_fill(entity me)
 {
        entity e;
@@ -27,4 +16,3 @@ void XonoticHUDInfoMessagesDialog_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_infomessages_flip", _("Flip align")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qh b/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qh
new file mode 100644 (file)
index 0000000..093bc00
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDInfoMessagesDialog, XonoticRootDialog)
+       METHOD(XonoticHUDInfoMessagesDialog, fill, void(entity));
+       ATTRIB(XonoticHUDInfoMessagesDialog, title, string, _("Info Messages Panel"))
+       ATTRIB(XonoticHUDInfoMessagesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDInfoMessagesDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDInfoMessagesDialog, rows, float, 15)
+       ATTRIB(XonoticHUDInfoMessagesDialog, columns, float, 4)
+       ATTRIB(XonoticHUDInfoMessagesDialog, name, string, "HUDinfomessages")
+       ATTRIB(XonoticHUDInfoMessagesDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDInfoMessagesDialog)
index 1124044e362e23e57ee719688f6ab8e4088505e5..f06038377561bb5fea908ac39e0e8e6c12370c00 100644 (file)
@@ -1,18 +1,11 @@
-#ifndef DIALOG_HUDPANEL_ITEMSTIME_H
-#define DIALOG_HUDPANEL_ITEMSTIME_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDItemsTimeDialog, XonoticRootDialog)
-       METHOD(XonoticHUDItemsTimeDialog, fill, void(entity));
-       ATTRIB(XonoticHUDItemsTimeDialog, title, string, _("Items Time Panel"))
-       ATTRIB(XonoticHUDItemsTimeDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDItemsTimeDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDItemsTimeDialog, rows, float, 15)
-       ATTRIB(XonoticHUDItemsTimeDialog, columns, float, 4)
-       ATTRIB(XonoticHUDItemsTimeDialog, name, string, "HUDitemstime")
-ENDCLASS(XonoticHUDItemsTimeDialog)
-#endif
+#include "dialog_hudpanel_itemstime.qh"
+
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "radiobutton.qh"
+#include "checkbox.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDItemsTimeDialog_fill(entity me)
 {
        entity e;
@@ -45,4 +38,3 @@ void XonoticHUDItemsTimeDialog_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_itemstime_dynamicsize", _("Dynamic size")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qh b/qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qh
new file mode 100644 (file)
index 0000000..71b53e6
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDItemsTimeDialog, XonoticRootDialog)
+       METHOD(XonoticHUDItemsTimeDialog, fill, void(entity));
+       ATTRIB(XonoticHUDItemsTimeDialog, title, string, _("Items Time Panel"))
+       ATTRIB(XonoticHUDItemsTimeDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDItemsTimeDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDItemsTimeDialog, rows, float, 15)
+       ATTRIB(XonoticHUDItemsTimeDialog, columns, float, 4)
+       ATTRIB(XonoticHUDItemsTimeDialog, name, string, "HUDitemstime")
+ENDCLASS(XonoticHUDItemsTimeDialog)
index 1fcefb72ff68e7369e9bd98ffce29b7a639746e5..53cad1a930383ca693df2d8c5aa2419255df556b 100644 (file)
@@ -1,19 +1,7 @@
-#ifndef DIALOG_HUDPANEL_MODICONS_H
-#define DIALOG_HUDPANEL_MODICONS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDModIconsDialog, XonoticRootDialog)
-       METHOD(XonoticHUDModIconsDialog, fill, void(entity));
-       ATTRIB(XonoticHUDModIconsDialog, title, string, _("Mod Icons Panel"))
-       ATTRIB(XonoticHUDModIconsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDModIconsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDModIconsDialog, rows, float, 15)
-       ATTRIB(XonoticHUDModIconsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDModIconsDialog, name, string, "HUDmodicons")
-       ATTRIB(XonoticHUDModIconsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDModIconsDialog)
-#endif
+#include "dialog_hudpanel_modicons.qh"
+
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDModIconsDialog_fill(entity me)
 {
        entity e;
@@ -21,4 +9,3 @@ void XonoticHUDModIconsDialog_fill(entity me)
 
        DIALOG_HUDPANEL_COMMON();
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_modicons.qh b/qcsrc/menu/xonotic/dialog_hudpanel_modicons.qh
new file mode 100644 (file)
index 0000000..feb36e2
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDModIconsDialog, XonoticRootDialog)
+       METHOD(XonoticHUDModIconsDialog, fill, void(entity));
+       ATTRIB(XonoticHUDModIconsDialog, title, string, _("Mod Icons Panel"))
+       ATTRIB(XonoticHUDModIconsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDModIconsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDModIconsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDModIconsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDModIconsDialog, name, string, "HUDmodicons")
+       ATTRIB(XonoticHUDModIconsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDModIconsDialog)
index 93d58d0bbc9179147e70728c52609c0f1ff110c1..490051846e378fd7835c50d684d9294083ef0ddc 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_NOTIFICATION_H
-#define DIALOG_HUDPANEL_NOTIFICATION_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDNotificationDialog, XonoticRootDialog)
-       METHOD(XonoticHUDNotificationDialog, fill, void(entity));
-       ATTRIB(XonoticHUDNotificationDialog, title, string, _("Notification Panel"))
-       ATTRIB(XonoticHUDNotificationDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDNotificationDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDNotificationDialog, rows, float, 15)
-       ATTRIB(XonoticHUDNotificationDialog, columns, float, 4)
-       ATTRIB(XonoticHUDNotificationDialog, name, string, "HUDnotify")
-       ATTRIB(XonoticHUDNotificationDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDNotificationDialog)
-#endif
+#include "dialog_hudpanel_notification.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDNotificationDialog_fill(entity me)
 {
        entity e;
@@ -38,4 +28,3 @@ void XonoticHUDNotificationDialog_fill(entity me)
                me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Entry fadetime:")));
                        me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 5, 0.5, "hud_panel_notify_fadetime"));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_notification.qh b/qcsrc/menu/xonotic/dialog_hudpanel_notification.qh
new file mode 100644 (file)
index 0000000..ad15007
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDNotificationDialog, XonoticRootDialog)
+       METHOD(XonoticHUDNotificationDialog, fill, void(entity));
+       ATTRIB(XonoticHUDNotificationDialog, title, string, _("Notification Panel"))
+       ATTRIB(XonoticHUDNotificationDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDNotificationDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDNotificationDialog, rows, float, 15)
+       ATTRIB(XonoticHUDNotificationDialog, columns, float, 4)
+       ATTRIB(XonoticHUDNotificationDialog, name, string, "HUDnotify")
+       ATTRIB(XonoticHUDNotificationDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDNotificationDialog)
index 394ab14bc96e4d83a3bb1eb6fa6dd51e510706f4..eabc93dab51021e7c44b1ac2cbe8dab9eda843ec 100644 (file)
@@ -1,20 +1,10 @@
-#ifndef DIALOG_HUDPANEL_PHYSICS_H
-#define DIALOG_HUDPANEL_PHYSICS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDPhysicsDialog, XonoticRootDialog)
-       METHOD(XonoticHUDPhysicsDialog, fill, void(entity));
-       ATTRIB(XonoticHUDPhysicsDialog, title, string, _("Physics Panel"))
-       ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
-       ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
-       ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
-       ATTRIB(XonoticHUDPhysicsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDPhysicsDialog)
-#endif
+#include "dialog_hudpanel_physics.qh"
+
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "checkbox.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDPhysicsDialog_fill(entity me)
 {
        entity e;
@@ -82,4 +72,3 @@ void XonoticHUDPhysicsDialog_fill(entity me)
                // me.TD(me, 1, 0.6, e = makeXonoticInputBox(1, "hud_panel_physics_acceleration_max"));
                        // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_physics.qh b/qcsrc/menu/xonotic/dialog_hudpanel_physics.qh
new file mode 100644 (file)
index 0000000..1d9c292
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPhysicsDialog, XonoticRootDialog)
+       METHOD(XonoticHUDPhysicsDialog, fill, void(entity));
+       ATTRIB(XonoticHUDPhysicsDialog, title, string, _("Physics Panel"))
+       ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
+       ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
+       ATTRIB(XonoticHUDPhysicsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPhysicsDialog)
index 85abb0f02c2c8676920a2b58f27c19c43d9f45aa..1b490d10272fdb3dc8bb28ee3d337b483afd751b 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_POWERUPS_H
-#define DIALOG_HUDPANEL_POWERUPS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDPowerupsDialog, XonoticRootDialog)
-       METHOD(XonoticHUDPowerupsDialog, fill, void(entity));
-       ATTRIB(XonoticHUDPowerupsDialog, title, string, _("Powerups Panel"))
-       ATTRIB(XonoticHUDPowerupsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDPowerupsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDPowerupsDialog, rows, float, 14)
-       ATTRIB(XonoticHUDPowerupsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDPowerupsDialog, name, string, "HUDpowerups")
-       ATTRIB(XonoticHUDPowerupsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDPowerupsDialog)
-#endif
+#include "dialog_hudpanel_powerups.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDPowerupsDialog_fill(entity me)
 {
        entity e;
@@ -45,4 +35,3 @@ void XonoticHUDPowerupsDialog_fill(entity me)
                        me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "2", _("Inward")));
                        me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "3", _("Outward")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_powerups.qh b/qcsrc/menu/xonotic/dialog_hudpanel_powerups.qh
new file mode 100644 (file)
index 0000000..ebb09b0
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPowerupsDialog, XonoticRootDialog)
+       METHOD(XonoticHUDPowerupsDialog, fill, void(entity));
+       ATTRIB(XonoticHUDPowerupsDialog, title, string, _("Powerups Panel"))
+       ATTRIB(XonoticHUDPowerupsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDPowerupsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDPowerupsDialog, rows, float, 14)
+       ATTRIB(XonoticHUDPowerupsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDPowerupsDialog, name, string, "HUDpowerups")
+       ATTRIB(XonoticHUDPowerupsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPowerupsDialog)
index 1de8e51c33d726c17f15374c6637878950e2a276..4e24ff998eeb67f2b0351d999056784898dfc7af 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_PRESSEDKEYS_H
-#define DIALOG_HUDPANEL_PRESSEDKEYS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDPressedKeysDialog, XonoticRootDialog)
-       METHOD(XonoticHUDPressedKeysDialog, fill, void(entity));
-       ATTRIB(XonoticHUDPressedKeysDialog, title, string, _("Pressed Keys Panel"))
-       ATTRIB(XonoticHUDPressedKeysDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDPressedKeysDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDPressedKeysDialog, rows, float, 15)
-       ATTRIB(XonoticHUDPressedKeysDialog, columns, float, 4)
-       ATTRIB(XonoticHUDPressedKeysDialog, name, string, "HUDpressedkeys")
-       ATTRIB(XonoticHUDPressedKeysDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDPressedKeysDialog)
-#endif
+#include "dialog_hudpanel_pressedkeys.qh"
+
+#include "textslider.qh"
+#include "slider.qh"
+#include "textlabel.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDPressedKeysDialog_fill(entity me)
 {
        entity e;
@@ -33,4 +23,3 @@ void XonoticHUDPressedKeysDialog_fill(entity me)
                me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Forced aspect:")));
                        me.TD(me, 1, 2.6, e = makeXonoticSlider(0.2, 4, 0.1, "hud_panel_pressedkeys_aspect"));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qh b/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qh
new file mode 100644 (file)
index 0000000..c4b7a90
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPressedKeysDialog, XonoticRootDialog)
+       METHOD(XonoticHUDPressedKeysDialog, fill, void(entity));
+       ATTRIB(XonoticHUDPressedKeysDialog, title, string, _("Pressed Keys Panel"))
+       ATTRIB(XonoticHUDPressedKeysDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDPressedKeysDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDPressedKeysDialog, rows, float, 15)
+       ATTRIB(XonoticHUDPressedKeysDialog, columns, float, 4)
+       ATTRIB(XonoticHUDPressedKeysDialog, name, string, "HUDpressedkeys")
+       ATTRIB(XonoticHUDPressedKeysDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPressedKeysDialog)
index 4d468452da31c77e952569c33d815a6f980766ec..4012bc61ac13b64975a57ff9c47e8bf356432af6 100644 (file)
@@ -1,18 +1,9 @@
-#ifndef DIALOG_HUDPANEL_QUICKMENU_H
-#define DIALOG_HUDPANEL_QUICKMENU_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDQuickMenuDialog, XonoticRootDialog)
-       METHOD(XonoticHUDQuickMenuDialog, fill, void(entity));
-       ATTRIB(XonoticHUDQuickMenuDialog, title, string, _("Quick Menu Panel"))
-       ATTRIB(XonoticHUDQuickMenuDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDQuickMenuDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDQuickMenuDialog, rows, float, 15)
-       ATTRIB(XonoticHUDQuickMenuDialog, columns, float, 4)
-       ATTRIB(XonoticHUDQuickMenuDialog, name, string, "HUDquickmenu")
-ENDCLASS(XonoticHUDQuickMenuDialog)
-#endif
+#include "dialog_hudpanel_quickmenu.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDQuickMenuDialog_fill(entity me)
 {
        entity e;
@@ -28,4 +19,3 @@ void XonoticHUDQuickMenuDialog_fill(entity me)
                        me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "0.5", _("Center")));
                        me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "1", _("Right")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_quickmenu.qh b/qcsrc/menu/xonotic/dialog_hudpanel_quickmenu.qh
new file mode 100644 (file)
index 0000000..396f62b
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDQuickMenuDialog, XonoticRootDialog)
+       METHOD(XonoticHUDQuickMenuDialog, fill, void(entity));
+       ATTRIB(XonoticHUDQuickMenuDialog, title, string, _("Quick Menu Panel"))
+       ATTRIB(XonoticHUDQuickMenuDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDQuickMenuDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDQuickMenuDialog, rows, float, 15)
+       ATTRIB(XonoticHUDQuickMenuDialog, columns, float, 4)
+       ATTRIB(XonoticHUDQuickMenuDialog, name, string, "HUDquickmenu")
+ENDCLASS(XonoticHUDQuickMenuDialog)
index 79a56230df9ec337f8519481ff4701b100675393..2673e546039a5afc5fb86d72e25e78193f1ce201 100644 (file)
@@ -1,19 +1,7 @@
-#ifndef DIALOG_HUDPANEL_RACETIMER_H
-#define DIALOG_HUDPANEL_RACETIMER_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDRaceTimerDialog, XonoticRootDialog)
-       METHOD(XonoticHUDRaceTimerDialog, fill, void(entity));
-       ATTRIB(XonoticHUDRaceTimerDialog, title, string, _("Race Timer Panel"))
-       ATTRIB(XonoticHUDRaceTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDRaceTimerDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDRaceTimerDialog, rows, float, 15)
-       ATTRIB(XonoticHUDRaceTimerDialog, columns, float, 4)
-       ATTRIB(XonoticHUDRaceTimerDialog, name, string, "HUDracetimer")
-       ATTRIB(XonoticHUDRaceTimerDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDRaceTimerDialog)
-#endif
+#include "dialog_hudpanel_racetimer.qh"
+
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDRaceTimerDialog_fill(entity me)
 {
        entity e;
@@ -21,4 +9,3 @@ void XonoticHUDRaceTimerDialog_fill(entity me)
 
        DIALOG_HUDPANEL_COMMON();
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qh b/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qh
new file mode 100644 (file)
index 0000000..81dca51
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDRaceTimerDialog, XonoticRootDialog)
+       METHOD(XonoticHUDRaceTimerDialog, fill, void(entity));
+       ATTRIB(XonoticHUDRaceTimerDialog, title, string, _("Race Timer Panel"))
+       ATTRIB(XonoticHUDRaceTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDRaceTimerDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDRaceTimerDialog, rows, float, 15)
+       ATTRIB(XonoticHUDRaceTimerDialog, columns, float, 4)
+       ATTRIB(XonoticHUDRaceTimerDialog, name, string, "HUDracetimer")
+       ATTRIB(XonoticHUDRaceTimerDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDRaceTimerDialog)
index b7efc4a39bd08e5a2ac7a198181e3018bd27f4bc..de9ed6898b821e7df49781fcb2176c85fcd103a1 100644 (file)
@@ -1,19 +1,10 @@
-#ifndef DIALOG_HUDPANEL_RADAR_H
-#define DIALOG_HUDPANEL_RADAR_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDRadarDialog, XonoticRootDialog)
-       METHOD(XonoticHUDRadarDialog, fill, void(entity));
-       ATTRIB(XonoticHUDRadarDialog, title, string, _("Radar Panel"))
-       ATTRIB(XonoticHUDRadarDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDRadarDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDRadarDialog, rows, float, 15)
-       ATTRIB(XonoticHUDRadarDialog, columns, float, 4)
-       ATTRIB(XonoticHUDRadarDialog, name, string, "HUDradar")
-       ATTRIB(XonoticHUDRadarDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDRadarDialog)
-#endif
+#include "dialog_hudpanel_radar.qh"
+
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "textlabel.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDRadarDialog_fill(entity me)
 {
        entity e;
@@ -58,4 +49,3 @@ void XonoticHUDRadarDialog_fill(entity me)
                                e.addValue(e, _("Never zoomed"), "3");
                                e.configureXonoticTextSliderValues(e);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_radar.qh b/qcsrc/menu/xonotic/dialog_hudpanel_radar.qh
new file mode 100644 (file)
index 0000000..6744e22
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDRadarDialog, XonoticRootDialog)
+       METHOD(XonoticHUDRadarDialog, fill, void(entity));
+       ATTRIB(XonoticHUDRadarDialog, title, string, _("Radar Panel"))
+       ATTRIB(XonoticHUDRadarDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDRadarDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDRadarDialog, rows, float, 15)
+       ATTRIB(XonoticHUDRadarDialog, columns, float, 4)
+       ATTRIB(XonoticHUDRadarDialog, name, string, "HUDradar")
+       ATTRIB(XonoticHUDRadarDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDRadarDialog)
index 6cbbe46183a9fe91888fdebcaa59312bc7546399..f04ca30da9397f358055366fa8bb726398847078 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_SCORE_H
-#define DIALOG_HUDPANEL_SCORE_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDScoreDialog, XonoticRootDialog)
-       METHOD(XonoticHUDScoreDialog, fill, void(entity));
-       ATTRIB(XonoticHUDScoreDialog, title, string, _("Score Panel"))
-       ATTRIB(XonoticHUDScoreDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDScoreDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDScoreDialog, rows, float, 15)
-       ATTRIB(XonoticHUDScoreDialog, columns, float, 4)
-       ATTRIB(XonoticHUDScoreDialog, name, string, "HUDscore")
-       ATTRIB(XonoticHUDScoreDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDScoreDialog)
-#endif
+#include "dialog_hudpanel_score.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDScoreDialog_fill(entity me)
 {
        entity e;
@@ -30,4 +20,3 @@ void XonoticHUDScoreDialog_fill(entity me)
                me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "1", _("And me")));
                me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "2", _("Pure")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_score.qh b/qcsrc/menu/xonotic/dialog_hudpanel_score.qh
new file mode 100644 (file)
index 0000000..68015ea
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDScoreDialog, XonoticRootDialog)
+       METHOD(XonoticHUDScoreDialog, fill, void(entity));
+       ATTRIB(XonoticHUDScoreDialog, title, string, _("Score Panel"))
+       ATTRIB(XonoticHUDScoreDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDScoreDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDScoreDialog, rows, float, 15)
+       ATTRIB(XonoticHUDScoreDialog, columns, float, 4)
+       ATTRIB(XonoticHUDScoreDialog, name, string, "HUDscore")
+       ATTRIB(XonoticHUDScoreDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDScoreDialog)
index ae071e02e117e1b2d4ab93c5df287090ba1ccf48..dd9a7b8788923f0a5f424e9e76c6655ce248c226 100644 (file)
@@ -1,19 +1,8 @@
-#ifndef DIALOG_HUDPANEL_TIMER_H
-#define DIALOG_HUDPANEL_TIMER_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDTimerDialog, XonoticRootDialog)
-       METHOD(XonoticHUDTimerDialog, fill, void(entity));
-       ATTRIB(XonoticHUDTimerDialog, title, string, _("Timer Panel"))
-       ATTRIB(XonoticHUDTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDTimerDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDTimerDialog, rows, float, 15)
-       ATTRIB(XonoticHUDTimerDialog, columns, float, 4)
-       ATTRIB(XonoticHUDTimerDialog, name, string, "HUDtimer")
-       ATTRIB(XonoticHUDTimerDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDTimerDialog)
-#endif
+#include "dialog_hudpanel_timer.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDTimerDialog_fill(entity me)
 {
        entity e;
@@ -27,4 +16,3 @@ void XonoticHUDTimerDialog_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_timer_increment", _("Show elapsed time")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_timer.qh b/qcsrc/menu/xonotic/dialog_hudpanel_timer.qh
new file mode 100644 (file)
index 0000000..7f75097
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDTimerDialog, XonoticRootDialog)
+       METHOD(XonoticHUDTimerDialog, fill, void(entity));
+       ATTRIB(XonoticHUDTimerDialog, title, string, _("Timer Panel"))
+       ATTRIB(XonoticHUDTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDTimerDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDTimerDialog, rows, float, 15)
+       ATTRIB(XonoticHUDTimerDialog, columns, float, 4)
+       ATTRIB(XonoticHUDTimerDialog, name, string, "HUDtimer")
+       ATTRIB(XonoticHUDTimerDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDTimerDialog)
index 67eed0c8fa808fc932959158f5f99e0e545bca1e..e8afa7ca706b91a71b050c9af2c12de684924bf4 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_HUDPANEL_VOTE_H
-#define DIALOG_HUDPANEL_VOTE_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDVoteDialog, XonoticRootDialog)
-       METHOD(XonoticHUDVoteDialog, fill, void(entity));
-       ATTRIB(XonoticHUDVoteDialog, title, string, _("Vote Panel"))
-       ATTRIB(XonoticHUDVoteDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDVoteDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDVoteDialog, rows, float, 15)
-       ATTRIB(XonoticHUDVoteDialog, columns, float, 4)
-       ATTRIB(XonoticHUDVoteDialog, name, string, "HUDvote")
-       ATTRIB(XonoticHUDVoteDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDVoteDialog)
-#endif
+#include "dialog_hudpanel_vote.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDVoteDialog_fill(entity me)
 {
        entity e;
@@ -25,4 +15,3 @@ void XonoticHUDVoteDialog_fill(entity me)
                me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Alpha after voting:")));
                me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_vote_alreadyvoted_alpha"));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_vote.qh b/qcsrc/menu/xonotic/dialog_hudpanel_vote.qh
new file mode 100644 (file)
index 0000000..1ee05a2
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDVoteDialog, XonoticRootDialog)
+       METHOD(XonoticHUDVoteDialog, fill, void(entity));
+       ATTRIB(XonoticHUDVoteDialog, title, string, _("Vote Panel"))
+       ATTRIB(XonoticHUDVoteDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDVoteDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDVoteDialog, rows, float, 15)
+       ATTRIB(XonoticHUDVoteDialog, columns, float, 4)
+       ATTRIB(XonoticHUDVoteDialog, name, string, "HUDvote")
+       ATTRIB(XonoticHUDVoteDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDVoteDialog)
index a5fedbd3fd4915c2bd683b5d65f141da990b7839..1676aab803080fc7fcec89ddc06831520ea2294d 100644 (file)
@@ -1,19 +1,12 @@
-#ifndef DIALOG_HUDPANEL_WEAPONS_H
-#define DIALOG_HUDPANEL_WEAPONS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDWeaponsDialog, XonoticRootDialog)
-       METHOD(XonoticHUDWeaponsDialog, fill, void(entity));
-       ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
-       ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 21)
-       ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
-       ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDWeaponsDialog)
-#endif
+#include "dialog_hudpanel_weapons.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
+#include "colorpicker_string.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDWeaponsDialog_fill(entity me)
 {
        entity e;
@@ -81,4 +74,3 @@ void XonoticHUDWeaponsDialog_fill(entity me)
                        setDependent(e, "hud_panel_weapons_ammo", 1, 1);
                me.TR(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qh b/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qh
new file mode 100644 (file)
index 0000000..649f7dd
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDWeaponsDialog, XonoticRootDialog)
+       METHOD(XonoticHUDWeaponsDialog, fill, void(entity));
+       ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
+       ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 21)
+       ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
+       ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDWeaponsDialog)
index 2a4180f3eef727a496aeecc1cd23ea89a36763f6..802ee96b55dc74bb6938b61253d118c438105197 100644 (file)
@@ -1,20 +1,14 @@
-#ifndef DIALOG_HUDSETUP_EXIT_H
-#define DIALOG_HUDSETUP_EXIT_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDExitDialog, XonoticRootDialog)
-       METHOD(XonoticHUDExitDialog, fill, void(entity));
-       ATTRIB(XonoticHUDExitDialog, title, string, _("Panel HUD Setup"))
-       ATTRIB(XonoticHUDExitDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDExitDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticHUDExitDialog, rows, float, 18)
-       ATTRIB(XonoticHUDExitDialog, columns, float, 8.2)
-       ATTRIB(XonoticHUDExitDialog, name, string, "HUDExit")
-       ATTRIB(XonoticHUDExitDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDExitDialog)
+#include "dialog_hudsetup_exit.qh"
 
-#endif
+#include "textlabel.qh"
+#include "button.qh"
+#include "textslider.qh"
+#include "inputbox.qh"
+#include "hudskinlist.qh"
+#include "colorpicker_string.qh"
+#include "checkbox.qh"
+#include "commandbutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticHUDExitDialog_fill(entity me)
 {
        entity e;
@@ -150,4 +144,3 @@ void XonoticHUDExitDialog_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Exit setup"), '0 0 0', "_hud_configure 0", 1));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudsetup_exit.qh b/qcsrc/menu/xonotic/dialog_hudsetup_exit.qh
new file mode 100644 (file)
index 0000000..e26cfad
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDExitDialog, XonoticRootDialog)
+       METHOD(XonoticHUDExitDialog, fill, void(entity));
+       ATTRIB(XonoticHUDExitDialog, title, string, _("Panel HUD Setup"))
+       ATTRIB(XonoticHUDExitDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDExitDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticHUDExitDialog, rows, float, 18)
+       ATTRIB(XonoticHUDExitDialog, columns, float, 8.2)
+       ATTRIB(XonoticHUDExitDialog, name, string, "HUDExit")
+       ATTRIB(XonoticHUDExitDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDExitDialog)
index a63e0141d9218e223d66ba2f77da1a46a6310edf..2a21242ef8ec677bfbe2975527cdf38233ce17bf 100644 (file)
@@ -1,18 +1,10 @@
-#ifndef DIALOG_MONSTERTOOLS_H
-#define DIALOG_MONSTERTOOLS_H
-#include "rootdialog.qc"
-CLASS(XonoticMonsterToolsDialog, XonoticRootDialog)
-       METHOD(XonoticMonsterToolsDialog, fill, void(entity));
-       ATTRIB(XonoticMonsterToolsDialog, title, string, _("Monster Tools"))
-       ATTRIB(XonoticMonsterToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
-       ATTRIB(XonoticMonsterToolsDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticMonsterToolsDialog, rows, float, 16)
-       ATTRIB(XonoticMonsterToolsDialog, columns, float, 4)
-       ATTRIB(XonoticMonsterToolsDialog, name, string, "MonsterTools")
-ENDCLASS(XonoticMonsterToolsDialog)
-#endif
+#include "dialog_monstertools.qh"
+
+#include "textlabel.qh"
+#include "radiobutton.qh"
+#include "commandbutton.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticMonsterToolsDialog_fill(entity me)
 {
        entity e;
@@ -47,6 +39,3 @@ void XonoticMonsterToolsDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_monstertools.qh b/qcsrc/menu/xonotic/dialog_monstertools.qh
new file mode 100644 (file)
index 0000000..2b6f8b4
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticMonsterToolsDialog, XonoticRootDialog)
+       METHOD(XonoticMonsterToolsDialog, fill, void(entity));
+       ATTRIB(XonoticMonsterToolsDialog, title, string, _("Monster Tools"))
+       ATTRIB(XonoticMonsterToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
+       ATTRIB(XonoticMonsterToolsDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticMonsterToolsDialog, rows, float, 16)
+       ATTRIB(XonoticMonsterToolsDialog, columns, float, 4)
+       ATTRIB(XonoticMonsterToolsDialog, name, string, "MonsterTools")
+ENDCLASS(XonoticMonsterToolsDialog)
index 0cef712a918f76f3591048f3407bdfe7630d7632..41ab2f93f624b8906e010d11523361ba951b958f 100644 (file)
@@ -1,18 +1,11 @@
-#ifndef DIALOG_MULTIPLAYER_H
-#define DIALOG_MULTIPLAYER_H
-#include "dialog.qc"
-CLASS(XonoticMultiplayerDialog, XonoticDialog)
-       METHOD(XonoticMultiplayerDialog, fill, void(entity));
-       ATTRIB(XonoticMultiplayerDialog, title, string, _("Multiplayer"))
-       ATTRIB(XonoticMultiplayerDialog, tooltip, string, _("Play online, against your friends in LAN, view demos or change player settings"))
-       ATTRIB(XonoticMultiplayerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
-       ATTRIB(XonoticMultiplayerDialog, intendedWidth, float, 0.96)
-       ATTRIB(XonoticMultiplayerDialog, rows, float, 24)
-       ATTRIB(XonoticMultiplayerDialog, columns, float, 4)
-ENDCLASS(XonoticMultiplayerDialog)
-#endif
+#include "dialog_multiplayer.qh"
+
+#include "tabcontroller.qh"
+#include "dialog_multiplayer_join.qh"
+#include "dialog_multiplayer_create.qh"
+#include "dialog_multiplayer_media.qh"
+#include "dialog_multiplayer_profile.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticMultiplayerDialog_fill(entity me)
 {
        entity mc, e;
@@ -28,4 +21,3 @@ void XonoticMultiplayerDialog_fill(entity me)
        me.TR(me);
                me.TD(me, me.rows - 1, me.columns, mc);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer.qh b/qcsrc/menu/xonotic/dialog_multiplayer.qh
new file mode 100644 (file)
index 0000000..b18ca55
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticMultiplayerDialog, XonoticDialog)
+       METHOD(XonoticMultiplayerDialog, fill, void(entity));
+       ATTRIB(XonoticMultiplayerDialog, title, string, _("Multiplayer"))
+       ATTRIB(XonoticMultiplayerDialog, tooltip, string, _("Play online, against your friends in LAN, view demos or change player settings"))
+       ATTRIB(XonoticMultiplayerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
+       ATTRIB(XonoticMultiplayerDialog, intendedWidth, float, 0.96)
+       ATTRIB(XonoticMultiplayerDialog, rows, float, 24)
+       ATTRIB(XonoticMultiplayerDialog, columns, float, 4)
+ENDCLASS(XonoticMultiplayerDialog)
index 689a8f6308fc6de28562d7b26b2d89d20248d567..85e0e9e69887bdf5bf5064de494eb46cbb4cfe64 100644 (file)
@@ -1,25 +1,19 @@
-#ifndef DIALOG_MULTIPLAYER_CREATE_H
-#define DIALOG_MULTIPLAYER_CREATE_H
-#include "tab.qc"
-CLASS(XonoticServerCreateTab, XonoticTab)
-       METHOD(XonoticServerCreateTab, fill, void(entity));
-       METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity));
-       METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity));
-       ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticServerCreateTab, rows, float, 23)
-       ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
-
-       ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
-ENDCLASS(XonoticServerCreateTab)
-entity makeXonoticServerCreateTab();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "dialog_multiplayer_create.qh"
+
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "dialog_multiplayer_create_mutators.qh"
+
+#include "gametypelist.qh"
+#include "maplist.qh"
+#include <common/mapinfo.qh>
+
+#include "image.qh"
+#include "textslider.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "mainwindow.qh"
+#include "button.qh"
+#include "inputbox.qh"
 
 void GameType_ConfigureSliders(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip)
 {
@@ -246,5 +240,3 @@ void XonoticServerCreateTab_gameTypeSelectNotify(entity me)
 {
        me.setFocus(me, me.mapListBox);
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.qh b/qcsrc/menu/xonotic/dialog_multiplayer_create.qh
new file mode 100644 (file)
index 0000000..5a747a9
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticServerCreateTab, XonoticTab)
+       METHOD(XonoticServerCreateTab, fill, void(entity));
+       METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity));
+       METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity));
+       ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticServerCreateTab, rows, float, 23)
+       ATTRIB(XonoticServerCreateTab, columns, float, 6.2)  // added extra .2 for center space
+
+       ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
+ENDCLASS(XonoticServerCreateTab)
+entity makeXonoticServerCreateTab();
index 2a5c8245a992d041580a605f47c91c0a9c559688..9bc82ebc28754bb8bf5ebbb87c697a3d50b7f813 100644 (file)
@@ -1,33 +1,11 @@
-#ifndef DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
-#define DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
-#include "dialog.qc"
-CLASS(XonoticMapInfoDialog, XonoticDialog)
-       METHOD(XonoticMapInfoDialog, fill, void(entity));
-       METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity));
-       ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
-       ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
-       ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
-       ATTRIB(XonoticMapInfoDialog, rows, float, 11)
-       ATTRIB(XonoticMapInfoDialog, columns, float, 10)
+#include "dialog_multiplayer_create_mapinfo.qh"
 
-       ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
+#include "button.qh"
+#include "image.qh"
+#include "maplist.qh"
+#include "textlabel.qh"
+#include <common/mapinfo.qh>
 
-       ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
-
-       ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
-       ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
-ENDCLASS(XonoticMapInfoDialog)
-#endif
-
-#ifdef IMPLEMENTATION
 void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
 {
        me.currentMapIndex = i;
@@ -119,4 +97,3 @@ void XonoticMapInfoDialog_fill(entity me)
                        me.startButton.onClick = MapList_LoadMap;
                        me.startButton.onClickEntity = NULL; // filled later
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qh b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qh
new file mode 100644 (file)
index 0000000..13acfcc
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticMapInfoDialog, XonoticDialog)
+       METHOD(XonoticMapInfoDialog, fill, void(entity));
+       METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity));
+       ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
+       ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
+       ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
+       ATTRIB(XonoticMapInfoDialog, rows, float, 11)
+       ATTRIB(XonoticMapInfoDialog, columns, float, 10)
+
+       ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
+
+       ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
+
+       ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
+       ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
+ENDCLASS(XonoticMapInfoDialog)
index e90a909595e7de504b04487c13412440f3e46b8c..f2f7f5c8e4862fe96cb94e4aaf5ccff6f23221d5 100644 (file)
@@ -1,23 +1,14 @@
+#include "dialog_multiplayer_create_mutators.qh"
 #include <common/weapons/all.qh>
 
-#ifndef DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
-#define DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
-#include "dialog.qc"
-CLASS(XonoticMutatorsDialog, XonoticDialog)
-       METHOD(XonoticMutatorsDialog, toString, string(entity));
-       METHOD(XonoticMutatorsDialog, fill, void(entity));
-       METHOD(XonoticMutatorsDialog, showNotify, void(entity));
-       METHOD(XonoticMutatorsDialog, close, void(entity));
-       ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
-       ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
-       ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMutatorsDialog, rows, float, 20)
-       ATTRIB(XonoticMutatorsDialog, columns, float, 6)
-       ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
-ENDCLASS(XonoticMutatorsDialog)
-#endif
+#include "weaponarenacheckbox.qh"
+#include "checkbox.qh"
+#include "slider.qh"
+#include "textlabel.qh"
+#include "checkbox_slider_invalid.qh"
+#include "radiobutton.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticMutatorsDialog_showNotify(entity me)
 {
        SUPER(XonoticMutatorsDialog).showNotify(me);
@@ -300,10 +291,11 @@ void XonoticMutatorsDialog_fill(entity me)
                        e.onClickEntity = me;
 }
 
+.void(entity) refilter;
+
 void XonoticMutatorsDialog_close(entity me)
 {
        if(me.refilterEntity)
                me.refilterEntity.refilter(me.refilterEntity);
        SUPER(XonoticMutatorsDialog).close(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh
new file mode 100644 (file)
index 0000000..ede8f4c
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticMutatorsDialog, XonoticDialog)
+       METHOD(XonoticMutatorsDialog, toString, string(entity));
+       METHOD(XonoticMutatorsDialog, fill, void(entity));
+       METHOD(XonoticMutatorsDialog, showNotify, void(entity));
+       METHOD(XonoticMutatorsDialog, close, void(entity));
+       ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
+       ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
+       ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMutatorsDialog, rows, float, 20)
+       ATTRIB(XonoticMutatorsDialog, columns, float, 6)
+       ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
+ENDCLASS(XonoticMutatorsDialog)
index fba5f193098652d55e7dfb00556e3f712145dc6a..f387f429b651f62895b974dc3550aa58b295bf8a 100644 (file)
@@ -1,16 +1,11 @@
-#ifndef DIALOG_MULTIPLAYER_JOIN_H
-#define DIALOG_MULTIPLAYER_JOIN_H
-#include "tab.qc"
-CLASS(XonoticServerListTab, XonoticTab)
-       METHOD(XonoticServerListTab, fill, void(entity));
-       ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticServerListTab, rows, float, 23)
-       ATTRIB(XonoticServerListTab, columns, float, 6.5)
-ENDCLASS(XonoticServerListTab)
-entity makeXonoticServerListTab();
-#endif
+#include "dialog_multiplayer_join.qh"
 
-#ifdef IMPLEMENTATION
+#include "serverlist.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "checkbox.qh"
+#include "button.qh"
 
 entity makeXonoticServerListTab()
 {
@@ -81,4 +76,3 @@ void XonoticServerListTab_fill(entity me)
                        e.onClickEntity = slist;
                        slist.connectButton = e;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.qh b/qcsrc/menu/xonotic/dialog_multiplayer_join.qh
new file mode 100644 (file)
index 0000000..7fa8379
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticServerListTab, XonoticTab)
+       METHOD(XonoticServerListTab, fill, void(entity));
+       ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticServerListTab, rows, float, 23)
+       ATTRIB(XonoticServerListTab, columns, float, 6.5)
+ENDCLASS(XonoticServerListTab)
+entity makeXonoticServerListTab();
index 798ef3ae78b9f405a7b5842427c627debe44ccef..d5532bcd92319757be8e3eea5b9f6ce7a13f39e8 100644 (file)
@@ -1,53 +1,12 @@
+#include "dialog_multiplayer_join_serverinfo.qh"
 #include <common/mapinfo.qh>
 
-#ifndef DIALOG_MULTIPLAYER_JOIN_SERVERINFO_H
-#define DIALOG_MULTIPLAYER_JOIN_SERVERINFO_H
-#include "dialog.qc"
-CLASS(XonoticServerInfoDialog, XonoticDialog)
-       METHOD(XonoticServerInfoDialog, fill, void(entity));
-       METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float));
-       ATTRIB(XonoticServerInfoDialog, title, string, _("Server Information"))
-       ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
-       ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticServerInfoDialog, rows, float, 18)
-       ATTRIB(XonoticServerInfoDialog, columns, float, 6.2)
-
-       ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerNumFreeSlots, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
-
-       ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, numFreeSlotsLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, keyLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, idLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, encryptLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
-ENDCLASS(XonoticServerInfoDialog)
-
-void Join_Click(entity btn, entity me);
-#endif
+#include "serverlist.qh"
+#include "playerlist.qh"
+#include "inputbox.qh"
+#include "textlabel.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
 {
        bool pure_available;
@@ -350,5 +309,3 @@ void Join_Click(entity btn, entity me)
 {
        localcmd("connect ", me.currentServerCName, "\n");
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qh b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qh
new file mode 100644 (file)
index 0000000..201f737
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticServerInfoDialog, XonoticDialog)
+       METHOD(XonoticServerInfoDialog, fill, void(entity));
+       METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float));
+       ATTRIB(XonoticServerInfoDialog, title, string, _("Server Information"))
+       ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
+       ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticServerInfoDialog, rows, float, 18)
+       ATTRIB(XonoticServerInfoDialog, columns, float, 6.2)
+
+       ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerNumFreeSlots, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
+
+       ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, numFreeSlotsLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, keyLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, idLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, encryptLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
+ENDCLASS(XonoticServerInfoDialog)
+
+void Join_Click(entity btn, entity me);
index abecd1ed5bd18e27576748b3ebc0f6dd0c2287e8..bc379d3b93adbb0e43646d4a92c38c11b7ba3593 100644 (file)
@@ -1,17 +1,14 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_H
-#define DIALOG_MULTIPLAYER_MEDIA_H
-#include "tab.qc"
-CLASS(XonoticMediaTab, XonoticTab)
-       METHOD(XonoticMediaTab, fill, void(entity));
-       ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMediaTab, rows, float, 23)
-       ATTRIB(XonoticMediaTab, columns, float, 3)
-       ATTRIB(XonoticMediaTab, name, string, "Media")
-ENDCLASS(XonoticMediaTab)
-entity makeXonoticMediaTab();
-#endif
+#include "dialog_multiplayer_media.qh"
+
+#include "demolist.qh"
+#include "dialog_multiplayer_media_demo.qh"
+#include "dialog_multiplayer_media_screenshot.qh"
+#include "dialog_multiplayer_media_musicplayer.qh"
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+
+#include "tabcontroller.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticMediaTab()
 {
        entity me;
@@ -32,4 +29,3 @@ void XonoticMediaTab_fill(entity me)
        me.gotoRC(me, 3, 0);
                me.TD(me, me.rows - 2, me.columns, mc);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media.qh
new file mode 100644 (file)
index 0000000..96c1aeb
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticMediaTab, XonoticTab)
+       METHOD(XonoticMediaTab, fill, void(entity));
+       ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMediaTab, rows, float, 23)
+       ATTRIB(XonoticMediaTab, columns, float, 3)
+       ATTRIB(XonoticMediaTab, name, string, "Media")
+ENDCLASS(XonoticMediaTab)
+entity makeXonoticMediaTab();
index b7f3884a80bd4284e69da513b03ae72f7ae51452..6ba33e2a710128ce86bb03c1369ea84883901771 100644 (file)
@@ -1,18 +1,11 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_H
-#define DIALOG_MULTIPLAYER_MEDIA_DEMO_H
-#include "tab.qc"
-CLASS(XonoticDemoBrowserTab, XonoticTab)
-       METHOD(XonoticDemoBrowserTab, fill, void(entity));
-       ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
-       ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
-       ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
-       ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
-ENDCLASS(XonoticDemoBrowserTab)
-entity makeXonoticDemoBrowserTab();
-#endif
+#include "dialog_multiplayer_media_demo.qh"
+
+#include "demolist.qh"
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "checkbox.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 const float DMO_PLAY = 1;
 const float DMO_TIME = 2;
 void DemoConfirm_Check_Gamestatus(entity btn, entity me)
@@ -71,4 +64,3 @@ void XonoticDemoBrowserTab_fill(entity me)
                        e.onClick = DemoConfirm_Check_Gamestatus;
                        e.onClickEntity = me; // demolist is global anyway
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qh
new file mode 100644 (file)
index 0000000..f41bb9e
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticDemoBrowserTab, XonoticTab)
+       METHOD(XonoticDemoBrowserTab, fill, void(entity));
+       ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
+       ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
+       ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
+       ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
+ENDCLASS(XonoticDemoBrowserTab)
+entity makeXonoticDemoBrowserTab();
index dedd34356e6c4f024552f598cc288641e97e939e..068a8217b67082f57f081f872fb277e8a1de88a4 100644 (file)
@@ -1,17 +1,9 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_STARTCONFIRM_H
-#define DIALOG_MULTIPLAYER_MEDIA_DEMO_STARTCONFIRM_H
-#include "dialog.qc"
-CLASS(XonoticDemoStartConfirmDialog, XonoticDialog)
-       METHOD(XonoticDemoStartConfirmDialog, fill, void(entity));
-       ATTRIB(XonoticDemoStartConfirmDialog, title, string, _("Disconnect"))
-       ATTRIB(XonoticDemoStartConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticDemoStartConfirmDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticDemoStartConfirmDialog, rows, float, 4)
-       ATTRIB(XonoticDemoStartConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticDemoStartConfirmDialog)
-#endif
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+
+#include "demolist.qh"
+#include "textlabel.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void Handle_StartDemo_Click(entity unused, entity me) { demolist.startDemo(demolist); }
 void XonoticDemoStartConfirmDialog_fill(entity me)
 {
@@ -30,4 +22,3 @@ void XonoticDemoStartConfirmDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qh
new file mode 100644 (file)
index 0000000..598dd55
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticDemoStartConfirmDialog, XonoticDialog)
+       METHOD(XonoticDemoStartConfirmDialog, fill, void(entity));
+       ATTRIB(XonoticDemoStartConfirmDialog, title, string, _("Disconnect"))
+       ATTRIB(XonoticDemoStartConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticDemoStartConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticDemoStartConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticDemoStartConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticDemoStartConfirmDialog)
index 6e35565ad5f789436235e610e8a536ca56833f8d..55760d14ab77cdddff1f9e532ded4e6ac79a9841 100644 (file)
@@ -1,17 +1,9 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_TIMECONFIRM_H
-#define DIALOG_MULTIPLAYER_MEDIA_DEMO_TIMECONFIRM_H
-#include "dialog.qc"
-CLASS(XonoticDemoTimeConfirmDialog, XonoticDialog)
-       METHOD(XonoticDemoTimeConfirmDialog, fill, void(entity));
-       ATTRIB(XonoticDemoTimeConfirmDialog, title, string, _("Disconnect"))
-       ATTRIB(XonoticDemoTimeConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticDemoTimeConfirmDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticDemoTimeConfirmDialog, rows, float, 4)
-       ATTRIB(XonoticDemoTimeConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticDemoTimeConfirmDialog)
-#endif
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+
+#include "demolist.qh"
+#include "textlabel.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void Handle_TimeDemo_Click(entity unused, entity unused) { demolist.timeDemo(demolist); }
 void XonoticDemoTimeConfirmDialog_fill(entity me)
 {
@@ -30,4 +22,3 @@ void XonoticDemoTimeConfirmDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qh
new file mode 100644 (file)
index 0000000..96e2d63
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticDemoTimeConfirmDialog, XonoticDialog)
+       METHOD(XonoticDemoTimeConfirmDialog, fill, void(entity));
+       ATTRIB(XonoticDemoTimeConfirmDialog, title, string, _("Disconnect"))
+       ATTRIB(XonoticDemoTimeConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticDemoTimeConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticDemoTimeConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticDemoTimeConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticDemoTimeConfirmDialog)
index 9346dfdbd53d6d1d82e9de18825b5548a7a54a2c..c3606508a51c4172bdfedd8a503fbaa8c30b56d8 100644 (file)
@@ -1,17 +1,13 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_MUSICPLAYER_H
-#define DIALOG_MULTIPLAYER_MEDIA_MUSICPLAYER_H
-#include "tab.qc"
-CLASS(XonoticMusicPlayerTab, XonoticTab)
-       METHOD(XonoticMusicPlayerTab, fill, void(entity));
-       ATTRIB(XonoticMusicPlayerTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMusicPlayerTab, rows, float, 21)
-       ATTRIB(XonoticMusicPlayerTab, columns, float, 6.5)
-       ATTRIB(XonoticMusicPlayerTab, name, string, "MusicPlayer")
-ENDCLASS(XonoticMusicPlayerTab)
-entity makeXonoticMusicPlayerTab();
-#endif
+#include "dialog_multiplayer_media_musicplayer.qh"
+
+#include "soundlist.qh"
+#include "playlist.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "button.qh"
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticMusicPlayerTab()
 {
        entity me;
@@ -84,4 +80,3 @@ void XonoticMusicPlayerTab_fill(entity me)
                        e.onClick = PlayList_Remove_All;
                        e.onClickEntity = playList;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qh
new file mode 100644 (file)
index 0000000..4d98f6e
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticMusicPlayerTab, XonoticTab)
+       METHOD(XonoticMusicPlayerTab, fill, void(entity));
+       ATTRIB(XonoticMusicPlayerTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMusicPlayerTab, rows, float, 21)
+       ATTRIB(XonoticMusicPlayerTab, columns, float, 6.5)
+       ATTRIB(XonoticMusicPlayerTab, name, string, "MusicPlayer")
+ENDCLASS(XonoticMusicPlayerTab)
+entity makeXonoticMusicPlayerTab();
index 58230253f4375d9e02aef7f70ddb2a9045f2289d..1229be714491116f7348641b47f7d31fd2310126 100644 (file)
@@ -1,21 +1,13 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_H
-#define DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_H
-#include "tab.qc"
-CLASS(XonoticScreenshotBrowserTab, XonoticTab)
-       METHOD(XonoticScreenshotBrowserTab, fill, void(entity));
-       ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
-       ATTRIB(XonoticScreenshotBrowserTab, rows, float, 21)
-       ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
-       ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+#include "dialog_multiplayer_media_screenshot.qh"
 
-       METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string));
-       ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
-       ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotBrowserTab)
-entity makeXonoticScreenshotBrowserTab();
-#endif
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "screenshotlist.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "checkbox.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticScreenshotBrowserTab()
 {
        entity me;
@@ -80,4 +72,3 @@ void XonoticScreenshotBrowserTab_fill(entity me)
                        slist.screenshotBrowserDialog = me;
 */
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qh
new file mode 100644 (file)
index 0000000..62ea843
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticScreenshotBrowserTab, XonoticTab)
+       METHOD(XonoticScreenshotBrowserTab, fill, void(entity));
+       ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
+       ATTRIB(XonoticScreenshotBrowserTab, rows, float, 21)
+       ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
+       ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+
+       METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string));
+       ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
+       ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotBrowserTab)
+entity makeXonoticScreenshotBrowserTab();
index 880dda03258c0cab772312f45474d8642c6a1671..d6d545eeeaf00b939ce5b8ad35b6243bd8e66868 100644 (file)
@@ -1,25 +1,9 @@
-#ifndef DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_VIEWER_H
-#define DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_VIEWER_H
-#include "dialog.qc"
-CLASS(XonoticScreenshotViewerDialog, XonoticDialog)
-       METHOD(XonoticScreenshotViewerDialog, fill, void(entity));
-       METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float));
-       METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string));
-       METHOD(XonoticScreenshotViewerDialog, close, void(entity));
-       ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
-       ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
-       ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
-       ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
-       ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
-       ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
-       ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
-       ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
-       ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
-       ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotViewerDialog)
-#endif
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+
+#include "screenshotlist.qh"
+#include "inputbox.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 float music_playlist_index_backup;
 void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
 {
@@ -170,4 +154,3 @@ void XonoticScreenshotViewerDialog_fill(entity me)
                        e.onClickEntity = me;
                        me.slideShowButton = e;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qh
new file mode 100644 (file)
index 0000000..c4f7e61
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "dialog.qh"
+
+#include "screenshotimage.qh"
+
+CLASS(XonoticScreenshotViewerDialog, XonoticDialog)
+       METHOD(XonoticScreenshotViewerDialog, fill, void(entity));
+       METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float));
+       METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string));
+       METHOD(XonoticScreenshotViewerDialog, close, void(entity));
+       ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
+       ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
+       ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
+       ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
+       ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
+       ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
+       ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
+       ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
+       ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
+       ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotViewerDialog)
index c316318b3a48d04532cd5208a679f0baf7b93fa3..68154221878670c8c7bcdd642bf5a6c0f07d24fa 100644 (file)
@@ -1,19 +1,17 @@
-#ifndef DIALOG_MULTIPLAYER_PROFILE_H
-#define DIALOG_MULTIPLAYER_PROFILE_H
-#include "tab.qc"
-CLASS(XonoticProfileTab, XonoticTab)
-       METHOD(XonoticProfileTab, fill, void(entity));
-       METHOD(XonoticProfileTab, draw, void(entity));
-       ATTRIB(XonoticProfileTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticProfileTab, rows, float, 23)
-       ATTRIB(XonoticProfileTab, columns, float, 6.1) // added extra .2 for center space
-       ATTRIB(XonoticProfileTab, playerNameLabel, entity, NULL)
-       ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER)
-ENDCLASS(XonoticProfileTab)
-entity makeXonoticProfileTab();
-#endif
+#include "dialog_multiplayer_profile.qh"
+
+#include "playermodel.qh"
+#include "statslist.qh"
+#include "languagelist.qh"
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "inputbox.qh"
+#include "colorpicker.qh"
+#include "charmap.qh"
+#include "colorbutton.qh"
+#include "checkbox.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticProfileTab()
 {
        entity me;
@@ -179,4 +177,3 @@ void XonoticProfileTab_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, profileApplyButton);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_profile.qh b/qcsrc/menu/xonotic/dialog_multiplayer_profile.qh
new file mode 100644 (file)
index 0000000..f60e9e0
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticProfileTab, XonoticTab)
+       METHOD(XonoticProfileTab, fill, void(entity));
+       METHOD(XonoticProfileTab, draw, void(entity));
+       ATTRIB(XonoticProfileTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticProfileTab, rows, float, 23)
+       ATTRIB(XonoticProfileTab, columns, float, 6.1)  // added extra .2 for center space
+       ATTRIB(XonoticProfileTab, playerNameLabel, entity, NULL)
+       ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER)
+ENDCLASS(XonoticProfileTab)
+entity makeXonoticProfileTab();
index 74692cf87677e734e16b7e8c814ca548a6c52fcb..e68b967a0f69a06b888beb214920dbcfd6373eac 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef DIALOG_QUIT_H
-#define DIALOG_QUIT_H
-#include "dialog.qc"
-CLASS(XonoticQuitDialog, XonoticDialog)
-       METHOD(XonoticQuitDialog, fill, void(entity));
-       ATTRIB(XonoticQuitDialog, title, string, _("Quit"))
-       ATTRIB(XonoticQuitDialog, tooltip, string, _("Quit the game"))
-       ATTRIB(XonoticQuitDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
-       ATTRIB(XonoticQuitDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticQuitDialog, rows, float, 3)
-       ATTRIB(XonoticQuitDialog, columns, float, 2)
-       ATTRIB(XonoticQuitDialog, name, string, "Quit")
-ENDCLASS(XonoticQuitDialog)
-#endif
+#include "dialog_quit.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticQuitDialog_fill(entity me)
 {
        entity e;
@@ -28,4 +18,3 @@ void XonoticQuitDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_quit.qh b/qcsrc/menu/xonotic/dialog_quit.qh
new file mode 100644 (file)
index 0000000..0b06c30
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticQuitDialog, XonoticDialog)
+       METHOD(XonoticQuitDialog, fill, void(entity));
+       ATTRIB(XonoticQuitDialog, title, string, _("Quit"))
+       ATTRIB(XonoticQuitDialog, tooltip, string, _("Quit the game"))
+       ATTRIB(XonoticQuitDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+       ATTRIB(XonoticQuitDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticQuitDialog, rows, float, 3)
+       ATTRIB(XonoticQuitDialog, columns, float, 2)
+       ATTRIB(XonoticQuitDialog, name, string, "Quit")
+ENDCLASS(XonoticQuitDialog)
index 59075442b4702666bc652f689efa7990c6b0d41b..bfd26b5fe169b274fb89c9598708148117a6f35f 100644 (file)
@@ -1,19 +1,12 @@
-#ifndef DIALOG_SANDBOXTOOLS_H
-#define DIALOG_SANDBOXTOOLS_H
-#include "rootdialog.qc"
-CLASS(XonoticSandboxToolsDialog, XonoticRootDialog)
-       METHOD(XonoticSandboxToolsDialog, fill, void(entity));
-       ATTRIB(XonoticSandboxToolsDialog, title, string, _("Sandbox Tools"))
-       ATTRIB(XonoticSandboxToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
-       ATTRIB(XonoticSandboxToolsDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticSandboxToolsDialog, rows, float, 16)
-       ATTRIB(XonoticSandboxToolsDialog, columns, float, 4)
-       ATTRIB(XonoticSandboxToolsDialog, name, string, "SandboxTools")
-       ATTRIB(XonoticSandboxToolsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticSandboxToolsDialog)
-#endif
+#include "dialog_sandboxtools.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "commandbutton.qh"
+#include "colorpicker_string.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticSandboxToolsDialog_fill(entity me)
 {
        entity e, box;
@@ -93,6 +86,3 @@ void XonoticSandboxToolsDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.qh b/qcsrc/menu/xonotic/dialog_sandboxtools.qh
new file mode 100644 (file)
index 0000000..ab49ec8
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticSandboxToolsDialog, XonoticRootDialog)
+       METHOD(XonoticSandboxToolsDialog, fill, void(entity));
+       ATTRIB(XonoticSandboxToolsDialog, title, string, _("Sandbox Tools"))
+       ATTRIB(XonoticSandboxToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
+       ATTRIB(XonoticSandboxToolsDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticSandboxToolsDialog, rows, float, 16)
+       ATTRIB(XonoticSandboxToolsDialog, columns, float, 4)
+       ATTRIB(XonoticSandboxToolsDialog, name, string, "SandboxTools")
+       ATTRIB(XonoticSandboxToolsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticSandboxToolsDialog)
index 1b491abe1127e9110d62be1f3f9f042c3dda8c86..bd6fd4c4f41295e6d7228e02c2972717b63b4ee6 100644 (file)
@@ -1,18 +1,15 @@
-#ifndef DIALOG_SETTINGS_H
-#define DIALOG_SETTINGS_H
-#include "dialog.qc"
-CLASS(XonoticSettingsDialog, XonoticDialog)
-       METHOD(XonoticSettingsDialog, fill, void(entity));
-       ATTRIB(XonoticSettingsDialog, title, string, _("Settings"))
-       ATTRIB(XonoticSettingsDialog, tooltip, string, _("Change the game settings"))
-       ATTRIB(XonoticSettingsDialog, color, vector, SKINCOLOR_DIALOG_SETTINGS)
-       ATTRIB(XonoticSettingsDialog, intendedWidth, float, 0.96)
-       ATTRIB(XonoticSettingsDialog, rows, float, 18)
-       ATTRIB(XonoticSettingsDialog, columns, float, 6)
-ENDCLASS(XonoticSettingsDialog)
-#endif
+#include "dialog_settings.qh"
+
+#include "dialog_settings_video.qh"
+#include "dialog_settings_effects.qh"
+#include "dialog_settings_audio.qh"
+#include "dialog_settings_game.qh"
+#include "dialog_settings_input.qh"
+#include "dialog_settings_user.qh"
+#include "dialog_settings_misc.qh"
+
+#include "tabcontroller.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticSettingsDialog_fill(entity me)
 {
        entity mc;
@@ -29,4 +26,3 @@ void XonoticSettingsDialog_fill(entity me)
        me.gotoRC(me, 2.5, 0);
                me.TD(me, me.rows - 2.5, me.columns, mc);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings.qh b/qcsrc/menu/xonotic/dialog_settings.qh
new file mode 100644 (file)
index 0000000..6c7eacb
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticSettingsDialog, XonoticDialog)
+       METHOD(XonoticSettingsDialog, fill, void(entity));
+       ATTRIB(XonoticSettingsDialog, title, string, _("Settings"))
+       ATTRIB(XonoticSettingsDialog, tooltip, string, _("Change the game settings"))
+       ATTRIB(XonoticSettingsDialog, color, vector, SKINCOLOR_DIALOG_SETTINGS)
+       ATTRIB(XonoticSettingsDialog, intendedWidth, float, 0.96)
+       ATTRIB(XonoticSettingsDialog, rows, float, 18)
+       ATTRIB(XonoticSettingsDialog, columns, float, 6)
+ENDCLASS(XonoticSettingsDialog)
index 775203a1cb306e254f86c5e84bc7f4f82c778e6c..4a25682e0b01c95e8e71ed39a06d46e7b81b2ed6 100644 (file)
@@ -1,17 +1,12 @@
-#ifndef DIALOG_SETTINGS_AUDIO_H
-#define DIALOG_SETTINGS_AUDIO_H
-#include "tab.qc"
-CLASS(XonoticAudioSettingsTab, XonoticTab)
-       METHOD(XonoticAudioSettingsTab, fill, void(entity));
-       ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
-       ATTRIB(XonoticAudioSettingsTab, hiddenMenuSoundsSlider, entity, NULL)
-ENDCLASS(XonoticAudioSettingsTab)
-entity makeXonoticAudioSettingsTab();
-#endif
+#include "dialog_settings_audio.qh"
+
+#include "slider_decibels.qh"
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "checkbox_slider_invalid.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticAudioSettingsTab()
 {
        entity me;
@@ -185,4 +180,3 @@ void XonoticAudioSettingsTab_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, audioApplyButton);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_audio.qh b/qcsrc/menu/xonotic/dialog_settings_audio.qh
new file mode 100644 (file)
index 0000000..a3e8a8c
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticAudioSettingsTab, XonoticTab)
+       METHOD(XonoticAudioSettingsTab, fill, void(entity));
+       ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2)  // added extra .2 for center space
+       ATTRIB(XonoticAudioSettingsTab, hiddenMenuSoundsSlider, entity, NULL)
+ENDCLASS(XonoticAudioSettingsTab)
+entity makeXonoticAudioSettingsTab();
index ed03e2f6e867b5f965fd6d01fd242536509ffa2d..1b0666c75afd59f3c4ad86f10ad13a034bf6b709 100644 (file)
@@ -1,16 +1,18 @@
-#ifndef DIALOG_SETTINGS_EFFECTS_H
-#define DIALOG_SETTINGS_EFFECTS_H
-#include "tab.qc"
-CLASS(XonoticEffectsSettingsTab, XonoticTab)
-       METHOD(XonoticEffectsSettingsTab, fill, void(entity));
-       ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticEffectsSettingsTab)
-entity makeXonoticEffectsSettingsTab();
-#endif
+#include "dialog_settings_effects.qh"
+
+#include "slider_picmip.qh"
+#include "slider_particles.qh"
+#include "slider_sbfadetime.qh"
+#include "weaponslist.qh"
+#include "keybinder.qh"
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
+#include "checkbox_slider_invalid.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticEffectsSettingsTab()
 {
        entity me;
@@ -256,4 +258,3 @@ void XonoticEffectsSettingsTab_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, effectsApplyButton);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_effects.qh b/qcsrc/menu/xonotic/dialog_settings_effects.qh
new file mode 100644 (file)
index 0000000..97f3854
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticEffectsSettingsTab, XonoticTab)
+       METHOD(XonoticEffectsSettingsTab, fill, void(entity));
+       ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2)  // added extra .2 for center space
+ENDCLASS(XonoticEffectsSettingsTab)
+entity makeXonoticEffectsSettingsTab();
index 6f68b332d3f98ad5bd9bb83c147f0ee0c2c54776..32d29d7dc7ce79a6b35d97e261ae208b53ead1aa 100644 (file)
-#ifndef DIALOG_SETTINGS_GAME_H
-#define DIALOG_SETTINGS_GAME_H
+#include "dialog_settings_game.qh"
 
 #include "../gamesettings.qh"
 
-#include "datasource.qc"
-CLASS(SettingSource, DataSource)
-    METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns))
+METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns))
+{
+    Lazy l = Settings_from(i);
+    entity it = l.m_get();
+    if (returns) returns(it.title, string_null);
+    return it;
+}
+METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns))
+{
+    Lazy l = Settings_from(i);
+    entity it = l.m_get();
+    if (returns) returns(it.tooltip);
+    return it;
+}
+METHOD(SettingSource, reload, int(entity this, string filter)) { return Settings_COUNT; }
+
+string XonoticRegisteredSettingsList_cb_name;
+string XonoticRegisteredSettingsList_cb_tooltip;
+void XonoticRegisteredSettingsList_getNameIcon_cb(string _name, string _icon)
+{
+    XonoticRegisteredSettingsList_cb_name = _name;
+}
+void XonoticRegisteredSettingsList_getTooltip_cb(string _tooltip)
+{
+    XonoticRegisteredSettingsList_cb_tooltip = _tooltip;
+}
+
+METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused))
+{
+    if (!this.source) return;
+    if (!this.source.getEntry(this.source, i, XonoticRegisteredSettingsList_getNameIcon_cb)) return;
+    string name = XonoticRegisteredSettingsList_cb_name;
+    if (isSelected) {
+        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+    } else if (isFocused) {
+        this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
+    }
+    string s = draw_TextShortenToWidth(strdecolorize(name), 1, 0, this.realFontSize);
+    draw_Text(this.realUpperMargin * eY + (0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+}
+
+METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this))
+{
+    if (this.focusedItem == -1 || !this.source)
     {
-        Lazy l = Settings_from(i);
-        entity it = l.m_get();
-        if (returns) returns(it.title, string_null);
-        return it;
+        clearTooltip(this);
+        return;
     }
-    METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns))
+    if (!this.source.getEntryTooltip(this, this.focusedItem, XonoticRegisteredSettingsList_getTooltip_cb))
     {
-        Lazy l = Settings_from(i);
-        entity it = l.m_get();
-        if (returns) returns(it.tooltip);
-        return it;
+        clearTooltip(this);
+        return;
     }
-    METHOD(SettingSource, reload, int(entity this, string filter)) { return Settings_COUNT; }
-ENDCLASS(SettingSource)
-
-#include "listbox.qc"
-CLASS(XonoticRegisteredSettingsList, XonoticListBox)
-    ATTRIB(XonoticRegisteredSettingsList, alphaBG, float, 0)
-    ATTRIB(XonoticRegisteredSettingsList, itemAbsSize, vector, '0 0 0')
-    ATTRIB(XonoticRegisteredSettingsList, origin, vector, '0 0 0')
-    ATTRIB(XonoticRegisteredSettingsList, realFontSize, vector, '0 0 0')
-    ATTRIB(XonoticRegisteredSettingsList, realUpperMargin, float, 0)
-    ATTRIB(XonoticRegisteredSettingsList, rowsPerItem, float, 2)
-    ATTRIB(XonoticRegisteredSettingsList, stringFilterBox, entity, NULL)
-    ATTRIB(XonoticRegisteredSettingsList, stringFilter, string, string_null)
-    ATTRIB(XonoticRegisteredSettingsList, typeToSearchString, string, string_null)
-    ATTRIB(XonoticRegisteredSettingsList, typeToSearchTime, float, 0)
-    ATTRIB(XonoticRegisteredSettingsList, source, DataSource, NULL)
-       ATTRIB(XonoticRegisteredSettingsList, onChange, void(entity, entity), func_null)
-       ATTRIB(XonoticRegisteredSettingsList, onChangeEntity, entity, NULL)
-       METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity));
-
-       string XonoticRegisteredSettingsList_cb_name;
-       string XonoticRegisteredSettingsList_cb_tooltip;
-       void XonoticRegisteredSettingsList_getNameIcon_cb(string _name, string _icon)
-       {
-               XonoticRegisteredSettingsList_cb_name = _name;
-       }
-       void XonoticRegisteredSettingsList_getTooltip_cb(string _tooltip)
-       {
-               XonoticRegisteredSettingsList_cb_tooltip = _tooltip;
-       }
+    string theTooltip = XonoticRegisteredSettingsList_cb_tooltip;
+    if(theTooltip != "")
+        setZonedTooltip(this, theTooltip, string_null);
+    else
+        clearTooltip(this);
+}
 
-       METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused))
-       {
-               if (!this.source) return;
-               if (!this.source.getEntry(this.source, i, XonoticRegisteredSettingsList_getNameIcon_cb)) return;
-               string name = XonoticRegisteredSettingsList_cb_name;
-               if (isSelected) {
-                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-               } else if (isFocused) {
-                       this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
-                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
-               }
-               string s = draw_TextShortenToWidth(strdecolorize(name), 1, 0, this.realFontSize);
-               draw_Text(this.realUpperMargin * eY + (0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-       }
-
-       METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this))
-       {
-               if (this.focusedItem == -1 || !this.source)
-               {
-                       clearTooltip(this);
-                       return;
-               }
-               if (!this.source.getEntryTooltip(this, this.focusedItem, XonoticRegisteredSettingsList_getTooltip_cb))
-               {
-                       clearTooltip(this);
-                       return;
-               }
-               string theTooltip = XonoticRegisteredSettingsList_cb_tooltip;
-               if(theTooltip != "")
-                       setZonedTooltip(this, theTooltip, string_null);
-               else
-                       clearTooltip(this);
-       }
+METHOD(XonoticRegisteredSettingsList, refilter, void(entity this))
+{
+    if (!this.source) {
+        this.nItems = 0;
+        return;
+    }
+    this.nItems = this.source.reload(this.source, this.stringFilter);
+}
+METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
+{
+    SUPER(XonoticRegisteredSettingsList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
 
-       METHOD(XonoticRegisteredSettingsList, refilter, void(entity this))
-       {
-               if (!this.source) {
-                       this.nItems = 0;
-                       return;
-               }
-               this.nItems = this.source.reload(this.source, this.stringFilter);
-       }
-       METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
-       {
-               SUPER(XonoticRegisteredSettingsList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+    this.itemAbsSize = '0 0 0';
+    this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
+    this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
+    this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
+}
+METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i))
+{
+    SUPER(XonoticRegisteredSettingsList).setSelected(this, i);
+    this.onChange(this, this.onChangeEntity);
+}
+CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source) {
+    CONSTRUCT(XonoticRegisteredSettingsList);
+    this.source = _source;
+    this.configureXonoticListBox(this);
+    this.refilter(this);
+}
 
-               this.itemAbsSize = '0 0 0';
-               this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
-               this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
-               this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
-       }
-       METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i))
-       {
-               SUPER(XonoticRegisteredSettingsList).setSelected(this, i);
-               this.onChange(this, this.onChangeEntity);
-       }
-    CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source) {
-        CONSTRUCT(XonoticRegisteredSettingsList);
-        this.source = _source;
-        this.configureXonoticListBox(this);
-        this.refilter(this);
+METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this))
+{
+    entity c = this.currentPanel;
+    entity removing = this.currentItem;
+    DataSource data = this.topicList.source;
+    entity adding = data.getEntry(data, this.topicList.selectedItem, func_null);
+    if (removing == adding) return;
+    if (removing) {
+        this.currentItem = NULL;
+        c.removeItem(c, removing);
     }
-ENDCLASS(XonoticRegisteredSettingsList)
-
-#include "tab.qc"
-CLASS(XonoticGameSettingsTab, XonoticTab)
-       ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
-    ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
-    ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
-    ATTRIB(XonoticGameSettingsTab, source, DataSource, NEW(SettingSource))
-    ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, this.source))
-    ATTRIB(XonoticGameSettingsTab, currentPanel, entity, NEW(XonoticTab))
-    ATTRIB(XonoticGameSettingsTab, currentItem, entity, NULL)
-    METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this))
-       {
-               entity c = this.currentPanel;
-               entity removing = this.currentItem;
-               DataSource data = this.topicList.source;
-               entity adding = data.getEntry(data, this.topicList.selectedItem, func_null);
-               if (removing == adding) return;
-               if (removing) {
-                       this.currentItem = NULL;
-                       c.removeItem(c, removing);
-               }
-               if (adding) {
-                       this.currentItem = adding;
-                       adding.resizeNotify(adding, '0 0 0', c.size, '0 0 0', c.size);
-                       c.addItem(c, adding, '0 0 0', '1 1 0', 1);
-               }
-       }
-       METHOD(XonoticGameSettingsTab, fill, void(entity this))
-       {
-               entity topics = this.topicList;
-                       topics.onChange = this.topicChangeNotify;
-                       topics.onChangeEntity = this;
+    if (adding) {
+        this.currentItem = adding;
+        adding.resizeNotify(adding, '0 0 0', c.size, '0 0 0', c.size);
+        c.addItem(c, adding, '0 0 0', '1 1 0', 1);
+    }
+}
+METHOD(XonoticGameSettingsTab, fill, void(entity this))
+{
+    entity topics = this.topicList;
+        topics.onChange = this.topicChangeNotify;
+        topics.onChangeEntity = this;
 
-               int
-               col = 0, width = 1;
-               this.gotoRC(this, 0, col);
-                       this.TD(this, this.rows, width, topics);
+    int
+    col = 0, width = 1;
+    this.gotoRC(this, 0, col);
+        this.TD(this, this.rows, width, topics);
 
-               col += width, width = this.columns - col;
-               this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
-                       this.TD(this, this.rows, width, this.currentPanel);
+    col += width, width = this.columns - col;
+    this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
+        this.TD(this, this.rows, width, this.currentPanel);
 
-               this.topicChangeNotify(topics, this);
-       }
-    INIT(XonoticGameSettingsTab)
-    {
-               this.configureDialog(this);
-       }
-ENDCLASS(XonoticGameSettingsTab)
-#endif
+    this.topicChangeNotify(topics, this);
+}
diff --git a/qcsrc/menu/xonotic/dialog_settings_game.qh b/qcsrc/menu/xonotic/dialog_settings_game.qh
new file mode 100644 (file)
index 0000000..c415e96
--- /dev/null
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "datasource.qh"
+CLASS(SettingSource, DataSource)
+       METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
+       METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns));
+       METHOD(SettingSource, reload, int(entity this, string filter));
+ENDCLASS(SettingSource)
+
+#include "listbox.qh"
+CLASS(XonoticRegisteredSettingsList, XonoticListBox)
+       ATTRIB(XonoticRegisteredSettingsList, alphaBG, float, 0)
+       ATTRIB(XonoticRegisteredSettingsList, itemAbsSize, vector, '0 0 0')
+       ATTRIB(XonoticRegisteredSettingsList, origin, vector, '0 0 0')
+       ATTRIB(XonoticRegisteredSettingsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticRegisteredSettingsList, realUpperMargin, float, 0)
+       ATTRIB(XonoticRegisteredSettingsList, rowsPerItem, float, 2)
+       ATTRIB(XonoticRegisteredSettingsList, stringFilterBox, entity, NULL)
+       ATTRIB(XonoticRegisteredSettingsList, stringFilter, string, string_null)
+       ATTRIB(XonoticRegisteredSettingsList, typeToSearchString, string, string_null)
+       ATTRIB(XonoticRegisteredSettingsList, typeToSearchTime, float, 0)
+       ATTRIB(XonoticRegisteredSettingsList, source, DataSource, NULL)
+       ATTRIB(XonoticRegisteredSettingsList, onChange, void(entity, entity), func_null)
+       ATTRIB(XonoticRegisteredSettingsList, onChangeEntity, entity, NULL)
+       METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity));
+       METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused));
+       METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this));
+       METHOD(XonoticRegisteredSettingsList, refilter, void(entity this));
+       METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize));
+       METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i));
+       CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source);
+ENDCLASS(XonoticRegisteredSettingsList)
+
+#include "tab.qh"
+CLASS(XonoticGameSettingsTab, XonoticTab)
+       ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
+       ATTRIB(XonoticGameSettingsTab, source, DataSource, NEW(SettingSource))
+       ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, this.source))
+       ATTRIB(XonoticGameSettingsTab, currentPanel, entity, NEW(XonoticTab))
+       ATTRIB(XonoticGameSettingsTab, currentItem, entity, NULL)
+       METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this));
+       METHOD(XonoticGameSettingsTab, fill, void(entity this));
+       INIT(XonoticGameSettingsTab)
+    {
+        this.configureDialog(this);
+    }
+ENDCLASS(XonoticGameSettingsTab)
index cab2d25c63669ecf0fb79921660e4e2b063770a2..664306738df38625e1acd1d67ef15b26b4157946 100644 (file)
@@ -1,20 +1,14 @@
-#ifndef DIALOG_SETTINGS_GAME_CROSSHAIR_H
-#define DIALOG_SETTINGS_GAME_CROSSHAIR_H
-#include "tab.qc"
-CLASS(XonoticGameCrosshairSettingsTab, XonoticTab)
-       METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity));
-       METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity));
-       ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
-       ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameCrosshairSettingsTab)
-entity makeXonoticGameCrosshairSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Crosshair, makeXonoticGameCrosshairSettingsTab());
-#endif
+#include "dialog_settings_game_crosshair.qh"
+
+#include "radiobutton.qh"
+#include "crosshairpicker.qh"
+#include "crosshairpreview.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "colorpicker_string.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticGameCrosshairSettingsTab_showNotify(entity me)
 {
        loadAllCvars(me);
@@ -151,4 +145,3 @@ void XonoticGameCrosshairSettingsTab_fill(entity me)
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate crosshair when picking up an item")));
                        setDependent(e, "crosshair_enabled", 1, 2);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_crosshair.qh b/qcsrc/menu/xonotic/dialog_settings_game_crosshair.qh
new file mode 100644 (file)
index 0000000..3e12220
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameCrosshairSettingsTab, XonoticTab)
+       METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity));
+       METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity));
+       ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
+       ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameCrosshairSettingsTab)
+entity makeXonoticGameCrosshairSettingsTab();
+
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Crosshair, makeXonoticGameCrosshairSettingsTab());
index 150357de208b75306d772cdd1554c88047a3e7a0..becefc6607f2f8202cbe7963eefdaa3e80963630 100644 (file)
@@ -1,21 +1,13 @@
-#ifndef DIALOG_SETTINGS_GAME_HUD_H
-#define DIALOG_SETTINGS_GAME_HUD_H
-#include "tab.qc"
-CLASS(XonoticGameHUDSettingsTab, XonoticTab)
-       METHOD(XonoticGameHUDSettingsTab, fill, void(entity));
-       METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity));
-       ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD"))
-       ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameHUDSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameHUDSettingsTab)
-entity makeXonoticGameHUDSettingsTab();
-void HUDSetup_Start(entity me, entity btn);
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(HUD, makeXonoticGameHUDSettingsTab());
-#endif
+#include "dialog_settings_game_hud.qh"
+
+#include "../item/modalcontroller.qh"
+#include "mainwindow.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "slider_sbfadetime.qh"
+#include "checkbox.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void HUDSetup_Check_Gamestatus(entity me, entity btn)
 {
        if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, ask the player if they want to start one anyway
@@ -174,4 +166,3 @@ void XonoticGameHUDSettingsTab_fill(entity me)
                        e.onClickEntity = me;
                // TODO: show hud config name with text here
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hud.qh b/qcsrc/menu/xonotic/dialog_settings_game_hud.qh
new file mode 100644 (file)
index 0000000..1db5890
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameHUDSettingsTab, XonoticTab)
+       METHOD(XonoticGameHUDSettingsTab, fill, void(entity));
+       METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity));
+       ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD"))
+       ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameHUDSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameHUDSettingsTab)
+entity makeXonoticGameHUDSettingsTab();
+void HUDSetup_Start(entity me, entity btn);
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(HUD, makeXonoticGameHUDSettingsTab());
index 6d3fa1f02c2422a6b1d9498646972e04fe1fadd3..b1426c2c9e28b2d00556402fbd4ca19f4ac06af3 100644 (file)
@@ -1,17 +1,8 @@
-#ifndef DIALOG_SETTINGS_GAME_HUDCONFIRM_H
-#define DIALOG_SETTINGS_GAME_HUDCONFIRM_H
-#include "dialog.qc"
-CLASS(XonoticHUDConfirmDialog, XonoticDialog)
-       METHOD(XonoticHUDConfirmDialog, fill, void(entity));
-       ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
-       ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
-       ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticHUDConfirmDialog)
-#endif
+#include "dialog_settings_game_hudconfirm.qh"
+
+#include "textlabel.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void HUDSetup_Start(entity me, entity btn)
 {
        if (!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
@@ -39,4 +30,3 @@ void XonoticHUDConfirmDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qh b/qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qh
new file mode 100644 (file)
index 0000000..6e8421e
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticHUDConfirmDialog, XonoticDialog)
+       METHOD(XonoticHUDConfirmDialog, fill, void(entity));
+       ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
+       ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticHUDConfirmDialog)
index f9ff06796fbe5d47d14477fd6beafd25d12c2ab9..58d0de9b6329d50eb96c1f43857e53974e02d9bf 100644 (file)
@@ -1,21 +1,9 @@
-#ifndef DIALOG_SETTINGS_GAME_MESSAGES_H
-#define DIALOG_SETTINGS_GAME_MESSAGES_H
-#include "tab.qc"
-CLASS(XonoticGameMessageSettingsTab, XonoticTab)
-       METHOD(XonoticGameMessageSettingsTab, fill, void(entity));
-       METHOD(XonoticGameMessageSettingsTab, showNotify, void(entity));
-       ATTRIB(XonoticGameMessageSettingsTab, title, string, _("Messages"))
-       ATTRIB(XonoticGameMessageSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameMessageSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameMessageSettingsTab, columns, float, 6)
-       ATTRIB(XonoticGameMessageSettingsTab, weaponsList, entity, NULL)
-ENDCLASS(XonoticGameMessageSettingsTab)
-entity makeXonoticGameMessageSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Messages, makeXonoticGameMessageSettingsTab());
-#endif
+#include "dialog_settings_game_messages.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticGameMessageSettingsTab_showNotify(entity me)
 {
        loadAllCvars(me);
@@ -116,4 +104,3 @@ void XonoticGameMessageSettingsTab_fill(entity me)
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(1, 0, "notification_ANNCE_ACHIEVEMENT_AIRSHOT", _("Achievement sounds"), "-"));
                        makeMulti(e, "notification_ANNCE_ACHIEVEMENT_AMAZING notification_ANNCE_ACHIEVEMENT_AWESOME notification_ANNCE_ACHIEVEMENT_BOTLIKE notification_ANNCE_ACHIEVEMENT_ELECTROBITCH notification_ANNCE_ACHIEVEMENT_IMPRESSIVE notification_ANNCE_ACHIEVEMENT_YODA");
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_messages.qh b/qcsrc/menu/xonotic/dialog_settings_game_messages.qh
new file mode 100644 (file)
index 0000000..56d13bc
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameMessageSettingsTab, XonoticTab)
+       METHOD(XonoticGameMessageSettingsTab, fill, void(entity));
+       METHOD(XonoticGameMessageSettingsTab, showNotify, void(entity));
+       ATTRIB(XonoticGameMessageSettingsTab, title, string, _("Messages"))
+       ATTRIB(XonoticGameMessageSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameMessageSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameMessageSettingsTab, columns, float, 6)
+       ATTRIB(XonoticGameMessageSettingsTab, weaponsList, entity, NULL)
+ENDCLASS(XonoticGameMessageSettingsTab)
+entity makeXonoticGameMessageSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Messages, makeXonoticGameMessageSettingsTab());
index 740dbe95acbd762ddeac278de10f2225098e7f4d..f0f95d74b95963fb540c5e330a538dc891f58199 100644 (file)
@@ -1,21 +1,10 @@
-#ifndef DIALOG_SETTINGS_GAME_MODEL_H
-#define DIALOG_SETTINGS_GAME_MODEL_H
-#include "tab.qc"
-CLASS(XonoticGameModelSettingsTab, XonoticTab)
-       METHOD(XonoticGameModelSettingsTab, fill, void(entity));
-       METHOD(XonoticGameModelSettingsTab, showNotify, void(entity));
-       ATTRIB(XonoticGameModelSettingsTab, title, string, _("Models"))
-       ATTRIB(XonoticGameModelSettingsTab, tooltip, string, _("Customize how players and items are displayed in game"))
-       ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameModelSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
-ENDCLASS(XonoticGameModelSettingsTab)
-entity makeXonoticGameModelSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Models, makeXonoticGameModelSettingsTab());
-#endif
+#include "dialog_settings_game_model.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticGameModelSettingsTab_showNotify(entity me)
 {
        loadAllCvars(me);
@@ -75,4 +64,3 @@ void XonoticGameModelSettingsTab_fill(entity me)
                        e.configureXonoticTextSliderValues(e);
                        setDependent(e, "cl_gentle", 0, 0);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_model.qh b/qcsrc/menu/xonotic/dialog_settings_game_model.qh
new file mode 100644 (file)
index 0000000..8ca179d
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameModelSettingsTab, XonoticTab)
+       METHOD(XonoticGameModelSettingsTab, fill, void(entity));
+       METHOD(XonoticGameModelSettingsTab, showNotify, void(entity));
+       ATTRIB(XonoticGameModelSettingsTab, title, string, _("Models"))
+       ATTRIB(XonoticGameModelSettingsTab, tooltip, string, _("Customize how players and items are displayed in game"))
+       ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameModelSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
+ENDCLASS(XonoticGameModelSettingsTab)
+entity makeXonoticGameModelSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Models, makeXonoticGameModelSettingsTab());
index 91ffa0e2904fee61255498c5a2f1be9c969320f1..2f5d795867844c5ab011970bf2bb4c32edc7a145 100644 (file)
@@ -1,20 +1,11 @@
-#ifndef DIALOG_SETTINGS_GAME_VIEW_H
-#define DIALOG_SETTINGS_GAME_VIEW_H
-#include "tab.qc"
-CLASS(XonoticGameViewSettingsTab, XonoticTab)
-       METHOD(XonoticGameViewSettingsTab, fill, void(entity));
-       METHOD(XonoticGameViewSettingsTab, showNotify, void(entity));
-       ATTRIB(XonoticGameViewSettingsTab, title, string, _("View"))
-       ATTRIB(XonoticGameViewSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameViewSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameViewSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameViewSettingsTab)
-entity makeXonoticGameViewSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(View, makeXonoticGameViewSettingsTab());
-#endif
+#include "dialog_settings_game_view.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticGameViewSettingsTab_showNotify(entity me)
 {
        loadAllCvars(me);
@@ -128,4 +119,3 @@ void XonoticGameViewSettingsTab_fill(entity me)
                //me.TDempty(me, 0.2);
                me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_zoom_on_weapon_switch", _("Release zoom when you switch weapons")));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_view.qh b/qcsrc/menu/xonotic/dialog_settings_game_view.qh
new file mode 100644 (file)
index 0000000..7ec4c79
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameViewSettingsTab, XonoticTab)
+       METHOD(XonoticGameViewSettingsTab, fill, void(entity));
+       METHOD(XonoticGameViewSettingsTab, showNotify, void(entity));
+       ATTRIB(XonoticGameViewSettingsTab, title, string, _("View"))
+       ATTRIB(XonoticGameViewSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameViewSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameViewSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameViewSettingsTab)
+entity makeXonoticGameViewSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(View, makeXonoticGameViewSettingsTab());
index 86b160331d3be5d512ff0a0f1d8893ec394948ce..1d75ecb49b39b0b2ba58293137c3d88051e53b32 100644 (file)
@@ -1,21 +1,12 @@
-#ifndef DIALOG_SETTINGS_GAME_WEAPONS_H
-#define DIALOG_SETTINGS_GAME_WEAPONS_H
-#include "tab.qc"
-CLASS(XonoticGameWeaponsSettingsTab, XonoticTab)
-       METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity));
-       METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity));
-       ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
-       ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
-       ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
-ENDCLASS(XonoticGameWeaponsSettingsTab)
-entity makeXonoticGameWeaponsSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Weapons, makeXonoticGameWeaponsSettingsTab());
-#endif
+#include "dialog_settings_game_weapons.qh"
+
+#include "weaponslist.qh"
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "button.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticGameWeaponsSettingsTab_showNotify(entity me)
 {
        loadAllCvars(me);
@@ -96,4 +87,3 @@ void XonoticGameWeaponsSettingsTab_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, me.columns, weaponsApplyButton);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_weapons.qh b/qcsrc/menu/xonotic/dialog_settings_game_weapons.qh
new file mode 100644 (file)
index 0000000..73ee66f
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameWeaponsSettingsTab, XonoticTab)
+       METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity));
+       METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity));
+       ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
+       ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
+       ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
+ENDCLASS(XonoticGameWeaponsSettingsTab)
+entity makeXonoticGameWeaponsSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Weapons, makeXonoticGameWeaponsSettingsTab());
index 9eab078ad6e9366d18344b3141f3ceb61ab9e0de..7f3af39f878be318dad0a2210eb7291c08b13e39 100644 (file)
@@ -1,16 +1,15 @@
-#ifndef DIALOG_SETTINGS_INPUT_H
-#define DIALOG_SETTINGS_INPUT_H
-#include "tab.qc"
-CLASS(XonoticInputSettingsTab, XonoticTab)
-       METHOD(XonoticInputSettingsTab, fill, void(entity));
-       ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticInputSettingsTab)
-entity makeXonoticInputSettingsTab();
-#endif
+#include "dialog_settings_input.qh"
+
+#include "dialog_settings_input_userbind.qh"
+#include "skinlist.qh"
+#include "slider_resolution.qh"
+#include "../item/checkbox.qh"
+#include "keybinder.qh"
+#include "textlabel.qh"
+#include "button.qh"
+#include "slider.qh"
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticInputSettingsTab()
 {
        entity me;
@@ -121,4 +120,3 @@ void XonoticInputSettingsTab_fill(entity me)
                        e.disabled = 1; // the option is never available in this case, just there for show
                }
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_input.qh b/qcsrc/menu/xonotic/dialog_settings_input.qh
new file mode 100644 (file)
index 0000000..f8e6fed
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticInputSettingsTab, XonoticTab)
+       METHOD(XonoticInputSettingsTab, fill, void(entity));
+       ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticInputSettingsTab, columns, float, 6.2)  // added extra .2 for center space
+ENDCLASS(XonoticInputSettingsTab)
+entity makeXonoticInputSettingsTab();
index d88be1d59e9daf213c98959926cff7e3ffa441b5..d8d5e7e18d3ef8aede3cfb5750a12722f39357ad 100644 (file)
@@ -1,23 +1,10 @@
-#ifndef DIALOG_SETTINGS_INPUT_USERBIND_H
-#define DIALOG_SETTINGS_INPUT_USERBIND_H
-#include "dialog.qc"
-CLASS(XonoticUserbindEditDialog, XonoticDialog)
-       METHOD(XonoticUserbindEditDialog, loadUserBind, void(entity, string, string, string));
-       METHOD(XonoticUserbindEditDialog, fill, void(entity));
-       ATTRIB(XonoticUserbindEditDialog, title, string, _("User defined key bind"))
-       ATTRIB(XonoticUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
-       ATTRIB(XonoticUserbindEditDialog, intendedWidth, float, 0.7)
-       ATTRIB(XonoticUserbindEditDialog, rows, float, 4)
-       ATTRIB(XonoticUserbindEditDialog, columns, float, 3)
-       ATTRIB(XonoticUserbindEditDialog, keybindBox, entity, NULL)
+#include "dialog_settings_input_userbind.qh"
 
-       ATTRIB(XonoticUserbindEditDialog, nameBox, entity, NULL)
-       ATTRIB(XonoticUserbindEditDialog, commandPressBox, entity, NULL)
-       ATTRIB(XonoticUserbindEditDialog, commandReleaseBox, entity, NULL)
-ENDCLASS(XonoticUserbindEditDialog)
-#endif
+#include "keybinder.qh"
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticUserbindEditDialog_Save(entity btn, entity me)
 {
        me.keybindBox.editUserbind(me.keybindBox, me.nameBox.text, me.commandPressBox.text, me.commandReleaseBox.text);
@@ -54,4 +41,3 @@ void XonoticUserbindEditDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_input_userbind.qh b/qcsrc/menu/xonotic/dialog_settings_input_userbind.qh
new file mode 100644 (file)
index 0000000..5ff3a2e
--- /dev/null
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticUserbindEditDialog, XonoticDialog)
+       METHOD(XonoticUserbindEditDialog, loadUserBind, void(entity, string, string, string));
+       METHOD(XonoticUserbindEditDialog, fill, void(entity));
+       ATTRIB(XonoticUserbindEditDialog, title, string, _("User defined key bind"))
+       ATTRIB(XonoticUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
+       ATTRIB(XonoticUserbindEditDialog, intendedWidth, float, 0.7)
+       ATTRIB(XonoticUserbindEditDialog, rows, float, 4)
+       ATTRIB(XonoticUserbindEditDialog, columns, float, 3)
+       ATTRIB(XonoticUserbindEditDialog, keybindBox, entity, NULL)
+
+       ATTRIB(XonoticUserbindEditDialog, nameBox, entity, NULL)
+       ATTRIB(XonoticUserbindEditDialog, commandPressBox, entity, NULL)
+       ATTRIB(XonoticUserbindEditDialog, commandReleaseBox, entity, NULL)
+ENDCLASS(XonoticUserbindEditDialog)
index 997c97f194c3b1120818c1058b0a636c53183a95..d951275db15a8c1c21cb6953d6ddb65024414093 100644 (file)
@@ -1,16 +1,13 @@
-#ifndef DIALOG_SETTINGS_MISC_H
-#define DIALOG_SETTINGS_MISC_H
-#include "tab.qc"
-CLASS(XonoticMiscSettingsTab, XonoticTab)
-       METHOD(XonoticMiscSettingsTab, fill, void(entity));
-       ATTRIB(XonoticMiscSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMiscSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticMiscSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticMiscSettingsTab)
-entity makeXonoticMiscSettingsTab();
-#endif
+#include "dialog_settings_misc.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "checkbox.qh"
+#include "button.qh"
+#include "mainwindow.qh"
 
-#ifdef IMPLEMENTATION
 #define ADDVALUE_FPS(i) e.addValue(e, strzone(sprintf(_("%d fps"), i)), #i)
 entity makeXonoticMiscSettingsTab()
 {
@@ -152,4 +149,3 @@ void XonoticMiscSettingsTab_fill(entity me)
                        e.onClickEntity = main.resetDialog;
 }
 #undef ADDVALUE_FPS
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc.qh b/qcsrc/menu/xonotic/dialog_settings_misc.qh
new file mode 100644 (file)
index 0000000..f3f367e
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticMiscSettingsTab, XonoticTab)
+       METHOD(XonoticMiscSettingsTab, fill, void(entity));
+       ATTRIB(XonoticMiscSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMiscSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticMiscSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticMiscSettingsTab)
+entity makeXonoticMiscSettingsTab();
index 8a2d489a0b9717dddd1f5f5570017c9958d1fed9..f1fec78cf22e44140895a7837033bc7fe66fa037 100644 (file)
@@ -1,18 +1,10 @@
-#ifndef DIALOG_SETTINGS_MISC_CVARS_H
-#define DIALOG_SETTINGS_MISC_CVARS_H
-#include "dialog.qc"
-CLASS(XonoticCvarsDialog, XonoticDialog)
-       METHOD(XonoticCvarsDialog, fill, void(entity));
-       METHOD(XonoticCvarsDialog, showNotify, void(entity));
-       ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
-       ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
-       ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticCvarsDialog, rows, float, 24)
-       ATTRIB(XonoticCvarsDialog, columns, float, 6)
-ENDCLASS(XonoticCvarsDialog)
-#endif
+#include "dialog_settings_misc_cvars.qh"
+
+#include "cvarlist.qh"
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticCvarsDialog_showNotify(entity me)
 {
        SUPER(XonoticCvarsDialog).showNotify(me);
@@ -85,5 +77,3 @@ void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIS
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_cvars.qh b/qcsrc/menu/xonotic/dialog_settings_misc_cvars.qh
new file mode 100644 (file)
index 0000000..f5011f7
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticCvarsDialog, XonoticDialog)
+       METHOD(XonoticCvarsDialog, fill, void(entity));
+       METHOD(XonoticCvarsDialog, showNotify, void(entity));
+       ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
+       ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
+       ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticCvarsDialog, rows, float, 24)
+       ATTRIB(XonoticCvarsDialog, columns, float, 6)
+ENDCLASS(XonoticCvarsDialog)
index f989f88593d59e2c7b186929f15f71e83d9f329c..d3ba0e4206f92cc453f4ec32b9aad91123a6f43f 100644 (file)
@@ -1,18 +1,9 @@
-#ifndef DIALOG_SETTINGS_MISC_RESET_H
-#define DIALOG_SETTINGS_MISC_RESET_H
-#include "dialog.qc"
-CLASS(XonoticResetDialog, XonoticDialog)
-       METHOD(XonoticResetDialog, fill, void(entity));
-       ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
-       ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
-       ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticResetDialog, rows, float, 4)
-       ATTRIB(XonoticResetDialog, columns, float, 2)
-       ATTRIB(XonoticResetDialog, name, string, "Factory reset")
-ENDCLASS(XonoticResetDialog)
-#endif
+#include "dialog_settings_misc_reset.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticResetDialog_fill(entity me)
 {
        entity e;
@@ -27,4 +18,3 @@ void XonoticResetDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_reset.qh b/qcsrc/menu/xonotic/dialog_settings_misc_reset.qh
new file mode 100644 (file)
index 0000000..1cbc777
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticResetDialog, XonoticDialog)
+       METHOD(XonoticResetDialog, fill, void(entity));
+       ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
+       ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+       ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticResetDialog, rows, float, 4)
+       ATTRIB(XonoticResetDialog, columns, float, 2)
+       ATTRIB(XonoticResetDialog, name, string, "Factory reset")
+ENDCLASS(XonoticResetDialog)
index 07ab1bd0d1d845a5fec09ecab657d4b328dc4cbd..fc6521c4d2b9a7bd03e9b567ceecb9dd6f9247d2 100644 (file)
@@ -1,16 +1,11 @@
-#ifndef DIALOG_SETTINGS_USER_H
-#define DIALOG_SETTINGS_USER_H
-#include "tab.qc"
-CLASS(XonoticUserSettingsTab, XonoticTab)
-       METHOD(XonoticUserSettingsTab, fill, void(entity));
-       ATTRIB(XonoticUserSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticUserSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticUserSettingsTab, columns, float, 6)
-ENDCLASS(XonoticUserSettingsTab)
-entity makeXonoticUserSettingsTab();
-#endif
+#include "dialog_settings_user.qh"
+
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "languagelist.qh"
+#include "skinlist.qh"
+#include "checkbox.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticUserSettingsTab()
 {
        entity me;
@@ -84,4 +79,3 @@ void XonoticUserSettingsTab_fill(entity me)
                me.TD(me, 1, 6, userApplyButton);
 
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_user.qh b/qcsrc/menu/xonotic/dialog_settings_user.qh
new file mode 100644 (file)
index 0000000..3a5ccc3
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticUserSettingsTab, XonoticTab)
+       METHOD(XonoticUserSettingsTab, fill, void(entity));
+       ATTRIB(XonoticUserSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticUserSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticUserSettingsTab, columns, float, 6)
+ENDCLASS(XonoticUserSettingsTab)
+entity makeXonoticUserSettingsTab();
index 605f8d245282dc4eec13795d5c6f5697be901da8..3cbd15bb41c2506cb96981a1e1b78d28979d3e12 100644 (file)
@@ -1,17 +1,8 @@
-#ifndef DIALOG_SETTINGS_USER_LANGUAGEWARNING_H
-#define DIALOG_SETTINGS_USER_LANGUAGEWARNING_H
-#include "dialog.qc"
-CLASS(XonoticLanguageWarningDialog, XonoticDialog)
-       METHOD(XonoticLanguageWarningDialog, fill, void(entity));
-       ATTRIB(XonoticLanguageWarningDialog, title, string, _("Warning"))
-       ATTRIB(XonoticLanguageWarningDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticLanguageWarningDialog, intendedWidth, float, 0.6)
-       ATTRIB(XonoticLanguageWarningDialog, rows, float, 5)
-       ATTRIB(XonoticLanguageWarningDialog, columns, float, 4)
-ENDCLASS(XonoticLanguageWarningDialog)
-#endif
+#include "dialog_settings_user_languagewarning.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticLanguageWarningDialog_fill(entity me)
 {
        entity e;
@@ -25,4 +16,3 @@ void XonoticLanguageWarningDialog_fill(entity me)
                me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Disconnect now"), '0 0 0', "disconnect", 0));
                me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Switch language"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; menu_restart; menu_cmd languageselect", 0));
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qh b/qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qh
new file mode 100644 (file)
index 0000000..6028a44
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticLanguageWarningDialog, XonoticDialog)
+       METHOD(XonoticLanguageWarningDialog, fill, void(entity));
+       ATTRIB(XonoticLanguageWarningDialog, title, string, _("Warning"))
+       ATTRIB(XonoticLanguageWarningDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticLanguageWarningDialog, intendedWidth, float, 0.6)
+       ATTRIB(XonoticLanguageWarningDialog, rows, float, 5)
+       ATTRIB(XonoticLanguageWarningDialog, columns, float, 4)
+ENDCLASS(XonoticLanguageWarningDialog)
index d8e55cb9da27829f2143cde516c7288627d8ee3c..1ec53c623eebe6bec086520cf9e52b2c7f788958 100644 (file)
@@ -1,17 +1,13 @@
-#ifndef DIALOG_SETTINGS_VIDEO_H
-#define DIALOG_SETTINGS_VIDEO_H
-#include "tab.qc"
-CLASS(XonoticVideoSettingsTab, XonoticTab)
-       METHOD(XonoticVideoSettingsTab, fill, void(entity));
-       ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticVideoSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
-       ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
-ENDCLASS(XonoticVideoSettingsTab)
-entity makeXonoticVideoSettingsTab();
-#endif
+#include "dialog_settings_video.qh"
+
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "checkbox.qh"
+#include "slider.qh"
+#include "slider_resolution.qh"
+#include "radiobutton.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticVideoSettingsTab()
 {
        entity me;
@@ -176,4 +172,3 @@ void XonoticVideoSettingsTab_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, videoApplyButton);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_video.qh b/qcsrc/menu/xonotic/dialog_settings_video.qh
new file mode 100644 (file)
index 0000000..0abe322
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticVideoSettingsTab, XonoticTab)
+       METHOD(XonoticVideoSettingsTab, fill, void(entity));
+       ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticVideoSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2)  // added extra .2 for center space
+       ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
+ENDCLASS(XonoticVideoSettingsTab)
+entity makeXonoticVideoSettingsTab();
index 1cdc2826781420dae8df98a6af112ef0cb983601..20984034db9c8887cf186ace4ba7be84e0e47a6f 100644 (file)
@@ -1,19 +1,10 @@
-#ifndef DIALOG_SINGLEPLAYER_H
-#define DIALOG_SINGLEPLAYER_H
-#include "dialog.qc"
-CLASS(XonoticSingleplayerDialog, XonoticDialog)
-       METHOD(XonoticSingleplayerDialog, fill, void(entity));
-       ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer"))
-       ATTRIB(XonoticSingleplayerDialog, tooltip, string, _("Play the singleplayer campaign or instant action matches against bots"))
-       ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
-       ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80)
-       ATTRIB(XonoticSingleplayerDialog, rows, float, 24)
-       ATTRIB(XonoticSingleplayerDialog, columns, float, 5)
-       ATTRIB(XonoticSingleplayerDialog, campaignBox, entity, NULL)
-ENDCLASS(XonoticSingleplayerDialog)
-#endif
+#include "dialog_singleplayer.qh"
 
-#ifdef IMPLEMENTATION
+#include <common/mapinfo.qh>
+#include "bigbutton.qh"
+#include "radiobutton.qh"
+#include "textlabel.qh"
+#include "campaign.qh"
 
 void InstantAction_LoadMap(entity btn, entity dummy)
 {
@@ -145,4 +136,3 @@ void XonoticSingleplayerDialog_fill(entity me)
                        e.onClick = CampaignList_LoadMap;
                        e.onClickEntity = me.campaignBox;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.qh b/qcsrc/menu/xonotic/dialog_singleplayer.qh
new file mode 100644 (file)
index 0000000..b3dabaf
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticSingleplayerDialog, XonoticDialog)
+       METHOD(XonoticSingleplayerDialog, fill, void(entity));
+       ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer"))
+       ATTRIB(XonoticSingleplayerDialog, tooltip, string, _("Play the singleplayer campaign or instant action matches against bots"))
+       ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
+       ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80)
+       ATTRIB(XonoticSingleplayerDialog, rows, float, 24)
+       ATTRIB(XonoticSingleplayerDialog, columns, float, 5)
+       ATTRIB(XonoticSingleplayerDialog, campaignBox, entity, NULL)
+ENDCLASS(XonoticSingleplayerDialog)
index b7b97c973378ceaece93ecb72d24900690f2451a..ff81d7d89355d3e45f536ea375030d656141d04f 100644 (file)
@@ -1,18 +1,8 @@
-#ifndef DIALOG_SINGLEPLAYER_WINNER_H
-#define DIALOG_SINGLEPLAYER_WINNER_H
-#include "dialog.qc"
-CLASS(XonoticWinnerDialog, XonoticDialog)
-       METHOD(XonoticWinnerDialog, fill, void(entity));
-       METHOD(XonoticWinnerDialog, focusEnter, void(entity));
-       ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
-       ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
-       ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
-       ATTRIB(XonoticWinnerDialog, rows, float, 12)
-       ATTRIB(XonoticWinnerDialog, columns, float, 3)
-ENDCLASS(XonoticWinnerDialog)
-#endif
+#include "dialog_singleplayer_winner.qh"
+
+#include "image.qh"
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticWinnerDialog_fill(entity me)
 {
        entity e;
@@ -29,4 +19,3 @@ void XonoticWinnerDialog_focusEnter(entity me)
 {
        m_play_click_sound(MENU_SOUND_WINNER);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_singleplayer_winner.qh b/qcsrc/menu/xonotic/dialog_singleplayer_winner.qh
new file mode 100644 (file)
index 0000000..1de958b
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticWinnerDialog, XonoticDialog)
+       METHOD(XonoticWinnerDialog, fill, void(entity));
+       METHOD(XonoticWinnerDialog, focusEnter, void(entity));
+       ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
+       ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
+       ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
+       ATTRIB(XonoticWinnerDialog, rows, float, 12)
+       ATTRIB(XonoticWinnerDialog, columns, float, 3)
+ENDCLASS(XonoticWinnerDialog)
index 15e023f79a2356106696dac0933183b663872044..b12de7c2958b87d2a104b3845589f7b5c18104de 100644 (file)
@@ -1,24 +1,7 @@
-#ifndef DIALOG_TEAMSELECT_H
-#define DIALOG_TEAMSELECT_H
-#include "rootdialog.qc"
-CLASS(XonoticTeamSelectDialog, XonoticRootDialog)
-       METHOD(XonoticTeamSelectDialog, fill, void(entity));
-       METHOD(XonoticTeamSelectDialog, showNotify, void(entity));
-       ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection"))
-       ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
-       ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
-       ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
-       ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, true)
-ENDCLASS(XonoticTeamSelectDialog)
-#endif
+#include "dialog_teamselect.qh"
+
+#include "bigcommandbutton.qh"
 
-#ifdef IMPLEMENTATION
 entity makeTeamButton_T(string theName, vector theColor, string commandtheName, string theTooltip)
 {
        entity b;
@@ -59,6 +42,3 @@ void XonoticTeamSelectDialog_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 4, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", 1));
 }
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_teamselect.qh b/qcsrc/menu/xonotic/dialog_teamselect.qh
new file mode 100644 (file)
index 0000000..b4056bb
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticTeamSelectDialog, XonoticRootDialog)
+       METHOD(XonoticTeamSelectDialog, fill, void(entity));
+       METHOD(XonoticTeamSelectDialog, showNotify, void(entity));
+       ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection"))
+       ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
+       ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
+       ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
+       ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, true)
+ENDCLASS(XonoticTeamSelectDialog)
diff --git a/qcsrc/menu/xonotic/gametypebutton.qc b/qcsrc/menu/xonotic/gametypebutton.qc
deleted file mode 100644 (file)
index fb80866..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef GAMETYPEBUTTON_H
-#define GAMETYPEBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticGametypeButton, RadioButton)
-       METHOD(XonoticGametypeButton, configureXonoticGametypeButton, void(entity, float, string, string));
-       METHOD(XonoticGametypeButton, setChecked, void(entity, float));
-       ATTRIB(XonoticGametypeButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticGametypeButton, image, string, SKINGFX_BUTTON_BIG)
-       ATTRIB(XonoticGametypeButton, color, vector, SKINCOLOR_BUTTON_N)
-       ATTRIB(XonoticGametypeButton, colorC, vector, SKINCOLOR_BUTTON_C)
-       ATTRIB(XonoticGametypeButton, colorF, vector, SKINCOLOR_BUTTON_F)
-       ATTRIB(XonoticGametypeButton, colorD, vector, SKINCOLOR_BUTTON_D)
-       ATTRIB(XonoticGametypeButton, srcMulti, float, 1)
-       ATTRIB(XonoticGametypeButton, useDownAsChecked, float, 1)
-
-       ATTRIB(XonoticGametypeButton, cvarName, string, string_null)
-       METHOD(XonoticGametypeButton, loadCvars, void(entity));
-       METHOD(XonoticGametypeButton, saveCvars, void(entity));
-
-       ATTRIB(XonoticGametypeButton, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticGametypeButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticGametypeButton)
-entity makeXonoticGametypeButton(float, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-void GameTypeButton_Click(entity me, entity other);
-entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
-{
-       entity me;
-       me = NEW(XonoticGametypeButton);
-       me.configureXonoticGametypeButton(me, theGroup, theCvar, theText, theTooltip);
-       return me;
-}
-void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText, string theTooltip)
-{
-       me.cvarName = (theCvar) ? theCvar : string_null;
-       me.loadCvars(me);
-       setZonedTooltip(me, theTooltip, theCvar);
-       me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
-       me.align = 0.5;
-       me.onClick = GameTypeButton_Click;
-       me.onClickEntity = NULL;
-}
-void XonoticGametypeButton_setChecked(entity me, float val)
-{
-       if(val != me.checked)
-       {
-               me.checked = val;
-               me.saveCvars(me);
-       }
-}
-void XonoticGametypeButton_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       me.checked = cvar(me.cvarName);
-}
-void XonoticGametypeButton_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       cvar_set(me.cvarName, ftos(me.checked));
-}
-void GameTypeButton_Click(entity me, entity other)
-{
-       RadioButton_Click(me, other);
-       me.parent.gameTypeChangeNotify(me.parent);
-}
-#endif
index f04a0d23a60b39b7f6c8b060598e1bbd0ea75867..9ee031dc783e6196dca7df6592ba6ab5f63fb6ea 100644 (file)
@@ -1,29 +1,7 @@
-#ifndef GAMETYPELIST_H
-#define GAMETYPELIST_H
-#include "listbox.qc"
-CLASS(XonoticGametypeList, XonoticListBox)
-       METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity));
-       ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
-       METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticGametypeList, setSelected, void(entity, float));
-       METHOD(XonoticGametypeList, loadCvars, void(entity));
-       METHOD(XonoticGametypeList, saveCvars, void(entity));
-       METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticGametypeList, focusedItemChangeNotify, void(entity));
+#include "gametypelist.qh"
 
-       ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
-       ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0)
-       ATTRIB(XonoticGametypeList, columnIconSize, float, 0)
-       ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticGametypeList, columnNameSize, float, 0)
-ENDCLASS(XonoticGametypeList)
-entity makeXonoticGametypeList();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "dialog_multiplayer_create.qh"
+#include <common/mapinfo.qh>
 
 entity makeXonoticGametypeList()
 {
@@ -113,7 +91,7 @@ void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool
 void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
        me.itemAbsSize = '0 0 0';
-       SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       SUPER(XonoticGametypeList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 
        me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
        me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
@@ -145,4 +123,3 @@ void XonoticGametypeList_focusedItemChangeNotify(entity me)
        else
                clearTooltip(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/gametypelist.qh b/qcsrc/menu/xonotic/gametypelist.qh
new file mode 100644 (file)
index 0000000..95eceaa
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticGametypeList, XonoticListBox)
+       METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity));
+       ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
+       METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticGametypeList, setSelected, void(entity, float));
+       METHOD(XonoticGametypeList, loadCvars, void(entity));
+       METHOD(XonoticGametypeList, saveCvars, void(entity));
+       METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticGametypeList, focusedItemChangeNotify, void(entity));
+
+       ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
+       ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0)
+       ATTRIB(XonoticGametypeList, columnIconSize, float, 0)
+       ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticGametypeList, columnNameSize, float, 0)
+ENDCLASS(XonoticGametypeList)
+entity makeXonoticGametypeList();
index b3bdc624332ea2cec2991cc4aceece1e18066fc9..66c96046d88e9e4a2b156b2ed2d149188613ab22 100644 (file)
@@ -1,49 +1,6 @@
-#ifndef HUDSKINLIST_H
-#define HUDSKINLIST_H
-#include "listbox.qc"
-CLASS(XonoticHUDSkinList, XonoticListBox)
-       METHOD(XonoticHUDSkinList, configureXonoticHUDSkinList, void(entity));
-       ATTRIB(XonoticHUDSkinList, rowsPerItem, float, 1)
-       METHOD(XonoticHUDSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticHUDSkinList, draw, void(entity));
-       METHOD(XonoticHUDSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticHUDSkinList, getHUDSkins, void(entity));
-       METHOD(XonoticHUDSkinList, setHUDSkin, void(entity));
-       METHOD(XonoticHUDSkinList, hudskinName, string(entity, float));
-       METHOD(XonoticHUDSkinList, hudskinPath, string(entity, float));
-       METHOD(XonoticHUDSkinList, hudskinTitle, string(entity, float));
-       METHOD(XonoticHUDSkinList, hudskinAuthor, string(entity, float));
-       METHOD(XonoticHUDSkinList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticHUDSkinList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticHUDSkinList, destroy, void(entity));
-       METHOD(XonoticHUDSkinList, showNotify, void(entity));
+#include "hudskinlist.qh"
 
-       ATTRIB(XonoticHUDSkinList, listHUDSkin, float, -1)
-       ATTRIB(XonoticHUDSkinList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticHUDSkinList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticHUDSkinList, columnNameSize, float, 0)
-       ATTRIB(XonoticHUDSkinList, realUpperMargin, float, 0)
-       ATTRIB(XonoticHUDSkinList, origin, vector, '0 0 0')
-       ATTRIB(XonoticHUDSkinList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticHUDSkinList, filterString, string, string_null)
-       ATTRIB(XonoticHUDSkinList, delayedRefreshTime, float, 0)
-       ATTRIB(XonoticHUDSkinList, savedName, string, string_null)
-ENDCLASS(XonoticHUDSkinList)
-
-#ifndef IMPLEMENTATION
-// public:
-entity hudskinlist;
-entity makeXonoticHUDSkinList();
-void SaveHUDSkin_Click(entity btn, entity me);
-void SetHUDSkin_Click(entity btn, entity me);
-#endif
-void HUDSkinList_Refresh_Click(entity btn, entity me);
-void HUDSkinList_Filter_Change(entity box, entity me);
-void HUDSkinList_SavedName_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "inputbox.qh"
 
 entity makeXonoticHUDSkinList()
 {
@@ -306,5 +263,3 @@ float XonoticHUDSkinList_keyDown(entity me, float scan, float ascii, float shift
                return SUPER(XonoticHUDSkinList).keyDown(me, scan, ascii, shift);
        }
 }
-#endif
-
diff --git a/qcsrc/menu/xonotic/hudskinlist.qh b/qcsrc/menu/xonotic/hudskinlist.qh
new file mode 100644 (file)
index 0000000..f580869
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticHUDSkinList, XonoticListBox)
+       METHOD(XonoticHUDSkinList, configureXonoticHUDSkinList, void(entity));
+       ATTRIB(XonoticHUDSkinList, rowsPerItem, float, 1)
+       METHOD(XonoticHUDSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticHUDSkinList, draw, void(entity));
+       METHOD(XonoticHUDSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticHUDSkinList, getHUDSkins, void(entity));
+       METHOD(XonoticHUDSkinList, setHUDSkin, void(entity));
+       METHOD(XonoticHUDSkinList, hudskinName, string(entity, float));
+       METHOD(XonoticHUDSkinList, hudskinPath, string(entity, float));
+       METHOD(XonoticHUDSkinList, hudskinTitle, string(entity, float));
+       METHOD(XonoticHUDSkinList, hudskinAuthor, string(entity, float));
+       METHOD(XonoticHUDSkinList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticHUDSkinList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticHUDSkinList, destroy, void(entity));
+       METHOD(XonoticHUDSkinList, showNotify, void(entity));
+
+       ATTRIB(XonoticHUDSkinList, listHUDSkin, float, -1)
+       ATTRIB(XonoticHUDSkinList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticHUDSkinList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticHUDSkinList, columnNameSize, float, 0)
+       ATTRIB(XonoticHUDSkinList, realUpperMargin, float, 0)
+       ATTRIB(XonoticHUDSkinList, origin, vector, '0 0 0')
+       ATTRIB(XonoticHUDSkinList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticHUDSkinList, filterString, string, string_null)
+       ATTRIB(XonoticHUDSkinList, delayedRefreshTime, float, 0)
+       ATTRIB(XonoticHUDSkinList, savedName, string, string_null)
+ENDCLASS(XonoticHUDSkinList)
+entity hudskinlist;
+entity makeXonoticHUDSkinList();
+void SaveHUDSkin_Click(entity btn, entity me);
+void SetHUDSkin_Click(entity btn, entity me);
+void HUDSkinList_Filter_Change(entity box, entity me);
+void HUDSkinList_Refresh_Click(entity btn, entity me);
+void HUDSkinList_SavedName_Change(entity box, entity me);
index 1f25899c142840647bec37c509e399dfd646aec7..f99fc5d94c30079c5c77cc04f07524297d8d99f1 100644 (file)
@@ -1,13 +1,5 @@
-#ifndef IMAGE_H
-#define IMAGE_H
-#include "../item/image.qc"
-CLASS(XonoticImage, Image)
-       METHOD(XonoticImage, configureXonoticImage, void(entity, string, float));
-ENDCLASS(XonoticImage)
-entity makeXonoticImage(string theImage, float theAspect);
-#endif
+#include "image.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticImage(string theImage, float theAspect)
 {
        entity me;
@@ -20,4 +12,3 @@ void XonoticImage_configureXonoticImage(entity me, string theImage, float theAsp
        me.configureImage(me, theImage);
        me.forcedAspect = theAspect;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/image.qh b/qcsrc/menu/xonotic/image.qh
new file mode 100644 (file)
index 0000000..b31c703
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "../item/image.qh"
+CLASS(XonoticImage, Image)
+       METHOD(XonoticImage, configureXonoticImage, void(entity, string, float));
+ENDCLASS(XonoticImage)
+entity makeXonoticImage(string theImage, float theAspect);
index 6dc49c02ea7ec9df3c7d6e9437d0898b4acd0240..22a7ce71741284dd91f7969c865ffe644a59e157 100644 (file)
@@ -1,43 +1,5 @@
-#ifndef INPUTBOX_H
-#define INPUTBOX_H
-#include "../item/inputbox.qc"
-CLASS(XonoticInputBox, InputBox)
-       METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string, string));
-       METHOD(XonoticInputBox, focusLeave, void(entity));
-       METHOD(XonoticInputBox, setText, void(entity, string));
-       METHOD(XonoticInputBox, keyDown, float(entity, float, float, float));
-       ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
-       ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
-       ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
-       ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
-       ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
-       ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
-       ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
+#include "inputbox.qh"
 
-       ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
-
-       // Clear button attributes
-       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
-       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
-       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
-       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
-       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
-
-       ATTRIB(XonoticInputBox, cvarName, string, string_null)
-       METHOD(XonoticInputBox, loadCvars, void(entity));
-       METHOD(XonoticInputBox, saveCvars, void(entity));
-       ATTRIB(XonoticInputBox, sendCvars, float, 0)
-
-       ATTRIB(XonoticInputBox, saveImmediately, float, 0)
-ENDCLASS(XonoticInputBox)
-entity makeXonoticInputBox_T(float, string, string theTooltip);
-entity makeXonoticInputBox(float, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticInputBox_T(float doEditColorCodes, string theCvar, string theTooltip)
 {
        entity me;
@@ -106,4 +68,3 @@ float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
                r = 1;
        return r;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/inputbox.qh b/qcsrc/menu/xonotic/inputbox.qh
new file mode 100644 (file)
index 0000000..c098179
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "../item/inputbox.qh"
+CLASS(XonoticInputBox, InputBox)
+       METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string, string));
+       METHOD(XonoticInputBox, focusLeave, void(entity));
+       METHOD(XonoticInputBox, setText, void(entity, string));
+       METHOD(XonoticInputBox, keyDown, float(entity, float, float, float));
+       ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
+       ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
+       ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
+       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
+       ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
+       ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
+       ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
+       ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
+       ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
+
+       ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
+
+       // Clear button attributes
+       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON)  // bound to range -1, 0
+       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
+       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
+       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
+       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
+
+       ATTRIB(XonoticInputBox, cvarName, string, string_null)
+       METHOD(XonoticInputBox, loadCvars, void(entity));
+       METHOD(XonoticInputBox, saveCvars, void(entity));
+       ATTRIB(XonoticInputBox, sendCvars, float, 0)
+
+       ATTRIB(XonoticInputBox, saveImmediately, float, 0)
+ENDCLASS(XonoticInputBox)
+entity makeXonoticInputBox_T(float, string, string theTooltip);
+entity makeXonoticInputBox(float, string);
index 9ce18c6b0a97357bc97e28b7fcefdb897d605ed5..3cb20d3018dfaa69b20c0ac3867dd62f98d01992 100644 (file)
@@ -1,42 +1,10 @@
-#ifndef KEYBINDER_H
-#define KEYBINDER_H
-#include "listbox.qc"
-CLASS(XonoticKeyBinder, XonoticListBox)
-       METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity));
-       ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
-       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticKeyBinder, showNotify, void(entity));
-       METHOD(XonoticKeyBinder, setSelected, void(entity, float));
-       METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float));
-       METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float));
-       METHOD(XonoticKeyBinder, destroy, void(entity));
-
-       ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
-       ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0)
-       ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0)
-       ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
-       ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
-
-       METHOD(XonoticKeyBinder, loadKeyBinds, void(entity));
-       ATTRIB(XonoticKeyBinder, previouslySelected, int, -1)
-       ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
-       ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
-       ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
-       ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
-       ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
-       METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string));
-ENDCLASS(XonoticKeyBinder)
-entity makeXonoticKeyBinder();
-void KeyBinder_Bind_Change(entity btn, entity me);
-void KeyBinder_Bind_Clear(entity btn, entity me);
-void KeyBinder_Bind_Edit(entity btn, entity me);
-void KeyBinder_Bind_Reset_All(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "keybinder.qh"
+
+#include <common/weapons/all.qh>
+.int flags;
+
+#include "button.qh"
+#include "dialog_settings_input_userbind.qh"
 
 const string KEY_NOT_BOUND_CMD = "// not bound";
 
@@ -477,4 +445,3 @@ void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isS
                draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
        }
 }
-#endif
diff --git a/qcsrc/menu/xonotic/keybinder.qh b/qcsrc/menu/xonotic/keybinder.qh
new file mode 100644 (file)
index 0000000..4d0482d
--- /dev/null
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticKeyBinder, XonoticListBox)
+       METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity));
+       ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
+       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticKeyBinder, showNotify, void(entity));
+       METHOD(XonoticKeyBinder, setSelected, void(entity, float));
+       METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float));
+       METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float));
+       METHOD(XonoticKeyBinder, destroy, void(entity));
+
+       ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
+       ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0)
+       ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0)
+       ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
+       ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
+
+       METHOD(XonoticKeyBinder, loadKeyBinds, void(entity));
+       ATTRIB(XonoticKeyBinder, previouslySelected, int, -1)
+       ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
+       ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
+       METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string));
+ENDCLASS(XonoticKeyBinder)
+entity makeXonoticKeyBinder();
+void KeyBinder_Bind_Change(entity btn, entity me);
+void KeyBinder_Bind_Clear(entity btn, entity me);
+void KeyBinder_Bind_Edit(entity btn, entity me);
+void KeyBinder_Bind_Reset_All(entity btn, entity me);
index 66dbb835127d4ffc4812f69cda19296ba461b47d..6840769d72eb8e63f36cc5a1a440e1a07b8745b6 100644 (file)
@@ -1,40 +1,7 @@
-#ifndef LANGUAGELIST_H
-#define LANGUAGELIST_H
-#include "listbox.qc"
-CLASS(XonoticLanguageList, XonoticListBox)
-       METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity));
-       ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
-       METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticLanguageList, setSelected, void(entity, float));
-       METHOD(XonoticLanguageList, loadCvars, void(entity));
-       METHOD(XonoticLanguageList, saveCvars, void(entity));
-
-       ATTRIB(XonoticLanguageList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticLanguageList, realUpperMargin, float, 0)
-       ATTRIB(XonoticLanguageList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticLanguageList, columnNameSize, float, 0)
-       ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
-       ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
-
-       METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)); // enter handling
-
-       METHOD(XonoticLanguageList, destroy, void(entity));
-
-       ATTRIB(XonoticLanguageList, languagelist, float, -1)
-       METHOD(XonoticLanguageList, getLanguages, void(entity));
-       METHOD(XonoticLanguageList, setLanguage, void(entity));
-       METHOD(XonoticLanguageList, languageParameter, string(entity, float, float));
-
-       ATTRIB(XonoticLanguageList, name, string, "languageselector") // change this to make it noninteractive (for first run dialog)
-ENDCLASS(XonoticLanguageList)
-
-entity makeXonoticLanguageList();
-void SetLanguage_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "languagelist.qh"
+
+#include "../item/modalcontroller.qh"
+#include "mainwindow.qh"
 
 const float LANGPARM_ID = 0;
 const float LANGPARM_NAME = 1;
@@ -216,5 +183,3 @@ void SetLanguage_Click(entity btn, entity me)
 {
        me.setLanguage(me);
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/languagelist.qh b/qcsrc/menu/xonotic/languagelist.qh
new file mode 100644 (file)
index 0000000..8febd64
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticLanguageList, XonoticListBox)
+       METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity));
+       ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
+       METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticLanguageList, setSelected, void(entity, float));
+       METHOD(XonoticLanguageList, loadCvars, void(entity));
+       METHOD(XonoticLanguageList, saveCvars, void(entity));
+
+       ATTRIB(XonoticLanguageList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticLanguageList, realUpperMargin, float, 0)
+       ATTRIB(XonoticLanguageList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticLanguageList, columnNameSize, float, 0)
+       ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
+       ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
+
+       METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float));  // enter handling
+
+       METHOD(XonoticLanguageList, destroy, void(entity));
+
+       ATTRIB(XonoticLanguageList, languagelist, float, -1)
+       METHOD(XonoticLanguageList, getLanguages, void(entity));
+       METHOD(XonoticLanguageList, setLanguage, void(entity));
+       METHOD(XonoticLanguageList, languageParameter, string(entity, float, float));
+
+       ATTRIB(XonoticLanguageList, name, string, "languageselector")  // change this to make it noninteractive (for first run dialog)
+ENDCLASS(XonoticLanguageList)
+
+entity makeXonoticLanguageList();
+void SetLanguage_Click(entity btn, entity me);
index 3ce6ed7cc79100fbae2c09e6b944556ec87a1925..aa8487c8bf0c50db25a2c1e45e2dfb976e3a1d9f 100644 (file)
@@ -1,25 +1,5 @@
-#ifndef LISTBOX_H
-#define LISTBOX_H
-#include "../item/listbox.qc"
-CLASS(XonoticListBox, ListBox)
-       METHOD(XonoticListBox, configureXonoticListBox, void(entity));
-       ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
-       ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
-       ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
-       ATTRIB(XonoticListBox, rowsPerItem, float, 1)
-       METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector));
-       ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
-       ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
-       ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
-       ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
-       ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
-       ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
-ENDCLASS(XonoticListBox)
-entity makeXonoticListBox();
-#endif
+#include "listbox.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticListBox()
 {
        entity me;
@@ -36,4 +16,3 @@ void XonoticListBox_resizeNotify(entity me, vector relOrigin, vector relSize, ve
        me.itemHeight = me.rowsPerItem * me.fontSize / absSize.y;
        SUPER(XonoticListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/listbox.qh b/qcsrc/menu/xonotic/listbox.qh
new file mode 100644 (file)
index 0000000..3e789e7
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "../item/listbox.qh"
+CLASS(XonoticListBox, ListBox)
+       METHOD(XonoticListBox, configureXonoticListBox, void(entity));
+       ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
+       ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
+       ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
+       ATTRIB(XonoticListBox, rowsPerItem, float, 1)
+       METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector));
+       ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
+       ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
+       ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
+       ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
+       ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
+       ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
+ENDCLASS(XonoticListBox)
+entity makeXonoticListBox();
index 3d41104488085fe1c629fc8980f728a055b921d6..fb25eebdef39bc2d4bc92cb5b1fd78d0f33c767e 100644 (file)
@@ -1,31 +1,50 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-#include "../item/modalcontroller.qc"
-CLASS(MainWindow, ModalController)
-       METHOD(MainWindow, configureMainWindow, void(entity));
-       METHOD(MainWindow, draw, void(entity));
-       ATTRIB(MainWindow, firstRunDialog, entity, NULL)
-       ATTRIB(MainWindow, advancedDialog, entity, NULL)
-       ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
-       ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
-       ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
-       ATTRIB(MainWindow, winnerDialog, entity, NULL)
-       ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
-       ATTRIB(MainWindow, cvarsDialog, entity, NULL)
-       ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
-       ATTRIB(MainWindow, viewDialog, entity, NULL)
-       ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
-       ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
-       ATTRIB(MainWindow, mainNexposee, entity, NULL)
-       ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
-       ATTRIB(MainWindow, dialogToShow, entity, NULL)
-       ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
-       ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
-       ATTRIB(MainWindow, resetDialog, entity, NULL)
-ENDCLASS(MainWindow)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "mainwindow.qh"
+
+#include "nexposee.qh"
+#include "inputbox.qh"
+#include "dialog_firstrun.qh"
+#include "dialog_hudsetup_exit.qh"
+#include "dialog_hudpanel_notification.qh"
+#include "dialog_hudpanel_ammo.qh"
+#include "dialog_hudpanel_healtharmor.qh"
+#include "dialog_hudpanel_chat.qh"
+#include "dialog_hudpanel_modicons.qh"
+#include "dialog_hudpanel_powerups.qh"
+#include "dialog_hudpanel_pressedkeys.qh"
+#include "dialog_hudpanel_racetimer.qh"
+#include "dialog_hudpanel_radar.qh"
+#include "dialog_hudpanel_score.qh"
+#include "dialog_hudpanel_timer.qh"
+#include "dialog_hudpanel_vote.qh"
+#include "dialog_hudpanel_weapons.qh"
+#include "dialog_hudpanel_engineinfo.qh"
+#include "dialog_hudpanel_infomessages.qh"
+#include "dialog_hudpanel_physics.qh"
+#include "dialog_hudpanel_centerprint.qh"
+#include "dialog_hudpanel_itemstime.qh"
+#include "dialog_hudpanel_quickmenu.qh"
+
+#include "dialog_settings_input_userbind.qh"
+#include "dialog_settings_misc_cvars.qh"
+#include "dialog_settings_misc_reset.qh"
+#include "dialog_settings_user_languagewarning.qh"
+#include "dialog_settings_game_hudconfirm.qh"
+#include "dialog_singleplayer_winner.qh"
+#include "dialog_multiplayer_join_serverinfo.qh"
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "dialog_multiplayer_create_mutators.qh"
+#include "dialog_sandboxtools.qh"
+#include "dialog_monstertools.qh"
+#include "dialog_teamselect.qh"
+#include "dialog_singleplayer.qh"
+#include "dialog_multiplayer.qh"
+#include "dialog_settings.qh"
+#include "dialog_credits.qh"
+#include "dialog_quit.qh"
+
 void MainWindow_draw(entity me)
 {
        SUPER(MainWindow).draw(me);
@@ -256,6 +275,3 @@ void MainWindow_configureMainWindow(entity me)
        if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
                me.dialogToShow = me.firstRunDialog;
 }
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/mainwindow.qh b/qcsrc/menu/xonotic/mainwindow.qh
new file mode 100644 (file)
index 0000000..daf5e05
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <menu/item/modalcontroller.qh>
+
+CLASS(MainWindow, ModalController)
+       METHOD(MainWindow, configureMainWindow, void(entity));
+       METHOD(MainWindow, draw, void(entity));
+       ATTRIB(MainWindow, firstRunDialog, entity, NULL)
+       ATTRIB(MainWindow, advancedDialog, entity, NULL)
+       ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
+       ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
+       ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
+       ATTRIB(MainWindow, winnerDialog, entity, NULL)
+       ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
+       ATTRIB(MainWindow, cvarsDialog, entity, NULL)
+       ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
+       ATTRIB(MainWindow, viewDialog, entity, NULL)
+       ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
+       ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
+       ATTRIB(MainWindow, mainNexposee, entity, NULL)
+       ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
+       ATTRIB(MainWindow, dialogToShow, entity, NULL)
+       ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
+       ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
+       ATTRIB(MainWindow, resetDialog, entity, NULL)
+ENDCLASS(MainWindow)
index 91d8eaa3de36d6bf14896d31cea4895f8aaf3e20..4b41f5bd3be6eb514600614e290c834df62f3a49 100644 (file)
@@ -1,63 +1,12 @@
-#ifndef MAPLIST_H
-#define MAPLIST_H
-#include "listbox.qc"
-CLASS(XonoticMapList, XonoticListBox)
-       METHOD(XonoticMapList, configureXonoticMapList, void(entity));
-       ATTRIB(XonoticMapList, rowsPerItem, float, 4)
-       METHOD(XonoticMapList, draw, void(entity));
-       METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticMapList, refilter, void(entity));
-       METHOD(XonoticMapList, refilterCallback, void(entity, entity));
-       METHOD(XonoticMapList, keyDown, float(entity, float, float, float));
-
-       ATTRIB(XonoticMapList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticMapList, columnPreviewOrigin, float, 0)
-       ATTRIB(XonoticMapList, columnPreviewSize, float, 0)
-       ATTRIB(XonoticMapList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticMapList, columnNameSize, float, 0)
-       ATTRIB(XonoticMapList, checkMarkOrigin, vector, '0 0 0')
-       ATTRIB(XonoticMapList, checkMarkSize, vector, '0 0 0')
-       ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
-       ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
-
-       ATTRIB(XonoticMapList, lastGametype, float, 0)
-       ATTRIB(XonoticMapList, lastFeatures, float, 0)
-
-       ATTRIB(XonoticMapList, origin, vector, '0 0 0')
-       ATTRIB(XonoticMapList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticMapList, g_maplistCache, string, string_null)
-       METHOD(XonoticMapList, g_maplistCacheToggle, void(entity, float));
-       METHOD(XonoticMapList, g_maplistCacheQuery, float(entity, float));
-
-       ATTRIB(XonoticMapList, stringFilter, string, string_null)
-       ATTRIB(XonoticMapList, stringFilterBox, entity, NULL)
-
-       ATTRIB(XonoticMapList, startButton, entity, NULL)
-
-       METHOD(XonoticMapList, loadCvars, void(entity));
-
-       ATTRIB(XonoticMapList, typeToSearchString, string, string_null)
-       ATTRIB(XonoticMapList, typeToSearchTime, float, 0)
-
-       METHOD(XonoticMapList, destroy, void(entity));
-
-       ATTRIB(XonoticMapList, alphaBG, float, 0)
-ENDCLASS(XonoticMapList)
-entity makeXonoticMapList();
-void MapList_StringFilterBox_Change(entity box, entity me);
-float MapList_StringFilterBox_keyDown(entity me, float key, float ascii, float shift);
-void MapList_Add_Shown(entity btn, entity me);
-void MapList_Remove_Shown(entity btn, entity me);
-void MapList_Add_All(entity btn, entity me);
-void MapList_Remove_All(entity btn, entity me);
-void MapList_LoadMap(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "maplist.qh"
+
+#include <common/mapinfo.qh>
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "mainwindow.qh"
+#include "inputbox.qh"
+
+.bool disabled;
+
 void XonoticMapList_destroy(entity me)
 {
        MapInfo_Shutdown();
@@ -458,4 +407,3 @@ float MapList_StringFilterBox_keyDown(entity me, float scan, float ascii, float
        }
        return SUPER(XonoticInputBox).keyDown(me, scan, ascii, shift);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/maplist.qh b/qcsrc/menu/xonotic/maplist.qh
new file mode 100644 (file)
index 0000000..de9d7e2
--- /dev/null
@@ -0,0 +1,57 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticMapList, XonoticListBox)
+       METHOD(XonoticMapList, configureXonoticMapList, void(entity));
+       ATTRIB(XonoticMapList, rowsPerItem, float, 4)
+       METHOD(XonoticMapList, draw, void(entity));
+       METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticMapList, refilter, void(entity));
+       METHOD(XonoticMapList, refilterCallback, void(entity, entity));
+       METHOD(XonoticMapList, keyDown, float(entity, float, float, float));
+
+       ATTRIB(XonoticMapList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticMapList, columnPreviewOrigin, float, 0)
+       ATTRIB(XonoticMapList, columnPreviewSize, float, 0)
+       ATTRIB(XonoticMapList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticMapList, columnNameSize, float, 0)
+       ATTRIB(XonoticMapList, checkMarkOrigin, vector, '0 0 0')
+       ATTRIB(XonoticMapList, checkMarkSize, vector, '0 0 0')
+       ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
+       ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
+
+       ATTRIB(XonoticMapList, lastGametype, float, 0)
+       ATTRIB(XonoticMapList, lastFeatures, float, 0)
+
+       ATTRIB(XonoticMapList, origin, vector, '0 0 0')
+       ATTRIB(XonoticMapList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticMapList, g_maplistCache, string, string_null)
+       METHOD(XonoticMapList, g_maplistCacheToggle, void(entity, float));
+       METHOD(XonoticMapList, g_maplistCacheQuery, float(entity, float));
+
+       ATTRIB(XonoticMapList, stringFilter, string, string_null)
+       ATTRIB(XonoticMapList, stringFilterBox, entity, NULL)
+
+       ATTRIB(XonoticMapList, startButton, entity, NULL)
+
+       METHOD(XonoticMapList, loadCvars, void(entity));
+
+       ATTRIB(XonoticMapList, typeToSearchString, string, string_null)
+       ATTRIB(XonoticMapList, typeToSearchTime, float, 0)
+
+       METHOD(XonoticMapList, destroy, void(entity));
+
+       ATTRIB(XonoticMapList, alphaBG, float, 0)
+ENDCLASS(XonoticMapList)
+entity makeXonoticMapList();
+void MapList_StringFilterBox_Change(entity box, entity me);
+float MapList_StringFilterBox_keyDown(entity me, float key, float ascii, float shift);
+void MapList_Add_Shown(entity btn, entity me);
+void MapList_Remove_Shown(entity btn, entity me);
+void MapList_Add_All(entity btn, entity me);
+void MapList_Remove_All(entity btn, entity me);
+void MapList_LoadMap(entity btn, entity me);
index 0d302eba8614a980c30476dd51b2c9487af3f46e..7c2bcacd9f9fcd25d5714db7a774571e1f1c4d8f 100644 (file)
@@ -1,14 +1,5 @@
-#ifndef NEXPOSEE_H
-#define NEXPOSEE_H
-#include "../item/nexposee.qc"
-CLASS(XonoticNexposee, Nexposee)
-       METHOD(XonoticNexposee, configureXonoticNexposee, void(entity));
-       METHOD(XonoticNexposee, close, void(entity));
-ENDCLASS(XonoticNexposee)
-entity makeXonoticNexposee();
-#endif
+#include "nexposee.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticNexposee()
 {
        entity me;
@@ -25,4 +16,3 @@ void XonoticNexposee_close(entity me)
 {
        m_goto(string_null); // hide
 }
-#endif
diff --git a/qcsrc/menu/xonotic/nexposee.qh b/qcsrc/menu/xonotic/nexposee.qh
new file mode 100644 (file)
index 0000000..3f4b876
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+
+#include "../item/nexposee.qh"
+CLASS(XonoticNexposee, Nexposee)
+       METHOD(XonoticNexposee, configureXonoticNexposee, void(entity));
+       METHOD(XonoticNexposee, close, void(entity));
+ENDCLASS(XonoticNexposee)
+entity makeXonoticNexposee();
index 24e5b2f5cdde2a54a5e6b159b1e56f3ff6acdd2c..db302e9a8ca11b435bd9e6b2e7c006fcc05268b8 100644 (file)
@@ -1,37 +1,6 @@
-#ifndef PICKER_H
-#define PICKER_H
-#include "../item.qc"
-CLASS(XonoticPicker, Item)
-       METHOD(XonoticPicker, configureXonoticPicker, void(entity));
-       METHOD(XonoticPicker, mousePress, float(entity, vector));
-       METHOD(XonoticPicker, mouseRelease, float(entity, vector));
-       METHOD(XonoticPicker, mouseMove, float(entity, vector));
-       METHOD(XonoticPicker, mouseDrag, float(entity, vector));
-       METHOD(XonoticPicker, keyDown, float(entity, float, float, float));
-       METHOD(XonoticPicker, draw, void(entity));
-       ATTRIB(XonoticPicker, focusable, float, 1)
-       ATTRIB(XonoticPicker, disabled, float, 0)
-       ATTRIB(XonoticPicker, alpha, float, 1)
-       ATTRIB(XonoticPicker, disabledAlpha, float, SKINALPHA_DISABLED)
-
-       ATTRIB(XonoticPicker, rows, float, 3)
-       ATTRIB(XonoticPicker, columns, float, 2)
-
-       METHOD(XonoticPicker, moveFocus, void(entity, vector, vector));
-       METHOD(XonoticPicker, cellSelect, void(entity, vector));
-       METHOD(XonoticPicker, cellDraw, void(entity, vector, vector));
-       METHOD(XonoticPicker, cellIsValid, bool(entity, vector));
-       ATTRIB(XonoticPicker, realCellSize, vector, '0 0 0')
-       ATTRIB(XonoticPicker, selectedCell, vector, '-1 -1 0')
-       ATTRIB(XonoticPicker, focusedCell, vector, '-1 -1 0')
-       ATTRIB(XonoticPicker, focusedCellAlpha, float, 0)
-       ATTRIB(XonoticPicker, focusedCellTime, float, 0)
-       ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
-ENDCLASS(XonoticPicker)
-entity makeXonoticPicker();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "picker.qh"
+
+.bool pressed;
 
 entity makeXonoticPicker()
 {
@@ -204,4 +173,3 @@ void XonoticPicker_draw(entity me)
 
        SUPER(XonoticPicker).draw(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/picker.qh b/qcsrc/menu/xonotic/picker.qh
new file mode 100644 (file)
index 0000000..c530c7c
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "../item.qh"
+CLASS(XonoticPicker, Item)
+       METHOD(XonoticPicker, configureXonoticPicker, void(entity));
+       METHOD(XonoticPicker, mousePress, float(entity, vector));
+       METHOD(XonoticPicker, mouseRelease, float(entity, vector));
+       METHOD(XonoticPicker, mouseMove, float(entity, vector));
+       METHOD(XonoticPicker, mouseDrag, float(entity, vector));
+       METHOD(XonoticPicker, keyDown, float(entity, float, float, float));
+       METHOD(XonoticPicker, draw, void(entity));
+       ATTRIB(XonoticPicker, focusable, float, 1)
+       ATTRIB(XonoticPicker, disabled, float, 0)
+       ATTRIB(XonoticPicker, alpha, float, 1)
+       ATTRIB(XonoticPicker, disabledAlpha, float, SKINALPHA_DISABLED)
+
+       ATTRIB(XonoticPicker, rows, float, 3)
+       ATTRIB(XonoticPicker, columns, float, 2)
+
+       METHOD(XonoticPicker, moveFocus, void(entity, vector, vector));
+       METHOD(XonoticPicker, cellSelect, void(entity, vector));
+       METHOD(XonoticPicker, cellDraw, void(entity, vector, vector));
+       METHOD(XonoticPicker, cellIsValid, bool(entity, vector));
+       ATTRIB(XonoticPicker, realCellSize, vector, '0 0 0')
+       ATTRIB(XonoticPicker, selectedCell, vector, '-1 -1 0')
+       ATTRIB(XonoticPicker, focusedCell, vector, '-1 -1 0')
+       ATTRIB(XonoticPicker, focusedCellAlpha, float, 0)
+       ATTRIB(XonoticPicker, focusedCellTime, float, 0)
+       ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
+ENDCLASS(XonoticPicker)
+entity makeXonoticPicker();
index 3fdea5ae2e513267fa9f10363bf8e08d4f5fc96f..c6033050ae6f45d9157b042039788773b67afa72 100644 (file)
@@ -1,28 +1,6 @@
-#ifndef PLAYERLIST_H
-#define PLAYERLIST_H
-#include "listbox.qc"
-CLASS(XonoticPlayerList, XonoticListBox)
-       ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
-       METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
-       ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
-       ATTRIB(XonoticPlayerList, columnScoreOrigin, float, 0)
-       ATTRIB(XonoticPlayerList, columnScoreSize, float, 0)
-       ATTRIB(XonoticPlayerList, realUpperMargin, float, 0)
-       ATTRIB(XonoticPlayerList, origin, vector, '0 0 0')
-       ATTRIB(XonoticPlayerList, itemAbsSize, vector, '0 0 0')
-       METHOD(XonoticPlayerList, setPlayerList, void(entity, string));
-       METHOD(XonoticPlayerList, getPlayerList, string(entity, float, float));
-       ATTRIB(XonoticPlayerList, playerList, float, -1)
-       ATTRIB(XonoticPlayerList, selectionDoesntMatter, bool, true)
-ENDCLASS(XonoticPlayerList)
-entity makeXonoticPlayerList();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "playerlist.qh"
+
+.float realUpperMargin2;
 
 const float PLAYERPARM_SCORE = 0;
 const float PLAYERPARM_PING = 1;
@@ -138,5 +116,3 @@ void XonoticPlayerList_drawListBoxItem(entity me, int i, vector absSize, bool is
        score = draw_TextShortenToWidth(score, me.columnScoreSize, 0, me.realFontSize);
        draw_Text(me.realUpperMargin2 * eY + (me.columnScoreOrigin + 1.00 * (me.columnScoreSize - draw_TextWidth(score, 1, me.realFontSize))) * eX, score, me.realFontSize, rgb, 1, 0);
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/playerlist.qh b/qcsrc/menu/xonotic/playerlist.qh
new file mode 100644 (file)
index 0000000..8474b91
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticPlayerList, XonoticListBox)
+       ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
+       METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
+       ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
+       ATTRIB(XonoticPlayerList, columnScoreOrigin, float, 0)
+       ATTRIB(XonoticPlayerList, columnScoreSize, float, 0)
+       ATTRIB(XonoticPlayerList, realUpperMargin, float, 0)
+       ATTRIB(XonoticPlayerList, origin, vector, '0 0 0')
+       ATTRIB(XonoticPlayerList, itemAbsSize, vector, '0 0 0')
+       METHOD(XonoticPlayerList, setPlayerList, void(entity, string));
+       METHOD(XonoticPlayerList, getPlayerList, string(entity, float, float));
+       ATTRIB(XonoticPlayerList, playerList, float, -1)
+       ATTRIB(XonoticPlayerList, selectionDoesntMatter, bool, true)
+ENDCLASS(XonoticPlayerList)
+entity makeXonoticPlayerList();
index 3af8238ddd1812f7b56c28f87309eb9fdee24de5..1a90fa737827bc8e2afaa6b074306d815439d046 100644 (file)
@@ -1,36 +1,5 @@
-#ifndef PLAYERMODEL_H
-#define PLAYERMODEL_H
-#include "image.qc"
-CLASS(XonoticPlayerModelSelector, XonoticImage)
-       METHOD(XonoticPlayerModelSelector, configureXonoticPlayerModelSelector, void(entity));
-       METHOD(XonoticPlayerModelSelector, loadModels, void(entity));
-       METHOD(XonoticPlayerModelSelector, loadCvars, void(entity));
-       METHOD(XonoticPlayerModelSelector, saveCvars, void(entity));
-       METHOD(XonoticPlayerModelSelector, draw, void(entity));
-       METHOD(XonoticPlayerModelSelector, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticPlayerModelSelector, showNotify, void(entity));
-       ATTRIB(XonoticPlayerModelSelector, currentModel, string, string_null)
-       ATTRIB(XonoticPlayerModelSelector, currentSkin, float, 0)
-       ATTRIB(XonoticPlayerModelSelector, currentModelImage, string, string_null)
-       ATTRIB(XonoticPlayerModelSelector, currentModelTitle, string, string_null)
-       ATTRIB(XonoticPlayerModelSelector, currentModelDescription, string, string_null)
-       METHOD(XonoticPlayerModelSelector, go, void(entity, float));
-       METHOD(XonoticPlayerModelSelector, destroy, void(entity));
-       ATTRIB(XonoticPlayerModelSelector, origin, vector, '0 0 0')
-       ATTRIB(XonoticPlayerModelSelector, size, vector, '0 0 0')
-       ATTRIB(XonoticPlayerModelSelector, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticPlayerModelSelector, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticPlayerModelSelector, titleFontSize, float, SKINFONTSIZE_TITLE)
-       ATTRIB(XonoticPlayerModelSelector, bufModels, float, -1)
-       ATTRIB(XonoticPlayerModelSelector, numModels, float, -1)
-       ATTRIB(XonoticPlayerModelSelector, idxModels, float, -1)
-ENDCLASS(XonoticPlayerModelSelector)
-entity makeXonoticPlayerModelSelector();
-void PlayerModelSelector_Next_Click(entity btn, entity me);
-void PlayerModelSelector_Prev_Click(entity btn, entity me);
-#endif
+#include "playermodel.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticPlayerModelSelector()
 {
        entity me;
@@ -232,4 +201,3 @@ void XonoticPlayerModelSelector_showNotify(entity me)
        me.destroy(me);
        me.loadModels(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/playermodel.qh b/qcsrc/menu/xonotic/playermodel.qh
new file mode 100644 (file)
index 0000000..664f22c
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "image.qh"
+CLASS(XonoticPlayerModelSelector, XonoticImage)
+       METHOD(XonoticPlayerModelSelector, configureXonoticPlayerModelSelector, void(entity));
+       METHOD(XonoticPlayerModelSelector, loadModels, void(entity));
+       METHOD(XonoticPlayerModelSelector, loadCvars, void(entity));
+       METHOD(XonoticPlayerModelSelector, saveCvars, void(entity));
+       METHOD(XonoticPlayerModelSelector, draw, void(entity));
+       METHOD(XonoticPlayerModelSelector, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticPlayerModelSelector, showNotify, void(entity));
+       ATTRIB(XonoticPlayerModelSelector, currentModel, string, string_null)
+       ATTRIB(XonoticPlayerModelSelector, currentSkin, float, 0)
+       ATTRIB(XonoticPlayerModelSelector, currentModelImage, string, string_null)
+       ATTRIB(XonoticPlayerModelSelector, currentModelTitle, string, string_null)
+       ATTRIB(XonoticPlayerModelSelector, currentModelDescription, string, string_null)
+       METHOD(XonoticPlayerModelSelector, go, void(entity, float));
+       METHOD(XonoticPlayerModelSelector, destroy, void(entity));
+       ATTRIB(XonoticPlayerModelSelector, origin, vector, '0 0 0')
+       ATTRIB(XonoticPlayerModelSelector, size, vector, '0 0 0')
+       ATTRIB(XonoticPlayerModelSelector, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticPlayerModelSelector, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticPlayerModelSelector, titleFontSize, float, SKINFONTSIZE_TITLE)
+       ATTRIB(XonoticPlayerModelSelector, bufModels, float, -1)
+       ATTRIB(XonoticPlayerModelSelector, numModels, float, -1)
+       ATTRIB(XonoticPlayerModelSelector, idxModels, float, -1)
+ENDCLASS(XonoticPlayerModelSelector)
+entity makeXonoticPlayerModelSelector();
+void PlayerModelSelector_Next_Click(entity btn, entity me);
+void PlayerModelSelector_Prev_Click(entity btn, entity me);
index 0393215f8a9e6c74e6c4b1cfc0f7207e687255b7..c912ba3a72c49bf40ff49c24ee5eaa199a1efb5f 100644 (file)
@@ -1,45 +1,4 @@
-#ifndef PLAYLIST_H
-#define PLAYLIST_H
-#include "listbox.qc"
-CLASS(XonoticPlayList, XonoticListBox)
-       METHOD(XonoticPlayList, configureXonoticPlayList, void(entity));
-       ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
-       METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticPlayList, draw, void(entity));
-       METHOD(XonoticPlayList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticPlayList, stopSound, void(entity));
-       METHOD(XonoticPlayList, startSound, void(entity, float));
-       METHOD(XonoticPlayList, resumeSound, void(entity));
-       METHOD(XonoticPlayList, pauseSound, void(entity));
-       METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticPlayList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticPlayList, mouseDrag, float(entity, vector));
-
-       METHOD(XonoticPlayList, addToPlayList, void(entity, string));
-       METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity));
-       ATTRIB(XonoticPlayList, playingTrack, float, -1)
-
-       ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticPlayList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticPlayList, columnNameSize, float, 0)
-       ATTRIB(XonoticPlayList, columnNumberOrigin, float, 0)
-       ATTRIB(XonoticPlayList, columnNumberSize, float, 0)
-       ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
-       ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
-       ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
-ENDCLASS(XonoticPlayList)
-
-entity makeXonoticPlayList();
-void PlayList_Remove(entity btn, entity me);
-void PlayList_Remove_All(entity btn, entity me);
-void StopSound_Click(entity btn, entity me);
-void StartSound_Click(entity btn, entity me);
-void PauseSound_Click(entity btn, entity me);
-void PrevSound_Click(entity btn, entity me);
-void NextSound_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "playlist.qh"
 
 entity makeXonoticPlayList()
 {
@@ -305,5 +264,3 @@ float XonoticPlayList_keyDown(entity me, float scan, float ascii, float shift)
        else
                return SUPER(XonoticPlayList).keyDown(me, scan, ascii, shift);
 }
-#endif
-
diff --git a/qcsrc/menu/xonotic/playlist.qh b/qcsrc/menu/xonotic/playlist.qh
new file mode 100644 (file)
index 0000000..6bee05b
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticPlayList, XonoticListBox)
+       METHOD(XonoticPlayList, configureXonoticPlayList, void(entity));
+       ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
+       METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticPlayList, draw, void(entity));
+       METHOD(XonoticPlayList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticPlayList, stopSound, void(entity));
+       METHOD(XonoticPlayList, startSound, void(entity, float));
+       METHOD(XonoticPlayList, resumeSound, void(entity));
+       METHOD(XonoticPlayList, pauseSound, void(entity));
+       METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticPlayList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticPlayList, mouseDrag, float(entity, vector));
+
+       METHOD(XonoticPlayList, addToPlayList, void(entity, string));
+       METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity));
+       ATTRIB(XonoticPlayList, playingTrack, float, -1)
+
+       ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticPlayList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticPlayList, columnNameSize, float, 0)
+       ATTRIB(XonoticPlayList, columnNumberOrigin, float, 0)
+       ATTRIB(XonoticPlayList, columnNumberSize, float, 0)
+       ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
+       ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
+       ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
+ENDCLASS(XonoticPlayList)
+
+entity makeXonoticPlayList();
+void PlayList_Remove(entity btn, entity me);
+void PlayList_Remove_All(entity btn, entity me);
+void StopSound_Click(entity btn, entity me);
+void StartSound_Click(entity btn, entity me);
+void PauseSound_Click(entity btn, entity me);
+void PrevSound_Click(entity btn, entity me);
+void NextSound_Click(entity btn, entity me);
index 1a0ffd55f87cd61fa9e13371f9d942e82d745f8a..536ea4f154f1b07d4c9b17afe67f18a2ff176f4d 100644 (file)
@@ -1,32 +1,5 @@
-#ifndef RADIOBUTTON_H
-#define RADIOBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticRadioButton, RadioButton)
-       METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string, string));
-       METHOD(XonoticRadioButton, draw, void(entity));
-       METHOD(XonoticRadioButton, setChecked, void(entity, float));
-       ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
-       ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
-       ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
-       ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
-       ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
+#include "radiobutton.qh"
 
-       ATTRIB(XonoticRadioButton, cvarName, string, string_null)
-       ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
-       ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
-       ATTRIB(XonoticRadioButton, cvarValueIsAnotherCvar, float, 0)
-       METHOD(XonoticRadioButton, loadCvars, void(entity));
-       METHOD(XonoticRadioButton, saveCvars, void(entity));
-
-       ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticRadioButton)
-entity makeXonoticRadioButton_T(float, string, string, string, string theTooltip);
-entity makeXonoticRadioButton(float, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticRadioButton_T(float theGroup, string theCvar, string theValue, string theText, string theTooltip)
 {
        entity me;
@@ -126,4 +99,3 @@ void XonoticRadioButton_saveCvars(entity me)
                }
        }
 }
-#endif
diff --git a/qcsrc/menu/xonotic/radiobutton.qh b/qcsrc/menu/xonotic/radiobutton.qh
new file mode 100644 (file)
index 0000000..36c228f
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "../item/radiobutton.qh"
+CLASS(XonoticRadioButton, RadioButton)
+       METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string, string));
+       METHOD(XonoticRadioButton, draw, void(entity));
+       METHOD(XonoticRadioButton, setChecked, void(entity, float));
+       ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
+       ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
+       ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
+       ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
+       ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
+
+       ATTRIB(XonoticRadioButton, cvarName, string, string_null)
+       ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
+       ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
+       ATTRIB(XonoticRadioButton, cvarValueIsAnotherCvar, float, 0)
+       METHOD(XonoticRadioButton, loadCvars, void(entity));
+       METHOD(XonoticRadioButton, saveCvars, void(entity));
+
+       ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticRadioButton)
+entity makeXonoticRadioButton_T(float, string, string, string, string theTooltip);
+entity makeXonoticRadioButton(float, string, string, string);
index f074a6286f16250f762bfd633faa0dc94eb89f4c..38fbe7fc79724a44e7ba20b75fe2c986152f44a8 100644 (file)
@@ -1,23 +1,6 @@
-#ifndef ROOTDIALOG_H
-#define ROOTDIALOG_H
-#include "dialog.qc"
-CLASS(XonoticRootDialog, XonoticDialog)
-       // still to be customized by user
-       /*
-       ATTRIB(XonoticDialog, closable, float, 1)
-       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
-       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
-       ATTRIB(XonoticDialog, intendedWidth, float, 0)
-       ATTRIB(XonoticDialog, rows, float, 3)
-       ATTRIB(XonoticDialog, columns, float, 2)
-       */
-       METHOD(XonoticRootDialog, close, void(entity));
-ENDCLASS(XonoticRootDialog)
-#endif
+#include "rootdialog.qh"
 
-#ifdef IMPLEMENTATION
 void XonoticRootDialog_close(entity me)
 {
        m_goto(string_null);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/rootdialog.qh b/qcsrc/menu/xonotic/rootdialog.qh
new file mode 100644 (file)
index 0000000..0bfd336
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticRootDialog, XonoticDialog)
+       // still to be customized by user
+       /*
+       ATTRIB(XonoticDialog, closable, float, 1)
+       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
+       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
+       ATTRIB(XonoticDialog, intendedWidth, float, 0)
+       ATTRIB(XonoticDialog, rows, float, 3)
+       ATTRIB(XonoticDialog, columns, float, 2)
+       */
+       METHOD(XonoticRootDialog, close, void(entity));
+ENDCLASS(XonoticRootDialog)
index f7a5c9b30339874e7e1c9c1da24de067deaff0b6..82ff4ba7b2b8dad148e2b4f20cf854271ce95838 100644 (file)
@@ -1,25 +1,5 @@
-#ifndef SCREENSHOTIMAGE_H
-#define SCREENSHOTIMAGE_H
-#include "image.qc"
-CLASS(XonoticScreenshotImage, XonoticImage)
-       METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity));
-       METHOD(XonoticScreenshotImage, load, void(entity, string));
-       METHOD(XonoticScreenshotImage, draw, void(entity));
-       ATTRIB(XonoticScreenshotImage, focusable, float, 1) // mousePress and mouseDrag work only if focusable is set
-       METHOD(XonoticScreenshotImage, mousePress, float(entity, vector));
-       METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector));
-       METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector));
-       METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector));
-       ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
-       ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
-       ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
-ENDCLASS(XonoticScreenshotImage)
-entity makeXonoticScreenshotImage();
-#endif
+#include "screenshotimage.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticScreenshotImage()
 {
        entity me;
@@ -94,4 +74,3 @@ void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector rel
        me.realFontSize_y = me.fontSize / absSize.y;
        me.realFontSize_x = me.fontSize / absSize.x;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/screenshotimage.qh b/qcsrc/menu/xonotic/screenshotimage.qh
new file mode 100644 (file)
index 0000000..eb20c73
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "image.qh"
+CLASS(XonoticScreenshotImage, XonoticImage)
+       METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity));
+       METHOD(XonoticScreenshotImage, load, void(entity, string));
+       METHOD(XonoticScreenshotImage, draw, void(entity));
+       ATTRIB(XonoticScreenshotImage, focusable, float, 1)  // mousePress and mouseDrag work only if focusable is set
+       METHOD(XonoticScreenshotImage, mousePress, float(entity, vector));
+       METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector));
+       METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector));
+       METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector));
+       ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
+       ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
+       ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
+ENDCLASS(XonoticScreenshotImage)
+entity makeXonoticScreenshotImage();
index 900c446f31085093cfb9086e6502c0e2c5c1ff45..a948ce86f842dfb79d7bf85c631835fcc6bf751b 100644 (file)
@@ -1,51 +1,9 @@
-#ifndef SCREENSHOTLIST_H
-#define SCREENSHOTLIST_H
-#include "listbox.qc"
-CLASS(XonoticScreenshotList, XonoticListBox)
-       METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity));
-       ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
-       METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticScreenshotList, setSelected, void(entity, float));
-       METHOD(XonoticScreenshotList, draw, void(entity));
-       METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticScreenshotList, getScreenshots, void(entity));
-       METHOD(XonoticScreenshotList, previewScreenshot, void(entity));
-       METHOD(XonoticScreenshotList, startScreenshot, void(entity));
-       METHOD(XonoticScreenshotList, screenshotName, string(entity, float));
-       METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticScreenshotList, destroy, void(entity));
-       METHOD(XonoticScreenshotList, showNotify, void(entity));
-       ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
-       ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticScreenshotList, columnNameSize, float, 0)
-       ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
-       ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, filterString, string, string_null)
-       ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
-       ATTRIB(XonoticScreenshotList, filterTime, float, 0)
-
-       ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
-       ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
-
-       ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
-       ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
-       ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
-       METHOD(XonoticScreenshotList, goScreenshot, void(entity, float));
-       METHOD(XonoticScreenshotList, startSlideShow, void(entity));
-       METHOD(XonoticScreenshotList, stopSlideShow, void(entity));
-ENDCLASS(XonoticScreenshotList)
-
-entity makeXonoticScreenshotList();
-void StartScreenshot_Click(entity btn, entity me);
-void ScreenshotList_Refresh_Click(entity btn, entity me);
-void ScreenshotList_Filter_Would_Change(entity box, entity me);
-void ScreenshotList_Filter_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "screenshotlist.qh"
+
+#include "dialog_multiplayer_media_screenshot.qh"
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "inputbox.qh"
+#include "../item/modalcontroller.qh"
 
 entity makeXonoticScreenshotList()
 {
@@ -296,4 +254,3 @@ float XonoticScreenshotList_keyDown(entity me, float scan, float ascii, float sh
        }
        return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/screenshotlist.qh b/qcsrc/menu/xonotic/screenshotlist.qh
new file mode 100644 (file)
index 0000000..1279c4a
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticScreenshotList, XonoticListBox)
+       METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity));
+       ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
+       METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticScreenshotList, setSelected, void(entity, float));
+       METHOD(XonoticScreenshotList, draw, void(entity));
+       METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticScreenshotList, getScreenshots, void(entity));
+       METHOD(XonoticScreenshotList, previewScreenshot, void(entity));
+       METHOD(XonoticScreenshotList, startScreenshot, void(entity));
+       METHOD(XonoticScreenshotList, screenshotName, string(entity, float));
+       METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticScreenshotList, destroy, void(entity));
+       METHOD(XonoticScreenshotList, showNotify, void(entity));
+       ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
+       ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticScreenshotList, columnNameSize, float, 0)
+       ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
+       ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotList, filterString, string, string_null)
+       ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
+       ATTRIB(XonoticScreenshotList, filterTime, float, 0)
+
+       ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
+       ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
+
+       ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
+       ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
+       ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
+       METHOD(XonoticScreenshotList, goScreenshot, void(entity, float));
+       METHOD(XonoticScreenshotList, startSlideShow, void(entity));
+       METHOD(XonoticScreenshotList, stopSlideShow, void(entity));
+ENDCLASS(XonoticScreenshotList)
+
+entity makeXonoticScreenshotList();
+void StartScreenshot_Click(entity btn, entity me);
+void ScreenshotList_Refresh_Click(entity btn, entity me);
+void ScreenshotList_Filter_Would_Change(entity box, entity me);
+void ScreenshotList_Filter_Change(entity box, entity me);
index ef49b4b2959dfe884950e9244451e43986422f22..fc2ba573bbaa7448addcd648cde86d9a2ae421e2 100644 (file)
-#ifndef SERVERLIST_H
-#define SERVERLIST_H
-#include "listbox.qc"
-CLASS(XonoticServerList, XonoticListBox)
-       METHOD(XonoticServerList, configureXonoticServerList, void(entity));
-       ATTRIB(XonoticServerList, rowsPerItem, float, 1)
-       METHOD(XonoticServerList, draw, void(entity));
-       METHOD(XonoticServerList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticServerList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticServerList, toggleFavorite, void(entity, string));
-
-       ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85)
-       METHOD(XonoticServerList, mouseMove, float(entity, vector));
-       ATTRIB(XonoticServerList, mouseOverIcons, bool, false)
-       METHOD(XonoticServerList, focusedItemChangeNotify, void(entity));
-
-       ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticServerList, realUpperMargin, float, 0)
-       ATTRIB(XonoticServerList, columnIconsOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnIconsSize, float, 0)
-       ATTRIB(XonoticServerList, columnPingOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnPingSize, float, 0)
-       ATTRIB(XonoticServerList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnNameSize, float, 0)
-       ATTRIB(XonoticServerList, columnMapOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnMapSize, float, 0)
-       ATTRIB(XonoticServerList, columnTypeOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnTypeSize, float, 0)
-       ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnPlayersSize, float, 0)
-       ATTRIB(XonoticServerList, lockedSelectedItem, bool, true) // initially keep selected the first item of the list, avoiding an unwanted scrolling
-
-       ATTRIB(XonoticServerList, selectedServer, string, string_null) // to restore selected server when needed
-       METHOD(XonoticServerList, setSelected, void(entity, float));
-       METHOD(XonoticServerList, setSortOrder, void(entity, float, float));
-       ATTRIB(XonoticServerList, filterShowEmpty, float, 1)
-       ATTRIB(XonoticServerList, filterShowFull, float, 1)
-       ATTRIB(XonoticServerList, filterString, string, string_null)
-       ATTRIB(XonoticServerList, controlledTextbox, entity, NULL)
-       ATTRIB(XonoticServerList, ipAddressBox, entity, NULL)
-       ATTRIB(XonoticServerList, favoriteButton, entity, NULL)
-       ATTRIB(XonoticServerList, nextRefreshTime, float, 0)
-       METHOD(XonoticServerList, refreshServerList, void(entity, float)); // refresh mode: REFRESHSERVERLIST_*
-       ATTRIB(XonoticServerList, needsRefresh, float, 1)
-       METHOD(XonoticServerList, focusEnter, void(entity));
-       METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)));
-       ATTRIB(XonoticServerList, sortButton1, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton2, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton3, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton4, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton5, entity, NULL)
-       ATTRIB(XonoticServerList, connectButton, entity, NULL)
-       ATTRIB(XonoticServerList, infoButton, entity, NULL)
-       ATTRIB(XonoticServerList, currentSortOrder, float, 0)
-       ATTRIB(XonoticServerList, currentSortField, float, -1)
-
-       ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
-
-       ATTRIB(XonoticServerList, seenIPv4, float, 0)
-       ATTRIB(XonoticServerList, seenIPv6, float, 0)
-       ATTRIB(XonoticServerList, categoriesHeight, float, 1.25)
-
-       METHOD(XonoticServerList, getTotalHeight, float(entity));
-       METHOD(XonoticServerList, getItemAtPos, float(entity, float));
-       METHOD(XonoticServerList, getItemStart, float(entity, float));
-       METHOD(XonoticServerList, getItemHeight, float(entity, float));
-ENDCLASS(XonoticServerList)
-entity makeXonoticServerList();
-
-#ifndef IMPLEMENTATION
-float autocvar_menu_slist_categories;
-float autocvar_menu_slist_categories_onlyifmultiple;
-float autocvar_menu_slist_purethreshold;
-float autocvar_menu_slist_modimpurity;
-float autocvar_menu_slist_recommendations;
-float autocvar_menu_slist_recommendations_maxping;
-float autocvar_menu_slist_recommendations_minfreeslots;
-float autocvar_menu_slist_recommendations_minhumans;
-float autocvar_menu_slist_recommendations_purethreshold;
-
-// server cache fields
-#define SLIST_FIELDS \
-       SLIST_FIELD(CNAME,       "cname") \
-       SLIST_FIELD(PING,        "ping") \
-       SLIST_FIELD(GAME,        "game") \
-       SLIST_FIELD(MOD,         "mod") \
-       SLIST_FIELD(MAP,         "map") \
-       SLIST_FIELD(NAME,        "name") \
-       SLIST_FIELD(MAXPLAYERS,  "maxplayers") \
-       SLIST_FIELD(NUMPLAYERS,  "numplayers") \
-       SLIST_FIELD(NUMHUMANS,   "numhumans") \
-       SLIST_FIELD(NUMBOTS,     "numbots") \
-       SLIST_FIELD(PROTOCOL,    "protocol") \
-       SLIST_FIELD(FREESLOTS,   "freeslots") \
-       SLIST_FIELD(PLAYERS,     "players") \
-       SLIST_FIELD(QCSTATUS,    "qcstatus") \
-       SLIST_FIELD(CATEGORY,    "category") \
-       SLIST_FIELD(ISFAVORITE,  "isfavorite")
-
-#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
-SLIST_FIELDS
-#undef SLIST_FIELD
-
-const float REFRESHSERVERLIST_RESORT = 0;    // sort the server list again to update for changes to e.g. favorite status, categories
-const float REFRESHSERVERLIST_REFILTER = 1;  // ..., also update filter and sort criteria
-const float REFRESHSERVERLIST_ASK = 2;       // ..., also suggest querying servers now
-const float REFRESHSERVERLIST_RESET = 3;     // ..., also clear the list first
-
-// function declarations
-float IsServerInList(string list, string srv);
-#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
-#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
-#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
-
-entity RetrieveCategoryEnt(float catnum);
-
-float CheckCategoryOverride(float cat);
-float CheckCategoryForEntry(float entry);
-float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
-
-void RegisterSLCategories();
-
-void ServerList_Connect_Click(entity btn, entity me);
-void ServerList_Categories_Click(entity box, entity me);
-void ServerList_ShowEmpty_Click(entity box, entity me);
-void ServerList_ShowFull_Click(entity box, entity me);
-void ServerList_Filter_Change(entity box, entity me);
-void ServerList_Favorite_Click(entity btn, entity me);
-void ServerList_Info_Click(entity btn, entity me);
-void ServerList_Update_favoriteButton(entity btn, entity me);
-
-// fields for category entities
-const int MAX_CATEGORIES = 9;
-const int CATEGORY_FIRST = 1;
-entity categories[MAX_CATEGORIES];
-int category_ent_count;
-.string cat_name;
-.string cat_string;
-.string cat_enoverride_string;
-.string cat_dioverride_string;
-.float cat_enoverride;
-.float cat_dioverride;
-
-// fields for drawing categories
-int category_name[MAX_CATEGORIES];
-int category_item[MAX_CATEGORIES];
-int category_draw_count;
-
-#define SLIST_CATEGORIES \
-       SLIST_CATEGORY(CAT_FAVORITED,    "",            "",             CTX(_("SLCAT^Favorites"))) \
-       SLIST_CATEGORY(CAT_RECOMMENDED,  "",            "",             CTX(_("SLCAT^Recommended"))) \
-       SLIST_CATEGORY(CAT_NORMAL,       "",            "CAT_SERVERS",  CTX(_("SLCAT^Normal Servers"))) \
-       SLIST_CATEGORY(CAT_SERVERS,      "CAT_NORMAL",  "CAT_SERVERS",  CTX(_("SLCAT^Servers"))) \
-       SLIST_CATEGORY(CAT_XPM,          "CAT_NORMAL",  "CAT_SERVERS",  CTX(_("SLCAT^Competitive Mode"))) \
-       SLIST_CATEGORY(CAT_MODIFIED,     "",            "CAT_SERVERS",  CTX(_("SLCAT^Modified Servers"))) \
-       SLIST_CATEGORY(CAT_OVERKILL,     "",            "CAT_SERVERS",  CTX(_("SLCAT^Overkill Mode"))) \
-       SLIST_CATEGORY(CAT_INSTAGIB,     "",            "CAT_SERVERS",  CTX(_("SLCAT^InstaGib Mode"))) \
-       SLIST_CATEGORY(CAT_DEFRAG,       "",            "CAT_SERVERS",  CTX(_("SLCAT^Defrag Mode")))
-
-#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
-#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
-       int name; \
-       string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
-SLIST_CATEGORIES
-#undef SLIST_CATEGORY
+#include "serverlist.qh"
 
-#endif
-#endif
-#ifdef IMPLEMENTATION
+#include "checkbox.qh"
+#include "inputbox.qh"
+#include "mainwindow.qh"
+#include "dialog_multiplayer_join_serverinfo.qh"
+#include <common/mapinfo.qh>
 
 void RegisterSLCategories()
 {
@@ -1370,5 +1206,3 @@ float XonoticServerList_getItemHeight(entity me, int item)
        }
        return me.itemHeight;
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/serverlist.qh b/qcsrc/menu/xonotic/serverlist.qh
new file mode 100644 (file)
index 0000000..ac726b2
--- /dev/null
@@ -0,0 +1,166 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticServerList, XonoticListBox)
+       METHOD(XonoticServerList, configureXonoticServerList, void(entity));
+       ATTRIB(XonoticServerList, rowsPerItem, float, 1)
+       METHOD(XonoticServerList, draw, void(entity));
+       METHOD(XonoticServerList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticServerList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticServerList, toggleFavorite, void(entity, string));
+
+       ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85)
+       METHOD(XonoticServerList, mouseMove, float(entity, vector));
+       ATTRIB(XonoticServerList, mouseOverIcons, bool, false)
+       METHOD(XonoticServerList, focusedItemChangeNotify, void(entity));
+
+       ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticServerList, realUpperMargin, float, 0)
+       ATTRIB(XonoticServerList, columnIconsOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnIconsSize, float, 0)
+       ATTRIB(XonoticServerList, columnPingOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnPingSize, float, 0)
+       ATTRIB(XonoticServerList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnNameSize, float, 0)
+       ATTRIB(XonoticServerList, columnMapOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnMapSize, float, 0)
+       ATTRIB(XonoticServerList, columnTypeOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnTypeSize, float, 0)
+       ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnPlayersSize, float, 0)
+       ATTRIB(XonoticServerList, lockedSelectedItem, bool, true)      // initially keep selected the first item of the list, avoiding an unwanted scrolling
+
+       ATTRIB(XonoticServerList, selectedServer, string, string_null) // to restore selected server when needed
+       METHOD(XonoticServerList, setSelected, void(entity, float));
+       METHOD(XonoticServerList, setSortOrder, void(entity, float, float));
+       ATTRIB(XonoticServerList, filterShowEmpty, float, 1)
+       ATTRIB(XonoticServerList, filterShowFull, float, 1)
+       ATTRIB(XonoticServerList, filterString, string, string_null)
+       ATTRIB(XonoticServerList, controlledTextbox, entity, NULL)
+       ATTRIB(XonoticServerList, ipAddressBox, entity, NULL)
+       ATTRIB(XonoticServerList, favoriteButton, entity, NULL)
+       ATTRIB(XonoticServerList, nextRefreshTime, float, 0)
+       METHOD(XonoticServerList, refreshServerList, void(entity, float));  // refresh mode: REFRESHSERVERLIST_*
+       ATTRIB(XonoticServerList, needsRefresh, float, 1)
+       METHOD(XonoticServerList, focusEnter, void(entity));
+       METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)));
+       ATTRIB(XonoticServerList, sortButton1, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton2, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton3, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton4, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton5, entity, NULL)
+       ATTRIB(XonoticServerList, connectButton, entity, NULL)
+       ATTRIB(XonoticServerList, infoButton, entity, NULL)
+       ATTRIB(XonoticServerList, currentSortOrder, float, 0)
+       ATTRIB(XonoticServerList, currentSortField, float, -1)
+
+       ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
+
+       ATTRIB(XonoticServerList, seenIPv4, float, 0)
+       ATTRIB(XonoticServerList, seenIPv6, float, 0)
+       ATTRIB(XonoticServerList, categoriesHeight, float, 1.25)
+
+       METHOD(XonoticServerList, getTotalHeight, float(entity));
+       METHOD(XonoticServerList, getItemAtPos, float(entity, float));
+       METHOD(XonoticServerList, getItemStart, float(entity, float));
+       METHOD(XonoticServerList, getItemHeight, float(entity, float));
+ENDCLASS(XonoticServerList)
+entity makeXonoticServerList();
+
+void RegisterSLCategories();
+float CheckCategoryForEntry(float entry);
+void ServerList_Filter_Change(entity box, entity me);
+void ServerList_Categories_Click(entity box, entity me);
+void ServerList_ShowEmpty_Click(entity box, entity me);
+void ServerList_ShowFull_Click(entity box, entity me);
+void ServerList_Connect_Click(entity btn, entity me);
+void ServerList_Update_favoriteButton(entity btn, entity me);
+void ServerList_Favorite_Click(entity btn, entity me);
+void ServerList_Info_Click(entity btn, entity me);
+
+// server cache fields
+#define SLIST_FIELDS \
+       SLIST_FIELD(CNAME,       "cname") \
+       SLIST_FIELD(PING,        "ping") \
+       SLIST_FIELD(GAME,        "game") \
+       SLIST_FIELD(MOD,         "mod") \
+       SLIST_FIELD(MAP,         "map") \
+       SLIST_FIELD(NAME,        "name") \
+       SLIST_FIELD(MAXPLAYERS,  "maxplayers") \
+       SLIST_FIELD(NUMPLAYERS,  "numplayers") \
+       SLIST_FIELD(NUMHUMANS,   "numhumans") \
+       SLIST_FIELD(NUMBOTS,     "numbots") \
+       SLIST_FIELD(PROTOCOL,    "protocol") \
+       SLIST_FIELD(FREESLOTS,   "freeslots") \
+       SLIST_FIELD(PLAYERS,     "players") \
+       SLIST_FIELD(QCSTATUS,    "qcstatus") \
+       SLIST_FIELD(CATEGORY,    "category") \
+       SLIST_FIELD(ISFAVORITE,  "isfavorite")
+
+#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
+SLIST_FIELDS
+#undef SLIST_FIELD
+
+float autocvar_menu_slist_categories;
+float autocvar_menu_slist_categories_onlyifmultiple;
+float autocvar_menu_slist_purethreshold;
+float autocvar_menu_slist_modimpurity;
+float autocvar_menu_slist_recommendations;
+float autocvar_menu_slist_recommendations_maxping;
+float autocvar_menu_slist_recommendations_minfreeslots;
+float autocvar_menu_slist_recommendations_minhumans;
+float autocvar_menu_slist_recommendations_purethreshold;
+
+const float REFRESHSERVERLIST_RESORT = 0;    // sort the server list again to update for changes to e.g. favorite status, categories
+const float REFRESHSERVERLIST_REFILTER = 1;  // ..., also update filter and sort criteria
+const float REFRESHSERVERLIST_ASK = 2;       // ..., also suggest querying servers now
+const float REFRESHSERVERLIST_RESET = 3;     // ..., also clear the list first
+
+// function declarations
+float IsServerInList(string list, string srv);
+#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
+#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
+#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
+
+entity RetrieveCategoryEnt(float catnum);
+
+float CheckCategoryOverride(float cat);
+float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
+
+
+// fields for category entities
+const int MAX_CATEGORIES = 9;
+const int CATEGORY_FIRST = 1;
+entity categories[MAX_CATEGORIES];
+int category_ent_count;
+.string cat_name;
+.string cat_string;
+.string cat_enoverride_string;
+.string cat_dioverride_string;
+.float cat_enoverride;
+.float cat_dioverride;
+
+// fields for drawing categories
+int category_name[MAX_CATEGORIES];
+int category_item[MAX_CATEGORIES];
+int category_draw_count;
+
+#define SLIST_CATEGORIES \
+       SLIST_CATEGORY(CAT_FAVORITED,    "",            "",             CTX(_("SLCAT^Favorites"))) \
+       SLIST_CATEGORY(CAT_RECOMMENDED,  "",            "",             CTX(_("SLCAT^Recommended"))) \
+       SLIST_CATEGORY(CAT_NORMAL,       "",            "CAT_SERVERS",  CTX(_("SLCAT^Normal Servers"))) \
+       SLIST_CATEGORY(CAT_SERVERS,      "CAT_NORMAL",  "CAT_SERVERS",  CTX(_("SLCAT^Servers"))) \
+       SLIST_CATEGORY(CAT_XPM,          "CAT_NORMAL",  "CAT_SERVERS",  CTX(_("SLCAT^Competitive Mode"))) \
+       SLIST_CATEGORY(CAT_MODIFIED,     "",            "CAT_SERVERS",  CTX(_("SLCAT^Modified Servers"))) \
+       SLIST_CATEGORY(CAT_OVERKILL,     "",            "CAT_SERVERS",  CTX(_("SLCAT^Overkill Mode"))) \
+       SLIST_CATEGORY(CAT_INSTAGIB,     "",            "CAT_SERVERS",  CTX(_("SLCAT^InstaGib Mode"))) \
+       SLIST_CATEGORY(CAT_DEFRAG,       "",            "CAT_SERVERS",  CTX(_("SLCAT^Defrag Mode")))
+
+#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
+#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
+       int name; \
+       string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
+SLIST_CATEGORIES
+#undef SLIST_CATEGORY
index 5c4195351bdcb5442e242ba729688e15f80b0623..6e3f8a03377f51eb4c6e93094ac384c92079ba99 100644 (file)
@@ -1,39 +1,4 @@
-#ifndef SKINLIST_H
-#define SKINLIST_H
-#include "listbox.qc"
-CLASS(XonoticSkinList, XonoticListBox)
-       METHOD(XonoticSkinList, configureXonoticSkinList, void(entity));
-       ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
-       METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticSkinList, getSkins, void(entity));
-       METHOD(XonoticSkinList, setSkin, void(entity));
-       METHOD(XonoticSkinList, loadCvars, void(entity));
-       METHOD(XonoticSkinList, saveCvars, void(entity));
-       METHOD(XonoticSkinList, skinParameter, string(entity, float, float));
-       METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticSkinList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticSkinList, destroy, void(entity));
-
-       ATTRIB(XonoticSkinList, skinlist, float, -1)
-       ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticSkinList, columnPreviewOrigin, float, 0)
-       ATTRIB(XonoticSkinList, columnPreviewSize, float, 0)
-       ATTRIB(XonoticSkinList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticSkinList, columnNameSize, float, 0)
-       ATTRIB(XonoticSkinList, realUpperMargin1, float, 0)
-       ATTRIB(XonoticSkinList, realUpperMargin2, float, 0)
-       ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
-       ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticSkinList, name, string, "skinselector")
-ENDCLASS(XonoticSkinList)
-
-entity makeXonoticSkinList();
-void SetSkin_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "skinlist.qh"
 
 const float SKINPARM_NAME = 0;
 const float SKINPARM_TITLE = 1;
@@ -209,4 +174,3 @@ float XonoticSkinList_keyDown(entity me, float scan, float ascii, float shift)
        else
                return SUPER(XonoticSkinList).keyDown(me, scan, ascii, shift);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/skinlist.qh b/qcsrc/menu/xonotic/skinlist.qh
new file mode 100644 (file)
index 0000000..616fc23
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticSkinList, XonoticListBox)
+       METHOD(XonoticSkinList, configureXonoticSkinList, void(entity));
+       ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
+       METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticSkinList, getSkins, void(entity));
+       METHOD(XonoticSkinList, setSkin, void(entity));
+       METHOD(XonoticSkinList, loadCvars, void(entity));
+       METHOD(XonoticSkinList, saveCvars, void(entity));
+       METHOD(XonoticSkinList, skinParameter, string(entity, float, float));
+       METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticSkinList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticSkinList, destroy, void(entity));
+
+       ATTRIB(XonoticSkinList, skinlist, float, -1)
+       ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticSkinList, columnPreviewOrigin, float, 0)
+       ATTRIB(XonoticSkinList, columnPreviewSize, float, 0)
+       ATTRIB(XonoticSkinList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticSkinList, columnNameSize, float, 0)
+       ATTRIB(XonoticSkinList, realUpperMargin1, float, 0)
+       ATTRIB(XonoticSkinList, realUpperMargin2, float, 0)
+       ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
+       ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticSkinList, name, string, "skinselector")
+ENDCLASS(XonoticSkinList)
+
+entity makeXonoticSkinList();
+void SetSkin_Click(entity btn, entity me);
index 2b0bd6ce0ac6343140b40783b3ee4e6f7f62a9b6..fc4228cf98b0503b55f013a15df217d1909978f5 100644 (file)
@@ -1,34 +1,5 @@
-#ifndef SLIDER_H
-#define SLIDER_H
-#include "../item/slider.qc"
-CLASS(XonoticSlider, Slider)
-       METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string, string));
-       METHOD(XonoticSlider, setValue, void(entity, float));
-       METHOD(XonoticSlider, setValue_noAnim, void(entity, float));
-       ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
-       ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
-       ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
-       ATTRIB(XonoticSlider, align, float, 0.5)
-       ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
-       ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
-       ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
-       ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
-       ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
+#include "slider.qh"
 
-       ATTRIB(XonoticSlider, cvarName, string, string_null)
-       METHOD(XonoticSlider, loadCvars, void(entity));
-       METHOD(XonoticSlider, saveCvars, void(entity));
-       ATTRIB(XonoticSlider, sendCvars, float, 0)
-
-       ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticSlider)
-entity makeXonoticSlider_T(float, float, float, string, string theTooltip);
-entity makeXonoticSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
 {
        entity me;
@@ -91,4 +62,3 @@ void XonoticSlider_saveCvars(entity me)
 
        CheckSendCvars(me, me.cvarName);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/slider.qh b/qcsrc/menu/xonotic/slider.qh
new file mode 100644 (file)
index 0000000..17287c4
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "../item/slider.qh"
+CLASS(XonoticSlider, Slider)
+       METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string, string));
+       METHOD(XonoticSlider, setValue, void(entity, float));
+       METHOD(XonoticSlider, setValue_noAnim, void(entity, float));
+       ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+       ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
+       ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
+       ATTRIB(XonoticSlider, align, float, 0.5)
+       ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
+       ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
+       ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
+       ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
+       ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
+
+       ATTRIB(XonoticSlider, cvarName, string, string_null)
+       METHOD(XonoticSlider, loadCvars, void(entity));
+       METHOD(XonoticSlider, saveCvars, void(entity));
+       ATTRIB(XonoticSlider, sendCvars, float, 0)
+
+       ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticSlider)
+entity makeXonoticSlider_T(float, float, float, string, string theTooltip);
+entity makeXonoticSlider(float, float, float, string);
index c3eb4b0abd1cf2226480eeba3176c4a22a91f631..2b78141383d28579d157c5d583addf039427f90d 100644 (file)
@@ -1,16 +1,4 @@
-#ifndef SLIDER_DECIBELS_H
-#define SLIDER_DECIBELS_H
-#include "slider.qc"
-CLASS(XonoticDecibelsSlider, XonoticSlider)
-       METHOD(XonoticDecibelsSlider, loadCvars, void(entity));
-       METHOD(XonoticDecibelsSlider, saveCvars, void(entity));
-       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float));
-ENDCLASS(XonoticDecibelsSlider)
-entity makeXonoticDecibelsSlider_T(float, float, float, string, string);
-entity makeXonoticDecibelsSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "slider_decibels.qh"
 
 float toDecibelOfSquare(float f, float mi)
 {
@@ -109,5 +97,3 @@ TEST(XonoticDecibelsSlider, SoundTest)
        }
        SUCCEED();
 }
-
-#endif
diff --git a/qcsrc/menu/xonotic/slider_decibels.qh b/qcsrc/menu/xonotic/slider_decibels.qh
new file mode 100644 (file)
index 0000000..887b58d
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "slider.qh"
+CLASS(XonoticDecibelsSlider, XonoticSlider)
+       METHOD(XonoticDecibelsSlider, loadCvars, void(entity));
+       METHOD(XonoticDecibelsSlider, saveCvars, void(entity));
+       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float));
+ENDCLASS(XonoticDecibelsSlider)
+entity makeXonoticDecibelsSlider_T(float, float, float, string, string);
+entity makeXonoticDecibelsSlider(float, float, float, string);
index 1a7ee2c4a59101b65826e0ef2f1dce73485bc9d5..e5982715e468d9423f6621aa781b5f73199e058c 100644 (file)
@@ -1,15 +1,5 @@
-#ifndef SLIDER_PARTICLES_H
-#define SLIDER_PARTICLES_H
-#include "textslider.qc"
-CLASS(XonoticParticlesSlider, XonoticTextSlider)
-       METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity));
-       METHOD(XonoticParticlesSlider, loadCvars, void(entity));
-       METHOD(XonoticParticlesSlider, saveCvars, void(entity));
-ENDCLASS(XonoticParticlesSlider)
-entity makeXonoticParticlesSlider();
-#endif
+#include "slider_particles.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticParticlesSlider()
 {
        entity me;
@@ -48,4 +38,3 @@ void XonoticParticlesSlider_saveCvars(entity me)
                cvar_set("cl_damageeffect", argv(2));
        }
 }
-#endif
diff --git a/qcsrc/menu/xonotic/slider_particles.qh b/qcsrc/menu/xonotic/slider_particles.qh
new file mode 100644 (file)
index 0000000..47c1bff
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticParticlesSlider, XonoticTextSlider)
+       METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity));
+       METHOD(XonoticParticlesSlider, loadCvars, void(entity));
+       METHOD(XonoticParticlesSlider, saveCvars, void(entity));
+ENDCLASS(XonoticParticlesSlider)
+entity makeXonoticParticlesSlider();
index 93ad740cdea5afbac93bef5855b453fb056a590d..226f4559c3425c9ac748a3bb32559b8b61c54042 100644 (file)
@@ -1,16 +1,5 @@
-#ifndef SLIDER_PICMIP_H
-#define SLIDER_PICMIP_H
-#include "textslider.qc"
-CLASS(XonoticPicmipSlider, XonoticTextSlider)
-       METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity));
-       METHOD(XonoticPicmipSlider, draw, void(entity));
-       METHOD(XonoticPicmipSlider, autofix, void(entity));
-       ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0)
-ENDCLASS(XonoticPicmipSlider)
-entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#endif
+#include "slider_picmip.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticPicmipSlider()
 {
        entity me;
@@ -53,4 +42,3 @@ void XonoticPicmipSlider_draw(entity me)
        me.autofix(me);
        SUPER(XonoticPicmipSlider).draw(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/slider_picmip.qh b/qcsrc/menu/xonotic/slider_picmip.qh
new file mode 100644 (file)
index 0000000..d25ba99
--- /dev/null
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticPicmipSlider, XonoticTextSlider)
+       METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity));
+       METHOD(XonoticPicmipSlider, draw, void(entity));
+       METHOD(XonoticPicmipSlider, autofix, void(entity));
+       ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0)
+ENDCLASS(XonoticPicmipSlider)
+entity makeXonoticPicmipSlider();  // note: you still need to call addValue and configureXonoticTextSliderValues!
index c6d95b4304315381f3e3cbc973a572998079d244..762b216f9b6801d9b4668a801737c15a2f84f36b 100644 (file)
@@ -1,22 +1,4 @@
-#ifndef SLIDER_RESOLUTION_H
-#define SLIDER_RESOLUTION_H
-#include "textslider.qc"
-CLASS(XonoticResolutionSlider, XonoticTextSlider)
-       METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity));
-       METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float));
-       METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float));
-       METHOD(XonoticResolutionSlider, loadCvars, void(entity));
-       METHOD(XonoticResolutionSlider, saveCvars, void(entity));
-       METHOD(XonoticResolutionSlider, draw, void(entity));
-       ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
-       ATTRIB(XonoticResolutionSlider, maxAllowedWidth, float, 0)
-       ATTRIB(XonoticResolutionSlider, maxAllowedHeight, float, 0)
-ENDCLASS(XonoticResolutionSlider)
-entity makeXonoticResolutionSlider();
-float updateConwidths(float width, float height, float pixelheight);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "slider_resolution.qh"
 
 /* private static */ float XonoticResolutionSlider_DataHasChanged;
 
@@ -243,4 +225,3 @@ void XonoticResolutionSlider_draw(entity me)
        }
        SUPER(XonoticResolutionSlider).draw(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/slider_resolution.qh b/qcsrc/menu/xonotic/slider_resolution.qh
new file mode 100644 (file)
index 0000000..40b7bbb
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticResolutionSlider, XonoticTextSlider)
+       METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity));
+       METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float));
+       METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float));
+       METHOD(XonoticResolutionSlider, loadCvars, void(entity));
+       METHOD(XonoticResolutionSlider, saveCvars, void(entity));
+       METHOD(XonoticResolutionSlider, draw, void(entity));
+       ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
+       ATTRIB(XonoticResolutionSlider, maxAllowedWidth, float, 0)
+       ATTRIB(XonoticResolutionSlider, maxAllowedHeight, float, 0)
+ENDCLASS(XonoticResolutionSlider)
+entity makeXonoticResolutionSlider();
+float updateConwidths(float width, float height, float pixelheight);
index ecf850f404f083b3548ed59138d7e34973c9ce80..1e4bdbca21664d56fea25791cf0c3bf5161d1d53 100644 (file)
@@ -1,15 +1,5 @@
-#ifndef SLIDER_SBFADETIME_H
-#define SLIDER_SBFADETIME_H
-#include "textslider.qc"
-CLASS(XonoticScoreboardFadeTimeSlider, XonoticTextSlider)
-       METHOD(XonoticScoreboardFadeTimeSlider, configureXonoticScoreboardFadeTimeSlider, void(entity));
-       METHOD(XonoticScoreboardFadeTimeSlider, loadCvars, void(entity));
-       METHOD(XonoticScoreboardFadeTimeSlider, saveCvars, void(entity));
-ENDCLASS(XonoticScoreboardFadeTimeSlider)
-entity makeXonoticScoreboardFadeTimeSlider();
-#endif
+#include "slider_sbfadetime.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticScoreboardFadeTimeSlider()
 {
        entity me;
@@ -42,4 +32,3 @@ void XonoticScoreboardFadeTimeSlider_saveCvars(entity me)
                cvar_set("scoreboard_fadeoutspeed", argv(1));
        }
 }
-#endif
diff --git a/qcsrc/menu/xonotic/slider_sbfadetime.qh b/qcsrc/menu/xonotic/slider_sbfadetime.qh
new file mode 100644 (file)
index 0000000..5597acc
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticScoreboardFadeTimeSlider, XonoticTextSlider)
+       METHOD(XonoticScoreboardFadeTimeSlider, configureXonoticScoreboardFadeTimeSlider, void(entity));
+       METHOD(XonoticScoreboardFadeTimeSlider, loadCvars, void(entity));
+       METHOD(XonoticScoreboardFadeTimeSlider, saveCvars, void(entity));
+ENDCLASS(XonoticScoreboardFadeTimeSlider)
+entity makeXonoticScoreboardFadeTimeSlider();
index 961c5b00be757e34c4aa6bb389cd6591594baef3..13e6ba34c03395f74fbe2f7f6fccfa3c26fd16f6 100644 (file)
@@ -1,41 +1,7 @@
-#ifndef SOUNDLIST_H
-#define SOUNDLIST_H
-#include "listbox.qc"
-CLASS(XonoticSoundList, XonoticListBox)
-       METHOD(XonoticSoundList, configureXonoticSoundList, void(entity));
-       ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
-       METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticSoundList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticSoundList, getSounds, void(entity));
-       METHOD(XonoticSoundList, soundName, string(entity, int));
-       METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, int, vector));
-       METHOD(XonoticSoundList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticSoundList, destroy, void(entity));
-       METHOD(XonoticSoundList, showNotify, void(entity));
-
-       ATTRIB(XonoticSoundList, listSound, int, -1)
-       ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticSoundList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticSoundList, columnNameSize, float, 0)
-       ATTRIB(XonoticSoundList, columnNumberOrigin, float, 0)
-       ATTRIB(XonoticSoundList, columnNumberSize, float, 0)
-       ATTRIB(XonoticSoundList, realUpperMargin, float, 0)
-       ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
-       ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticSoundList, filterString, string, string_null)
-       ATTRIB(XonoticSoundList, playlist, entity, NULL)
-ENDCLASS(XonoticSoundList)
-
-entity makeXonoticSoundList();
-void SoundList_Filter_Change(entity box, entity me);
-void SoundList_Add(entity box, entity me);
-void SoundList_Add_All(entity box, entity me);
-void SoundList_Menu_Track_Change(entity box, entity me);
-void SoundList_Menu_Track_Reset(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "soundlist.qh"
+
+#include "inputbox.qh"
+#include "playlist.qh"
 
 entity makeXonoticSoundList()
 {
@@ -175,5 +141,3 @@ float XonoticSoundList_keyDown(entity me, float scan, float ascii, float shift)
        else
                return SUPER(XonoticSoundList).keyDown(me, scan, ascii, shift);
 }
-#endif
-
diff --git a/qcsrc/menu/xonotic/soundlist.qh b/qcsrc/menu/xonotic/soundlist.qh
new file mode 100644 (file)
index 0000000..86dc4c7
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticSoundList, XonoticListBox)
+       METHOD(XonoticSoundList, configureXonoticSoundList, void(entity));
+       ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
+       METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticSoundList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticSoundList, getSounds, void(entity));
+       METHOD(XonoticSoundList, soundName, string(entity, int));
+       METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, int, vector));
+       METHOD(XonoticSoundList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticSoundList, destroy, void(entity));
+       METHOD(XonoticSoundList, showNotify, void(entity));
+
+       ATTRIB(XonoticSoundList, listSound, int, -1)
+       ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticSoundList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticSoundList, columnNameSize, float, 0)
+       ATTRIB(XonoticSoundList, columnNumberOrigin, float, 0)
+       ATTRIB(XonoticSoundList, columnNumberSize, float, 0)
+       ATTRIB(XonoticSoundList, realUpperMargin, float, 0)
+       ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
+       ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticSoundList, filterString, string, string_null)
+       ATTRIB(XonoticSoundList, playlist, entity, NULL)
+ENDCLASS(XonoticSoundList)
+
+entity makeXonoticSoundList();
+void SoundList_Filter_Change(entity box, entity me);
+void SoundList_Add(entity box, entity me);
+void SoundList_Add_All(entity box, entity me);
+void SoundList_Menu_Track_Change(entity box, entity me);
+void SoundList_Menu_Track_Reset(entity box, entity me);
index 3a52371d1acd4160d232eb55f26ed9d512ddf593..7fdbf9c1645dde038675f8787e947d8dbba794aa 100644 (file)
@@ -1,36 +1,6 @@
+#include "statslist.qh"
 #include <common/playerstats.qh>
 
-#ifndef STATSLIST_H
-#define STATSLIST_H
-#include "listbox.qc"
-CLASS(XonoticStatsList, XonoticListBox)
-       METHOD(XonoticStatsList, configureXonoticStatsList, void(entity));
-       ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
-       METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticStatsList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticStatsList, getStats, void(entity));
-       METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector));
-       METHOD(XonoticStatsList, keyDown, float(entity, float, float, float));
-       METHOD(XonoticStatsList, destroy, void(entity));
-       METHOD(XonoticStatsList, showNotify, void(entity));
-       ATTRIB(XonoticStatsList, selectionDoesntMatter, bool, true)
-
-       ATTRIB(XonoticStatsList, listStats, float, -1)
-       ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
-       ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticStatsList, columnNameSize, float, 0)
-ENDCLASS(XonoticStatsList)
-
-#ifndef IMPLEMENTATION
-// public:
-entity statslist; // for reference elsewhere
-#endif
-entity makeXonoticStatsList();
-#endif
-
-#ifdef IMPLEMENTATION
-
 entity makeXonoticStatsList()
 {
        entity me;
@@ -358,5 +328,3 @@ float XonoticStatsList_keyDown(entity me, float scan, float ascii, float shift)
                return SUPER(XonoticStatsList).keyDown(me, scan, ascii, shift);
        }
 }
-#endif
-
diff --git a/qcsrc/menu/xonotic/statslist.qh b/qcsrc/menu/xonotic/statslist.qh
new file mode 100644 (file)
index 0000000..ebef28a
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticStatsList, XonoticListBox)
+       METHOD(XonoticStatsList, configureXonoticStatsList, void(entity));
+       ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
+       METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticStatsList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticStatsList, getStats, void(entity));
+       METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticStatsList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticStatsList, destroy, void(entity));
+       METHOD(XonoticStatsList, showNotify, void(entity));
+       ATTRIB(XonoticStatsList, selectionDoesntMatter, bool, true)
+
+       ATTRIB(XonoticStatsList, listStats, float, -1)
+       ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
+       ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticStatsList, columnNameSize, float, 0)
+ENDCLASS(XonoticStatsList)
+
+entity statslist;  // for reference elsewhere
+entity makeXonoticStatsList();
index 03a5bc5fe74adad0ac8be1501b5711717f535e0b..9c5bcce8df58ab0026fcfa050d5e2158d7368bad 100644 (file)
@@ -1,31 +1,7 @@
-#ifndef TAB_H
-#define TAB_H
-#include "../item/tab.qc"
-CLASS(XonoticTab, Tab)
-       // still to be customized by user
-       /*
-       ATTRIB(XonoticTab, intendedWidth, float, 0)
-       ATTRIB(XonoticTab, rows, float, 3)
-       ATTRIB(XonoticTab, columns, float, 2)
-       */
-       METHOD(XonoticTab, showNotify, void(entity));
+#include "tab.qh"
 
-       ATTRIB(XonoticTab, marginTop, float, 0) // pixels
-       ATTRIB(XonoticTab, marginBottom, float, 0) // pixels
-       ATTRIB(XonoticTab, marginLeft, float, 0) // pixels
-       ATTRIB(XonoticTab, marginRight, float, 0) // pixels
-       ATTRIB(XonoticTab, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
-       ATTRIB(XonoticTab, rowSpacing, float, SKINMARGIN_ROWS) // pixels
-       ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
-
-       ATTRIB(XonoticTab, backgroundImage, string, string_null)
-ENDCLASS(XonoticTab)
-#endif
-
-#ifdef IMPLEMENTATION
 void XonoticTab_showNotify(entity me)
 {
        loadAllCvars(me);
        SUPER(XonoticTab).showNotify(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/tab.qh b/qcsrc/menu/xonotic/tab.qh
new file mode 100644 (file)
index 0000000..26fe898
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "../item/tab.qh"
+CLASS(XonoticTab, Tab)
+       // still to be customized by user
+       /*
+       ATTRIB(XonoticTab, intendedWidth, float, 0)
+       ATTRIB(XonoticTab, rows, float, 3)
+       ATTRIB(XonoticTab, columns, float, 2)
+       */
+       METHOD(XonoticTab, showNotify, void(entity));
+
+       ATTRIB(XonoticTab, marginTop, float, 0)                                       // pixels
+       ATTRIB(XonoticTab, marginBottom, float, 0)                                    // pixels
+       ATTRIB(XonoticTab, marginLeft, float, 0)                                      // pixels
+       ATTRIB(XonoticTab, marginRight, float, 0)                                     // pixels
+       ATTRIB(XonoticTab, columnSpacing, float, SKINMARGIN_COLUMNS)                  // pixels
+       ATTRIB(XonoticTab, rowSpacing, float, SKINMARGIN_ROWS)                        // pixels
+       ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+
+       ATTRIB(XonoticTab, backgroundImage, string, string_null)
+ENDCLASS(XonoticTab)
index 2fae65a89b4599d70830c88dfed67a111f592afb..fe6941723a121ac93f56ca9b8af51a2176150cd0 100644 (file)
@@ -1,18 +1,7 @@
-#ifndef TABCONTROLLER_H
-#define TABCONTROLLER_H
-#include "../item/modalcontroller.qc"
-CLASS(XonoticTabController, ModalController)
-       METHOD(XonoticTabController, configureXonoticTabController, void(entity, float));
-       METHOD(XonoticTabController, makeTabButton_T, entity(entity, string, entity, string));
-       METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity));
-       ATTRIB(XonoticTabController, rows, float, 0)
-       ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
-ENDCLASS(XonoticTabController)
-entity makeXonoticTabController(float theRows);
-#endif
+#include "tabcontroller.qh"
+
+#include "button.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticTabController(float theRows)
 {
        entity me;
@@ -38,4 +27,3 @@ entity XonoticTabController_makeTabButton(entity me, string theTitle, entity tab
 {
        return XonoticTabController_makeTabButton_T(me, theTitle, tab, string_null);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/tabcontroller.qh b/qcsrc/menu/xonotic/tabcontroller.qh
new file mode 100644 (file)
index 0000000..eb4d48f
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "../item/modalcontroller.qh"
+CLASS(XonoticTabController, ModalController)
+       METHOD(XonoticTabController, configureXonoticTabController, void(entity, float));
+       METHOD(XonoticTabController, makeTabButton_T, entity(entity, string, entity, string));
+       METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity));
+       ATTRIB(XonoticTabController, rows, float, 0)
+       ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
+ENDCLASS(XonoticTabController)
+entity makeXonoticTabController(float theRows);
index 13d3077abf7612f3c940c1feefd98a6816b77679..9af676ecf6e7ec894daff1a410d2a15b9614767e 100644 (file)
@@ -1,18 +1,5 @@
-#ifndef TEXTLABEL_H
-#define TEXTLABEL_H
-#include "../item/label.qc"
-CLASS(XonoticTextLabel, Label)
-       METHOD(XonoticTextLabel, configureXonoticTextLabel, void(entity, float, string));
-       METHOD(XonoticTextLabel, draw, void(entity));
-       ATTRIB(XonoticTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticTextLabel, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticTextLabel, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticTextLabel)
-entity makeXonoticTextLabel(float theAlign, string theText);
-entity makeXonoticHeaderLabel(string theText);
-#endif
+#include "textlabel.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticTextLabel(float theAlign, string theText)
 {
        entity me;
@@ -37,4 +24,3 @@ void XonoticTextLabel_draw(entity me)
 {
        SUPER(XonoticTextLabel).draw(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/textlabel.qh b/qcsrc/menu/xonotic/textlabel.qh
new file mode 100644 (file)
index 0000000..fde05de
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "../item/label.qh"
+CLASS(XonoticTextLabel, Label)
+       METHOD(XonoticTextLabel, configureXonoticTextLabel, void(entity, float, string));
+       METHOD(XonoticTextLabel, draw, void(entity));
+       ATTRIB(XonoticTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticTextLabel, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticTextLabel, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticTextLabel)
+entity makeXonoticTextLabel(float theAlign, string theText);
+entity makeXonoticHeaderLabel(string theText);
index c21b07734fcd8c10749969a1972e2a8017d44a1b..54c7e5fb1238788e7e8d2a21fa2aac67e0e85676 100644 (file)
@@ -1,35 +1,5 @@
-#ifndef TEXTSLIDER_H
-#define TEXTSLIDER_H
-#include "../item/textslider.qc"
-CLASS(XonoticTextSlider, TextSlider)
-       METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string, string));
-       METHOD(XonoticTextSlider, setValue, void(entity, float));
-       METHOD(XonoticTextSlider, setValue_noAnim, void(entity, float));
-       METHOD(XonoticTextSlider, configureXonoticTextSliderValues, void(entity));
-       ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
-       ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER)
-       ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
-       ATTRIB(XonoticTextSlider, align, float, 0.5)
-       ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N)
-       ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C)
-       ATTRIB(XonoticTextSlider, colorF, vector, SKINCOLOR_SLIDER_F)
-       ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D)
-       ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S)
+#include "textslider.qh"
 
-       ATTRIB(XonoticTextSlider, cvarName, string, string_null)
-       METHOD(XonoticTextSlider, loadCvars, void(entity));
-       METHOD(XonoticTextSlider, saveCvars, void(entity));
-       ATTRIB(XonoticTextSlider, sendCvars, float, 0)
-
-       ATTRIB(XonoticTextSlider, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticTextSlider, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticTextSlider)
-entity makeXonoticTextSlider_T(string, string theTooltip);
-entity makeXonoticTextSlider(string); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticTextSlider_T(string theCvar, string theTooltip)
 {
        entity me;
@@ -130,4 +100,3 @@ void XonoticTextSlider_configureXonoticTextSliderValues(entity me)
        me.configureTextSliderValues(me, string_null);
        me.loadCvars(me);
 }
-#endif
diff --git a/qcsrc/menu/xonotic/textslider.qh b/qcsrc/menu/xonotic/textslider.qh
new file mode 100644 (file)
index 0000000..ae81f36
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "../item/textslider.qh"
+CLASS(XonoticTextSlider, TextSlider)
+       METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string, string));
+       METHOD(XonoticTextSlider, setValue, void(entity, float));
+       METHOD(XonoticTextSlider, setValue_noAnim, void(entity, float));
+       METHOD(XonoticTextSlider, configureXonoticTextSliderValues, void(entity));
+       ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+       ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER)
+       ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
+       ATTRIB(XonoticTextSlider, align, float, 0.5)
+       ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N)
+       ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C)
+       ATTRIB(XonoticTextSlider, colorF, vector, SKINCOLOR_SLIDER_F)
+       ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D)
+       ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S)
+
+       ATTRIB(XonoticTextSlider, cvarName, string, string_null)
+       METHOD(XonoticTextSlider, loadCvars, void(entity));
+       METHOD(XonoticTextSlider, saveCvars, void(entity));
+       ATTRIB(XonoticTextSlider, sendCvars, float, 0)
+
+       ATTRIB(XonoticTextSlider, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticTextSlider, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticTextSlider)
+entity makeXonoticTextSlider_T(string, string theTooltip);
+entity makeXonoticTextSlider(string);  // note: you still need to call addValue and configureXonoticTextSliderValues!
index c2a53db939e341a67afcfdcc4536604bae2ad918..4d704606d31275d4281b03e2fdb1f66c864bd6d4 100644 (file)
@@ -1,6 +1,6 @@
 #include "util.qh"
 
-#include "../item.qc"
+#include "../item.qh"
 
 #include "../menu.qh"
 #include <common/campaign_common.qh>
index 79ce7c5eefa7abbaca8a705961879b6503762a13..d433352cf5a1734e70429d8ed33e0faf0d11fc9f 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef MENU_UTIL_H
-#define MENU_UTIL_H
+#pragma once
 
 float GL_CheckExtension(string ext);
 float GL_Have_TextureCompression();
@@ -54,4 +53,3 @@ string _Nex_ExtResponseSystem_RecommendedServers;
 float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;
 
 void CheckSendCvars(entity me, string cvarnamestring);
-#endif
index a0a962de24ed8a31e420ddb413ce87bfa86156c9..fd4f51385bb898cf74fd498b1bc13b3673c02805 100644 (file)
@@ -1,20 +1,5 @@
-#ifndef WEAPONARENACHECKBOX_H
-#define WEAPONARENACHECKBOX_H
-#include "../item/checkbox.qc"
-CLASS(XonoticWeaponarenaCheckBox, CheckBox)
-       METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string));
-       METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float));
-       ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
+#include "weaponarenacheckbox.qh"
 
-       METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity));
-       METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity));
-ENDCLASS(XonoticWeaponarenaCheckBox)
-entity makeXonoticWeaponarenaCheckBox(string, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
 {
        entity me;
@@ -56,4 +41,3 @@ void XonoticWeaponarenaCheckBox_saveCvars(entity me)
                localcmd(strcat("\nmenu_cmd removefromlist menu_weaponarena ", me.netname, "\n"));
        localcmd("\ng_weaponarena \"$menu_weaponarena\"\n");
 }
-#endif
diff --git a/qcsrc/menu/xonotic/weaponarenacheckbox.qh b/qcsrc/menu/xonotic/weaponarenacheckbox.qh
new file mode 100644 (file)
index 0000000..0b8e214
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticWeaponarenaCheckBox, CheckBox)
+       METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string));
+       METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float));
+       ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
+
+       METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity));
+       METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity));
+ENDCLASS(XonoticWeaponarenaCheckBox)
+entity makeXonoticWeaponarenaCheckBox(string, string);
index 94347b3255b1fcfc587e5334d5e3992d896a3a3a..ed74631dead1b7454724cbe937cb6db0bdf6b72c 100644 (file)
@@ -1,26 +1,9 @@
-#ifndef WEAPONSLIST_H
-#define WEAPONSLIST_H
-#include "listbox.qc"
-CLASS(XonoticWeaponsList, XonoticListBox)
-       METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity));
-       METHOD(XonoticWeaponsList, toString, string(entity));
-       ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
-       METHOD(XonoticWeaponsList, draw, void(entity));
-       METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, bool));
-       METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float));
-       ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0)
-       METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector));
+#include "weaponslist.qh"
 
-       ATTRIB(XonoticWeaponsList, applyButton, entity, NULL)
-ENDCLASS(XonoticWeaponsList)
-entity makeXonoticWeaponsList();
-void WeaponsList_MoveUp_Click(entity btn, entity me);
-void WeaponsList_MoveDown_Click(entity box, entity me);
-#endif
+#include <common/weapons/all.qh>
+
+.bool disabled;
 
-#ifdef IMPLEMENTATION
 entity makeXonoticWeaponsList()
 {
        entity me;
@@ -138,4 +121,3 @@ float XonoticWeaponsList_keyDown(entity me, float scan, float ascii, float shift
                return 1;
        return 0;
 }
-#endif
diff --git a/qcsrc/menu/xonotic/weaponslist.qh b/qcsrc/menu/xonotic/weaponslist.qh
new file mode 100644 (file)
index 0000000..953a40c
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticWeaponsList, XonoticListBox)
+       METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity));
+       METHOD(XonoticWeaponsList, toString, string(entity));
+       ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
+       METHOD(XonoticWeaponsList, draw, void(entity));
+       METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float));
+       ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0)
+       METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector));
+
+       ATTRIB(XonoticWeaponsList, applyButton, entity, NULL)
+ENDCLASS(XonoticWeaponsList)
+entity makeXonoticWeaponsList();
+void WeaponsList_MoveUp_Click(entity btn, entity me);
+void WeaponsList_MoveDown_Click(entity box, entity me);
diff --git a/qcsrc/qcc.sh b/qcsrc/qcc.sh
deleted file mode 100755 (executable)
index b3ad199..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -eu
-
-MODE=$1
-IN=$3
-OUT=$2
-
-QCC=${QCC}
-QCCIDENT="-DGMQCC"
-
-case ${MODE} in
-    client) PROG=CSQC
-    ;;
-    menu) PROG=MENUQC
-    ;;
-    server) PROG=SVQC
-    ;;
-esac
-
-CPP="${CPP} -I. ${QCCIDENT} ${QCCDEFS} -D${PROG}"
-${CPP} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror -o ../.tmp/${MODE}.txt ${IN}
-${CPP} -dM 1>../.tmp/${MODE}_macros.txt -H 2>../.tmp/${MODE}_includes.txt ${IN}
-sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' ../.tmp/${MODE}.txt > ../.tmp/${MODE}.qc
-cd ${MODE}
-echo $(basename ${QCC}) ${QCCFLAGS} -o ${OUT} ${MODE}.qc
-${QCC} ${QCCFLAGS} -o ${OUT} ../../.tmp/${MODE}.qc
index 6a78f5320860405d9de73aa018f83b9bd3dffe46..a32f8b5832cf01e9ecccc534be2d794d6672118f 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_ALL_H
-#define SERVER_ALL_H
+#pragma once
 
 int maxclients;
 
@@ -12,9 +11,12 @@ const string STR_OBSERVER = "observer";
 #define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
 
 #define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
 #define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
 #define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
 
 #define IS_MONSTER(v) (v.flags & FL_MONSTER)
 #define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
@@ -34,7 +36,7 @@ const string STR_OBSERVER = "observer";
                for(int _i = 1; _i <= maxclients; ++_i) \
                { \
                        const noref int i = _i; \
-                       const noref entity it = ftoe(i); \
+                       ITER_CONST noref entity it = ftoe(i); \
                        if(cond) { LAMBDA(body) } \
                } \
        } MACRO_END
@@ -51,5 +53,3 @@ const string STR_OBSERVER = "observer";
 #include "constants.qh"
 #include "defs.qh"
 #include "miscfunctions.qh"
-
-#endif
diff --git a/qcsrc/server/_mod.inc b/qcsrc/server/_mod.inc
new file mode 100644 (file)
index 0000000..d502c48
--- /dev/null
@@ -0,0 +1,32 @@
+// generated file; do not modify
+#include "anticheat.qc"
+#include "antilag.qc"
+#include "campaign.qc"
+#include "cheats.qc"
+#include "cl_client.qc"
+#include "cl_impulse.qc"
+#include "cl_player.qc"
+#include "g_damage.qc"
+#include "g_hook.qc"
+#include "g_lights.qc"
+#include "g_models.qc"
+#include "g_subs.qc"
+#include "g_world.qc"
+#include "ipban.qc"
+#include "item_key.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "playerdemo.qc"
+#include "portals.qc"
+#include "race.qc"
+#include "round_handler.qc"
+#include "scores.qc"
+#include "scores_rules.qc"
+#include "spawnpoints.qc"
+#include "steerlib.qc"
+#include "sv_main.qc"
+#include "teamplay.qc"
+#include "tests.qc"
+#include "t_halflife.qc"
+#include "t_quake.qc"
+#include "t_quake3.qc"
index 0e0121db67aae70f0460bd53679ff0f712618dbf..4861fe2a79c25cb75ca100e3ddc6b1545870d863 100644 (file)
@@ -146,15 +146,14 @@ void anticheat_physics(entity this)
        }
 }
 
-void anticheat_spectatecopy(entity spectatee)
-{SELFPARAM();
+void anticheat_spectatecopy(entity this, entity spectatee)
+{
        // div0_evade -> SPECTATORS
-       self.angles = CS(spectatee).anticheat_div0_evade_v_angle;
+       this.angles = CS(spectatee).anticheat_div0_evade_v_angle;
 }
 
-void anticheat_prethink()
+void anticheat_prethink(entity this)
 {
-    SELFPARAM();
        // div0_evade -> SPECTATORS
        CS(this).anticheat_div0_evade_offset = 0;
 }
@@ -170,52 +169,52 @@ string anticheat_display(float f, float tmin, float mi, float ma)
        return strcat(s, ":-");
 }
 
-void anticheat_report()
-{SELFPARAM();
+void anticheat_report(entity this)
+{
        if(!autocvar_sv_eventlog)
                return;
        // TODO(divVerent): Use xonstat to acquire good thresholds.
-       GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - CS(self).anticheat_jointime)));
-       GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack), 240, 0, 9999))); // Actually this one seems broken.
-       GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m1), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m2), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m3), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m4), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m5), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_old), 120, 0.15, 0.4)));
-       GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_new), 120, 0.25, 0.8)));
-       GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_div0_evade), 120, 0.2, 0.5)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m2), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m3), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m4), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m7), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m10), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:_time:", ftos(this.playerid), ":", ftos(servertime - CS(this).anticheat_jointime)));
+       GameLogEcho(strcat(":anticheat:speedhack:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack), 240, 0, 9999))); // Actually this one seems broken.
+       GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m1), 240, 1.01, 1.25)));
+       GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m2), 240, 1.01, 1.25)));
+       GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m3), 240, 1.01, 1.25)));
+       GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m4), 240, 1.01, 1.25)));
+       GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m5), 240, 1.01, 1.25)));
+       GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old), 120, 0.15, 0.4)));
+       GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new), 120, 0.25, 0.8)));
+       GameLogEcho(strcat(":anticheat:div0_evade:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_evade), 120, 0.2, 0.5)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7), 120, 0, 9999)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10), 120, 0, 9999)));
 }
 
-float anticheat_getvalue(string id)
-{SELFPARAM();
+float anticheat_getvalue(entity this, string id)
+{
        switch(id) {
-               case "_time": return servertime - CS(self).anticheat_jointime;
-               case "speedhack": return MEAN_EVALUATE(CS(self), anticheat_speedhack);
-               case "speedhack_m1": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m1);
-               case "speedhack_m2": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m2);
-               case "speedhack_m3": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m3);
-               case "speedhack_m4": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m4);
-               case "speedhack_m5": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m5);
-               case "div0_strafebot_old": return MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_old);
-               case "div0_strafebot_new": return MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_new);
-               case "div0_evade": return MEAN_EVALUATE(CS(self), anticheat_div0_evade);
-               case "idle_snapaim": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise);
-               case "idle_snapaim_signal": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal);
-               case "idle_snapaim_noise": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise);
-               case "idle_snapaim_m2": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m2);
-               case "idle_snapaim_m3": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m3);
-               case "idle_snapaim_m4": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m4);
-               case "idle_snapaim_m7": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m7);
-               case "idle_snapaim_m10": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m10);
+               case "_time": return servertime - CS(this).anticheat_jointime;
+               case "speedhack": return MEAN_EVALUATE(CS(this), anticheat_speedhack);
+               case "speedhack_m1": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m1);
+               case "speedhack_m2": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m2);
+               case "speedhack_m3": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m3);
+               case "speedhack_m4": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m4);
+               case "speedhack_m5": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m5);
+               case "div0_strafebot_old": return MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old);
+               case "div0_strafebot_new": return MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new);
+               case "div0_evade": return MEAN_EVALUATE(CS(this), anticheat_div0_evade);
+               case "idle_snapaim": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise);
+               case "idle_snapaim_signal": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal);
+               case "idle_snapaim_noise": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise);
+               case "idle_snapaim_m2": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2);
+               case "idle_snapaim_m3": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3);
+               case "idle_snapaim_m4": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4);
+               case "idle_snapaim_m7": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7);
+               case "idle_snapaim_m10": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10);
        }
        return -1;
 }
@@ -231,7 +230,7 @@ void anticheat_fixangle(entity this)
 }
 
 void anticheat_endframe()
-{SELFPARAM();
+{
        FOREACH_CLIENT(it.fixangle, anticheat_fixangle(it));
        anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
 }
index e1055ac44e95f2f96951d7b535dba9cd77882f3a..2b0522b991fb25747ce48c06003cf4433c74e30d 100644 (file)
@@ -1,17 +1,15 @@
-#ifndef ANTICHEAT_H
-#define ANTICHEAT_H
+#pragma once
 
 void anticheat_init(entity this);
-void anticheat_report();
+void anticheat_report(entity this);
 
 void anticheat_physics(entity this);
-void anticheat_spectatecopy(entity spectatee);
-void anticheat_prethink();
+void anticheat_spectatecopy(entity this, entity spectatee);
+void anticheat_prethink(entity this);
 
-float anticheat_getvalue(string name);
+float anticheat_getvalue(entity this, string name);
 
 void anticheat_startframe();
 void anticheat_endframe();
 
 void anticheat_fixangle(entity this);
-#endif
index 02cdc20285470d16ab6d0f5a92a9395c806d2e60..d5f8e39f756aa00a52b9a9c7b48371beabb9bd39 100644 (file)
@@ -1,3 +1,4 @@
+#include "antilag.qh"
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
@@ -15,56 +16,53 @@ const int ANTILAG_MAX_ORIGINS = 64;
 
 .float antilag_debug;
 
-void antilag_record(entity e, float t)
+void antilag_record(entity e, entity store, float t)
 {
-    if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
-        return;
-
-    if(e.vehicle)
-        antilag_record(e.vehicle, t);
-
-       if(time < CS(e).antilag_times[CS(e).antilag_index])
-               return;
-       CS(e).antilag_index += 1;
-       if(CS(e).antilag_index >= ANTILAG_MAX_ORIGINS)
-               CS(e).antilag_index = 0;
-       CS(e).antilag_times[CS(e).antilag_index] = t;
-       CS(e).antilag_origins[CS(e).antilag_index] = e.origin;
-
-       if(CS(e).antilag_debug)
-               te_spark(antilag_takebackorigin(e, t - CS(e).antilag_debug), '0 0 0', 32);
-
+    if (e.vehicle) {
+        if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
+        antilag_record(e.vehicle, e.vehicle, t);
+    }
+
+       if (time < store.antilag_times[store.antilag_index]) return;
+       store.antilag_index += 1;
+       if (store.antilag_index >= ANTILAG_MAX_ORIGINS)
+               store.antilag_index = 0;
+       store.antilag_times[store.antilag_index] = t;
+       store.antilag_origins[store.antilag_index] = e.origin;
+
+       if (store.antilag_debug)
+               te_spark(antilag_takebackorigin(e, store, t - store.antilag_debug), '0 0 0', 32);
 }
 
 // finds the index BEFORE t
-float antilag_find(entity e, float t)
+float antilag_find(entity e, entity store, float t)
 {
-       for(int i = CS(e).antilag_index; i > 0; --i)
-               if(CS(e).antilag_times[i] >= t)
-                       if(CS(e).antilag_times[i - 1] < t)
+       for(int i = store.antilag_index; i > 0; --i)
+               if(store.antilag_times[i] >= t)
+                       if(store.antilag_times[i - 1] < t)
                                return i - 1;
 
-       if(CS(e).antilag_times[0] >= t)
-               if(CS(e).antilag_times[ANTILAG_MAX_ORIGINS - 1] < t)
+       if(store.antilag_times[0] >= t)
+               if(store.antilag_times[ANTILAG_MAX_ORIGINS - 1] < t)
                        return ANTILAG_MAX_ORIGINS - 1;
 
-       for(int i = ANTILAG_MAX_ORIGINS - 1; i > CS(e).antilag_index + 1; --i)
-               if(CS(e).antilag_times[i] >= t)
-                       if(CS(e).antilag_times[i - 1] < t)
+       for(int i = ANTILAG_MAX_ORIGINS - 1; i > store.antilag_index + 1; --i)
+               if(store.antilag_times[i] >= t)
+                       if(store.antilag_times[i - 1] < t)
                                return i - 1;
 
        // if we get here, t is sandwiched nowhere, so let's assume it's in the present
        return -1;
 }
 
-vector antilag_takebackorigin(entity e, float t)
+vector antilag_takebackorigin(entity e, entity store, float t)
 {
-       int i0 = antilag_find(e, t);
+       int i0 = antilag_find(e, store, t);
        if (i0 < 0)
        {
                // IN THE PRESENT
-               if(CS(e).antilag_takenback)
-                       return CS(e).antilag_saved_origin;
+               if(store.antilag_takenback)
+                       return store.antilag_saved_origin;
                else
                        return e.origin;
        }
@@ -72,59 +70,51 @@ vector antilag_takebackorigin(entity e, float t)
        if (i1 >= ANTILAG_MAX_ORIGINS)
                i1 = 0;
 
-       return lerpv(CS(e).antilag_times[i0], CS(e).antilag_origins[i0], CS(e).antilag_times[i1], CS(e).antilag_origins[i1], t);
+       return lerpv(store.antilag_times[i0], store.antilag_origins[i0], store.antilag_times[i1], store.antilag_origins[i1], t);
 }
 
-vector antilag_takebackavgvelocity(entity e, float t0, float t1)
+vector antilag_takebackavgvelocity(entity e, entity store, float t0, float t1)
 {
-       vector o0, o1;
-
-       if(t0 >= t1)
-               return '0 0 0';
-       o0 = antilag_takebackorigin(e, t0);
-       o1 = antilag_takebackorigin(e, t1);
+       if (t0 >= t1) return '0 0 0';
+       vector o0 = antilag_takebackorigin(e, store, t0);
+       vector o1 = antilag_takebackorigin(e, store, t1);
        return (o1 - o0) * (1 / (t1 - t0));
 }
 
-void antilag_takeback(entity e, float t)
+void antilag_takeback(entity e, entity store, float t)
 {
+       if (e.vehicle) {
+           if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
+               antilag_takeback(e.vehicle, e.vehicle, t);
+    }
 
-    if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
-        return;
+       if (!store.antilag_takenback)
+               store.antilag_saved_origin = e.origin;
 
-       if(e.vehicle)
-               antilag_takeback(e.vehicle, t);
-
-       if(!CS(e).antilag_takenback)
-               CS(e).antilag_saved_origin = e.origin;
-
-       vector org = antilag_takebackorigin(e, t);
+       vector org = antilag_takebackorigin(e, store, t);
        setorigin(e, org);
-       CS(e).antilag_takenback = true;
+       store.antilag_takenback = true;
 }
 
-void antilag_restore(entity e)
+void antilag_restore(entity e, entity store)
 {
-    if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
-        return;
-
-       if(e.vehicle)
-               antilag_restore(e.vehicle);
+       if (e.vehicle) {
+           if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
+               antilag_restore(e.vehicle, e.vehicle);
+       }
 
-       if(!CS(e).antilag_takenback)
-               return;
+       if (!store.antilag_takenback) return;
 
-       setorigin(e, CS(e).antilag_saved_origin);
-       CS(e).antilag_takenback = false;
+       setorigin(e, store.antilag_saved_origin);
+       store.antilag_takenback = false;
 }
 
-void antilag_clear(entity e)
+void antilag_clear(entity e, entity store)
 {
-       antilag_restore(e);
-       for (int i = 0; i < ANTILAG_MAX_ORIGINS; ++i)
-       {
-               CS(e).antilag_times[i] = -2342;
-               CS(e).antilag_origins[i] = e.origin;
+       antilag_restore(e, store);
+       for (int i = 0; i < ANTILAG_MAX_ORIGINS; ++i) {
+               store.antilag_times[i] = -2342;
+               store.antilag_origins[i] = e.origin;
        }
-       CS(e).antilag_index = ANTILAG_MAX_ORIGINS - 1; // next one is 0
+       store.antilag_index = ANTILAG_MAX_ORIGINS - 1; // next one is 0
 }
index e1123e786e6db126f17ff0923f5a891d94fc6fde..ee7b5d4e37c0095628517a93ca765173f32bbd14 100644 (file)
@@ -1,15 +1,12 @@
-#ifndef ANTILAG_H
-#define ANTILAG_H
+#pragma once
 
-void antilag_record(entity e, float t);
-vector antilag_takebackorigin(entity e, float t);
-vector antilag_takebackavgvelocity(entity e, float t0, float t1);
-void antilag_takeback(entity e, float t);
-void antilag_restore(entity e);
-void antilag_clear(entity e);
+void antilag_record(entity e, entity store, float t);
+vector antilag_takebackorigin(entity e, entity store, float t);
+void antilag_takeback(entity e, entity store, float t);
+void antilag_restore(entity e, entity store);
+void antilag_clear(entity e, entity store);
 
 .float antilag_debug;
 
 #define ANTILAG_LATENCY(e) min(0.4, e.ping * 0.001)
 // add one ticrate?
-#endif
index cd950738e9e6736cd8e2f80e9d78a709f2e22032..893bb647859e8da75b80b26b05e028c59e1ab530 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_AUTOCVARS_H
-#define SERVER_AUTOCVARS_H
+#pragma once
 
 bool autocvar__notarget;
 bool autocvar__campaign_testrun;
@@ -264,7 +263,7 @@ bool autocvar_g_spawn_alloweffects;
 float autocvar_g_spawn_furthest;
 bool autocvar_g_spawn_useallspawns;
 bool autocvar_g_spawnpoints_auto_move_out_of_solid;
-#define autocvar_g_spawnshieldtime cvar("g_spawnshieldtime")
+float autocvar_g_spawnshieldtime;
 float autocvar_g_spawnshield_blockdamage;
 float autocvar_g_teamdamage_resetspeed;
 float autocvar_g_teamdamage_threshold;
@@ -545,4 +544,3 @@ float autocvar_g_frozen_revive_falldamage;
 int autocvar_g_frozen_revive_falldamage_health;
 bool autocvar_g_frozen_damage_trigger;
 float autocvar_g_frozen_force;
-#endif
diff --git a/qcsrc/server/bot/_all.inc b/qcsrc/server/bot/_all.inc
deleted file mode 100644 (file)
index 2965baa..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "aim.qc"
-#include "bot.qc"
-#include "navigation.qc"
-#include "scripting.qc"
-#include "waypoints.qc"
-
-#include "havocbot/_all.inc"
diff --git a/qcsrc/server/bot/_mod.inc b/qcsrc/server/bot/_mod.inc
new file mode 100644 (file)
index 0000000..02ef867
--- /dev/null
@@ -0,0 +1,6 @@
+// generated file; do not modify
+#include "aim.qc"
+#include "bot.qc"
+#include "navigation.qc"
+#include "scripting.qc"
+#include "waypoints.qc"
index 67057181b6a9f2c247b82c338db4ee87895cbed8..2d6a642bab38d064d563b46880d17f2044648a1c 100644 (file)
@@ -2,6 +2,9 @@
 
 #include "bot.qh"
 
+#include <common/physics/player.qh>
+#include <common/state.qh>
+
 #include "../weapons/weaponsystem.qh"
 
 #include "../mutators/all.qh"
@@ -86,172 +89,172 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f
        return false;
 }
 
-void lag_update()
-{SELFPARAM();
-       if (self.lag1_time) if (time > self.lag1_time) {self.lag_func(self.lag1_time, self.lag1_float1, self.lag1_float2, self.lag1_entity1, self.lag1_vec1, self.lag1_vec2, self.lag1_vec3, self.lag1_vec4);self.lag1_time = 0;}
-       if (self.lag2_time) if (time > self.lag2_time) {self.lag_func(self.lag2_time, self.lag2_float1, self.lag2_float2, self.lag2_entity1, self.lag2_vec1, self.lag2_vec2, self.lag2_vec3, self.lag2_vec4);self.lag2_time = 0;}
-       if (self.lag3_time) if (time > self.lag3_time) {self.lag_func(self.lag3_time, self.lag3_float1, self.lag3_float2, self.lag3_entity1, self.lag3_vec1, self.lag3_vec2, self.lag3_vec3, self.lag3_vec4);self.lag3_time = 0;}
-       if (self.lag4_time) if (time > self.lag4_time) {self.lag_func(self.lag4_time, self.lag4_float1, self.lag4_float2, self.lag4_entity1, self.lag4_vec1, self.lag4_vec2, self.lag4_vec3, self.lag4_vec4);self.lag4_time = 0;}
-       if (self.lag5_time) if (time > self.lag5_time) {self.lag_func(self.lag5_time, self.lag5_float1, self.lag5_float2, self.lag5_entity1, self.lag5_vec1, self.lag5_vec2, self.lag5_vec3, self.lag5_vec4);self.lag5_time = 0;}
+void lag_update(entity this)
+{
+       if (this.lag1_time) if (time > this.lag1_time) {this.lag_func(this, this.lag1_time, this.lag1_float1, this.lag1_float2, this.lag1_entity1, this.lag1_vec1, this.lag1_vec2, this.lag1_vec3, this.lag1_vec4);this.lag1_time = 0;}
+       if (this.lag2_time) if (time > this.lag2_time) {this.lag_func(this, this.lag2_time, this.lag2_float1, this.lag2_float2, this.lag2_entity1, this.lag2_vec1, this.lag2_vec2, this.lag2_vec3, this.lag2_vec4);this.lag2_time = 0;}
+       if (this.lag3_time) if (time > this.lag3_time) {this.lag_func(this, this.lag3_time, this.lag3_float1, this.lag3_float2, this.lag3_entity1, this.lag3_vec1, this.lag3_vec2, this.lag3_vec3, this.lag3_vec4);this.lag3_time = 0;}
+       if (this.lag4_time) if (time > this.lag4_time) {this.lag_func(this, this.lag4_time, this.lag4_float1, this.lag4_float2, this.lag4_entity1, this.lag4_vec1, this.lag4_vec2, this.lag4_vec3, this.lag4_vec4);this.lag4_time = 0;}
+       if (this.lag5_time) if (time > this.lag5_time) {this.lag_func(this, this.lag5_time, this.lag5_float1, this.lag5_float2, this.lag5_entity1, this.lag5_vec1, this.lag5_vec2, this.lag5_vec3, this.lag5_vec4);this.lag5_time = 0;}
 }
 
-float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
-{SELFPARAM();
-       if (self.lag1_time == 0) {self.lag1_time = t;self.lag1_float1 = f1;self.lag1_float2 = f2;self.lag1_entity1 = e1;self.lag1_vec1 = v1;self.lag1_vec2 = v2;self.lag1_vec3 = v3;self.lag1_vec4 = v4;return true;}
-       if (self.lag2_time == 0) {self.lag2_time = t;self.lag2_float1 = f1;self.lag2_float2 = f2;self.lag2_entity1 = e1;self.lag2_vec1 = v1;self.lag2_vec2 = v2;self.lag2_vec3 = v3;self.lag2_vec4 = v4;return true;}
-       if (self.lag3_time == 0) {self.lag3_time = t;self.lag3_float1 = f1;self.lag3_float2 = f2;self.lag3_entity1 = e1;self.lag3_vec1 = v1;self.lag3_vec2 = v2;self.lag3_vec3 = v3;self.lag3_vec4 = v4;return true;}
-       if (self.lag4_time == 0) {self.lag4_time = t;self.lag4_float1 = f1;self.lag4_float2 = f2;self.lag4_entity1 = e1;self.lag4_vec1 = v1;self.lag4_vec2 = v2;self.lag4_vec3 = v3;self.lag4_vec4 = v4;return true;}
-       if (self.lag5_time == 0) {self.lag5_time = t;self.lag5_float1 = f1;self.lag5_float2 = f2;self.lag5_entity1 = e1;self.lag5_vec1 = v1;self.lag5_vec2 = v2;self.lag5_vec3 = v3;self.lag5_vec4 = v4;return true;}
+float lag_additem(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
+{
+       if (this.lag1_time == 0) {this.lag1_time = t;this.lag1_float1 = f1;this.lag1_float2 = f2;this.lag1_entity1 = e1;this.lag1_vec1 = v1;this.lag1_vec2 = v2;this.lag1_vec3 = v3;this.lag1_vec4 = v4;return true;}
+       if (this.lag2_time == 0) {this.lag2_time = t;this.lag2_float1 = f1;this.lag2_float2 = f2;this.lag2_entity1 = e1;this.lag2_vec1 = v1;this.lag2_vec2 = v2;this.lag2_vec3 = v3;this.lag2_vec4 = v4;return true;}
+       if (this.lag3_time == 0) {this.lag3_time = t;this.lag3_float1 = f1;this.lag3_float2 = f2;this.lag3_entity1 = e1;this.lag3_vec1 = v1;this.lag3_vec2 = v2;this.lag3_vec3 = v3;this.lag3_vec4 = v4;return true;}
+       if (this.lag4_time == 0) {this.lag4_time = t;this.lag4_float1 = f1;this.lag4_float2 = f2;this.lag4_entity1 = e1;this.lag4_vec1 = v1;this.lag4_vec2 = v2;this.lag4_vec3 = v3;this.lag4_vec4 = v4;return true;}
+       if (this.lag5_time == 0) {this.lag5_time = t;this.lag5_float1 = f1;this.lag5_float2 = f2;this.lag5_entity1 = e1;this.lag5_vec1 = v1;this.lag5_vec2 = v2;this.lag5_vec3 = v3;this.lag5_vec4 = v4;return true;}
        // no room for it (what is the best thing to do here??)
        return false;
 }
 
-float bot_shouldattack(entity e)
-{SELFPARAM();
-       if (e.team == self.team)
+bool bot_shouldattack(entity this, entity targ)
+{
+       if (targ.team == this.team)
        {
-               if (e == self)
+               if (targ == this)
                        return false;
                if (teamplay)
-               if (e.team != 0)
+               if (targ.team != 0)
                        return false;
        }
 
-       if(STAT(FROZEN, e))
+       if(STAT(FROZEN, targ))
                return false;
 
        if(teamplay)
        {
-               if(e.team==0)
+               if(targ.team==0)
                        return false;
        }
        else if(bot_ignore_bots)
-               if(IS_BOT_CLIENT(e))
+               if(IS_BOT_CLIENT(targ))
                        return false;
 
-       if (!e.takedamage)
+       if (!targ.takedamage)
                return false;
-       if (IS_DEAD(e))
+       if (IS_DEAD(targ))
                return false;
-       if (PHYS_INPUT_BUTTON_CHAT(e))
+       if (PHYS_INPUT_BUTTON_CHAT(targ))
                return false;
-       if(e.flags & FL_NOTARGET)
+       if(targ.flags & FL_NOTARGET)
                return false;
 
-       if(MUTATOR_CALLHOOK(BotShouldAttack, e))
+       if(MUTATOR_CALLHOOK(BotShouldAttack, this, targ))
                return false;
 
        return true;
 }
 
-void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
-{SELFPARAM();
-       if(self.flags & FL_INWATER)
+void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
+{
+       if(this.flags & FL_INWATER)
        {
-               self.bot_aimtarg = world;
+               this.bot_aimtarg = world;
                return;
        }
-       self.bot_aimtarg = e1;
-       self.bot_aimlatency = self.ping; // FIXME?  Shouldn't this be in the lag item?
-       self.bot_aimselforigin = v1;
-       self.bot_aimselfvelocity = v2;
-       self.bot_aimtargorigin = v3;
-       self.bot_aimtargvelocity = v4;
+       this.bot_aimtarg = e1;
+       this.bot_aimlatency = this.ping; // FIXME?  Shouldn't this be in the lag item?
+       this.bot_aimselforigin = v1;
+       this.bot_aimselfvelocity = v2;
+       this.bot_aimtargorigin = v3;
+       this.bot_aimtargvelocity = v4;
        if(skill <= 0)
-               self.bot_canfire = (random() < 0.8);
+               this.bot_canfire = (random() < 0.8);
        else if(skill <= 1)
-               self.bot_canfire = (random() < 0.9);
+               this.bot_canfire = (random() < 0.9);
        else if(skill <= 2)
-               self.bot_canfire = (random() < 0.95);
+               this.bot_canfire = (random() < 0.95);
        else
-               self.bot_canfire = 1;
+               this.bot_canfire = 1;
 }
 
-float bot_aimdir(vector v, float maxfiredeviation)
-{SELFPARAM();
+float bot_aimdir(entity this, vector v, float maxfiredeviation)
+{
        float dist, delta_t, blend;
        vector desiredang, diffang;
 
-       //dprint("aim ", self.netname, ": old:", vtos(self.v_angle));
+       //dprint("aim ", this.netname, ": old:", vtos(this.v_angle));
        // make sure v_angle is sane first
-       self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
-       self.v_angle_z = 0;
+       this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
+       this.v_angle_z = 0;
 
        // get the desired angles to aim at
        //dprint(" at:", vtos(v));
        v = normalize(v);
-       //te_lightning2(world, self.origin + self.view_ofs, self.origin + self.view_ofs + v * 200);
-       if (time >= self.bot_badaimtime)
+       //te_lightning2(world, this.origin + this.view_ofs, this.origin + this.view_ofs + v * 200);
+       if (time >= this.bot_badaimtime)
        {
-               self.bot_badaimtime = max(self.bot_badaimtime + 0.3, time);
-               self.bot_badaimoffset = randomvec() * bound(0, 5 - 0.5 * (skill+self.bot_offsetskill), 5) * autocvar_bot_ai_aimskill_offset;
+               this.bot_badaimtime = max(this.bot_badaimtime + 0.3, time);
+               this.bot_badaimoffset = randomvec() * bound(0, 5 - 0.5 * (skill+this.bot_offsetskill), 5) * autocvar_bot_ai_aimskill_offset;
        }
-       desiredang = vectoangles(v) + self.bot_badaimoffset;
+       desiredang = vectoangles(v) + this.bot_badaimoffset;
        //dprint(" desired:", vtos(desiredang));
        if (desiredang.x >= 180)
                desiredang.x = desiredang.x - 360;
        desiredang.x = bound(-90, 0 - desiredang.x, 90);
-       desiredang.z = self.v_angle.z;
+       desiredang.z = this.v_angle.z;
        //dprint(" / ", vtos(desiredang));
 
        //// pain throws off aim
-       //if (self.bot_painintensity)
+       //if (this.bot_painintensity)
        //{
        //      // shake from pain
-       //      desiredang = desiredang + randomvec() * self.bot_painintensity * 0.2;
+       //      desiredang = desiredang + randomvec() * this.bot_painintensity * 0.2;
        //}
 
        // calculate turn angles
-       diffang = (desiredang - self.bot_olddesiredang);
+       diffang = (desiredang - this.bot_olddesiredang);
        // wrap yaw turn
        diffang.y = diffang.y - floor(diffang.y / 360) * 360;
        if (diffang.y >= 180)
                diffang.y = diffang.y - 360;
-       self.bot_olddesiredang = desiredang;
+       this.bot_olddesiredang = desiredang;
        //dprint(" diff:", vtos(diffang));
 
-       delta_t = time-self.bot_prevaimtime;
-       self.bot_prevaimtime = time;
+       delta_t = time-this.bot_prevaimtime;
+       this.bot_prevaimtime = time;
        // Here we will try to anticipate the comming aiming direction
-       self.bot_1st_order_aimfilter= self.bot_1st_order_aimfilter
-               + (diffang * (1 / delta_t)    - self.bot_1st_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_1st,1);
-       self.bot_2nd_order_aimfilter= self.bot_2nd_order_aimfilter
-               + (self.bot_1st_order_aimfilter - self.bot_2nd_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_2nd,1);
-       self.bot_3th_order_aimfilter= self.bot_3th_order_aimfilter
-               + (self.bot_2nd_order_aimfilter - self.bot_3th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_3th,1);
-       self.bot_4th_order_aimfilter= self.bot_4th_order_aimfilter
-               + (self.bot_3th_order_aimfilter - self.bot_4th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_4th,1);
-       self.bot_5th_order_aimfilter= self.bot_5th_order_aimfilter
-               + (self.bot_4th_order_aimfilter - self.bot_5th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_5th,1);
+       this.bot_1st_order_aimfilter= this.bot_1st_order_aimfilter
+               + (diffang * (1 / delta_t)    - this.bot_1st_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_1st,1);
+       this.bot_2nd_order_aimfilter= this.bot_2nd_order_aimfilter
+               + (this.bot_1st_order_aimfilter - this.bot_2nd_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_2nd,1);
+       this.bot_3th_order_aimfilter= this.bot_3th_order_aimfilter
+               + (this.bot_2nd_order_aimfilter - this.bot_3th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_3th,1);
+       this.bot_4th_order_aimfilter= this.bot_4th_order_aimfilter
+               + (this.bot_3th_order_aimfilter - this.bot_4th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_4th,1);
+       this.bot_5th_order_aimfilter= this.bot_5th_order_aimfilter
+               + (this.bot_4th_order_aimfilter - this.bot_5th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_5th,1);
 
        //blend = (bound(0,skill,10)*0.1)*pow(1-bound(0,skill,10)*0.05,2.5)*5.656854249; //Plot formule before changing !
-       blend = bound(0,skill+self.bot_aimskill,10)*0.1;
+       blend = bound(0,skill+this.bot_aimskill,10)*0.1;
        desiredang = desiredang + blend *
        (
-                 self.bot_1st_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_1st
-               + self.bot_2nd_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_2nd
-               + self.bot_3th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_3th
-               + self.bot_4th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_4th
-               + self.bot_5th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_5th
+                 this.bot_1st_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_1st
+               + this.bot_2nd_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_2nd
+               + this.bot_3th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_3th
+               + this.bot_4th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_4th
+               + this.bot_5th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_5th
        );
 
        // calculate turn angles
-       diffang = desiredang - self.bot_mouseaim;
+       diffang = desiredang - this.bot_mouseaim;
        // wrap yaw turn
        diffang.y = diffang.y - floor(diffang.y / 360) * 360;
        if (diffang.y >= 180)
                diffang.y = diffang.y - 360;
        //dprint(" diff:", vtos(diffang));
 
-       if (time >= self.bot_aimthinktime)
+       if (time >= this.bot_aimthinktime)
        {
-               self.bot_aimthinktime = max(self.bot_aimthinktime + 0.5 - 0.05*(skill+self.bot_thinkskill), time);
-               self.bot_mouseaim = self.bot_mouseaim + diffang * (1-random()*0.1*bound(1,10-(skill+self.bot_thinkskill),10));
+               this.bot_aimthinktime = max(this.bot_aimthinktime + 0.5 - 0.05*(skill+this.bot_thinkskill), time);
+               this.bot_mouseaim = this.bot_mouseaim + diffang * (1-random()*0.1*bound(1,10-(skill+this.bot_thinkskill),10));
        }
 
-       //self.v_angle = self.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
+       //this.v_angle = this.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
 
-       diffang = self.bot_mouseaim - desiredang;
+       diffang = this.bot_mouseaim - desiredang;
        // wrap yaw turn
        diffang.y = diffang.y - floor(diffang.y / 360) * 360;
        if (diffang.y >= 180)
@@ -259,7 +262,7 @@ float bot_aimdir(vector v, float maxfiredeviation)
        desiredang = desiredang + diffang * bound(0,autocvar_bot_ai_aimskill_think,1);
 
        // calculate turn angles
-       diffang = desiredang - self.v_angle;
+       diffang = desiredang - this.v_angle;
        // wrap yaw turn
        diffang.y = diffang.y - floor(diffang.y / 360) * 360;
        if (diffang.y >= 180)
@@ -275,24 +278,24 @@ float bot_aimdir(vector v, float maxfiredeviation)
        fixedrate = autocvar_bot_ai_aimskill_fixedrate / bound(1,dist,1000);
        blendrate = autocvar_bot_ai_aimskill_blendrate;
        r = max(fixedrate, blendrate);
-       //self.v_angle = self.v_angle + diffang * bound(frametime, r * frametime * (2+skill*skill*0.05-random()*0.05*(10-skill)), 1);
-       self.v_angle = self.v_angle + diffang * bound(delta_t, r * delta_t * (2+pow(skill+self.bot_mouseskill,3)*0.005-random()), 1);
-       self.v_angle = self.v_angle * bound(0,autocvar_bot_ai_aimskill_mouse,1) + desiredang * bound(0,(1-autocvar_bot_ai_aimskill_mouse),1);
-       //self.v_angle = self.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
-       //self.v_angle = self.v_angle + diffang * (1/ blendrate);
-       self.v_angle_z = 0;
-       self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
-       //dprint(" turn:", vtos(self.v_angle));
-
-       makevectors(self.v_angle);
-       shotorg = self.origin + self.view_ofs;
+       //this.v_angle = this.v_angle + diffang * bound(frametime, r * frametime * (2+skill*skill*0.05-random()*0.05*(10-skill)), 1);
+       this.v_angle = this.v_angle + diffang * bound(delta_t, r * delta_t * (2+pow(skill+this.bot_mouseskill,3)*0.005-random()), 1);
+       this.v_angle = this.v_angle * bound(0,autocvar_bot_ai_aimskill_mouse,1) + desiredang * bound(0,(1-autocvar_bot_ai_aimskill_mouse),1);
+       //this.v_angle = this.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
+       //this.v_angle = this.v_angle + diffang * (1/ blendrate);
+       this.v_angle_z = 0;
+       this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
+       //dprint(" turn:", vtos(this.v_angle));
+
+       makevectors(this.v_angle);
+       shotorg = this.origin + this.view_ofs;
        shotdir = v_forward;
 
        //dprint(" dir:", vtos(v_forward));
        //te_lightning2(world, shotorg, shotorg + shotdir * 100);
 
        // calculate turn angles again
-       //diffang = desiredang - self.v_angle;
+       //diffang = desiredang - this.v_angle;
        //diffang_y = diffang_y - floor(diffang_y / 360) * 360;
        //if (diffang_y >= 180)
        //      diffang_y = diffang_y - 360;
@@ -303,13 +306,13 @@ float bot_aimdir(vector v, float maxfiredeviation)
        // note the maxfiredeviation is in degrees so this has to convert to radians first
        //if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
        if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
-       if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + self.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
-               self.bot_firetimer = time + bound(0.1, 0.5-(skill+self.bot_aggresskill)*0.05, 0.5);
+       if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + this.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+this.bot_aggresskill)*0.05,1))
+               this.bot_firetimer = time + bound(0.1, 0.5-(skill+this.bot_aggresskill)*0.05, 0.5);
        //traceline(shotorg,shotorg+shotdir*1000,false,world);
        //dprint(ftos(maxfiredeviation),"\n");
        //dprint(" diff:", vtos(diffang), "\n");
 
-       return self.bot_canfire && (time < self.bot_firetimer);
+       return this.bot_canfire && (time < this.bot_firetimer);
 }
 
 vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay)
@@ -318,12 +321,12 @@ vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, flo
        return targorigin + targvelocity * (shotdelay + vlen(targorigin - shotorg) / shotspeed);
 }
 
-float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
-{SELFPARAM();
+bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity)
+{
        float f, r, hf, distanceratio;
        vector v;
        /*
-       eprint(self);
+       eprint(this);
        dprint("bot_aim(", ftos(shotspeed));
        dprint(", ", ftos(shotspeedupward));
        dprint(", ", ftos(maxshottime));
@@ -331,60 +334,60 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        dprint(");\n");
        */
 
-       hf = self.dphitcontentsmask;
-       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+       hf = this.dphitcontentsmask;
+       this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 
        shotspeed *= W_WeaponSpeedFactor();
        shotspeedupward *= W_WeaponSpeedFactor();
        if (!shotspeed)
        {
-               LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " shotspeed is zero!\n");
+               LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " shotspeed is zero!\n");
                shotspeed = 1000000;
        }
        if (!maxshottime)
        {
-               LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " maxshottime is zero!\n");
+               LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " maxshottime is zero!\n");
                maxshottime = 1;
        }
-       makevectors(self.v_angle);
-       shotorg = self.origin + self.view_ofs;
+       makevectors(this.v_angle);
+       shotorg = this.origin + this.view_ofs;
        shotdir = v_forward;
-       v = bot_shotlead(self.bot_aimtargorigin, self.bot_aimtargvelocity, shotspeed, self.bot_aimlatency);
+       v = bot_shotlead(this.bot_aimtargorigin, this.bot_aimtargvelocity, shotspeed, this.bot_aimlatency);
        distanceratio = sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees;
        distanceratio = bound(0,distanceratio,1);
        r =  (autocvar_bot_ai_aimskill_firetolerance_maxdegrees-autocvar_bot_ai_aimskill_firetolerance_mindegrees)
                * (1-distanceratio) + autocvar_bot_ai_aimskill_firetolerance_mindegrees;
-       if (applygravity && self.bot_aimtarg)
+       if (applygravity && this.bot_aimtarg)
        {
-               if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', self.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, self))
+               if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', this.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, this))
                {
-                       self.dphitcontentsmask = hf;
+                       this.dphitcontentsmask = hf;
                        return false;
                }
 
-               f = bot_aimdir(findtrajectory_velocity - shotspeedupward * '0 0 1', r);
+               f = bot_aimdir(this, findtrajectory_velocity - shotspeedupward * '0 0 1', r);
        }
        else
        {
-               f = bot_aimdir(v - shotorg, r);
-               //dprint("AIM: ");dprint(vtos(self.bot_aimtargorigin));dprint(" + ");dprint(vtos(self.bot_aimtargvelocity));dprint(" * ");dprint(ftos(self.bot_aimlatency + vlen(self.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
-               //traceline(shotorg, shotorg + shotdir * 10000, false, self);
+               f = bot_aimdir(this, v - shotorg, r);
+               //dprint("AIM: ");dprint(vtos(this.bot_aimtargorigin));dprint(" + ");dprint(vtos(this.bot_aimtargvelocity));dprint(" * ");dprint(ftos(this.bot_aimlatency + vlen(this.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
+               //traceline(shotorg, shotorg + shotdir * 10000, false, this);
                //if (trace_ent.takedamage)
                //if (trace_fraction < 1)
-               //if (!bot_shouldattack(trace_ent))
+               //if (!bot_shouldattack(this, trace_ent))
                //      return false;
-               traceline(shotorg, self.bot_aimtargorigin, false, self);
+               traceline(shotorg, this.bot_aimtargorigin, false, this);
                if (trace_fraction < 1)
-               if (trace_ent != self.enemy)
-               if (!bot_shouldattack(trace_ent))
+               if (trace_ent != this.enemy)
+               if (!bot_shouldattack(this, trace_ent))
                {
-                       self.dphitcontentsmask = hf;
+                       this.dphitcontentsmask = hf;
                        return false;
                }
        }
 
        //if (r > maxshottime * shotspeed)
        //      return false;
-       self.dphitcontentsmask = hf;
+       this.dphitcontentsmask = hf;
        return true;
 }
index d1cbd0d629a71368ed5b8ea74fe26b4a73ea245d..5a1cb16c4d05a8a56d9f8cc1b2747cf8770db70e 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef AIM_H
-#define AIM_H
+#pragma once
 /*
  * Globals and Fields
  */
@@ -86,16 +85,15 @@ vector shotdir;
  * Functions
  */
 
-float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
-void lag_update();
-void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
+float lag_additem(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
+void lag_update(entity this);
+void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
 
-float bot_shouldattack(entity e);
-float bot_aimdir(vector v, float maxfiredeviation);
-float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity);
+float bot_shouldattack(entity this, entity targ);
+float bot_aimdir(entity this, vector v, float maxfiredeviation);
+bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity);
 float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, float shotspeed, float shotspeedupward, float maxtime, float shotdelay, entity ignore);
 
 vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay);
 
-.void(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) lag_func;
-#endif
+.void(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) lag_func;
index 72ebfcb2e70d65cecc4aeba4373151514effec6b..ef08e308c0223767729e93005e2df70b36d83a55 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "../weapons/accuracy.qh"
 
+#include <common/physics/player.qh>
 #include <common/constants.qh>
 #include <common/mapinfo.qh>
 #include <common/teams.qh>
 #include <lib/warpzone/util_server.qh>
 
 entity bot_spawn()
-{SELFPARAM();
+{
        entity bot = spawnclient();
        if (bot)
        {
                currentbots = currentbots + 1;
-               setself(bot);
-               bot_setnameandstuff();
-               ClientConnect();
-               PutClientInServer();
-               setself(this);
+               bot_setnameandstuff(bot);
+               WITHSELF(bot, ClientConnect());
+               WITHSELF(bot, PutClientInServer());
        }
        return bot;
 }
 
-void bot_think()
-{SELFPARAM();
-       if (self.bot_nextthink > time)
+void bot_think(entity this)
+{
+       if (this.bot_nextthink > time)
                return;
 
-       self.flags &= ~FL_GODMODE;
+       this.flags &= ~FL_GODMODE;
        if(autocvar_bot_god)
-               self.flags |= FL_GODMODE;
+               this.flags |= FL_GODMODE;
 
-       self.bot_nextthink = self.bot_nextthink + autocvar_bot_ai_thinkinterval * pow(0.5, self.bot_aiskill);
-       //if (self.bot_painintensity > 0)
-       //      self.bot_painintensity = self.bot_painintensity - (skill + 1) * 40 * frametime;
+       this.bot_nextthink = this.bot_nextthink + autocvar_bot_ai_thinkinterval * pow(0.5, this.bot_aiskill);
+       //if (this.bot_painintensity > 0)
+       //      this.bot_painintensity = this.bot_painintensity - (skill + 1) * 40 * frametime;
 
-       //self.bot_painintensity = self.bot_painintensity + self.bot_oldhealth - self.health;
-       //self.bot_painintensity = bound(0, self.bot_painintensity, 100);
+       //this.bot_painintensity = this.bot_painintensity + this.bot_oldhealth - this.health;
+       //this.bot_painintensity = bound(0, this.bot_painintensity, 100);
 
-       if (!IS_PLAYER(self) || (autocvar_g_campaign && !campaign_bots_may_start))
+       if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
        {
-               self.bot_nextthink = time + 0.5;
+               this.bot_nextthink = time + 0.5;
                return;
        }
 
-       if (self.fixangle)
+       if (this.fixangle)
        {
-               self.v_angle = self.angles;
-               self.v_angle_z = 0;
-               self.fixangle = false;
+               this.v_angle = this.angles;
+               this.v_angle_z = 0;
+               this.fixangle = false;
        }
 
-       self.dmg_take = 0;
-       self.dmg_save = 0;
-       self.dmg_inflictor = world;
+       this.dmg_take = 0;
+       this.dmg_save = 0;
+       this.dmg_inflictor = world;
 
        // calculate an aiming latency based on the skill setting
        // (simulated network latency + naturally delayed reflexes)
-       //self.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
+       //this.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
        // minimum ping 20+10 random
-       self.ping = bound(0,0.07 - bound(0, (skill + self.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
+       this.ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
        // skill 10 = ping 0.2 (adrenaline)
        // skill 0 = ping 0.7 (slightly drunk)
 
        // clear buttons
-       PHYS_INPUT_BUTTON_ATCK(self) = false;
-       PHYS_INPUT_BUTTON_JUMP(self) = false;
-       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-       PHYS_INPUT_BUTTON_ZOOM(self) = false;
-       PHYS_INPUT_BUTTON_CROUCH(self) = false;
-       PHYS_INPUT_BUTTON_HOOK(self) = false;
-       PHYS_INPUT_BUTTON_INFO(self) = false;
-       PHYS_INPUT_BUTTON_DRAG(self) = false;
-       PHYS_INPUT_BUTTON_CHAT(self) = false;
-       PHYS_INPUT_BUTTON_USE(self) = false;
+       PHYS_INPUT_BUTTON_ATCK(this) = false;
+       PHYS_INPUT_BUTTON_JUMP(this) = false;
+       PHYS_INPUT_BUTTON_ATCK2(this) = false;
+       PHYS_INPUT_BUTTON_ZOOM(this) = false;
+       PHYS_INPUT_BUTTON_CROUCH(this) = false;
+       PHYS_INPUT_BUTTON_HOOK(this) = false;
+       PHYS_INPUT_BUTTON_INFO(this) = false;
+       PHYS_INPUT_BUTTON_DRAG(this) = false;
+       PHYS_INPUT_BUTTON_CHAT(this) = false;
+       PHYS_INPUT_BUTTON_USE(this) = false;
 
        if (time < game_starttime)
        {
                // block the bot during the countdown to game start
-               self.movement = '0 0 0';
-               self.bot_nextthink = game_starttime;
+               this.movement = '0 0 0';
+               this.bot_nextthink = game_starttime;
                return;
        }
 
        // if dead, just wait until we can respawn
-       if (IS_DEAD(self))
+       if (IS_DEAD(this))
        {
-               if (self.deadflag == DEAD_DEAD)
+               if (this.deadflag == DEAD_DEAD)
                {
-                       PHYS_INPUT_BUTTON_JUMP(self) = true; // press jump to respawn
-                       self.bot_strategytime = 0;
+                       PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
+                       this.bot_strategytime = 0;
                }
        }
-       else if(self.aistatus & AI_STATUS_STUCK)
-               navigation_unstuck();
+       else if(this.aistatus & AI_STATUS_STUCK)
+               navigation_unstuck(this);
 
        // now call the current bot AI (havocbot for example)
-       self.bot_ai();
+       this.bot_ai(this);
 }
 
-void bot_setnameandstuff()
-{SELFPARAM();
+void bot_setnameandstuff(entity this)
+{
        string readfile, s;
        float file, tokens, prio;
 
@@ -196,11 +195,11 @@ void bot_setnameandstuff()
        if(argv(4) != "" && stof(argv(4)) >= 0) bot_pants = argv(4);
        else bot_pants = ftos(floor(random() * 15));
 
-       self.bot_forced_team = stof(argv(5));
+       this.bot_forced_team = stof(argv(5));
 
        prio = 6;
 
-       #define READSKILL(f,w,r) if(argv(prio) != "") self.f = stof(argv(prio)) * (w); else self.f = (!autocvar_g_campaign) * (2 * random() - 1) * (r) * (w); ++prio
+       #define READSKILL(f,w,r) if(argv(prio) != "") this.f = stof(argv(prio)) * (w); else this.f = (!autocvar_g_campaign) * (2 * random() - 1) * (r) * (w); ++prio
        //print(bot_name, ": ping=", argv(9), "\n");
 
        READSKILL(havocbot_keyboardskill, 0.5, 0.5); // keyboard skill
@@ -220,11 +219,11 @@ void bot_setnameandstuff()
        READSKILL(bot_thinkskill, 1, 0.5); // think skill
        READSKILL(bot_aiskill, 2, 0); // "ai" skill
 
-       self.bot_config_loaded = true;
+       this.bot_config_loaded = true;
 
        // this is really only a default, JoinBestTeam is called later
-       setcolor(self, stof(bot_shirt) * 16 + stof(bot_pants));
-       self.bot_preferredcolors = self.clientcolors;
+       setcolor(this, stof(bot_shirt) * 16 + stof(bot_pants));
+       this.bot_preferredcolors = this.clientcolors;
 
        // pick the name
        if (autocvar_bot_usemodelnames)
@@ -239,20 +238,20 @@ void bot_setnameandstuff()
                        ++j;
        ));
        if (j)
-               self.netname = self.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
+               this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
        else
-               self.netname = self.netname_freeme = strzone(strcat(prefix, name, suffix));
+               this.netname = this.netname_freeme = strzone(strcat(prefix, name, suffix));
 
-       self.cleanname = strzone(name);
+       this.cleanname = strzone(name);
 
        // pick the model and skin
        if(substring(bot_model, -4, 1) != ".")
                bot_model = strcat(bot_model, ".iqm");
-       self.playermodel = self.playermodel_freeme = strzone(strcat("models/player/", bot_model));
-       self.playerskin = self.playerskin_freeme = strzone(bot_skin);
+       this.playermodel = this.playermodel_freeme = strzone(strcat("models/player/", bot_model));
+       this.playerskin = this.playerskin_freeme = strzone(bot_skin);
 
-       self.cvar_cl_accuracy_data_share = 1;  // share the bots weapon accuracy data with the world
-       self.cvar_cl_accuracy_data_receive = 0;  // don't receive any weapon accuracy data
+       this.cvar_cl_accuracy_data_share = 1;  // share the bots weapon accuracy data with the world
+       this.cvar_cl_accuracy_data_receive = 0;  // don't receive any weapon accuracy data
 }
 
 void bot_custom_weapon_priority_setup()
@@ -377,53 +376,53 @@ void bot_relinkplayerlist()
        bot_strategytoken_taken = true;
 }
 
-void bot_clientdisconnect()
-{SELFPARAM();
-       if (!IS_BOT_CLIENT(self))
+void bot_clientdisconnect(entity this)
+{
+       if (!IS_BOT_CLIENT(this))
                return;
-       bot_clearqueue(self);
-       if(self.cleanname)
-               strunzone(self.cleanname);
-       if(self.netname_freeme)
-               strunzone(self.netname_freeme);
-       if(self.playermodel_freeme)
-               strunzone(self.playermodel_freeme);
-       if(self.playerskin_freeme)
-               strunzone(self.playerskin_freeme);
-       self.cleanname = string_null;
-       self.netname_freeme = string_null;
-       self.playermodel_freeme = string_null;
-       self.playerskin_freeme = string_null;
-       if(self.bot_cmd_current)
-               remove(self.bot_cmd_current);
-       if(bot_waypoint_queue_owner==self)
+       bot_clearqueue(this);
+       if(this.cleanname)
+               strunzone(this.cleanname);
+       if(this.netname_freeme)
+               strunzone(this.netname_freeme);
+       if(this.playermodel_freeme)
+               strunzone(this.playermodel_freeme);
+       if(this.playerskin_freeme)
+               strunzone(this.playerskin_freeme);
+       this.cleanname = string_null;
+       this.netname_freeme = string_null;
+       this.playermodel_freeme = string_null;
+       this.playerskin_freeme = string_null;
+       if(this.bot_cmd_current)
+               remove(this.bot_cmd_current);
+       if(bot_waypoint_queue_owner==this)
                bot_waypoint_queue_owner = world;
 }
 
 void bot_clientconnect(entity this)
 {
        if (!IS_BOT_CLIENT(this)) return;
-       self.bot_preferredcolors = self.clientcolors;
-       self.bot_nextthink = time - random();
-       self.lag_func = bot_lagfunc;
-       self.isbot = true;
-       self.createdtime = self.bot_nextthink;
-
-       if(!self.bot_config_loaded) // This is needed so team overrider doesn't break between matches
-               bot_setnameandstuff();
-
-       if(self.bot_forced_team==1)
-               self.team = NUM_TEAM_1;
-       else if(self.bot_forced_team==2)
-               self.team = NUM_TEAM_2;
-       else if(self.bot_forced_team==3)
-               self.team = NUM_TEAM_3;
-       else if(self.bot_forced_team==4)
-               self.team = NUM_TEAM_4;
+       this.bot_preferredcolors = this.clientcolors;
+       this.bot_nextthink = time - random();
+       this.lag_func = bot_lagfunc;
+       this.isbot = true;
+       this.createdtime = this.bot_nextthink;
+
+       if(!this.bot_config_loaded) // This is needed so team overrider doesn't break between matches
+               bot_setnameandstuff(this);
+
+       if(this.bot_forced_team==1)
+               this.team = NUM_TEAM_1;
+       else if(this.bot_forced_team==2)
+               this.team = NUM_TEAM_2;
+       else if(this.bot_forced_team==3)
+               this.team = NUM_TEAM_3;
+       else if(this.bot_forced_team==4)
+               this.team = NUM_TEAM_4;
        else
-               JoinBestTeam(self, false, true);
+               JoinBestTeam(this, false, true);
 
-       havocbot_setupbot();
+       havocbot_setupbot(this);
 }
 
 void bot_removefromlargestteam()
index 7927942ea73fdd5d2a34843d512f781054500027..a28c94b7f729a8744241489008dc324caae6f51d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef BOT_H
-#define BOT_H
+#pragma once
 /*
  * Globals and Fields
  */
@@ -93,26 +92,25 @@ float bot_ignore_bots; // let bots not attack other bots (only works in non-team
 entity bot_spawn();
 float bot_fixcount();
 
-void bot_think();
-void bot_setnameandstuff();
+void bot_think(entity this);
+void bot_setnameandstuff(entity this);
 void bot_custom_weapon_priority_setup();
 void bot_endgame();
 void bot_relinkplayerlist();
-void bot_clientdisconnect();
+void bot_clientdisconnect(entity this);
 void bot_clientconnect(entity this);
 void bot_removefromlargestteam();
 void bot_removenewest();
 void autoskill(float factor);
 void bot_serverframe();
 
-.void() bot_ai;
+.void(entity this) bot_ai;
 .float(entity player, entity item) bot_pickupevalfunc;
 
 /*
  * Imports
  */
 
-void() havocbot_setupbot;
+void(entity this) havocbot_setupbot;
 
 void bot_calculate_stepheightvec();
-#endif
diff --git a/qcsrc/server/bot/havocbot/_all.inc b/qcsrc/server/bot/havocbot/_all.inc
deleted file mode 100644 (file)
index 2dd8c74..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "havocbot.qc"
-#include "roles.qc"
diff --git a/qcsrc/server/bot/havocbot/_mod.inc b/qcsrc/server/bot/havocbot/_mod.inc
new file mode 100644 (file)
index 0000000..fa2d660
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+#include "havocbot.qc"
+#include "roles.qc"
index 260e8e661f8395109cd62b24a0fe16fd2b09d0fb..5403b35ca6110e3dde18e1840d019300de04ac1e 100644 (file)
@@ -7,6 +7,8 @@
 #include "../waypoints.qh"
 
 #include <common/constants.qh>
+#include <common/physics/player.qh>
+#include <common/state.qh>
 #include <common/items/all.qh>
 
 #include <common/triggers/trigger/jumppads.qh>
 
 .float speed;
 
-void havocbot_ai()
-{SELFPARAM();
-       if(self.draggedby)
+void havocbot_ai(entity this)
+{
+       if(this.draggedby)
                return;
 
-       if(bot_execute_commands())
+       if(bot_execute_commands(this))
                return;
 
-       if (bot_strategytoken == self)
+       if (bot_strategytoken == this)
        if (!bot_strategytoken_taken)
        {
-               if(self.havocbot_blockhead)
+               if(this.havocbot_blockhead)
                {
-                       self.havocbot_blockhead = false;
+                       this.havocbot_blockhead = false;
                }
                else
                {
-                       if (!self.jumppadcount)
-                               self.havocbot_role();
+                       if (!this.jumppadcount)
+                               this.havocbot_role(this); // little too far down the rabbit hole
                }
 
                // TODO: tracewalk() should take care of this job (better path finding under water)
                // if we don't have a goal and we're under water look for a waypoint near the "shore" and push it
-               if(IS_DEAD(self))
-               if(self.goalcurrent==world)
-               if(self.waterlevel==WATERLEVEL_SWIMMING || (self.aistatus & AI_STATUS_OUT_WATER))
+               if(IS_DEAD(this))
+               if(this.goalcurrent==world)
+               if(this.waterlevel==WATERLEVEL_SWIMMING || (this.aistatus & AI_STATUS_OUT_WATER))
                {
                        // Look for the closest waypoint out of water
                        entity newgoal, head;
@@ -50,20 +52,20 @@ void havocbot_ai()
                        bestdistance = 10000;
                        for (head = findchain(classname, "waypoint"); head; head = head.chain)
                        {
-                               distance = vlen(head.origin - self.origin);
+                               distance = vlen(head.origin - this.origin);
                                if(distance>10000)
                                        continue;
 
-                               if(head.origin.z < self.origin.z)
+                               if(head.origin.z < this.origin.z)
                                        continue;
 
-                               if(head.origin.z - self.origin.z - self.view_ofs.z > 100)
+                               if(head.origin.z - this.origin.z - this.view_ofs.z > 100)
                                        continue;
 
                                if (pointcontents(head.origin + head.maxs + '0 0 1') != CONTENT_EMPTY)
                                        continue;
 
-                               traceline(self.origin + self.view_ofs , head.origin, true, head);
+                               traceline(this.origin + this.view_ofs , head.origin, true, head);
 
                                if(trace_fraction<1)
                                        continue;
@@ -78,7 +80,7 @@ void havocbot_ai()
                        if(newgoal)
                        {
                        //      te_wizspike(newgoal.origin);
-                               navigation_pushroute(newgoal);
+                               navigation_pushroute(this, newgoal);
                        }
                }
 
@@ -86,119 +88,119 @@ void havocbot_ai()
                bot_strategytoken_taken = true;
        }
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
                return;
 
-       havocbot_chooseenemy();
-       if (self.bot_chooseweapontime < time )
+       havocbot_chooseenemy(this);
+       if (this.bot_chooseweapontime < time )
        {
-               self.bot_chooseweapontime = time + autocvar_bot_ai_chooseweaponinterval;
-               havocbot_chooseweapon();
+               this.bot_chooseweapontime = time + autocvar_bot_ai_chooseweaponinterval;
+               havocbot_chooseweapon(this);
        }
-       havocbot_aim();
-       lag_update();
-       if (self.bot_aimtarg)
+       havocbot_aim(this);
+       lag_update(this);
+       if (this.bot_aimtarg)
        {
-               self.aistatus |= AI_STATUS_ATTACKING;
-               self.aistatus &= ~AI_STATUS_ROAMING;
+               this.aistatus |= AI_STATUS_ATTACKING;
+               this.aistatus &= ~AI_STATUS_ROAMING;
 
-               if(self.weapons)
+               if(this.weapons)
                {
-                       Weapon w = PS(self).m_weapon;
+                       Weapon w = PS(this).m_weapon;
                        w.wr_aim(w);
-                       if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
+                       if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
                        {
-                               PHYS_INPUT_BUTTON_ATCK(self) = false;
-                               PHYS_INPUT_BUTTON_ATCK2(self) = false;
+                               PHYS_INPUT_BUTTON_ATCK(this) = false;
+                               PHYS_INPUT_BUTTON_ATCK2(this) = false;
                        }
                        else
                        {
-                               if(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))
-                                       self.lastfiredweapon = PS(self).m_weapon.m_id;
+                               if(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))
+                                       this.lastfiredweapon = PS(this).m_weapon.m_id;
                        }
                }
                else
                {
-                       if(IS_PLAYER(self.bot_aimtarg))
-                               bot_aimdir(self.bot_aimtarg.origin + self.bot_aimtarg.view_ofs - self.origin - self.view_ofs , -1);
+                       if(IS_PLAYER(this.bot_aimtarg))
+                               bot_aimdir(this, this.bot_aimtarg.origin + this.bot_aimtarg.view_ofs - this.origin - this.view_ofs , -1);
                }
        }
-       else if (self.goalcurrent)
+       else if (this.goalcurrent)
        {
-               self.aistatus |= AI_STATUS_ROAMING;
-               self.aistatus &= ~AI_STATUS_ATTACKING;
+               this.aistatus |= AI_STATUS_ROAMING;
+               this.aistatus &= ~AI_STATUS_ATTACKING;
 
                vector now,v,next;//,heading;
                float aimdistance,skillblend,distanceblend,blend;
-               next = now = ( (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5) - (self.origin + self.view_ofs);
+               next = now = ( (this.goalcurrent.absmin + this.goalcurrent.absmax) * 0.5) - (this.origin + this.view_ofs);
                aimdistance = vlen(now);
-               //heading = self.velocity;
-               //dprint(self.goalstack01.classname,etos(self.goalstack01),"\n");
+               //heading = this.velocity;
+               //dprint(this.goalstack01.classname,etos(this.goalstack01),"\n");
                if(
-                       self.goalstack01 != self && self.goalstack01 != world && ((self.aistatus & AI_STATUS_RUNNING) == 0) &&
-                       !(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
+                       this.goalstack01 != this && this.goalstack01 != world && ((this.aistatus & AI_STATUS_RUNNING) == 0) &&
+                       !(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
                )
-                       next = ((self.goalstack01.absmin + self.goalstack01.absmax) * 0.5) - (self.origin + self.view_ofs);
+                       next = ((this.goalstack01.absmin + this.goalstack01.absmax) * 0.5) - (this.origin + this.view_ofs);
 
-               skillblend=bound(0,(skill+self.bot_moveskill-2.5)*0.5,1); //lower skill player can't preturn
+               skillblend=bound(0,(skill+this.bot_moveskill-2.5)*0.5,1); //lower skill player can't preturn
                distanceblend=bound(0,aimdistance/autocvar_bot_ai_keyboard_distance,1);
                blend = skillblend * (1-distanceblend);
                //v = (now * (distanceblend) + next * (1-distanceblend)) * (skillblend) + now * (1-skillblend);
                //v = now * (distanceblend) * (skillblend) + next * (1-distanceblend) * (skillblend) + now * (1-skillblend);
                //v = now * ((1-skillblend) + (distanceblend) * (skillblend)) + next * (1-distanceblend) * (skillblend);
                v = now + blend * (next - now);
-               //dprint(etos(self), " ");
+               //dprint(etos(this), " ");
                //dprint(vtos(now), ":", vtos(next), "=", vtos(v), " (blend ", ftos(blend), ")\n");
                //v = now * (distanceblend) + next * (1-distanceblend);
-               if (self.waterlevel < WATERLEVEL_SWIMMING)
+               if (this.waterlevel < WATERLEVEL_SWIMMING)
                        v.z = 0;
                //dprint("walk at:", vtos(v), "\n");
-               //te_lightning2(world, self.origin, self.goalcurrent.origin);
-               bot_aimdir(v, -1);
+               //te_lightning2(world, this.origin, this.goalcurrent.origin);
+               bot_aimdir(this, v, -1);
        }
-       havocbot_movetogoal();
+       havocbot_movetogoal(this);
 
        // if the bot is not attacking, consider reloading weapons
-       if (!(self.aistatus & AI_STATUS_ATTACKING))
+       if (!(this.aistatus & AI_STATUS_ATTACKING))
        {
                // we are currently holding a weapon that's not fully loaded, reload it
                if(skill >= 2) // bots can only reload the held weapon on purpose past this skill
-               if(self.clip_load < self.clip_size)
-                       self.impulse = 20; // "press" the reload button, not sure if this is done right
+               if(this.clip_load < this.clip_size)
+                       this.impulse = 20; // "press" the reload button, not sure if this is done right
 
                // if we're not reloading a weapon, switch to any weapon in our invnetory that's not fully loaded to reload it next
                // the code above executes next frame, starting the reloading then
                if(skill >= 5) // bots can only look for unloaded weapons past this skill
-               if(self.clip_load >= 0) // only if we're not reloading a weapon already
+               if(this.clip_load >= 0) // only if we're not reloading a weapon already
                {
                        FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                               if((self.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[it.m_id] < it.reloading_ammo))
-                                       PS(self).m_switchweapon = it;
+                               if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.weapon_load[it.m_id] < it.reloading_ammo))
+                                       PS(this).m_switchweapon = it;
                        ));
                }
        }
 }
 
-void havocbot_keyboard_movement(vector destorg)
-{SELFPARAM();
+void havocbot_keyboard_movement(entity this, vector destorg)
+{
        vector keyboard;
        float blend, maxspeed;
        float sk;
 
-       sk = skill + self.bot_moveskill;
+       sk = skill + this.bot_moveskill;
 
        maxspeed = autocvar_sv_maxspeed;
 
-       if (time < self.havocbot_keyboardtime)
+       if (time < this.havocbot_keyboardtime)
                return;
 
-       self.havocbot_keyboardtime =
+       this.havocbot_keyboardtime =
                max(
-                       self.havocbot_keyboardtime
-                               + 0.05/max(1, sk+self.havocbot_keyboardskill)
-                               + random()*0.025/max(0.00025, skill+self.havocbot_keyboardskill)
+                       this.havocbot_keyboardtime
+                               + 0.05/max(1, sk+this.havocbot_keyboardskill)
+                               + random()*0.025/max(0.00025, skill+this.havocbot_keyboardskill)
                , time);
-       keyboard = self.movement * (1.0 / maxspeed);
+       keyboard = this.movement * (1.0 / maxspeed);
 
        float trigger, trigger1;
        blend = bound(0,sk*0.1,1);
@@ -245,100 +247,100 @@ void havocbot_keyboard_movement(vector destorg)
        else
                keyboard.z = 0;
 
-       self.havocbot_keyboard = keyboard * maxspeed;
-       if (self.havocbot_ducktime>time) PHYS_INPUT_BUTTON_CROUCH(self) = true;
+       this.havocbot_keyboard = keyboard * maxspeed;
+       if (this.havocbot_ducktime>time) PHYS_INPUT_BUTTON_CROUCH(this) = true;
 
-       keyboard = self.havocbot_keyboard;
-       blend = bound(0,vlen(destorg-self.origin)/autocvar_bot_ai_keyboard_distance,1); // When getting close move with 360 degree
-       //dprint("movement ", vtos(self.movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
-       self.movement = self.movement + (keyboard - self.movement) * blend;
+       keyboard = this.havocbot_keyboard;
+       blend = bound(0,vlen(destorg-this.origin)/autocvar_bot_ai_keyboard_distance,1); // When getting close move with 360 degree
+       //dprint("movement ", vtos(this.movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
+       this.movement = this.movement + (keyboard - this.movement) * blend;
 }
 
-void havocbot_bunnyhop(vector dir)
-{SELFPARAM();
+void havocbot_bunnyhop(entity this, vector dir)
+{
        float bunnyhopdistance;
        vector deviation;
        float maxspeed;
        vector gco, gno;
 
        // Don't jump when attacking
-       if(self.aistatus & AI_STATUS_ATTACKING)
+       if(this.aistatus & AI_STATUS_ATTACKING)
                return;
 
-       if(IS_PLAYER(self.goalcurrent))
+       if(IS_PLAYER(this.goalcurrent))
                return;
 
        maxspeed = autocvar_sv_maxspeed;
 
-       if(self.aistatus & AI_STATUS_DANGER_AHEAD)
+       if(this.aistatus & AI_STATUS_DANGER_AHEAD)
        {
-               self.aistatus &= ~AI_STATUS_RUNNING;
-               PHYS_INPUT_BUTTON_JUMP(self) = false;
-               self.bot_canruntogoal = 0;
-               self.bot_timelastseengoal = 0;
+               this.aistatus &= ~AI_STATUS_RUNNING;
+               PHYS_INPUT_BUTTON_JUMP(this) = false;
+               this.bot_canruntogoal = 0;
+               this.bot_timelastseengoal = 0;
                return;
        }
 
-       if(self.waterlevel > WATERLEVEL_WETFEET)
+       if(this.waterlevel > WATERLEVEL_WETFEET)
        {
-               self.aistatus &= ~AI_STATUS_RUNNING;
+               this.aistatus &= ~AI_STATUS_RUNNING;
                return;
        }
 
-       if(self.bot_lastseengoal != self.goalcurrent && !(self.aistatus & AI_STATUS_RUNNING))
+       if(this.bot_lastseengoal != this.goalcurrent && !(this.aistatus & AI_STATUS_RUNNING))
        {
-               self.bot_canruntogoal = 0;
-               self.bot_timelastseengoal = 0;
+               this.bot_canruntogoal = 0;
+               this.bot_timelastseengoal = 0;
        }
 
-       gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
-       bunnyhopdistance = vlen(self.origin - gco);
+       gco = (this.goalcurrent.absmin + this.goalcurrent.absmax) * 0.5;
+       bunnyhopdistance = vlen(this.origin - gco);
 
        // Run only to visible goals
-       if(IS_ONGROUND(self))
-       if(self.speed==maxspeed)
-       if(checkpvs(self.origin + self.view_ofs, self.goalcurrent))
+       if(IS_ONGROUND(this))
+       if(this.speed==maxspeed)
+       if(checkpvs(this.origin + this.view_ofs, this.goalcurrent))
        {
-                       self.bot_lastseengoal = self.goalcurrent;
+                       this.bot_lastseengoal = this.goalcurrent;
 
                        // seen it before
-                       if(self.bot_timelastseengoal)
+                       if(this.bot_timelastseengoal)
                        {
                                // for a period of time
-                               if(time - self.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
+                               if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
                                {
                                        float checkdistance;
                                        checkdistance = true;
 
                                        // don't run if it is too close
-                                       if(self.bot_canruntogoal==0)
+                                       if(this.bot_canruntogoal==0)
                                        {
                                                if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_startdistance)
-                                                       self.bot_canruntogoal = 1;
+                                                       this.bot_canruntogoal = 1;
                                                else
-                                                       self.bot_canruntogoal = -1;
+                                                       this.bot_canruntogoal = -1;
                                        }
 
-                                       if(self.bot_canruntogoal != 1)
+                                       if(this.bot_canruntogoal != 1)
                                                return;
 
-                                       if(self.aistatus & AI_STATUS_ROAMING)
-                                       if(self.goalcurrent.classname=="waypoint")
-                                       if (!(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
-                                       if(fabs(gco.z - self.origin.z) < self.maxs.z - self.mins.z)
-                                       if(self.goalstack01!=world)
+                                       if(this.aistatus & AI_STATUS_ROAMING)
+                                       if(this.goalcurrent.classname=="waypoint")
+                                       if (!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
+                                       if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z)
+                                       if(this.goalstack01!=world)
                                        {
-                                               gno = (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5;
-                                               deviation = vectoangles(gno - self.origin) - vectoangles(gco - self.origin);
+                                               gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5;
+                                               deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin);
                                                while (deviation.y < -180) deviation.y = deviation.y + 360;
                                                while (deviation.y > 180) deviation.y = deviation.y - 360;
 
                                                if(fabs(deviation.y) < 20)
-                                               if(bunnyhopdistance < vlen(self.origin - gno))
-                                               if(fabs(gno.z - gco.z) < self.maxs.z - self.mins.z)
+                                               if(bunnyhopdistance < vlen(this.origin - gno))
+                                               if(fabs(gno.z - gco.z) < this.maxs.z - this.mins.z)
                                                {
-                                                       if(vlen(gco - gno) > autocvar_bot_ai_bunnyhop_startdistance)
-                                                       if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
+                                                       if(vdist(gco - gno, >, autocvar_bot_ai_bunnyhop_startdistance))
+                                                       if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
                                                        {
                                                                checkdistance = false;
                                                        }
@@ -347,58 +349,58 @@ void havocbot_bunnyhop(vector dir)
 
                                        if(checkdistance)
                                        {
-                                               self.aistatus &= ~AI_STATUS_RUNNING;
+                                               this.aistatus &= ~AI_STATUS_RUNNING;
                                                if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance)
-                                                       PHYS_INPUT_BUTTON_JUMP(self) = true;
+                                                       PHYS_INPUT_BUTTON_JUMP(this) = true;
                                        }
                                        else
                                        {
-                                               self.aistatus |= AI_STATUS_RUNNING;
-                                               PHYS_INPUT_BUTTON_JUMP(self) = true;
+                                               this.aistatus |= AI_STATUS_RUNNING;
+                                               PHYS_INPUT_BUTTON_JUMP(this) = true;
                                        }
                                }
                        }
                        else
                        {
-                               self.bot_timelastseengoal = time;
+                               this.bot_timelastseengoal = time;
                        }
        }
        else
        {
-               self.bot_timelastseengoal = 0;
+               this.bot_timelastseengoal = 0;
        }
 
 #if 0
        // Release jump button
        if(!cvar("sv_pogostick"))
-       if((IS_ONGROUND(self)) == 0)
+       if((IS_ONGROUND(this)) == 0)
        {
-               if(self.velocity.z < 0 || vlen(self.velocity)<maxspeed)
-                       PHYS_INPUT_BUTTON_JUMP(self) = false;
+               if(this.velocity.z < 0 || vlen(this.velocity)<maxspeed)
+                       PHYS_INPUT_BUTTON_JUMP(this) = false;
 
                // Strafe
-               if(self.aistatus & AI_STATUS_RUNNING)
-               if(vlen(self.velocity)>maxspeed)
+               if(this.aistatus & AI_STATUS_RUNNING)
+               if(vlen(this.velocity)>maxspeed)
                {
-                       deviation = vectoangles(dir) - vectoangles(self.velocity);
+                       deviation = vectoangles(dir) - vectoangles(this.velocity);
                        while (deviation.y < -180) deviation.y = deviation.y + 360;
                        while (deviation.y > 180) deviation.y = deviation.y - 360;
 
                        if(fabs(deviation.y)>10)
-                               self.movement_x = 0;
+                               this.movement_x = 0;
 
                        if(deviation.y>10)
-                               self.movement_y = maxspeed * -1;
+                               this.movement_y = maxspeed * -1;
                        else if(deviation.y<10)
-                               self.movement_y = maxspeed;
+                               this.movement_y = maxspeed;
 
                }
        }
 #endif
 }
 
-void havocbot_movetogoal()
-{SELFPARAM();
+void havocbot_movetogoal(entity this)
+{
        vector destorg;
        vector diff;
        vector dir;
@@ -412,87 +414,87 @@ void havocbot_movetogoal()
        vector gco;
        //float dist;
        vector dodge;
-       //if (self.goalentity)
-       //      te_lightning2(self, self.origin, (self.goalentity.absmin + self.goalentity.absmax) * 0.5);
-       self.movement = '0 0 0';
+       //if (this.goalentity)
+       //      te_lightning2(this, this.origin, (this.goalentity.absmin + this.goalentity.absmax) * 0.5);
+       this.movement = '0 0 0';
        maxspeed = autocvar_sv_maxspeed;
 
        // Jetpack navigation
-       if(self.goalcurrent)
-       if(self.navigation_jetpack_goal)
-       if(self.goalcurrent==self.navigation_jetpack_goal)
-       if(self.ammo_fuel)
+       if(this.goalcurrent)
+       if(this.navigation_jetpack_goal)
+       if(this.goalcurrent==this.navigation_jetpack_goal)
+       if(this.ammo_fuel)
        {
                if(autocvar_bot_debug_goalstack)
                {
-                       debuggoalstack();
-                       te_wizspike(self.navigation_jetpack_point);
+                       debuggoalstack(this);
+                       te_wizspike(this.navigation_jetpack_point);
                }
 
                // Take off
-               if (!(self.aistatus & AI_STATUS_JETPACK_FLYING))
+               if (!(this.aistatus & AI_STATUS_JETPACK_FLYING))
                {
                        // Brake almost completely so it can get a good direction
-                       if(vlen(self.velocity)>10)
+                       if(vdist(this.velocity, >, 10))
                                return;
-                       self.aistatus |= AI_STATUS_JETPACK_FLYING;
+                       this.aistatus |= AI_STATUS_JETPACK_FLYING;
                }
 
-               makevectors(self.v_angle.y * '0 1 0');
-               dir = normalize(self.navigation_jetpack_point - self.origin);
+               makevectors(this.v_angle.y * '0 1 0');
+               dir = normalize(this.navigation_jetpack_point - this.origin);
 
                // Landing
-               if(self.aistatus & AI_STATUS_JETPACK_LANDING)
+               if(this.aistatus & AI_STATUS_JETPACK_LANDING)
                {
                        // Calculate brake distance in xy
                        float db, v, d;
                        vector dxy;
 
-                       dxy = self.origin - ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ); dxy.z = 0;
+                       dxy = this.origin - ( ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5 ); dxy.z = 0;
                        d = vlen(dxy);
-                       v = vlen(self.velocity -  self.velocity.z * '0 0 1');
+                       v = vlen(this.velocity -  this.velocity.z * '0 0 1');
                        db = (pow(v,2) / (autocvar_g_jetpack_acceleration_side * 2)) + 100;
                //      dprint("distance ", ftos(ceil(d)), " velocity ", ftos(ceil(v)), " brake at ", ftos(ceil(db)), "\n");
                        if(d < db || d < 500)
                        {
                                // Brake
-                               if(fabs(self.velocity.x)>maxspeed*0.3)
+                               if(fabs(this.velocity.x)>maxspeed*0.3)
                                {
-                                       self.movement_x = dir * v_forward * -maxspeed;
+                                       this.movement_x = dir * v_forward * -maxspeed;
                                        return;
                                }
                                // Switch to normal mode
-                               self.navigation_jetpack_goal = world;
-                               self.aistatus &= ~AI_STATUS_JETPACK_LANDING;
-                               self.aistatus &= ~AI_STATUS_JETPACK_FLYING;
+                               this.navigation_jetpack_goal = world;
+                               this.aistatus &= ~AI_STATUS_JETPACK_LANDING;
+                               this.aistatus &= ~AI_STATUS_JETPACK_FLYING;
                                return;
                        }
                }
-               else if(checkpvs(self.origin,self.goalcurrent))
+               else if(checkpvs(this.origin,this.goalcurrent))
                {
                        // If I can see the goal switch to landing code
-                       self.aistatus &= ~AI_STATUS_JETPACK_FLYING;
-                       self.aistatus |= AI_STATUS_JETPACK_LANDING;
+                       this.aistatus &= ~AI_STATUS_JETPACK_FLYING;
+                       this.aistatus |= AI_STATUS_JETPACK_LANDING;
                        return;
                }
 
                // Flying
-               PHYS_INPUT_BUTTON_HOOK(self) = true;
-               if(self.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < self.origin.z)
+               PHYS_INPUT_BUTTON_HOOK(this) = true;
+               if(this.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < this.origin.z)
                {
-                       self.movement_x = dir * v_forward * maxspeed;
-                       self.movement_y = dir * v_right * maxspeed;
+                       this.movement_x = dir * v_forward * maxspeed;
+                       this.movement_y = dir * v_right * maxspeed;
                }
                return;
        }
 
        // Handling of jump pads
-       if(self.jumppadcount)
+       if(this.jumppadcount)
        {
                // If got stuck on the jump pad try to reach the farthest visible waypoint
-               if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
+               if(this.aistatus & AI_STATUS_OUT_JUMPPAD)
                {
-                       if(fabs(self.velocity.z)<50)
+                       if(fabs(this.velocity.z)<50)
                        {
                                entity head, newgoal = world;
                                float distance, bestdistance = 0;
@@ -500,11 +502,11 @@ void havocbot_movetogoal()
                                for (head = findchain(classname, "waypoint"); head; head = head.chain)
                                {
 
-                                       distance = vlen(head.origin - self.origin);
+                                       distance = vlen(head.origin - this.origin);
                                        if(distance>1000)
                                                continue;
 
-                                       traceline(self.origin + self.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), true, world);
+                                       traceline(this.origin + this.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), true, world);
 
                                        if(trace_fraction<1)
                                                continue;
@@ -518,11 +520,11 @@ void havocbot_movetogoal()
 
                                if(newgoal)
                                {
-                                       self.ignoregoal = self.goalcurrent;
-                                       self.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
-                                       navigation_clearroute();
-                                       navigation_routetogoal(newgoal, self.origin);
-                                       self.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
+                                       this.ignoregoal = this.goalcurrent;
+                                       this.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
+                                       navigation_clearroute(this);
+                                       navigation_routetogoal(this, newgoal, this.origin);
+                                       this.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
                                }
                        }
                        else
@@ -530,267 +532,266 @@ void havocbot_movetogoal()
                }
                else
                {
-                       if(self.velocity.z>0)
+                       if(this.velocity.z>0)
                        {
-                               float threshold, sxy;
-                               vector velxy = self.velocity; velxy_z = 0;
-                               sxy = vlen(velxy);
+                               float threshold;
+                               vector velxy = this.velocity; velxy_z = 0;
                                threshold = maxspeed * 0.2;
-                               if(sxy < threshold)
+                               if(vdist(velxy, <, threshold))
                                {
-                                       LOG_TRACE("Warning: ", self.netname, " got stuck on a jumppad (velocity in xy is ", ftos(sxy), "), trying to get out of it now\n");
-                                       self.aistatus |= AI_STATUS_OUT_JUMPPAD;
+                                       LOG_TRACE("Warning: ", this.netname, " got stuck on a jumppad (velocity in xy is ", vtos(velxy), "), trying to get out of it now\n");
+                                       this.aistatus |= AI_STATUS_OUT_JUMPPAD;
                                }
                                return;
                        }
 
                        // Don't chase players while using a jump pad
-                       if(IS_PLAYER(self.goalcurrent) || IS_PLAYER(self.goalstack01))
+                       if(IS_PLAYER(this.goalcurrent) || IS_PLAYER(this.goalstack01))
                                return;
                }
        }
-       else if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
-               self.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
+       else if(this.aistatus & AI_STATUS_OUT_JUMPPAD)
+               this.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
 
        // If there is a trigger_hurt right below try to use the jetpack or make a rocketjump
        if(skill>6)
-       if (!(IS_ONGROUND(self)))
+       if (!(IS_ONGROUND(this)))
        {
-               tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 -65536', MOVE_NOMONSTERS, self);
-               if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos ))
-               if(self.items & IT_JETPACK)
+               tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 -65536', MOVE_NOMONSTERS, this);
+               if(tracebox_hits_trigger_hurt(this.origin, this.mins, this.maxs, trace_endpos ))
+               if(this.items & IT_JETPACK)
                {
-                       tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 65536', MOVE_NOMONSTERS, self);
-                       if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos + '0 0 1' ))
+                       tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 65536', MOVE_NOMONSTERS, this);
+                       if(tracebox_hits_trigger_hurt(this.origin, this.mins, this.maxs, trace_endpos + '0 0 1' ))
                        {
-                               if(self.velocity.z<0)
+                               if(this.velocity.z<0)
                                {
-                                       PHYS_INPUT_BUTTON_HOOK(self) = true;
+                                       PHYS_INPUT_BUTTON_HOOK(this) = true;
                                }
                        }
                        else
-                               PHYS_INPUT_BUTTON_HOOK(self) = true;
+                               PHYS_INPUT_BUTTON_HOOK(this) = true;
 
                        // If there is no goal try to move forward
 
-                       if(self.goalcurrent==world)
+                       if(this.goalcurrent==world)
                                dir = v_forward;
                        else
-                               dir = normalize(( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - self.origin);
+                               dir = normalize(( ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5 ) - this.origin);
 
-                       vector xyvelocity = self.velocity; xyvelocity_z = 0;
+                       vector xyvelocity = this.velocity; xyvelocity_z = 0;
                        float xyspeed = xyvelocity * dir;
 
                        if(xyspeed < (maxspeed / 2))
                        {
-                               makevectors(self.v_angle.y * '0 1 0');
-                               tracebox(self.origin, self.mins, self.maxs, self.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, self);
+                               makevectors(this.v_angle.y * '0 1 0');
+                               tracebox(this.origin, this.mins, this.maxs, this.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, this);
                                if(trace_fraction==1)
                                {
-                                       self.movement_x = dir * v_forward * maxspeed;
-                                       self.movement_y = dir * v_right * maxspeed;
+                                       this.movement_x = dir * v_forward * maxspeed;
+                                       this.movement_y = dir * v_right * maxspeed;
                                        if (skill < 10)
-                                               havocbot_keyboard_movement(self.origin + dir * 100);
+                                               havocbot_keyboard_movement(this, this.origin + dir * 100);
                                }
                        }
 
-                       self.havocbot_blockhead = true;
+                       this.havocbot_blockhead = true;
 
                        return;
                }
-               else if(self.health>WEP_CVAR(devastator, damage)*0.5)
+               else if(this.health>WEP_CVAR(devastator, damage)*0.5)
                {
-                       if(self.velocity.z < 0)
-                       if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
+                       if(this.velocity.z < 0)
+                       if(client_hasweapon(this, WEP_DEVASTATOR, true, false))
                        {
-                               self.movement_x = maxspeed;
+                               this.movement_x = maxspeed;
 
-                               if(self.rocketjumptime)
+                               if(this.rocketjumptime)
                                {
-                                       if(time > self.rocketjumptime)
+                                       if(time > this.rocketjumptime)
                                        {
-                                               PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                               self.rocketjumptime = 0;
+                                               PHYS_INPUT_BUTTON_ATCK2(this) = true;
+                                               this.rocketjumptime = 0;
                                        }
                                        return;
                                }
 
-                               PS(self).m_switchweapon = WEP_DEVASTATOR;
-                               self.v_angle_x = 90;
-                               PHYS_INPUT_BUTTON_ATCK(self) = true;
-                               self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
+                               PS(this).m_switchweapon = WEP_DEVASTATOR;
+                               this.v_angle_x = 90;
+                               PHYS_INPUT_BUTTON_ATCK(this) = true;
+                               this.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
                                return;
                        }
                }
                else
                {
                        // If there is no goal try to move forward
-                       if(self.goalcurrent==world)
-                               self.movement_x = maxspeed;
+                       if(this.goalcurrent==world)
+                               this.movement_x = maxspeed;
                }
        }
 
        // If we are under water with no goals, swim up
-       if(self.waterlevel)
-       if(self.goalcurrent==world)
+       if(this.waterlevel)
+       if(this.goalcurrent==world)
        {
                dir = '0 0 0';
-               if(self.waterlevel>WATERLEVEL_SWIMMING)
+               if(this.waterlevel>WATERLEVEL_SWIMMING)
                        dir.z = 1;
-               else if(self.velocity.z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER))
-                       PHYS_INPUT_BUTTON_JUMP(self) = true;
+               else if(this.velocity.z >= 0 && !(this.waterlevel == WATERLEVEL_WETFEET && this.watertype == CONTENT_WATER))
+                       PHYS_INPUT_BUTTON_JUMP(this) = true;
                else
-                       PHYS_INPUT_BUTTON_JUMP(self) = false;
-               makevectors(self.v_angle.y * '0 1 0');
-               self.movement_x = dir * v_forward * maxspeed;
-               self.movement_y = dir * v_right * maxspeed;
-               self.movement_z = dir * v_up * maxspeed;
+                       PHYS_INPUT_BUTTON_JUMP(this) = false;
+               makevectors(this.v_angle.y * '0 1 0');
+               this.movement_x = dir * v_forward * maxspeed;
+               this.movement_y = dir * v_right * maxspeed;
+               this.movement_z = dir * v_up * maxspeed;
        }
 
        // if there is nowhere to go, exit
-       if (self.goalcurrent == world)
+       if (this.goalcurrent == world)
                return;
 
-       if (self.goalcurrent)
-               navigation_poptouchedgoals();
+       if (this.goalcurrent)
+               navigation_poptouchedgoals(this);
 
        // if ran out of goals try to use an alternative goal or get a new strategy asap
-       if(self.goalcurrent == world)
+       if(this.goalcurrent == world)
        {
-               self.bot_strategytime = 0;
+               this.bot_strategytime = 0;
                return;
        }
 
 
        if(autocvar_bot_debug_goalstack)
-               debuggoalstack();
+               debuggoalstack(this);
 
-       m1 = self.goalcurrent.origin + self.goalcurrent.mins;
-       m2 = self.goalcurrent.origin + self.goalcurrent.maxs;
-       destorg = self.origin;
+       m1 = this.goalcurrent.origin + this.goalcurrent.mins;
+       m2 = this.goalcurrent.origin + this.goalcurrent.maxs;
+       destorg = this.origin;
        destorg.x = bound(m1_x, destorg.x, m2_x);
        destorg.y = bound(m1_y, destorg.y, m2_y);
        destorg.z = bound(m1_z, destorg.z, m2_z);
-       diff = destorg - self.origin;
+       diff = destorg - this.origin;
        //dist = vlen(diff);
        dir = normalize(diff);
        flatdir = diff;flatdir.z = 0;
        flatdir = normalize(flatdir);
-       gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
+       gco = (this.goalcurrent.absmin + this.goalcurrent.absmax) * 0.5;
 
-       //if (self.bot_dodgevector_time < time)
+       //if (this.bot_dodgevector_time < time)
        {
-       //      self.bot_dodgevector_time = time + cvar("bot_ai_dodgeupdateinterval");
-       //      self.bot_dodgevector_jumpbutton = 1;
+       //      this.bot_dodgevector_time = time + cvar("bot_ai_dodgeupdateinterval");
+       //      this.bot_dodgevector_jumpbutton = 1;
                evadeobstacle = '0 0 0';
                evadelava = '0 0 0';
 
-               if (self.waterlevel)
+               if (this.waterlevel)
                {
-                       if(self.waterlevel>WATERLEVEL_SWIMMING)
+                       if(this.waterlevel>WATERLEVEL_SWIMMING)
                        {
                        //      flatdir_z = 1;
-                               self.aistatus |= AI_STATUS_OUT_WATER;
+                               this.aistatus |= AI_STATUS_OUT_WATER;
                        }
                        else
                        {
-                               if(self.velocity.z >= 0 && !(self.watertype == CONTENT_WATER && gco.z < self.origin.z) &&
-                                       ( !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER) || self.aistatus & AI_STATUS_OUT_WATER))
-                                       PHYS_INPUT_BUTTON_JUMP(self) = true;
+                               if(this.velocity.z >= 0 && !(this.watertype == CONTENT_WATER && gco.z < this.origin.z) &&
+                                       ( !(this.waterlevel == WATERLEVEL_WETFEET && this.watertype == CONTENT_WATER) || this.aistatus & AI_STATUS_OUT_WATER))
+                                       PHYS_INPUT_BUTTON_JUMP(this) = true;
                                else
-                                       PHYS_INPUT_BUTTON_JUMP(self) = false;
+                                       PHYS_INPUT_BUTTON_JUMP(this) = false;
                        }
                        dir = normalize(flatdir);
-                       makevectors(self.v_angle.y * '0 1 0');
+                       makevectors(this.v_angle.y * '0 1 0');
                }
                else
                {
-                       if(self.aistatus & AI_STATUS_OUT_WATER)
-                               self.aistatus &= ~AI_STATUS_OUT_WATER;
+                       if(this.aistatus & AI_STATUS_OUT_WATER)
+                               this.aistatus &= ~AI_STATUS_OUT_WATER;
 
                        // jump if going toward an obstacle that doesn't look like stairs we
                        // can walk up directly
-                       tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.2, false, self);
+                       tracebox(this.origin, this.mins, this.maxs, this.origin + this.velocity * 0.2, false, this);
                        if (trace_fraction < 1)
                        if (trace_plane_normal.z < 0.7)
                        {
                                s = trace_fraction;
-                               tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, false, self);
+                               tracebox(this.origin + stepheightvec, this.mins, this.maxs, this.origin + this.velocity * 0.2 + stepheightvec, false, this);
                                if (trace_fraction < s + 0.01)
                                if (trace_plane_normal.z < 0.7)
                                {
                                        s = trace_fraction;
-                                       tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, false, self);
+                                       tracebox(this.origin + jumpstepheightvec, this.mins, this.maxs, this.origin + this.velocity * 0.2 + jumpstepheightvec, false, this);
                                        if (trace_fraction > s)
-                                               PHYS_INPUT_BUTTON_JUMP(self) = true;
+                                               PHYS_INPUT_BUTTON_JUMP(this) = true;
                                }
                        }
 
                        // avoiding dangers and obstacles
                        vector dst_ahead, dst_down;
-                       makevectors(self.v_angle.y * '0 1 0');
-                       dst_ahead = self.origin + self.view_ofs + (self.velocity * 0.4) + (v_forward * 32 * 3);
+                       makevectors(this.v_angle.y * '0 1 0');
+                       dst_ahead = this.origin + this.view_ofs + (this.velocity * 0.4) + (v_forward * 32 * 3);
                        dst_down = dst_ahead - '0 0 1500';
 
                        // Look ahead
-                       traceline(self.origin + self.view_ofs, dst_ahead, true, world);
+                       traceline(this.origin + this.view_ofs, dst_ahead, true, world);
 
                        // Check head-banging against walls
-                       if(vlen(self.origin + self.view_ofs - trace_endpos) < 25 && !(self.aistatus & AI_STATUS_OUT_WATER))
+                       if(vlen(this.origin + this.view_ofs - trace_endpos) < 25 && !(this.aistatus & AI_STATUS_OUT_WATER))
                        {
-                               PHYS_INPUT_BUTTON_JUMP(self) = true;
-                               if(self.facingwalltime && time > self.facingwalltime)
+                               PHYS_INPUT_BUTTON_JUMP(this) = true;
+                               if(this.facingwalltime && time > this.facingwalltime)
                                {
-                                       self.ignoregoal = self.goalcurrent;
-                                       self.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
-                                       self.bot_strategytime = 0;
+                                       this.ignoregoal = this.goalcurrent;
+                                       this.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
+                                       this.bot_strategytime = 0;
                                        return;
                                }
                                else
                                {
-                                       self.facingwalltime = time + 0.05;
+                                       this.facingwalltime = time + 0.05;
                                }
                        }
                        else
                        {
-                               self.facingwalltime = 0;
+                               this.facingwalltime = 0;
 
-                               if(self.ignoregoal != world && time > self.ignoregoaltime)
+                               if(this.ignoregoal != world && time > this.ignoregoaltime)
                                {
-                                       self.ignoregoal = world;
-                                       self.ignoregoaltime = 0;
+                                       this.ignoregoal = world;
+                                       this.ignoregoaltime = 0;
                                }
                        }
 
                        // Check for water/slime/lava and dangerous edges
                        // (only when the bot is on the ground or jumping intentionally)
-                       self.aistatus &= ~AI_STATUS_DANGER_AHEAD;
+                       this.aistatus &= ~AI_STATUS_DANGER_AHEAD;
 
-                       if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
-                       if((IS_ONGROUND(self)) || (self.aistatus & AI_STATUS_RUNNING) || PHYS_INPUT_BUTTON_JUMP(self))
+                       if(trace_fraction == 1 && this.jumppadcount == 0 && !this.goalcurrent.wphardwired )
+                       if((IS_ONGROUND(this)) || (this.aistatus & AI_STATUS_RUNNING) || PHYS_INPUT_BUTTON_JUMP(this))
                        {
                                // Look downwards
                                traceline(dst_ahead , dst_down, true, world);
-                       //      te_lightning2(world, self.origin, dst_ahead);   // Draw "ahead" look
+                       //      te_lightning2(world, this.origin, dst_ahead);   // Draw "ahead" look
                        //      te_lightning2(world, dst_ahead, dst_down);              // Draw "downwards" look
-                               if(trace_endpos.z < self.origin.z + self.mins.z)
+                               if(trace_endpos.z < this.origin.z + this.mins.z)
                                {
                                        s = pointcontents(trace_endpos + '0 0 1');
                                        if (s != CONTENT_SOLID)
                                        if (s == CONTENT_LAVA || s == CONTENT_SLIME)
-                                               evadelava = normalize(self.velocity) * -1;
+                                               evadelava = normalize(this.velocity) * -1;
                                        else if (s == CONTENT_SKY)
-                                               evadeobstacle = normalize(self.velocity) * -1;
-                                       else if (!boxesoverlap(dst_ahead - self.view_ofs + self.mins, dst_ahead - self.view_ofs + self.maxs,
-                                                               self.goalcurrent.absmin, self.goalcurrent.absmax))
+                                               evadeobstacle = normalize(this.velocity) * -1;
+                                       else if (!boxesoverlap(dst_ahead - this.view_ofs + this.mins, dst_ahead - this.view_ofs + this.maxs,
+                                                               this.goalcurrent.absmin, this.goalcurrent.absmax))
                                        {
                                                // if ain't a safe goal with "holes" (like the jumpad on soylent)
                                                // and there is a trigger_hurt below
-                                               if(tracebox_hits_trigger_hurt(dst_ahead, self.mins, self.maxs, trace_endpos))
+                                               if(tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos))
                                                {
                                                        // Remove dangerous dynamic goals from stack
-                                                       LOG_TRACE("bot ", self.netname, " avoided the goal ", self.goalcurrent.classname, " ", etos(self.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
-                                                       navigation_clearroute();
+                                                       LOG_TRACE("bot ", this.netname, " avoided the goal ", this.goalcurrent.classname, " ", etos(this.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
+                                                       navigation_clearroute(this);
                                                        return;
                                                }
                                        }
@@ -800,114 +801,114 @@ void havocbot_movetogoal()
                        dir = flatdir;
                        evadeobstacle.z = 0;
                        evadelava.z = 0;
-                       makevectors(self.v_angle.y * '0 1 0');
+                       makevectors(this.v_angle.y * '0 1 0');
 
                        if(evadeobstacle!='0 0 0'||evadelava!='0 0 0')
-                               self.aistatus |= AI_STATUS_DANGER_AHEAD;
+                               this.aistatus |= AI_STATUS_DANGER_AHEAD;
                }
 
                dodge = havocbot_dodge();
-               dodge = dodge * bound(0,0.5+(skill+self.bot_dodgeskill)*0.1,1);
-               evadelava = evadelava * bound(1,3-(skill+self.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
-               traceline(self.origin, ( ( self.enemy.absmin + self.enemy.absmax ) * 0.5 ), true, world);
+               dodge = dodge * bound(0,0.5+(skill+this.bot_dodgeskill)*0.1,1);
+               evadelava = evadelava * bound(1,3-(skill+this.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
+               traceline(this.origin, ( ( this.enemy.absmin + this.enemy.absmax ) * 0.5 ), true, world);
                if(IS_PLAYER(trace_ent))
-                       dir = dir * bound(0,(skill+self.bot_dodgeskill)/7,1);
+                       dir = dir * bound(0,(skill+this.bot_dodgeskill)/7,1);
 
                dir = normalize(dir + dodge + evadeobstacle + evadelava);
-       //      self.bot_dodgevector = dir;
-       //      self.bot_dodgevector_jumpbutton = PHYS_INPUT_BUTTON_JUMP(self);
+       //      this.bot_dodgevector = dir;
+       //      this.bot_dodgevector_jumpbutton = PHYS_INPUT_BUTTON_JUMP(this);
        }
 
-       if(time < self.ladder_time)
+       if(time < this.ladder_time)
        {
-               if(self.goalcurrent.origin.z + self.goalcurrent.mins.z > self.origin.z + self.mins.z)
+               if(this.goalcurrent.origin.z + this.goalcurrent.mins.z > this.origin.z + this.mins.z)
                {
-                       if(self.origin.z + self.mins.z  < self.ladder_entity.origin.z + self.ladder_entity.maxs.z)
+                       if(this.origin.z + this.mins.z  < this.ladder_entity.origin.z + this.ladder_entity.maxs.z)
                                dir.z = 1;
                }
                else
                {
-                       if(self.origin.z + self.mins.z  > self.ladder_entity.origin.z + self.ladder_entity.mins.z)
+                       if(this.origin.z + this.mins.z  > this.ladder_entity.origin.z + this.ladder_entity.mins.z)
                                dir.z = -1;
                }
        }
 
-       //dir = self.bot_dodgevector;
-       //if (self.bot_dodgevector_jumpbutton)
-       //      PHYS_INPUT_BUTTON_JUMP(self) = true;
-       self.movement_x = dir * v_forward * maxspeed;
-       self.movement_y = dir * v_right * maxspeed;
-       self.movement_z = dir * v_up * maxspeed;
+       //dir = this.bot_dodgevector;
+       //if (this.bot_dodgevector_jumpbutton)
+       //      PHYS_INPUT_BUTTON_JUMP(this) = true;
+       this.movement_x = dir * v_forward * maxspeed;
+       this.movement_y = dir * v_right * maxspeed;
+       this.movement_z = dir * v_up * maxspeed;
 
        // Emulate keyboard interface
        if (skill < 10)
-               havocbot_keyboard_movement(destorg);
+               havocbot_keyboard_movement(this, destorg);
 
        // Bunnyhop!
-//     if(self.aistatus & AI_STATUS_ROAMING)
-       if(self.goalcurrent)
-       if(skill+self.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
-               havocbot_bunnyhop(dir);
-
-       if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(self))) PHYS_INPUT_BUTTON_JUMP(self) = true;
-       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) PHYS_INPUT_BUTTON_JUMP(self) = true;
-       if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.havocbot_ducktime=time+0.3/bound(0.1,skill+self.bot_dodgeskill,10);
+//     if(this.aistatus & AI_STATUS_ROAMING)
+       if(this.goalcurrent)
+       if(skill+this.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
+               havocbot_bunnyhop(this, dir);
+
+       if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(this))) PHYS_INPUT_BUTTON_JUMP(this) = true;
+       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-this.bot_dodgeskill)*0.1,1)) PHYS_INPUT_BUTTON_JUMP(this) = true;
+       if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-this.bot_dodgeskill)*0.1,1)) this.havocbot_ducktime=time+0.3/bound(0.1,skill+this.bot_dodgeskill,10);
 }
 
-void havocbot_chooseenemy()
-{SELFPARAM();
+void havocbot_chooseenemy(entity this)
+{
        entity head, best, head2;
        float rating, bestrating, hf;
        vector eye, v;
-       if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
+       if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
        {
-               self.enemy = world;
+               this.enemy = world;
                return;
        }
-       if (self.enemy)
+       if (this.enemy)
        {
-               if (!bot_shouldattack(self.enemy))
+               if (!bot_shouldattack(this, this.enemy))
                {
                        // enemy died or something, find a new target
-                       self.enemy = world;
-                       self.havocbot_chooseenemy_finished = time;
+                       this.enemy = world;
+                       this.havocbot_chooseenemy_finished = time;
                }
-               else if (self.havocbot_stickenemy)
+               else if (this.havocbot_stickenemy)
                {
                        // tracking last chosen enemy
                        // if enemy is visible
                        // and not really really far away
                        // and we're not severely injured
                        // then keep tracking for a half second into the future
-                       traceline(self.origin+self.view_ofs, ( self.enemy.absmin + self.enemy.absmax ) * 0.5,false,world);
-                       if (trace_ent == self.enemy || trace_fraction == 1)
-                       if (vlen((( self.enemy.absmin + self.enemy.absmax ) * 0.5) - self.origin) < 1000)
-                       if (self.health > 30)
+                       traceline(this.origin+this.view_ofs, ( this.enemy.absmin + this.enemy.absmax ) * 0.5,false,world);
+                       if (trace_ent == this.enemy || trace_fraction == 1)
+                       if (vdist(((this.enemy.absmin + this.enemy.absmax) * 0.5) - this.origin, <, 1000))
+                       if (this.health > 30)
                        {
                                // remain tracking him for a shot while (case he went after a small corner or pilar
-                               self.havocbot_chooseenemy_finished = time + 0.5;
+                               this.havocbot_chooseenemy_finished = time + 0.5;
                                return;
                        }
                        // enemy isn't visible, or is far away, or we're injured severely
                        // so stop preferring this enemy
                        // (it will still take a half second until a new one is chosen)
-                       self.havocbot_stickenemy = 0;
+                       this.havocbot_stickenemy = 0;
                }
        }
-       if (time < self.havocbot_chooseenemy_finished)
+       if (time < this.havocbot_chooseenemy_finished)
                return;
-       self.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
-       eye = self.origin + self.view_ofs;
+       this.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
+       eye = this.origin + this.view_ofs;
        best = world;
        bestrating = 100000000;
        head = head2 = findchainfloat(bot_attack, true);
 
        // Backup hit flags
-       hf = self.dphitcontentsmask;
+       hf = this.dphitcontentsmask;
 
        // Search for enemies, if no enemy can be seen directly try to look through transparent objects
 
-       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+       this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 
        bool scan_transparent = false;
        bool scan_secondary_targets = false;
@@ -915,7 +916,7 @@ void havocbot_chooseenemy()
        while(true)
        {
                scan_secondary_targets = false;
-               :scan_targets
+LABEL(scan_targets)
                for( ; head; head = head.chain)
                {
                        if(!scan_secondary_targets)
@@ -936,9 +937,9 @@ void havocbot_chooseenemy()
                        rating = vlen(v - eye);
                        if (rating<autocvar_bot_ai_enemydetectionradius)
                        if (bestrating > rating)
-                       if (bot_shouldattack(head))
+                       if (bot_shouldattack(this, head))
                        {
-                               traceline(eye, v, true, self);
+                               traceline(eye, v, true, this);
                                if (trace_ent == head || trace_fraction >= 1)
                                {
                                        best = head;
@@ -958,29 +959,29 @@ void havocbot_chooseenemy()
 
                // I want to do a second scan if no enemy was found or I don't have weapons
                // TODO: Perform the scan when using the rifle (requires changes on the rifle code)
-               if(best || self.weapons) // || self.weapon == WEP_RIFLE.m_id
+               if(best || this.weapons) // || this.weapon == WEP_RIFLE.m_id
                        break;
                if(scan_transparent)
                        break;
 
                // Set flags to see through transparent objects
-               self.dphitcontentsmask |= DPCONTENTS_OPAQUE;
+               this.dphitcontentsmask |= DPCONTENTS_OPAQUE;
 
                head = head2;
                scan_transparent = true;
        }
 
        // Restore hit flags
-       self.dphitcontentsmask = hf;
+       this.dphitcontentsmask = hf;
 
-       self.enemy = best;
-       self.havocbot_stickenemy = true;
+       this.enemy = best;
+       this.havocbot_stickenemy = true;
        if(best && best.classname == "misc_breakablemodel")
-               self.havocbot_stickenemy = false;
+               this.havocbot_stickenemy = false;
 }
 
-float havocbot_chooseweapon_checkreload(int new_weapon)
-{SELFPARAM();
+float havocbot_chooseweapon_checkreload(entity this, int new_weapon)
+{
        // bots under this skill cannot find unloaded weapons to reload idly when not in combat,
        // so skip this for them, or they'll never get to reload their weapons at all.
        // this also allows bots under this skill to be more stupid, and reload more often during combat :)
@@ -988,7 +989,7 @@ float havocbot_chooseweapon_checkreload(int new_weapon)
                return false;
 
        // if this weapon is scheduled for reloading, don't switch to it during combat
-       if (self.weapon_load[new_weapon] < 0)
+       if (this.weapon_load[new_weapon] < 0)
        {
                bool other_weapon_available = false;
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
@@ -1002,26 +1003,26 @@ float havocbot_chooseweapon_checkreload(int new_weapon)
        return false;
 }
 
-void havocbot_chooseweapon()
-{SELFPARAM();
+void havocbot_chooseweapon(entity this)
+{
        int i;
 
        // ;)
        if(g_weaponarena_weapons == WEPSET(TUBA))
        {
-               PS(self).m_switchweapon = WEP_TUBA;
+               PS(this).m_switchweapon = WEP_TUBA;
                return;
        }
 
        // TODO: clean this up by moving it to weapon code
-       if(self.enemy==world)
+       if(this.enemy==world)
        {
                // If no weapon was chosen get the first available weapon
-               if(PS(self).m_weapon==WEP_Null)
+               if(PS(this).m_weapon==WEP_Null)
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       if(client_hasweapon(self, it, true, false))
+                       if(client_hasweapon(this, it, true, false))
                        {
-                               PS(self).m_switchweapon = it;
+                               PS(this).m_switchweapon = it;
                                return;
                        }
                ));
@@ -1029,34 +1030,34 @@ void havocbot_chooseweapon()
        }
 
        // Do not change weapon during the next second after a combo
-       float f = time - self.lastcombotime;
+       float f = time - this.lastcombotime;
        if(f < 1)
                return;
 
        float w;
-       float distance; distance=bound(10,vlen(self.origin-self.enemy.origin)-200,10000);
+       float distance; distance=bound(10,vlen(this.origin-this.enemy.origin)-200,10000);
 
        // Should it do a weapon combo?
        float af, ct, combo_time, combo;
 
-       af = ATTACK_FINISHED(self, 0);
+       af = ATTACK_FINISHED(this, 0);
        ct = autocvar_bot_ai_weapon_combo_threshold;
 
        // Bots with no skill will be 4 times more slower than "godlike" bots when doing weapon combos
        // Ideally this 4 should be calculated as longest_weapon_refire / bot_ai_weapon_combo_threshold
-       combo_time = time + ct + (ct * ((-0.3*(skill+self.bot_weaponskill))+3));
+       combo_time = time + ct + (ct * ((-0.3*(skill+this.bot_weaponskill))+3));
 
        combo = false;
 
        if(autocvar_bot_ai_weapon_combo)
-       if(PS(self).m_weapon.m_id == self.lastfiredweapon)
+       if(PS(this).m_weapon.m_id == this.lastfiredweapon)
        if(af > combo_time)
        {
                combo = true;
-               self.lastcombotime = time;
+               this.lastcombotime = time;
        }
 
-       distance *= pow(2, self.bot_rangepreference);
+       distance *= pow(2, this.bot_rangepreference);
 
        // Custom weapon list based on distance to the enemy
        if(bot_custom_weapon){
@@ -1065,11 +1066,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, Weapons_from(w), true, false) )
+                               if ( client_hasweapon(this, Weapons_from(w), true, false) )
                                {
-                                       if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
+                                       if ((PS(this).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, w))
                                                continue;
-                                       PS(self).m_switchweapon = Weapons_from(w);
+                                       PS(this).m_switchweapon = Weapons_from(w);
                                        return;
                                }
                        }
@@ -1079,11 +1080,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, Weapons_from(w), true, false) )
+                               if ( client_hasweapon(this, Weapons_from(w), true, false) )
                                {
-                                       if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
+                                       if ((PS(this).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, w))
                                                continue;
-                                       PS(self).m_switchweapon = Weapons_from(w);
+                                       PS(this).m_switchweapon = Weapons_from(w);
                                        return;
                                }
                        }
@@ -1092,107 +1093,107 @@ 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, Weapons_from(w), true, false) )
+                       if ( client_hasweapon(this, Weapons_from(w), true, false) )
                        {
-                               if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
+                               if ((PS(this).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, w))
                                        continue;
-                               PS(self).m_switchweapon = Weapons_from(w);
+                               PS(this).m_switchweapon = Weapons_from(w);
                                return;
                        }
                }
        }
 }
 
-void havocbot_aim()
-{SELFPARAM();
+void havocbot_aim(entity this)
+{
        vector selfvel, enemyvel;
-//     if(self.flags & FL_INWATER)
+//     if(this.flags & FL_INWATER)
 //             return;
-       if (time < self.nextaim)
+       if (time < this.nextaim)
                return;
-       self.nextaim = time + 0.1;
-       selfvel = self.velocity;
-       if (!self.waterlevel)
+       this.nextaim = time + 0.1;
+       selfvel = this.velocity;
+       if (!this.waterlevel)
                selfvel.z = 0;
-       if (self.enemy)
+       if (this.enemy)
        {
-               enemyvel = self.enemy.velocity;
-               if (!self.enemy.waterlevel)
+               enemyvel = this.enemy.velocity;
+               if (!this.enemy.waterlevel)
                        enemyvel.z = 0;
-               lag_additem(time + self.ping, 0, 0, self.enemy, self.origin, selfvel, (self.enemy.absmin + self.enemy.absmax) * 0.5, enemyvel);
+               lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, selfvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel);
        }
        else
-               lag_additem(time + self.ping, 0, 0, world, self.origin, selfvel, ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5, '0 0 0');
+               lag_additem(this, time + this.ping, 0, 0, world, this.origin, selfvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0');
 }
 
-float havocbot_moveto_refresh_route()
-{SELFPARAM();
+bool havocbot_moveto_refresh_route(entity this)
+{
        // Refresh path to goal if necessary
        entity wp;
-       wp = self.havocbot_personal_waypoint;
-       navigation_goalrating_start();
-       navigation_routerating(wp, 10000, 10000);
-       navigation_goalrating_end();
-       return self.navigation_hasgoals;
+       wp = this.havocbot_personal_waypoint;
+       navigation_goalrating_start(this);
+       navigation_routerating(this, wp, 10000, 10000);
+       navigation_goalrating_end(this);
+       return this.navigation_hasgoals;
 }
 
-float havocbot_moveto(vector pos)
-{SELFPARAM();
+float havocbot_moveto(entity this, vector pos)
+{
        entity wp;
 
-       if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+       if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
        {
                // Step 4: Move to waypoint
-               if(self.havocbot_personal_waypoint==world)
+               if(this.havocbot_personal_waypoint==world)
                {
-                       LOG_TRACE("Error: ", self.netname, " trying to walk to a non existent personal waypoint\n");
-                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                       LOG_TRACE("Error: ", this.netname, " trying to walk to a non existent personal waypoint\n");
+                       this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
                        return CMD_STATUS_ERROR;
                }
 
                if (!bot_strategytoken_taken)
-               if(self.havocbot_personal_waypoint_searchtime<time)
+               if(this.havocbot_personal_waypoint_searchtime<time)
                {
                        bot_strategytoken_taken = true;
-                       if(havocbot_moveto_refresh_route())
+                       if(havocbot_moveto_refresh_route(this))
                        {
-                               LOG_TRACE(self.netname, " walking to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
-                               self.havocbot_personal_waypoint_searchtime = time + 10;
-                               self.havocbot_personal_waypoint_failcounter = 0;
+                               LOG_TRACE(this.netname, " walking to its personal waypoint (after ", ftos(this.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
+                               this.havocbot_personal_waypoint_searchtime = time + 10;
+                               this.havocbot_personal_waypoint_failcounter = 0;
                        }
                        else
                        {
-                               self.havocbot_personal_waypoint_failcounter += 1;
-                               self.havocbot_personal_waypoint_searchtime = time + 2;
-                               if(self.havocbot_personal_waypoint_failcounter >= 30)
+                               this.havocbot_personal_waypoint_failcounter += 1;
+                               this.havocbot_personal_waypoint_searchtime = time + 2;
+                               if(this.havocbot_personal_waypoint_failcounter >= 30)
                                {
-                                       LOG_TRACE("Warning: can't walk to the personal waypoint located at ", vtos(self.havocbot_personal_waypoint.origin),"\n");
-                                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
-                                       remove(self.havocbot_personal_waypoint);
+                                       LOG_TRACE("Warning: can't walk to the personal waypoint located at ", vtos(this.havocbot_personal_waypoint.origin),"\n");
+                                       this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
+                                       remove(this.havocbot_personal_waypoint);
                                        return CMD_STATUS_ERROR;
                                }
                                else
-                                       LOG_TRACE(self.netname, " can't walk to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts), trying later\n");
+                                       LOG_TRACE(this.netname, " can't walk to its personal waypoint (after ", ftos(this.havocbot_personal_waypoint_failcounter), " failed attempts), trying later\n");
                        }
                }
 
                if(autocvar_bot_debug_goalstack)
-                       debuggoalstack();
+                       debuggoalstack(this);
 
                // Heading
-               vector dir = ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - (self.origin + self.view_ofs);
+               vector dir = ( ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5 ) - (this.origin + this.view_ofs);
                dir.z = 0;
-               bot_aimdir(dir, -1);
+               bot_aimdir(this, dir, -1);
 
                // Go!
-               havocbot_movetogoal();
+               havocbot_movetogoal(this);
 
-               if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_REACHED)
+               if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_REACHED)
                {
                        // Step 5: Waypoint reached
-                       LOG_TRACE(self.netname, "'s personal waypoint reached\n");
-                       remove(self.havocbot_personal_waypoint);
-                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+                       LOG_TRACE(this.netname, "'s personal waypoint reached\n");
+                       remove(this.havocbot_personal_waypoint);
+                       this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                        return CMD_STATUS_FINISHED;
                }
 
@@ -1200,36 +1201,36 @@ float havocbot_moveto(vector pos)
        }
 
        // Step 2: Linking waypoint
-       if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_LINKING)
+       if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_LINKING)
        {
                // Wait until it is linked
-               if(!self.havocbot_personal_waypoint.wplinked)
+               if(!this.havocbot_personal_waypoint.wplinked)
                {
-                       LOG_TRACE(self.netname, " waiting for personal waypoint to be linked\n");
+                       LOG_TRACE(this.netname, " waiting for personal waypoint to be linked\n");
                        return CMD_STATUS_EXECUTING;
                }
 
-               self.havocbot_personal_waypoint_searchtime = time; // so we set the route next frame
-               self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
-               self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_GOING;
+               this.havocbot_personal_waypoint_searchtime = time; // so we set the route next frame
+               this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
+               this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_GOING;
 
                // Step 3: Route to waypoint
-               LOG_TRACE(self.netname, " walking to its personal waypoint\n");
+               LOG_TRACE(this.netname, " walking to its personal waypoint\n");
 
                return CMD_STATUS_EXECUTING;
        }
 
        // Step 1: Spawning waypoint
-       wp = waypoint_spawnpersonal(pos);
+       wp = waypoint_spawnpersonal(this, pos);
        if(wp==world)
        {
                LOG_TRACE("Error: Can't spawn personal waypoint at ",vtos(pos),"\n");
                return CMD_STATUS_ERROR;
        }
 
-       self.havocbot_personal_waypoint = wp;
-       self.havocbot_personal_waypoint_failcounter = 0;
-       self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_LINKING;
+       this.havocbot_personal_waypoint = wp;
+       this.havocbot_personal_waypoint_failcounter = 0;
+       this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_LINKING;
 
        // if pos is inside a teleport, then let's mark it as teleport waypoint
        entity head;
@@ -1238,7 +1239,7 @@ float havocbot_moveto(vector pos)
                if(WarpZoneLib_BoxTouchesBrush(pos, pos, head, world))
                {
                        wp.wpflags |= WAYPOINTFLAG_TELEPORT;
-                       self.lastteleporttime = 0;
+                       this.lastteleporttime = 0;
                }
        }
 
@@ -1252,23 +1253,23 @@ float havocbot_moveto(vector pos)
        return CMD_STATUS_EXECUTING;
 }
 
-float havocbot_resetgoal()
+float havocbot_resetgoal(entity this)
 {
-       navigation_clearroute();
+       navigation_clearroute(this);
        return CMD_STATUS_FINISHED;
 }
 
-void havocbot_setupbot()
-{SELFPARAM();
-       self.bot_ai = havocbot_ai;
-       self.cmd_moveto = havocbot_moveto;
-       self.cmd_resetgoal = havocbot_resetgoal;
+void havocbot_setupbot(entity this)
+{
+       this.bot_ai = havocbot_ai;
+       this.cmd_moveto = havocbot_moveto;
+       this.cmd_resetgoal = havocbot_resetgoal;
 
-       havocbot_chooserole();
+       havocbot_chooserole(this);
 }
 
 vector havocbot_dodge()
-{SELFPARAM();
+{
        // LordHavoc: disabled because this is too expensive
        return '0 0 0';
 #if 0
index 2d3d3291320201437aa034ee666420ce0807fe0d..36b4c33fd9b5a3bdcfdf5645c97afda9c915821d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef HAVOCBOT_H
-#define HAVOCBOT_H
+#pragma once
 
 /*
  * Globals and Fields
  * Functions
  */
 
-void havocbot_ai();
-void havocbot_aim();
-void havocbot_setupbot();
-void havocbot_movetogoal();
-void havocbot_chooserole();
-void havocbot_chooseenemy();
-void havocbot_chooseweapon();
-void havocbot_bunnyhop(vector dir);
-void havocbot_keyboard_movement(vector destorg);
+void havocbot_ai(entity this);
+void havocbot_aim(entity this);
+void havocbot_setupbot(entity this);
+void havocbot_movetogoal(entity this);
+void havocbot_chooserole(entity this);
+void havocbot_chooseenemy(entity this);
+void havocbot_chooseweapon(entity this);
+void havocbot_bunnyhop(entity this, vector dir);
+void havocbot_keyboard_movement(entity this, vector destorg);
 
-float havocbot_resetgoal();
-float havocbot_moveto(vector pos);
-float havocbot_moveto_refresh_route();
+float havocbot_resetgoal(entity this);
+float havocbot_moveto(entity this, vector pos);
+float havocbot_moveto_refresh_route(entity this);
 
 vector havocbot_dodge();
 
-.void() havocbot_role;
-.void() havocbot_previous_role;
+.void(entity this) havocbot_role;
+.void(entity this) havocbot_previous_role;
 
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_items;
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
 
 /*
  * Imports
@@ -63,4 +62,3 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay
 .entity draggedby;
 .float ladder_time;
 .entity ladder_entity;
-#endif
index b7f459afe0acdfcee1b242357c5c9392a6d3ec7c..2a354d9a57ec23c72faaecd246c9861f85a17518 100644 (file)
@@ -1,3 +1,4 @@
+#include "roles.qh"
 
 #include "havocbot.qh"
 
@@ -7,11 +8,11 @@
 .float max_armorvalue;
 .float havocbot_role_timeout;
 
-.void() havocbot_previous_role;
-.void() havocbot_role;
+.void(entity this) havocbot_previous_role;
+.void(entity this) havocbot_role;
 
-void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
+{
        entity head;
        float rating, d, discard, distance, friend_distance, enemy_distance;
        vector o;
@@ -25,7 +26,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                friend_distance = 10000; enemy_distance = 10000;
                rating = 0;
 
-               if(!head.solid || distance > sradius || (head == self.ignoregoal && time < self.ignoregoaltime) )
+               if(!head.solid || distance > sradius || (head == this.ignoregoal && time < this.ignoregoaltime) )
                {
                        head = head.chain;
                        continue;
@@ -63,10 +64,10 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                {
                        discard = false;
 
-                       FOREACH_CLIENT(IS_PLAYER(it) && it != self && !IS_DEAD(it), LAMBDA(
+                       FOREACH_CLIENT(IS_PLAYER(it) && it != this && !IS_DEAD(it), LAMBDA(
                                d = vlen(it.origin - o); // distance between player and item
 
-                               if ( it.team == self.team )
+                               if ( it.team == this.team )
                                {
                                        if ( !IS_REAL_CLIENT(it) || discard )
                                                continue;
@@ -78,29 +79,29 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
 
                                        discard = true;
 
-                                       if( head.health && it.health > self.health )
+                                       if( head.health && it.health > this.health )
                                                continue;
 
-                                       if( head.armorvalue && it.armorvalue > self.armorvalue)
+                                       if( head.armorvalue && it.armorvalue > this.armorvalue)
                                                continue;
 
                                        if( head.weapons )
                                        if( head.weapons & ~it.weapons )
                                                continue;
 
-                                       if (head.ammo_shells && it.ammo_shells > self.ammo_shells)
+                                       if (head.ammo_shells && it.ammo_shells > this.ammo_shells)
                                                continue;
 
-                                       if (head.ammo_nails && it.ammo_nails > self.ammo_nails)
+                                       if (head.ammo_nails && it.ammo_nails > this.ammo_nails)
                                                continue;
 
-                                       if (head.ammo_rockets && it.ammo_rockets > self.ammo_rockets)
+                                       if (head.ammo_rockets && it.ammo_rockets > this.ammo_rockets)
                                                continue;
 
-                                       if (head.ammo_cells && it.ammo_cells > self.ammo_cells)
+                                       if (head.ammo_cells && it.ammo_cells > this.ammo_cells)
                                                continue;
 
-                                       if (head.ammo_plasma && it.ammo_plasma > self.ammo_plasma)
+                                       if (head.ammo_plasma && it.ammo_plasma > this.ammo_plasma)
                                                continue;
 
                                        discard = false;
@@ -117,58 +118,56 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                        // Rate the item only if no one needs it, or if an enemy is closer to it
                        if ( (enemy_distance < friend_distance && distance < enemy_distance) ||
                                (friend_distance > autocvar_bot_ai_friends_aware_pickup_radius ) || !discard )
-                               rating = head.bot_pickupevalfunc(self, head);
+                               rating = head.bot_pickupevalfunc(this, head);
 
                }
                else
-                       rating = head.bot_pickupevalfunc(self, head);
+                       rating = head.bot_pickupevalfunc(this, head);
 
                if(rating > 0)
-                       navigation_routerating(head, rating * ratingscale, 2000);
+                       navigation_routerating(this, head, rating * ratingscale, 2000);
                head = head.chain;
        }
 }
 
-void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_controlpoints(entity this, float ratingscale, vector org, float sradius)
+{
        entity head;
        head = findchain(classname, "dom_controlpoint");
        while (head)
        {
-               if (vlen(( ( head.absmin + head.absmax ) * 0.5 ) - org) < sradius)
+               if(vdist((((head.absmin + head.absmax) * 0.5) - org), <, sradius))
                {
                        if(head.cnt > -1) // this is just being fought for
-                               navigation_routerating(head, ratingscale, 5000);
+                               navigation_routerating(this, head, ratingscale, 5000);
                        else if(head.goalentity.cnt == 0) // unclaimed point
-                               navigation_routerating(head, ratingscale * 0.5, 5000);
-                       else if(head.goalentity.team != self.team) // other team's point
-                               navigation_routerating(head, ratingscale * 0.2, 5000);
+                               navigation_routerating(this, head, ratingscale * 0.5, 5000);
+                       else if(head.goalentity.team != this.team) // other team's point
+                               navigation_routerating(this, head, ratingscale * 0.2, 5000);
                }
                head = head.chain;
        }
 }
 
-void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
+{
        if (autocvar_bot_nofire)
                return;
 
        // don't chase players if we're under water
-       if(self.waterlevel>WATERLEVEL_WETFEET)
+       if(this.waterlevel>WATERLEVEL_WETFEET)
                return;
 
-       float distance;
        int t;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), LAMBDA(
                // TODO: Merge this logic with the bot_shouldattack function
-               distance = vlen(it.origin - org);
-               if (distance < 100 || distance > sradius)
+               if(vdist(it.origin - org, <, 100) || vdist(it.origin - org, >, sradius))
                        continue;
 
                // rate only visible enemies
                /*
-               traceline(self.origin + self.view_ofs, it.origin, MOVE_NOMONSTERS, self);
+               traceline(this.origin + this.view_ofs, it.origin, MOVE_NOMONSTERS, this);
                if (trace_fraction < 1 || trace_ent != it)
                        continue;
                */
@@ -188,42 +187,42 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi
                                continue;
                }
 
-               // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
+               // TODO: rate waypoints near the targetted player at that moment, instead of the player itthis
                //               adding a player as a goal seems to be quite dangerous, especially on space maps
                //               remove hack in navigation_poptouchedgoals() after performing this change
 
-               t = (self.health + self.armorvalue ) / (it.health + it.armorvalue );
-               navigation_routerating(it, t * ratingscale, 2000);
+               t = (this.health + this.armorvalue ) / (it.health + it.armorvalue );
+               navigation_routerating(this, it, t * ratingscale, 2000);
        ));
 }
 
 // legacy bot role for standard gamemodes
 // go to best items
-void havocbot_role_generic()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_generic(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               havocbot_goalrating_items(10000, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
-               //havocbot_goalrating_waypoints(1, self.origin, 1000);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
+               havocbot_goalrating_items(this, 10000, this.origin, 10000);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 10000);
+               //havocbot_goalrating_waypoints(1, this.origin, 1000);
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_chooserole_generic()
-{SELFPARAM();
-       self.havocbot_role = havocbot_role_generic;
+void havocbot_chooserole_generic(entity this)
+{
+       this.havocbot_role = havocbot_role_generic;
 }
 
-void havocbot_chooserole()
-{SELFPARAM();
+void havocbot_chooserole(entity this)
+{
        LOG_TRACE("choosing a role...\n");
-       self.bot_strategytime = 0;
-       if(!MUTATOR_CALLHOOK(HavocBot_ChooseRole, self))
-               havocbot_chooserole_generic();
+       this.bot_strategytime = 0;
+       if(!MUTATOR_CALLHOOK(HavocBot_ChooseRole, this))
+               havocbot_chooserole_generic(this);
 }
index cfabf0534d5d5ddcb3dc34f9d9663dc48d268d9e..5b1f2b530de231e60d79dd03f76ea8d758e66809 100644 (file)
@@ -1,4 +1,2 @@
-#ifndef ROLES_H
-#define ROLES_H
-void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius);
-#endif
+#pragma once
+void havocbot_goalrating_controlpoints(entity this, float ratingscale, vector org, float sradius);
index c09dbdeacc8edb72251e7852b329fba4af17d65d..07cb4d6e6066dd358153ef24a76b93a0efab6a93 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef HAVOCBOT_SCRIPTING_H
-#define HAVOCBOT_SCRIPTING_H
+#pragma once
 
 void bot_clearqueue(entity bot);
-#endif
index 2e40f09601bf5763edb90a9d82e0ffe31e9efa60..56cf7d98159188bb64df3cf8ee7ae66198c0288a 100644 (file)
@@ -30,7 +30,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
        if(autocvar_bot_debug_tracewalk)
        {
                debugresetnodes();
-               debugnode(start);
+               debugnode(self, start);
        }
 
        move = end - start;
@@ -81,7 +81,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        return true;
                }
                if(autocvar_bot_debug_tracewalk)
-                       debugnode(org);
+                       debugnode(self, org);
 
                if (dist <= 0)
                        break;
@@ -107,7 +107,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        tracebox(org, m1, m2, org + move * stepdist, movemode, e);
 
                        if(autocvar_bot_debug_tracewalk)
-                               debugnode(trace_endpos);
+                               debugnode(self, trace_endpos);
 
                        if (trace_fraction < 1)
                        {
@@ -116,7 +116,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                for (; org.z < end.z + self.maxs.z; org.z += stepdist)
                                {
                                                if(autocvar_bot_debug_tracewalk)
-                                                       debugnode(org);
+                                                       debugnode(self, org);
 
                                        if(pointcontents(org) == CONTENT_EMPTY)
                                                        break;
@@ -142,7 +142,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        tracebox(org, m1, m2, move, movemode, e);
 
                        if(autocvar_bot_debug_tracewalk)
-                               debugnode(trace_endpos);
+                               debugnode(self, trace_endpos);
 
                        // hit something
                        if (trace_fraction < 1)
@@ -225,42 +225,42 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
 /////////////////////////////////////////////////////////////////////////////
 
 // completely empty the goal stack, used when deciding where to go
-void navigation_clearroute()
-{SELFPARAM();
-       //print("bot ", etos(self), " clear\n");
-       self.navigation_hasgoals = false;
-       self.goalcurrent = world;
-       self.goalstack01 = world;
-       self.goalstack02 = world;
-       self.goalstack03 = world;
-       self.goalstack04 = world;
-       self.goalstack05 = world;
-       self.goalstack06 = world;
-       self.goalstack07 = world;
-       self.goalstack08 = world;
-       self.goalstack09 = world;
-       self.goalstack10 = world;
-       self.goalstack11 = world;
-       self.goalstack12 = world;
-       self.goalstack13 = world;
-       self.goalstack14 = world;
-       self.goalstack15 = world;
-       self.goalstack16 = world;
-       self.goalstack17 = world;
-       self.goalstack18 = world;
-       self.goalstack19 = world;
-       self.goalstack20 = world;
-       self.goalstack21 = world;
-       self.goalstack22 = world;
-       self.goalstack23 = world;
-       self.goalstack24 = world;
-       self.goalstack25 = world;
-       self.goalstack26 = world;
-       self.goalstack27 = world;
-       self.goalstack28 = world;
-       self.goalstack29 = world;
-       self.goalstack30 = world;
-       self.goalstack31 = world;
+void navigation_clearroute(entity this)
+{
+       //print("bot ", etos(this), " clear\n");
+       this.navigation_hasgoals = false;
+       this.goalcurrent = world;
+       this.goalstack01 = world;
+       this.goalstack02 = world;
+       this.goalstack03 = world;
+       this.goalstack04 = world;
+       this.goalstack05 = world;
+       this.goalstack06 = world;
+       this.goalstack07 = world;
+       this.goalstack08 = world;
+       this.goalstack09 = world;
+       this.goalstack10 = world;
+       this.goalstack11 = world;
+       this.goalstack12 = world;
+       this.goalstack13 = world;
+       this.goalstack14 = world;
+       this.goalstack15 = world;
+       this.goalstack16 = world;
+       this.goalstack17 = world;
+       this.goalstack18 = world;
+       this.goalstack19 = world;
+       this.goalstack20 = world;
+       this.goalstack21 = world;
+       this.goalstack22 = world;
+       this.goalstack23 = world;
+       this.goalstack24 = world;
+       this.goalstack25 = world;
+       this.goalstack26 = world;
+       this.goalstack27 = world;
+       this.goalstack28 = world;
+       this.goalstack29 = world;
+       this.goalstack30 = world;
+       this.goalstack31 = world;
 }
 
 // add a new goal at the beginning of the stack
@@ -269,81 +269,81 @@ void navigation_clearroute()
 // next-closest WP on the shortest path to the WP
 // That means, if the stack overflows, the bot will know how to do the FIRST 32
 // steps to the goal, and then recalculate the path.
-void navigation_pushroute(entity e)
-{SELFPARAM();
-       //print("bot ", etos(self), " push ", etos(e), "\n");
-       self.goalstack31 = self.goalstack30;
-       self.goalstack30 = self.goalstack29;
-       self.goalstack29 = self.goalstack28;
-       self.goalstack28 = self.goalstack27;
-       self.goalstack27 = self.goalstack26;
-       self.goalstack26 = self.goalstack25;
-       self.goalstack25 = self.goalstack24;
-       self.goalstack24 = self.goalstack23;
-       self.goalstack23 = self.goalstack22;
-       self.goalstack22 = self.goalstack21;
-       self.goalstack21 = self.goalstack20;
-       self.goalstack20 = self.goalstack19;
-       self.goalstack19 = self.goalstack18;
-       self.goalstack18 = self.goalstack17;
-       self.goalstack17 = self.goalstack16;
-       self.goalstack16 = self.goalstack15;
-       self.goalstack15 = self.goalstack14;
-       self.goalstack14 = self.goalstack13;
-       self.goalstack13 = self.goalstack12;
-       self.goalstack12 = self.goalstack11;
-       self.goalstack11 = self.goalstack10;
-       self.goalstack10 = self.goalstack09;
-       self.goalstack09 = self.goalstack08;
-       self.goalstack08 = self.goalstack07;
-       self.goalstack07 = self.goalstack06;
-       self.goalstack06 = self.goalstack05;
-       self.goalstack05 = self.goalstack04;
-       self.goalstack04 = self.goalstack03;
-       self.goalstack03 = self.goalstack02;
-       self.goalstack02 = self.goalstack01;
-       self.goalstack01 = self.goalcurrent;
-       self.goalcurrent = e;
+void navigation_pushroute(entity this, entity e)
+{
+       //print("bot ", etos(this), " push ", etos(e), "\n");
+       this.goalstack31 = this.goalstack30;
+       this.goalstack30 = this.goalstack29;
+       this.goalstack29 = this.goalstack28;
+       this.goalstack28 = this.goalstack27;
+       this.goalstack27 = this.goalstack26;
+       this.goalstack26 = this.goalstack25;
+       this.goalstack25 = this.goalstack24;
+       this.goalstack24 = this.goalstack23;
+       this.goalstack23 = this.goalstack22;
+       this.goalstack22 = this.goalstack21;
+       this.goalstack21 = this.goalstack20;
+       this.goalstack20 = this.goalstack19;
+       this.goalstack19 = this.goalstack18;
+       this.goalstack18 = this.goalstack17;
+       this.goalstack17 = this.goalstack16;
+       this.goalstack16 = this.goalstack15;
+       this.goalstack15 = this.goalstack14;
+       this.goalstack14 = this.goalstack13;
+       this.goalstack13 = this.goalstack12;
+       this.goalstack12 = this.goalstack11;
+       this.goalstack11 = this.goalstack10;
+       this.goalstack10 = this.goalstack09;
+       this.goalstack09 = this.goalstack08;
+       this.goalstack08 = this.goalstack07;
+       this.goalstack07 = this.goalstack06;
+       this.goalstack06 = this.goalstack05;
+       this.goalstack05 = this.goalstack04;
+       this.goalstack04 = this.goalstack03;
+       this.goalstack03 = this.goalstack02;
+       this.goalstack02 = this.goalstack01;
+       this.goalstack01 = this.goalcurrent;
+       this.goalcurrent = e;
 }
 
 // remove first goal from stack
 // (in other words: remove a prerequisite for reaching the later goals)
 // (used when a spawnfunc_waypoint is reached)
-void navigation_poproute()
-{SELFPARAM();
-       //print("bot ", etos(self), " pop\n");
-       self.goalcurrent = self.goalstack01;
-       self.goalstack01 = self.goalstack02;
-       self.goalstack02 = self.goalstack03;
-       self.goalstack03 = self.goalstack04;
-       self.goalstack04 = self.goalstack05;
-       self.goalstack05 = self.goalstack06;
-       self.goalstack06 = self.goalstack07;
-       self.goalstack07 = self.goalstack08;
-       self.goalstack08 = self.goalstack09;
-       self.goalstack09 = self.goalstack10;
-       self.goalstack10 = self.goalstack11;
-       self.goalstack11 = self.goalstack12;
-       self.goalstack12 = self.goalstack13;
-       self.goalstack13 = self.goalstack14;
-       self.goalstack14 = self.goalstack15;
-       self.goalstack15 = self.goalstack16;
-       self.goalstack16 = self.goalstack17;
-       self.goalstack17 = self.goalstack18;
-       self.goalstack18 = self.goalstack19;
-       self.goalstack19 = self.goalstack20;
-       self.goalstack20 = self.goalstack21;
-       self.goalstack21 = self.goalstack22;
-       self.goalstack22 = self.goalstack23;
-       self.goalstack23 = self.goalstack24;
-       self.goalstack24 = self.goalstack25;
-       self.goalstack25 = self.goalstack26;
-       self.goalstack26 = self.goalstack27;
-       self.goalstack27 = self.goalstack28;
-       self.goalstack28 = self.goalstack29;
-       self.goalstack29 = self.goalstack30;
-       self.goalstack30 = self.goalstack31;
-       self.goalstack31 = world;
+void navigation_poproute(entity this)
+{
+       //print("bot ", etos(this), " pop\n");
+       this.goalcurrent = this.goalstack01;
+       this.goalstack01 = this.goalstack02;
+       this.goalstack02 = this.goalstack03;
+       this.goalstack03 = this.goalstack04;
+       this.goalstack04 = this.goalstack05;
+       this.goalstack05 = this.goalstack06;
+       this.goalstack06 = this.goalstack07;
+       this.goalstack07 = this.goalstack08;
+       this.goalstack08 = this.goalstack09;
+       this.goalstack09 = this.goalstack10;
+       this.goalstack10 = this.goalstack11;
+       this.goalstack11 = this.goalstack12;
+       this.goalstack12 = this.goalstack13;
+       this.goalstack13 = this.goalstack14;
+       this.goalstack14 = this.goalstack15;
+       this.goalstack15 = this.goalstack16;
+       this.goalstack16 = this.goalstack17;
+       this.goalstack17 = this.goalstack18;
+       this.goalstack18 = this.goalstack19;
+       this.goalstack19 = this.goalstack20;
+       this.goalstack20 = this.goalstack21;
+       this.goalstack21 = this.goalstack22;
+       this.goalstack22 = this.goalstack23;
+       this.goalstack23 = this.goalstack24;
+       this.goalstack24 = this.goalstack25;
+       this.goalstack25 = this.goalstack26;
+       this.goalstack26 = this.goalstack27;
+       this.goalstack27 = this.goalstack28;
+       this.goalstack28 = this.goalstack29;
+       this.goalstack29 = this.goalstack30;
+       this.goalstack30 = this.goalstack31;
+       this.goalstack31 = world;
 }
 
 float navigation_waypoint_will_link(vector v, vector org, entity ent, float walkfromwp, float bestdist)
@@ -442,8 +442,8 @@ entity navigation_findnearestwaypoint(entity ent, float walkfromwp)
 }
 
 // finds the waypoints near the bot initiating a navigation query
-float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
-{SELFPARAM();
+float navigation_markroutes_nearestwaypoints(entity this, entity waylist, float maxdist)
+{
        entity head;
        vector v, m1, m2, diff;
        float c;
@@ -458,26 +458,29 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
                        {
                                m1 = head.origin + head.mins;
                                m2 = head.origin + head.maxs;
-                               v = self.origin;
+                               v = this.origin;
                                v.x = bound(m1_x, v.x, m2_x);
                                v.y = bound(m1_y, v.y, m2_y);
                                v.z = bound(m1_z, v.z, m2_z);
                        }
                        else
                                v = head.origin;
-                       diff = v - self.origin;
+                       diff = v - this.origin;
                        diff.z = max(0, diff.z);
-                       if (vlen(diff) < maxdist)
+                       if(vdist(diff, <, maxdist))
                        {
                                head.wpconsidered = true;
-                               if (tracewalk(self, self.origin, self.mins, self.maxs, v, bot_navigation_movemode))
+                               entity oldself = self;
+                               setself(this);
+                               if (tracewalk(this, this.origin, this.mins, this.maxs, v, bot_navigation_movemode))
                                {
                                        head.wpnearestpoint = v;
-                                       head.wpcost = vlen(v - self.origin) + head.dmg;
+                                       head.wpcost = vlen(v - this.origin) + head.dmg;
                                        head.wpfire = 1;
                                        head.enemy = world;
                                        c = c + 1;
                                }
+                               setself(oldself);
                        }
                }
                head = head.chain;
@@ -513,8 +516,8 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto
 }
 
 // queries the entire spawnfunc_waypoint network for pathes leading away from the bot
-void navigation_markroutes(entity fixed_source_waypoint)
-{SELFPARAM();
+void navigation_markroutes(entity this, entity fixed_source_waypoint)
+{
        entity w, wp, waylist;
        float searching, cost, cost2;
        vector p;
@@ -542,7 +545,7 @@ void navigation_markroutes(entity fixed_source_waypoint)
                // try a short range search for the nearest waypoints, and expand the search repeatedly if none are found
                // as this search is expensive we will use lower values if the bot is on the air
                float i, increment, maxdistance;
-               if(IS_ONGROUND(self))
+               if(IS_ONGROUND(this))
                {
                        increment = 750;
                        maxdistance = 50000;
@@ -553,7 +556,7 @@ void navigation_markroutes(entity fixed_source_waypoint)
                        maxdistance = 1500;
                }
 
-               for(i=increment;!navigation_markroutes_nearestwaypoints(waylist, i)&&i<maxdistance;i+=increment);
+               for(i=increment;!navigation_markroutes_nearestwaypoints(this, waylist, i)&&i<maxdistance;i+=increment);
        }
 
        searching = true;
@@ -672,8 +675,8 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
 }
 
 // updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item
-void navigation_routerating(entity e, float f, float rangebias)
-{SELFPARAM();
+void navigation_routerating(entity this, entity e, float f, float rangebias)
+{
        entity nwp;
        vector o;
        if (!e)
@@ -688,16 +691,16 @@ void navigation_routerating(entity e, float f, float rangebias)
 
        // Evaluate path using jetpack
        if(g_jetpack)
-       if(self.items & IT_JETPACK)
+       if(this.items & IT_JETPACK)
        if(autocvar_bot_ai_navigation_jetpack)
-       if(vlen(self.origin - o) > autocvar_bot_ai_navigation_jetpack_mindistance)
+       if(vlen(this.origin - o) > autocvar_bot_ai_navigation_jetpack_mindistance)
        {
                vector pointa, pointb;
 
                LOG_DEBUG("jetpack ai: evaluating path for ", e.classname, "\n");
 
                // Point A
-               traceline(self.origin, self.origin + '0 0 65535', MOVE_NORMAL, self);
+               traceline(this.origin, this.origin + '0 0 65535', MOVE_NORMAL, this);
                pointa = trace_endpos - '0 0 1';
 
                // Point B
@@ -705,7 +708,7 @@ void navigation_routerating(entity e, float f, float rangebias)
                pointb = trace_endpos - '0 0 1';
 
                // Can I see these two points from the sky?
-               traceline(pointa, pointb, MOVE_NORMAL, self);
+               traceline(pointa, pointb, MOVE_NORMAL, this);
 
                if(trace_fraction==1)
                {
@@ -721,13 +724,13 @@ void navigation_routerating(entity e, float f, float rangebias)
                                npa = pointa + down;
                                npb = pointb + down;
 
-                               if(npa.z<=self.absmax.z)
+                               if(npa.z<=this.absmax.z)
                                        break;
 
                                if(npb.z<=e.absmax.z)
                                        break;
 
-                               traceline(npa, npb, MOVE_NORMAL, self);
+                               traceline(npa, npb, MOVE_NORMAL, this);
                                if(trace_fraction==1)
                                {
                                        pointa = npa;
@@ -740,16 +743,16 @@ void navigation_routerating(entity e, float f, float rangebias)
                        // Rough estimation of fuel consumption
                        // (ignores acceleration and current xyz velocity)
                        xydistance = vlen(pointa - pointb);
-                       zdistance = fabs(pointa.z - self.origin.z);
+                       zdistance = fabs(pointa.z - this.origin.z);
 
                        t = zdistance / autocvar_g_jetpack_maxspeed_up;
                        t += xydistance / autocvar_g_jetpack_maxspeed_side;
                        fuel = t * autocvar_g_jetpack_fuel * 0.8;
 
-                       LOG_DEBUG(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
+                       LOG_DEBUG(strcat("jetpack ai: required fuel ", ftos(fuel), " this.ammo_fuel ", ftos(this.ammo_fuel), "\n"));
 
                        // enough fuel ?
-                       if(self.ammo_fuel>fuel)
+                       if(this.ammo_fuel>fuel)
                        {
                                // Estimate cost
                                // (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship
@@ -767,8 +770,8 @@ void navigation_routerating(entity e, float f, float rangebias)
                                        LOG_DEBUG(strcat("jetpack path: added goal ", e.classname, " (with rating ", ftos(f), ")\n"));
                                        navigation_bestrating = f;
                                        navigation_bestgoal = e;
-                                       self.navigation_jetpack_goal = e;
-                                       self.navigation_jetpack_point = pointb;
+                                       this.navigation_jetpack_goal = e;
+                                       this.navigation_jetpack_point = pointb;
                                }
                                return;
                        }
@@ -854,26 +857,26 @@ void navigation_routerating(entity e, float f, float rangebias)
 }
 
 // adds an item to the the goal stack with the path to a given item
-float navigation_routetogoal(entity e, vector startposition)
-{SELFPARAM();
-       self.goalentity = e;
+bool navigation_routetogoal(entity this, entity e, vector startposition)
+{
+       this.goalentity = e;
 
        // if there is no goal, just exit
        if (!e)
                return false;
 
-       self.navigation_hasgoals = true;
+       this.navigation_hasgoals = true;
 
        // put the entity on the goal stack
        //print("routetogoal ", etos(e), "\n");
-       navigation_pushroute(e);
+       navigation_pushroute(this, e);
 
        if(g_jetpack)
-       if(e==self.navigation_jetpack_goal)
+       if(e==this.navigation_jetpack_goal)
                return true;
 
        // if it can reach the goal there is nothing more to do
-       if (tracewalk(self, startposition, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
+       if (tracewalk(this, startposition, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
                return true;
 
        // see if there are waypoints describing a path to the item
@@ -888,7 +891,7 @@ float navigation_routetogoal(entity e, vector startposition)
        for (;;)
        {
                // add the spawnfunc_waypoint to the path
-               navigation_pushroute(e);
+               navigation_pushroute(this, e);
                e = e.enemy;
 
                if(e==world)
@@ -900,37 +903,37 @@ float navigation_routetogoal(entity e, vector startposition)
 
 // removes any currently touching waypoints from the goal stack
 // (this is how bots detect if they reached a goal)
-void navigation_poptouchedgoals()
-{SELFPARAM();
+void navigation_poptouchedgoals(entity this)
+{
        vector org, m1, m2;
-       org = self.origin;
-       m1 = org + self.mins;
-       m2 = org + self.maxs;
+       org = this.origin;
+       m1 = org + this.mins;
+       m2 = org + this.maxs;
 
-       if(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
+       if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
        {
-               if(self.lastteleporttime>0)
-               if(time-self.lastteleporttime<(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)?2:0.15)
+               if(this.lastteleporttime>0)
+               if(time-this.lastteleporttime<(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)?2:0.15)
                {
-                       if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
-                       if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
+                       if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+                       if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
                        {
-                               self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
-                               self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+                               this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                               this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                        }
-                       navigation_poproute();
+                       navigation_poproute(this);
                        return;
                }
        }
 
        // If for some reason the bot is closer to the next goal, pop the current one
-       if(self.goalstack01)
-       if(vlen(self.goalcurrent.origin - self.origin) > vlen(self.goalstack01.origin - self.origin))
-       if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
-       if(tracewalk(self, self.origin, self.mins, self.maxs, (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5, bot_navigation_movemode))
+       if(this.goalstack01)
+       if(vlen(this.goalcurrent.origin - this.origin) > vlen(this.goalstack01.origin - this.origin))
+       if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
+       if(tracewalk(this, this.origin, this.mins, this.maxs, (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5, bot_navigation_movemode))
        {
-               LOG_DEBUG(strcat("path optimized for ", self.netname, ", removed a goal from the queue\n"));
-               navigation_poproute();
+               LOG_DEBUG(strcat("path optimized for ", this.netname, ", removed a goal from the queue\n"));
+               navigation_poproute(this);
                // TODO this may also be a nice idea to do "early" (e.g. by
                // manipulating the vlen() comparisons) to shorten paths in
                // general - this would make bots walk more "on rails" than
@@ -940,85 +943,85 @@ void navigation_poptouchedgoals()
        }
 
        // HACK: remove players/bots as goals, they can lead a bot to unexpected places (cliffs, lava, etc)
-       // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
-       if(IS_PLAYER(self.goalcurrent))
-               navigation_poproute();
+       // TODO: rate waypoints near the targetted player at that moment, instead of the player itthis
+       if(IS_PLAYER(this.goalcurrent))
+               navigation_poproute(this);
 
        // aid for detecting jump pads better (distance based check fails sometimes)
-       if(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && self.jumppadcount > 0 )
-               navigation_poproute();
+       if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && this.jumppadcount > 0 )
+               navigation_poproute(this);
 
        // Loose goal touching check when running
-       if(self.aistatus & AI_STATUS_RUNNING)
-       if(self.speed >= autocvar_sv_maxspeed) // if -really- running
-       if(self.goalcurrent.classname=="waypoint")
+       if(this.aistatus & AI_STATUS_RUNNING)
+       if(this.speed >= autocvar_sv_maxspeed) // if -really- running
+       if(this.goalcurrent.classname=="waypoint")
        {
-               if(vlen(self.origin - self.goalcurrent.origin)<150)
+               if(vlen(this.origin - this.goalcurrent.origin)<150)
                {
-                       traceline(self.origin + self.view_ofs , self.goalcurrent.origin, true, world);
+                       traceline(this.origin + this.view_ofs , this.goalcurrent.origin, true, world);
                        if(trace_fraction==1)
                        {
                                // Detect personal waypoints
-                               if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
-                               if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
+                               if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+                               if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
                                {
-                                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
-                                       self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+                                       this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                                       this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                                }
 
-                               navigation_poproute();
+                               navigation_poproute(this);
                        }
                }
        }
 
-       while (self.goalcurrent && boxesoverlap(m1, m2, self.goalcurrent.absmin, self.goalcurrent.absmax))
+       while (this.goalcurrent && boxesoverlap(m1, m2, this.goalcurrent.absmin, this.goalcurrent.absmax))
        {
                // Detect personal waypoints
-               if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
-               if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
+               if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+               if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
                {
-                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
-                       self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+                       this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                       this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                }
 
-               navigation_poproute();
+               navigation_poproute(this);
        }
 }
 
 // begin a goal selection session (queries spawnfunc_waypoint network)
-void navigation_goalrating_start()
-{SELFPARAM();
-       if(self.aistatus & AI_STATUS_STUCK)
+void navigation_goalrating_start(entity this)
+{
+       if(this.aistatus & AI_STATUS_STUCK)
                return;
 
-       self.navigation_jetpack_goal = world;
+       this.navigation_jetpack_goal = world;
        navigation_bestrating = -1;
-       self.navigation_hasgoals = false;
-       navigation_clearroute();
+       this.navigation_hasgoals = false;
+       navigation_clearroute(this);
        navigation_bestgoal = world;
-       navigation_markroutes(world);
+       navigation_markroutes(this, world);
 }
 
 // ends a goal selection session (updates goal stack to the best goal)
-void navigation_goalrating_end()
-{SELFPARAM();
-       if(self.aistatus & AI_STATUS_STUCK)
+void navigation_goalrating_end(entity this)
+{
+       if(this.aistatus & AI_STATUS_STUCK)
                return;
 
-       navigation_routetogoal(navigation_bestgoal, self.origin);
-       LOG_DEBUG(strcat("best goal ", self.goalcurrent.classname , "\n"));
+       navigation_routetogoal(this, navigation_bestgoal, this.origin);
+       LOG_DEBUG(strcat("best goal ", this.goalcurrent.classname , "\n"));
 
        // If the bot got stuck then try to reach the farthest waypoint
-       if (!self.navigation_hasgoals)
+       if (!this.navigation_hasgoals)
        if (autocvar_bot_wander_enable)
        {
-               if (!(self.aistatus & AI_STATUS_STUCK))
+               if (!(this.aistatus & AI_STATUS_STUCK))
                {
-                       LOG_DEBUG(strcat(self.netname, " cannot walk to any goal\n"));
-                       self.aistatus |= AI_STATUS_STUCK;
+                       LOG_DEBUG(strcat(this.netname, " cannot walk to any goal\n"));
+                       this.aistatus |= AI_STATUS_STUCK;
                }
 
-               self.navigation_hasgoals = false; // Reset this value
+               this.navigation_hasgoals = false; // Reset this value
        }
 }
 
@@ -1060,8 +1063,8 @@ void botframe_updatedangerousobjects(float maxupdate)
        }
 }
 
-void navigation_unstuck()
-{SELFPARAM();
+void navigation_unstuck(entity this)
+{
        float search_radius = 1000;
 
        if (!autocvar_bot_wander_enable)
@@ -1069,21 +1072,23 @@ void navigation_unstuck()
 
        if (!bot_waypoint_queue_owner)
        {
-               LOG_DEBUG(strcat(self.netname, " sutck, taking over the waypoints queue\n"));
-               bot_waypoint_queue_owner = self;
+               LOG_DEBUG(strcat(this.netname, " sutck, taking over the waypoints queue\n"));
+               bot_waypoint_queue_owner = this;
                bot_waypoint_queue_bestgoal = world;
                bot_waypoint_queue_bestgoalrating = 0;
        }
 
-       if(bot_waypoint_queue_owner!=self)
+       if(bot_waypoint_queue_owner!=this)
                return;
 
        if (bot_waypoint_queue_goal)
        {
                // evaluate the next goal on the queue
-               float d = vlen(self.origin - bot_waypoint_queue_goal.origin);
-               LOG_DEBUG(strcat(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n"));
-               if(tracewalk(bot_waypoint_queue_goal, self.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
+               float d = vlen(this.origin - bot_waypoint_queue_goal.origin);
+               LOG_DEBUG(strcat(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n"));
+               entity oldself = self;
+               setself(this); // tracewalk has questionable use of self
+               if(tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
                {
                        if( d > bot_waypoint_queue_bestgoalrating)
                        {
@@ -1091,20 +1096,21 @@ void navigation_unstuck()
                                bot_waypoint_queue_bestgoal = bot_waypoint_queue_goal;
                        }
                }
+               setself(oldself);
                bot_waypoint_queue_goal = bot_waypoint_queue_goal.bot_waypoint_queue_nextgoal;
 
                if (!bot_waypoint_queue_goal)
                {
                        if (bot_waypoint_queue_bestgoal)
                        {
-                               LOG_DEBUG(strcat(self.netname, " stuck, reachable waypoint found, heading to it\n"));
-                               navigation_routetogoal(bot_waypoint_queue_bestgoal, self.origin);
-                               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-                               self.aistatus &= ~AI_STATUS_STUCK;
+                               LOG_DEBUG(strcat(this.netname, " stuck, reachable waypoint found, heading to it\n"));
+                               navigation_routetogoal(this, bot_waypoint_queue_bestgoal, this.origin);
+                               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+                               this.aistatus &= ~AI_STATUS_STUCK;
                        }
                        else
                        {
-                               LOG_DEBUG(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
+                               LOG_DEBUG(strcat(this.netname, " stuck, cannot walk to any waypoint at all\n"));
                        }
 
                        bot_waypoint_queue_owner = world;
@@ -1112,16 +1118,16 @@ void navigation_unstuck()
        }
        else
        {
-               if(bot_strategytoken!=self)
+               if(bot_strategytoken!=this)
                        return;
 
                // build a new queue
-               LOG_DEBUG(strcat(self.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n"));
+               LOG_DEBUG(strcat(this.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n"));
 
                entity head, first;
 
                first = world;
-               head = findradius(self.origin, search_radius);
+               head = findradius(this.origin, search_radius);
 
                while(head)
                {
@@ -1144,7 +1150,7 @@ void navigation_unstuck()
                        bot_waypoint_queue_goal = first;
                else
                {
-                       LOG_DEBUG(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
+                       LOG_DEBUG(strcat(this.netname, " stuck, cannot walk to any waypoint at all\n"));
                        bot_waypoint_queue_owner = world;
                }
        }
@@ -1157,9 +1163,9 @@ void debugresetnodes()
        debuglastnode = '0 0 0';
 }
 
-void debugnode(vector node)
-{SELFPARAM();
-       if (!IS_PLAYER(self))
+void debugnode(entity this, vector node)
+{
+       if (!IS_PLAYER(this))
                return;
 
        if(debuglastnode=='0 0 0')
@@ -1200,61 +1206,61 @@ void debugnodestatus(vector position, float status)
 .vector lastposition;
 
 // Debug the goal stack visually
-void debuggoalstack()
-{SELFPARAM();
+void debuggoalstack(entity this)
+{
        entity goal;
        vector org, go;
 
-       if(self.goalcounter==0)goal=self.goalcurrent;
-       else if(self.goalcounter==1)goal=self.goalstack01;
-       else if(self.goalcounter==2)goal=self.goalstack02;
-       else if(self.goalcounter==3)goal=self.goalstack03;
-       else if(self.goalcounter==4)goal=self.goalstack04;
-       else if(self.goalcounter==5)goal=self.goalstack05;
-       else if(self.goalcounter==6)goal=self.goalstack06;
-       else if(self.goalcounter==7)goal=self.goalstack07;
-       else if(self.goalcounter==8)goal=self.goalstack08;
-       else if(self.goalcounter==9)goal=self.goalstack09;
-       else if(self.goalcounter==10)goal=self.goalstack10;
-       else if(self.goalcounter==11)goal=self.goalstack11;
-       else if(self.goalcounter==12)goal=self.goalstack12;
-       else if(self.goalcounter==13)goal=self.goalstack13;
-       else if(self.goalcounter==14)goal=self.goalstack14;
-       else if(self.goalcounter==15)goal=self.goalstack15;
-       else if(self.goalcounter==16)goal=self.goalstack16;
-       else if(self.goalcounter==17)goal=self.goalstack17;
-       else if(self.goalcounter==18)goal=self.goalstack18;
-       else if(self.goalcounter==19)goal=self.goalstack19;
-       else if(self.goalcounter==20)goal=self.goalstack20;
-       else if(self.goalcounter==21)goal=self.goalstack21;
-       else if(self.goalcounter==22)goal=self.goalstack22;
-       else if(self.goalcounter==23)goal=self.goalstack23;
-       else if(self.goalcounter==24)goal=self.goalstack24;
-       else if(self.goalcounter==25)goal=self.goalstack25;
-       else if(self.goalcounter==26)goal=self.goalstack26;
-       else if(self.goalcounter==27)goal=self.goalstack27;
-       else if(self.goalcounter==28)goal=self.goalstack28;
-       else if(self.goalcounter==29)goal=self.goalstack29;
-       else if(self.goalcounter==30)goal=self.goalstack30;
-       else if(self.goalcounter==31)goal=self.goalstack31;
+       if(this.goalcounter==0)goal=this.goalcurrent;
+       else if(this.goalcounter==1)goal=this.goalstack01;
+       else if(this.goalcounter==2)goal=this.goalstack02;
+       else if(this.goalcounter==3)goal=this.goalstack03;
+       else if(this.goalcounter==4)goal=this.goalstack04;
+       else if(this.goalcounter==5)goal=this.goalstack05;
+       else if(this.goalcounter==6)goal=this.goalstack06;
+       else if(this.goalcounter==7)goal=this.goalstack07;
+       else if(this.goalcounter==8)goal=this.goalstack08;
+       else if(this.goalcounter==9)goal=this.goalstack09;
+       else if(this.goalcounter==10)goal=this.goalstack10;
+       else if(this.goalcounter==11)goal=this.goalstack11;
+       else if(this.goalcounter==12)goal=this.goalstack12;
+       else if(this.goalcounter==13)goal=this.goalstack13;
+       else if(this.goalcounter==14)goal=this.goalstack14;
+       else if(this.goalcounter==15)goal=this.goalstack15;
+       else if(this.goalcounter==16)goal=this.goalstack16;
+       else if(this.goalcounter==17)goal=this.goalstack17;
+       else if(this.goalcounter==18)goal=this.goalstack18;
+       else if(this.goalcounter==19)goal=this.goalstack19;
+       else if(this.goalcounter==20)goal=this.goalstack20;
+       else if(this.goalcounter==21)goal=this.goalstack21;
+       else if(this.goalcounter==22)goal=this.goalstack22;
+       else if(this.goalcounter==23)goal=this.goalstack23;
+       else if(this.goalcounter==24)goal=this.goalstack24;
+       else if(this.goalcounter==25)goal=this.goalstack25;
+       else if(this.goalcounter==26)goal=this.goalstack26;
+       else if(this.goalcounter==27)goal=this.goalstack27;
+       else if(this.goalcounter==28)goal=this.goalstack28;
+       else if(this.goalcounter==29)goal=this.goalstack29;
+       else if(this.goalcounter==30)goal=this.goalstack30;
+       else if(this.goalcounter==31)goal=this.goalstack31;
        else goal=world;
 
        if(goal==world)
        {
-               self.goalcounter = 0;
-               self.lastposition='0 0 0';
+               this.goalcounter = 0;
+               this.lastposition='0 0 0';
                return;
        }
 
-       if(self.lastposition=='0 0 0')
-               org = self.origin;
+       if(this.lastposition=='0 0 0')
+               org = this.origin;
        else
-               org = self.lastposition;
+               org = this.lastposition;
 
 
        go = ( goal.absmin + goal.absmax ) * 0.5;
        te_lightning2(world, org, go);
-       self.lastposition = go;
+       this.lastposition = go;
 
-       self.goalcounter++;
+       this.goalcounter++;
 }
index cf4a5ce5b261dcf6c4e154bef405c480d85a2afb..7fef6afef3a3f7a549f15f3753416ab5d5866a83 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef NAVIGATION_H
-#define NAVIGATION_H
+#pragma once
 /*
  * Globals and Fields
  */
@@ -51,30 +50,29 @@ float bot_waypoint_queue_bestgoalrating;
  */
 
 void debugresetnodes();
-void debugnode(vector node);
+void debugnode(entity this, vector node);
 void debugnodestatus(vector position, float status);
 
-void debuggoalstack();
+void debuggoalstack(entity this);
 
 float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode);
 
-float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist);
-float navigation_routetogoal(entity e, vector startposition);
+float navigation_markroutes_nearestwaypoints(entity this, entity waylist, float maxdist);
+float navigation_routetogoal(entity this, entity e, vector startposition);
 
-void navigation_clearroute();
-void navigation_pushroute(entity e);
-void navigation_poproute();
+void navigation_clearroute(entity this);
+void navigation_pushroute(entity this, entity e);
+void navigation_poproute(entity this);
 void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p);
-void navigation_markroutes(entity fixed_source_waypoint);
+void navigation_markroutes(entity this, entity fixed_source_waypoint);
 void navigation_markroutes_inverted(entity fixed_source_waypoint);
-void navigation_routerating(entity e, float f, float rangebias);
-void navigation_poptouchedgoals();
-void navigation_goalrating_start();
-void navigation_goalrating_end();
-void navigation_unstuck();
+void navigation_routerating(entity this, entity e, float f, float rangebias);
+void navigation_poptouchedgoals(entity this);
+void navigation_goalrating_start(entity this);
+void navigation_goalrating_end(entity this);
+void navigation_unstuck(entity this);
 
 void botframe_updatedangerousobjects(float maxupdate);
 
 entity navigation_findnearestwaypoint(entity ent, float walkfromwp);
 float navigation_waypoint_will_link(vector v, vector org, entity ent, float walkfromwp, float bestdist);
-#endif
index 7b349f479aa2cfdfd2a113c47069160c8795cbe7..77d410653afb6146aee016bd815e79a635cea4bb 100644 (file)
@@ -1,5 +1,8 @@
 #include "scripting.qh"
 
+#include <common/state.qh>
+#include <common/physics/player.qh>
+
 #include "bot.qh"
 
 .int state;
@@ -86,33 +89,33 @@ string bot_readcommand(entity bot, float idx)
        return bufstr_get(bot.bot_cmdqueuebuf, idx);
 }
 
-float bot_havecommand(entity bot, float idx)
+bool bot_havecommand(entity this, int idx)
 {
-       if(!bot.bot_cmdqueuebuf_allocated)
-               return 0;
-       if(idx < bot.bot_cmdqueuebuf_start)
-               return 0;
-       if(idx >= bot.bot_cmdqueuebuf_end)
-               return 0;
-       return 1;
+       if(!this.bot_cmdqueuebuf_allocated)
+               return false;
+       if(idx < this.bot_cmdqueuebuf_start)
+               return false;
+       if(idx >= this.bot_cmdqueuebuf_end)
+               return false;
+       return true;
 }
 
 const int MAX_BOT_PLACES = 4;
 .float bot_places_count;
 .entity bot_places[MAX_BOT_PLACES];
 .string bot_placenames[MAX_BOT_PLACES];
-entity bot_getplace(string placename)
-{SELFPARAM();
+entity bot_getplace(entity this, string placename)
+{
        entity e;
        if(substring(placename, 0, 1) == "@")
        {
                int i, p;
                placename = substring(placename, 1, -1);
                string s, s2;
-               for(i = 0; i < self.bot_places_count; ++i)
-                       if(self.(bot_placenames[i]) == placename)
-                               return self.(bot_places[i]);
-               // now: i == self.bot_places_count
+               for(i = 0; i < this.bot_places_count; ++i)
+                       if(this.(bot_placenames[i]) == placename)
+                               return this.(bot_places[i]);
+               // now: i == this.bot_places_count
                s = s2 = cvar_string(placename);
                p = strstrofs(s2, " ", 0);
                if(p >= 0)
@@ -127,9 +130,9 @@ entity bot_getplace(string placename)
                        LOG_INFO("invalid place ", s, "\n");
                if(i < MAX_BOT_PLACES)
                {
-                       self.(bot_placenames[i]) = strzone(placename);
-                       self.(bot_places[i]) = e;
-                       self.bot_places_count += 1;
+                       this.(bot_placenames[i]) = strzone(placename);
+                       this.(bot_places[i]) = e;
+                       this.bot_places_count += 1;
                }
                return e;
        }
@@ -474,66 +477,66 @@ void bot_list_commands()
 .int bot_exec_status;
 
 void SV_ParseClientCommand(string s);
-float bot_cmd_cc()
+float bot_cmd_cc(entity this)
 {
-       SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string);
+       WITHSELF(this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_impulse()
-{SELFPARAM();
-       self.impulse = bot_cmd.bot_cmd_parm_float;
+float bot_cmd_impulse(entity this)
+{
+       this.impulse = bot_cmd.bot_cmd_parm_float;
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_continue()
-{SELFPARAM();
-       self.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
+float bot_cmd_continue(entity this)
+{
+       this.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
        return CMD_STATUS_FINISHED;
 }
 
 .float bot_cmd_wait_time;
-float bot_cmd_wait()
-{SELFPARAM();
-       if(self.bot_exec_status & BOT_EXEC_STATUS_WAITING)
+float bot_cmd_wait(entity this)
+{
+       if(this.bot_exec_status & BOT_EXEC_STATUS_WAITING)
        {
-               if(time>=self.bot_cmd_wait_time)
+               if(time>=this.bot_cmd_wait_time)
                {
-                       self.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
+                       this.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
                        return CMD_STATUS_FINISHED;
                }
                else
                        return CMD_STATUS_EXECUTING;
        }
 
-       self.bot_cmd_wait_time = time + bot_cmd.bot_cmd_parm_float;
-       self.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
+       this.bot_cmd_wait_time = time + bot_cmd.bot_cmd_parm_float;
+       this.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
        return CMD_STATUS_EXECUTING;
 }
 
-float bot_cmd_wait_until()
-{SELFPARAM();
+float bot_cmd_wait_until(entity this)
+{
        if(time < bot_cmd.bot_cmd_parm_float + bot_barriertime)
        {
-               self.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
+               this.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
                return CMD_STATUS_EXECUTING;
        }
-       self.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
+       this.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_barrier()
-{SELFPARAM();
+float bot_cmd_barrier(entity this)
+{
        // 0 = no barrier, 1 = waiting, 2 = waiting finished
 
-       if(self.bot_barrier == 0) // initialization
+       if(this.bot_barrier == 0) // initialization
        {
-               self.bot_barrier = 1;
+               this.bot_barrier = 1;
 
-               //self.colormod = '4 4 0';
+               //this.colormod = '4 4 0';
        }
 
-       if(self.bot_barrier == 1) // find other bots
+       if(this.bot_barrier == 1) // find other bots
        {
                FOREACH_CLIENT(it.isbot, LAMBDA(
                        if(it.bot_cmdqueuebuf_allocated)
@@ -551,28 +554,28 @@ float bot_cmd_barrier()
 
        // if we get here, the barrier is finished
        // so end it...
-       self.bot_barrier = 0;
-       //self.colormod = '0 0 0';
+       this.bot_barrier = 0;
+       //this.colormod = '0 0 0';
 
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_turn()
-{SELFPARAM();
-       self.v_angle_y = self.v_angle.y + bot_cmd.bot_cmd_parm_float;
-       self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
+float bot_cmd_turn(entity this)
+{
+       this.v_angle_y = this.v_angle.y + bot_cmd.bot_cmd_parm_float;
+       this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_select_weapon()
-{SELFPARAM();
+float bot_cmd_select_weapon(entity this)
+{
        float id = bot_cmd.bot_cmd_parm_float;
 
        if(id < WEP_FIRST || id > WEP_LAST)
                return CMD_STATUS_ERROR;
 
-       if(client_hasweapon(self, Weapons_from(id), true, false))
-               PS(self).m_switchweapon = Weapons_from(id);
+       if(client_hasweapon(this, Weapons_from(id), true, false))
+               PS(this).m_switchweapon = Weapons_from(id);
        else
                return CMD_STATUS_ERROR;
 
@@ -587,8 +590,8 @@ const int CMD_CONDITION_false = 2;
 const int CMD_CONDITION_true_BLOCK = 4;
 const int CMD_CONDITION_false_BLOCK = 8;
 
-float bot_cmd_eval(string expr)
-{SELFPARAM();
+float bot_cmd_eval(entity this, string expr)
+{
        // Search for numbers
        if(strstrofs("0123456789", substring(expr, 0, 1), 0) >= 0)
        {
@@ -605,31 +608,31 @@ float bot_cmd_eval(string expr)
        switch(expr)
        {
                case "health":
-                       return self.health;
+                       return this.health;
                case "speed":
-                       return vlen(self.velocity);
+                       return vlen(this.velocity);
                case "flagcarrier":
-                       return ((self.flagcarried!=world));
+                       return ((this.flagcarried!=world));
        }
 
        LOG_INFO(strcat("ERROR: Unable to convert the expression '",expr,"' into a numeric value\n"));
        return 0;
 }
 
-float bot_cmd_if()
-{SELFPARAM();
+float bot_cmd_if(entity this)
+{
        string expr, val_a, val_b;
        float cmpofs;
 
-       if(self.bot_cmd_condition_status != CMD_CONDITION_NONE)
+       if(this.bot_cmd_condition_status != CMD_CONDITION_NONE)
        {
                // Only one "if" block is allowed at time
                LOG_INFO("ERROR: Only one conditional block can be processed at time");
-               bot_clearqueue(self);
+               bot_clearqueue(this);
                return CMD_STATUS_ERROR;
        }
 
-       self.bot_cmd_condition_status |= CMD_CONDITION_true_BLOCK;
+       this.bot_cmd_condition_status |= CMD_CONDITION_true_BLOCK;
 
        // search for operators
        expr = bot_cmd.bot_cmd_parm_string;
@@ -641,10 +644,10 @@ float bot_cmd_if()
                val_a = substring(expr,0,cmpofs);
                val_b = substring(expr,cmpofs+1,strlen(expr));
 
-               if(bot_cmd_eval(val_a)==bot_cmd_eval(val_b))
-                       self.bot_cmd_condition_status |= CMD_CONDITION_true;
+               if(bot_cmd_eval(this, val_a)==bot_cmd_eval(this, val_b))
+                       this.bot_cmd_condition_status |= CMD_CONDITION_true;
                else
-                       self.bot_cmd_condition_status |= CMD_CONDITION_false;
+                       this.bot_cmd_condition_status |= CMD_CONDITION_false;
 
                return CMD_STATUS_FINISHED;
        }
@@ -656,10 +659,10 @@ float bot_cmd_if()
                val_a = substring(expr,0,cmpofs);
                val_b = substring(expr,cmpofs+1,strlen(expr));
 
-               if(bot_cmd_eval(val_a)>bot_cmd_eval(val_b))
-                       self.bot_cmd_condition_status |= CMD_CONDITION_true;
+               if(bot_cmd_eval(this, val_a)>bot_cmd_eval(this, val_b))
+                       this.bot_cmd_condition_status |= CMD_CONDITION_true;
                else
-                       self.bot_cmd_condition_status |= CMD_CONDITION_false;
+                       this.bot_cmd_condition_status |= CMD_CONDITION_false;
 
                return CMD_STATUS_FINISHED;
        }
@@ -671,38 +674,38 @@ float bot_cmd_if()
                val_a = substring(expr,0,cmpofs);
                val_b = substring(expr,cmpofs+1,strlen(expr));
 
-               if(bot_cmd_eval(val_a)<bot_cmd_eval(val_b))
-                       self.bot_cmd_condition_status |= CMD_CONDITION_true;
+               if(bot_cmd_eval(this, val_a)<bot_cmd_eval(this, val_b))
+                       this.bot_cmd_condition_status |= CMD_CONDITION_true;
                else
-                       self.bot_cmd_condition_status |= CMD_CONDITION_false;
+                       this.bot_cmd_condition_status |= CMD_CONDITION_false;
 
                return CMD_STATUS_FINISHED;
        }
 
-       if(bot_cmd_eval(expr))
-               self.bot_cmd_condition_status |= CMD_CONDITION_true;
+       if(bot_cmd_eval(this, expr))
+               this.bot_cmd_condition_status |= CMD_CONDITION_true;
        else
-               self.bot_cmd_condition_status |= CMD_CONDITION_false;
+               this.bot_cmd_condition_status |= CMD_CONDITION_false;
 
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_else()
-{SELFPARAM();
-       self.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK;
-       self.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK;
+float bot_cmd_else(entity this)
+{
+       this.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK;
+       this.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK;
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_fi()
-{SELFPARAM();
-       self.bot_cmd_condition_status = CMD_CONDITION_NONE;
+float bot_cmd_fi(entity this)
+{
+       this.bot_cmd_condition_status = CMD_CONDITION_NONE;
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_resetaim()
-{SELFPARAM();
-       self.v_angle = '0 0 0';
+float bot_cmd_resetaim(entity this)
+{
+       this.v_angle = '0 0 0';
        return CMD_STATUS_FINISHED;
 }
 
@@ -711,19 +714,19 @@ float bot_cmd_resetaim()
 .vector bot_cmd_aim_begin;
 .vector bot_cmd_aim_end;
 
-float bot_cmd_aim()
-{SELFPARAM();
+float bot_cmd_aim(entity this)
+{
        // Current direction
-       if(self.bot_cmd_aim_endtime)
+       if(this.bot_cmd_aim_endtime)
        {
                float progress;
 
-               progress = min(1 - (self.bot_cmd_aim_endtime - time) / (self.bot_cmd_aim_endtime - self.bot_cmd_aim_begintime),1);
-               self.v_angle = self.bot_cmd_aim_begin + ((self.bot_cmd_aim_end - self.bot_cmd_aim_begin) * progress);
+               progress = min(1 - (this.bot_cmd_aim_endtime - time) / (this.bot_cmd_aim_endtime - this.bot_cmd_aim_begintime),1);
+               this.v_angle = this.bot_cmd_aim_begin + ((this.bot_cmd_aim_end - this.bot_cmd_aim_begin) * progress);
 
-               if(time>=self.bot_cmd_aim_endtime)
+               if(time>=this.bot_cmd_aim_endtime)
                {
-                       self.bot_cmd_aim_endtime = 0;
+                       this.bot_cmd_aim_endtime = 0;
                        return CMD_STATUS_FINISHED;
                }
                else
@@ -745,28 +748,28 @@ float bot_cmd_aim()
 
        if(step == 0)
        {
-               self.v_angle_x -= stof(argv(1));
-               self.v_angle_y += stof(argv(0));
+               this.v_angle_x -= stof(argv(1));
+               this.v_angle_y += stof(argv(0));
                return CMD_STATUS_FINISHED;
        }
 
-       self.bot_cmd_aim_begin = self.v_angle;
+       this.bot_cmd_aim_begin = this.v_angle;
 
-       self.bot_cmd_aim_end_x = self.v_angle.x - stof(argv(1));
-       self.bot_cmd_aim_end_y = self.v_angle.y + stof(argv(0));
-       self.bot_cmd_aim_end_z = 0;
+       this.bot_cmd_aim_end_x = this.v_angle.x - stof(argv(1));
+       this.bot_cmd_aim_end_y = this.v_angle.y + stof(argv(0));
+       this.bot_cmd_aim_end_z = 0;
 
-       self.bot_cmd_aim_begintime = time;
-       self.bot_cmd_aim_endtime = time + step;
+       this.bot_cmd_aim_begintime = time;
+       this.bot_cmd_aim_endtime = time + step;
 
        return CMD_STATUS_EXECUTING;
 }
 
-float bot_cmd_aimtarget()
-{SELFPARAM();
-       if(self.bot_cmd_aim_endtime)
+float bot_cmd_aimtarget(entity this)
+{
+       if(this.bot_cmd_aim_endtime)
        {
-               return bot_cmd_aim();
+               return bot_cmd_aim(this);
        }
 
        entity e;
@@ -778,7 +781,7 @@ float bot_cmd_aimtarget()
 
        tokens = tokenizebyseparator(parms, " ");
 
-       e = bot_getplace(argv(0));
+       e = bot_getplace(this, argv(0));
        if(!e)
                return CMD_STATUS_ERROR;
 
@@ -786,8 +789,8 @@ float bot_cmd_aimtarget()
 
        if(tokens==1)
        {
-               self.v_angle = vectoangles(v - (self.origin + self.view_ofs));
-               self.v_angle_x = -self.v_angle.x;
+               this.v_angle = vectoangles(v - (this.origin + this.view_ofs));
+               this.v_angle_x = -this.v_angle.x;
                return CMD_STATUS_FINISHED;
        }
 
@@ -796,12 +799,12 @@ float bot_cmd_aimtarget()
 
        step = stof(argv(1));
 
-       self.bot_cmd_aim_begin = self.v_angle;
-       self.bot_cmd_aim_end = vectoangles(v - (self.origin + self.view_ofs));
-       self.bot_cmd_aim_end_x = -self.bot_cmd_aim_end.x;
+       this.bot_cmd_aim_begin = this.v_angle;
+       this.bot_cmd_aim_end = vectoangles(v - (this.origin + this.view_ofs));
+       this.bot_cmd_aim_end_x = -this.bot_cmd_aim_end.x;
 
-       self.bot_cmd_aim_begintime = time;
-       self.bot_cmd_aim_endtime = time + step;
+       this.bot_cmd_aim_begintime = time;
+       this.bot_cmd_aim_endtime = time + step;
 
        return CMD_STATUS_EXECUTING;
 }
@@ -821,141 +824,141 @@ const int BOT_CMD_KEY_HOOK              = BIT(8);
 const int BOT_CMD_KEY_CROUCH   = BIT(9);
 const int BOT_CMD_KEY_CHAT             = BIT(10);
 
-float bot_presskeys()
-{SELFPARAM();
-       self.movement = '0 0 0';
-       PHYS_INPUT_BUTTON_JUMP(self) = false;
-       PHYS_INPUT_BUTTON_CROUCH(self) = false;
-       PHYS_INPUT_BUTTON_ATCK(self) = false;
-       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-       PHYS_INPUT_BUTTON_USE(self) = false;
-       PHYS_INPUT_BUTTON_HOOK(self) = false;
-       PHYS_INPUT_BUTTON_CHAT(self) = false;
-
-       if(self.bot_cmd_keys == BOT_CMD_KEY_NONE)
+bool bot_presskeys(entity this)
+{
+       this.movement = '0 0 0';
+       PHYS_INPUT_BUTTON_JUMP(this) = false;
+       PHYS_INPUT_BUTTON_CROUCH(this) = false;
+       PHYS_INPUT_BUTTON_ATCK(this) = false;
+       PHYS_INPUT_BUTTON_ATCK2(this) = false;
+       PHYS_INPUT_BUTTON_USE(this) = false;
+       PHYS_INPUT_BUTTON_HOOK(this) = false;
+       PHYS_INPUT_BUTTON_CHAT(this) = false;
+
+       if(this.bot_cmd_keys == BOT_CMD_KEY_NONE)
                return false;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
-               self.movement_x = autocvar_sv_maxspeed;
-       else if(self.bot_cmd_keys & BOT_CMD_KEY_BACKWARD)
-               self.movement_x = -autocvar_sv_maxspeed;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
+               this.movement_x = autocvar_sv_maxspeed;
+       else if(this.bot_cmd_keys & BOT_CMD_KEY_BACKWARD)
+               this.movement_x = -autocvar_sv_maxspeed;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_RIGHT)
-               self.movement_y = autocvar_sv_maxspeed;
-       else if(self.bot_cmd_keys & BOT_CMD_KEY_LEFT)
-               self.movement_y = -autocvar_sv_maxspeed;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_RIGHT)
+               this.movement_y = autocvar_sv_maxspeed;
+       else if(this.bot_cmd_keys & BOT_CMD_KEY_LEFT)
+               this.movement_y = -autocvar_sv_maxspeed;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_JUMP)
-               PHYS_INPUT_BUTTON_JUMP(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_JUMP)
+               PHYS_INPUT_BUTTON_JUMP(this) = true;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_CROUCH)
-               PHYS_INPUT_BUTTON_CROUCH(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_CROUCH)
+               PHYS_INPUT_BUTTON_CROUCH(this) = true;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK1)
-               PHYS_INPUT_BUTTON_ATCK(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_ATTACK1)
+               PHYS_INPUT_BUTTON_ATCK(this) = true;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK2)
-               PHYS_INPUT_BUTTON_ATCK2(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_ATTACK2)
+               PHYS_INPUT_BUTTON_ATCK2(this) = true;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_USE)
-               PHYS_INPUT_BUTTON_USE(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_USE)
+               PHYS_INPUT_BUTTON_USE(this) = true;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_HOOK)
-               PHYS_INPUT_BUTTON_HOOK(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_HOOK)
+               PHYS_INPUT_BUTTON_HOOK(this) = true;
 
-       if(self.bot_cmd_keys & BOT_CMD_KEY_CHAT)
-               PHYS_INPUT_BUTTON_CHAT(self) = true;
+       if(this.bot_cmd_keys & BOT_CMD_KEY_CHAT)
+               PHYS_INPUT_BUTTON_CHAT(this) = true;
 
        return true;
 }
 
 
-float bot_cmd_keypress_handler(string key, float enabled)
-{SELFPARAM();
+float bot_cmd_keypress_handler(entity this, string key, float enabled)
+{
        switch(key)
        {
                case "all":
                        if(enabled)
-                               self.bot_cmd_keys = power2of(20) - 1; // >:)
+                               this.bot_cmd_keys = power2of(20) - 1; // >:)
                        else
-                               self.bot_cmd_keys = BOT_CMD_KEY_NONE;
+                               this.bot_cmd_keys = BOT_CMD_KEY_NONE;
                case "forward":
                        if(enabled)
                        {
-                               self.bot_cmd_keys |= BOT_CMD_KEY_FORWARD;
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_FORWARD;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
                        }
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
                        break;
                case "backward":
                        if(enabled)
                        {
-                               self.bot_cmd_keys |= BOT_CMD_KEY_BACKWARD;
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_BACKWARD;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
                        }
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
                        break;
                case "left":
                        if(enabled)
                        {
-                               self.bot_cmd_keys |= BOT_CMD_KEY_LEFT;
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_LEFT;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
                        }
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
                        break;
                case "right":
                        if(enabled)
                        {
-                               self.bot_cmd_keys |= BOT_CMD_KEY_RIGHT;
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_RIGHT;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
                        }
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
                        break;
                case "jump":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_JUMP;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_JUMP;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_JUMP;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_JUMP;
                        break;
                case "crouch":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_CROUCH;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_CROUCH;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_CROUCH;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_CROUCH;
                        break;
                case "attack1":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_ATTACK1;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_ATTACK1;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK1;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK1;
                        break;
                case "attack2":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_ATTACK2;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_ATTACK2;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK2;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK2;
                        break;
                case "use":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_USE;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_USE;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_USE;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_USE;
                        break;
                case "hook":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_HOOK;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_HOOK;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_HOOK;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_HOOK;
                        break;
                case "chat":
                        if(enabled)
-                               self.bot_cmd_keys |= BOT_CMD_KEY_CHAT;
+                               this.bot_cmd_keys |= BOT_CMD_KEY_CHAT;
                        else
-                               self.bot_cmd_keys &= ~BOT_CMD_KEY_CHAT;
+                               this.bot_cmd_keys &= ~BOT_CMD_KEY_CHAT;
                        break;
                default:
                        break;
@@ -964,66 +967,66 @@ float bot_cmd_keypress_handler(string key, float enabled)
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_presskey()
+float bot_cmd_presskey(entity this)
 {
        string key;
 
        key = bot_cmd.bot_cmd_parm_string;
 
-       bot_cmd_keypress_handler(key,true);
+       bot_cmd_keypress_handler(this, key,true);
 
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_releasekey()
+float bot_cmd_releasekey(entity this)
 {
        string key;
 
        key = bot_cmd.bot_cmd_parm_string;
 
-       return bot_cmd_keypress_handler(key,false);
+       return bot_cmd_keypress_handler(this, key,false);
 }
 
-float bot_cmd_pause()
-{SELFPARAM();
-       PHYS_INPUT_BUTTON_DRAG(self) = false;
-       PHYS_INPUT_BUTTON_USE(self) = false;
-       PHYS_INPUT_BUTTON_ATCK(self) = false;
-       PHYS_INPUT_BUTTON_JUMP(self) = false;
-       PHYS_INPUT_BUTTON_HOOK(self) = false;
-       PHYS_INPUT_BUTTON_CHAT(self) = false;
-       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-       PHYS_INPUT_BUTTON_CROUCH(self) = false;
-
-       self.movement = '0 0 0';
-       self.bot_cmd_keys = BOT_CMD_KEY_NONE;
-
-       self.bot_exec_status |= BOT_EXEC_STATUS_PAUSED;
+float bot_cmd_pause(entity this)
+{
+       PHYS_INPUT_BUTTON_DRAG(this) = false;
+       PHYS_INPUT_BUTTON_USE(this) = false;
+       PHYS_INPUT_BUTTON_ATCK(this) = false;
+       PHYS_INPUT_BUTTON_JUMP(this) = false;
+       PHYS_INPUT_BUTTON_HOOK(this) = false;
+       PHYS_INPUT_BUTTON_CHAT(this) = false;
+       PHYS_INPUT_BUTTON_ATCK2(this) = false;
+       PHYS_INPUT_BUTTON_CROUCH(this) = false;
+
+       this.movement = '0 0 0';
+       this.bot_cmd_keys = BOT_CMD_KEY_NONE;
+
+       this.bot_exec_status |= BOT_EXEC_STATUS_PAUSED;
        return CMD_STATUS_FINISHED;
 }
 
-float bot_cmd_moveto()
-{SELFPARAM();
-       return self.cmd_moveto(bot_cmd.bot_cmd_parm_vector);
+float bot_cmd_moveto(entity this)
+{
+       return this.cmd_moveto(this, bot_cmd.bot_cmd_parm_vector);
 }
 
-float bot_cmd_movetotarget()
-{SELFPARAM();
+float bot_cmd_movetotarget(entity this)
+{
        entity e;
-       e = bot_getplace(bot_cmd.bot_cmd_parm_string);
+       e = bot_getplace(this, bot_cmd.bot_cmd_parm_string);
        if(!e)
                return CMD_STATUS_ERROR;
-       return self.cmd_moveto(e.origin + (e.mins + e.maxs) * 0.5);
+       return this.cmd_moveto(this, e.origin + (e.mins + e.maxs) * 0.5);
 }
 
-float bot_cmd_resetgoal()
-{SELFPARAM();
-       return self.cmd_resetgoal();
+float bot_cmd_resetgoal(entity this)
+{
+       return this.cmd_resetgoal(this);
 }
 
 
-float bot_cmd_sound()
-{SELFPARAM();
+float bot_cmd_sound(entity this)
+{
        string f;
        f = bot_cmd.bot_cmd_parm_string;
 
@@ -1044,48 +1047,48 @@ float bot_cmd_sound()
                atten = stof(argv(2));
 
        precache_sound(f);
-       _sound(self, chan, sample, vol, atten);
+       _sound(this, chan, sample, vol, atten);
 
        return CMD_STATUS_FINISHED;
 }
 
 .entity tuba_note;
-float bot_cmd_debug_assert_canfire()
-{SELFPARAM();
+float bot_cmd_debug_assert_canfire(entity this)
+{
        float f = bot_cmd.bot_cmd_parm_float;
 
        int slot = 0;
        .entity weaponentity = weaponentities[slot];
-       if(self.(weaponentity).state != WS_READY)
+       if(this.(weaponentity).state != WS_READY)
        {
                if(f)
                {
-                       self.colormod = '0 8 8';
-                       LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by weaponentity state\n");
+                       this.colormod = '0 8 8';
+                       LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " wants to fire, inhibited by weaponentity state\n");
                }
        }
-       else if(ATTACK_FINISHED(self, slot) > time)
+       else if(ATTACK_FINISHED(this, slot) > time)
        {
                if(f)
                {
-                       self.colormod = '8 0 8';
-                       LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(self, slot) - time), " seconds left)\n");
+                       this.colormod = '8 0 8';
+                       LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)\n");
                }
        }
-       else if(self.tuba_note)
+       else if(this.tuba_note)
        {
                if(f)
                {
-                       self.colormod = '8 0 0';
-                       LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " wants to fire, bot still has an active tuba note\n");
+                       this.colormod = '8 0 0';
+                       LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " wants to fire, bot still has an active tuba note\n");
                }
        }
        else
        {
                if(!f)
                {
-                       self.colormod = '8 8 0';
-                       LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(self, slot) - time), " seconds left\n");
+                       this.colormod = '8 8 0';
+                       LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left\n");
                }
        }
 
@@ -1094,46 +1097,46 @@ float bot_cmd_debug_assert_canfire()
 
 //
 
-void bot_command_executed(float rm)
-{SELFPARAM();
+void bot_command_executed(entity this, bool rm)
+{
        entity cmd;
 
        cmd = bot_cmd;
 
        if(rm)
-               bot_dequeuecommand(self, self.bot_cmd_execution_index);
+               bot_dequeuecommand(this, this.bot_cmd_execution_index);
 
-       self.bot_cmd_execution_index++;
+       this.bot_cmd_execution_index++;
 }
 
-void bot_setcurrentcommand()
-{SELFPARAM();
+void bot_setcurrentcommand(entity this)
+{
        bot_cmd = world;
 
-       if(!self.bot_cmd_current)
+       if(!this.bot_cmd_current)
        {
-               self.bot_cmd_current = new_pure(bot_cmd);
-               self.bot_cmd_current.is_bot_cmd = true;
+               this.bot_cmd_current = new_pure(bot_cmd);
+               this.bot_cmd_current.is_bot_cmd = true;
        }
 
-       bot_cmd = self.bot_cmd_current;
-       if(bot_cmd.bot_cmd_index != self.bot_cmd_execution_index || self.bot_cmd_execution_index == 0)
+       bot_cmd = this.bot_cmd_current;
+       if(bot_cmd.bot_cmd_index != this.bot_cmd_execution_index || this.bot_cmd_execution_index == 0)
        {
-               if(bot_havecommand(self, self.bot_cmd_execution_index))
+               if(bot_havecommand(this, this.bot_cmd_execution_index))
                {
                        string cmdstring;
-                       cmdstring = bot_readcommand(self, self.bot_cmd_execution_index);
+                       cmdstring = bot_readcommand(this, this.bot_cmd_execution_index);
                        if(bot_decodecommand(cmdstring))
                        {
-                               bot_cmd.owner = self;
-                               bot_cmd.bot_cmd_index = self.bot_cmd_execution_index;
+                               bot_cmd.owner = this;
+                               bot_cmd.bot_cmd_index = this.bot_cmd_execution_index;
                        }
                        else
                        {
                                // Invalid command, remove from queue
                                bot_cmd = world;
-                               bot_dequeuecommand(self, self.bot_cmd_execution_index);
-                               self.bot_cmd_execution_index++;
+                               bot_dequeuecommand(this, this.bot_cmd_execution_index);
+                               this.bot_cmd_execution_index++;
                        }
                }
                else
@@ -1161,12 +1164,12 @@ void bot_resetqueues()
 
 // Here we map commands to functions and deal with complex interactions between commands and execution states
 // NOTE: Of course you need to include your commands here too :)
-float bot_execute_commands_once()
-{SELFPARAM();
+float bot_execute_commands_once(entity this)
+{
        float status, ispressingkey;
 
        // Find command
-       bot_setcurrentcommand();
+       bot_setcurrentcommand(this);
 
        // if we have no bot command, better return
        // old logic kept pressing previously pressed keys, but that has problems
@@ -1176,30 +1179,30 @@ float bot_execute_commands_once()
                return false;
 
        // Ignore all commands except continue when the bot is paused
-       if(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
+       if(this.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
        if(bot_cmd.bot_cmd_type!=BOT_CMD_CONTINUE)
        {
                if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
                {
-                       bot_command_executed(true);
+                       bot_command_executed(this, true);
                        LOG_INFO( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
                }
                return 1;
        }
 
        // Keep pressing keys raised by the "presskey" command
-       ispressingkey = boolean(bot_presskeys());
+       ispressingkey = boolean(bot_presskeys(this));
 
        // Handle conditions
        if (!(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE))
-       if(self.bot_cmd_condition_status & CMD_CONDITION_true && self.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK)
+       if(this.bot_cmd_condition_status & CMD_CONDITION_true && this.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK)
        {
-               bot_command_executed(true);
+               bot_command_executed(this, true);
                return -1;
        }
-       else if(self.bot_cmd_condition_status & CMD_CONDITION_false && self.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK)
+       else if(this.bot_cmd_condition_status & CMD_CONDITION_false && this.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK)
        {
-               bot_command_executed(true);
+               bot_command_executed(this, true);
                return -1;
        }
 
@@ -1210,74 +1213,74 @@ float bot_execute_commands_once()
                        return ispressingkey;
                        //break;
                case BOT_CMD_PAUSE:
-                       status = bot_cmd_pause();
+                       status = bot_cmd_pause(this);
                        break;
                case BOT_CMD_CONTINUE:
-                       status = bot_cmd_continue();
+                       status = bot_cmd_continue(this);
                        break;
                case BOT_CMD_WAIT:
-                       status = bot_cmd_wait();
+                       status = bot_cmd_wait(this);
                        break;
                case BOT_CMD_WAIT_UNTIL:
-                       status = bot_cmd_wait_until();
+                       status = bot_cmd_wait_until(this);
                        break;
                case BOT_CMD_TURN:
-                       status = bot_cmd_turn();
+                       status = bot_cmd_turn(this);
                        break;
                case BOT_CMD_MOVETO:
-                       status = bot_cmd_moveto();
+                       status = bot_cmd_moveto(this);
                        break;
                case BOT_CMD_MOVETOTARGET:
-                       status = bot_cmd_movetotarget();
+                       status = bot_cmd_movetotarget(this);
                        break;
                case BOT_CMD_RESETGOAL:
-                       status = bot_cmd_resetgoal();
+                       status = bot_cmd_resetgoal(this);
                        break;
                case BOT_CMD_CC:
-                       status = bot_cmd_cc();
+                       status = bot_cmd_cc(this);
                        break;
                case BOT_CMD_IF:
-                       status = bot_cmd_if();
+                       status = bot_cmd_if(this);
                        break;
                case BOT_CMD_ELSE:
-                       status = bot_cmd_else();
+                       status = bot_cmd_else(this);
                        break;
                case BOT_CMD_FI:
-                       status = bot_cmd_fi();
+                       status = bot_cmd_fi(this);
                        break;
                case BOT_CMD_RESETAIM:
-                       status = bot_cmd_resetaim();
+                       status = bot_cmd_resetaim(this);
                        break;
                case BOT_CMD_AIM:
-                       status = bot_cmd_aim();
+                       status = bot_cmd_aim(this);
                        break;
                case BOT_CMD_AIMTARGET:
-                       status = bot_cmd_aimtarget();
+                       status = bot_cmd_aimtarget(this);
                        break;
                case BOT_CMD_PRESSKEY:
-                       status = bot_cmd_presskey();
+                       status = bot_cmd_presskey(this);
                        break;
                case BOT_CMD_RELEASEKEY:
-                       status = bot_cmd_releasekey();
+                       status = bot_cmd_releasekey(this);
                        break;
                case BOT_CMD_SELECTWEAPON:
-                       status = bot_cmd_select_weapon();
+                       status = bot_cmd_select_weapon(this);
                        break;
                case BOT_CMD_IMPULSE:
-                       status = bot_cmd_impulse();
+                       status = bot_cmd_impulse(this);
                        break;
                case BOT_CMD_BARRIER:
-                       status = bot_cmd_barrier();
+                       status = bot_cmd_barrier(this);
                        break;
                case BOT_CMD_CONSOLE:
                        localcmd(strcat(bot_cmd.bot_cmd_parm_string, "\n"));
                        status = CMD_STATUS_FINISHED;
                        break;
                case BOT_CMD_SOUND:
-                       status = bot_cmd_sound();
+                       status = bot_cmd_sound(this);
                        break;
                case BOT_CMD_DEBUG_ASSERT_CANFIRE:
-                       status = bot_cmd_debug_assert_canfire();
+                       status = bot_cmd_debug_assert_canfire(this);
                        break;
                default:
                        LOG_INFO(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
@@ -1313,10 +1316,10 @@ float bot_execute_commands_once()
                                        parms = "";
                                        break;
                        }
-                       clientcommand(self,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
+                       clientcommand(this,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
                }
 
-               bot_command_executed(true);
+               bot_command_executed(this, true);
        }
 
        if(status == CMD_STATUS_FINISHED)
@@ -1326,12 +1329,12 @@ float bot_execute_commands_once()
 }
 
 // This function should be (the only) called directly from the bot ai loop
-float bot_execute_commands()
+int bot_execute_commands(entity this)
 {
-       float f;
+       int f;
        do
        {
-               f = bot_execute_commands_once();
+               f = bot_execute_commands_once(this);
        }
        while(f < 0);
        return f;
index d5cdda9d69859d483cd69786389e8236bb2bd701..cb6cd8731daab16ad2d43147a5c64ad0f5f3f71e 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef BOT_SCRIPTING_H
-#define BOT_SCRIPTING_H
+#pragma once
 
 #define BOT_EXEC_STATUS_IDLE 0
 #define BOT_EXEC_STATUS_PAUSED 1
@@ -43,8 +42,8 @@ const int BOT_CMD_COUNTER             = 24;   // Update this value if you add/remove a comma
 
 // NOTE: Following commands should be implemented on the bot ai
 //              If a new command should be handled by the target ai(s) please declare it here
-.float(vector) cmd_moveto;
-.float() cmd_resetgoal;
+.float(entity, vector) cmd_moveto;
+.float(entity) cmd_resetgoal;
 
 //
 const int BOT_CMD_PARAMETER_NONE = 0;
@@ -77,7 +76,6 @@ void bot_resetqueues();
 void bot_queuecommand(entity bot, string cmdstring);
 void bot_cmdhelp(string scmd);
 void bot_list_commands();
-float bot_execute_commands();
+float bot_execute_commands(entity this);
 entity find_bot_by_name(string name);
 entity find_bot_by_number(float number);
-#endif
index 178bc637c267980a62d71380fbe087d45f793a0f..184710818c1aac266a32e620695cd97fbbd66b1f 100644 (file)
@@ -3,6 +3,8 @@
 #include "bot.qh"
 #include "navigation.qh"
 
+#include <common/state.qh>
+
 #include "../antilag.qh"
 
 #include <common/constants.qh>
@@ -199,7 +201,7 @@ void waypoint_think()
                        ev.z = bound(em1_z, ev.z, em2_z);
                        dv = ev - sv;
                        dv.z = 0;
-                       if (vlen(dv) >= 1050) // max search distance in XY
+                       if(vdist(dv, >=, 1050)) // max search distance in XY
                        {
                                ++relink_lengthculled;
                                continue;
@@ -294,10 +296,10 @@ void waypoint_schedulerelink(entity wp)
 // spawnfunc_waypoint map entity
 spawnfunc(waypoint)
 {
-       setorigin(self, self.origin);
+       setorigin(this, this.origin);
        // schedule a relink after other waypoints have had a chance to spawn
-       waypoint_clearlinks(self);
-       //waypoint_schedulerelink(self);
+       waypoint_clearlinks(this);
+       //waypoint_schedulerelink(this);
 }
 
 // remove a spawnfunc_waypoint, and schedule all neighbors to relink
@@ -788,8 +790,8 @@ void waypoint_spawnforteleporter(entity e, vector destination, float timetaken)
        waypoint_spawnforteleporter_boxes(e, e.absmin, e.absmax, destination, destination, timetaken);
 }
 
-entity waypoint_spawnpersonal(vector position)
-{SELFPARAM();
+entity waypoint_spawnpersonal(entity this, vector position)
+{
        entity w;
 
        // drop the waypoint to a proper location:
@@ -800,7 +802,7 @@ entity waypoint_spawnpersonal(vector position)
        w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
        w.nearestwaypoint = world;
        w.nearestwaypointtimeout = 0;
-       w.owner = self;
+       w.owner = this;
 
        waypoint_schedulerelink(w);
 
@@ -983,7 +985,7 @@ float botframe_autowaypoints_fix_from(entity p, float walkfromwp, entity wp, .en
                }
 
                t = (tmin + tmax) * 0.5;
-               o = antilag_takebackorigin(p, time - t);
+               o = antilag_takebackorigin(p, CS(p), time - t);
                if(!botframe_autowaypoints_fixdown(o))
                        return -2;
                o = trace_endpos;
@@ -1107,7 +1109,7 @@ void botframe_deleteuselesswaypoints()
                                        goto next;
                                }
                        }
-:next
+LABEL(next)
                }
        }
        // d) The waypoint is a dead end. Dead end waypoints must be kept as
index 8e0dd0fe627e07c1ecfc689da28454cf8280e8c9..a03155544f6688722ef8e3f462ae50f4531226a2 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef WAYPOINTS_H
-#define WAYPOINTS_H
+#pragma once
 /*
  * Globals and Fields
  */
@@ -61,9 +60,8 @@ float waypoint_loadall();
 float waypoint_load_links();
 
 entity waypoint_spawn(vector m1, vector m2, float f);
-entity waypoint_spawnpersonal(vector position);
+entity waypoint_spawnpersonal(entity this, vector position);
 
 vector waypoint_fixorigin(vector position);
 
 void botframe_autowaypoints();
-#endif
index f5228c269338cd146e6c4656a45044185e59c56b..6feb07c4541965366aa850ee8aaf2b984200e253 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CAMPAIGN_H
-#define CAMPAIGN_H
+#pragma once
 
 // this must be included BEFORE campaign_common.h to make this a memory saving
 #define CAMPAIGN_MAX_ENTRIES 2
@@ -13,7 +12,8 @@ void CampaignPostIntermission(); // must change map
 
 void CampaignLevelWarp(float n);
 
-float campaign_bots_may_start;
-// campaign mode: bots shall spawn but wait for the player to spawn before they do anything
-// in other game modes, this is ignored
-#endif
+/**
+ * campaign mode: bots shall spawn but wait for the player to spawn before they do anything
+ * in other game modes, this is ignored
+ */
+bool campaign_bots_may_start;
index b82b19a4a7f3a9593e20c556a41ccc27c14562df..e13678dce5995e6381c3dd248cdb275aecc174a8 100644 (file)
@@ -97,15 +97,15 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
        cheatcount_total += n; \
        e.cheatcount += n
 #define END_CHEAT_FUNCTION() \
-       ADD_CHEATS(self,cheating); \
+       ADD_CHEATS(this, cheating); \
        return attempting
 #define IS_CHEAT(i,argc,fr) \
        if((++attempting, !CheatsAllowed(i,argc,fr))) \
                break
 
 float num_autoscreenshot;
-void info_autoscreenshot_findtarget()
-{SELFPARAM();
+void info_autoscreenshot_findtarget(entity this)
+{
        entity e;
        e = find(world, targetname, self.target);
        if(!e)
@@ -324,7 +324,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   effectname
                                effectnum = _particleeffectnum(argv(1));
-                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, SND_Null, CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
                                __trailparticles(self, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
@@ -339,7 +339,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   modelname mode
                                f = stof(argv(2));
-                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, SND_Null, CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, self);
                                if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
                                {
@@ -358,7 +358,7 @@ float CheatCommand(float argc)
                                                e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
                                                e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
                                        }
-                                       WITH(entity, self, e, spawnfunc_func_breakable(e));
+                                       WITHSELF(e, spawnfunc_func_breakable(e));
                                        // now, is it valid?
                                        if(f == 0)
                                        {
@@ -696,7 +696,7 @@ float CheatCommand(float argc)
                        setself(new(cheattriggerteleport));
                        setorigin(self, self.origin);
                        self.target = argv(1);
-                       teleport_findtarget();
+                       teleport_findtarget(self);
                        if(!wasfreed(self))
                        {
                                Simple_TeleportPlayer(self, this);
@@ -736,10 +736,10 @@ float CheatFrame()
        switch(0)
        {
                default:
-                       if(self.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
+                       if(this.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
                        {
                                // use cheat dragging if cheats are enabled
-                               crosshair_trace_plusvisibletriggers(self);
+                               crosshair_trace_plusvisibletriggers(this);
                                Drag(true, true);
                        }
                        else
@@ -779,43 +779,43 @@ float Drag(float force_allow_pick, float ischeat)
        switch(0)
        {
                default:
-                       if(Drag_IsDragging(self))
+                       if(Drag_IsDragging(this))
                        {
-                               if(PHYS_INPUT_BUTTON_DRAG(self))
+                               if(PHYS_INPUT_BUTTON_DRAG(this))
                                {
-                                       if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+                                       if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
                                        {
-                                               Drag_MoveForward(self);
-                                               self.impulse = 0;
+                                               Drag_MoveForward(this);
+                                               this.impulse = 0;
                                        }
-                                       else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19)
+                                       else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
                                        {
-                                               Drag_MoveBackward(self);
-                                               self.impulse = 0;
+                                               Drag_MoveBackward(this);
+                                               this.impulse = 0;
                                        }
-                                       else if(self.impulse >= 1 && self.impulse <= 9)
+                                       else if(this.impulse >= 1 && this.impulse <= 9)
                                        {
-                                               Drag_SetSpeed(self, self.impulse - 1);
+                                               Drag_SetSpeed(this, this.impulse - 1);
                                        }
-                                       else if(self.impulse == 14)
+                                       else if(this.impulse == 14)
                                        {
-                                               Drag_SetSpeed(self, 9);
+                                               Drag_SetSpeed(this, 9);
                                        }
 
                                        if(frametime)
-                                               Drag_Update(self);
+                                               Drag_Update(this);
                                }
                                else
                                {
-                                       Drag_Finish(self);
+                                       Drag_Finish(this);
                                }
                        }
                        else
                        {
-                               if(Drag_CanDrag(self))
-                                       if(PHYS_INPUT_BUTTON_DRAG(self))
+                               if(Drag_CanDrag(this))
+                                       if(PHYS_INPUT_BUTTON_DRAG(this))
                                        {
-                                               crosshair_trace_plusvisibletriggers(self);
+                                               crosshair_trace_plusvisibletriggers(this);
                                                entity e = trace_ent;
                                                float pick = force_allow_pick;
                                                if (e && !pick)
@@ -825,18 +825,18 @@ float Drag(float force_allow_pick, float ischeat)
                                                        // This also makes sure that an object can only pe picked up if in range, but does not get dropped if
                                                        // it goes out of range while slinging it around.
 
-                                                       if(vlen(self.origin - e.origin) <= autocvar_g_grab_range)
+                                                       if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
                                                        {
                                                                switch(e.grab)
                                                                {
                                                                        case 0: // can't grab
                                                                                break;
                                                                        case 1: // owner can grab
-                                                                               if(e.owner == self || e.realowner == self)
+                                                                               if(e.owner == this || e.realowner == this)
                                                                                        pick = true;
                                                                                break;
                                                                        case 2: // owner and team mates can grab
-                                                                               if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
+                                                                               if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
                                                                                        pick = true;
                                                                                break;
                                                                        case 3: // anyone can grab
@@ -857,7 +857,7 @@ float Drag(float force_allow_pick, float ischeat)
                                                                        Drag_Finish(e.draggedby);
                                                                if(e.tag_entity)
                                                                        detach_sameorigin(e);
-                                                               Drag_Begin(self, e, trace_endpos);
+                                                               Drag_Begin(this, e, trace_endpos);
                                                                if(ischeat)
                                                                        DID_CHEAT();
                                                                return true;
@@ -1047,38 +1047,38 @@ void Drag_MoveDrag(entity from, entity to)
 
 void DragBox_Think()
 {SELFPARAM();
-       if(self.aiment && self.enemy)
+       if(this.aiment && this.enemy)
        {
-               self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
-               self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5;
-               self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5;
-               self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5;
-               self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5;
-               self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5;
-               self.mins = -1 * self.maxs;
-               setorigin(self, self.origin);
-               setsize(self, self.mins, self.maxs); // link edict
+               this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
+               this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
+               this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
+               this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
+               this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
+               this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
+               this.mins = -1 * this.maxs;
+               setorigin(this, this.origin);
+               setsize(this, this.mins, this.maxs); // link edict
        }
 
-       if(self.cnt == -1) // actually race_place -1
+       if(this.cnt == -1) // actually race_place -1
        {
                // show "10 10" for qualifying spawns
-               setmodel(self.killindicator, MDL_NUM(10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(10));
        }
-       else if(self.cnt == -2) // actually race_place 0
+       else if(this.cnt == -2) // actually race_place 0
        {
                // show "10 0" for loser spawns
-               setmodel(self.killindicator, MDL_NUM(10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(0));
+               setmodel(this.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(0));
        }
        else
        {
-               setmodel(self.killindicator, MDL_NUM(self.cnt % 10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(floor(self.cnt / 10)));
+               setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
        }
 
-       self.nextthink = time;
+       this.nextthink = time;
 }
 
 #endif
index 4ead519eb0ff563390abf8afaf409c1288e79872..97df2467bd207013cc8dbbe1cc7fc2fc853f0b02 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef CHEATS_H
-#define CHEATS_H
+#pragma once
 
-#include "../common/impulses/all.qh"
+#include <common/impulses/all.qh>
 
 //float autocvar_sv_cheats; // must... declare... global
 
@@ -16,4 +15,3 @@ float CheatFrame();
 const float CHRAME_DRAG = 8;
 
 void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
-#endif
index 6d5a4641a77e5dfec786c35c6cc12b75c1ef597b..9edcf8d5f0806097e3ea7b058d28e4f4c8e662ad 100644 (file)
@@ -25,6 +25,8 @@
 #include "../common/ent_cs.qh"
 #include <common/state.qh>
 
+#include <common/effects/qc/globalsound.qh>
+
 #include "../common/triggers/teleporters.qh"
 
 #include "../common/vehicles/all.qh"
 
 #include "../lib/warpzone/server.qh"
 
+STATIC_METHOD(Client, Add, void(Client this, int _team))
+{
+    WITHSELF(this, ClientConnect());
+    TRANSMUTE(Player, this);
+    this.frame = 12; // 7
+    this.team = _team;
+    WITHSELF(this, PutClientInServer());
+}
+
+void PutObserverInServer();
+void ClientDisconnect();
+
+STATIC_METHOD(Client, Remove, void(Client this))
+{
+    TRANSMUTE(Observer, this);
+    WITHSELF(this, PutClientInServer());
+    WITHSELF(this, ClientDisconnect());
+}
 
 void send_CSQC_teamnagger() {
        WriteHeader(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
@@ -87,14 +107,14 @@ bool ClientData_Send(entity this, entity to, int sf)
 void ClientData_Attach(entity this)
 {
        Net_LinkEntity(this.clientdata = new_pure(clientdata), false, 0, ClientData_Send);
-       self.clientdata.drawonlytoclient = this;
-       self.clientdata.owner = this;
+       this.clientdata.drawonlytoclient = this;
+       this.clientdata.owner = this;
 }
 
 void ClientData_Detach(entity this)
 {
        remove(this.clientdata);
-       self.clientdata = NULL;
+       this.clientdata = NULL;
 }
 
 void ClientData_Touch(entity e)
@@ -158,6 +178,8 @@ void setplayermodel(entity e, string modelname)
        precache_model(modelname);
        _setmodel(e, modelname);
        player_setupanimsformodel();
+       if(!autocvar_g_debug_globalsounds)
+               UpdatePlayerSounds(e);
 }
 
 void FixPlayermodel(entity player);
@@ -190,6 +212,12 @@ void PutObserverInServer()
         }
         // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
         // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
+        if(!autocvar_g_debug_globalsounds)
+        {
+               // needed for player sounds
+               this.model = "";
+               FixPlayermodel(this);
+        } 
         setmodel(this, MDL_Null);
         setsize(this, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL));
         this.view_ofs = '0 0 0';
@@ -236,7 +264,7 @@ void PutObserverInServer()
        this.spectatortime = time;
        this.bot_attack = false;
     this.hud = HUD_NORMAL;
-       this.classname = STR_OBSERVER;
+       TRANSMUTE(Observer, this);
        this.iscreature = false;
        this.teleportable = TELEPORT_SIMPLE;
        this.damagedbycontents = false;
@@ -380,6 +408,8 @@ void FixPlayermodel(entity player)
        if(chmdl || oldskin != player.skin) // model or skin has changed
        {
                player.species = player_getspecies(player); // update species
+               if(!autocvar_g_debug_globalsounds)
+                       UpdatePlayerSounds(player); // update skin sounds
        }
 
        if(!teamplay)
@@ -394,14 +424,14 @@ void PutClientInServer()
 {
        SELFPARAM();
        if (IS_BOT_CLIENT(this)) {
-               this.classname = STR_PLAYER;
+               TRANSMUTE(Player, this);
        } else if (IS_REAL_CLIENT(this)) {
                msg_entity = this;
                WriteByte(MSG_ONE, SVC_SETVIEW);
                WriteEntity(MSG_ONE, this);
        }
        if (gameover) {
-               this.classname = STR_OBSERVER;
+               TRANSMUTE(Observer, this);
        }
 
        SetSpectatee(this, NULL);
@@ -426,7 +456,7 @@ void PutClientInServer()
                        return; // spawn failed
                }
 
-               this.classname = STR_PLAYER;
+               TRANSMUTE(Player, this);
                this.wasplayer = true;
                this.iscreature = true;
                this.teleportable = TELEPORT_NORMAL;
@@ -578,7 +608,7 @@ void PutClientInServer()
                        string s = spot.target;
                        spot.target = string_null;
                        WITH(entity, activator, this, LAMBDA(
-                               WITH(entity, self, spot, SUB_UseTargets())
+                               WITHSELF(spot, SUB_UseTargets())
                        ));
                        spot.target = s;
                }
@@ -602,7 +632,7 @@ void PutClientInServer()
                if (!warmup_stage && !this.alivetime)
                        this.alivetime = time;
 
-               antilag_clear(this);
+               antilag_clear(this, CS(this));
        }
 }
 
@@ -625,6 +655,7 @@ bool ClientInit_SendEntity(entity this, entity to, int sf)
 }
 void ClientInit_misc()
 {
+    SELFPARAM();
        int channel = MSG_ONE;
        WriteHeader(channel, ENT_CLIENT_INIT);
        WriteByte(channel, g_nexball_meter_period * 32);
@@ -641,18 +672,18 @@ void ClientInit_misc()
                WriteString(channel, world.fog);
        else
                WriteString(channel, "");
-       WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
+       WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
        WriteByte(channel, serverflags); // client has to know if it should zoom or not
        WriteCoord(channel, autocvar_g_trueaim_minrange);
 }
 
 void ClientInit_CheckUpdate()
 {SELFPARAM();
-       self.nextthink = time;
-       if(self.count != autocvar_g_balance_armor_blockpercent)
+       this.nextthink = time;
+       if(this.count != autocvar_g_balance_armor_blockpercent)
        {
-               self.count = autocvar_g_balance_armor_blockpercent;
-               self.SendFlags |= 1;
+               this.count = autocvar_g_balance_armor_blockpercent;
+               this.SendFlags |= 1;
        }
 }
 
@@ -663,7 +694,7 @@ void ClientInit_Spawn()
        e.think = ClientInit_CheckUpdate;
        Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
 
-       WITH(entity, self, e, ClientInit_CheckUpdate());
+       WITHSELF(e, ClientInit_CheckUpdate());
 }
 
 /*
@@ -687,7 +718,7 @@ SetChangeParms
 void SetChangeParms ()
 {SELFPARAM();
        // save parms for level change
-       parm1 = self.parm_idlesince - time;
+       parm1 = this.parm_idlesince - time;
 
        MUTATOR_CALLHOOK(SetChangeParms);
 }
@@ -729,35 +760,35 @@ void ClientKill_Now_TeamChange(entity this)
        {
                if(blockSpectators)
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
-               WITH(entity, self, this, PutObserverInServer());
+               WITHSELF(this, PutObserverInServer());
        }
        else
-               WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+               WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1));
        this.killindicator_teamchange = 0;
 }
 
 void ClientKill_Now()
 {SELFPARAM();
-       if(self.vehicle)
+       if(this.vehicle)
        {
            vehicles_exit(VHEF_RELEASE);
-           if(!self.killindicator_teamchange)
+           if(!this.killindicator_teamchange)
            {
-            self.vehicle_health = -1;
-            Damage(self, self, self, 1 , DEATH_KILL.m_id, self.origin, '0 0 0');
+            this.vehicle_health = -1;
+            Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
            }
        }
 
-       if(self.killindicator && !wasfreed(self.killindicator))
-               remove(self.killindicator);
+       if(this.killindicator && !wasfreed(this.killindicator))
+               remove(this.killindicator);
 
-       self.killindicator = world;
+       this.killindicator = world;
 
-       if(self.killindicator_teamchange)
-               ClientKill_Now_TeamChange(self);
+       if(this.killindicator_teamchange)
+               ClientKill_Now_TeamChange(this);
 
-       if(IS_PLAYER(self))
-               Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+       if(IS_PLAYER(this))
+               Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
 
        // now I am sure the player IS dead
 }
@@ -765,39 +796,39 @@ void KillIndicator_Think()
 {SELFPARAM();
        if (gameover)
        {
-               self.owner.killindicator = world;
-               remove(self);
+               this.owner.killindicator = world;
+               remove(this);
                return;
        }
 
-       if (self.owner.alpha < 0 && !self.owner.vehicle)
+       if (this.owner.alpha < 0 && !this.owner.vehicle)
        {
-               self.owner.killindicator = world;
-               remove(self);
+               this.owner.killindicator = world;
+               remove(this);
                return;
        }
 
-       if(self.cnt <= 0)
+       if(this.cnt <= 0)
        {
-               WITH(entity, self, self.owner, ClientKill_Now());
+               WITHSELF(this.owner, ClientKill_Now());
                return;
        }
-    else if(g_cts && self.health == 1) // health == 1 means that it's silent
+    else if(g_cts && this.health == 1) // health == 1 means that it's silent
     {
-        self.nextthink = time + 1;
-        self.cnt -= 1;
+        this.nextthink = time + 1;
+        this.cnt -= 1;
     }
        else
        {
-               if(self.cnt <= 10)
-                       setmodel(self, MDL_NUM(self.cnt));
-               if(IS_REAL_CLIENT(self.owner))
+               if(this.cnt <= 10)
+                       setmodel(this, MDL_NUM(this.cnt));
+               if(IS_REAL_CLIENT(this.owner))
                {
-                       if(self.cnt <= 10)
-                               { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
+                       if(this.cnt <= 10)
+                               { Send_Notification(NOTIF_ONE, this.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, this.cnt)); }
                }
-               self.nextthink = time + 1;
-               self.cnt -= 1;
+               this.nextthink = time + 1;
+               this.cnt -= 1;
        }
 }
 
@@ -816,20 +847,20 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
        if(g_race_qualifying || g_cts)
                killtime = 0;
 
-    if(MUTATOR_CALLHOOK(ClientKill, self, killtime))
+    if(MUTATOR_CALLHOOK(ClientKill, this, killtime))
        return;
 
-       self.killindicator_teamchange = targetteam;
+       this.killindicator_teamchange = targetteam;
 
-    if(!self.killindicator)
+    if(!this.killindicator)
        {
-               if(!IS_DEAD(self))
+               if(!IS_DEAD(this))
                {
-                       killtime = max(killtime, self.clientkill_nexttime - time);
-                       self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
+                       killtime = max(killtime, this.clientkill_nexttime - time);
+                       this.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
                }
 
-               if(killtime <= 0 || !IS_PLAYER(self) || IS_DEAD(self))
+               if(killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this))
                {
                        ClientKill_Now();
                }
@@ -837,21 +868,21 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                {
                        starttime = max(time, clientkilltime);
 
-                       self.killindicator = spawn();
-                       self.killindicator.owner = self;
-                       self.killindicator.scale = 0.5;
-                       setattachment(self.killindicator, self, "");
-                       setorigin(self.killindicator, '0 0 52');
-                       self.killindicator.think = KillIndicator_Think;
-                       self.killindicator.nextthink = starttime + (self.lip) * 0.05;
-                       clientkilltime = max(clientkilltime, self.killindicator.nextthink + 0.05);
-                       self.killindicator.cnt = ceil(killtime);
-                       self.killindicator.count = bound(0, ceil(killtime), 10);
-                       //sprint(self, strcat("^1You'll be dead in ", ftos(self.killindicator.cnt), " seconds\n"));
+                       this.killindicator = spawn();
+                       this.killindicator.owner = this;
+                       this.killindicator.scale = 0.5;
+                       setattachment(this.killindicator, this, "");
+                       setorigin(this.killindicator, '0 0 52');
+                       this.killindicator.think = KillIndicator_Think;
+                       this.killindicator.nextthink = starttime + (this.lip) * 0.05;
+                       clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
+                       this.killindicator.cnt = ceil(killtime);
+                       this.killindicator.count = bound(0, ceil(killtime), 10);
+                       //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n"));
 
                        for(e = world; (e = find(e, classname, "body")) != world; )
                        {
-                               if(e.enemy != self)
+                               if(e.enemy != this)
                                        continue;
                                e.killindicator = spawn();
                                e.killindicator.owner = e;
@@ -863,38 +894,38 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                                clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
                                e.killindicator.cnt = ceil(killtime);
                        }
-                       self.lip = 0;
+                       this.lip = 0;
                }
        }
-       if(self.killindicator)
+       if(this.killindicator)
        {
                if(targetteam == 0) // just die
                {
-                       self.killindicator.colormod = '0 0 0';
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, self.killindicator.cnt);
+                       this.killindicator.colormod = '0 0 0';
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, this.killindicator.cnt);
                }
                else if(targetteam == -1) // auto
                {
-                       self.killindicator.colormod = '0 1 0';
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, self.killindicator.cnt);
+                       this.killindicator.colormod = '0 1 0';
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, this.killindicator.cnt);
                }
                else if(targetteam == -2) // spectate
                {
-                       self.killindicator.colormod = '0.5 0.5 0.5';
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
+                       this.killindicator.colormod = '0.5 0.5 0.5';
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, this.killindicator.cnt);
                }
                else
                {
-                       self.killindicator.colormod = Team_ColorRGB(targetteam);
-                       if(IS_REAL_CLIENT(self))
-                       if(self.killindicator.cnt > 0)
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
+                       this.killindicator.colormod = Team_ColorRGB(targetteam);
+                       if(IS_REAL_CLIENT(this))
+                       if(this.killindicator.cnt > 0)
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), this.killindicator.cnt);
                }
        }
 
@@ -903,8 +934,8 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
 void ClientKill ()
 {SELFPARAM();
        if(gameover) return;
-       if(self.player_blocked) return;
-       if(STAT(FROZEN, self)) return;
+       if(this.player_blocked) return;
+       if(STAT(FROZEN, this)) return;
 
        ClientKill_TeamChange(0);
 }
@@ -955,9 +986,9 @@ void ClientPreConnect ()
        if(autocvar_sv_eventlog)
        {
                GameLogEcho(sprintf(":connect:%d:%d:%s",
-                       self.playerid,
-                       etof(self),
-                       ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
+                       this.playerid,
+                       etof(this),
+                       ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot")
                ));
        }
 }
@@ -975,16 +1006,14 @@ void ClientConnect()
        SELFPARAM();
        if (Ban_MaybeEnforceBanOnce(this)) return;
        assert(!IS_CLIENT(this), return);
+       this.flags |= FL_CLIENT;
        assert(player_count >= 0, player_count = 0);
-       this.classname = "player_joining";
-       this.flags = FL_CLIENT;
 
 #ifdef WATERMARK
        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_WATERMARK, WATERMARK);
 #endif
        this.version_nagtime = time + 10 + random() * 10;
-
-       ClientState_attach(this);
+       TRANSMUTE(Client, this);
 
        // identify the right forced team
        if (autocvar_g_campaign)
@@ -1019,24 +1048,24 @@ void ClientConnect()
        }
        if (!teamplay && this.team_forced > 0) this.team_forced = 0;
 
-       JoinBestTeam(this, false, false); // if the team number is valid, keep it
+    {
+        int id = this.playerid;
+        this.playerid = 0; // silent
+           JoinBestTeam(this, false, false); // if the team number is valid, keep it
+           this.playerid = id;
+    }
 
        if (autocvar_sv_spectate || autocvar_g_campaign || this.team_forced < 0) {
-               this.classname = STR_OBSERVER;
+               TRANSMUTE(Observer, this);
        } else {
-               if (!teamplay || autocvar_g_balance_teams)
-               {
-                       this.classname = STR_PLAYER;
-                       campaign_bots_may_start = 1;
-               }
-               else
-               {
-                       this.classname = STR_OBSERVER; // do it anyway
+               if (!teamplay || autocvar_g_balance_teams) {
+                       TRANSMUTE(Player, this);
+                       campaign_bots_may_start = true;
+               } else {
+                       TRANSMUTE(Observer, this); // do it anyway
                }
        }
 
-       this.playerid = ++playerid_last;
-
        PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
 
        // always track bots, don't ask for cl_allow_uidtracking
@@ -1115,7 +1144,7 @@ void ClientConnect()
                sv_notice_join(this);
 
        FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
-               WITH(entity, self, it, it.init_for_player(it));
+               WITHSELF(it, it.init_for_player(it));
        });
 
        MUTATOR_CALLHOOK(ClientConnect, this);
@@ -1148,15 +1177,15 @@ void ClientDisconnect()
 
        ClientState_detach(this);
 
-       Portal_ClearAll(self);
+       Portal_ClearAll(this);
 
-       Unfreeze(self);
+       Unfreeze(this);
 
-       RemoveGrapplingHook(self);
+       RemoveGrapplingHook(this);
 
        // Here, everything has been done that requires this player to be a client.
 
-       self.flags &= ~FL_CLIENT;
+       this.flags &= ~FL_CLIENT;
 
        if (this.chatbubbleentity) remove(this.chatbubbleentity);
        if (this.killindicator) remove(this.killindicator);
@@ -1165,10 +1194,10 @@ void ClientDisconnect()
 
        bot_relinkplayerlist();
 
-       if (self.netname_previous) strunzone(self.netname_previous);
-       if (self.clientstatus) strunzone(self.clientstatus);
-       if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
-       if (self.personal) remove(self.personal);
+       if (this.netname_previous) strunzone(this.netname_previous);
+       if (this.clientstatus) strunzone(this.clientstatus);
+       if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse);
+       if (this.personal) remove(this.personal);
 
        this.playerid = 0;
        ReadyCount();
@@ -1177,49 +1206,49 @@ void ClientDisconnect()
 
 void ChatBubbleThink()
 {SELFPARAM();
-       self.nextthink = time;
-       if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self)
+       this.nextthink = time;
+       if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
        {
-               if(self.owner) // but why can that ever be world?
-                       self.owner.chatbubbleentity = world;
-               remove(self);
+               if(this.owner) // but why can that ever be world?
+                       this.owner.chatbubbleentity = world;
+               remove(this);
                return;
        }
 
-       self.mdl = "";
+       this.mdl = "";
 
-       if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) )
+       if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
        {
-               if ( self.owner.active_minigame )
-                       self.mdl = "models/sprites/minigame_busy.iqm";
-               else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
-                       self.mdl = "models/misc/chatbubble.spr";
+               if ( this.owner.active_minigame )
+                       this.mdl = "models/sprites/minigame_busy.iqm";
+               else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
+                       this.mdl = "models/misc/chatbubble.spr";
        }
 
-       if ( self.model != self.mdl )
-               _setmodel(self, self.mdl);
+       if ( this.model != this.mdl )
+               _setmodel(this, this.mdl);
 
 }
 
 void UpdateChatBubble()
 {SELFPARAM();
-       if (self.alpha < 0)
+       if (this.alpha < 0)
                return;
        // spawn a chatbubble entity if needed
-       if (!self.chatbubbleentity)
-       {
-               self.chatbubbleentity = new(chatbubbleentity);
-               self.chatbubbleentity.owner = self;
-               self.chatbubbleentity.exteriormodeltoclient = self;
-               self.chatbubbleentity.think = ChatBubbleThink;
-               self.chatbubbleentity.nextthink = time;
-               setmodel(self.chatbubbleentity, MDL_CHAT); // precision set below
-               //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
-               setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
-               setattachment(self.chatbubbleentity, self, "");  // sticks to moving player better, also conserves bandwidth
-               self.chatbubbleentity.mdl = self.chatbubbleentity.model;
-               //self.chatbubbleentity.model = "";
-               self.chatbubbleentity.effects = EF_LOWPRECISION;
+       if (!this.chatbubbleentity)
+       {
+               this.chatbubbleentity = new(chatbubbleentity);
+               this.chatbubbleentity.owner = this;
+               this.chatbubbleentity.exteriormodeltoclient = this;
+               this.chatbubbleentity.think = ChatBubbleThink;
+               this.chatbubbleentity.nextthink = time;
+               setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
+               //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
+               setorigin(this.chatbubbleentity, '0 0 15' + this.maxs_z * '0 0 1');
+               setattachment(this.chatbubbleentity, this, "");  // sticks to moving player better, also conserves bandwidth
+               this.chatbubbleentity.mdl = this.chatbubbleentity.model;
+               //this.chatbubbleentity.model = "";
+               this.chatbubbleentity.effects = EF_LOWPRECISION;
        }
 }
 
@@ -1229,162 +1258,163 @@ void UpdateChatBubble()
 /*void UpdateColorModHack()
 {
        float c;
-       c = self.clientcolors & 15;
+       c = this.clientcolors & 15;
        // LordHavoc: only bothering to support white, green, red, yellow, blue
-            if (!teamplay) self.colormod = '0 0 0';
-       else if (c ==  0) self.colormod = '1.00 1.00 1.00';
-       else if (c ==  3) self.colormod = '0.10 1.73 0.10';
-       else if (c ==  4) self.colormod = '1.73 0.10 0.10';
-       else if (c == 12) self.colormod = '1.22 1.22 0.10';
-       else if (c == 13) self.colormod = '0.10 0.10 1.73';
-       else self.colormod = '1 1 1';
+            if (!teamplay) this.colormod = '0 0 0';
+       else if (c ==  0) this.colormod = '1.00 1.00 1.00';
+       else if (c ==  3) this.colormod = '0.10 1.73 0.10';
+       else if (c ==  4) this.colormod = '1.73 0.10 0.10';
+       else if (c == 12) this.colormod = '1.22 1.22 0.10';
+       else if (c == 13) this.colormod = '0.10 0.10 1.73';
+       else this.colormod = '1 1 1';
 }*/
 
 void respawn()
 {SELFPARAM();
-       if(self.alpha >= 0 && autocvar_g_respawn_ghosts)
-       {
-               self.solid = SOLID_NOT;
-               self.takedamage = DAMAGE_NO;
-               self.movetype = MOVETYPE_FLY;
-               self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
-               self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
-               self.effects |= CSQCMODEL_EF_RESPAWNGHOST;
-               Send_Effect(EFFECT_RESPAWN_GHOST, self.origin, '0 0 0', 1);
+       if(this.alpha >= 0 && autocvar_g_respawn_ghosts)
+       {
+               this.solid = SOLID_NOT;
+               this.takedamage = DAMAGE_NO;
+               this.movetype = MOVETYPE_FLY;
+               this.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
+               this.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
+               this.effects |= CSQCMODEL_EF_RESPAWNGHOST;
+               Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1);
                if(autocvar_g_respawn_ghosts_maxtime)
-                       SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
+                       SUB_SetFade (this, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
        }
 
-       CopyBody(self, 1);
+       CopyBody(this, 1);
 
-       self.effects |= EF_NODRAW; // prevent another CopyBody
+       this.effects |= EF_NODRAW; // prevent another CopyBody
        PutClientInServer();
 }
 
-void play_countdown(float finished, string samp)
+void play_countdown(float finished, Sound samp)
 {SELFPARAM();
-       if(IS_REAL_CLIENT(self))
+    TC(Sound, samp);
+       if(IS_REAL_CLIENT(this))
                if(floor(finished - time - frametime) != floor(finished - time))
                        if(finished - time < 6)
-                               _sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
+                               sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
 }
 
 void player_powerups ()
 {SELFPARAM();
        // add a way to see what the items were BEFORE all of these checks for the mutator hook
-       int items_prev = self.items;
+       int items_prev = this.items;
 
-       if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover)
-               self.modelflags |= MF_ROCKET;
+       if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !gameover)
+               this.modelflags |= MF_ROCKET;
        else
-               self.modelflags &= ~MF_ROCKET;
+               this.modelflags &= ~MF_ROCKET;
 
-       self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
+       this.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
 
-       if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed
+       if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
                return;
 
-       Fire_ApplyDamage(self);
-       Fire_ApplyEffect(self);
+       Fire_ApplyDamage(this);
+       Fire_ApplyEffect(this);
 
        if (!g_instagib)
        {
-               if (self.items & ITEM_Strength.m_itemid)
+               if (this.items & ITEM_Strength.m_itemid)
                {
-                       play_countdown(self.strength_finished, SND(POWEROFF));
-                       self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
-                       if (time > self.strength_finished)
+                       play_countdown(this.strength_finished, SND_POWEROFF);
+                       this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
+                       if (time > this.strength_finished)
                        {
-                               self.items = self.items - (self.items & ITEM_Strength.m_itemid);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
+                               this.items = this.items - (this.items & ITEM_Strength.m_itemid);
+                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
                        }
                }
                else
                {
-                       if (time < self.strength_finished)
+                       if (time < this.strength_finished)
                        {
-                               self.items = self.items | ITEM_Strength.m_itemid;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH);
+                               this.items = this.items | ITEM_Strength.m_itemid;
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_STRENGTH);
                        }
                }
-               if (self.items & ITEM_Shield.m_itemid)
+               if (this.items & ITEM_Shield.m_itemid)
                {
-                       play_countdown(self.invincible_finished, SND(POWEROFF));
-                       self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
-                       if (time > self.invincible_finished)
+                       play_countdown(this.invincible_finished, SND_POWEROFF);
+                       this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
+                       if (time > this.invincible_finished)
                        {
-                               self.items = self.items - (self.items & ITEM_Shield.m_itemid);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
+                               this.items = this.items - (this.items & ITEM_Shield.m_itemid);
+                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
                        }
                }
                else
                {
-                       if (time < self.invincible_finished)
+                       if (time < this.invincible_finished)
                        {
-                               self.items = self.items | ITEM_Shield.m_itemid;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD);
+                               this.items = this.items | ITEM_Shield.m_itemid;
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_SHIELD);
                        }
                }
-               if (self.items & IT_SUPERWEAPON)
+               if (this.items & IT_SUPERWEAPON)
                {
-                       if (!(self.weapons & WEPSET_SUPERWEAPONS))
+                       if (!(this.weapons & WEPSET_SUPERWEAPONS))
                        {
-                               self.superweapons_finished = 0;
-                               self.items = self.items - (self.items & IT_SUPERWEAPON);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
+                               this.superweapons_finished = 0;
+                               this.items = this.items - (this.items & IT_SUPERWEAPON);
+                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
                        }
-                       else if (self.items & IT_UNLIMITED_SUPERWEAPONS)
+                       else if (this.items & IT_UNLIMITED_SUPERWEAPONS)
                        {
                                // don't let them run out
                        }
                        else
                        {
-                               play_countdown(self.superweapons_finished, SND(POWEROFF));
-                               if (time > self.superweapons_finished)
+                               play_countdown(this.superweapons_finished, SND_POWEROFF);
+                               if (time > this.superweapons_finished)
                                {
-                                       self.items = self.items - (self.items & IT_SUPERWEAPON);
-                                       self.weapons &= ~WEPSET_SUPERWEAPONS;
-                                       //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, self.netname);
-                                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
+                                       this.items = this.items - (this.items & IT_SUPERWEAPON);
+                                       this.weapons &= ~WEPSET_SUPERWEAPONS;
+                                       //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname);
+                                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
                                }
                        }
                }
-               else if(self.weapons & WEPSET_SUPERWEAPONS)
+               else if(this.weapons & WEPSET_SUPERWEAPONS)
                {
-                       if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
+                       if (time < this.superweapons_finished || (this.items & IT_UNLIMITED_SUPERWEAPONS))
                        {
-                               self.items = self.items | IT_SUPERWEAPON;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
+                               this.items = this.items | IT_SUPERWEAPON;
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname);
+                               Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
                        }
                        else
                        {
-                               self.superweapons_finished = 0;
-                               self.weapons &= ~WEPSET_SUPERWEAPONS;
+                               this.superweapons_finished = 0;
+                               this.weapons &= ~WEPSET_SUPERWEAPONS;
                        }
                }
                else
                {
-                       self.superweapons_finished = 0;
+                       this.superweapons_finished = 0;
                }
        }
 
        if(autocvar_g_nodepthtestplayers)
-               self.effects = self.effects | EF_NODEPTHTEST;
+               this.effects = this.effects | EF_NODEPTHTEST;
 
        if(autocvar_g_fullbrightplayers)
-               self.effects = self.effects | EF_FULLBRIGHT;
+               this.effects = this.effects | EF_FULLBRIGHT;
 
        if (time >= game_starttime)
-       if (time < self.spawnshieldtime)
-               self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
+       if (time < this.spawnshieldtime)
+               this.effects = this.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
 
-       MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev);
+       MUTATOR_CALLHOOK(PlayerPowerups, this, items_prev);
 }
 
 float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
@@ -1448,7 +1478,7 @@ void player_regen ()
        regen_health_stable = autocvar_g_balance_health_regenstable;
        regen_health_rotstable = autocvar_g_balance_health_rotstable;
        if(!MUTATOR_CALLHOOK(PlayerRegen))
-       if(!STAT(FROZEN, self))
+       if(!STAT(FROZEN, this))
        {
                float mina, maxa, limith, limita;
                maxa = autocvar_g_balance_armor_rotstable;
@@ -1466,21 +1496,21 @@ void player_regen ()
                limith = limith * limit_mod;
                limita = limita * limit_mod;
 
-               self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
-               self.health = CalcRotRegen(self.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > self.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith);
+               this.armorvalue = CalcRotRegen(this.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > this.pauserotarmor_finished), limita);
+               this.health = CalcRotRegen(this.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > this.pauserothealth_finished), limith);
        }
 
        // if player rotted to death...  die!
        // check this outside above checks, as player may still be able to rot to death
-       if(self.health < 1)
+       if(this.health < 1)
        {
-               if(self.vehicle)
+               if(this.vehicle)
                        vehicles_exit(VHEF_RELEASE);
-               if(self.event_damage)
-                       self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+               if(this.event_damage)
+                       this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0');
        }
 
-       if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+       if (!(this.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                float minf, maxf, limitf;
 
@@ -1488,19 +1518,19 @@ void player_regen ()
                minf = autocvar_g_balance_fuel_regenstable;
                limitf = autocvar_g_balance_fuel_limit;
 
-               self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+               this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
        }
 }
 
-float zoomstate_set;
+bool zoomstate_set;
 void SetZoomState(float z)
 {SELFPARAM();
-       if(z != self.zoomstate)
+       if(z != this.zoomstate)
        {
-               self.zoomstate = z;
-               ClientData_Touch(self);
+               this.zoomstate = z;
+               ClientData_Touch(this);
        }
-       zoomstate_set = 1;
+       zoomstate_set = true;
 }
 
 void GetPressedKeys()
@@ -1528,6 +1558,8 @@ spectate mode routines
 
 void SpectateCopy(entity this, entity spectatee)
 {
+    TC(Client, this); TC(Client, spectatee);
+
        MUTATOR_CALLHOOK(SpectateCopy, spectatee, this);
        PS(this) = PS(spectatee);
        this.armortype = spectatee.armortype;
@@ -1571,7 +1603,7 @@ void SpectateCopy(entity this, entity spectatee)
        setsize(this, spectatee.mins, spectatee.maxs);
        SetZoomState(spectatee.zoomstate);
 
-    anticheat_spectatecopy(spectatee);
+    anticheat_spectatecopy(this, spectatee);
        this.hud = spectatee.hud;
        if(spectatee.vehicle)
     {
@@ -1601,12 +1633,12 @@ void SpectateCopy(entity this, entity spectatee)
 
 bool SpectateUpdate()
 {SELFPARAM();
-       if(!self.enemy)
+       if(!this.enemy)
            return false;
 
-       if(!IS_PLAYER(self.enemy) || self == self.enemy)
+       if(!IS_PLAYER(this.enemy) || this == this.enemy)
        {
-               SetSpectatee(self, NULL);
+               SetSpectatee(this, NULL);
                return false;
        }
 
@@ -1617,14 +1649,14 @@ bool SpectateUpdate()
 
 bool SpectateSet()
 {SELFPARAM();
-       if(!IS_PLAYER(self.enemy))
+       if(!IS_PLAYER(this.enemy))
                return false;
 
-       msg_entity = self;
+       msg_entity = this;
        WriteByte(MSG_ONE, SVC_SETVIEW);
-       WriteEntity(MSG_ONE, self.enemy);
-       self.movetype = MOVETYPE_NONE;
-       accuracy_resend(self);
+       WriteEntity(MSG_ONE, this.enemy);
+       this.movetype = MOVETYPE_NONE;
+       accuracy_resend(this);
 
        if(!SpectateUpdate())
                PutObserverInServer();
@@ -1646,24 +1678,24 @@ void SetSpectatee(entity player, entity spectatee)
 
 bool Spectate(entity pl)
 {SELFPARAM();
-       if(MUTATOR_CALLHOOK(SpectateSet, self, pl))
+       if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
                return false;
        pl = spec_player;
 
-       SetSpectatee(self, pl);
+       SetSpectatee(this, pl);
        return SpectateSet();
 }
 
 bool SpectateNext()
 {SELFPARAM();
-       other = find(self.enemy, classname, STR_PLAYER);
+       other = find(this.enemy, classname, STR_PLAYER);
 
-       if (MUTATOR_CALLHOOK(SpectateNext, self, other))
+       if (MUTATOR_CALLHOOK(SpectateNext, this, other))
                other = spec_player;
        else if (!other)
                other = find(other, classname, STR_PLAYER);
 
-       if(other) { SetSpectatee(self, other); }
+       if(other) { SetSpectatee(this, other); }
 
        return SpectateSet();
 }
@@ -1677,11 +1709,11 @@ bool SpectatePrev()
 
        entity first = other;
        // skip players until current spectated player
-       if(self.enemy)
-       while(other && other != self.enemy)
+       if(this.enemy)
+       while(other && other != this.enemy)
                other = other.chain;
 
-       switch (MUTATOR_CALLHOOK(SpectatePrev, self, other, first))
+       switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first))
        {
                case MUT_SPECPREV_FOUND:
                    other = spec_player;
@@ -1700,7 +1732,7 @@ bool SpectatePrev()
                }
        }
 
-       SetSpectatee(self, other);
+       SetSpectatee(this, other);
        return SpectateSet();
 }
 
@@ -1714,51 +1746,51 @@ Update a respawn countdown display.
 void ShowRespawnCountdown()
 {SELFPARAM();
        float number;
-       if(!IS_DEAD(self)) // just respawned?
+       if(!IS_DEAD(this)) // just respawned?
                return;
        else
        {
-               number = ceil(self.respawn_time - time);
+               number = ceil(this.respawn_time - time);
                if(number <= 0)
                        return;
-               if(number <= self.respawn_countdown)
+               if(number <= this.respawn_countdown)
                {
-                       self.respawn_countdown = number - 1;
-                       if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
-                               { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
+                       this.respawn_countdown = number - 1;
+                       if(ceil(this.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
+                               { Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
                }
        }
 }
 
 void LeaveSpectatorMode()
 {SELFPARAM();
-       if(self.caplayer)
+       if(this.caplayer)
                return;
-       if(nJoinAllowed(self, self))
+       if(nJoinAllowed(this, this))
        {
-               if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0)
+               if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
                {
-                       self.classname = STR_PLAYER;
+                       TRANSMUTE(Player, this);
 
                        if(autocvar_g_campaign || autocvar_g_balance_teams)
-                               { JoinBestTeam(self, false, true); }
+                               { JoinBestTeam(this, false, true); }
 
                        if(autocvar_g_campaign)
-                               { campaign_bots_may_start = 1; }
+                               { campaign_bots_may_start = true; }
 
-                       Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
+                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
 
                        PutClientInServer();
 
-                       if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
+                       if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
                }
                else
-                       stuffcmd(self, "menu_showteamselect\n");
+                       stuffcmd(this, "menu_showteamselect\n");
        }
        else
        {
                // Player may not join because g_maxplayers is set
-               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT);
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
        }
 }
 
@@ -1809,92 +1841,92 @@ bool nJoinAllowed(entity this, entity ignore)
  */
 void checkSpectatorBlock()
 {SELFPARAM();
-       if(IS_SPEC(self) || IS_OBSERVER(self))
-       if(!self.caplayer)
-       if(IS_REAL_CLIENT(self))
+       if(IS_SPEC(this) || IS_OBSERVER(this))
+       if(!this.caplayer)
+       if(IS_REAL_CLIENT(this))
        {
-               if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
-                       dropclient(self);
+               if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
+                       dropclient(this);
                }
        }
 }
 
-void PrintWelcomeMessage()
-{SELFPARAM();
-       if(self.motd_actived_time == 0)
+void PrintWelcomeMessage(entity this)
+{
+       if(this.motd_actived_time == 0)
        {
                if (autocvar_g_campaign) {
-                       if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
-                               self.motd_actived_time = time;
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
+                       if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
+                               this.motd_actived_time = time;
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
                        }
                } else {
-                       if (PHYS_INPUT_BUTTON_INFO(self)) {
-                               self.motd_actived_time = time;
-                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+                       if (PHYS_INPUT_BUTTON_INFO(this)) {
+                               this.motd_actived_time = time;
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
                        }
                }
        }
-       else if(self.motd_actived_time > 0) // showing MOTD or campaign message
+       else if(this.motd_actived_time > 0) // showing MOTD or campaign message
        {
                if (autocvar_g_campaign) {
-                       if (PHYS_INPUT_BUTTON_INFO(self))
-                               self.motd_actived_time = time;
-                       else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
-                               self.motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+                       if (PHYS_INPUT_BUTTON_INFO(this))
+                               this.motd_actived_time = time;
+                       else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
+                               this.motd_actived_time = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                        }
                } else {
-                       if (PHYS_INPUT_BUTTON_INFO(self))
-                               self.motd_actived_time = time;
-                       else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
-                               self.motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+                       if (PHYS_INPUT_BUTTON_INFO(this))
+                               this.motd_actived_time = time;
+                       else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+                               this.motd_actived_time = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                        }
                }
        }
-       else //if(self.motd_actived_time < 0) // just connected, motd is active
+       else //if(this.motd_actived_time < 0) // just connected, motd is active
        {
-               if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
-                       self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
-               else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
+               if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
+                       this.motd_actived_time = -2; // wait until BUTTON_INFO gets released
+               else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
                {
                        // instanctly hide MOTD
-                       self.motd_actived_time = 0;
-                       Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+                       this.motd_actived_time = 0;
+                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                }
        }
 }
 
 void ObserverThink()
 {SELFPARAM();
-       if ( self.impulse )
+       if ( this.impulse )
        {
-               MinigameImpulse(self, self.impulse);
-               self.impulse = 0;
+               MinigameImpulse(this, this.impulse);
+               this.impulse = 0;
        }
        float prefered_movetype;
-       if (self.flags & FL_JUMPRELEASED) {
-               if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
-                       self.flags &= ~FL_JUMPRELEASED;
-                       self.flags |= FL_SPAWNING;
-               } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
-                       self.flags &= ~FL_JUMPRELEASED;
+       if (this.flags & FL_JUMPRELEASED) {
+               if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+                       this.flags &= ~FL_JUMPRELEASED;
+                       this.flags |= FL_SPAWNING;
+               } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
+                       this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext()) {
-                               self.classname = STR_SPECTATOR;
+                               TRANSMUTE(Spectator, this);
                        }
                } else {
-                       prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
-                       if (self.movetype != prefered_movetype)
-                               self.movetype = prefered_movetype;
+                       prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+                       if (this.movetype != prefered_movetype)
+                               this.movetype = prefered_movetype;
                }
        } else {
-               if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
-                       self.flags |= FL_JUMPRELEASED;
-                       if(self.flags & FL_SPAWNING)
+               if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this))) {
+                       this.flags |= FL_JUMPRELEASED;
+                       if(this.flags & FL_SPAWNING)
                        {
-                               self.flags &= ~FL_SPAWNING;
+                               this.flags &= ~FL_SPAWNING;
                                LeaveSpectatorMode();
                                return;
                        }
@@ -1904,47 +1936,47 @@ void ObserverThink()
 
 void SpectatorThink()
 {SELFPARAM();
-       if ( self.impulse )
+       if ( this.impulse )
        {
-               if(MinigameImpulse(self, self.impulse))
-                       self.impulse = 0;
-       }
-       if (self.flags & FL_JUMPRELEASED) {
-               if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
-                       self.flags &= ~FL_JUMPRELEASED;
-                       self.flags |= FL_SPAWNING;
-               } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
-                       self.flags &= ~FL_JUMPRELEASED;
+               if(MinigameImpulse(this, this.impulse))
+                       this.impulse = 0;
+       }
+       if (this.flags & FL_JUMPRELEASED) {
+               if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+                       this.flags &= ~FL_JUMPRELEASED;
+                       this.flags |= FL_SPAWNING;
+               } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+                       this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext()) {
-                               self.classname = STR_SPECTATOR;
+                               TRANSMUTE(Spectator, this);
                        } else {
-                               self.classname = STR_OBSERVER;
+                               TRANSMUTE(Observer, this);
                                PutClientInServer();
                        }
-                       self.impulse = 0;
-               } else if(self.impulse == 12 || self.impulse == 16  || self.impulse == 19 || (self.impulse >= 220 && self.impulse <= 229)) {
-                       self.flags &= ~FL_JUMPRELEASED;
+                       this.impulse = 0;
+               } else if(this.impulse == 12 || this.impulse == 16  || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+                       this.flags &= ~FL_JUMPRELEASED;
                        if(SpectatePrev()) {
-                               self.classname = STR_SPECTATOR;
+                               TRANSMUTE(Spectator, this);
                        } else {
-                               self.classname = STR_OBSERVER;
+                               TRANSMUTE(Observer, this);
                                PutClientInServer();
                        }
-                       self.impulse = 0;
-               } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
-                       self.flags &= ~FL_JUMPRELEASED;
-                       self.classname = STR_OBSERVER;
+                       this.impulse = 0;
+               } else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
+                       this.flags &= ~FL_JUMPRELEASED;
+                       TRANSMUTE(Observer, this);
                        PutClientInServer();
                } else {
                        if(!SpectateUpdate())
                                PutObserverInServer();
                }
        } else {
-               if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
-                       self.flags |= FL_JUMPRELEASED;
-                       if(self.flags & FL_SPAWNING)
+               if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) {
+                       this.flags |= FL_JUMPRELEASED;
+                       if(this.flags & FL_SPAWNING)
                        {
-                               self.flags &= ~FL_SPAWNING;
+                               this.flags &= ~FL_SPAWNING;
                                LeaveSpectatorMode();
                                return;
                        }
@@ -1953,16 +1985,16 @@ void SpectatorThink()
                        PutObserverInServer();
        }
 
-       self.flags |= FL_CLIENT | FL_NOTARGET;
+       this.flags |= FL_CLIENT | FL_NOTARGET;
 }
 
 void vehicles_enter (entity pl, entity veh);
 void PlayerUseKey()
 {SELFPARAM();
-       if (!IS_PLAYER(self))
+       if (!IS_PLAYER(this))
                return;
 
-       if(self.vehicle)
+       if(this.vehicle)
        {
                if(!gameover)
                {
@@ -1972,23 +2004,23 @@ void PlayerUseKey()
        }
        else if(autocvar_g_vehicles_enter)
        {
-               if(!STAT(FROZEN, self))
-               if(!IS_DEAD(self))
+               if(!STAT(FROZEN, this))
+               if(!IS_DEAD(this))
                if(!gameover)
                {
                        entity head, closest_target = world;
-                       head = WarpZone_FindRadius(self.origin, autocvar_g_vehicles_enter_radius, true);
+                       head = WarpZone_FindRadius(this.origin, autocvar_g_vehicles_enter_radius, true);
 
                        while(head) // find the closest acceptable target to enter
                        {
                                if(head.vehicle_flags & VHF_ISVEHICLE)
                                if(!IS_DEAD(head))
-                               if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, self)))
+                               if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this)))
                                if(head.takedamage != DAMAGE_NO)
                                {
                                        if(closest_target)
                                        {
-                                               if(vlen(self.origin - head.origin) < vlen(self.origin - closest_target.origin))
+                                               if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin))
                                                { closest_target = head; }
                                        }
                                        else { closest_target = head; }
@@ -1997,7 +2029,7 @@ void PlayerUseKey()
                                head = head.chain;
                        }
 
-                       if(closest_target) { vehicles_enter(self, closest_target); return; }
+                       if(closest_target) { vehicles_enter(this, closest_target); return; }
                }
        }
 
@@ -2018,372 +2050,317 @@ void() nexball_setstatus;
 .float last_vehiclecheck;
 .int items_added;
 void PlayerPreThink ()
-{SELFPARAM();
-       WarpZone_PlayerPhysics_FixVAngle();
+{
+    SELFPARAM();
+       WarpZone_PlayerPhysics_FixVAngle(this);
 
-       self.stat_game_starttime = game_starttime;
-       self.stat_round_starttime = round_starttime;
-       self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam;
-       self.stat_leadlimit = autocvar_leadlimit;
+    STAT(GAMESTARTTIME, this) = game_starttime;
+       STAT(ROUNDSTARTTIME, this) = round_starttime;
+       STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
+       STAT(LEADLIMIT, this) = autocvar_leadlimit;
 
-       self.weaponsinmap = weaponsInMap;
+       STAT(WEAPONSINMAP, this) = weaponsInMap;
 
-       if(frametime)
-       {
+       if (frametime) {
                // physics frames: update anticheat stuff
-               anticheat_prethink();
+               anticheat_prethink(this);
        }
 
-       if(blockSpectators && frametime)
-               // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+       if (blockSpectators && frametime) {
+               // WORKAROUND: only use dropclient in server frames (frametime set).
+               // Never use it in cl_movement frames (frametime zero).
                checkSpectatorBlock();
+    }
 
-       zoomstate_set = 0;
-
-       // Savage: Check for nameless players
-       if (isInvisibleString(self.netname)) {
-               string new_name = strzone(strcat("Player@", ftos(self.playerid)));
-               if(autocvar_sv_eventlog)
-                       GameLogEcho(strcat(":name:", ftos(self.playerid), ":", new_name));
-               if(self.netname_previous)
-                       strunzone(self.netname_previous);
-               self.netname_previous = strzone(new_name);
-               self.netname = self.netname_previous;
-               // stuffcmd(self, strcat("name ", self.netname, "\n"));
-       } else if(self.netname_previous != self.netname) {
-               if(autocvar_sv_eventlog)
-                       GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname));
-               if(self.netname_previous)
-                       strunzone(self.netname_previous);
-               self.netname_previous = strzone(self.netname);
+       zoomstate_set = false;
+
+       // Check for nameless players
+       if (isInvisibleString(this.netname)) {
+               this.netname = strzone(sprintf("Player#%d", this.playerid));
+               // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
+       }
+       if (this.netname != this.netname_previous) {
+               if (autocvar_sv_eventlog) {
+                       GameLogEcho(strcat(":name:", ftos(this.playerid), ":", this.netname));
+        }
+               if (this.netname_previous) strunzone(this.netname_previous);
+               this.netname_previous = strzone(this.netname);
        }
 
        // version nagging
-       if(self.version_nagtime)
-               if(self.cvar_g_xonoticversion)
-                       if(time > self.version_nagtime)
-                       {
-                               // don't notify git users
-                               if(strstr(self.cvar_g_xonoticversion, "git", 0) < 0 && strstr(self.cvar_g_xonoticversion, "autobuild", 0) < 0)
-                               {
-                                       if(strstr(autocvar_g_xonoticversion, "git", 0) >= 0 || strstr(autocvar_g_xonoticversion, "autobuild", 0) >= 0)
-                                       {
-                                               // notify release users if connecting to git
-                                               LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
-                                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
-                                       }
-                                       else
-                                       {
-                                               float r;
-                                               r = vercmp(self.cvar_g_xonoticversion, autocvar_g_xonoticversion);
-                                               if(r < 0)
-                                               {
-                                                       // give users new version
-                                                       LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n");
-                                                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
-                                               }
-                                               else if(r > 0)
-                                               {
-                                                       // notify users about old server version
-                                                       LOG_INFO("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
-                                                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
-                                               }
-                                       }
-                               }
-                               self.version_nagtime = 0;
-                       }
+       if (this.version_nagtime && this.cvar_g_xonoticversion && time > this.version_nagtime) {
+        this.version_nagtime = 0;
+        if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+            // git client
+        } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
+            // git server
+            Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+        } else {
+            int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+            if (r < 0) { // old client
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+            } else if (r > 0) { // old server
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+            }
+        }
+    }
 
        // GOD MODE info
-       if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
+       if (!(this.flags & FL_GODMODE) && this.max_armorvalue)
        {
-               Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_GODMODE_OFF, self.max_armorvalue);
-               self.max_armorvalue = 0;
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_GODMODE_OFF, this.max_armorvalue);
+               this.max_armorvalue = 0;
        }
 
-       if(STAT(FROZEN, self) == 2)
+       if (STAT(FROZEN, this) == 2)
        {
-               self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
-               self.health = max(1, self.revive_progress * start_health);
-               self.iceblock.alpha = bound(0.2, 1 - self.revive_progress, 1);
+               this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+               this.health = max(1, this.revive_progress * start_health);
+               this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
 
-               if(self.revive_progress >= 1)
-                       Unfreeze(self);
+               if (this.revive_progress >= 1)
+                       Unfreeze(this);
        }
-       else if(STAT(FROZEN, self) == 3)
+       else if (STAT(FROZEN, this) == 3)
        {
-               self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
-               self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
+               this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+               this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
 
-               if(self.health < 1)
+               if (this.health < 1)
                {
-                       if(self.vehicle)
+                       if (this.vehicle)
                                vehicles_exit(VHEF_RELEASE);
-                       self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+                       this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
                }
-               else if ( self.revive_progress <= 0 )
-                       Unfreeze(self);
+               else if (this.revive_progress <= 0)
+                       Unfreeze(this);
        }
 
        MUTATOR_CALLHOOK(PlayerPreThink);
 
        if(autocvar_g_vehicles_enter)
-       if(time > self.last_vehiclecheck)
-       if(IS_PLAYER(self))
+       if(time > this.last_vehiclecheck)
+       if(IS_PLAYER(this))
        if(!gameover)
-       if(!STAT(FROZEN, self))
-       if(!self.vehicle)
-       if(!IS_DEAD(self))
+       if(!STAT(FROZEN, this))
+       if(!this.vehicle)
+       if(!IS_DEAD(this))
        {
                entity veh;
                for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
-               if(vlen(veh.origin - self.origin) < autocvar_g_vehicles_enter_radius)
+               if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius)
                if(!IS_DEAD(veh))
                if(veh.takedamage != DAMAGE_NO)
-               if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, self))
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
+               if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this))
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
                else if(!veh.owner)
-               if(!veh.team || SAME_TEAM(self, veh))
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER);
+               if(!veh.team || SAME_TEAM(this, veh))
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER);
                else if(autocvar_g_vehicles_steal)
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
 
-               self.last_vehiclecheck = time + 1;
+               this.last_vehiclecheck = time + 1;
        }
 
-       if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+       if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
        {
-               if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
+               if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed)
                        PlayerUseKey();
-               self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
+               this.usekeypressed = PHYS_INPUT_BUTTON_USE(this);
        }
 
-       if(IS_REAL_CLIENT(self))
-               PrintWelcomeMessage();
-
-       if(IS_PLAYER(self))
-       {
+       if (IS_REAL_CLIENT(this))
+               PrintWelcomeMessage(this);
 
+       if (IS_PLAYER(this)) {
                CheckRules_Player();
 
-               if (intermission_running)
-               {
-                       IntermissionThink ();   // otherwise a button could be missed between
-                       return;                                 // the think tics
+               if (intermission_running) {
+                       IntermissionThink();
+                       return;
                }
 
-               //don't allow the player to turn around while game is paused!
-               if(timeout_status == TIMEOUT_ACTIVE) {
+               if (timeout_status == TIMEOUT_ACTIVE) {
+            // don't allow the player to turn around while game is paused
                        // FIXME turn this into CSQC stuff
-                       self.v_angle = self.lastV_angle;
-                       self.angles = self.lastV_angle;
-                       self.fixangle = true;
+                       this.v_angle = this.lastV_angle;
+                       this.angles = this.lastV_angle;
+                       this.fixangle = true;
                }
 
-               if(frametime)
-               {
-                       player_powerups();
-               }
+               if (frametime) player_powerups();
 
-               if (IS_DEAD(self))
-               {
-                       if(self.personal && g_race_qualifying)
-                       {
-                               if(time > self.respawn_time)
-                               {
-                                       self.respawn_time = time + 1; // only retry once a second
-                                       self.stat_respawn_time = self.respawn_time;
+               if (IS_DEAD(this)) {
+                       if (this.personal && g_race_qualifying) {
+                               if (time > this.respawn_time) {
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
                                        respawn();
-                                       self.impulse = 141;
-                               }
-                       }
-                       else
-                       {
-                               float button_pressed;
-                               if(frametime)
-                                       player_anim();
-                               button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
-
-                               if (self.deadflag == DEAD_DYING)
-                               {
-                                       if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
-                                               self.deadflag = DEAD_RESPAWNING;
-                                       else if(!button_pressed)
-                                               self.deadflag = DEAD_DEAD;
+                                       this.impulse = CHIMPULSE_SPEEDRUN.impulse;
                                }
-                               else if (self.deadflag == DEAD_DEAD)
-                               {
-                                       if(button_pressed)
-                                               self.deadflag = DEAD_RESPAWNABLE;
-                                       else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
-                                               self.deadflag = DEAD_RESPAWNING;
-                               }
-                               else if (self.deadflag == DEAD_RESPAWNABLE)
-                               {
-                                       if(!button_pressed)
-                                               self.deadflag = DEAD_RESPAWNING;
-                               }
-                               else if (self.deadflag == DEAD_RESPAWNING)
-                               {
-                                       if(time > self.respawn_time)
-                                       {
-                                               self.respawn_time = time + 1; // only retry once a second
-                                               self.respawn_time_max = self.respawn_time;
+                       } else {
+                               if (frametime) player_anim();
+                               bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
+
+                               if (this.deadflag == DEAD_DYING) {
+                                       if ((this.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max) {
+                                               this.deadflag = DEAD_RESPAWNING;
+                                       } else if (!button_pressed) {
+                                               this.deadflag = DEAD_DEAD;
+                    }
+                               } else if (this.deadflag == DEAD_DEAD) {
+                                       if (button_pressed) {
+                                               this.deadflag = DEAD_RESPAWNABLE;
+                                       } else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) {
+                                               this.deadflag = DEAD_RESPAWNING;
+                    }
+                               } else if (this.deadflag == DEAD_RESPAWNABLE) {
+                                       if (!button_pressed) {
+                                               this.deadflag = DEAD_RESPAWNING;
+                    }
+                               } else if (this.deadflag == DEAD_RESPAWNING) {
+                                       if (time > this.respawn_time) {
+                                               this.respawn_time = time + 1; // only retry once a second
+                                               this.respawn_time_max = this.respawn_time;
                                                respawn();
                                        }
                                }
 
                                ShowRespawnCountdown();
 
-                               if(self.respawn_flags & RESPAWN_SILENT)
-                                       self.stat_respawn_time = 0;
-                               else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
-                                       self.stat_respawn_time = self.respawn_time_max;
+                               if (this.respawn_flags & RESPAWN_SILENT)
+                                       STAT(RESPAWN_TIME, this) = 0;
+                               else if ((this.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time_max;
                                else
-                                       self.stat_respawn_time = self.respawn_time;
+                                       STAT(RESPAWN_TIME, this) = this.respawn_time;
                        }
 
                        // if respawning, invert stat_respawn_time to indicate this, the client translates it
-                       if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0)
-                               self.stat_respawn_time *= -1;
+                       if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
+                               STAT(RESPAWN_TIME, this) *= -1;
 
                        return;
                }
 
-               self.prevorigin = self.origin;
-
-               float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
-               if(self.hook.state)
-                       do_crouch = 0;
-               if(self.vehicle)
-                       do_crouch = 0;
-               if(STAT(FROZEN, self))
-                       do_crouch = 0;
+               this.prevorigin = this.origin;
 
-               // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
-               // It cannot be predicted by the engine!
-               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-               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;
+               bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+               if (this.hook.state) {
+                       do_crouch = false;
+               } else if (this.vehicle) {
+                       do_crouch = false;
+               } else if (STAT(FROZEN, this)) {
+                       do_crouch = false;
+        } else if ((PS(this).m_weapon == WEP_SHOTGUN || PS(this).m_weapon == WEP_SHOCKWAVE) && this.(weaponentity).wframe == WFRAME_FIRE2 && time < this.(weaponentity).weapon_nextthink) {
+                   // WEAPONTODO: predict
+                       do_crouch = false;
+        }
 
-               if (do_crouch)
-               {
-                       if (!self.crouch)
-                       {
-                               self.crouch = true;
-                               self.view_ofs = STAT(PL_CROUCH_VIEW_OFS, self);
-                               setsize (self, STAT(PL_CROUCH_MIN, self), STAT(PL_CROUCH_MAX, self));
-                               // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway
-                       }
-               }
-               else
-               {
-                       if (self.crouch)
-                       {
-                               tracebox(self.origin, STAT(PL_MIN, self), STAT(PL_MAX, self), self.origin, false, self);
-                               if (!trace_startsolid)
-                               {
-                                       self.crouch = false;
-                                       self.view_ofs = STAT(PL_VIEW_OFS, self);
-                                       setsize (self, STAT(PL_MIN, self), STAT(PL_MAX, self));
-                               }
+               if (do_crouch) {
+                       if (!this.crouch) {
+                               this.crouch = true;
+                               this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+                               setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
+                               // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
                        }
+               } else if (this.crouch) {
+            tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+            if (!trace_startsolid) {
+                this.crouch = false;
+                this.view_ofs = STAT(PL_VIEW_OFS, this);
+                setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+            }
                }
 
-               FixPlayermodel(self);
+               FixPlayermodel(this);
 
                // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
                //if(frametime)
                {
-                       self.items &= ~self.items_added;
+                       this.items &= ~this.items_added;
 
-                       W_WeaponFrame(self);
+                       W_WeaponFrame(this);
 
-                       self.items_added = 0;
-                       if(self.items & ITEM_Jetpack.m_itemid)
-                               if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01)
-                                       self.items_added |= IT_FUEL;
+                       this.items_added = 0;
+                       if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))
+                this.items_added |= IT_FUEL;
 
-                       self.items |= self.items_added;
+                       this.items |= this.items_added;
                }
 
                player_regen();
 
                // WEAPONTODO: Add a weapon request for this
                // rot vortex charge to the charge limit
-               if(WEP_CVAR(vortex, charge_rot_rate) && self.vortex_charge > WEP_CVAR(vortex, charge_limit) && self.vortex_charge_rottime < time)
-                       self.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), self.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+               if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time)
+                       this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
 
-               if(frametime)
-                       player_anim();
+               if (frametime) player_anim();
 
                // secret status
                secrets_setstatus();
 
                // monsters status
-               monsters_setstatus(self);
-
-               self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+               monsters_setstatus(this);
 
-               //self.angles_y=self.v_angle_y + 90;   // temp
-       } else if(gameover) {
-               if (intermission_running)
-                       IntermissionThink ();   // otherwise a button could be missed between
+               this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+       }
+       else if (gameover) {
+               if (intermission_running) IntermissionThink();
                return;
-       } else if(IS_OBSERVER(self)) {
+       }
+       else if (IS_OBSERVER(this)) {
                ObserverThink();
-       } else if(IS_SPEC(self)) {
+       }
+       else if (IS_SPEC(this)) {
                SpectatorThink();
        }
 
        // WEAPONTODO: Add weapon request for this
-       if(!zoomstate_set)
+       if (!zoomstate_set) {
                SetZoomState(
-                       PHYS_INPUT_BUTTON_ZOOM(self)
-                       || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
-                       || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
-                       || (PHYS_INPUT_BUTTON_ATCK2(self) && 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 = etof(self.enemy);
-       else if(IS_OBSERVER(self))
-               self.spectatee_status = etof(self);
-       else
-               self.spectatee_status = 0;
-       if(self.spectatee_status != oldspectatee_status)
-       {
-               ClientData_Touch(self);
-               if(g_race || g_cts)
-                       race_InitSpectator();
+                       PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this)
+                       || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX)
+                       || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+               );
+    }
+
+       int oldspectatee_status = this.spectatee_status;
+       if (IS_SPEC(this)) {
+               this.spectatee_status = etof(this.enemy);
+       } else if (IS_OBSERVER(this)) {
+               this.spectatee_status = etof(this);
+       } else {
+               this.spectatee_status = 0;
+    }
+       if (this.spectatee_status != oldspectatee_status) {
+               ClientData_Touch(this);
+               if (g_race || g_cts) race_InitSpectator();
        }
 
-       if(self.teamkill_soundtime)
-       if(time > self.teamkill_soundtime)
+       if (this.teamkill_soundtime && time > this.teamkill_soundtime)
        {
-               self.teamkill_soundtime = 0;
+               this.teamkill_soundtime = 0;
 
-               entity e = self.teamkill_soundsource;
+               entity e = this.teamkill_soundsource;
                entity oldpusher = e.pusher;
                e.pusher = this;
                PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY);
                e.pusher = oldpusher;
        }
 
-       if(self.taunt_soundtime)
-       if(time > self.taunt_soundtime)
-       {
-               self.taunt_soundtime = 0;
-               PlayerSound(self, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
+       if (this.taunt_soundtime && time > this.taunt_soundtime) {
+               this.taunt_soundtime = 0;
+               PlayerSound(this, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
        }
 
-       target_voicescript_next(self);
+       target_voicescript_next(this);
 
        // 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 (PS(self).m_weapon == WEP_Null)
-               self.clip_load = self.clip_size = 0;
+       if (PS(this).m_weapon == WEP_Null)
+               this.clip_load = this.clip_size = 0;
 }
 
 void DrownPlayer(entity this)
@@ -2417,39 +2394,38 @@ Called every frame for each client after the physics are run
 */
 .float idlekick_lasttimeleft;
 void PlayerPostThink ()
-{SELFPARAM();
-       if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
-       if(IS_REAL_CLIENT(self))
-       if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
+{
+    SELFPARAM();
+       if (sv_maxidle > 0)
+       if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+       if (IS_REAL_CLIENT(this))
+       if (IS_PLAYER(this) || sv_maxidle_spectatorsareidle)
        {
-               if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10
+               if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
-                       if(self.idlekick_lasttimeleft)
+                       if (this.idlekick_lasttimeleft)
                        {
-                               self.idlekick_lasttimeleft = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
+                               this.idlekick_lasttimeleft = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
                        }
                }
                else
                {
-                       float timeleft;
-                       timeleft = ceil(sv_maxidle - (time - self.parm_idlesince));
-                       if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10
-                       {
-                               if(!self.idlekick_lasttimeleft)
-                                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
+                       float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+                       if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
+                               if (!this.idlekick_lasttimeleft)
+                                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
                        }
-                       if(timeleft <= 0)
-                       {
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, self.netname);
-                               dropclient(self);
+                       if (timeleft <= 0) {
+                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname);
+                               dropclient(this);
                                return;
                        }
-                       else if(timeleft <= 10)
-                       {
-                               if(timeleft != self.idlekick_lasttimeleft)
-                                       { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
-                               self.idlekick_lasttimeleft = timeleft;
+                       else if (timeleft <= 10) {
+                               if (timeleft != this.idlekick_lasttimeleft) {
+                                   Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
+                }
+                               this.idlekick_lasttimeleft = timeleft;
                        }
                }
        }
@@ -2458,37 +2434,21 @@ void PlayerPostThink ()
 
        //CheckPlayerJump();
 
-       if(IS_PLAYER(self)) {
-               DrownPlayer(self);
+       if (IS_PLAYER(this)) {
+               DrownPlayer(this);
                CheckRules_Player();
                UpdateChatBubble();
-               if (self.impulse)
-                       ImpulseCommands(self);
-               if (intermission_running)
-                       return;         // intermission or finale
+               if (this.impulse) ImpulseCommands(this);
+               if (intermission_running) return; // intermission or finale
                GetPressedKeys();
        }
 
-       /*
-       float i;
-       for(i = 0; i < 1000; ++i)
-       {
-               vector end;
-               end = self.origin + '0 0 1024' + 512 * randomvec();
-               tracebox(self.origin, self.mins, self.maxs, end, MOVE_NORMAL, self);
-               if(trace_fraction < 1)
-               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
-               {
-                       print("I HIT SOLID: ", vtos(self.origin), " -> ", vtos(end), "\n");
-                       break;
-               }
-       }
-       */
-
-       if(self.waypointsprite_attachedforcarrier)
-               WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
+       if (this.waypointsprite_attachedforcarrier) {
+           vector v = healtharmor_maxdamage(this.health, this.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id);
+               WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, '1 0 0' * v);
+    }
 
        playerdemo_write();
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
index b4c125c6bac84f93aad5bedb1a63ed83eb231c7f..337c4db838c3e73ed0b95b60fd58658d22315cb2 100644 (file)
@@ -1,8 +1,105 @@
-#ifndef CL_CLIENT_H
-#define CL_CLIENT_H
+#pragma once
+
+void ClientState_attach(entity this);
+
+CLASS(Client, Object)
+    /** Client name */
+    ATTRIB(Client, netname, string, this.netname)
+    ATTRIB(Client, colormap, int, this.colormap)
+    ATTRIB(Client, team, int, this.team)
+    ATTRIB(Client, clientcolors, int, this.clientcolors)
+    /** Client IP */
+    ATTRIB(Client, netaddress, string, this.netaddress)
+    ATTRIB(Client, playermodel, string, this.playermodel)
+    ATTRIB(Client, playerskin, int, this.playerskin)
+
+    /** fingerprint of CA key the player used to authenticate */
+    ATTRIB(Client, crypto_keyfp, string, this.crypto_keyfp)
+    /** fingerprint of CA key the server used to authenticate to the player */
+    ATTRIB(Client, crypto_mykeyfp, string, this.crypto_mykeyfp)
+    /** fingerprint of ID used by the player entity, or string_null if not identified */
+    ATTRIB(Client, crypto_idfp, string, this.crypto_idfp)
+    /** set if the player's ID has been signed */
+    ATTRIB(Client, crypto_idfp_signed, bool, this.crypto_idfp_signed)
+    /** the string "AES128" if encrypting, and string_null if plaintext */
+    ATTRIB(Client, crypto_encryptmethod, string, this.crypto_encryptmethod)
+    /** the string "HMAC-SHA256" if signing, and string_null if plaintext */
+    ATTRIB(Client, crypto_signmethod, string, this.crypto_signmethod)
+
+    // custom
+
+    ATTRIB(Client, playerid, int, this.playerid)
+
+    METHOD(Client, m_unwind, bool(Client this));
+
+    STATIC_METHOD(Client, Add, void(Client this, int _team));
+    STATIC_METHOD(Client, Remove, void(Client this));
+
+    INIT(Client) {
+        if (this.m_unwind(this)) return this;
+        make_impure(this);
+        this.classname = "player_joining";
+        static int playerid_last;
+        this.playerid = ++playerid_last;
+        ClientState_attach(this);
+    }
+    DESTRUCTOR(Client) {
+        Client_Remove(this);
+    }
+    CONSTRUCTOR(Client, string name) {
+        CONSTRUCT(Client);
+        this.netname = name;
+        this.netaddress = "local";
+        this.playermodel = "models/player/megaerebus.iqm";
+    }
+ENDCLASS(Client)
+
+CLASS(Observer, Client)
+    INIT(Observer) {
+        this.classname = STR_OBSERVER;
+    }
+    DESTRUCTOR(Observer) { }
+ENDCLASS(Observer)
+
+CLASS(Spectator, Client)
+    INIT(Spectator) {
+        this.classname = STR_SPECTATOR;
+    }
+    DESTRUCTOR(Spectator) { }
+ENDCLASS(Spectator)
+
+CLASS(Player, Client)
+    INIT(Player) {
+        this.classname = STR_PLAYER;
+    }
+    DESTRUCTOR(Player) { }
+ENDCLASS(Player)
+
+METHOD(Client, m_unwind, bool(Client this))
+{
+    TC(Client, this);
+    #define UNWIND(class) MACRO_BEGIN if (this.instanceOf##class) { METHOD_REFERENCE(class, dtorimpl)(this); } MACRO_END
+    switch (this.classname) {
+        case "Observer":
+            UNWIND(Spectator);
+            UNWIND(Player);
+            return true;
+        case "Spectator":
+            UNWIND(Observer);
+            UNWIND(Player);
+            return true;
+        case "Player":
+            UNWIND(Observer);
+            UNWIND(Spectator);
+            return true;
+    }
+    #undef UNWIND
+    return false;
+}
+
 float c1, c2, c3, c4;
 
-void play_countdown(float finished, string samp);
+void play_countdown(float finished, Sound samp);
 
 float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit);
 
@@ -10,5 +107,3 @@ float Spectate(entity pl);
 
 #define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee)
 #define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); }
-
-#endif
index 926eeacea5e2f4303d79f1682de98bcc4b62d3f1..14779525fdaa53cfe83c95bde9cbc04be2d4daa5 100644 (file)
@@ -1,3 +1,4 @@
+#include "cl_impulse.qh"
 #include "round_handler.qh"
 
 #include "bot/waypoints.qh"
@@ -10,6 +11,8 @@
 #include "weapons/tracing.qh"
 #include "weapons/weaponsystem.qh"
 
+#include <common/state.qh>
+
 #include "../common/minigames/sv_minigames.qh"
 
 #include "../common/weapons/all.qh"
@@ -515,7 +518,7 @@ IMPULSE(navwaypoint_unreachable)
                e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
        }
        entity e2 = navigation_findnearestwaypoint(this, false);
-       navigation_markroutes(e2);
+       navigation_markroutes(this, e2);
 
        int i, m;
 
index aecf079b787f35cf8022f38ba23205675272eee1..50edc2c9c5e80c956cc1405f8b00fc56eea5b3ef 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef CL_IMPULSE_H
-#define CL_IMPULSE_H
+#pragma once
 
 void ImpulseCommands(entity this);
-#endif
index 46743ce2e16955be47952b6321dd50c6212e8fa2..42904695c693b35e39835bed217e3c78ef2635c8 100644 (file)
@@ -9,6 +9,7 @@
 #include "teamplay.qh"
 #include "weapons/throwing.qh"
 #include "command/common.qh"
+#include "../common/state.qh"
 #include "../common/anim.qh"
 #include "../common/animdecide.qh"
 #include "../common/csqcmodel_settings.qh"
@@ -19,6 +20,8 @@
 
 #include "../common/minigames/sv_minigames.qh"
 
+#include "../common/physics/player.qh"
+#include "../common/effects/qc/all.qh"
 #include "../common/mutators/mutator/waypoints/waypointsprites.qh"
 #include "../common/triggers/include.qh"
 
@@ -36,17 +39,17 @@ void Drop_Special_Items(entity player)
 
 void CopyBody_Think()
 {SELFPARAM();
-       if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
+       if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
        {
-               self.CopyBody_think();
-               if(wasfreed(self))
+               this.CopyBody_think();
+               if(wasfreed(this))
                        return;
-               self.CopyBody_nextthink = self.nextthink;
-               self.CopyBody_think = self.think;
-               self.think = CopyBody_Think;
+               this.CopyBody_nextthink = this.nextthink;
+               this.CopyBody_think = this.think;
+               this.think = CopyBody_Think;
        }
-       CSQCMODEL_AUTOUPDATE(self);
-       self.nextthink = time;
+       CSQCMODEL_AUTOUPDATE(this);
+       this.nextthink = time;
 }
 void CopyBody(entity this, float keepvelocity)
 {
@@ -132,8 +135,8 @@ void player_setupanimsformodel()
 
 void player_anim ()
 {SELFPARAM();
-       int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
-       if(IS_DEAD(self)) {
+       int deadbits = (this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+       if(IS_DEAD(this)) {
                if (!deadbits) {
                        // Decide on which death animation to use.
                        if(random() < 0.5)
@@ -146,14 +149,14 @@ void player_anim ()
                deadbits = 0;
        }
        int animbits = deadbits;
-       if(STAT(FROZEN, self))
+       if(STAT(FROZEN, this))
                animbits |= ANIMSTATE_FROZEN;
-       if(self.movetype == MOVETYPE_FOLLOW)
+       if(this.movetype == MOVETYPE_FOLLOW)
                animbits |= ANIMSTATE_FOLLOW;
-       if(self.crouch)
+       if(this.crouch)
                animbits |= ANIMSTATE_DUCK;
-       animdecide_setstate(self, animbits, false);
-       animdecide_setimplicitstate(self, IS_ONGROUND(self));
+       animdecide_setstate(this, animbits, false);
+       animdecide_setimplicitstate(this, IS_ONGROUND(this));
 }
 
 void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -553,7 +556,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                excess = frag_damage;
 
                Weapon wep = PS(this).m_weapon;
-               WITH(entity, self, this, wep.wr_playerdeath(wep));
+               WITHSELF(this, wep.wr_playerdeath(wep));
 
                RemoveGrapplingHook(this);
 
@@ -634,7 +637,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                // reset fields the weapons may use just in case
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       WITH(entity, self, this, it.wr_resetplayer(it));
+                       WITHSELF(this, it.wr_resetplayer(it));
                        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {
                                ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
index 3d95cdab9ea57b0145437bf6b549bad80905c291..22c595f66d3cd9ca4a59ce2e507e0d9f65dc2524 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CL_PLAYER_H
-#define CL_PLAYER_H
+#pragma once
 
 .entity pusher;
 .float pushltime;
@@ -38,5 +37,3 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 /** to be used by `prvm_edictset server playernumber muted 1` */
 .float muted;
 int Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol);
-
-#endif
diff --git a/qcsrc/server/command/_mod.inc b/qcsrc/server/command/_mod.inc
new file mode 100644 (file)
index 0000000..1f2b37a
--- /dev/null
@@ -0,0 +1,9 @@
+// generated file; do not modify
+#include "all.qc"
+#include "banning.qc"
+#include "cmd.qc"
+#include "common.qc"
+#include "getreplies.qc"
+#include "radarmap.qc"
+#include "sv_cmd.qc"
+#include "vote.qc"
index a15ae46deb4156ac4b89da54a39e77fb55c856e4..bc15eeb689560fbaa07b91647cbd6cbe15ff1bdd 100644 (file)
@@ -1,10 +1,2 @@
+#include "all.qh"
 #include <common/command/all.qc>
-
-#include "sv_cmd.qc"
-
-#include "banning.qc"
-#include "cmd.qc"
-#include "common.qc"
-#include "getreplies.qc"
-#include "radarmap.qc"
-#include "vote.qc"
index 0d74ec2739518fe6e487bca835ec0b11a45844bf..cde5ef367abedccba08a358e74ff7c4c7014dd21 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_COMMANDS_ALL_H
-#define SERVER_COMMANDS_ALL_H
+#pragma once
 
 #include <common/command/command.qh>
 REGISTRY(SERVER_COMMANDS, BITS(7))
@@ -13,7 +12,7 @@ REGISTRY_SORT(SERVER_COMMANDS)
        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))
+       METHOD(servercommand_##id, m_invokecmd, void(servercommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(SERVER_COMMANDS_aliases) {
        FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv"))));
@@ -27,5 +26,3 @@ STATIC_INIT(SERVER_COMMANDS_aliases) {
 #include "getreplies.qh"
 #include "radarmap.qh"
 #include "vote.qh"
-
-#endif
index 9c7eb00ca637b909a076b562f02a3e9f72b8074d..d6968c262de869826bd4f82db3247e514bbfdd2b 100644 (file)
@@ -1,3 +1,4 @@
+#include "banning.qh"
 #include <common/command/command.qh>
 #include "banning.qh"
 
index a330ff1b0b9e1781a4b54f3482f42e23ba0c3016..d6b1ae60f0f779511ca65dd6830323c134c91fe3 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef BANNING_H
-#define BANNING_H
+#pragma once
 
 // ====================================
 //  Declarations for kick/ban commands
@@ -19,5 +18,3 @@ void BanCommand_macro_write_aliases(float fh);
 
 void BanCommand_macro_help();
 float BanCommand_macro_usage(float argc);
-
-#endif
index 9246f7aa1f4da938fb5cbc4cc1d007e76a785fa5..e7cc3d4578c8a811d7509db00a23954ef785f50a 100644 (file)
@@ -1,5 +1,5 @@
-#include <common/command/command.qh>
 #include "cmd.qh"
+#include <common/command/command.qh>
 
 #include "common.qh"
 #include "vote.qh"
@@ -20,6 +20,7 @@
 
 #include <common/constants.qh>
 #include <common/deathtypes/all.qh>
+#include <common/effects/all.qh>
 #include <common/mapinfo.qh>
 #include <common/notifications/all.qh>
 #include <common/physics/player.qh>
@@ -116,7 +117,7 @@ void ClientCommand_clientversion(float request, float argc)  // internal command
                                        }
                                        else if (teamplay && !autocvar_sv_spectate && !(self.team_forced > 0))
                                        {
-                                               self.classname = STR_OBSERVER;  // really?
+                                               TRANSMUTE(Observer, self);  // really?
                                                stuffcmd(self, "menu_showteamselect\n");
                                        }
                                }
@@ -176,8 +177,8 @@ void ClientCommand_join(float request)
                                        if (self.caplayer) return;
                                        if (nJoinAllowed(self, self))
                                        {
-                                               if (autocvar_g_campaign)   campaign_bots_may_start = 1;
-                                               self.classname = STR_PLAYER;
+                                               if (autocvar_g_campaign)   campaign_bots_may_start = true;
+                                               TRANSMUTE(Player, self);
                                                PlayerScore_Clear(self);
                                                Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
                                                Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && self.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname);
@@ -470,7 +471,7 @@ void ClientCommand_sentcvar(float request, float argc, string command)
                                        tokenize_console(s);
                                }
 
-                               GetCvars(1);
+                               GetCvars(this, 1);
 
                                return;
                        }
@@ -732,7 +733,7 @@ void SV_ParseClientCommand(string command)
        if (command != command2) return;
 
        // if we're banned, don't even parse the command
-       if (Ban_MaybeEnforceBanOnce(self)) return;
+       if (Ban_MaybeEnforceBanOnce(this)) return;
 
        float argc = tokenize_console(command);
 
@@ -764,17 +765,17 @@ void SV_ParseClientCommand(string command)
        {
                if (argc == 1)
                {
-                       sprint(self, "\nClient networked commands:\n");
+                       sprint(this, "\nClient networked commands:\n");
                        ClientCommand_macro_help();
 
-                       sprint(self, "\nCommon networked commands:\n");
-                       CommonCommand_macro_help(self);
+                       sprint(this, "\nCommon networked commands:\n");
+                       CommonCommand_macro_help(this);
 
-                       sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
-                       sprint(self, "For help about a specific command, type cmd help COMMAND\n");
+                       sprint(this, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
+                       sprint(this, "For help about a specific command, type cmd help COMMAND\n");
                        return;
                }
-               else if (CommonCommand_macro_usage(argc, self))  // Instead of trying to call a command, we're going to see detailed information about it
+               else if (CommonCommand_macro_usage(argc, this))  // Instead of trying to call a command, we're going to see detailed information about it
                {
                        return;
                }
@@ -791,7 +792,7 @@ void SV_ParseClientCommand(string command)
        {
                return;  // handled by server/cheats.qc
        }
-       else if (CommonCommand_macro_command(argc, self, command))
+       else if (CommonCommand_macro_command(argc, this, command))
        {
                return;                                          // handled by server/command/common.qc
        }
@@ -801,6 +802,6 @@ void SV_ParseClientCommand(string command)
        }
        else
        {
-               clientcommand(self, command);
+               clientcommand(this, command);
        }
 }
index 1f2365822a4551ced188153991e3fa5045bb9a93..0dd27dd89582681a0ac510a832fe850ddb5797c9 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CMD_H
-#define CMD_H
+#pragma once
 
 // =================================================
 //  Declarations for server side networked commands
@@ -14,4 +13,3 @@ string MapVote_Suggest(string m);
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
 void ClientCommand_macro_write_aliases(float fh);
-#endif
index d2a8f6ec9b7cb8341514b111ea82d437a2f9d028..14965d8c73be1189f3c0abb44675cd0af0ffcedc 100644 (file)
@@ -1,3 +1,4 @@
+#include "common.qh"
 #include <common/command/command.qh>
 #include "common.qh"
 
@@ -320,7 +321,6 @@ void CommonCommand_cvar_purechanges(float request, entity caller)
 
 void CommonCommand_editmob(int request, entity caller, int argc)
 {
-       SELFPARAM();
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
index 6aed511e1bc45c898dc8d7db98cbb28ebd1e195e..b79a570209ff46f7c0f2a10f73634443034cc0d3 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef COMMAND_COMMON_H
-#define COMMAND_COMMON_H
+#pragma once
 
 #include <common/command/command.qh>
 REGISTRY(COMMON_COMMANDS, BITS(7))
@@ -13,7 +12,7 @@ REGISTRY_SORT(COMMON_COMMANDS)
        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))
+       METHOD(commoncommand_##id, m_invokecmd, void(commoncommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(COMMON_COMMANDS_aliases) {
        FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
@@ -166,7 +165,7 @@ float CommonCommand_macro_command(float argc, entity caller, string command)
 {
        string c = strtolower(argv(0));
        FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
-               it.m_invokecmd(CMD_REQUEST_COMMAND, caller, argc, command);
+               it.m_invokecmd(it, CMD_REQUEST_COMMAND, caller, argc, command);
                return true;
        ));
        return false;
@@ -176,7 +175,7 @@ float CommonCommand_macro_usage(float argc, entity caller)
 {
        string c = strtolower(argv(1));
        FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
-               it.m_invokecmd(CMD_REQUEST_USAGE, caller, argc, "");
+               it.m_invokecmd(it, CMD_REQUEST_USAGE, caller, argc, "");
                return true;
        ));
        return false;
@@ -186,6 +185,3 @@ void CommonCommand_macro_write_aliases(float fh)
 {
        FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description)));
 }
-
-
-#endif
index ea61290e5adc45f2588eddcaa2640a2fafecf5d3..83a746b7a50b734faa8a35fdb09f9d46d22c43b6 100644 (file)
@@ -1,3 +1,4 @@
+#include "getreplies.qh"
 #include <common/command/command.qh>
 #include "getreplies.qh"
 
index a0f9b21ef8fae18214da4fa6d47fa34954b1952e..7b436079227f47c1d1621cb891b5bd87400122c0 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef GETREPLIES_H
-#define GETREPLIES_H
+#pragma once
 
 // ======================================================
 //  Declarations for reply messages, re-worked by Samual
@@ -21,4 +20,3 @@ string getladder();
 string getmaplist();
 string getlsmaps();
 string getmonsterlist();
-#endif
index cec53d4f33baef9a4340457a89c5d90a31802529..5105a5b19cc42d715cd37d382e86975b5c44e938 100644 (file)
@@ -1,3 +1,4 @@
+#include "radarmap.qh"
 #include <common/command/command.qh>
 #include "radarmap.qh"
 
index fea60ba9e1143238181d3f5a131ea7034edcb3f7..4332003f8f4cd15aa885cc14afd7698ca46fcca7 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef RADARMAP_H
-#define RADARMAP_H
+#pragma once
 
 // ===========================================
 //     Declarations for radarmap generation code
@@ -16,6 +15,3 @@ string doublehex = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D
 // removes the need to bound()
 
 float RadarMap_Make(float argc);
-
-
-#endif
index 056cb0db4f7b20b3e7a0565bd0d53770b6905ac7..02e984e3c587e5eec84957cf6c628014c64e110c 100644 (file)
@@ -1,3 +1,4 @@
+#include "sv_cmd.qh"
 #include "all.qh"
 
 #include "banning.qh"
@@ -198,7 +199,7 @@ void GameCommand_allspec(float request, float argc)
                        int n = 0;
                        FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
                                if (it.caplayer) it.caplayer = 0;
-                               WITH(entity, self, it, PutObserverInServer());
+                               WITHSELF(it, PutObserverInServer());
                                ++n;
                        ));
                        if (n)   bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
@@ -219,7 +220,6 @@ void GameCommand_allspec(float request, float argc)
 
 void GameCommand_anticheat(float request, float argc)
 {
-       SELFPARAM();
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
@@ -229,7 +229,7 @@ void GameCommand_anticheat(float request, float argc)
 
                        if (accepted > 0)
                        {
-                               WITH(entity, self, client, anticheat_report());
+                               anticheat_report(client);
                                return;
                        }
                        else
@@ -1028,7 +1028,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                if (!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        if (client.caplayer) client.caplayer = 0;
-                                                       WITH(entity, self, client, PutObserverInServer());
+                                                       WITHSELF(client, PutObserverInServer());
 
                                                        successful = strcat(successful, (successful ? ", " : ""), client.netname);
                                                }
@@ -1178,7 +1178,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                        return;
                                                }
 
-                                               WITH(entity, self, client, playerdemo_open_read(argv(next_token)));
+                                               WITHSELF(client, playerdemo_open_read(argv(next_token)));
                                                return;
                                        }
 
@@ -1193,7 +1193,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                        return;
                                                }
 
-                                               WITH(entity, self, client, playerdemo_open_write(argv(next_token)));
+                                               WITHSELF(client, playerdemo_open_write(argv(next_token)));
                                                return;
                                        }
 
@@ -1780,7 +1780,7 @@ float GameCommand_macro_command(float argc, string command)
 {
        string c = strtolower(argv(0));
        FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
-               it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+               it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
                return true;
        ));
        return false;
@@ -1790,7 +1790,7 @@ float GameCommand_macro_usage(float argc)
 {
        string c = strtolower(argv(1));
        FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
-               it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+               it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
                return true;
        ));
        return false;
index 8fa66dac47567fe28f92a42505fbdeebff80d646..29db3ee4df20d5edd5c4f4614ca5fccc1f5b16b9 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SV_CMD_H
-#define SV_CMD_H
+#pragma once
 
 // =================================================
 //  Declarations for server side game commands
@@ -17,4 +16,3 @@ float shuffleteams_teams[SHUFFLETEAMS_MAX_TEAMS];     // maximum of 4 teams
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
 void GameCommand_macro_write_aliases(float fh);
-#endif
index 1e00e85629629072775531d0c579c0dc327de2a7..4bd8dee6e5d15d30c953db2971caf57f1b8868b2 100644 (file)
@@ -1,3 +1,4 @@
+#include "vote.qh"
 #include <common/command/command.qh>
 #include "vote.qh"
 
@@ -340,22 +341,22 @@ void reset_map(bool dorespawn)
 
        MUTATOR_CALLHOOK(reset_map_global);
 
-       FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
+       FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
                if (it.reset)
                {
-                       WITH(entity, self, it, it.reset(it));
+                       WITHSELF(it, it.reset(it));
                        continue;
                }
                if (it.team_saved) it.team = it.team_saved;
                if (it.flags & FL_PROJECTILE) remove(it);  // remove any projectiles left
-       ));
+       });
 
        // Waypoints and assault start come LAST
-       FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
-               if (it.reset2) WITH(entity, self, it, it.reset2());
-       ));
+       FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
+               if (it.reset2) WITHSELF(it, it.reset2());
+       });
 
-       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITH(entity, self, it, Unfreeze(it))));
+       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITHSELF(it, Unfreeze(it))));
 
        // Moving the player reset code here since the player-reset depends
        // on spawnpoint entities which have to be reset first --blub
index 0cab6c1d4a7559bcd5cf9f9381b664ebc79d2486..7b10b37eb70bcf2a0e50a45fb105b14846d7b59c 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef VOTE_H
-#define VOTE_H
+#pragma once
 
 // ================================================
 //  Declarations for the vote system/vote commands
@@ -55,4 +54,3 @@ void reset_map(float dorespawn);
 void ReadyCount();
 void ReadyRestart_force();
 void VoteCount(float first_count);
-#endif
index c1ea1c6c61dcab81aa2df27e52f5b10377605d4e..c8717f0058afdbf92e8bd703edb5f8c20d8a7fed 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_CONSTANTS_H
-#define SERVER_CONSTANTS_H
+#pragma once
 
 const int FL_WEAPON = BIT(13);
 const int FL_POWERUP = BIT(14);
@@ -19,5 +18,3 @@ const int RESPAWN_SILENT = 2;
 const int NUM_PLAYERSKINS_TEAMPLAY = 3;
 
 const int ASSAULT_VALUE_INACTIVE = 1000;
-
-#endif
index 27755db96f7cf1122731515f0849210c51f34e21..7124e4468f3f6cf82878c23ec71b251cad460760 100644 (file)
@@ -1,15 +1,14 @@
-#ifndef SERVER_DEFS_H
-#define SERVER_DEFS_H
+#pragma once
 
-#include "../common/weapons/all.qh"
-#include "../common/stats.qh"
+float warmup_limit;
+#include <common/weapons/all.qh>
+#include <common/stats.qh>
 
 #define INDEPENDENT_ATTACK_FINISHED 1
 
 // Globals
 
 float g_footsteps, g_grappling_hook, g_instagib;
-float g_warmup_limit;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;
 float warmup_stage;
@@ -172,7 +171,6 @@ bool nJoinAllowed(entity this, entity ignore);
 .entity flagcarried;
 
 .int playerid;
-float playerid_last;
 .float noalign;                // if set to 1, the item or spawnpoint won't be dropped to the floor
 
 .vector death_origin;
@@ -215,7 +213,6 @@ void FixClientCvars(entity e);
 WepSet weaponsInMap;
 
 #define weapons _STAT(WEAPONS)
-#define weaponsinmap _STAT(WEAPONSINMAP)
 
 .float respawn_countdown; // next number to count
 
@@ -287,8 +284,6 @@ float cvar_purechanges_count;
 
 float game_starttime; //point in time when the countdown to game start is over
 float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime = _STAT(GAMESTARTTIME);
-.float stat_round_starttime = _STAT(ROUNDSTARTTIME);
 
 void W_Porto_Remove (entity p);
 
@@ -296,8 +291,6 @@ void W_Porto_Remove (entity p);
 
 .string message2;
 
-.bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
-
 // reset to 0 on weapon switch
 // may be useful to all weapons
 .float bulletcounter;
@@ -344,8 +337,6 @@ string matchid;
 
 .float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
 
-.float stat_leadlimit = _STAT(LEADLIMIT);
-
 bool radar_showennemies;
 
 #ifdef PROFILING
@@ -380,7 +371,7 @@ float client_cefc_accumulatortime;
 
 string deathmessage;
 
-.float just_joined;
+.bool just_joined;
 
 .float cvar_cl_weaponimpulsemode;
 .float selectweapon; // last selected weapon of the player
@@ -417,7 +408,7 @@ const float ACTIVE_TOGGLE   = 3;
 
 void PlayerUseKey();
 
-typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
+USING(spawn_evalfunc_t, vector(entity player, entity spot, vector current));
 .spawn_evalfunc_t spawn_evalfunc;
 
 string modname;
@@ -452,5 +443,3 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 
 .float init_for_player_needed;
 .void(entity) init_for_player;
-
-#endif
index 37ccf37ebd8e43247ad795c7dec27272fca96bcd..208ae62e59365a347c18e3477c863bca8f506d06 100644 (file)
@@ -5,6 +5,8 @@
 #include "mutators/all.qh"
 #include "scores.qh"
 #include "spawnpoints.qh"
+#include "../common/state.qh"
+#include "../common/physics/player.qh"
 #include "../common/t_items.qh"
 #include "../common/vehicles/all.qh"
 #include "../common/items/all.qc"
@@ -538,7 +540,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        targ.iceblock = ice;
        targ.revival_time = 0;
 
-       WITH(entity, self, ice, Ice_Think());
+       WITHSELF(ice, Ice_Think());
 
        RemoveGrapplingHook(targ);
 
@@ -551,6 +553,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
 
 void Unfreeze (entity targ)
 {
+    SELFPARAM();
        if(!STAT(FROZEN, targ))
                return;
 
index 6a8ca99b462c878e1d30c581c3e6dfccd6246ae9..ca5c45b9efd3c01282d965cd812abd15b64c8cb2 100644 (file)
@@ -1,28 +1,27 @@
-#ifndef G_DAMAGE_H
-#define G_DAMAGE_H
+#pragma once
 
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
-    #include "../lib/warpzone/common.qh"
-    #include "../common/constants.qh"
-    #include "../common/teams.qh"
-    #include "../common/util.qh"
-    #include "../common/weapons/all.qh"
+    #include <lib/warpzone/common.qh>
+    #include <common/constants.qh>
+    #include <common/teams.qh>
+    #include <common/util.qh>
+    #include <common/weapons/all.qh>
     #include "weapons/accuracy.qh"
     #include "weapons/csqcprojectile.qh"
     #include "weapons/selection.qh"
-    #include "../common/t_items.qh"
+    #include <common/t_items.qh>
     #include "autocvars.qh"
     #include "constants.qh"
     #include "defs.qh"
-    #include "../common/notifications/all.qh"
-    #include "../common/deathtypes/all.qh"
+    #include <common/notifications/all.qh>
+    #include <common/deathtypes/all.qh>
     #include "mutators/all.qh"
-    #include "../common/turrets/sv_turrets.qh"
-    #include "../common/vehicles/all.qh"
-    #include "../lib/csqcmodel/sv_model.qh"
-    #include "../common/playerstats.qh"
+    #include <common/turrets/sv_turrets.qh>
+    #include <common/vehicles/all.qh>
+    #include <lib/csqcmodel/sv_model.qh>
+    #include <common/playerstats.qh>
     #include "g_hook.qh"
     #include "scores.qh"
     #include "spawnpoints.qh"
@@ -56,7 +55,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, Weapon w);
+void W_SwitchWeapon_Force(Player this, Weapon w);
 entity GiveFrags_randomweapons;
 void GiveFrags (entity attacker, entity targ, float f, int deathtype);
 
@@ -118,4 +117,3 @@ void Fire_ApplyDamage(entity e);
 void Fire_ApplyEffect(entity e);
 
 void fireburner_think();
-#endif
index c0509a3f69b0d5d8386f7d32a218882980618286..86fb14b29c997be7a56166fd57958a43b274c59f 100644 (file)
@@ -8,6 +8,8 @@
 #include "cl_player.qh"
 #include "command/common.qh"
 #include "round_handler.qh"
+#include "../common/state.qh"
+#include "../common/physics/player.qh"
 #include "../common/vehicles/all.qh"
 #include "../common/constants.qh"
 #include "../common/util.qh"
index 95ba88205b90666a612cb4232b7c00774dba76b0..900c23d36abac3eb9ce8dfb5edf0c1a8681c6bf3 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef HOOK_H
-#define HOOK_H
+#pragma once
 
 // Wazat's grappling hook
 .entity                hook;
@@ -16,4 +15,3 @@ const float HOOK_WAITING_FOR_RELEASE = BIT(4);
 
 void GrappleHookInit();
 vector hook_shotorigin[4];
-#endif
index 8399b5fdb976d3c50f1fedf29bb117509c23bc96..5e9273f7cd43702f62592c461ea8ecabefe9ab66 100644 (file)
@@ -1,3 +1,4 @@
+#include "g_lights.qh"
 
 void train_next();
 
@@ -35,12 +36,13 @@ flags:
 */
 void dynlight_think()
 {
+    SELFPARAM();
        if(!self.owner)
                remove(self);
 
        self.nextthink = time + 0.1;
 }
-void dynlight_find_aiment()
+void dynlight_find_aiment(entity this)
 {
        entity targ;
        if (!self.target)
@@ -56,7 +58,7 @@ void dynlight_find_aiment()
        self.think = dynlight_think;
        self.nextthink = time + 0.1;
 }
-void dynlight_find_path()
+void dynlight_find_path(entity this)
 {
        entity targ;
        if (!self.target)
@@ -68,7 +70,7 @@ void dynlight_find_path()
        self.think = train_next;
        self.nextthink = time + 0.1;
 }
-void dynlight_find_target()
+void dynlight_find_target(entity this)
 {
        entity targ;
        if (!self.target)
@@ -82,6 +84,7 @@ void dynlight_find_target()
 }
 void dynlight_use()
 {
+    SELFPARAM();
        if (self.light_lev == 0)
                self.light_lev = self.lefty;
        else
diff --git a/qcsrc/server/g_lights.qh b/qcsrc/server/g_lights.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 46ebe5ed89476348bc9411ba75c207153389d2b0..baca561786a00bcf9da35e7883100fd622242951 100644 (file)
@@ -1,3 +1,4 @@
+#include "g_models.qh"
 
 #include "g_subs.qh"
 #include "../common/triggers/subs.qh"
@@ -50,8 +51,8 @@ void g_clientmodel_use()
        g_clientmodel_setcolormaptoactivator();
 }
 
-void g_model_dropbyspawnflags()
-{SELFPARAM();
+void g_model_dropbyspawnflags(entity this)
+{
        if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN
        {
                traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
@@ -69,11 +70,11 @@ void g_model_dropbyspawnflags()
        }
 }
 
-void g_clientmodel_dropbyspawnflags()
-{SELFPARAM();
+void g_clientmodel_dropbyspawnflags(entity this)
+{
        vector o0;
        o0 = self.origin;
-       g_model_dropbyspawnflags();
+       g_model_dropbyspawnflags(self);
        if(self.origin != o0)
                self.SendFlags |= 2;
 }
diff --git a/qcsrc/server/g_models.qh b/qcsrc/server/g_models.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 5c2896dbe0b973a4a250b3c889247a27111c1d19..a2cbc5a431e4d2fd9ad6bb3ed462ac9d4c5dffc5 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "antilag.qh"
 #include "command/common.qh"
+#include "../common/state.qh"
 #include "../lib/warpzone/common.qh"
 #include "../common/triggers/subs.qh"
 
@@ -49,11 +50,11 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
        if (lag)
        {
                // take players back into the past
-               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_takeback(it, time - lag)));
-               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_takeback(it, CS(it), time - lag));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
                        if(it != forent)
-                               antilag_takeback(it, time - lag);
-               ));
+                               antilag_takeback(it, it, time - lag);
+               });
        }
 
        // do the trace
@@ -65,11 +66,11 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
        // restore players to current positions
        if (lag)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_restore(it)));
-               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
-                       if(it != forent)
-                               antilag_restore(it);
-               ));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_restore(it, CS(it)));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+                       if (it != forent)
+                               antilag_restore(it, it);
+               });
        }
 
        // restore shooter solid type
@@ -239,89 +240,89 @@ float LOD_customize()
        {
                int d = autocvar_loddebug;
                if(d == 1)
-                       self.modelindex = self.lodmodelindex0;
-               else if(d == 2 || !self.lodmodelindex2)
-                       self.modelindex = self.lodmodelindex1;
+                       this.modelindex = this.lodmodelindex0;
+               else if(d == 2 || !this.lodmodelindex2)
+                       this.modelindex = this.lodmodelindex1;
                else // if(d == 3)
-                       self.modelindex = self.lodmodelindex2;
+                       this.modelindex = this.lodmodelindex2;
                return true;
        }
 
        // TODO csqc network this so it only gets sent once
-       vector near_point = NearestPointOnBox(self, other.origin);
-       if(vdist(near_point - other.origin, <, self.loddistance1))
-               self.modelindex = self.lodmodelindex0;
-       else if(!self.lodmodelindex2 || vdist(near_point - other.origin, <, self.loddistance2))
-               self.modelindex = self.lodmodelindex1;
+       vector near_point = NearestPointOnBox(this, other.origin);
+       if(vdist(near_point - other.origin, <, this.loddistance1))
+               this.modelindex = this.lodmodelindex0;
+       else if(!this.lodmodelindex2 || vdist(near_point - other.origin, <, this.loddistance2))
+               this.modelindex = this.lodmodelindex1;
        else
-               self.modelindex = self.lodmodelindex2;
+               this.modelindex = this.lodmodelindex2;
 
        return true;
 }
 
 void LOD_uncustomize()
 {SELFPARAM();
-       self.modelindex = self.lodmodelindex0;
+       this.modelindex = this.lodmodelindex0;
 }
 
-void LODmodel_attach()
-{SELFPARAM();
+void LODmodel_attach(entity this)
+{
        entity e;
 
-       if(!self.loddistance1)
-               self.loddistance1 = 1000;
-       if(!self.loddistance2)
-               self.loddistance2 = 2000;
-       self.lodmodelindex0 = self.modelindex;
+       if(!this.loddistance1)
+               this.loddistance1 = 1000;
+       if(!this.loddistance2)
+               this.loddistance2 = 2000;
+       this.lodmodelindex0 = this.modelindex;
 
-       if(self.lodtarget1 != "")
+       if(this.lodtarget1 != "")
        {
-               e = find(world, targetname, self.lodtarget1);
+               e = find(world, targetname, this.lodtarget1);
                if(e)
                {
-                       self.lodmodel1 = e.model;
+                       this.lodmodel1 = e.model;
                        remove(e);
                }
        }
-       if(self.lodtarget2 != "")
+       if(this.lodtarget2 != "")
        {
-               e = find(world, targetname, self.lodtarget2);
+               e = find(world, targetname, this.lodtarget2);
                if(e)
                {
-                       self.lodmodel2 = e.model;
+                       this.lodmodel2 = e.model;
                        remove(e);
                }
        }
 
        if(autocvar_loddebug < 0)
        {
-               self.lodmodel1 = self.lodmodel2 = ""; // don't even initialize
+               this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
        }
 
-       if(self.lodmodel1 != "")
+       if(this.lodmodel1 != "")
        {
                vector mi, ma;
-               mi = self.mins;
-               ma = self.maxs;
+               mi = this.mins;
+               ma = this.maxs;
 
-               precache_model(self.lodmodel1);
-               _setmodel(self, self.lodmodel1);
-               self.lodmodelindex1 = self.modelindex;
+               precache_model(this.lodmodel1);
+               _setmodel(this, this.lodmodel1);
+               this.lodmodelindex1 = this.modelindex;
 
-               if(self.lodmodel2 != "")
+               if(this.lodmodel2 != "")
                {
-                       precache_model(self.lodmodel2);
-                       _setmodel(self, self.lodmodel2);
-                       self.lodmodelindex2 = self.modelindex;
+                       precache_model(this.lodmodel2);
+                       _setmodel(this, this.lodmodel2);
+                       this.lodmodelindex2 = this.modelindex;
                }
 
-               self.modelindex = self.lodmodelindex0;
-               setsize(self, mi, ma);
+               this.modelindex = this.lodmodelindex0;
+               setsize(this, mi, ma);
        }
 
-       if(self.lodmodelindex1)
-               if (!self.SendEntity)
-                       SetCustomizer(self, LOD_customize, LOD_uncustomize);
+       if(this.lodmodelindex1)
+               if (!this.SendEntity)
+                       SetCustomizer(this, LOD_customize, LOD_uncustomize);
 }
 
 void ApplyMinMaxScaleAngles(entity e)
index 81516f9357c56344f932fe70b439f282a6ddc72e..49bcd8904f86e7bf07a9e791d9835a4ef145aa4f 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef G_SUBS_H
-#define G_SUBS_H
+#pragma once
 
 void SUB_NullThink();
 
@@ -144,7 +143,7 @@ float LOD_customize();
 
 void LOD_uncustomize();
 
-void LODmodel_attach();
+void LODmodel_attach(entity this);
 
 void ApplyMinMaxScaleAngles(entity e);
 
@@ -165,4 +164,3 @@ void InitTrigger();
 void InitSolidBSPTrigger();
 
 float InitMovingBrushTrigger();
-#endif
index fac96e11f9a1172928c3b4e0f701957d7dc8d47c..d4bc83b681d2c63193ce9a71f4b5374fb1380901 100644 (file)
@@ -34,6 +34,7 @@
 #include "../common/util.qh"
 #include "../common/items/all.qh"
 #include "../common/weapons/all.qh"
+#include "../common/state.qh"
 
 const float LATENCY_THINKRATE = 10;
 .float latency_sum;
@@ -48,13 +49,13 @@ void PingPLReport_Think()
        delta = 3 / maxclients;
        if(delta < sys_frametime)
                delta = 0;
-       self.nextthink = time + delta;
+       this.nextthink = time + delta;
 
-       e = edict_num(self.cnt + 1);
+       e = edict_num(this.cnt + 1);
        if(IS_REAL_CLIENT(e))
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
-               WriteByte(MSG_BROADCAST, self.cnt);
+               WriteByte(MSG_BROADCAST, this.cnt);
                WriteShort(MSG_BROADCAST, max(1, e.ping));
                WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
                WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
@@ -71,12 +72,12 @@ void PingPLReport_Think()
        else
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
-               WriteByte(MSG_BROADCAST, self.cnt);
+               WriteByte(MSG_BROADCAST, this.cnt);
                WriteShort(MSG_BROADCAST, 0);
                WriteByte(MSG_BROADCAST, 0);
                WriteByte(MSG_BROADCAST, 0);
        }
-       self.cnt = (self.cnt + 1) % maxclients;
+       this.cnt = (this.cnt + 1) % maxclients;
 }
 void PingPLReport_Spawn()
 {
@@ -510,15 +511,15 @@ entity randomseed;
 bool RandomSeed_Send(entity this, entity to, int sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
-       WriteShort(MSG_ENTITY, self.cnt);
+       WriteShort(MSG_ENTITY, this.cnt);
        return true;
 }
 void RandomSeed_Think()
 {SELFPARAM();
-       self.cnt = bound(0, floor(random() * 65536), 65535);
-       self.nextthink = time + 5;
+       this.cnt = bound(0, floor(random() * 65536), 65535);
+       this.nextthink = time + 5;
 
-       self.SendFlags |= 1;
+       this.SendFlags |= 1;
 }
 void RandomSeed_Spawn()
 {SELFPARAM();
@@ -526,7 +527,7 @@ void RandomSeed_Spawn()
        randomseed.think = RandomSeed_Think;
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
-       WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
+       WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
 }
 
 spawnfunc(__init_dedicated_server)
@@ -1503,6 +1504,7 @@ only called if a time or frag limit has expired
 */
 void NextLevel()
 {
+    SELFPARAM();
        gameover = true;
 
        intermission_running = 1;
@@ -1543,9 +1545,7 @@ void NextLevel()
                        bprint(it.netname, " ^7wins.\n");
        ));
 
-       entity oldself = self;
-       target_music_kill();
-       self = oldself;
+       WITHSELF(NULL, target_music_kill());
 
        if(autocvar_g_campaign)
                CampaignPreIntermission();
@@ -1567,8 +1567,8 @@ void CheckRules_Player()
        if (gameover)   // someone else quit the game already
                return;
 
-       if(!IS_DEAD(self))
-               self.play_time += frametime;
+       if(!IS_DEAD(this))
+               this.play_time += frametime;
 
        // fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
        //   (div0: and that in CheckRules_World please)
@@ -1968,40 +1968,36 @@ string GotoMap(string m)
 
 
 void EndFrame()
-{SELFPARAM();
+{
        anticheat_endframe();
 
-       float altime;
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                entity e = IS_SPEC(it) ? it.enemy : it;
-               if(e.typehitsound)
+               if (e.typehitsound) {
                        it.typehit_time = time;
-               else if(e.damage_dealt)
-               {
+               } else if (e.damage_dealt) {
                        it.hit_time = time;
                        it.damage_dealt_total += ceil(e.damage_dealt);
                }
-       ));
-       altime = time + frametime * (1 + autocvar_g_antilag_nudge);
+       });
        // add 1 frametime because after this, engine SV_Physics
        // increases time by a frametime and then networks the frame
        // add another frametime because client shows everything with
        // 1 frame of lag (cl_nolerp 0). The last +1 however should not be
        // needed!
-       FOREACH_CLIENT(true, LAMBDA(
+       float altime = time + frametime * (1 + autocvar_g_antilag_nudge);
+       FOREACH_CLIENT(true, {
                it.typehitsound = false;
                it.damage_dealt = 0;
-               setself(it);
-               antilag_record(it, altime);
-       ));
-       FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
-               setself(it);
-               antilag_record(it, altime);
-       ));
-       FOREACH_CLIENT(PS(it), LAMBDA(
+               antilag_record(it, CS(it), altime);
+       });
+       FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+               antilag_record(it, it, altime);
+       });
+       FOREACH_CLIENT(PS(it), {
                PlayerState s = PS(it);
                s.ps_push(s, it);
-       ));
+       });
 }
 
 
index 920ef71e184c1cc71d5962d57cd9c639f140d8f4..cd1cafd36a2fd0a5ca60ab1b011391a8a740c559 100644 (file)
@@ -1,16 +1,17 @@
-#ifndef G_WORLD_H
-#define G_WORLD_H
+#pragma once
 
 float checkrules_equality;
 float checkrules_suddendeathwarning;
 float checkrules_suddendeathend;
 float checkrules_overtimesadded; //how many overtimes have been already added
 
-const float WINNING_NO = 0; // no winner, but time limits may terminate the game
-const float WINNING_YES = 1; // winner found
-const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
-const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
+const int WINNING_NO = 0; // no winner, but time limits may terminate the game
+const int WINNING_YES = 1; // winner found
+const int WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
+const int WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
 
+float WinningCondition_Scores(float limit, float leadlimit);
+void SetWinners(.float field, float value);
 void CheckRules_Player();
 void IntermissionThink();
 void GotoNextMap(float reinit);
@@ -24,5 +25,3 @@ void Map_Goto_SetStr(string nextmapname);
 void Map_Goto(float reinit);
 float DoNextMapOverride(float reinit);
 void CheckRules_World();
-
-#endif
index deffa8e0386c470aba82d7c2bac2179b83e06bce..d129d994f4db575187797ec149ab315626cba43b 100644 (file)
@@ -192,7 +192,7 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
                LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ");
                LOG_INFO(reason, "\n");
 
-:skip
+LABEL(skip)
        }
 }
 
@@ -242,7 +242,7 @@ void OnlineBanList_Think()
                goto killme;
        return;
 
-:killme
+LABEL(killme)
        remove(self);
 }
 
@@ -380,7 +380,7 @@ float Ban_GetClientIP(entity client)
        ban_ip4 = strcat1(s); // 32
        return true;
 
-:ipv6
+LABEL(ipv6)
        i1 = strstrofs(s, ":", 0);
        if(i1 < 0)
                return false;
index e758cbca4e94fdaef60a33f7f0cef18141fe3c4e..946f44f9351a14b3be143cadf3bdecf5da0dc38f 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef IPBAN_H
-#define IPBAN_H
+#pragma once
 
 void Ban_SaveBans();
 void Ban_LoadBans();
@@ -8,4 +7,3 @@ float Ban_MaybeEnforceBanOnce(entity client);
 float BanCommand(string command);
 
 void OnlineBanList_URI_Get_Callback(float id, float status, string data);
-#endif
index 4a2acd85b7d1c015d8303f3c4d120b4b25178292..50be5f8dba7ef998c238dd68fbb531f6951da142 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef ITEM_KEY
-#define ITEM_KEY
+#pragma once
 
 /**
  * Returns the bit ID of a key
@@ -25,5 +24,3 @@ float item_keys_usekey(entity l, entity p);
  */
 string item_keys_keylist(float keylist);
 #endif
-
-#endif
index 409674f0a3a8f437cccacd730a06b0eaa9df51cc..7a615fc863b4015f297d8d72d8e1325937384166 100644 (file)
@@ -191,7 +191,7 @@ void MapVote_AddVotable(string nextMap, float isSuggestion)
        }
        if(i >= mapvote_screenshot_dirs_count)
                i = 0; // FIXME maybe network this error case, as that means there is no mapshot on the server?
-       for(o = strstr(pakfile, "/", 0)+1; o > 0; o = strstr(pakfile, "/", 0)+1)
+       for(o = strstrofs(pakfile, "/", 0)+1; o > 0; o = strstrofs(pakfile, "/", 0)+1)
                pakfile = substring(pakfile, o, -1);
 
        mapvote_maps_screenshot_dir[mapvote_count] = i;
index e4e6b0b52ac8b49582751d4cd32f868824c9a5cc..3a1a0ad6493807f2dcf5e38bb94a07dbcc95384b 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef MAPVOTING_H
-#define MAPVOTING_H
+#pragma once
 
 // definitions for functions used outside mapvoting.qc
 void MapVote_Start();
@@ -13,4 +12,3 @@ string GameTypeVote_MapInfo_FixName(string m);
 float gametypevote;
 string getmapname_stored;
 float mapvote_initialized;
-#endif
index 9e40e9d59e832a23dd3125724def5879ec9ec055..72747037dee0c8739223fe5f2ca1744351138841 100644 (file)
@@ -23,6 +23,8 @@
 #include "../common/vehicles/sv_vehicles.qh"
 #include "../common/vehicles/vehicle.qh"
 #include "../common/items/all.qc"
+#include "../common/state.qh"
+#include "../common/effects/qc/globalsound.qh"
 #include "../lib/csqcmodel/sv_model.qh"
 #include "../lib/warpzone/anglestransform.qh"
 #include "../lib/warpzone/server.qh"
@@ -235,8 +237,8 @@ string formatmessage(string msg)
                        break; // too many replacements
 
                n = n - 1;
-               p1 = strstr(msg, "%", p); // NOTE: this destroys msg as it's a tempstring!
-               p2 = strstr(msg, "\\", p); // NOTE: this destroys msg as it's a tempstring!
+               p1 = strstrofs(msg, "%", p); // NOTE: this destroys msg as it's a tempstring!
+               p2 = strstrofs(msg, "\\", p); // NOTE: this destroys msg as it's a tempstring!
 
                if (p1 < 0)
                        p1 = p2;
@@ -408,8 +410,8 @@ REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
 /**
  * @param f -1: cleanup, 0: request, 1: receive
  */
-void GetCvars(int f)
-{SELFPARAM();
+void GetCvars(entity this, int f)
+{
        string s = string_null;
 
        if (f > 0)
@@ -752,7 +754,7 @@ void precache_playermodels(string s)
 }
 
 void precache()
-{SELFPARAM();
+{
     // gamemode related things
 
     // Precache all player models if desired
@@ -849,7 +851,7 @@ void remove_safely(entity e)
     builtin_remove(e);
 }
 
-void InitializeEntity(entity e, void() func, float order)
+void InitializeEntity(entity e, void(entity this) func, float order)
 {
     entity prev, cur;
 
@@ -883,7 +885,7 @@ void InitializeEntity(entity e, void() func, float order)
     }
 }
 void InitializeEntitiesRun()
-{SELFPARAM();
+{
     entity startoflist = initialize_entity_first;
     initialize_entity_first = NULL;
     remove = remove_except_protected;
@@ -897,7 +899,7 @@ void InitializeEntitiesRun()
         e.initialize_entity_order = 0;
        entity next = e.initialize_entity_next;
         e.initialize_entity_next = NULL;
-        var void() func = e.initialize_entity;
+        var void(entity this) func = e.initialize_entity;
         e.initialize_entity = func_null;
         if (e.classname == "initialize_entity")
         {
@@ -908,7 +910,7 @@ void InitializeEntitiesRun()
         //dprint("Delayed initialization: ", e.classname, "\n");
         if (func)
         {
-               WITH(entity, self, e, func());
+               WITHSELF(e, func(e));
         }
         else
         {
@@ -985,8 +987,8 @@ void adaptor_think2use_hittype_splash() // for timed projectile detonation
 }
 
 // deferred dropping
-void DropToFloor_Handler()
-{SELFPARAM();
+void DropToFloor_Handler(entity this)
+{
     builtin_droptofloor();
     self.dropped_origin = self.origin;
 }
@@ -1406,7 +1408,8 @@ float LostMovetypeFollow(entity ent)
        return 0;
 }
 
-float isPushable(entity e)
+.bool pushable;
+bool isPushable(entity e)
 {
        if(e.pushable)
                return true;
index 4cb4e20b33b1537d041a6c3db75bd937c2bc5c7a..04221e439ef8f85fef2017e998cc26481e6b0c62 100644 (file)
@@ -1,13 +1,12 @@
-#ifndef MISCFUNCTIONS_H
-#define MISCFUNCTIONS_H
+#pragma once
 
-#include "../common/t_items.qh"
+#include <common/t_items.qh>
 
 #include "mutators/events.qh"
 
-#include "../common/constants.qh"
-#include "../common/mapinfo.qh"
-#include "../common/turrets/all.qh"
+#include <common/constants.qh>
+#include <common/mapinfo.qh>
+#include <common/turrets/all.qh>
 
 #ifdef RELEASE
 #define cvar_string_normal builtin_cvar_string
@@ -77,7 +76,7 @@ void GameLogInit();
 
 void GameLogClose();
 
-void GetCvars(float f);
+void GetCvars(entity this, float f);
 
 string GetMapname();
 
@@ -133,13 +132,12 @@ string strcat1(string s) = #115; // FRIK_FILE
 float logfile_open;
 float logfile;
 
-#define strstr strstrofs
 /*
 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
 // IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
 // STRINGS AND TAKE QUITE LONG. haystack and needle MUST
 // BE CONSTANT OR strzoneD!
-float strstr(string haystack, string needle, float offset)
+float strstrofs(string haystack, string needle, float offset)
 {
        float len, endpos;
        string found;
@@ -263,7 +261,9 @@ void readlevelcvars()
        sv_taunt = cvar("sv_taunt");
 
        warmup_stage = cvar("g_warmup");
-       g_warmup_limit = cvar("g_warmup_limit");
+       warmup_limit = cvar("g_warmup_limit");
+       if(warmup_limit == 0)
+               warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
        g_warmup_allguns = cvar("g_warmup_allguns");
        g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
 
@@ -357,7 +357,7 @@ const float INITPRIO_SETLOCATION            = 90;
 const float INITPRIO_LINKDOORS                         = 91;
 const float INITPRIO_LAST                              = 99;
 
-.void() initialize_entity;
+.void(entity this) initialize_entity;
 .float initialize_entity_order;
 .entity initialize_entity_next;
 entity initialize_entity_first;
@@ -367,7 +367,5 @@ entity initialize_entity_first;
 
 
 float sound_allowed(float dest, entity e);
-void InitializeEntity(entity e, void() func, float order);
+void InitializeEntity(entity e, void(entity this) func, float order);
 void SetCustomizer(entity e, float() customizer, void() uncustomizer);
-
-#endif
diff --git a/qcsrc/server/mutators/_mod.inc b/qcsrc/server/mutators/_mod.inc
new file mode 100644 (file)
index 0000000..254d13d
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include "all.qc"
index 2cca71c7ccdd6e464374cfb864cb1dc13ff8ad72..d742c77af105f6d33e916fcd1704acc23f3010ce 100644 (file)
@@ -1,3 +1,4 @@
+#include "all.qh"
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
index e586ec74e925a77d8d614048bf2936b0c27a0cda..4a1f2b3533ef390d5757d7927cf9afdcaab26643 100644 (file)
@@ -1,9 +1,6 @@
+#pragma once
+
 #include "mutator.qh"
 #include "gamemode.qh"
 
-#ifndef SERVER_MUTATORS_H
-#define SERVER_MUTATORS_H
-
 #include "all.inc"
-
-#endif
index d81b2b1a5b630c62d0edb78e5c1dd94a6cf6a418..8039d8348f0108d497e21560491d95760560de86 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_MUTATORS_EVENTS_H
-#define SERVER_MUTATORS_EVENTS_H
+#pragma once
 
 #include <common/mutators/base.qh>
 
@@ -473,6 +472,7 @@ MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
 
 /** called when a bot checks a target to attack */
 #define EV_BotShouldAttack(i, o) \
+    /**/ i(entity, __self) \
     /**/ i(entity, checkentity) \
     /**/
 entity checkentity;
@@ -502,7 +502,10 @@ MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
  * called when a vehicle initializes
  * return true to remove the vehicle
  */
-MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
+#define EV_VehicleSpawn(i, o) \
+    /**/ i(entity, __self) \
+    /**/
+MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
 
 /**
  * called when a player enters a vehicle
@@ -857,4 +860,3 @@ float uricb_id;
 float uricb_status;
 string uricb_data;
 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
-#endif
index b8370465022e5179dd50e57dd9f418e3e4e4e236..ee80b44b06df6213c745d39e0c2b3dc70bb9c116 100644 (file)
@@ -1,32 +1,34 @@
-#ifndef GAMEMODE_H
-#define GAMEMODE_H
+#pragma once
 
-#include "../cl_client.qh"
-#include "../cl_player.qh"
-#include "../cl_impulse.qh"
-#include "../cheats.qh"
-#include "../g_damage.qh"
-#include "../round_handler.qh"
-#include "../scores.qh"
-#include "../scores_rules.qh"
-#include "../teamplay.qh"
+#include <server/cl_client.qh>
+#include <server/cl_player.qh>
+#include <server/cl_impulse.qh>
+#include <server/cheats.qh>
+#include <server/g_damage.qh>
+#include <server/g_world.qh>
+#include <server/round_handler.qh>
+#include <server/scores.qh>
+#include <server/scores_rules.qh>
+#include <server/teamplay.qh>
 
-#include "../bot/bot.qh"
-#include "../bot/navigation.qh"
-#include "../bot/waypoints.qh"
-#include "../bot/havocbot/roles.qh"
+#include <server/bot/bot.qh>
+#include <server/bot/navigation.qh>
+#include <server/bot/waypoints.qh>
+#include <server/bot/havocbot/roles.qh>
 
-#include "../bot/havocbot/havocbot.qh"
+#include <server/bot/havocbot/havocbot.qh>
 
-#include "../command/vote.qh"
+#include <server/command/vote.qh>
 
 #include <common/monsters/all.qh>
 
-#include "../command/common.qh"
+#include <server/command/common.qh>
 
-#include "../weapons/tracing.qh"
-#include "../weapons/weaponsystem.qh"
+#include <server/weapons/tracing.qh>
+#include <server/weapons/weaponsystem.qh>
 
+#include <common/physics/player.qh>
+#include <common/effects/qc/all.qh>
 #include <common/deathtypes/all.qh>
 #include <common/notifications/all.qh>
 #include <common/triggers/teleporters.qh>
@@ -44,5 +46,3 @@ float redalive, bluealive, yellowalive, pinkalive;
 .float bluealive_stat = _STAT(BLUEALIVE);
 .float yellowalive_stat = _STAT(YELLOWALIVE);
 .float pinkalive_stat = _STAT(PINKALIVE);
-
-#endif
index 485bce29874eaff11f0af3faf529973ef37603e8..40fad29b34426e03fae679d508eab6968ca327ba 100644 (file)
@@ -1,31 +1,30 @@
-#ifndef MUTATOR_H
-#define MUTATOR_H
+#pragma once
 
 #include <common/mutators/base.qh>
 
-#include "../cl_client.qh"
-#include "../cl_player.qh"
-#include "../cl_impulse.qh"
-#include "../cheats.qh"
-#include "../g_damage.qh"
-#include "../round_handler.qh"
-#include "../scores.qh"
-#include "../scores_rules.qh"
+#include <server/cl_client.qh>
+#include <server/cl_player.qh>
+#include <server/cl_impulse.qh>
+#include <server/cheats.qh>
+#include <server/g_damage.qh>
+#include <server/round_handler.qh>
+#include <server/scores.qh>
+#include <server/scores_rules.qh>
 
-#include "../bot/bot.qh"
-#include "../bot/navigation.qh"
-#include "../bot/waypoints.qh"
+#include <server/bot/bot.qh>
+#include <server/bot/navigation.qh>
+#include <server/bot/waypoints.qh>
 
-#include "../bot/havocbot/havocbot.qh"
-#include "../bot/havocbot/roles.qh"
+#include <server/bot/havocbot/havocbot.qh>
+#include <server/bot/havocbot/roles.qh>
 
-#include "../command/vote.qh"
-#include "../command/common.qh"
+#include <server/command/vote.qh>
+#include <server/command/common.qh>
 
-#include "../weapons/common.qh"
-#include "../weapons/tracing.qh"
-#include "../weapons/throwing.qh"
-#include "../weapons/weaponsystem.qh"
+#include <server/weapons/common.qh>
+#include <server/weapons/tracing.qh>
+#include <server/weapons/throwing.qh>
+#include <server/weapons/weaponsystem.qh>
 
 #include <common/deathtypes/all.qh>
 #include <common/notifications/all.qh>
@@ -39,5 +38,3 @@
 #include <lib/warpzone/anglestransform.qh>
 #include <lib/warpzone/server.qh>
 #include <lib/warpzone/util_server.qh>
-
-#endif
diff --git a/qcsrc/server/mutators/mutator/_mod.inc b/qcsrc/server/mutators/mutator/_mod.inc
new file mode 100644 (file)
index 0000000..c56c2db
--- /dev/null
@@ -0,0 +1,14 @@
+// generated file; do not modify
+#include "gamemode_assault.qc"
+#include "gamemode_ca.qc"
+#include "gamemode_ctf.qc"
+#include "gamemode_cts.qc"
+#include "gamemode_deathmatch.qc"
+#include "gamemode_domination.qc"
+#include "gamemode_freezetag.qc"
+#include "gamemode_invasion.qc"
+#include "gamemode_keepaway.qc"
+#include "gamemode_keyhunt.qc"
+#include "gamemode_lms.qc"
+#include "gamemode_race.qc"
+#include "gamemode_tdm.qc"
index b822911c8993d81dc70a13fa4aef88a2858075a6..34c19d425178a0d9c02e3f844d1aa6edb6730034 100644 (file)
@@ -1,7 +1,9 @@
+#include "gamemode_assault.qh"
 #ifndef GAMEMODE_ASSAULT_H
 #define GAMEMODE_ASSAULT_H
 
 void assault_ScoreRules();
+void ActivateTeamplay();
 
 REGISTER_MUTATOR(as, false)
 {
@@ -43,17 +45,17 @@ const int HAVOCBOT_AST_ROLE_OFFENSE = 4;
 .int havocbot_role_flags;
 .float havocbot_attack_time;
 
-.void() havocbot_role;
-.void() havocbot_previous_role;
+.void(entity this) havocbot_role;
+.void(entity this) havocbot_previous_role;
 
-void() havocbot_role_ast_defense;
-void() havocbot_role_ast_offense;
+void(entity this) havocbot_role_ast_defense;
+void(entity this) havocbot_role_ast_offense;
 .entity havocbot_ast_target;
 
 void(entity bot) havocbot_ast_reset_role;
 
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_items;
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
 
 // scoreboard stuff
 const float ST_ASSAULT_OBJECTIVES = 1;
@@ -78,7 +80,7 @@ void assault_objective_use()
        {
                if (e.classname == "target_objective_decrease")
                {
-                       WITH(entity, self, e, target_objective_decrease_activate());
+                       WITHSELF(e, target_objective_decrease_activate());
                }
        }
 
@@ -145,8 +147,8 @@ void assault_objective_decrease_use()
        }
 }
 
-void assault_setenemytoobjective()
-{SELFPARAM();
+void assault_setenemytoobjective(entity this)
+{
        entity objective;
        for(objective = world; (objective = find(objective, targetname, self.target)); )
        {
@@ -206,9 +208,9 @@ void target_objective_decrease_activate()
        }
 }
 
-void target_objective_decrease_findtarget()
+void target_objective_decrease_findtarget(entity this)
 {
-       assault_setenemytoobjective();
+       assault_setenemytoobjective(this);
 }
 
 void target_assault_roundend_reset(entity this)
@@ -223,8 +225,8 @@ void target_assault_roundend_use()
        self.winning = 1; // round has been won by attackers
 }
 
-void assault_roundstart_use()
-{SELFPARAM();
+void assault_roundstart_use(entity this)
+{
        activator = self;
        SUB_UseTargets();
 
@@ -237,9 +239,14 @@ void assault_roundstart_use()
                        it.team = NUM_TEAM_1;
 
                // Dubbles as teamchange
-               WITH(entity, self, it, turret_respawn());
+               WITHSELF(it, turret_respawn());
        ));
 }
+void assault_roundstart_use_self()
+{
+    SELFPARAM();
+    assault_roundstart_use(this);
+}
 
 void assault_wall_think()
 {SELFPARAM();
@@ -266,7 +273,7 @@ void assault_new_round()
        //bprint("ASSAULT: new round\n");
 
        // Eject players from vehicles
-    FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, LAMBDA(WITH(entity, self, it, vehicles_exit(VHEF_RELEASE))));
+    FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE)));
 
     FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
        setself(it);
@@ -299,6 +306,7 @@ void assault_new_round()
 // they win. Otherwise the defending team wins once the timelimit passes.
 int WinningCondition_Assault()
 {
+    SELFPARAM();
        WinningConditionHelper(); // set worldstatus
 
        int status = WINNING_NO;
@@ -329,7 +337,7 @@ int WinningCondition_Assault()
                        }
                        else
                        {
-                               WITH(entity, self, ent, assault_new_round());
+                               WITHSELF(ent, assault_new_round());
                        }
                }
        }
@@ -429,14 +437,14 @@ spawnfunc(target_assault_roundstart)
 
        assault_attacker_team = NUM_TEAM_1;
        self.classname = "target_assault_roundstart";
-       self.use = assault_roundstart_use;
-       self.reset2 = assault_roundstart_use;
+       self.use = assault_roundstart_use_self;
+       self.reset2 = assault_roundstart_use_self;
        InitializeEntity(self, assault_roundstart_use, INITPRIO_FINDTARGET);
 }
 
 // legacy bot code
-void havocbot_goalrating_ast_targets(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ast_targets(entity this, float ratingscale)
+{
        entity ad, best, wp, tod;
        float radius, found, bestvalue;
        vector p;
@@ -506,115 +514,115 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                //      te_lightning2(world, '0 0 0', best.origin);
                //      te_knightspike(best.origin);
 
-                       navigation_routerating(best, ratingscale, 4000);
+                       navigation_routerating(this, best, ratingscale, 4000);
                        best.cnt += 1;
 
-                       self.havocbot_attack_time = 0;
+                       this.havocbot_attack_time = 0;
 
-                       if(checkpvs(self.view_ofs,ad))
-                       if(checkpvs(self.view_ofs,best))
+                       if(checkpvs(this.view_ofs,ad))
+                       if(checkpvs(this.view_ofs,best))
                        {
                        //      dprint("increasing attack time for this target\n");
-                               self.havocbot_attack_time = time + 2;
+                               this.havocbot_attack_time = time + 2;
                        }
                }
        }
 }
 
-void havocbot_role_ast_offense()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_ast_offense(entity this)
+{
+       if(IS_DEAD(this))
        {
-               self.havocbot_attack_time = 0;
-               havocbot_ast_reset_role(self);
+               this.havocbot_attack_time = 0;
+               havocbot_ast_reset_role(this);
                return;
        }
 
        // Set the role timeout if necessary
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 120;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 120;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ast_reset_role(self);
+               havocbot_ast_reset_role(this);
                return;
        }
 
-       if(self.havocbot_attack_time>time)
+       if(this.havocbot_attack_time>time)
                return;
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               navigation_goalrating_start();
-               havocbot_goalrating_enemyplayers(20000, self.origin, 650);
-               havocbot_goalrating_ast_targets(20000);
-               havocbot_goalrating_items(15000, self.origin, 10000);
-               navigation_goalrating_end();
+               navigation_goalrating_start(this);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 650);
+               havocbot_goalrating_ast_targets(this, 20000);
+               havocbot_goalrating_items(this, 15000, this.origin, 10000);
+               navigation_goalrating_end(this);
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
        }
 }
 
-void havocbot_role_ast_defense()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_ast_defense(entity this)
+{
+       if(IS_DEAD(this))
        {
-               self.havocbot_attack_time = 0;
-               havocbot_ast_reset_role(self);
+               this.havocbot_attack_time = 0;
+               havocbot_ast_reset_role(this);
                return;
        }
 
        // Set the role timeout if necessary
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 120;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 120;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ast_reset_role(self);
+               havocbot_ast_reset_role(this);
                return;
        }
 
-       if(self.havocbot_attack_time>time)
+       if(this.havocbot_attack_time>time)
                return;
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               navigation_goalrating_start();
-               havocbot_goalrating_enemyplayers(20000, self.origin, 3000);
-               havocbot_goalrating_ast_targets(20000);
-               havocbot_goalrating_items(15000, self.origin, 10000);
-               navigation_goalrating_end();
+               navigation_goalrating_start(this);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 3000);
+               havocbot_goalrating_ast_targets(this, 20000);
+               havocbot_goalrating_items(this, 15000, this.origin, 10000);
+               navigation_goalrating_end(this);
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
        }
 }
 
-void havocbot_role_ast_setrole(entity bot, float role)
+void havocbot_role_ast_setrole(entity this, float role)
 {
        switch(role)
        {
                case HAVOCBOT_AST_ROLE_DEFENSE:
-                       bot.havocbot_role = havocbot_role_ast_defense;
-                       bot.havocbot_role_flags = HAVOCBOT_AST_ROLE_DEFENSE;
-                       bot.havocbot_role_timeout = 0;
+                       this.havocbot_role = havocbot_role_ast_defense;
+                       this.havocbot_role_flags = HAVOCBOT_AST_ROLE_DEFENSE;
+                       this.havocbot_role_timeout = 0;
                        break;
                case HAVOCBOT_AST_ROLE_OFFENSE:
-                       bot.havocbot_role = havocbot_role_ast_offense;
-                       bot.havocbot_role_flags = HAVOCBOT_AST_ROLE_OFFENSE;
-                       bot.havocbot_role_timeout = 0;
+                       this.havocbot_role = havocbot_role_ast_offense;
+                       this.havocbot_role_flags = HAVOCBOT_AST_ROLE_OFFENSE;
+                       this.havocbot_role_timeout = 0;
                        break;
        }
 }
 
-void havocbot_ast_reset_role(entity bot)
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_ast_reset_role(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if(bot.team == assault_attacker_team)
-               havocbot_role_ast_setrole(bot, HAVOCBOT_AST_ROLE_OFFENSE);
+       if(this.team == assault_attacker_team)
+               havocbot_role_ast_setrole(this, HAVOCBOT_AST_ROLE_OFFENSE);
        else
-               havocbot_role_ast_setrole(bot, HAVOCBOT_AST_ROLE_DEFENSE);
+               havocbot_role_ast_setrole(this, HAVOCBOT_AST_ROLE_DEFENSE);
 }
 
 // mutator hooks
@@ -676,6 +684,7 @@ MUTATOR_HOOKFUNCTION(as, ReadLevelCvars)
 
 MUTATOR_HOOKFUNCTION(as, OnEntityPreSpawn)
 {
+    SELFPARAM();
        switch(self.classname)
        {
                case "info_player_team1":
diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qh b/qcsrc/server/mutators/mutator/gamemode_assault.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 57e96abf92d6a45c114e4001762df3bb26f63daa..7f0eafe868d3a7d517a67966bd0c4d52ccdff2ca 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_ca.qh"
 #ifndef GAMEMODE_CA_H
 #define GAMEMODE_CA_H
 
@@ -20,6 +21,8 @@ bool CA_CheckWinner();
 void CA_RoundStart();
 bool ca_isEliminated(entity e);
 
+void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
+
 REGISTER_MUTATOR(ca, false)
 {
        MUTATOR_ONADD
@@ -112,6 +115,8 @@ float CA_GetWinnerTeam()
        return -1; // no player left
 }
 
+void nades_Clear(entity player);
+
 #define CA_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0))
 #define CA_ALIVE_TEAMS_OK() (CA_ALIVE_TEAMS() == ca_teams)
 float CA_CheckWinner()
@@ -226,7 +231,7 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
     SELFPARAM();
        if (!allowed_to_spawn && IS_PLAYER(this)) // this is true even when player is trying to join
        {
-               this.classname = STR_OBSERVER;
+               TRANSMUTE(Observer, this);
                if (this.jointime != time && !this.caplayer) // not when connecting
                {
                        this.caplayer = 0.5;
@@ -237,6 +242,7 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
 
 MUTATOR_HOOKFUNCTION(ca, reset_map_players)
 {
+    SELFPARAM();
        FOREACH_CLIENT(true, {
                it.killcount = 0;
                if (!it.caplayer && IS_BOT_CLIENT(it))
@@ -246,9 +252,9 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players)
                }
                if (it.caplayer)
                {
-                       it.classname = STR_PLAYER;
+                       TRANSMUTE(Player, it);
                        it.caplayer = 1;
-                       WITH(entity, self, it, PutClientInServer());
+                       WITHSELF(it, PutClientInServer());
                }
        });
        return true;
@@ -257,7 +263,7 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players)
 MUTATOR_HOOKFUNCTION(ca, ClientConnect)
 {
     SELFPARAM();
-       this.classname = STR_OBSERVER;
+       TRANSMUTE(Observer, this);
        return true;
 }
 
diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qh b/qcsrc/server/mutators/mutator/gamemode_ca.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index a6d34c0d4af675506a764d79d2284486e88bdacf..a7d6fb2a1b26f7e6d1376b259ca5a5d91323ed93 100644 (file)
@@ -1,6 +1,6 @@
-#ifndef GAMEMODE_CTF_H
-#define GAMEMODE_CTF_H
+#include "gamemode_ctf.qh"
 
+#ifdef IMPLEMENTATION
 #ifndef CSQC
 void ctf_Initialize();
 
@@ -34,179 +34,6 @@ REGISTER_MUTATOR(ctf, false)
 }
 #endif
 
-#ifdef SVQC
-// used in cheats.qc
-void ctf_RespawnFlag(entity flag);
-
-// score rule declarations
-const int ST_CTF_CAPS = 1;
-const int SP_CTF_CAPS = 4;
-const int SP_CTF_CAPTIME = 5;
-const int SP_CTF_PICKUPS = 6;
-const int SP_CTF_DROPS = 7;
-const int SP_CTF_FCKILLS = 8;
-const int SP_CTF_RETURNS = 9;
-
-CLASS(Flag, Pickup)
-    ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13')
-    ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
-ENDCLASS(Flag)
-Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
-void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
-
-// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
-
-const float FLAG_SCALE = 0.6;
-
-const float FLAG_THINKRATE = 0.2;
-const float FLAG_TOUCHRATE = 0.5;
-const float WPFE_THINKRATE = 0.5;
-
-const vector FLAG_DROP_OFFSET = ('0 0 32');
-const vector FLAG_CARRY_OFFSET = ('-16 0 8');
-#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
-const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
-const vector FLAG_FLOAT_OFFSET = ('0 0 32');
-const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
-
-const vector VEHICLE_FLAG_OFFSET = ('0 0 96');
-const float VEHICLE_FLAG_SCALE = 1.0;
-
-// waypoint colors
-#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
-#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color)
-#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1')
-
-// sounds
-#define snd_flag_taken noise
-#define snd_flag_returned noise1
-#define snd_flag_capture noise2
-#define snd_flag_respawn noise3
-.string snd_flag_dropped;
-.string snd_flag_touch;
-.string snd_flag_pass;
-
-// effects
-.string toucheffect;
-.string passeffect;
-.string capeffect;
-
-// list of flags on the map
-entity ctf_worldflaglist;
-.entity ctf_worldflagnext;
-.entity ctf_staleflagnext;
-
-// waypoint sprites
-.entity bot_basewaypoint; // flag waypointsprite
-.entity wps_helpme;
-.entity wps_flagbase;
-.entity wps_flagcarrier;
-.entity wps_flagdropped;
-.entity wps_enemyflagcarrier;
-.float wps_helpme_time;
-bool wpforenemy_announced;
-float wpforenemy_nextthink;
-
-// statuses
-const int FLAG_BASE = 1;
-const int FLAG_DROPPED = 2;
-const int FLAG_CARRY = 3;
-const int FLAG_PASSING = 4;
-
-const int DROP_NORMAL = 1;
-const int DROP_THROW = 2;
-const int DROP_PASS = 3;
-const int DROP_RESET = 4;
-
-const int PICKUP_BASE = 1;
-const int PICKUP_DROPPED = 2;
-
-const int CAPTURE_NORMAL = 1;
-const int CAPTURE_DROPPED = 2;
-
-const int RETURN_TIMEOUT = 1;
-const int RETURN_DROPPED = 2;
-const int RETURN_DAMAGE = 3;
-const int RETURN_SPEEDRUN = 4;
-const int RETURN_NEEDKILL = 5;
-
-void ctf_Handle_Throw(entity player, entity receiver, float droptype);
-
-// flag properties
-#define ctf_spawnorigin dropped_origin
-bool ctf_stalemate; // indicates that a stalemate is active
-float ctf_captimerecord; // record time for capturing the flag
-.float ctf_pickuptime;
-.float ctf_droptime;
-.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
-.entity ctf_dropper; // don't allow spam of dropping the flag
-.int max_flag_health;
-.float next_take_time;
-.bool ctf_flagdamaged;
-int ctf_teams;
-
-// passing/throwing properties
-.float pass_distance;
-.entity pass_sender;
-.entity pass_target;
-.float throw_antispam;
-.float throw_prevtime;
-.int throw_count;
-
-// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
-.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
-float ctf_captureshield_min_negscore; // punish at -20 points
-float ctf_captureshield_max_ratio; // punish at most 30% of each team
-float ctf_captureshield_force; // push force of the shield
-
-// 1 flag ctf
-bool ctf_oneflag; // indicates whether or not a neutral flag has been found
-
-// bot player logic
-const int HAVOCBOT_CTF_ROLE_NONE = 0;
-const int HAVOCBOT_CTF_ROLE_DEFENSE = 2;
-const int HAVOCBOT_CTF_ROLE_MIDDLE = 4;
-const int HAVOCBOT_CTF_ROLE_OFFENSE = 8;
-const int HAVOCBOT_CTF_ROLE_CARRIER = 16;
-const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32;
-const int HAVOCBOT_CTF_ROLE_ESCORT = 64;
-
-.bool havocbot_cantfindflag;
-
-vector havocbot_ctf_middlepoint;
-float havocbot_ctf_middlepoint_radius;
-
-void havocbot_role_ctf_setrole(entity bot, int role);
-
-// team checking
-#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
-#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
-
-// networked flag statuses
-.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS);
-#endif
-
-const int CTF_RED_FLAG_TAKEN                   = 1;
-const int CTF_RED_FLAG_LOST                            = 2;
-const int CTF_RED_FLAG_CARRYING                        = 3;
-const int CTF_BLUE_FLAG_TAKEN                  = 4;
-const int CTF_BLUE_FLAG_LOST                   = 8;
-const int CTF_BLUE_FLAG_CARRYING               = 12;
-const int CTF_YELLOW_FLAG_TAKEN                        = 16;
-const int CTF_YELLOW_FLAG_LOST                 = 32;
-const int CTF_YELLOW_FLAG_CARRYING             = 48;
-const int CTF_PINK_FLAG_TAKEN                  = 64;
-const int CTF_PINK_FLAG_LOST                   = 128;
-const int CTF_PINK_FLAG_CARRYING               = 192;
-const int CTF_NEUTRAL_FLAG_TAKEN               = 256;
-const int CTF_NEUTRAL_FLAG_LOST                        = 512;
-const int CTF_NEUTRAL_FLAG_CARRYING            = 768;
-const int CTF_FLAG_NEUTRAL                             = 2048;
-const int CTF_SHIELDED                                 = 4096;
-#endif
-
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 #include <common/vehicles/all.qh>
 #include <server/teamplay.qh>
@@ -684,6 +511,8 @@ void shockwave_spawn(string m, vector org, float sz, float t1, float t2)
 // Event Handlers
 // ==============
 
+void nades_GiveBonus(entity player, float score);
+
 void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
 {
        entity enemy_flag = ((capturetype == CAPTURE_NORMAL) ? toucher.flagcarried : toucher);
@@ -1329,8 +1158,8 @@ void ctf_Reset(entity this)
        ctf_RespawnFlag(this);
 }
 
-void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_FlagSetup()
-{SELFPARAM();
+void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map by ctf_FlagSetup()
+{
        // bot waypoints
        waypoint_spawnforitem_force(self, self.origin);
        self.nearestwaypointtimeout = 0; // activate waypointing again
@@ -1355,8 +1184,10 @@ void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_Fla
        ctf_CaptureShield_Spawn(self);
 }
 
+.bool pushable;
+
 void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
-{SELFPARAM();
+{
        // declarations
        setself(flag); // for later usage with droptofloor()
 
@@ -1550,95 +1381,95 @@ int havocbot_ctf_teamcount(entity bot, vector org, float tc_radius)
        return c;
 }
 
-void havocbot_goalrating_ctf_ourflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourflag(entity this, float ratingscale)
+{
        entity head;
        head = ctf_worldflaglist;
        while (head)
        {
-               if (CTF_SAMETEAM(self, head))
+               if (CTF_SAMETEAM(this, head))
                        break;
                head = head.ctf_worldflagnext;
        }
        if (head)
-               navigation_routerating(head, ratingscale, 10000);
+               navigation_routerating(this, head, ratingscale, 10000);
 }
 
-void havocbot_goalrating_ctf_ourbase(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourbase(entity this, float ratingscale)
+{
        entity head;
        head = ctf_worldflaglist;
        while (head)
        {
-               if (CTF_SAMETEAM(self, head))
+               if (CTF_SAMETEAM(this, head))
                        break;
                head = head.ctf_worldflagnext;
        }
        if (!head)
                return;
 
-       navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
+       navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
 }
 
-void havocbot_goalrating_ctf_enemyflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale)
+{
        entity head;
        head = ctf_worldflaglist;
        while (head)
        {
                if(ctf_oneflag)
                {
-                       if(CTF_DIFFTEAM(self, head))
+                       if(CTF_DIFFTEAM(this, head))
                        {
                                if(head.team)
                                {
-                                       if(self.flagcarried)
+                                       if(this.flagcarried)
                                                break;
                                }
-                               else if(!self.flagcarried)
+                               else if(!this.flagcarried)
                                        break;
                        }
                }
-               else if(CTF_DIFFTEAM(self, head))
+               else if(CTF_DIFFTEAM(this, head))
                        break;
                head = head.ctf_worldflagnext;
        }
        if (head)
-               navigation_routerating(head, ratingscale, 10000);
+               navigation_routerating(this, head, ratingscale, 10000);
 }
 
-void havocbot_goalrating_ctf_enemybase(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_enemybase(entity this, float ratingscale)
+{
        if (!bot_waypoints_for_items)
        {
-               havocbot_goalrating_ctf_enemyflag(ratingscale);
+               havocbot_goalrating_ctf_enemyflag(this, ratingscale);
                return;
        }
 
        entity head;
 
-       head = havocbot_ctf_find_enemy_flag(self);
+       head = havocbot_ctf_find_enemy_flag(this);
 
        if (!head)
                return;
 
-       navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
+       navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
 }
 
-void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourstolenflag(entity this, float ratingscale)
+{
        entity mf;
 
-       mf = havocbot_ctf_find_flag(self);
+       mf = havocbot_ctf_find_flag(this);
 
        if(mf.ctf_status == FLAG_BASE)
                return;
 
        if(mf.tag_entity)
-               navigation_routerating(mf.tag_entity, ratingscale, 10000);
+               navigation_routerating(this, mf.tag_entity, ratingscale, 10000);
 }
 
-void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float df_radius)
+void havocbot_goalrating_ctf_droppedflags(entity this, float ratingscale, vector org, float df_radius)
 {
        entity head;
        head = ctf_worldflaglist;
@@ -1651,18 +1482,18 @@ void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float d
                        if(df_radius)
                        {
                                if(vlen(org-head.origin)<df_radius)
-                                       navigation_routerating(head, ratingscale, 10000);
+                                       navigation_routerating(self, head, ratingscale, 10000);
                        }
                        else
-                               navigation_routerating(head, ratingscale, 10000);
+                               navigation_routerating(self, head, ratingscale, 10000);
                }
 
                head = head.ctf_worldflagnext;
        }
 }
 
-void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_ctf_carrieritems(entity this, float ratingscale, vector org, float sradius)
+{
        entity head;
        float t;
        head = findchainfloat(bot_pickup, true);
@@ -1674,199 +1505,199 @@ void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float s
                if (vlen(head.origin - org) < sradius)
                {
                        // get the value of the item
-                       t = head.bot_pickupevalfunc(self, head) * 0.0001;
+                       t = head.bot_pickupevalfunc(this, head) * 0.0001;
                        if (t > 0)
-                               navigation_routerating(head, t * ratingscale, 500);
+                               navigation_routerating(this, head, t * ratingscale, 500);
                }
                head = head.chain;
        }
 }
 
-void havocbot_ctf_reset_role(entity bot)
+void havocbot_ctf_reset_role(entity this)
 {
        float cdefense, cmiddle, coffense;
        entity mf, ef;
        float c;
 
-       if(IS_DEAD(bot))
+       if(IS_DEAD(this))
                return;
 
-       if(vlen(havocbot_ctf_middlepoint)==0)
+       if(havocbot_ctf_middlepoint == '0 0 0')
                havocbot_calculate_middlepoint();
 
        // Check ctf flags
-       if (bot.flagcarried)
+       if (this.flagcarried)
        {
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_CARRIER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
                return;
        }
 
-       mf = havocbot_ctf_find_flag(bot);
-       ef = havocbot_ctf_find_enemy_flag(bot);
+       mf = havocbot_ctf_find_flag(this);
+       ef = havocbot_ctf_find_enemy_flag(this);
 
        // Retrieve stolen flag
        if(mf.ctf_status!=FLAG_BASE)
        {
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_RETRIEVER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
                return;
        }
 
        // If enemy flag is taken go to the middle to intercept pursuers
        if(ef.ctf_status!=FLAG_BASE)
        {
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
                return;
        }
 
        // if there is only me on the team switch to offense
        c = 0;
-       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, bot), LAMBDA(++c));
+       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), LAMBDA(++c));
 
        if(c==1)
        {
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE);
                return;
        }
 
        // Evaluate best position to take
        // Count mates on middle position
-       cmiddle = havocbot_ctf_teamcount(bot, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5);
+       cmiddle = havocbot_ctf_teamcount(this, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5);
 
        // Count mates on defense position
-       cdefense = havocbot_ctf_teamcount(bot, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5);
+       cdefense = havocbot_ctf_teamcount(this, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5);
 
        // Count mates on offense position
-       coffense = havocbot_ctf_teamcount(bot, ef.dropped_origin, havocbot_ctf_middlepoint_radius);
+       coffense = havocbot_ctf_teamcount(this, ef.dropped_origin, havocbot_ctf_middlepoint_radius);
 
        if(cdefense<=coffense)
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_DEFENSE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
        else if(coffense<=cmiddle)
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE);
        else
-               havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
 }
 
-void havocbot_role_ctf_carrier()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_ctf_carrier(entity this)
+{
+       if(IS_DEAD(this))
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.flagcarried == world)
+       if (this.flagcarried == world)
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
 
-               navigation_goalrating_start();
+               navigation_goalrating_start(this);
                if(ctf_oneflag)
-                       havocbot_goalrating_ctf_enemybase(50000);
+                       havocbot_goalrating_ctf_enemybase(this, 50000);
                else
-                       havocbot_goalrating_ctf_ourbase(50000);
+                       havocbot_goalrating_ctf_ourbase(this, 50000);
 
-               if(self.health<100)
-                       havocbot_goalrating_ctf_carrieritems(1000, self.origin, 1000);
+               if(this.health<100)
+                       havocbot_goalrating_ctf_carrieritems(this, 1000, this.origin, 1000);
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
 
-               if (self.navigation_hasgoals)
-                       self.havocbot_cantfindflag = time + 10;
-               else if (time > self.havocbot_cantfindflag)
+               if (this.navigation_hasgoals)
+                       this.havocbot_cantfindflag = time + 10;
+               else if (time > this.havocbot_cantfindflag)
                {
                        // Can't navigate to my own base, suicide!
                        // TODO: drop it and wander around
-                       Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+                       Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
                        return;
                }
        }
 }
 
-void havocbot_role_ctf_escort()
-{SELFPARAM();
+void havocbot_role_ctf_escort(entity this)
+{
        entity mf, ef;
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.flagcarried)
+       if (this.flagcarried)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
                return;
        }
 
        // If enemy flag is back on the base switch to previous role
-       ef = havocbot_ctf_find_enemy_flag(self);
+       ef = havocbot_ctf_find_enemy_flag(this);
        if(ef.ctf_status==FLAG_BASE)
        {
-               self.havocbot_role = self.havocbot_previous_role;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = this.havocbot_previous_role;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
        // If the flag carrier reached the base switch to defense
-       mf = havocbot_ctf_find_flag(self);
+       mf = havocbot_ctf_find_flag(this);
        if(mf.ctf_status!=FLAG_BASE)
        if(vlen(ef.origin - mf.dropped_origin) < 300)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_DEFENSE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
                return;
        }
 
        // Set the role timeout if necessary
-       if (!self.havocbot_role_timeout)
+       if (!this.havocbot_role_timeout)
        {
-               self.havocbot_role_timeout = time + random() * 30 + 60;
+               this.havocbot_role_timeout = time + random() * 30 + 60;
        }
 
        // If nothing happened just switch to previous role
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               self.havocbot_role = self.havocbot_previous_role;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = this.havocbot_previous_role;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
        // Chase the flag carrier
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               havocbot_goalrating_ctf_enemyflag(30000);
-               havocbot_goalrating_ctf_ourstolenflag(40000);
-               havocbot_goalrating_items(10000, self.origin, 10000);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
+               havocbot_goalrating_ctf_enemyflag(this, 30000);
+               havocbot_goalrating_ctf_ourstolenflag(this, 40000);
+               havocbot_goalrating_items(this, 10000, this.origin, 10000);
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_ctf_offense()
-{SELFPARAM();
+void havocbot_role_ctf_offense(entity this)
+{
        entity mf, ef;
        vector pos;
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.flagcarried)
+       if (this.flagcarried)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
                return;
        }
 
        // Check flags
-       mf = havocbot_ctf_find_flag(self);
-       ef = havocbot_ctf_find_enemy_flag(self);
+       mf = havocbot_ctf_find_flag(this);
+       ef = havocbot_ctf_find_enemy_flag(this);
 
        // Own flag stolen
        if(mf.ctf_status!=FLAG_BASE)
@@ -1877,9 +1708,9 @@ void havocbot_role_ctf_offense()
                        pos = mf.origin;
 
                // Try to get it if closer than the enemy base
-               if(vlen(self.origin-ef.dropped_origin)>vlen(self.origin-pos))
+               if(vlen(this.origin-ef.dropped_origin)>vlen(this.origin-pos))
                {
-                       havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+                       havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
                        return;
                }
        }
@@ -1894,173 +1725,173 @@ void havocbot_role_ctf_offense()
 
                if(vlen(pos-mf.dropped_origin)>700)
                {
-                       havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_ESCORT);
+                       havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_ESCORT);
                        return;
                }
        }
 
        // About to fail, switch to middlefield
-       if(self.health<50)
+       if(this.health<50)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_MIDDLE);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
                return;
        }
 
        // Set the role timeout if necessary
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 120;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 120;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               havocbot_goalrating_ctf_ourstolenflag(50000);
-               havocbot_goalrating_ctf_enemybase(20000);
-               havocbot_goalrating_items(5000, self.origin, 1000);
-               havocbot_goalrating_items(1000, self.origin, 10000);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
+               havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+               havocbot_goalrating_ctf_enemybase(this, 20000);
+               havocbot_goalrating_items(this, 5000, this.origin, 1000);
+               havocbot_goalrating_items(this, 1000, this.origin, 10000);
+               navigation_goalrating_end(this);
        }
 }
 
 // Retriever (temporary role):
-void havocbot_role_ctf_retriever()
-{SELFPARAM();
+void havocbot_role_ctf_retriever(entity this)
+{
        entity mf;
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.flagcarried)
+       if (this.flagcarried)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
                return;
        }
 
        // If flag is back on the base switch to previous role
-       mf = havocbot_ctf_find_flag(self);
+       mf = havocbot_ctf_find_flag(this);
        if(mf.ctf_status==FLAG_BASE)
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 20;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 20;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
                float rt_radius;
                rt_radius = 10000;
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               havocbot_goalrating_ctf_ourstolenflag(50000);
-               havocbot_goalrating_ctf_droppedflags(40000, self.origin, rt_radius);
-               havocbot_goalrating_ctf_enemybase(30000);
-               havocbot_goalrating_items(500, self.origin, rt_radius);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
+               havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+               havocbot_goalrating_ctf_droppedflags(this, 40000, this.origin, rt_radius);
+               havocbot_goalrating_ctf_enemybase(this, 30000);
+               havocbot_goalrating_items(this, 500, this.origin, rt_radius);
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_ctf_middle()
-{SELFPARAM();
+void havocbot_role_ctf_middle(entity this)
+{
        entity mf;
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.flagcarried)
+       if (this.flagcarried)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
                return;
        }
 
-       mf = havocbot_ctf_find_flag(self);
+       mf = havocbot_ctf_find_flag(this);
        if(mf.ctf_status!=FLAG_BASE)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
                return;
        }
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 10;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 10;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
                vector org;
 
                org = havocbot_ctf_middlepoint;
-               org.z = self.origin.z;
+               org.z = this.origin.z;
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               havocbot_goalrating_ctf_ourstolenflag(50000);
-               havocbot_goalrating_ctf_droppedflags(30000, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(10000, org, havocbot_ctf_middlepoint_radius * 0.5);
-               havocbot_goalrating_items(5000, org, havocbot_ctf_middlepoint_radius * 0.5);
-               havocbot_goalrating_items(2500, self.origin, 10000);
-               havocbot_goalrating_ctf_enemybase(2500);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
+               havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+               havocbot_goalrating_ctf_droppedflags(this, 30000, this.origin, 10000);
+               havocbot_goalrating_enemyplayers(this, 10000, org, havocbot_ctf_middlepoint_radius * 0.5);
+               havocbot_goalrating_items(this, 5000, org, havocbot_ctf_middlepoint_radius * 0.5);
+               havocbot_goalrating_items(this, 2500, this.origin, 10000);
+               havocbot_goalrating_ctf_enemybase(this, 2500);
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_ctf_defense()
-{SELFPARAM();
+void havocbot_role_ctf_defense(entity this)
+{
        entity mf;
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
 
-       if (self.flagcarried)
+       if (this.flagcarried)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
                return;
        }
 
        // If own flag was captured
-       mf = havocbot_ctf_find_flag(self);
+       mf = havocbot_ctf_find_flag(this);
        if(mf.ctf_status!=FLAG_BASE)
        {
-               havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+               havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
                return;
        }
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + 30;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + 30;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
-               havocbot_ctf_reset_role(self);
+               havocbot_ctf_reset_role(this);
                return;
        }
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
                float mp_radius;
                vector org;
@@ -2068,8 +1899,8 @@ void havocbot_role_ctf_defense()
                org = mf.dropped_origin;
                mp_radius = havocbot_ctf_middlepoint_radius;
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
                // if enemies are closer to our base, go there
                entity closestplayer = world;
@@ -2084,17 +1915,17 @@ void havocbot_role_ctf_defense()
                ));
 
                if(closestplayer)
-               if(DIFF_TEAM(closestplayer, self))
-               if(vlen(org - self.origin)>1000)
-               if(checkpvs(self.origin,closestplayer)||random()<0.5)
-                       havocbot_goalrating_ctf_ourbase(30000);
+               if(DIFF_TEAM(closestplayer, this))
+               if(vlen(org - this.origin)>1000)
+               if(checkpvs(this.origin,closestplayer)||random()<0.5)
+                       havocbot_goalrating_ctf_ourbase(this, 30000);
 
-               havocbot_goalrating_ctf_ourstolenflag(20000);
-               havocbot_goalrating_ctf_droppedflags(20000, org, mp_radius);
-               havocbot_goalrating_enemyplayers(15000, org, mp_radius);
-               havocbot_goalrating_items(10000, org, mp_radius);
-               havocbot_goalrating_items(5000, self.origin, 10000);
-               navigation_goalrating_end();
+               havocbot_goalrating_ctf_ourstolenflag(this, 20000);
+               havocbot_goalrating_ctf_droppedflags(this, 20000, org, mp_radius);
+               havocbot_goalrating_enemyplayers(this, 15000, org, mp_radius);
+               havocbot_goalrating_items(this, 10000, org, mp_radius);
+               havocbot_goalrating_items(this, 5000, this.origin, 10000);
+               navigation_goalrating_end(this);
        }
 }
 
@@ -2522,6 +2353,7 @@ bool superspec_Spectate(entity _player); // TODO
 void superspec_msg(string _center_title, string _con_title, entity _to, string _msg, float _spamlevel); // TODO
 MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand)
 {
+    SELFPARAM();
        if(IS_PLAYER(self) || MUTATOR_RETURNVALUE || !cvar("g_superspectate")) { return false; }
 
        if(cmd_name == "followfc")
@@ -2719,10 +2551,10 @@ void ctf_SpawnTeam (string teamname, int teamcolor)
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
-       WITH(entity, self, this, spawnfunc_ctf_team(this));
+       WITHSELF(this, spawnfunc_ctf_team(this));
 }
 
-void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
        ctf_teams = 2;
 
diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh
new file mode 100644 (file)
index 0000000..c44dfc3
--- /dev/null
@@ -0,0 +1,173 @@
+#pragma once
+
+#ifdef SVQC
+
+#include "../gamemode.qh"
+// used in cheats.qc
+void ctf_RespawnFlag(entity flag);
+
+// score rule declarations
+const int ST_CTF_CAPS = 1;
+const int SP_CTF_CAPS = 4;
+const int SP_CTF_CAPTIME = 5;
+const int SP_CTF_PICKUPS = 6;
+const int SP_CTF_DROPS = 7;
+const int SP_CTF_FCKILLS = 8;
+const int SP_CTF_RETURNS = 9;
+
+CLASS(Flag, Pickup)
+    ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13')
+    ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
+ENDCLASS(Flag)
+Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
+void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
+
+// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
+
+const float FLAG_SCALE = 0.6;
+
+const float FLAG_THINKRATE = 0.2;
+const float FLAG_TOUCHRATE = 0.5;
+const float WPFE_THINKRATE = 0.5;
+
+const vector FLAG_DROP_OFFSET = ('0 0 32');
+const vector FLAG_CARRY_OFFSET = ('-16 0 8');
+#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
+const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
+const vector FLAG_FLOAT_OFFSET = ('0 0 32');
+const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
+
+const vector VEHICLE_FLAG_OFFSET = ('0 0 96');
+const float VEHICLE_FLAG_SCALE = 1.0;
+
+// waypoint colors
+#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
+#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color)
+#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1')
+
+// sounds
+#define snd_flag_taken noise
+#define snd_flag_returned noise1
+#define snd_flag_capture noise2
+#define snd_flag_respawn noise3
+.string snd_flag_dropped;
+.string snd_flag_touch;
+.string snd_flag_pass;
+
+// effects
+.string toucheffect;
+.string passeffect;
+.string capeffect;
+
+// list of flags on the map
+entity ctf_worldflaglist;
+.entity ctf_worldflagnext;
+.entity ctf_staleflagnext;
+
+// waypoint sprites
+.entity bot_basewaypoint; // flag waypointsprite
+.entity wps_helpme;
+.entity wps_flagbase;
+.entity wps_flagcarrier;
+.entity wps_flagdropped;
+.entity wps_enemyflagcarrier;
+.float wps_helpme_time;
+bool wpforenemy_announced;
+float wpforenemy_nextthink;
+
+// statuses
+const int FLAG_BASE = 1;
+const int FLAG_DROPPED = 2;
+const int FLAG_CARRY = 3;
+const int FLAG_PASSING = 4;
+
+const int DROP_NORMAL = 1;
+const int DROP_THROW = 2;
+const int DROP_PASS = 3;
+const int DROP_RESET = 4;
+
+const int PICKUP_BASE = 1;
+const int PICKUP_DROPPED = 2;
+
+const int CAPTURE_NORMAL = 1;
+const int CAPTURE_DROPPED = 2;
+
+const int RETURN_TIMEOUT = 1;
+const int RETURN_DROPPED = 2;
+const int RETURN_DAMAGE = 3;
+const int RETURN_SPEEDRUN = 4;
+const int RETURN_NEEDKILL = 5;
+
+void ctf_Handle_Throw(entity player, entity receiver, float droptype);
+
+// flag properties
+#define ctf_spawnorigin dropped_origin
+bool ctf_stalemate; // indicates that a stalemate is active
+float ctf_captimerecord; // record time for capturing the flag
+.float ctf_pickuptime;
+.float ctf_droptime;
+.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
+.entity ctf_dropper; // don't allow spam of dropping the flag
+.int max_flag_health;
+.float next_take_time;
+.bool ctf_flagdamaged;
+int ctf_teams;
+
+// passing/throwing properties
+.float pass_distance;
+.entity pass_sender;
+.entity pass_target;
+.float throw_antispam;
+.float throw_prevtime;
+.int throw_count;
+
+// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
+.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
+float ctf_captureshield_min_negscore; // punish at -20 points
+float ctf_captureshield_max_ratio; // punish at most 30% of each team
+float ctf_captureshield_force; // push force of the shield
+
+// 1 flag ctf
+bool ctf_oneflag; // indicates whether or not a neutral flag has been found
+
+// bot player logic
+const int HAVOCBOT_CTF_ROLE_NONE = 0;
+const int HAVOCBOT_CTF_ROLE_DEFENSE = 2;
+const int HAVOCBOT_CTF_ROLE_MIDDLE = 4;
+const int HAVOCBOT_CTF_ROLE_OFFENSE = 8;
+const int HAVOCBOT_CTF_ROLE_CARRIER = 16;
+const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32;
+const int HAVOCBOT_CTF_ROLE_ESCORT = 64;
+
+.bool havocbot_cantfindflag;
+
+vector havocbot_ctf_middlepoint;
+float havocbot_ctf_middlepoint_radius;
+
+void havocbot_role_ctf_setrole(entity bot, int role);
+
+// team checking
+#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
+#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
+
+// networked flag statuses
+.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS);
+#endif
+
+const int CTF_RED_FLAG_TAKEN                   = 1;
+const int CTF_RED_FLAG_LOST                            = 2;
+const int CTF_RED_FLAG_CARRYING                        = 3;
+const int CTF_BLUE_FLAG_TAKEN                  = 4;
+const int CTF_BLUE_FLAG_LOST                   = 8;
+const int CTF_BLUE_FLAG_CARRYING               = 12;
+const int CTF_YELLOW_FLAG_TAKEN                        = 16;
+const int CTF_YELLOW_FLAG_LOST                 = 32;
+const int CTF_YELLOW_FLAG_CARRYING             = 48;
+const int CTF_PINK_FLAG_TAKEN                  = 64;
+const int CTF_PINK_FLAG_LOST                   = 128;
+const int CTF_PINK_FLAG_CARRYING               = 192;
+const int CTF_NEUTRAL_FLAG_TAKEN               = 256;
+const int CTF_NEUTRAL_FLAG_LOST                        = 512;
+const int CTF_NEUTRAL_FLAG_CARRYING            = 768;
+const int CTF_FLAG_NEUTRAL                             = 2048;
+const int CTF_SHIELDED                                 = 4096;
index fed9a89201290d7290ed098e3de358d0670972d9..1f99c938de021984872d4416b6167dab6c0e232a 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_cts.qh"
 #include <server/race.qh>
 
 #ifndef GAMEMODE_CTS_H
@@ -51,25 +52,25 @@ bool autocvar_g_cts_selfdamage;
 
 // legacy bot roles
 .float race_checkpoint;
-void havocbot_role_cts()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_cts(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
                FOREACH_ENTITY_CLASS("trigger_race_checkpoint", true,
                {
-                       if(it.cnt == self.race_checkpoint)
-                               navigation_routerating(it, 1000000, 5000);
-                       else if(self.race_checkpoint == -1)
-                               navigation_routerating(it, 1000000, 5000);
+                       if(it.cnt == this.race_checkpoint)
+                               navigation_routerating(this, it, 1000000, 5000);
+                       else if(this.race_checkpoint == -1)
+                               navigation_routerating(this, it, 1000000, 5000);
                });
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
        }
 }
 
@@ -95,6 +96,7 @@ void cts_EventLog(string mode, entity actor) // use an alias for easy changing a
                GameLogEcho(strcat(":cts:", mode, ":", ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
 }
 
+void KillIndicator_Think();
 void CTS_ClientKill(entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed
 {
     e.killindicator = spawn();
@@ -383,8 +385,10 @@ MUTATOR_HOOKFUNCTION(cts, GetRecords)
        return false;
 }
 
+void ClientKill_Now();
 MUTATOR_HOOKFUNCTION(cts, ClientKill)
 {
+    SELFPARAM();
        ret_float = 0;
 
        if(self.killindicator && self.killindicator.health == 1) // self.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill
diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qh b/qcsrc/server/mutators/mutator/gamemode_cts.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index d05bc18bd2125fc0de1eadc9c52c3fbd133af0f2..866370351377f1dda2c9ac12fa447b8a3ed8f4db 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_deathmatch.qh"
 #ifndef GAMEMODE_DEATHMATCH_H
 #define GAMEMODE_DEATHMATCH_H
 
diff --git a/qcsrc/server/mutators/mutator/gamemode_deathmatch.qh b/qcsrc/server/mutators/mutator/gamemode_deathmatch.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 1c1620414a143abf0cbb3464e3ce376f5f8ba996..01f17ec9feee1d09cd86b2e02bf000eba020b89d 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_domination.qh"
 #ifndef GAMEMODE_DOMINATION_H
 #define GAMEMODE_DOMINATION_H
 
@@ -450,20 +451,20 @@ void Domination_RoundStart()
 }
 
 //go to best items, or control points you don't own
-void havocbot_role_dom()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_dom(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               havocbot_goalrating_controlpoints(10000, self.origin, 15000);
-               havocbot_goalrating_items(8000, self.origin, 8000);
-               //havocbot_goalrating_enemyplayers(3000, self.origin, 2000);
-               //havocbot_goalrating_waypoints(1, self.origin, 1000);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
+               havocbot_goalrating_controlpoints(this, 10000, this.origin, 15000);
+               havocbot_goalrating_items(this, 8000, this.origin, 8000);
+               //havocbot_goalrating_enemyplayers(this, 3000, this.origin, 2000);
+               //havocbot_goalrating_waypoints(1, this.origin, 1000);
+               navigation_goalrating_end(this);
        }
 }
 
@@ -629,15 +630,16 @@ void ScoreRules_dom(float teams)
 }
 
 // code from here on is just to support maps that don't have control point and team entities
-void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage)
+void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
 {SELFPARAM();
+    TC(Sound, capsound);
        setself(spawn());
        self.classname = "dom_team";
        self.netname = strzone(teamname);
        self.cnt = teamcolor;
        self.model = pointmodel;
        self.skin = pointskin;
-       self.noise = strzone(capsound);
+       self.noise = strzone(Sound_fixpath(capsound));
        self.noise1 = strzone(capnarration);
        self.message = strzone(capmessage);
 
@@ -667,18 +669,19 @@ void dom_spawnpoint(vector org)
 }
 
 // spawn some default teams if the map is not set up for domination
-void dom_spawnteams(float teams)
+void dom_spawnteams(int teams)
 {
-       dom_spawnteam(Team_ColoredFullName(NUM_TEAM_1), NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND(DOM_CLAIM), "", "Red team has captured a control point");
-       dom_spawnteam(Team_ColoredFullName(NUM_TEAM_2), NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND(DOM_CLAIM), "", "Blue team has captured a control point");
+    TC(int, teams);
+       dom_spawnteam(Team_ColoredFullName(NUM_TEAM_1), NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND_DOM_CLAIM, "", "Red team has captured a control point");
+       dom_spawnteam(Team_ColoredFullName(NUM_TEAM_2), NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND_DOM_CLAIM, "", "Blue team has captured a control point");
        if(teams >= 3)
-               dom_spawnteam(Team_ColoredFullName(NUM_TEAM_3), NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND(DOM_CLAIM), "", "Yellow team has captured a control point");
+               dom_spawnteam(Team_ColoredFullName(NUM_TEAM_3), NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND_DOM_CLAIM, "", "Yellow team has captured a control point");
        if(teams >= 4)
-               dom_spawnteam(Team_ColoredFullName(NUM_TEAM_4), NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND(DOM_CLAIM), "", "Pink team has captured a control point");
-       dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
+               dom_spawnteam(Team_ColoredFullName(NUM_TEAM_4), NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND_DOM_CLAIM, "", "Pink team has captured a control point");
+       dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, SND_Null, "", "");
 }
 
-void dom_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void dom_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
        // if no teams are found, spawn defaults
        if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qh b/qcsrc/server/mutators/mutator/gamemode_domination.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 236ec2dd86bfe2b53fcfb5d339386e093dab9870..8482e258e9d0f8fdf2e64579e53246a766e21bdc 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_freezetag.qh"
 #ifndef GAMEMODE_FREEZETAG_H
 #define GAMEMODE_FREEZETAG_H
 
@@ -262,90 +263,87 @@ float freezetag_isEliminated(entity e)
 // Bot player logic
 // ================
 
-void() havocbot_role_ft_freeing;
-void() havocbot_role_ft_offense;
+void(entity this) havocbot_role_ft_freeing;
+void(entity this) havocbot_role_ft_offense;
 
-void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradius)
-{SELFPARAM();
-       float distance;
-
-       FOREACH_CLIENT(IS_PLAYER(it) && it != self && SAME_TEAM(it, self), LAMBDA(
+void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org, float sradius)
+{
+       FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), LAMBDA(
                if (STAT(FROZEN, it) == 1)
                {
-                       distance = vlen(it.origin - org);
-                       if (distance > sradius)
+                       if(vdist(it.origin - org, >, sradius))
                                continue;
-                       navigation_routerating(it, ratingscale, 2000);
+                       navigation_routerating(this, it, ratingscale, 2000);
                }
                else
                {
                        // If teamate is not frozen still seek them out as fight better
                        // in a group.
-                       navigation_routerating(it, ratingscale/3, 2000);
+                       navigation_routerating(this, it, ratingscale/3, 2000);
                }
        ));
 }
 
-void havocbot_role_ft_offense()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_ft_offense(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + random() * 10 + 20;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + random() * 10 + 20;
 
        // Count how many players on team are unfrozen.
        int unfrozen = 0;
-       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, self) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++));
+       FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++));
 
        // If only one left on team or if role has timed out then start trying to free players.
-       if (((unfrozen == 0) && (!STAT(FROZEN, self))) || (time > self.havocbot_role_timeout))
+       if (((unfrozen == 0) && (!STAT(FROZEN, this))) || (time > this.havocbot_role_timeout))
        {
                LOG_TRACE("changing role to freeing\n");
-               self.havocbot_role = havocbot_role_ft_freeing;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_ft_freeing;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (time > self.bot_strategytime)
+       if (time > this.bot_strategytime)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-
-               navigation_goalrating_start();
-               havocbot_goalrating_items(10000, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
-               havocbot_goalrating_freeplayers(9000, self.origin, 10000);
-               //havocbot_goalrating_waypoints(1, self.origin, 1000);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+
+               navigation_goalrating_start(this);
+               havocbot_goalrating_items(this, 10000, this.origin, 10000);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 10000);
+               havocbot_goalrating_freeplayers(this, 9000, this.origin, 10000);
+               //havocbot_goalrating_waypoints(1, this.origin, 1000);
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_ft_freeing()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_ft_freeing(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + random() * 10 + 20;
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + random() * 10 + 20;
 
-       if (time > self.havocbot_role_timeout)
+       if (time > this.havocbot_role_timeout)
        {
                LOG_TRACE("changing role to offense\n");
-               self.havocbot_role = havocbot_role_ft_offense;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_ft_offense;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (time > self.bot_strategytime)
+       if (time > this.bot_strategytime)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-
-               navigation_goalrating_start();
-               havocbot_goalrating_items(8000, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(10000, self.origin, 10000);
-               havocbot_goalrating_freeplayers(20000, self.origin, 10000);
-               //havocbot_goalrating_waypoints(1, self.origin, 1000);
-               navigation_goalrating_end();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+
+               navigation_goalrating_start(this);
+               havocbot_goalrating_items(this, 8000, this.origin, 10000);
+               havocbot_goalrating_enemyplayers(this, 10000, this.origin, 10000);
+               havocbot_goalrating_freeplayers(this, 20000, this.origin, 10000);
+               //havocbot_goalrating_waypoints(1, this.origin, 1000);
+               navigation_goalrating_end(this);
        }
 }
 
@@ -364,24 +362,25 @@ void ft_RemovePlayer()
 }
 
 MUTATOR_HOOKFUNCTION(ft, ClientDisconnect)
-{SELFPARAM();
+{
        ft_RemovePlayer();
        return 1;
 }
 
 MUTATOR_HOOKFUNCTION(ft, MakePlayerObserver)
-{SELFPARAM();
+{
        ft_RemovePlayer();
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(ft, PlayerDies)
 {
+    SELFPARAM();
        if(round_handler_IsActive())
        if(round_handler_CountdownRunning())
        {
                if(STAT(FROZEN, frag_target))
-                       WITH(entity, self, frag_target, freezetag_Unfreeze(world));
+                       WITHSELF(frag_target, freezetag_Unfreeze(world));
                freezetag_count_alive_players();
                return 1; // let the player die so that he can respawn whenever he wants
        }
@@ -399,7 +398,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
                        freezetag_LastPlayerForTeam_Notify();
                }
                else
-                       WITH(entity, self, frag_target, freezetag_Unfreeze(world)); // remove ice
+                       WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice
                frag_target.health = 0; // Unfreeze resets health
                frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
                return 1;
@@ -408,7 +407,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
        if(STAT(FROZEN, frag_target))
                return 1;
 
-       WITH(entity, self, frag_target, freezetag_Freeze(frag_attacker));
+       WITHSELF(frag_target, freezetag_Freeze(frag_attacker));
        freezetag_LastPlayerForTeam_Notify();
 
        if(frag_attacker == frag_target || frag_attacker == world)
@@ -453,7 +452,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(ft, reset_map_players)
-{SELFPARAM();
+{
        FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
                it.killcount = 0;
                it.freezetag_frozen_timeout = -1;
diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qh b/qcsrc/server/mutators/mutator/gamemode_freezetag.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 64b710f22e08fcde41d5697f73d84568072199af..efb6842e5dedb8137e9c6201f7d5e8f83e1c1d5f 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_invasion.qh"
 #ifndef GAMEMODE_INVASION_H
 #define GAMEMODE_INVASION_H
 
@@ -481,7 +482,7 @@ void invasion_ScoreRules(float inv_teams)
        ScoreRules_basics_end();
 }
 
-void invasion_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
        if(autocvar_g_invasion_teams)
                invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qh b/qcsrc/server/mutators/mutator/gamemode_invasion.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 073631e702ebd346a8aabf7c2e9bb95c327c8207..66ac8a80e38619e61012ce18b3185cda04556926 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_keepaway.qh"
 #ifndef GAMEMODE_KEEPAWAY_H
 #define GAMEMODE_KEEPAWAY_H
 
@@ -35,8 +36,8 @@ const float SP_KEEPAWAY_PICKUPS = 4;
 const float SP_KEEPAWAY_CARRIERKILLS = 5;
 const float SP_KEEPAWAY_BCTIME = 6;
 
-void() havocbot_role_ka_carrier;
-void() havocbot_role_ka_collector;
+void(entity this) havocbot_role_ka_carrier;
+void(entity this) havocbot_role_ka_collector;
 
 void ka_DropEvent(entity plyr);
 #endif
@@ -81,8 +82,8 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an
 }
 
 void ka_TouchEvent();
-void ka_RespawnBall() // runs whenever the ball needs to be relocated
-{SELFPARAM();
+void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
+{
        if(gameover) { return; }
        vector oldballorigin = self.origin;
 
@@ -99,7 +100,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
        self.touch = ka_TouchEvent;
-       self.think = ka_RespawnBall;
+       setthink(self, ka_RespawnBall);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
        Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
@@ -129,7 +130,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        if(!self) { return; }
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
        { // The ball fell off the map, respawn it since players can't get to it
-               ka_RespawnBall();
+               ka_RespawnBall(self);
                return;
        }
        if(IS_DEAD(other)) { return; }
@@ -192,7 +193,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
        ball.touch = ka_TouchEvent;
-       ball.think = ka_RespawnBall;
+       setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
        ball.effects &= ~EF_NODRAW;
@@ -229,12 +230,12 @@ void ka_Reset(entity this)
 
        if(time < game_starttime)
        {
-               this.think = ka_RespawnBall;
+               setthink(this, ka_RespawnBall);
                this.touch = func_null;
                this.nextthink = game_starttime;
        }
        else
-               ka_RespawnBall();
+               ka_RespawnBall(this);
 }
 
 
@@ -242,68 +243,68 @@ void ka_Reset(entity this)
 // Bot player logic
 // ================
 
-void havocbot_goalrating_ball(float ratingscale, vector org)
-{SELFPARAM();
+void havocbot_goalrating_ball(entity this, float ratingscale, vector org)
+{
        float t;
        entity ball_owner;
        ball_owner = ka_ball.owner;
 
-       if (ball_owner == self)
+       if (ball_owner == this)
                return;
 
        // If ball is carried by player then hunt them down.
        if (ball_owner)
        {
-               t = (self.health + self.armorvalue) / (ball_owner.health + ball_owner.armorvalue);
-               navigation_routerating(ball_owner, t * ratingscale, 2000);
+               t = (this.health + this.armorvalue) / (ball_owner.health + ball_owner.armorvalue);
+               navigation_routerating(this, ball_owner, t * ratingscale, 2000);
        }
        else // Ball has been dropped so collect.
-               navigation_routerating(ka_ball, ratingscale, 2000);
+               navigation_routerating(this, ka_ball, ratingscale, 2000);
 }
 
-void havocbot_role_ka_carrier()
-{SELFPARAM();
-       if (IS_DEAD(self))
+void havocbot_role_ka_carrier(entity this)
+{
+       if (IS_DEAD(this))
                return;
 
-       if (time > self.bot_strategytime)
+       if (time > this.bot_strategytime)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
 
-               navigation_goalrating_start();
-               havocbot_goalrating_items(10000, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
-               //havocbot_goalrating_waypoints(1, self.origin, 1000);
-               navigation_goalrating_end();
+               navigation_goalrating_start(this);
+               havocbot_goalrating_items(this, 10000, this.origin, 10000);
+               havocbot_goalrating_enemyplayers(this, 20000, this.origin, 10000);
+               //havocbot_goalrating_waypoints(1, this.origin, 1000);
+               navigation_goalrating_end(this);
        }
 
-       if (!self.ballcarried)
+       if (!this.ballcarried)
        {
-               self.havocbot_role = havocbot_role_ka_collector;
-               self.bot_strategytime = 0;
+               this.havocbot_role = havocbot_role_ka_collector;
+               this.bot_strategytime = 0;
        }
 }
 
-void havocbot_role_ka_collector()
-{SELFPARAM();
-       if (IS_DEAD(self))
+void havocbot_role_ka_collector(entity this)
+{
+       if (IS_DEAD(this))
                return;
 
-       if (time > self.bot_strategytime)
+       if (time > this.bot_strategytime)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
 
-               navigation_goalrating_start();
-               havocbot_goalrating_items(10000, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(1000, self.origin, 10000);
-               havocbot_goalrating_ball(20000, self.origin);
-               navigation_goalrating_end();
+               navigation_goalrating_start(this);
+               havocbot_goalrating_items(this, 10000, this.origin, 10000);
+               havocbot_goalrating_enemyplayers(this, 1000, this.origin, 10000);
+               havocbot_goalrating_ball(this, 20000, this.origin);
+               navigation_goalrating_end(this);
        }
 
-       if (self.ballcarried)
+       if (this.ballcarried)
        {
-               self.havocbot_role = havocbot_role_ka_carrier;
-               self.bot_strategytime = 0;
+               this.havocbot_role = havocbot_role_ka_carrier;
+               this.bot_strategytime = 0;
        }
 }
 
diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qh b/qcsrc/server/mutators/mutator/gamemode_keepaway.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 6720f053a1e438e112a2a54f8a71d110b089e9f1..dbcaa5f898362a082be5f916222151c0c1e30e7d 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_keyhunt.qh"
 #ifndef GAMEMODE_KEYHUNT_H
 #define GAMEMODE_KEYHUNT_H
 
@@ -45,7 +46,7 @@ float kh_tracking_enabled;
 .entity kh_next;
 float kh_Key_AllOwnedByWhichTeam();
 
-typedef void() kh_Think_t;
+USING(kh_Think_t, void());
 void kh_StartRound();
 void kh_Controller_SetThink(float t, kh_Think_t func);
 
@@ -759,7 +760,7 @@ void kh_Key_Think()  // runs all the time
                        if(vlen(key.owner.origin - p) > autocvar_g_balance_keyhunt_maxdist)
                                goto not_winning;
                kh_WinnerTeam(self.team);
-:not_winning
+LABEL(not_winning)
        }
 
        if(kh_interferemsg_time && time > kh_interferemsg_time)
@@ -1090,198 +1091,198 @@ void kh_finalize()
 
 // legacy bot role
 
-void() havocbot_role_kh_carrier;
-void() havocbot_role_kh_defense;
-void() havocbot_role_kh_offense;
-void() havocbot_role_kh_freelancer;
+void(entity this) havocbot_role_kh_carrier;
+void(entity this) havocbot_role_kh_defense;
+void(entity this) havocbot_role_kh_offense;
+void(entity this) havocbot_role_kh_freelancer;
 
 
-void havocbot_goalrating_kh(float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
-{SELFPARAM();
+void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
+{
        entity head;
        for (head = kh_worldkeylist; head; head = head.kh_worldkeynext)
        {
-               if(head.owner == self)
+               if(head.owner == this)
                        continue;
                if(!kh_tracking_enabled)
                {
                        // if it's carried by our team we know about it
                        // otherwise we have to see it to know about it
-                       if(!head.owner || head.team != self.team)
+                       if(!head.owner || head.team != this.team)
                        {
-                               traceline(self.origin + self.view_ofs, head.origin, MOVE_NOMONSTERS, self);
+                               traceline(this.origin + this.view_ofs, head.origin, MOVE_NOMONSTERS, this);
                                if (trace_fraction < 1 && trace_ent != head)
                                        continue; // skip what I can't see
                        }
                }
                if(!head.owner)
-                       navigation_routerating(head, ratingscale_dropped * BOT_PICKUP_RATING_HIGH, 100000);
-               else if(head.team == self.team)
-                       navigation_routerating(head.owner, ratingscale_team * BOT_PICKUP_RATING_HIGH, 100000);
+                       navigation_routerating(this, head, ratingscale_dropped * BOT_PICKUP_RATING_HIGH, 100000);
+               else if(head.team == this.team)
+                       navigation_routerating(this, head.owner, ratingscale_team * BOT_PICKUP_RATING_HIGH, 100000);
                else
-                       navigation_routerating(head.owner, ratingscale_enemy * BOT_PICKUP_RATING_HIGH, 100000);
+                       navigation_routerating(this, head.owner, ratingscale_enemy * BOT_PICKUP_RATING_HIGH, 100000);
        }
 
-       havocbot_goalrating_items(1, self.origin, 10000);
+       havocbot_goalrating_items(this, 1, this.origin, 10000);
 }
 
-void havocbot_role_kh_carrier()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_kh_carrier(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (!(self.kh_next))
+       if (!(this.kh_next))
        {
                LOG_TRACE("changing role to freelancer\n");
-               self.havocbot_role = havocbot_role_kh_freelancer;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_kh_freelancer;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
-               if(kh_Key_AllOwnedByWhichTeam() == self.team)
-                       havocbot_goalrating_kh(10, 0.1, 0.1); // bring home
+               if(kh_Key_AllOwnedByWhichTeam() == this.team)
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // bring home
                else
-                       havocbot_goalrating_kh(4, 4, 1); // play defensively
+                       havocbot_goalrating_kh(this, 4, 4, 1); // play defensively
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_kh_defense()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_kh_defense(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (self.kh_next)
+       if (this.kh_next)
        {
                LOG_TRACE("changing role to carrier\n");
-               self.havocbot_role = havocbot_role_kh_carrier;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_kh_carrier;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + random() * 10 + 20;
-       if (time > self.havocbot_role_timeout)
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + random() * 10 + 20;
+       if (time > this.havocbot_role_timeout)
        {
                LOG_TRACE("changing role to freelancer\n");
-               self.havocbot_role = havocbot_role_kh_freelancer;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_kh_freelancer;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
                float key_owner_team;
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
                key_owner_team = kh_Key_AllOwnedByWhichTeam();
-               if(key_owner_team == self.team)
-                       havocbot_goalrating_kh(10, 0.1, 0.1); // defend key carriers
+               if(key_owner_team == this.team)
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend key carriers
                else if(key_owner_team == -1)
-                       havocbot_goalrating_kh(4, 1, 0.1); // play defensively
+                       havocbot_goalrating_kh(this, 4, 1, 0.1); // play defensively
                else
-                       havocbot_goalrating_kh(0.1, 0.1, 10); // ATTACK ANYWAY
+                       havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK ANYWAY
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_kh_offense()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_kh_offense(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (self.kh_next)
+       if (this.kh_next)
        {
                LOG_TRACE("changing role to carrier\n");
-               self.havocbot_role = havocbot_role_kh_carrier;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_kh_carrier;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + random() * 10 + 20;
-       if (time > self.havocbot_role_timeout)
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + random() * 10 + 20;
+       if (time > this.havocbot_role_timeout)
        {
                LOG_TRACE("changing role to freelancer\n");
-               self.havocbot_role = havocbot_role_kh_freelancer;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_kh_freelancer;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
                float key_owner_team;
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
                key_owner_team = kh_Key_AllOwnedByWhichTeam();
-               if(key_owner_team == self.team)
-                       havocbot_goalrating_kh(10, 0.1, 0.1); // defend anyway
+               if(key_owner_team == this.team)
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend anyway
                else if(key_owner_team == -1)
-                       havocbot_goalrating_kh(0.1, 1, 4); // play offensively
+                       havocbot_goalrating_kh(this, 0.1, 1, 4); // play offensively
                else
-                       havocbot_goalrating_kh(0.1, 0.1, 10); // ATTACK! EMERGENCY!
+                       havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK! EMERGENCY!
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
        }
 }
 
-void havocbot_role_kh_freelancer()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_kh_freelancer(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
-       if (self.kh_next)
+       if (this.kh_next)
        {
                LOG_TRACE("changing role to carrier\n");
-               self.havocbot_role = havocbot_role_kh_carrier;
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role = havocbot_role_kh_carrier;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (!self.havocbot_role_timeout)
-               self.havocbot_role_timeout = time + random() * 10 + 10;
-       if (time > self.havocbot_role_timeout)
+       if (!this.havocbot_role_timeout)
+               this.havocbot_role_timeout = time + random() * 10 + 10;
+       if (time > this.havocbot_role_timeout)
        {
                if (random() < 0.5)
                {
                        LOG_TRACE("changing role to offense\n");
-                       self.havocbot_role = havocbot_role_kh_offense;
+                       this.havocbot_role = havocbot_role_kh_offense;
                }
                else
                {
                        LOG_TRACE("changing role to defense\n");
-                       self.havocbot_role = havocbot_role_kh_defense;
+                       this.havocbot_role = havocbot_role_kh_defense;
                }
-               self.havocbot_role_timeout = 0;
+               this.havocbot_role_timeout = 0;
                return;
        }
 
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
                float key_owner_team;
 
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
                key_owner_team = kh_Key_AllOwnedByWhichTeam();
-               if(key_owner_team == self.team)
-                       havocbot_goalrating_kh(10, 0.1, 0.1); // defend anyway
+               if(key_owner_team == this.team)
+                       havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend anyway
                else if(key_owner_team == -1)
-                       havocbot_goalrating_kh(1, 10, 4); // prefer dropped keys
+                       havocbot_goalrating_kh(this, 1, 10, 4); // prefer dropped keys
                else
-                       havocbot_goalrating_kh(0.1, 0.1, 10); // ATTACK ANYWAY
+                       havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK ANYWAY
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
        }
 }
 
@@ -1352,6 +1353,7 @@ MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
 
 MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
 {
+    SELFPARAM();
        if(IS_DEAD(self))
                return true;
 
diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qh b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index cbca46300258e03725240f7a6fdaf2941620228d..a2f1f2507ed2bdf4d9da74d58dddc89b5bf2730f 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_lms.qh"
 #ifndef GAMEMODE_LMS_H
 #define GAMEMODE_LMS_H
 
@@ -44,6 +45,7 @@ float LMS_NewPlayerLives();
 
 #ifdef IMPLEMENTATION
 
+#include <common/mutators/mutator/instagib/items.qc>
 #include <server/campaign.qh>
 #include <server/command/cmd.qh>
 
@@ -71,6 +73,8 @@ float LMS_NewPlayerLives()
        return bound(1, lms_lowest_lives, fl);
 }
 
+void ClearWinners();
+
 // LMS winning condition: game terminates if and only if there's at most one
 // one player who's living lives. Top two scores being equal cancels the time
 // limit.
@@ -169,7 +173,7 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
        // FIXME fix LMS scoring for new system
        if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
        {
-               self.classname = STR_OBSERVER;
+               TRANSMUTE(Observer, self);
                Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_NOLIVES);
        }
 }
@@ -210,8 +214,8 @@ MUTATOR_HOOKFUNCTION(lms, MakePlayerObserver)
 
 MUTATOR_HOOKFUNCTION(lms, ClientConnect)
 {SELFPARAM();
-       self.classname = STR_PLAYER;
-       campaign_bots_may_start = 1;
+       TRANSMUTE(Player, self);
+       campaign_bots_may_start = true;
 
        if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
        {
@@ -224,8 +228,8 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect)
 
 MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
 {SELFPARAM();
-       if(self.deadflag == DEAD_DYING)
-               self.deadflag = DEAD_RESPAWNING;
+       if(this.deadflag == DEAD_DYING)
+               this.deadflag = DEAD_RESPAWNING;
 
        return false;
 }
@@ -342,6 +346,7 @@ MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
 
 MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
 {
+    SELFPARAM();
        if(self.lms_spectate_warning)
        {
                // for the forfeit message...
diff --git a/qcsrc/server/mutators/mutator/gamemode_lms.qh b/qcsrc/server/mutators/mutator/gamemode_lms.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 03ee6eaf97c95b74c9c880d363d647f9bee24db2..3f6a8a85603f6c95dbb7361472d1e457ee5e3b3f 100644 (file)
@@ -1,3 +1,5 @@
+#include "gamemode_race.qh"
+
 #ifndef GAMEMODE_RACE_H
 #define GAMEMODE_RACE_H
 
@@ -31,13 +33,6 @@ REGISTER_MUTATOR(rc, false)
        return 0;
 }
 
-float race_teams;
-
-// scores
-const float ST_RACE_LAPS = 1;
-const float SP_RACE_LAPS = 4;
-const float SP_RACE_TIME = 5;
-const float SP_RACE_FASTEST = 6;
 #endif
 
 #ifdef IMPLEMENTATION
@@ -51,30 +46,30 @@ int autocvar_g_race_teams;
 
 // legacy bot roles
 .float race_checkpoint;
-void havocbot_role_race()
-{SELFPARAM();
-       if(IS_DEAD(self))
+void havocbot_role_race(entity this)
+{
+       if(IS_DEAD(this))
                return;
 
        entity e;
-       if (self.bot_strategytime < time)
+       if (this.bot_strategytime < time)
        {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
+               this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start(this);
 
                for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; )
                {
-                       if(e.cnt == self.race_checkpoint)
+                       if(e.cnt == this.race_checkpoint)
                        {
-                               navigation_routerating(e, 1000000, 5000);
+                               navigation_routerating(this, e, 1000000, 5000);
                        }
-                       else if(self.race_checkpoint == -1)
+                       else if(this.race_checkpoint == -1)
                        {
-                               navigation_routerating(e, 1000000, 5000);
+                               navigation_routerating(this, e, 1000000, 5000);
                        }
                }
 
-               navigation_goalrating_end();
+               navigation_goalrating_end(this);
        }
 }
 
diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qh b/qcsrc/server/mutators/mutator/gamemode_race.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
index 0c17a479b436fe13672b0d8c993f65d5ba2cd411..078e3517d08bb5dcfdc42eee5db23236a657077c 100644 (file)
@@ -1,10 +1,11 @@
+#include "gamemode_tdm.qh"
 #ifndef GAMEMODE_TDM_H
 #define GAMEMODE_TDM_H
 
 int autocvar_g_tdm_point_limit;
 int autocvar_g_tdm_point_leadlimit;
 bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit();
+void tdm_DelayedInit(entity this);
 
 REGISTER_MUTATOR(tdm, false)
 {
@@ -63,10 +64,10 @@ void tdm_SpawnTeam (string teamname, float teamcolor)
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
-       WITH(entity, self, this, spawnfunc_tdm_team(this));
+       WITHSELF(this, spawnfunc_tdm_team(this));
 }
 
-void tdm_DelayedInit()
+void tdm_DelayedInit(entity this)
 {
        // if no teams are found, spawn defaults
        if(find(world, classname, "tdm_team") == world)
diff --git a/qcsrc/server/mutators/mutator/gamemode_tdm.qh b/qcsrc/server/mutators/mutator/gamemode_tdm.qh
new file mode 100644 (file)
index 0000000..399830d
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "../gamemode.qh"
diff --git a/qcsrc/server/pathlib/_mod.inc b/qcsrc/server/pathlib/_mod.inc
new file mode 100644 (file)
index 0000000..c737f24
--- /dev/null
@@ -0,0 +1,8 @@
+// generated file; do not modify
+#include "costs.qc"
+#include "debug.qc"
+#include "expandnode.qc"
+#include "main.qc"
+#include "movenode.qc"
+#include "path_waypoint.qc"
+#include "utility.qc"
index 3e452f66e7dc02dbf2937410c44e08ba8684f95d..6b89bb640223c1776d48cf5f152f285789258868 100644 (file)
@@ -1,3 +1,4 @@
+#include "costs.qh"
 #include "pathlib.qh"
 
 float pathlib_g_static(entity parent,vector to, float static_cost)
diff --git a/qcsrc/server/pathlib/costs.qh b/qcsrc/server/pathlib/costs.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index abdfcbaed88087254fe4e0e1eabab38943ef6d2e..16f31e6efb691d56ec288327da5b6b5844fa867f 100644 (file)
@@ -1,3 +1,4 @@
+#include "debug.qh"
 #include "pathlib.qh"
 
 MODEL(SQUARE,       "models/pathlib/square.md3");
diff --git a/qcsrc/server/pathlib/debug.qh b/qcsrc/server/pathlib/debug.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 1f095a7856a1f8ff8304004016b9e9c73ac4dfdb..972c09c9782ce7372742ca9176d9f444105a6d97 100644 (file)
@@ -1,3 +1,4 @@
+#include "expandnode.qh"
 #include "pathlib.qh"
 #include "utility.qh"
 
diff --git a/qcsrc/server/pathlib/expandnode.qh b/qcsrc/server/pathlib/expandnode.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index f2534805764968c5e2ba2ba215a9f2372274fd56..d0c70b2b88dff8e9ec43c838c5f2b7dc4eb9907b 100644 (file)
@@ -1,3 +1,4 @@
+#include "main.qh"
 
 #include "pathlib.qh"
 #include "utility.qh"
index 177c432cf3c9210e8996dd54fbc043f68cb69bd5..6c8e4dc7692304b5bbd29dd85bb291b3557f783d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef PATHLIB_MAIN_H
-#define PATHLIB_MAIN_H
+#pragma once
+
 float buildpath_nodefilter_none(vector n,vector c,vector p);
 entity path_build(entity next, vector where, entity prev, entity start);
-#endif
index e3bcac61e4f289d2b54d8cd581e737baff7898d6..d1a4e68dff095c1e00019ecb4fbb740c355b936b 100644 (file)
@@ -1,3 +1,4 @@
+#include "movenode.qh"
 
 #include "pathlib.qh"
 #include "utility.qh"
diff --git a/qcsrc/server/pathlib/movenode.qh b/qcsrc/server/pathlib/movenode.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 4c3a7a1aadb70153b8918a330851467e74d19b1c..849514c37c8d975a4a7d71378a5ee59a0ce87fc4 100644 (file)
@@ -1,3 +1,4 @@
+#include "path_waypoint.qh"
 #include "../bot/waypoints.qh"
 
 #include "pathlib.qh"
diff --git a/qcsrc/server/pathlib/path_waypoint.qh b/qcsrc/server/pathlib/path_waypoint.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 5c331d4b404fc035ba83bbb14497e4b952e347b7..7364440240e719e51afcbeaab3f9e5f41c36d32f 100644 (file)
@@ -1,12 +1,11 @@
-#ifndef PATHLIB_H
-#define PATHLIB_H
+#pragma once
 
 .entity pathlib_list;
 .entity path_next;
 .entity path_prev;
 
 #define inwater(point) (pointcontents(point) == CONTENT_WATER)
-#define medium spawnshieldtime
+.int medium;
 
 const vector PLIB_FORWARD = '0 1 0';
 //#define PLIB_BACK    '0 -1 0'
@@ -107,5 +106,3 @@ var float  pathlib_makenode(entity parent,vector start, vector to, vector goal,f
 var float  buildpath_nodefilter(vector n,vector c,vector p);
 
 var float  pathlib_wpp_waypointcallback(entity wp, entity wp_prev);
-
-#endif
index bf72549a03b95c827a86ba8814ef9f33512e080b..3544e86ca2b659125a3a99a3bfef5dab008e9f07 100644 (file)
@@ -1,6 +1,5 @@
-#ifndef PATHLIB_UTILITY
-#define PATHLIB_UTILITY
+#pragma once
+
 float fsnap(float val,float fsize);
 entity pathlib_nodeatpoint(vector where);
 float tile_check_plus2(vector where);
-#endif
index 69ad7d0c65144deddf03134a68f83704b9861935..9f3fd6d28f952db4ffa59fb5983e605825cfb5a7 100644 (file)
@@ -1,3 +1,4 @@
+#include "playerdemo.qh"
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
@@ -93,9 +94,9 @@ void playerdemo_write_float(.float f, string name)
 }
 void playerdemo_write()
 {SELFPARAM();
-       if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
+       if(this.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
                return;
-       fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
+       fputs(this.playerdemo_fh, strcat(ftos(time - this.playerdemo_starttime), "\n"));
        PLAYERDEMO_FIELDS(playerdemo_write_)
 }
 void playerdemo_read_originvector(.vector f, string name)
@@ -146,9 +147,9 @@ float playerdemo_read(entity this)
                PLAYERDEMO_FIELDS(playerdemo_read_)
                {
                        time = this.playerdemo_time;
-                       WITH(entity, self, this, PlayerPreThink());
+                       WITHSELF(this, PlayerPreThink());
                        // not running physics though... this is just so we can run weapon stuff
-                       WITH(entity, self, this, PlayerPostThink());
+                       WITHSELF(this, PlayerPostThink());
                }
                this.playerdemo_time = stof(fgets(this.playerdemo_fh));
                if(this.playerdemo_time == 0)
index 7c19314328b25109ff3400e20fe2215ac8647c15..0fd42dca6b24257fad827cae16124d3edc8156cc 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef PLAYERDEMO_H
-#define PLAYERDEMO_H
+#pragma once
 
 void playerdemo_init(entity this);
 void playerdemo_shutdown();
@@ -8,4 +7,3 @@ float playerdemo_read(entity this);
 
 void playerdemo_open_read(string f);
 void playerdemo_open_write(string f);
-#endif
index 68ff068a77788aa0f28fb6bddd333a61e9de48d4..f3528d081072ce7e4314a5ca80b4a6a03bdff8ee 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef PORTALS_H
-#define PORTALS_H
+#pragma once
 
 .float portal_id;
 .entity portal_in, portal_out;
@@ -12,4 +11,3 @@ void Portal_ClearWithID(entity own, float id);
 
 vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle);
 void Portal_ClearAll_PortalsOnly(entity own);
-#endif
diff --git a/qcsrc/server/progdefs.h b/qcsrc/server/progdefs.h
deleted file mode 100644 (file)
index eb15c45..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-
-/* file generated by qcc, do not modify */
-
-typedef struct
-{      int     pad[28];
-       int     self;
-       int     other;
-       int     world;
-       float   time;
-       float   frametime;
-       float   force_retouch;
-       string_t        mapname;
-       float   deathmatch;
-       float   coop;
-       float   teamplay;
-       float   serverflags;
-       float   total_secrets;
-       float   total_monsters;
-       float   found_secrets;
-       float   killed_monsters;
-       float   parm1;
-       float   parm2;
-       float   parm3;
-       float   parm4;
-       float   parm5;
-       float   parm6;
-       float   parm7;
-       float   parm8;
-       float   parm9;
-       float   parm10;
-       float   parm11;
-       float   parm12;
-       float   parm13;
-       float   parm14;
-       float   parm15;
-       float   parm16;
-       vec3_t  v_forward;
-       vec3_t  v_up;
-       vec3_t  v_right;
-       float   trace_allsolid;
-       float   trace_startsolid;
-       float   trace_fraction;
-       vec3_t  trace_endpos;
-       vec3_t  trace_plane_normal;
-       float   trace_plane_dist;
-       int     trace_ent;
-       float   trace_inopen;
-       float   trace_inwater;
-       int     msg_entity;
-       func_t  main;
-       func_t  StartFrame;
-       func_t  PlayerPreThink;
-       func_t  PlayerPostThink;
-       func_t  ClientKill;
-       func_t  ClientConnect;
-       func_t  PutClientInServer;
-       func_t  ClientDisconnect;
-       func_t  SetNewParms;
-       func_t  SetChangeParms;
-} globalvars_t;
-
-typedef struct
-{
-       float   modelindex;
-       vec3_t  absmin;
-       vec3_t  absmax;
-       float   ltime;
-       float   movetype;
-       float   solid;
-       vec3_t  origin;
-       vec3_t  oldorigin;
-       vec3_t  velocity;
-       vec3_t  angles;
-       vec3_t  avelocity;
-       vec3_t  punchangle;
-       string_t        classname;
-       string_t        model;
-       float   frame;
-       float   skin;
-       float   effects;
-       vec3_t  mins;
-       vec3_t  maxs;
-       vec3_t  size;
-       func_t  touch;
-       func_t  use;
-       func_t  think;
-       func_t  blocked;
-       float   nextthink;
-       int     groundentity;
-       float   health;
-       float   frags;
-       float   weapon;
-       string_t        weaponmodel;
-       float   weaponframe;
-       float   currentammo;
-       float   ammo_shells;
-       float   ammo_nails;
-       float   ammo_rockets;
-       float   ammo_cells;
-       float   items;
-       float   takedamage;
-       int     chain;
-       float   deadflag;
-       vec3_t  view_ofs;
-       float   button0;
-       float   button1;
-       float   button2;
-       float   impulse;
-       float   fixangle;
-       vec3_t  v_angle;
-       float   idealpitch;
-       string_t        netname;
-       int     enemy;
-       float   flags;
-       float   colormap;
-       float   team;
-       float   max_health;
-       float   teleport_time;
-       float   armortype;
-       float   armorvalue;
-       float   waterlevel;
-       float   watertype;
-       float   ideal_yaw;
-       float   yaw_speed;
-       int     aiment;
-       int     goalentity;
-       float   spawnflags;
-       string_t        target;
-       string_t        targetname;
-       float   dmg_take;
-       float   dmg_save;
-       int     dmg_inflictor;
-       int     owner;
-       vec3_t  movedir;
-       string_t        message;
-       float   sounds;
-       string_t        noise;
-       string_t        noise1;
-       string_t        noise2;
-       string_t        noise3;
-} entvars_t;
-
-#define PROGHEADER_CRC 5927
index 0665f807c14c9e30b415d135ac4ab4aa6951cd75..2c7eb92536fe73e2255453d417caecc539642982 100644 (file)
@@ -1,65 +1,27 @@
-#include "../lib/_all.inc"
-#include "_all.qh"
-
-#include "../common/effects/qc/all.qc"
-
-#include "anticheat.qc"
-#include "antilag.qc"
-#include "campaign.qc"
-#include "cheats.qc"
-#include "cl_client.qc"
-#include "cl_impulse.qc"
-#include "cl_player.qc"
-#include "g_damage.qc"
-#include "g_hook.qc"
-// #include "g_lights.qc" // TODO: was never used
-#include "g_models.qc"
-#include "g_subs.qc"
-#include "g_world.qc"
-#include "ipban.qc"
-#include "item_key.qc"
-#include "mapvoting.qc"
-#include "miscfunctions.qc"
-#include "playerdemo.qc"
-#include "portals.qc"
-#include "race.qc"
-#include "round_handler.qc"
-#include "scores.qc"
-#include "scores_rules.qc"
-#include "spawnpoints.qc"
-#include "steerlib.qc"
-#include "sv_main.qc"
-#include "teamplay.qc"
-#include "t_halflife.qc"
-#include "t_quake3.qc"
-#include "t_quake.qc"
-
-#include "bot/_all.inc"
+#ifndef DEBUGPATHING
+       #define DEBUGPATHING 0
+#endif
 
-#include "command/all.qc"
+#include <lib/_all.inc>
+#include "_all.qh"
 
+#include "_mod.inc"
+#include "bot/_mod.inc"
+#include "bot/havocbot/_mod.inc"
+#include "command/_mod.inc"
+#include "mutators/_mod.inc"
 #include "pathlib/_all.inc"
+#include "weapons/_mod.inc"
 
-#include "weapons/accuracy.qc"
-#include "weapons/common.qc"
-#include "weapons/csqcprojectile.qc" // TODO
-#include "weapons/hitplot.qc"
-#include "weapons/selection.qc"
-#include "weapons/spawning.qc"
-#include "weapons/throwing.qc"
-#include "weapons/tracing.qc"
-#include "weapons/weaponstats.qc"
-#include "weapons/weaponsystem.qc"
-
-#include "../common/_all.inc"
-#include "mutators/all.qc"
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
 
-#include "../lib/csqcmodel/sv_model.qc"
+#include <lib/csqcmodel/sv_model.qc>
 
-#include "../lib/warpzone/anglestransform.qc"
-#include "../lib/warpzone/common.qc"
-#include "../lib/warpzone/server.qc"
-#include "../lib/warpzone/util_server.qc"
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
 
 #if BUILD_MOD
 #include "../../mod/server/progs.inc"
index dd3a11cc0929cca2c1760004755d4728c780e128..9fd6ca7b3f9d2f0db732ebcd6a673d7c9b0ea30a 100644 (file)
@@ -726,67 +726,58 @@ float race_waypointsprite_visible_for_player(entity e)
                return false;
 }
 
-float have_verified;
-void trigger_race_checkpoint_verify()
-{SELFPARAM();
-       entity cp;
-       float i, p;
-       float qual;
-
-       if(have_verified)
-               return;
-       have_verified = 1;
+void trigger_race_checkpoint_verify(entity this)
+{
+    static bool have_verified;
+       if (have_verified) return;
+       have_verified = true;
 
-       qual = g_race_qualifying;
+       bool qual = g_race_qualifying;
 
-       setself(spawn());
-       self.classname = STR_PLAYER;
+       int pl_race_checkpoint = 0;
+       int pl_race_place = 0;
 
-       if(g_race)
-       {
-               for(i = 0; i <= race_highest_checkpoint; ++i)
-               {
-                       self.race_checkpoint = race_NextCheckpoint(i);
+       if (g_race) {
+               for (int i = 0; i <= race_highest_checkpoint; ++i) {
+                       pl_race_checkpoint = race_NextCheckpoint(i);
 
                        // race only (middle of the race)
-                       g_race_qualifying = 0;
-                       self.race_place = 0;
-                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out"));
+                       g_race_qualifying = false;
+                       pl_race_place = 0;
+                       if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));
+            }
 
-                       if(i == 0)
-                       {
+                       if (i == 0) {
                                // qualifying only
                                g_race_qualifying = 1;
-                               self.race_place = race_lowest_place_spawn;
-                               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+                               pl_race_place = race_lowest_place_spawn;
+                               if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+                }
 
                                // race only (initial spawn)
                                g_race_qualifying = 0;
-                               for(p = 1; p <= race_highest_place_spawn; ++p)
-                               {
-                                       self.race_place = p;
-                                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out"));
+                               for (int p = 1; p <= race_highest_place_spawn; ++p) {
+                                       pl_race_place = p;
+                                       if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for initially spawning in race) - bailing out"));
+                    }
                                }
                        }
                }
-       }
-       else if(!defrag_ents)
-       {
+       } else if (!defrag_ents) {
                // qualifying only
-               self.race_checkpoint = race_NextCheckpoint(0);
+               pl_race_checkpoint = race_NextCheckpoint(0);
                g_race_qualifying = 1;
-               self.race_place = race_lowest_place_spawn;
-               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
-       }
-       else
-       {
-               self.race_checkpoint = race_NextCheckpoint(0);
+               pl_race_place = race_lowest_place_spawn;
+               if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+        }
+       } else {
+               pl_race_checkpoint = race_NextCheckpoint(0);
                g_race_qualifying = 1;
-               self.race_place = 0; // there's only one spawn on defrag maps
+               pl_race_place = 0; // there's only one spawn on defrag maps
 
                // check if a defragcp file already exists, then read it and apply the checkpoint order
                float fh;
@@ -794,19 +785,18 @@ void trigger_race_checkpoint_verify()
                string l;
 
                defragcpexists = fh = fopen(strcat("maps/", GetMapname(), ".defragcp"), FILE_READ);
-               if(fh >= 0)
-               {
-                       while((l = fgets(fh)))
-                       {
+               if (fh >= 0) {
+                       while ((l = fgets(fh))) {
                                len = tokenize_console(l);
-                               if(len != 2)
-                               {
+                               if (len != 2) {
                                        defragcpexists = -1; // something's wrong in the defrag cp file, set defragcpexists to -1 so that it will be rewritten when someone finishes
                                        continue;
                                }
-                               for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                                       if(argv(0) == cp.targetname)
+                               for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                                       if (argv(0) == cp.targetname) {
                                                cp.race_checkpoint = stof(argv(1));
+                    }
+                }
                        }
                        fclose(fh);
                }
@@ -814,60 +804,55 @@ void trigger_race_checkpoint_verify()
 
        g_race_qualifying = qual;
 
-       if(race_timed_checkpoint)
-       {
-               if(defrag_ents)
-               {
-                       for(cp = world; (cp = find(cp, classname, "target_startTimer"));)
+       if (race_timed_checkpoint) {
+               if (defrag_ents) {
+                       for (entity cp = world; (cp = find(cp, classname, "target_startTimer"));) {
                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
-                       for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+            }
+                       for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
-
-                       for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                       {
-                               if(cp.race_checkpoint == -2) // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
+            }
+                       for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                               if (cp.race_checkpoint == -2) { // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
                                        defragcpexists = -1;
+                }
                        }
-
-                       if(defragcpexists != -1)
-                       {
+                       if (defragcpexists != -1) {
                                float largest_cp_id = 0;
-                               for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                                       if(cp.race_checkpoint > largest_cp_id)
+                               for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                                       if (cp.race_checkpoint > largest_cp_id) {
                                                largest_cp_id = cp.race_checkpoint;
-                               for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+                    }
+                }
+                               for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                        cp.race_checkpoint = largest_cp_id + 1; // finish line
+                }
                                race_highest_checkpoint = largest_cp_id + 1;
                                race_timed_checkpoint = largest_cp_id + 1;
-                       }
-                       else
-                       {
-                               for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+                       } else {
+                               for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                        cp.race_checkpoint = 255; // finish line
+                }
                                race_highest_checkpoint = 255;
                                race_timed_checkpoint = 255;
                        }
-               }
-               else
-               {
-                       for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); )
-                               if(cp.sprite)
-                               {
-                                       if(cp.race_checkpoint == 0)
+               } else {
+                       for (entity cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); ) {
+                               if (cp.sprite) {
+                                       if (cp.race_checkpoint == 0) {
                                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
-                                       else if(cp.race_checkpoint == race_timed_checkpoint)
+                    } else if (cp.race_checkpoint == race_timed_checkpoint) {
                                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
+                    }
                                }
+            }
                }
        }
 
-       if(defrag_ents)
-       {
-               entity trigger, targ;
-               for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
-                       for(targ = world; (targ = find(targ, targetname, trigger.target)); )
-                               if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer")
-                               {
+       if (defrag_ents) {
+               for (entity trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) {
+                       for (entity targ = world; (targ = find(targ, targetname, trigger.target)); ) {
+                               if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") {
                                        trigger.wait = 0;
                                        trigger.delay = 0;
                                        targ.wait = 0;
@@ -885,9 +870,9 @@ void trigger_race_checkpoint_verify()
                                        //setorigin(targ, trigger.origin);
                                        //remove(trigger);
                                }
+            }
+        }
        }
-       remove(self);
-       setself(this);
 }
 
 vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current)
@@ -1075,7 +1060,7 @@ void race_ClearRecords()
 
        FOREACH_CLIENT(true, LAMBDA(
                float p = it.race_place;
-               WITH(entity, self, it, race_PreparePlayer());
+               WITHSELF(it, race_PreparePlayer());
                it.race_place = p;
        ));
 }
index c78c7765bb40a4d5f81a1aeed5212ec8bbe0217a..51ec4590019abf277b06cc03632f6fa8d110a3b1 100644 (file)
@@ -1,5 +1,12 @@
-#ifndef RACE_H
-#define RACE_H
+#pragma once
+
+float race_teams;
+
+// scores
+const float ST_RACE_LAPS = 1;
+const float SP_RACE_LAPS = 4;
+const float SP_RACE_TIME = 5;
+const float SP_RACE_FASTEST = 6;
 
 bool g_race_qualifying;
 
@@ -58,5 +65,3 @@ void race_SendRankings(float pos, float prevpos, float del, float msg);
 void race_RetractPlayer();
 
 void race_InitSpectator();
-
-#endif
index 448788442842ab2bd631abb1daefbcf3a0a7678a..7d4499ce4a2859ed008b5a289eb754aa710f1324 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef ROUND_HANDLER_H
-#define ROUND_HANDLER_H
+#pragma once
 
 entity round_handler;
 .float delay; // stores delay from round end to countdown start
@@ -23,5 +22,3 @@ void round_handler_Remove();
 #define round_handler_CountdownRunning() (!round_handler.wait && round_handler.cnt)
 #define round_handler_IsRoundStarted() (!round_handler.wait && !round_handler.cnt)
 #define round_handler_GetEndTime() (round_handler.round_endtime)
-
-#endif
index b7c994598010e8ee036136c62833bf5e555b6dab..b09657e6a5832d8b93bae23b537daaa26fe6946e 100644 (file)
@@ -387,6 +387,7 @@ float PlayerScore_Compare(entity t1, entity t2, float strict)
 
 void WinningConditionHelper()
 {
+    SELFPARAM();
        float c;
        string s;
        float fullstatus;
index 8c9af4534fa1158106727abaf7b52716f4ad0908..b547730efef6035e008386d4fd38d199d55d3fdd 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef SCORES_H
-#define SCORES_H
+#pragma once
 
-#include "../common/constants.qh"
+#include <common/constants.qh>
 
 entity scores_initialized; // non-world when scores labels/rules have been set
 .float scores[MAX_SCORE];
@@ -129,4 +128,3 @@ string GetTeamScoreString(float tm, float shortString);
  * nospectators: exclude spectators
  */
 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators);
-#endif
index b307eebfb1f746bcd84c25542893f8b4026bb912..1d2646bb83e6d544d6986f3e60d2d8e119d7a9ee 100644 (file)
@@ -1,8 +1,5 @@
-#ifndef SCORES_RULES_H
-#define SCORES_RULES_H
+#pragma once
 
 void ScoreRules_basics(float teams, float sprio, float stprio, float score_enabled);
 void ScoreRules_basics_end();
 void ScoreRules_generic();
-
-#endif
index 0692d90886521cabe42d84eb1477b32aff438cc6..51af4d16e311e4857e84e1572f2acd6acc2e8c39 100644 (file)
@@ -30,13 +30,13 @@ bool SpawnEvent_Send(entity this, entity to, int sf)
 
        if(autocvar_g_spawn_alloweffects)
        {
-               WriteByte(MSG_ENTITY, etof(self.owner));
-               WriteCoord(MSG_ENTITY, self.owner.origin.x);
-               WriteCoord(MSG_ENTITY, self.owner.origin.y);
-               WriteCoord(MSG_ENTITY, self.owner.origin.z);
+               WriteByte(MSG_ENTITY, etof(this.owner));
+               WriteCoord(MSG_ENTITY, this.owner.origin.x);
+               WriteCoord(MSG_ENTITY, this.owner.origin.y);
+               WriteCoord(MSG_ENTITY, this.owner.origin.z);
                send = true;
        }
-       else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) )
+       else if((to == this.owner) || (IS_SPEC(to) && (to.enemy == this.owner)) )
        {
                WriteByte(MSG_ENTITY, 0);
                send = true;
@@ -49,11 +49,12 @@ bool SpawnEvent_Send(entity this, entity to, int sf)
 .vector spawnpoint_prevorigin;
 void spawnpoint_think()
 {
-       self.nextthink = time + 0.1;
-       if(self.origin != self.spawnpoint_prevorigin)
+    SELFPARAM();
+       this.nextthink = time + 0.1;
+       if(this.origin != this.spawnpoint_prevorigin)
        {
-               self.spawnpoint_prevorigin = self.origin;
-               self.SendFlags |= 1;
+               this.spawnpoint_prevorigin = this.origin;
+               this.SendFlags |= 1;
        }
 }
 
@@ -260,9 +261,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck)
                        ++found;
                        if(ent.spawn_evalfunc)
                        {
-                               WITH(entity, self, ent, {
-                                       spawn_score = ent.spawn_evalfunc(this, spot, spawn_score);
-                               });
+                               WITHSELF(ent, spawn_score = ent.spawn_evalfunc(this, spot, spawn_score));
                                if(spawn_score.x < 0)
                                        return spawn_score;
                        }
index ef2ab6687800227d3caa022fa3b8b09761346081..b010350908550a976d0bf4ec3398e03cb90a11af 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SPAWNPOINTS_H
-#define SPAWNPOINTS_H
+#pragma once
 
 .vector spawnpoint_score;
 float spawnpoint_nag;
@@ -8,4 +7,3 @@ entity Spawn_FilterOutBadSpots(entity firstspot, float mindist, float teamcheck)
 entity SelectSpawnPoint (float anypoint);
 spawnfunc(info_player_deathmatch);
 void spawnpoint_use();
-#endif
index 7e05e7c75ede628c474356c9e022839a39754294..24800165661c95361ab2662b4037df977c2e1a15 100644 (file)
@@ -1,3 +1,4 @@
+#include "steerlib.qh"
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
index 3c10bfd0275407c3b1fcd87ae5da619620ca4e24..32ac07c3cda37b75d951f8e00197beb0428d30ee 100644 (file)
@@ -1,10 +1,7 @@
-#ifndef STEERLIB_H
-#define STEERLIB_H
+#pragma once
 
 .vector steerto;
 
 vector steerlib_arrive(vector point,float maximal_distance);
 vector steerlib_attract2(entity this, vector point, float min_influense,float max_distance,float max_influense);
 vector steerlib_pull(vector point);
-
-#endif
index 4ecaedc5b7331213bfce3bf084f19d5cdfcaf663..e7d6dbfb5b2b9f34cc5eb967930ce4d3d34e5ca7 100644 (file)
@@ -1,3 +1,4 @@
+#include "sv_main.qh"
 
 #include "anticheat.qh"
 #include "g_hook.qh"
@@ -116,12 +117,12 @@ void CreatureFrame_FallDamage(entity this)
 
 void CreatureFrame_All()
 {
-       FOREACH_ENTITY_FLOAT(damagedbycontents, true, LAMBDA(
-               if(it.movetype == MOVETYPE_NOCLIP) continue;
+       FOREACH_ENTITY_FLOAT(damagedbycontents, true, {
+               if (it.movetype == MOVETYPE_NOCLIP) continue;
                CreatureFrame_Liquids(it);
                CreatureFrame_FallDamage(it);
                it.oldvelocity = it.velocity;
-       ));
+       });
 }
 
 void Pause_TryPause(bool ispaused)
@@ -153,9 +154,13 @@ float game_delay_last;
 
 bool autocvar_sv_autopause = true;
 float RedirectionThink();
+void PM_Main(Client this);
 void StartFrame()
 {
-       SELFPARAM();
+    // TODO: if move is more than 50ms, split it into two moves (this matches QWSV behavior and the client prediction)
+    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PM_Main(it));
+    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPreThink()));
+
        execute_next_frame();
        if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
 
@@ -185,10 +190,9 @@ void StartFrame()
        }
 #endif
 
-       FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, LAMBDA(CSQCProjectile_Check(it)));
+       FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, CSQCProjectile_Check(it));
 
-       if(RedirectionThink())
-               return;
+       if (RedirectionThink()) return;
 
        UncustomizeEntitiesRun();
        InitializeEntitiesRun();
@@ -196,8 +200,7 @@ void StartFrame()
        WarpZone_StartFrame();
 
        sys_frametime = autocvar_sys_ticrate * autocvar_slowmo;
-       if(sys_frametime <= 0)
-               sys_frametime = 1.0 / 60.0; // somewhat safe fallback
+       if (sys_frametime <= 0) sys_frametime = 1.0 / 60.0; // somewhat safe fallback
 
        if (timeout_status == TIMEOUT_LEADTIME) // just before the timeout (when timeout_status will be TIMEOUT_ACTIVE)
                orig_slowmo = autocvar_slowmo; // slowmo will be restored after the timeout
@@ -207,7 +210,7 @@ void StartFrame()
        // detect when the pre-game countdown (if any) has ended and the game has started
        game_delay = (time < game_starttime);
 
-       if(autocvar_sv_eventlog && game_delay_last && !game_delay)
+       if (autocvar_sv_eventlog && game_delay_last && !game_delay)
                GameLogEcho(":startdelay_ended");
 
        game_delay_last = game_delay;
@@ -215,12 +218,7 @@ void StartFrame()
        CreatureFrame_All();
        CheckRules_World();
 
-       // if in warmup stage and limit for warmup is hit start match
-       if(warmup_stage)
-       if(!gameover)
-       if((g_warmup_limit > 0 && time >= g_warmup_limit)
-        || (g_warmup_limit == 0 && autocvar_timelimit != 0 && time >= autocvar_timelimit * 60))
-       {
+       if (warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit) {
                ReadyRestart();
                return;
        }
@@ -229,7 +227,8 @@ void StartFrame()
        anticheat_startframe();
        MUTATOR_CALLHOOK(SV_StartFrame);
 
-    FOREACH_CLIENT(true, LAMBDA(GlobalStats_update(it)));
+    FOREACH_CLIENT(true, GlobalStats_update(it));
+    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPostThink()));
 }
 
 .vector originjitter;
@@ -348,7 +347,7 @@ void SV_OnEntityPreSpawnFunction()
                        }
                }
                inv = !inv;
-:cvar_fail
+LABEL(cvar_fail)
                // now inv is 1 if we want to keep the item, and 0 if we want to get rid of it
                if (!inv)
                {
diff --git a/qcsrc/server/sv_main.qh b/qcsrc/server/sv_main.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index aca5969ba665ad426903000a8838e50b4367e206..a74e521ab0c935e48a92b0ef9546099e9e3b9b59 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_SYS_POST_H
-#define SERVER_SYS_POST_H
+#pragma once
 
 #undef objerror
 #undef droptofloor
@@ -39,5 +38,3 @@ var void remove(entity e);
 #undef IT_QUAD
 
 #pragma noref 0
-
-#endif
index be17b6923b3b2bbbd63dac0b760d8adc60ace165..ca6a2044d375c7d5b1f2cd6b1921145d00e982fa 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SERVER_SYS_PRE_H
-#define SERVER_SYS_PRE_H
+#pragma once
 
 #define objerror builtin_objerror
 #define droptofloor builtin_droptofloor
@@ -34,5 +33,3 @@
 #define IT_QUAD             _IT_QUAD /* BIT(22) */
 
 #pragma noref 1
-
-#endif
index 0438282006c22a072255fb75142b4ee63eaf8b9f..7719542459324cb695e16169088a662ad77ebbc4 100644 (file)
@@ -1,3 +1,4 @@
+#include "t_halflife.qh"
 .float  roomtype;
 .float  radius;
 .float  pitch;
diff --git a/qcsrc/server/t_halflife.qh b/qcsrc/server/t_halflife.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 29de5d4c71a530623e0e938e291bf0976c618574..c41f8ccf8cd5c50b739e2f720337e7985bbb9f5e 100644 (file)
@@ -1,3 +1,4 @@
+#include "t_quake.qh"
 
 #include "../common/weapons/all.qh"
 
diff --git a/qcsrc/server/t_quake.qh b/qcsrc/server/t_quake.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 4ea7a33485f420984dba9e2bdb3fe318344ebd51..ef614c7ac3eaf55885ae4bb8d99246e8ac9d09f3 100644 (file)
@@ -1,3 +1,4 @@
+#include "t_quake3.qh"
 
 #include "../common/weapons/all.qh"
 
@@ -67,7 +68,7 @@ spawnfunc(item_enviro)         { spawnfunc_item_invincible(this);     }
 .float delay;
 
 // weapon remove ent from df
-void target_init_verify()
+void target_init_verify(entity this)
 {
        entity trigger, targ;
        for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
@@ -94,8 +95,8 @@ spawnfunc(target_init)
 }
 
 // weapon give ent from defrag
-void target_give_init()
-{SELFPARAM();
+void target_give_init(entity this)
+{
        entity targ;
        for (targ = world; (targ = find(targ, targetname, self.target)); ) {
                if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
diff --git a/qcsrc/server/t_quake3.qh b/qcsrc/server/t_quake3.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 34ee3277a5fa6ce755520cfe520db6f29e030fe9..8dd4667117e8d745d12cc62e19fb2fef1add64ff 100644 (file)
@@ -31,7 +31,7 @@ void LogTeamchange(float player_id, float team_number, float type)
        GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
 }
 
-void default_delayedinit()
+void default_delayedinit(entity this)
 {
        if(!scores_initialized)
                ScoreRules_generic();
@@ -499,7 +499,7 @@ float FindSmallestTeam(entity pl, float ignore_pl)
        return RandomSelection_chosen_float;
 }
 
-float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
+int JoinBestTeam(entity pl, bool only_return_best, bool forcebestteam)
 {SELFPARAM();
        float smallest, selectedteam;
 
index 6b3bdf0f2a1e517f4e93d03209abd227dae16c18..2a3a528fea537dd16a59c839f5e6b373415c84e6 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef TEAMPLAY_H
-#define TEAMPLAY_H
+#pragma once
 
 string cache_mutatormsg;
 string cache_lastmutatormsg;
@@ -17,7 +16,7 @@ void TeamchangeFrags(entity e);
 
 void LogTeamchange(float player_id, float team_number, float type);
 
-void default_delayedinit();
+void default_delayedinit(entity this);
 
 void ActivateTeamplay();
 
@@ -48,10 +47,9 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e);
 // NOTE: Assumes CheckAllowedTeams has already been called!
 float FindSmallestTeam(entity pl, float ignore_pl);
 
-float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
+int JoinBestTeam(entity pl, bool only_return_best, bool forcebestteam);
 
 //void() ctf_playerchanged;
 void SV_ChangeTeam(float _color);
 
 void ShufflePlayerOutOfTeam (float source_team);
-#endif
diff --git a/qcsrc/server/tests.qc b/qcsrc/server/tests.qc
new file mode 100644 (file)
index 0000000..7bbf00d
--- /dev/null
@@ -0,0 +1,55 @@
+#include "tests.qh"
+
+void test_weapons_hurt(entity this)
+{
+    EXPECT_NE(100, this.health);
+    remove(this.enemy);
+    remove(this);
+}
+
+TEST(Weapons, Hurt)
+{
+    entity it;
+
+    noref Client a = it = NEW(Client, "A");
+    WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_1));
+    it.origin = '-100 0 0';
+    it.angles = '0 0 0';
+
+    noref Client b = it = NEW(Client, "B");
+    WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_2));
+    it.origin = '100 0 0';
+    it.angles = '0 180 0';
+
+    it = a;
+    PHYS_INPUT_BUTTON_ATCK(it) = true;
+    it.items |= IT_UNLIMITED_AMMO;
+    Weapon wep = WEP_VORTEX;
+    W_GiveWeapon(it, wep.m_id);
+    W_SwitchWeapon_Force(it, wep);
+
+    it = b;
+    PHYS_INPUT_BUTTON_JUMP(it) = true;
+    it.enemy = a;
+
+    defer(it, wep.switchdelay_raise + 0.1, test_weapons_hurt);
+
+    SUCCEED();
+}
+
+TEST(Vehicles, Spawn)
+{
+    entity it;
+
+    noref Client bot = it = NEW(Client, "Rider");
+    Client_Add(it, NUM_TEAM_1);
+    it.origin = '0 0 100';
+
+    noref entity v = it = new(vehicle);
+    Vehicle veh = VEH_BUMBLEBEE;
+    it.active = ACTIVE_NOT;
+    vehicle_initialize(it, veh, false);
+    it.nextthink = time;
+
+    SUCCEED();
+}
diff --git a/qcsrc/server/tests.qh b/qcsrc/server/tests.qh
new file mode 100644 (file)
index 0000000..be6445b
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "autocvars.qh"
+#include "cl_client.qh"
+#include "command/all.qh"
+#include "weapons/common.qh"
+#include "weapons/selection.qh"
+#include <common/items/item.qh>
+#include <common/physics/player.qh>
+#include <common/weapons/all.qh>
+#include <common/vehicles/all.qh>
diff --git a/qcsrc/server/weapons/_mod.inc b/qcsrc/server/weapons/_mod.inc
new file mode 100644 (file)
index 0000000..cb24b27
--- /dev/null
@@ -0,0 +1,11 @@
+// generated file; do not modify
+#include "accuracy.qc"
+#include "common.qc"
+#include "csqcprojectile.qc"
+#include "hitplot.qc"
+#include "selection.qc"
+#include "spawning.qc"
+#include "throwing.qc"
+#include "tracing.qc"
+#include "weaponstats.qc"
+#include "weaponsystem.qc"
index 33c1fbf3924aacf3a71cab0a3cf4acf2de6033b5..35b0174ec7dae3ab1a0a926b66c2116fbb20ca3e 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef ACCURACY_H
-#define ACCURACY_H
+#pragma once
 
 .bool cvar_cl_accuracy_data_share;
 REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
@@ -28,4 +27,3 @@ void accuracy_add(entity e, float w, float fired, float hit);
 // helper
 bool accuracy_isgooddamage(entity attacker, entity targ);
 bool accuracy_canbegooddamage(entity attacker);
-#endif
index 85e8820f38c9dc21cc15f4ff3fe8581357af8576..2a439f3d9eeb26d5763b85349995a12937f65f63 100644 (file)
@@ -8,20 +8,15 @@
 #include <common/weapons/all.qh>
 #include <common/items/all.qc>
 
-void W_GiveWeapon (entity e, float wep)
-{SELFPARAM();
-
-       if (!wep)
-               return;
+void W_GiveWeapon(entity e, int wep)
+{
+       if (!wep) return;
 
        e.weapons |= WepSet_FromWeapon(Weapons_from(wep));
 
-       setself(e);
-
-       if(IS_PLAYER(other))
-               { Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_WEAPON_GOT, wep); }
-
-       setself(this);
+       if (IS_PLAYER(e)) {
+           Send_Notification(NOTIF_ONE, e, MSG_MULTI, ITEM_WEAPON_GOT, wep);
+    }
 }
 
 void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
index b97457ad99697c017846226b10730a3466e0c6f2..7633c386e77c247092350bcdff51be40f5400f63 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef WEAPONS_COMMON_H
-#define WEAPONS_COMMON_H
+#pragma once
 
 void W_GiveWeapon (entity e, float wep);
 .float prevstrengthsound;
@@ -7,4 +6,3 @@ void W_GiveWeapon (entity e, float wep);
 void W_PlayStrengthSound(entity player);
 float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception);
 void W_PrepareExplosionByDamage(entity attacker, void() explode);
-#endif
index c2ecc3e4d45cd9d9b4e03a810121739ebcabb239..af8c96085b3c5d8cd2e7419ee19dadf691d359d1 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef CSQCPROJECTILE_H
-#define CSQCPROJECTILE_H
+#pragma once
 
 .float csqcprojectile_clientanimate;
 
@@ -7,4 +6,3 @@ void CSQCProjectile(entity e, float clientanimate, float type, float docull);
 void UpdateCSQCProjectile(entity e);
 void UpdateCSQCProjectileAfterTeleport(entity e);
 void CSQCProjectile_Check(entity e);
-#endif
index 850315a519a1fdfa211dcefed039ecce7fb6f516..ec1fd089b1abd6cfeaf7fae56bf9d7546e975b0e 100644 (file)
@@ -3,6 +3,7 @@
 #include "../antilag.qh"
 #include "../g_subs.qh"
 #include <common/weapons/all.qh>
+#include <common/state.qh>
 
 vector W_HitPlotUnnormalizedUntransform(vector screenforward, vector screenright, vector screenup, vector v)
 {
@@ -68,9 +69,10 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright,
                traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
                if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
                {
-                       antilag_takeback(trace_ent, time - lag);
+                   entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
+                       antilag_takeback(trace_ent, store, time - lag);
                        hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
-                       antilag_restore(trace_ent);
+                       antilag_restore(trace_ent, store);
                        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 3b111f1c5433d382e38a0116b49309b65ab79347..8aa15a61b4f37222725bc539f51d4e7682545766 100644 (file)
@@ -1,9 +1,7 @@
-#ifndef HITPLOT_H
-#define HITPLOT_H
+#pragma once
 
 .float hitplotfh;
 
 void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, vector screenup);
 void W_HitPlotOpen(entity player);
 void W_HitPlotClose(entity player);
-#endif
index d0cb0a82780d26177e41c54633c2b3147be52615..27d35643de1415f389a6ed61819ce3f22983e69c 100644 (file)
@@ -6,6 +6,7 @@
 #include <common/util.qh>
 #include <common/items/item.qh>
 #include <common/weapons/all.qh>
+#include <common/state.qh>
 #include <common/mutators/mutator/waypoints/waypointsprites.qh>
 
 // switch between weapons
@@ -41,6 +42,7 @@ void Weapon_whereis(Weapon this, entity cl)
 
 bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain)
 {
+    SELFPARAM();
        float f = 0;
 
        if (time < cl.hasweapon_complain_spam)
@@ -70,7 +72,7 @@ bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain)
                        }
                        else
                        {
-                               WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
+                               WITHSELF(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
                                if(wpn == WEP_MINE_LAYER)
@@ -224,11 +226,12 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        return 0;
 }
 
-void W_SwitchWeapon_Force(entity e, Weapon wep)
+void W_SwitchWeapon_Force(Player this, Weapon wep)
 {
-       e.cnt = PS(e).m_switchweapon.m_id;
-       PS(e).m_switchweapon = wep;
-       e.selectweapon = wep.m_id;
+    TC(Player, this); TC(Weapon, wep);
+       this.cnt = PS(this).m_switchweapon.m_id;
+       PS(this).m_switchweapon = wep;
+       this.selectweapon = wep.m_id;
 }
 
 // perform weapon to attack (weaponstate and attack_finished check is here)
index b4e2fb81cdb1174f76daaf014416b8af14b7b530..07f27f5b5d2f17e4c99f298caf3552090130beaa 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef SELECTION_H
-#define SELECTION_H
+#pragma once
 
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type);
@@ -12,7 +11,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
 
 #define w_getbestweapon(ent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true))
 
-void W_SwitchWeapon_Force(entity e, Weapon w);
+void W_SwitchWeapon_Force(Player this, Weapon w);
 
 // perform weapon to attack (weaponstate and attack_finished check is here)
 void W_SwitchToOtherWeapon(entity pl);
@@ -30,4 +29,3 @@ void W_PreviousWeapon(float list);
 
 // previously used if exists and has ammo, (second) best otherwise
 void W_LastWeapon(entity this);
-#endif
index fd66a8e87b97c94a4a17ba7f33805692eea0054c..9ce5ca30e4da2426627d11a463e0fcc321c8c243 100644 (file)
@@ -1,7 +1,5 @@
-#ifndef SPAWNING_H
-#define SPAWNING_H
+#pragma once
 
 string W_Apply_Weaponreplace(string in);
 
 void weapon_defaultspawnfunc(entity this, Weapon e);
-#endif
index 7ffc68105f5761632edf2ec31c3c697c8ed31aa3..c06b08c08ac2a387618e90a6cc1f18357278b218 100644 (file)
@@ -10,6 +10,7 @@
 #include <common/triggers/subs.qh>
 #include <common/util.qh>
 #include <common/weapons/all.qh>
+#include <common/state.qh>
 
 void thrown_wep_think()
 {SELFPARAM();
index 1bf50c14a400e0bd7e16ca9ac203471de1970e54..488791295b59bf8ed52df983ed949c6164abb2a6 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef THROWING_H
-#define THROWING_H
+#pragma once
 
 .float savenextthink;
 void thrown_wep_think();
@@ -13,4 +12,3 @@ float W_IsWeaponThrowable(float w);
 void W_ThrowWeapon(vector velo, vector delta, float doreduce);
 
 void SpawnThrownWeapon(entity this, vector org, float w);
-#endif
index e924805fd9a7e749eb4929c1659722aefa2d29cc..311edd0883586944d3bd5b28e6e61c2afe5d7d8a 100644 (file)
 #include <common/util.qh>
 
 #include <common/weapons/all.qh>
+#include <common/state.qh>
 
 #include <lib/warpzone/common.qh>
 
 // this function calculates w_shotorg and w_shotdir based on the weapon model
 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
 // make sure you call makevectors first (FIXME?)
-void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range)
+void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range)
 {
+    TC(Sound, snd);
        float nudge = 1; // added to traceline target and subtracted from result  TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
        float oldsolid;
        vector vecs, dv;
@@ -132,9 +134,8 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        if (!autocvar_g_norecoil)
                ent.punchangle_x = recoil * -1;
 
-       if (snd != "")
-       {
-               _sound (ent, chan, snd, VOL_BASE, ATTN_NORM);
+       if (snd != SND_Null) {
+               sound (ent, chan, snd, VOL_BASE, ATTN_NORM);
                W_PlayStrengthSound(ent);
        }
 
@@ -348,8 +349,8 @@ void fireBullet_trace_callback(vector start, vector hit, vector end)
        fireBullet_last_hit = world;
 }
 
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
-{SELFPARAM();
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
+{
        vector  end;
 
        dir = normalize(dir + randomvec() * spread);
@@ -366,28 +367,28 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
        else
                fireBullet_trace_callback_eff = EFFECT_BULLET;
 
-       float lag = ANTILAG_LATENCY(self);
+       float lag = ANTILAG_LATENCY(this);
        if(lag < 0.001)
                lag = 0;
-       if (!IS_REAL_CLIENT(self))
+       if (!IS_REAL_CLIENT(this))
                lag = 0;
-       if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
+       if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(antilag_takeback(it, time - lag)));
-               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
-                       if(it != self)
-                               antilag_takeback(it, time - lag);
-               ));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+                       if (it != this)
+                               antilag_takeback(it, it, time - lag);
+               });
        }
 
        // change shooter to SOLID_BBOX so the shot can hit corpses
-       int oldsolid = self.dphitcontentsmask;
-       if(self)
-               self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+       int oldsolid = this.dphitcontentsmask;
+       if(this)
+               this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 
-       WarpZone_trace_forent = self;
+       WarpZone_trace_forent = this;
 
        for (;;)
        {
@@ -425,23 +426,23 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
                        is_weapclip = true;
 
                if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
-                       Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
+                       Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, this);
 
                if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit)  // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
                {
                        fireBullet_last_hit = hit;
                        yoda = 0;
-                       MUTATOR_CALLHOOK(FireBullet_Hit, self, hit, start, end, damage);
+                       MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
                        damage = frag_damage;
-                       float g = accuracy_isgooddamage(self, hit);
-                       Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+                       float g = accuracy_isgooddamage(this, hit);
+                       Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
                        // calculate hits for ballistic weapons
                        if(g)
                        {
                                // do not exceed 100%
                                float added_damage = min(damage - total_damage, damage * solid_penetration_left);
                                total_damage += damage * solid_penetration_left;
-                               accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
+                               accuracy_add(this, PS(this).m_weapon.m_id, 0, added_damage);
                        }
                }
 
@@ -480,24 +481,24 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
                // Only show effect when going through a player (invisible otherwise)
                if (hit && (hit.solid != SOLID_BSP))
                        if(vdist(trace_endpos - start, >, 4))
-                               trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
+                               trailparticles(this, fireBullet_trace_callback_eff, start, trace_endpos);
 
                start = trace_endpos;
 
                if(hit.solid == SOLID_BSP)
-                       Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
+                       Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, this);
        }
 
        if(lag)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(antilag_restore(it)));
-               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
-                       if(it != self)
-                               antilag_restore(it);
-               ));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+                       if (it != this)
+                               antilag_restore(it, it);
+               });
        }
 
        // restore shooter solid type
-       if(self)
-               self.dphitcontentsmask = oldsolid;
+       if(this)
+               this.dphitcontentsmask = oldsolid;
 }
index c4f63835c359f07b9fb8f2ea932c2f89179ebe9c..fed7364b2556f2435a0a7a8635d5b6977c61e9e5 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef TRACING_H
-#define TRACING_H
+#pragma once
 
 vector w_shotorg;
 vector w_shotdir;
@@ -8,7 +7,7 @@ vector w_shotend;
 // this function calculates w_shotorg and w_shotdir based on the weapon model
 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
 // make sure you call makevectors first (FIXME?)
-void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range);
+void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range);
 
 #define W_SetupShot_Dir_ProjectileSize(ent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
 #define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
@@ -55,5 +54,4 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 entity fireBullet_trace_callback_eff;
 entity fireBullet_last_hit;
 void fireBullet_trace_callback(vector start, vector hit, vector end);
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
-#endif
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
index 0018f190669d533d2397973adc80d66a7e3bc11f..f031223e78304f3e5540c4855b18e638e981e3e6 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef WEAPONSTATS_H
-#define WEAPONSTATS_H
+#pragma once
 
 float weaponstats_buffer;
 
@@ -11,4 +10,3 @@ void WeaponStats_LogDamage(float awep, float abot, float vwep, float vbot, float
 void WeaponStats_LogKill(float awep, float abot, float vwep, float vbot);
 
 #define WEAPONSTATS_GETINDEX(awep,abot,vwep,vbot) (((vwep) + (awep) * (WEP_LAST - WEP_FIRST + 1) - (WEP_FIRST + WEP_FIRST * (WEP_LAST - WEP_FIRST + 1))) * 4 + (abot) * 2 + (vbot))
-#endif
index 3fd9e896f91e5a0a785394abe255f1e7d52b7f4a..f44b3929013c2a5929abed8cb8add8679145017e 100644 (file)
@@ -12,6 +12,7 @@
 #include <common/notifications/all.qh>
 #include <common/util.qh>
 #include <common/weapons/all.qh>
+#include <common/state.qh>
 #include <lib/csqcmodel/sv_model.qh>
 
 .int state;
@@ -51,9 +52,9 @@ vector CL_Weapon_GetShotOrg(int wpn)
 {
        entity wi = Weapons_from(wpn);
        entity e = spawn();
-       CL_WeaponEntity_SetModel(e, wi.mdl);
+       CL_WeaponEntity_SetModel(e, wi.mdl, false);
        vector ret = e.movedir;
-       CL_WeaponEntity_SetModel(e, "");
+       CL_WeaponEntity_SetModel(e, "", false);
        remove(e);
        return ret;
 }
@@ -74,7 +75,7 @@ void CL_Weaponentity_Think()
                remove(this);
                return;
        }
-       if (IS_DEAD(self.owner))
+       if (IS_DEAD(this.owner))
        {
                // owner died; disappear
                this.model = "";
@@ -90,7 +91,7 @@ void CL_Weaponentity_Think()
                this.dmg = this.owner.modelindex;
                this.deadflag = this.owner.deadflag;
 
-               CL_WeaponEntity_SetModel(this, this.owner.weaponname);
+               CL_WeaponEntity_SetModel(this, this.owner.weaponname, true);
        }
 
        this.alpha = -1;  // TODO: don't render this entity at all
@@ -115,7 +116,7 @@ void CL_ExteriorWeaponentity_Think()
                remove(this);
                return;
        }
-       if (IS_DEAD(self.owner))
+       if (IS_DEAD(this.owner))
        {
                this.model = "";
                return;
@@ -151,7 +152,8 @@ void CL_ExteriorWeaponentity_Think()
        else if (this.owner.alpha != 0) this.alpha = this.owner.alpha;
        else this.alpha = 1;
 
-       this.glowmod = weaponentity_glowmod(PS(this.owner).m_weapon, this.owner.clientcolors);
+    Weapon wep = PS(this.owner).m_weapon;
+       if (wep) this.glowmod = weaponentity_glowmod(wep, this.owner.clientcolors);
        this.colormap = this.owner.colormap;
 
        CSQCMODEL_AUTOUPDATE(this);
@@ -208,10 +210,11 @@ void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 .float prevwarntime;
 bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary)
 {
+    SELFPARAM();
        if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
        bool ammo = false;
-       if (secondary) WITH(entity, self, actor, ammo = thiswep.wr_checkammo2(thiswep));
-       else WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
+       if (secondary) WITHSELF(actor, ammo = thiswep.wr_checkammo2(thiswep));
+       else WITHSELF(actor, ammo = thiswep.wr_checkammo1(thiswep));
        if (ammo) return true;
        // always keep the Mine Layer if we placed mines, so that we can detonate them
        if (thiswep == WEP_MINE_LAYER)
@@ -229,8 +232,8 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
 
        // check if the other firing mode has enough ammo
        bool ammo_other = false;
-       if (secondary) WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo1(thiswep));
-       else WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo2(thiswep));
+       if (secondary) WITHSELF(actor, ammo_other = thiswep.wr_checkammo1(thiswep));
+       else WITHSELF(actor, ammo_other = thiswep.wr_checkammo2(thiswep));
        if (ammo_other)
        {
                if (time - actor.prevwarntime > 1)
@@ -411,8 +414,10 @@ bool forbidWeaponUse(entity player)
 
 .bool hook_switchweapon;
 
-void W_WeaponFrame(entity actor)
+void W_WeaponFrame(Player actor)
 {
+    TC(Player, actor);
+    TC(PlayerState, PS(actor));
        .entity weaponentity = weaponentities[0];  // TODO: unhardcode
        entity this = actor.(weaponentity);
        if (frametime) actor.weapon_frametime = frametime;
@@ -512,17 +517,17 @@ 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 = PS(actor).m_weapon.m_id;
+       Weapon w = PS(actor).m_weapon;
 
        // call the think code which may fire the weapon
        // and do so multiple times to resolve framerate dependency issues if the
        // server framerate is very low and the weapon fire rate very high
        for (int c = 0; c < W_TICSPERFRAME; ++c)
        {
-               if (w && !(actor.weapons & WepSet_FromWeapon(Weapons_from(w))))
+               if (w != WEP_Null && !(actor.weapons & WepSet_FromWeapon(w)))
                {
                        if (PS(actor).m_weapon == PS(actor).m_switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                       w = 0;
+                       w = WEP_Null;
                }
 
                v_forward = fo;
@@ -554,15 +559,15 @@ void W_WeaponFrame(entity actor)
 
                if (!block_weapon)
                {
-                       if (w)
+            Weapon e = PS(actor).m_weapon;
+            TC(Weapon, e);
+                       if (w != WEP_Null)
                        {
-                               Weapon e = PS(actor).m_weapon;
                                e.wr_think(e, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
                        }
-                       else
+                       else if (e)
                        {
-                               Weapon w = PS(actor).m_weapon;
-                               w.wr_gonethink(w);
+                               e.wr_gonethink(e);
                        }
                }
 
@@ -682,8 +687,9 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int
        w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
 }
 
-void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
+void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound)
 {
+    TC(Sound, sent_sound);
        .entity weaponentity = weaponentities[0];
        // set global values to work with
        Weapon e = PS(actor).m_weapon;
@@ -693,7 +699,8 @@ void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
        actor.reload_ammo_min = sent_ammo_min;
        actor.reload_ammo_amount = e.reloading_ammo;
        actor.reload_time = e.reloading_time;
-       actor.reload_sound = sent_sound;
+       if (actor.reload_sound) strunzone(actor.reload_sound);
+       actor.reload_sound = strzone(Sound_fixpath(sent_sound));
 
        // don't reload weapons that don't have the RELOADABLE flag
        if (!(e.spawnflags & WEP_FLAG_RELOADABLE))
@@ -762,7 +769,8 @@ void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
 
 void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
 {
+    SELFPARAM();
        Weapon w = Weapons_from(weapon_type);
        weapon_dropevent_item = weapon_item;
-       WITH(entity, self, player, w.event(w));
+       WITHSELF(player, w.event(w));
 }
index 0000ac2155b762298e15bbb956187955cbec7fb5..74d120150fc788e917a591beeb98e2c1f7655818 100644 (file)
@@ -1,6 +1,4 @@
-#ifndef WEAPONSYSTEM_H
-#define WEAPONSYSTEM_H
-
+#pragma once
 
 float internalteam;
 float weaponswapping;
@@ -18,9 +16,9 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use);
 
 void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item);
 
-void W_Reload(entity actor, float sent_ammo_min, string sent_sound);
+void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound);
 
-void W_WeaponFrame(entity actor);
+void W_WeaponFrame(Player actor);
 
 float W_WeaponRateFactor();
 
@@ -33,5 +31,3 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponenti
 void weapon_prepareattack_do(entity actor, .entity weaponentity, float secondary, float attacktime);
 
 void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func);
-
-#endif
diff --git a/qcsrc/test/compilationunit.sh b/qcsrc/test/compilationunit.sh
deleted file mode 100755 (executable)
index dfe7181..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-set -eu
-cd "$(dirname "$0")"
-cd ..
-
-declare -a NOWARN=(
-  -Wno-field-redeclared
-  -Wno-unused-variable
-  -Wno-implicit-function-pointer
-)
-declare QCC=../../../gmqcc/gmqcc
-
-declare -a QCC_FLAGS=(
-  -std=gmqcc
-  -Wall -Werror
-  -fftepp -fftepp-predefs -Wcpp
-  -futf8
-  -freturn-assignments
-  -frelaxed-switch
-  -Ooverlap-locals
-)
-
-function check() {
-  declare -l base="${1}"
-  declare -la predefs=("-D${2}" "lib/_all.inc" "${base}/_all.qh")
-  find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
-    echo "$file"
-    ${QCC} "${QCC_FLAGS[@]}" "${NOWARN[@]}" "${predefs[@]}" "$file" >/dev/null
-  done
-}
-
-check client CSQC
-check server SVQC
-check menu MENUQC
diff --git a/qcsrc/tools/autocvarize-update.sh b/qcsrc/tools/autocvarize-update.sh
new file mode 100755 (executable)
index 0000000..31ecc08
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -ex
+git checkout divVerent/autocvarizer_test
+trap 'git reset --hard; git checkout divVerent/autocvarizer' EXIT
+trap 'exit 1' INT
+git merge --no-commit -s ours divVerent/autocvarizer
+git read-tree -m -u divVerent/autocvarizer # "theirs"
+find server \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | AUTOCVARING_SVQC=1 xargs -0 perl autocvarize.pl > server/autocvars.qh.new
+diff -Nu server/autocvars.qh server/autocvars.qh.new || true
+mv server/autocvars.qh.new server/autocvars.qh
+find client \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | xargs -0 perl autocvarize.pl > client/autocvars.qh.new
+diff -Nu client/autocvars.qh client/autocvars.qh.new || true
+mv client/autocvars.qh.new client/autocvars.qh
+if make -C .. FTEQCC=../../../../fteqcc/fteqcc.bin FTEQCCFLAGS=; then
+       echo "Commit? ^C to not"
+       read -r L
+       git add server/autocvars.qh
+       git add client/autocvars.qh
+       git commit -a
+else
+       echo "FAILED. Exit this shell when done examining."
+       sh -i
+fi
diff --git a/qcsrc/tools/autocvarize.pl b/qcsrc/tools/autocvarize.pl
new file mode 100644 (file)
index 0000000..7ac048a
--- /dev/null
@@ -0,0 +1,281 @@
+#!/usr/bin/perl
+# this tool generates JUST the autocvar declarations for cvars
+use strict;
+use warnings;
+
+my @files = @ARGV;
+
+my %cvars = ();
+my %old = ();
+my %menu = ();
+my %defaults = ();
+
+sub found($$$$)
+{
+       my ($name, $type, $default, $force) = @_;
+       if(length $name >= 55)
+       {
+               warn "cvar $name is a Dr. honorificabilitudinitatibis causa BRLOGENSHFEGLE";
+               $type = 'cvar_toolong';
+               return;
+       }
+#      $old{$name} = 1
+#              if $force;
+#      $menu{$name} = 1
+#              if $force > 1;
+       if(exists $cvars{$name} and not defined $cvars{name})
+       {
+               # have already warned
+       }
+       elsif(exists $cvars{$name} and $type ne $cvars{$name})
+       {
+               warn "cvar $name used with different types";
+               if($force)
+               {
+                       $defaults{$name} = $default;
+                       $cvars{$name} = $type;
+               }
+               else
+               {
+                       undef $cvars{$name}
+                               unless $old{$name};
+               }
+               return;
+       }
+       elsif(exists $cvars{$name} and exists $defaults{$name} and $default ne $defaults{$name})
+       {
+               warn "cvar $name used with different defaults";
+               if($force)
+               {
+                       $defaults{$name} = $default;
+                       $cvars{$name} = $type;
+               }
+               else
+               {
+                       undef $cvars{$name}
+                               unless $old{$name};
+               }
+       }
+       else
+       {
+               $defaults{$name} = $default;
+               $cvars{$name} = $type;
+       }
+}
+
+for my $f(@files)
+{
+       print STDERR "In file $f\n";
+       open my $fh, "<", $f;
+       while(<$fh>)
+       {
+               chomp;
+               if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
+               {
+                       next;
+               }
+               s/\/\/.*//;
+               if(/^(?:var )?float autocvar_(\w+);$/)
+               {
+                       found $1, 'cvar', 0, 1;
+                       next;
+               }
+               if(/^var float autocvar_(\w+) = (.*);$/)
+               {
+                       found $1, 'cvar', $2, 1;
+                       next;
+               }
+               if(/^(?:var )?vector autocvar_(\w+);$/)
+               {
+                       found $1, 'cvar_vector', "0 0 0", 1;
+                       next;
+               }
+               if(/^var vector autocvar_(\w+) = '(.*)';$/)
+               {
+                       found $1, 'cvar_vector', $2, 1;
+                       next;
+               }
+               if(/^(?:var )?string autocvar_(\w+);$/)
+               {
+                       found $1, 'cvar_string', "", 1;
+                       next;
+               }
+               if(/^var string autocvar_(\w+) = "(.*)";$/)
+               {
+                       found $1, 'cvar_string', $2, 1;
+                       next;
+               }
+               if(/^#define autocvar_(\w+) cvar("\1")$/)
+               {
+                       found $1, 'cvar', 0, 2;
+                       next;
+               }
+               if(/^#define autocvar_(\w+) cvar_or("\1", (.*))$/)
+               {
+                       found $1, 'cvar', $1, 2;
+                       next;
+               }
+               if(/^#define autocvar_(\w+) cvar_string("\1")$/)
+               {
+                       found $1, 'cvar_string', "", 2;
+                       next;
+               }
+               while(/\bcvar\s*\(\s*"(\w+)"\s*\)/g)
+               {
+                       found $1, 'cvar', 0, 0;
+               }
+               while(/\bcvar_string\s*\(\s*"(\w+)"\s*\)/g)
+               {
+                       found $1, 'cvar_string', "", 0;
+               }
+               while(/\bcvar_vector\s*\(\s*"(\w+)"\s*\)/g)
+               {
+                       found $1, 'cvar_vector', "0 0 0", 0;
+               }
+               while(/\bcvar_or\s*\(\s*"(\w+)"\s*,\s*([^\s)]+)\s*\)/g)
+               {
+                       found $1, 'cvar', $2, 0;
+               }
+       }
+}
+
+if($ENV{AUTOCVARING_SVQC})
+{
+       for my $f(<menu/xonotic/*.c>)
+       {
+               print STDERR "In file $f\n";
+               open my $fh, "<", $f;
+               while(<$fh>)
+               {
+                       for(/"([^"]*)"/g)
+                       {
+                               $menu{$1} = 1;
+                       }
+               }
+       }
+
+       for my $f(<../maps/campaign*.txt>)
+       {
+               print STDERR "In file $f\n";
+               open my $fh, "<", $f;
+               while(<$fh>)
+               {
+                       for(/\b(.+?)\b/g)
+                       {
+                               $menu{$1} = 1;
+                       }
+               }
+       }
+}
+
+for my $name(sort keys %cvars)
+{
+       my $type = $cvars{$name};
+       my $menu = $menu{$name};
+       my $default = $defaults{$name};
+       die "wtf" if $name =~ /\0/;
+       if(not defined $type)
+       {
+               print "// cannot declare $name, it is used with different types\n";
+       }
+       elsif($type eq 'cvar_toolong')
+       {
+               print "// cannot declare $name, name is too long\n";
+       }
+       elsif($type eq 'cvar' and not $menu and $default eq "0")
+       {
+               print "float autocvar_$name;\n";
+       }
+       elsif($type eq 'cvar' and not $menu and $default ne "0")
+       {
+               print "var float autocvar_$name = $default;\n";
+       }
+       elsif($type eq 'cvar_vector' and not $menu and $default eq "0 0 0")
+       {
+               print "vector autocvar_$name;\n";
+       }
+       elsif($type eq 'cvar_vector' and not $menu and $default ne "0 0 0")
+       {
+               print "var vector autocvar_$name = '$default';\n";
+       }
+       elsif($type eq 'cvar_string' and not $menu and $default eq "")
+       {
+               print "string autocvar_$name;\n";
+       }
+       elsif($type eq 'cvar_string' and not $menu and $default ne "")
+       {
+               print "var string autocvar_$name = \"$default\";\n";
+       }
+       elsif($type eq 'cvar' and $menu and $default eq "0")
+       {
+               print "#define autocvar_$name cvar(\"$name\")\n";
+       }
+       elsif($type eq 'cvar' and $menu and $default ne "0")
+       {
+               print "#define autocvar_$name cvar_or(\"$name\", \"$default\")\n";
+       }
+       elsif($type eq 'cvar_string' and $menu) # sorry, no cvar_or for these
+       {
+               print "#define autocvar_$name cvar_string(\"$name\")\n";
+       }
+       elsif($type eq 'cvar_vector' and $menu) # sorry, no cvar_or for these
+       {
+               print "#define autocvar_$name cvar_vector(\"$name\")\n";
+       }
+}
+
+for my $f(@files)
+{
+       print STDERR "In file $f\n";
+       open my $fh, "<", $f;
+       my $out = "";
+       while(<$fh>)
+       {
+               chomp;
+               if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
+               {
+                       $out .= "$_\n";
+                       next;
+               }
+               if(/^(?:var )?float autocvar_(.*);$/)
+               {
+                       $out .= "$_\n";
+                       next;
+               }
+               if(/^(?:var )?string autocvar_(.*);$/)
+               {
+                       $out .= "$_\n";
+                       next;
+               }
+               if(/^#define autocvar_(.*) cvar/)
+               {
+                       $out .= "$_\n";
+                       next;
+               }
+               s{\b(cvar|cvar_string|cvar_vector|cvar_or)\s*\(\s*"([^"]+)"\s*(?:,\s*[^\s)]+\s*)?\)}{
+                       my ($type, $name) = ($1, $2);
+                       $type = 'cvar' if $type eq 'cvar_or';
+                       my $realtype = $cvars{$name};
+                       my $r = $&;
+                       if(defined $realtype)
+                       {
+                               #$r = "$realtype(\"$name\")";
+                               $r = "autocvar_$name";
+                               if($type eq 'cvar' && $realtype eq 'cvar_string')
+                               {
+                                       $r = "stof($r)";
+                               }
+                               if($type eq 'cvar_string' && $realtype eq 'cvar')
+                               {
+                                       $r = "ftos($r)";
+                               }
+                       }
+                       $r;
+               }ge;
+               $out .= "$_\n";
+       }
+       close $fh;
+       open $fh, ">", $f;
+       print $fh $out;
+       close $fh;
+}
diff --git a/qcsrc/tools/compilationunits.sh b/qcsrc/tools/compilationunits.sh
new file mode 100755 (executable)
index 0000000..3c794e9
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+
+WORKDIR=../.tmp
+
+CPP="cc -xc -E"
+: ${QCC:=$PWD/../../../../gmqcc/gmqcc}
+
+declare -a QCCDEFS=(
+    -DNDEBUG=1
+    -DWATERMARK="\"$(git describe --tags --dirty='~')\""
+    -DDEBUGPATHING=0
+)
+QCCDEFS="${QCCDEFS[@]}"
+
+declare -a QCCFLAGS=(
+    -std=gmqcc
+    -Wall -Werror
+    -futf8
+    -freturn-assignments
+    -frelaxed-switch
+    -Ooverlap-locals
+)
+declare -a NOWARN=(
+    -Wno-field-redeclared
+    -Wno-unused-variable
+    -Wno-implicit-function-pointer
+    -Wno-missing-return-values
+)
+QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}"
+
+. qcc.sh
+cd ..
+
+function check1() {
+    declare -l base="${1}"
+    MODE=${2}
+    declare -l file="${3}"
+    qpp ${file} test.dat \
+            -include lib/_all.inc -include ${base}/_all.qh \
+            -I. ${QCCIDENT} ${QCCDEFS} -D${MODE} > ${WORKDIR}/${MODE}.qc
+    qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${MODE}.qc >/dev/null
+}
+
+function check() {
+    declare -l base="${1}"
+    MODE=${2}
+    find ${base} -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
+        check1 ${base} ${MODE} ${file}
+    done
+}
+
+check client CSQC
+check server SVQC
+check menu MENUQC
diff --git a/qcsrc/tools/genmod.sh b/qcsrc/tools/genmod.sh
new file mode 100755 (executable)
index 0000000..269c631
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+MOD=_mod.inc
+
+function genmod() {
+    echo '// generated file; do not modify' > ${MOD}
+    for f in $(ls | sort -k 1,1 -t .); do
+        if [[ "$f" == *.qc ]]; then echo "#include \"$f\"" >> ${MOD}; fi
+    done
+    # echo >> ${MOD}
+    for f in *; do if [ -d "$f" ]; then
+        (cd -- "$f" && genmod)
+        # echo "#include \"$f/MOD\"" >> ${MOD}
+    fi; done
+}
+
+(cd lib; genmod)
+(cd common; genmod)
+(cd client; genmod)
+(cd server; genmod)
+(cd menu; genmod)
diff --git a/qcsrc/tools/headerstyle.sh b/qcsrc/tools/headerstyle.sh
new file mode 100755 (executable)
index 0000000..ef17315
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+function startswith() {
+    declare -l file="${1}"
+    declare -l prelude="${2}"
+    declare -l line=$(head -n1 "$file")
+    if [ "$line" != "$prelude" ]; then
+        echo "$prelude" | cat - "$file" > "$file.tmp" && mv "$file.tmp" "$file"
+    fi
+}
+
+function check() {
+    declare -l base="${1}"
+    find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
+        echo "$file"
+        declare -l file_h="${file%.qc}.qh"
+        if [ ! -f "$file_h" ]; then echo "#pragma once" > "$file_h"; fi
+
+        include=$(basename "$file")
+        include="${include%.qc}.qh"
+        include="#include \"${include}\""
+        startswith "$file" "$include"
+    done
+    find "$base" -type f -name '*.qh' -print0 | sort -z | while read -r -d '' file; do
+        echo "$file"
+        startswith "$file" "#pragma once"
+    done
+}
+
+check client
+check server
+check menu
diff --git a/qcsrc/tools/qcc.sh b/qcsrc/tools/qcc.sh
new file mode 100755 (executable)
index 0000000..40223c1
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+set -euo pipefail
+IFS=$' \n\t'
+
+WORKDIR=${WORKDIR}
+CPP=${CPP}
+QCC=${QCC}
+QCCIDENT="-DGMQCC"
+QCCDEFS=${QCCDEFS}
+QCCFLAGS=${QCCFLAGS}
+
+function qpp() {
+    IN=$1
+    OUT=$2
+    >&2 echo + ${CPP} ${@:3} ${IN}
+    set +e
+    # additional information
+    ${CPP} ${@:3} \
+        -dM 1>${WORKDIR}/${MODE}_macros.txt \
+        -H 2>${WORKDIR}/${MODE}_includes.txt \
+        ${IN}
+    # main step
+    ${CPP} ${@:3} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror ${IN} -o ${WORKDIR}/${MODE}.txt
+    err=$?
+    set -e
+    if [ ${err} -ne 0 ]; then return ${err}; fi
+    sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' ${WORKDIR}/${MODE}.txt
+}
+
+function qcc() {
+    >&2 echo + $(basename ${QCC}) $@
+    # FIXME: relative compiler path is too deep
+    (cd tools && ${QCC} $@)
+}
+
+$(return >/dev/null 2>&1) || {
+    MODE=$1
+    OUT=$2
+    IN=$3
+
+    case ${MODE} in
+        client) PROG=CSQC
+        ;;
+        menu) PROG=MENUQC
+        ;;
+        server) PROG=SVQC
+        ;;
+    esac
+
+    qpp ${IN} ${OUT} -I. ${QCCIDENT} ${QCCDEFS} -D${PROG} > ${WORKDIR}/${MODE}.qc
+    qcc ${QCCFLAGS} -o ${OUT} ../${WORKDIR}/${MODE}.qc
+}
diff --git a/qcsrc/tools/uncrusticracy.sh b/qcsrc/tools/uncrusticracy.sh
new file mode 100644 (file)
index 0000000..c71b6cd
--- /dev/null
@@ -0,0 +1,173 @@
+FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
+out_raw()
+{
+       printf "%s\n" "$LINE"
+}
+out()
+{
+       printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
+}
+decide()
+{
+       verybestchoice=
+       verybestscore=2147483647
+       bestchoice=
+       bestscore=2147483647
+       secondbestchoice=
+       secondbestscore=2147483647
+       worstscore=0
+       haveignore=false
+       havefalse=false
+       have0=false
+       seen=
+       for choice in "$VAL" "$@"; do
+               case " $seen " in
+                       *" $choice "*)
+                               continue
+                               ;;
+                       *)
+                               seen=$seen" $VAL"
+                               ;;
+               esac
+               if [ x"$choice" = x"force" ]; then
+                       continue
+               fi
+               if [ x"$choice" = x"ignore" ]; then
+                       haveignore=true
+               fi
+               if [ x"$choice" = x"false" ]; then
+                       havefalse=true
+               fi
+               if [ x"$choice" = x"0" ]; then
+                       have0=true
+               fi
+               if [ x"$MODE" = x"initialize" ]; then
+                       if [ x"$choice" = x"ignore" ]; then
+                               score=0
+                       else
+                               score=2147483647
+                       fi
+               else
+                       {
+                               cat uncrustify.cfg
+                               printf "%s = %s\n" "$KEY" "$choice"
+                       } > uncrustify.cfg.test
+                       UNCRUSTIFY_CONFIG=uncrustify.cfg.test sh uncrustify.sh $FILES >/dev/null 2>&1
+                       status=$?
+                       if [ $status -gt 1 ]; then
+                               echo "# ERROR: $KEY = $choice crashes with status $status."
+                               continue
+                       fi
+                       score=0
+                       git diff --numstat > diffstat.tmp
+                       while read -r add del rest; do
+                               if [ x"$add" != x"-" ]; then
+                                       score=$(($score + $add))
+                               fi
+                               if [ x"$del" != x"-" ]; then
+                                       score=$(($score + $del))
+                               fi
+                       done < diffstat.tmp
+                       git reset --hard >/dev/null 2>&1
+               fi
+               echo >&2 "$KEY = $choice: $score"
+               if [ x"$choice" != x"ignore" ]; then
+                       if [ $score -lt $bestscore ]; then
+                               secondbestscore=$bestscore
+                               secondbestchoice=$bestchoice
+                               bestscore=$score
+                               bestchoice=$choice
+                       elif [ $score -lt $secondbestscore ]; then
+                               secondbestscore=$score
+                               secondbestchoice=$choice
+                       fi
+               fi
+               if [ $score -lt $verybestscore ]; then
+                       verybestscore=$score
+                       verybestchoice=$choice
+               fi
+               if [ $score -gt $worstscore ]; then
+                       worstscore=$score
+                       worstchoice=$choice
+               fi
+       done
+       if [ -z "$bestchoice" ]; then
+               echo "# WARNING: No best choice identified"
+       elif [ $verybestscore -ge $worstscore ]; then
+               echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
+               if $haveignore; then
+                       VAL=ignore
+               elif $havefalse; then
+                       VAL=false
+               elif $have0; then
+                       VAL=0
+               fi
+       elif [ $bestscore -ge $worstscore ]; then
+               echo "# WARNING: Indifferent... please decide manually."
+       elif [ $bestscore -ge $secondbestscore ]; then
+               echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
+       elif [ $bestscore -gt $verybestscore ]; then
+               echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
+               VAL=$bestchoice
+       else
+               VAL=$bestchoice
+       fi
+}
+while read -r LINE; do
+       case "$LINE" in
+               "# NOTE: "*)
+                       continue
+                       ;;
+               "# WARNING: "*)
+                       continue
+                       ;;
+               "# ERROR: "*)
+                       continue
+                       ;;
+               "#"*)
+                       out_raw
+                       continue
+                       ;;
+               *"#force"*|*"#ignore"*)
+                       out_raw
+                       continue
+                       ;;
+       esac
+       printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
+               if \
+                       [ x"$EQ" != x"=" ] || \
+                       [ x"$DELIM" != x"#" ]; then
+                       out_raw
+                       continue
+               fi
+               case "$COMMENT" in
+                       number)
+                               case "$KEY" in
+                                       indent_columns|*tab*)
+                                               decide 1 2 4 8
+                                               ;;
+                                       *)
+                                               decide 0 1 2 3 indent_columns
+                                               ;;
+                               esac
+                               out
+                               ;;
+                       string)
+                               printf "# WARNING: unsupported %s\n" "$COMMENT"
+                               out_raw
+                               ;;
+                       *[!a-z/_]*)
+                               printf "# ERROR: invalid characters %s\n" "$COMMENT"
+                               out_raw
+                               ;;
+                       */*)
+                               decide `echo "$COMMENT" | tr / ' '`
+                               out
+                               ;;
+                       *)
+                               printf "# ERROR: only once choice %s\n" "$COMMENT"
+                               out_raw
+                               ;;
+               esac
+       done
+done < uncrustify.cfg
diff --git a/qcsrc/tools/uncrustify.sh b/qcsrc/tools/uncrustify.sh
new file mode 100755 (executable)
index 0000000..b36953e
--- /dev/null
@@ -0,0 +1,22 @@
+fix_function_types() {
+       # Uncrustify handles QC function types (example:
+       #  void(void) func;
+       # ) wrong and removes the space between type and variable. Fix this by
+       # a simple sed on ")letter" which should normally not occur.
+       sed -e 's/)\([A-Za-z_]\)/) \1/g' "$@"
+}
+
+if [ -z "$UNCRUSTIFY_CONFIG" ]; then
+       UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg
+fi
+
+case "$#" in
+       0)
+               uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\
+               fix_function_types
+               ;;
+       *)
+               uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" ;\
+               fix_function_types -i "$@"
+               ;;
+esac
diff --git a/qcsrc/tools/whitespace.sh b/qcsrc/tools/whitespace.sh
new file mode 100755 (executable)
index 0000000..5662337
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+function check() {
+    declare -l base="${1}"
+    find "$base" -type f -print0 | sort -z | xargs -0 sed -i \
+        `# strip trailing spaces`                            \
+        -e 's/[[:space:]]*$//'                               \
+        `# line feed at EOF for #include to work properly`   \
+        -e '$a\'
+}
+
+check lib
+check common
+check client
+check server
+check menu
diff --git a/qcsrc/uncrusticracy.sh b/qcsrc/uncrusticracy.sh
deleted file mode 100644 (file)
index c71b6cd..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
-out_raw()
-{
-       printf "%s\n" "$LINE"
-}
-out()
-{
-       printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
-}
-decide()
-{
-       verybestchoice=
-       verybestscore=2147483647
-       bestchoice=
-       bestscore=2147483647
-       secondbestchoice=
-       secondbestscore=2147483647
-       worstscore=0
-       haveignore=false
-       havefalse=false
-       have0=false
-       seen=
-       for choice in "$VAL" "$@"; do
-               case " $seen " in
-                       *" $choice "*)
-                               continue
-                               ;;
-                       *)
-                               seen=$seen" $VAL"
-                               ;;
-               esac
-               if [ x"$choice" = x"force" ]; then
-                       continue
-               fi
-               if [ x"$choice" = x"ignore" ]; then
-                       haveignore=true
-               fi
-               if [ x"$choice" = x"false" ]; then
-                       havefalse=true
-               fi
-               if [ x"$choice" = x"0" ]; then
-                       have0=true
-               fi
-               if [ x"$MODE" = x"initialize" ]; then
-                       if [ x"$choice" = x"ignore" ]; then
-                               score=0
-                       else
-                               score=2147483647
-                       fi
-               else
-                       {
-                               cat uncrustify.cfg
-                               printf "%s = %s\n" "$KEY" "$choice"
-                       } > uncrustify.cfg.test
-                       UNCRUSTIFY_CONFIG=uncrustify.cfg.test sh uncrustify.sh $FILES >/dev/null 2>&1
-                       status=$?
-                       if [ $status -gt 1 ]; then
-                               echo "# ERROR: $KEY = $choice crashes with status $status."
-                               continue
-                       fi
-                       score=0
-                       git diff --numstat > diffstat.tmp
-                       while read -r add del rest; do
-                               if [ x"$add" != x"-" ]; then
-                                       score=$(($score + $add))
-                               fi
-                               if [ x"$del" != x"-" ]; then
-                                       score=$(($score + $del))
-                               fi
-                       done < diffstat.tmp
-                       git reset --hard >/dev/null 2>&1
-               fi
-               echo >&2 "$KEY = $choice: $score"
-               if [ x"$choice" != x"ignore" ]; then
-                       if [ $score -lt $bestscore ]; then
-                               secondbestscore=$bestscore
-                               secondbestchoice=$bestchoice
-                               bestscore=$score
-                               bestchoice=$choice
-                       elif [ $score -lt $secondbestscore ]; then
-                               secondbestscore=$score
-                               secondbestchoice=$choice
-                       fi
-               fi
-               if [ $score -lt $verybestscore ]; then
-                       verybestscore=$score
-                       verybestchoice=$choice
-               fi
-               if [ $score -gt $worstscore ]; then
-                       worstscore=$score
-                       worstchoice=$choice
-               fi
-       done
-       if [ -z "$bestchoice" ]; then
-               echo "# WARNING: No best choice identified"
-       elif [ $verybestscore -ge $worstscore ]; then
-               echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
-               if $haveignore; then
-                       VAL=ignore
-               elif $havefalse; then
-                       VAL=false
-               elif $have0; then
-                       VAL=0
-               fi
-       elif [ $bestscore -ge $worstscore ]; then
-               echo "# WARNING: Indifferent... please decide manually."
-       elif [ $bestscore -ge $secondbestscore ]; then
-               echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
-       elif [ $bestscore -gt $verybestscore ]; then
-               echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
-               VAL=$bestchoice
-       else
-               VAL=$bestchoice
-       fi
-}
-while read -r LINE; do
-       case "$LINE" in
-               "# NOTE: "*)
-                       continue
-                       ;;
-               "# WARNING: "*)
-                       continue
-                       ;;
-               "# ERROR: "*)
-                       continue
-                       ;;
-               "#"*)
-                       out_raw
-                       continue
-                       ;;
-               *"#force"*|*"#ignore"*)
-                       out_raw
-                       continue
-                       ;;
-       esac
-       printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
-               if \
-                       [ x"$EQ" != x"=" ] || \
-                       [ x"$DELIM" != x"#" ]; then
-                       out_raw
-                       continue
-               fi
-               case "$COMMENT" in
-                       number)
-                               case "$KEY" in
-                                       indent_columns|*tab*)
-                                               decide 1 2 4 8
-                                               ;;
-                                       *)
-                                               decide 0 1 2 3 indent_columns
-                                               ;;
-                               esac
-                               out
-                               ;;
-                       string)
-                               printf "# WARNING: unsupported %s\n" "$COMMENT"
-                               out_raw
-                               ;;
-                       *[!a-z/_]*)
-                               printf "# ERROR: invalid characters %s\n" "$COMMENT"
-                               out_raw
-                               ;;
-                       */*)
-                               decide `echo "$COMMENT" | tr / ' '`
-                               out
-                               ;;
-                       *)
-                               printf "# ERROR: only once choice %s\n" "$COMMENT"
-                               out_raw
-                               ;;
-               esac
-       done
-done < uncrustify.cfg
index b09403f9545fa44e5d246bfab479be9815f535b2..98cdab9dd51b3036def6ce08a78f128abdc91d22 100644 (file)
@@ -1815,7 +1815,6 @@ type .string
 
 # QC OO
 macro-open CLASS
-macro-else EXTENDS
 macro-close ENDCLASS
 
 # translations
diff --git a/qcsrc/uncrustify.sh b/qcsrc/uncrustify.sh
deleted file mode 100755 (executable)
index b36953e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-fix_function_types() {
-       # Uncrustify handles QC function types (example:
-       #  void(void) func;
-       # ) wrong and removes the space between type and variable. Fix this by
-       # a simple sed on ")letter" which should normally not occur.
-       sed -e 's/)\([A-Za-z_]\)/) \1/g' "$@"
-}
-
-if [ -z "$UNCRUSTIFY_CONFIG" ]; then
-       UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg
-fi
-
-case "$#" in
-       0)
-               uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\
-               fix_function_types
-               ;;
-       *)
-               uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" ;\
-               fix_function_types -i "$@"
-               ;;
-esac
diff --git a/qcsrc/whitespace.sh b/qcsrc/whitespace.sh
deleted file mode 100755 (executable)
index ba16fd7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-cd ${0%[\\/]*}
-find . -name .git -prune -o -type f -print0 |               \
-    xargs -0 sed -i                                         \
-        `# strip trailing spaces`                           \
-        -e 's/[[:space:]]*$//'                              \
-        `# line feed at EOF for #include to work properly`  \
-        -e '$a\'
index 0c7b3be58a5ba96db025c59ff4e615ef95517efc..b16c16ac4ca23c5f2c531563e123bb7be888f9fc 100644 (file)
@@ -51,6 +51,8 @@ set g_turrets_unit_ewheel_aim_maxpitch 45
 set g_turrets_unit_ewheel_track_type 1
 set g_turrets_unit_ewheel_track_accel_pitch 0
 set g_turrets_unit_ewheel_track_accel_rot 0
+
+set g_turrets_unit_ewheel_track_blendrate 0
 // }}}
 // {{{ #2: FLAC Cannon
 set g_turrets_unit_flac_health 700
@@ -420,6 +422,22 @@ set g_turrets_unit_tesla_target_select_missilebias 1
 set g_turrets_unit_tesla_ammo_max 1000
 set g_turrets_unit_tesla_ammo 200
 set g_turrets_unit_tesla_ammo_recharge 15
+
+set g_turrets_unit_tesla_shot_radius 0
+set g_turrets_unit_tesla_shot_speed 0
+set g_turrets_unit_tesla_shot_spread 0
+set g_turrets_unit_tesla_target_range_optimal 0
+set g_turrets_unit_tesla_target_select_rangebias 0
+set g_turrets_unit_tesla_target_select_samebias 0
+set g_turrets_unit_tesla_target_select_anglebias 0
+set g_turrets_unit_tesla_aim_firetolerance_dist 0
+set g_turrets_unit_tesla_aim_speed 0
+set g_turrets_unit_tesla_aim_maxrot 0
+set g_turrets_unit_tesla_aim_maxpitch 0
+set g_turrets_unit_tesla_track_type 0
+set g_turrets_unit_tesla_track_accel_pitch 0
+set g_turrets_unit_tesla_track_accel_rot 0
+set g_turrets_unit_tesla_track_blendrate 0
 // }}}
 // {{{ #12: Walker Turret
 set g_turrets_unit_walker_health 500
diff --git a/vehicle_bumblebee.cfg b/vehicle_bumblebee.cfg
deleted file mode 100644 (file)
index 705d2a9..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-set g_vehicle_bumblebee_respawntime              60
-
-set g_vehicle_bumblebee_speed_forward            350
-set g_vehicle_bumblebee_speed_strafe             350
-set g_vehicle_bumblebee_speed_up                 350
-set g_vehicle_bumblebee_speed_down               350
-set g_vehicle_bumblebee_turnspeed                120
-set g_vehicle_bumblebee_pitchspeed               60
-set g_vehicle_bumblebee_pitchlimit               60
-set g_vehicle_bumblebee_friction                 0.5
-
-set g_vehicle_bumblebee_energy                   500
-set g_vehicle_bumblebee_energy_regen             50
-set g_vehicle_bumblebee_energy_regen_pause       1
-
-set g_vehicle_bumblebee_health                   1000
-set g_vehicle_bumblebee_health_regen             65
-set g_vehicle_bumblebee_health_regen_pause       10
-
-set g_vehicle_bumblebee_shield                   400
-set g_vehicle_bumblebee_shield_regen             150
-set g_vehicle_bumblebee_shield_regen_pause       0.75
-
-set g_vehicle_bumblebee_cannon_lock                            0
-set g_vehicle_bumblebee_cannon_cost                            2
-set g_vehicle_bumblebee_cannon_damage                  60
-set g_vehicle_bumblebee_cannon_radius                  225
-set g_vehicle_bumblebee_cannon_refire                  0.2
-set g_vehicle_bumblebee_cannon_speed                   20000
-set g_vehicle_bumblebee_cannon_spread                  0.02
-set g_vehicle_bumblebee_cannon_force                   -35
-set g_vehicle_bumblebee_cannon_turnspeed               160
-set g_vehicle_bumblebee_cannon_pitchlimit_down 60
-set g_vehicle_bumblebee_cannon_pitchlimit_up   60
-set g_vehicle_bumblebee_cannon_turnlimit_in            20
-set g_vehicle_bumblebee_cannon_turnlimit_out   80
-set g_vehicle_bumblebee_cannon_ammo                            100
-set g_vehicle_bumblebee_cannon_ammo_regen              100
-set g_vehicle_bumblebee_cannon_ammo_regen_pause        1
-
-set g_vehicle_bumblebee_raygun_turnspeed 180
-set g_vehicle_bumblebee_raygun_pitchlimit_down 20
-set g_vehicle_bumblebee_raygun_pitchlimit_up 5
-set g_vehicle_bumblebee_raygun_turnlimit_sides 35
-
-set g_vehicle_bumblebee_raygun 0
-set g_vehicle_bumblebee_raygun_range 2048
-set g_vehicle_bumblebee_raygun_dps 250
-set g_vehicle_bumblebee_raygun_aps 100
-set g_vehicle_bumblebee_raygun_fps 100
-
-set g_vehicle_bumblebee_healgun_hps 150
-set g_vehicle_bumblebee_healgun_hmax 100
-set g_vehicle_bumblebee_healgun_aps 75
-set g_vehicle_bumblebee_healgun_amax 100
-set g_vehicle_bumblebee_healgun_sps 100
-set g_vehicle_bumblebee_healgun_smax 100
-set g_vehicle_bumblebee_healgun_locktime 2.5
-
-set g_vehicle_bumblebee_blowup_radius            500
-set g_vehicle_bumblebee_blowup_coredamage        500
-set g_vehicle_bumblebee_blowup_edgedamage        100
-set g_vehicle_bumblebee_blowup_forceintensity    600
-set g_vehicle_bumblebee_bouncepain "1 100 200"
\ No newline at end of file
diff --git a/vehicle_racer.cfg b/vehicle_racer.cfg
deleted file mode 100644 (file)
index c43decb..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-set g_vehicle_racer_respawntime                    35
-
-set g_vehicle_racer_health              200
-set g_vehicle_racer_health_regen        0
-set g_vehicle_racer_health_regen_pause  0
-
-set g_vehicle_racer_shield              100
-set g_vehicle_racer_shield_regen        30
-set g_vehicle_racer_shield_regen_pause  1
-
-set g_vehicle_racer_energy              100
-set g_vehicle_racer_energy_regen        50
-set g_vehicle_racer_energy_regen_pause  1
-
-set g_vehicle_racer_speed_stop          2500
-set g_vehicle_racer_speed_forward       650
-set g_vehicle_racer_speed_strafe        650
-set g_vehicle_racer_speed_afterburn     3000
-set g_vehicle_racer_friction            0.45
-set g_vehicle_racer_afterburn_cost      100       // energy consumed per second
-
-set g_vehicle_racer_waterburn_speed 750
-set g_vehicle_racer_waterburn_cost 5
-set g_vehicle_racer_water_speed_forward 600
-set g_vehicle_racer_water_speed_strafe 600
-
-set g_vehicle_racer_hovertype           0       // 0 = hover, != 0 = maglev
-set g_vehicle_racer_hoverpower          8000    // NOTE!! x 4 (4 engines)
-set g_vehicle_racer_upforcedamper       10
-
-set g_vehicle_racer_downforce            0.01
-set g_vehicle_racer_springlength         70
-set g_vehicle_racer_collision_multiplier 0.05
-set g_vehicle_racer_anglestabilizer      1.75
-
-set g_vehicle_racer_turnspeed          220
-set g_vehicle_racer_pitchspeed         125
-set g_vehicle_racer_maxpitch           25
-set g_vehicle_racer_turnroll           30
-
-set g_vehicle_racer_cannon_speed        15000
-set g_vehicle_racer_cannon_damage       15
-set g_vehicle_racer_cannon_radius       100
-set g_vehicle_racer_cannon_refire       0.05
-set g_vehicle_racer_cannon_cost         2
-set g_vehicle_racer_cannon_spread       0.0125
-set g_vehicle_racer_cannon_force        50
-
-set g_vehicle_racer_rocket_speed       900
-set g_vehicle_racer_rocket_accel       1600
-set g_vehicle_racer_rocket_turnrate    0.2
-set g_vehicle_racer_rocket_damage      100
-set g_vehicle_racer_rocket_force       350
-set g_vehicle_racer_rocket_radius      125
-set g_vehicle_racer_rocket_refire      3
-set g_vehicle_racer_rocket_cost        0
-set g_vehicle_racer_rocket_climbspeed  1600
-
-set g_vehicle_racer_rocket_locktarget           1
-set g_vehicle_racer_rocket_locking_time         0.9
-set g_vehicle_racer_rocket_locking_releasetime  0.5
-set g_vehicle_racer_rocket_locked_time          4
-set g_vehicle_racer_rocket_locked_maxangle      1.8
-
-set g_vehicle_racer_blowup_radius           250
-set g_vehicle_racer_blowup_coredamage       250
-set g_vehicle_racer_blowup_edgedamage       15
-set g_vehicle_racer_blowup_forceintensity   250
-
-set g_vehicle_racer_bouncefactor 0.25   // Factor of old velocity to keep after colission
-set g_vehicle_racer_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
-set g_vehicle_racer_bouncepain "60 0.75 300" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
-
-set g_vehicle_racer_mass                    900
diff --git a/vehicle_raptor.cfg b/vehicle_raptor.cfg
deleted file mode 100644 (file)
index 86864ee..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-set g_vehicle_raptor_respawntime 40
-
-// 0: go where player aims, +forward etc relative to aim angles
-// 1: ignore aim for up/down movement. +forward always moved forward, +jump always moves up
-set g_vehicle_raptor_movestyle 1
-
-set g_vehicle_raptor_turnroll 0.4
-
-set g_vehicle_raptor_takeofftime 1.5
-
-set g_vehicle_raptor_turnspeed  200
-set g_vehicle_raptor_pitchspeed 50
-set g_vehicle_raptor_pitchlimit 45
-
-set g_vehicle_raptor_speed_forward 1700
-set g_vehicle_raptor_speed_strafe  900
-set g_vehicle_raptor_speed_up      1700
-set g_vehicle_raptor_speed_down    1700
-set g_vehicle_raptor_friction      2
-
-set g_vehicle_raptor_bomblets           8
-set g_vehicle_raptor_bomblet_alt        750
-set g_vehicle_raptor_bomblet_time       0.5
-set g_vehicle_raptor_bomblet_spread     0.4
-set g_vehicle_raptor_bomblet_damage     55
-set g_vehicle_raptor_bomblet_edgedamage 25
-set g_vehicle_raptor_bomblet_radius     350
-set g_vehicle_raptor_bomblet_force      150
-set g_vehicle_raptor_bomblet_explode_delay 0.4
-set g_vehicle_raptor_bombs_refire       5
-
-set g_vehicle_raptor_cannon_turnspeed 120
-set g_vehicle_raptor_cannon_turnlimit 20
-set g_vehicle_raptor_cannon_pitchlimit_up   12
-set g_vehicle_raptor_cannon_pitchlimit_down 32
-
-set g_vehicle_raptor_cannon_locktarget          0
-set g_vehicle_raptor_cannon_locking_time        0.2
-set g_vehicle_raptor_cannon_locking_releasetime 0.45
-set g_vehicle_raptor_cannon_locked_time         1
-set g_vehicle_raptor_cannon_predicttarget       1
-
-set g_vehicle_raptor_cannon_cost     1
-set g_vehicle_raptor_cannon_damage   10
-set g_vehicle_raptor_cannon_radius   60
-set g_vehicle_raptor_cannon_refire   0.03
-set g_vehicle_raptor_cannon_speed    24000
-set g_vehicle_raptor_cannon_spread   0.01
-set g_vehicle_raptor_cannon_force    25
-
-set g_vehicle_raptor_flare_refire 5
-set g_vehicle_raptor_flare_lifetime 10
-set g_vehicle_raptor_flare_chase 0.9
-set g_vehicle_raptor_flare_range 2000
-
-set g_vehicle_raptor_energy             100
-set g_vehicle_raptor_energy_regen       25
-set g_vehicle_raptor_energy_regen_pause 0.25
-
-set g_vehicle_raptor_health             150
-set g_vehicle_raptor_health_regen       0
-set g_vehicle_raptor_health_regen_pause 0
-
-set g_vehicle_raptor_shield             75
-set g_vehicle_raptor_shield_regen       25
-set g_vehicle_raptor_shield_regen_pause 1.5
-
-set g_vehicle_raptor_blowup_radius           250
-set g_vehicle_raptor_blowup_coredamage       250
-set g_vehicle_raptor_blowup_edgedamage       15
-set g_vehicle_raptor_blowup_forceintensity   250
-
-set g_vehicle_raptor_bouncefactor 0.2
-set g_vehicle_raptor_bouncestop 0
-set g_vehicle_raptor_bouncepain "1 4 1000"
-
-set g_vehicle_raptor_mass              2200
diff --git a/vehicle_spiderbot.cfg b/vehicle_spiderbot.cfg
deleted file mode 100644 (file)
index 0172053..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-set g_vehicle_spiderbot_respawntime                      45
-
-set g_vehicle_spiderbot_health                800
-set g_vehicle_spiderbot_health_regen             10
-set g_vehicle_spiderbot_health_regen_pause    5
-
-set g_vehicle_spiderbot_shield                200
-set g_vehicle_spiderbot_shield_block          1
-set g_vehicle_spiderbot_shield_regen          25
-set g_vehicle_spiderbot_shield_regen_pause    0.35
-
-set g_vehicle_spiderbot_energy              0
-set g_vehicle_spiderbot_energy_regen        0
-set g_vehicle_spiderbot_energy_regen_pause  0
-
-set g_vehicle_spiderbot_turnspeed            90
-set g_vehicle_spiderbot_turnspeed_strafe     300
-set g_vehicle_spiderbot_head_turnspeed       110
-set g_vehicle_spiderbot_head_turnlimit       90
-set g_vehicle_spiderbot_head_pitchlimit_up   30
-set g_vehicle_spiderbot_head_pitchlimit_down -20
-
-set g_vehicle_spiderbot_speed_stop         50
-set g_vehicle_spiderbot_speed_walk         500
-set g_vehicle_spiderbot_speed_strafe       400
-set g_vehicle_spiderbot_movement_inertia   0.15
-set g_vehicle_spiderbot_tiltlimit          90
-
-set g_vehicle_spiderbot_minigun_damage          24       // 400 (x2) DPS
-set g_vehicle_spiderbot_minigun_refire          0.06
-set g_vehicle_spiderbot_minigun_force           9
-set g_vehicle_spiderbot_minigun_spread          0.015
-set g_vehicle_spiderbot_minigun_solidpenetration 32
-set g_vehicle_spiderbot_minigun_ammo_cost       1
-set g_vehicle_spiderbot_minigun_ammo_max        100
-set g_vehicle_spiderbot_minigun_ammo_regen      40
-set g_vehicle_spiderbot_minigun_ammo_regen_pause 1
-
-set g_vehicle_spiderbot_springlength        150
-set g_vehicle_spiderbot_springup            20
-set g_vehicle_spiderbot_springblend         0.1
-
-set g_vehicle_spiderbot_rocket_health     100
-set g_vehicle_spiderbot_rocket_damage     50
-set g_vehicle_spiderbot_rocket_edgedamage 25
-set g_vehicle_spiderbot_rocket_force      150
-set g_vehicle_spiderbot_rocket_radius     250
-set g_vehicle_spiderbot_rocket_reload     4
-set g_vehicle_spiderbot_rocket_refire     0.1
-set g_vehicle_spiderbot_rocket_refire2    0.025  // volly
-set g_vehicle_spiderbot_rocket_speed      3500
-set g_vehicle_spiderbot_rocket_turnrate   0.25
-set g_vehicle_spiderbot_rocket_noise      0.2
-set g_vehicle_spiderbot_rocket_lifetime   20
-set g_vehicle_spiderbot_rocket_spread     0.05
-
-set g_vehicle_spiderbot_blowup_radius           250
-set g_vehicle_spiderbot_blowup_coredamage       250
-set g_vehicle_spiderbot_blowup_edgedamage       15
-set g_vehicle_spiderbot_blowup_forceintensity   250
-
-set g_vehicle_spiderbot_bouncefactor 0   // Factor of old velocity to keep after colission
-set g_vehicle_spiderbot_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
-set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
diff --git a/vehicles.cfg b/vehicles.cfg
deleted file mode 100644 (file)
index 0fefec6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-set g_vehicles 1
-
-exec vehicle_racer.cfg
-exec vehicle_raptor.cfg
-exec vehicle_spiderbot.cfg
-exec vehicle_bumblebee.cfg
-
-set g_vehicle_racer 1
-set g_vehicle_spiderbot 1
-set g_vehicle_raptor 1
-set g_vehicle_bumblebee 1
-
-set g_vehicles_crush_dmg 70
-set g_vehicles_crush_force 50
-
-set cl_vehicles_hud_tactical 1
-set cl_vehicles_hudscale 0.5
-set cl_vehicles_crosshair_size 0.5
-
-set g_vehicles_enter 0 "require pressing use key to enter a vehicle"
-set g_vehicles_enter_radius 250
-set g_vehicles_steal 1 "allow stealing enemy vehicles in teamplay modes"
-set g_vehicles_steal_show_waypoint 1 "show a waypoint above the thief"
-
-set g_vehicles_teams 1 "allow team specific vehicles"
-
-set g_vehicles_delayspawn 1
-set g_vehicles_delayspawn_jitter 10
-
-set g_vehicles_vortex_damagerate 0.5
-set g_vehicles_machinegun_damagerate 0.65
-set g_vehicles_rifle_damagerate 1
-set g_vehicles_vaporizer_damagerate 0.8
-set g_vehicles_tag_damagerate 2
-