From b0210c08a287ad4631e16ddf3a83a0b0c546283f Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 20 Aug 2016 23:44:16 +1000 Subject: [PATCH] Cleanup common mutators: remove IMPLEMENTATION macro --- qcsrc/client/commands/_mod.inc | 4 +- qcsrc/client/commands/_mod.qh | 4 +- qcsrc/client/view.qc | 2 +- qcsrc/common/campaign_file.qh | 1 + qcsrc/common/campaign_setup.qh | 1 + qcsrc/common/effects/effectinfo.qh | 1 + qcsrc/common/effects/qc/casings.qh | 1 + qcsrc/common/effects/qc/damageeffects.qh | 1 + qcsrc/common/effects/qc/globalsound.qc | 2 +- qcsrc/common/gamemodes/_all.inc | 2 + qcsrc/common/gamemodes/_all.qh | 2 + qcsrc/common/gamemodes/_mod.inc | 1 - qcsrc/common/gamemodes/_mod.qh | 1 - qcsrc/common/gamemodes/all.inc | 2 - qcsrc/common/gamemodes/all.qc | 5 - qcsrc/common/gamemodes/all.qh | 6 - qcsrc/common/gamemodes/gamemode/_all.inc | 5 + qcsrc/common/gamemodes/gamemode/_all.qh | 5 + .../gamemodes/gamemode/nexball/module.inc | 2 - .../gamemodes/gamemode/nexball/nexball.qc | 2 - .../gamemodes/gamemode/nexball/nexball.qh | 4 +- .../gamemodes/gamemode/nexball/weapon.qc | 13 +- .../gamemodes/gamemode/nexball/weapon.qh | 9 + .../gamemodes/gamemode/onslaught/_mod.inc | 21 +- .../gamemodes/gamemode/onslaught/_mod.qh | 21 +- .../gamemode/onslaught/cl_controlpoint.qh | 5 +- .../gamemode/onslaught/cl_generator.qh | 6 +- .../gamemode/onslaught/controlpoint.qc | 1 + .../gamemode/onslaught/controlpoint.qh | 1 + .../gamemodes/gamemode/onslaught/generator.qc | 1 + .../gamemodes/gamemode/onslaught/generator.qh | 1 + .../gamemodes/gamemode/onslaught/module.inc | 24 - .../gamemodes/gamemode/onslaught/onslaught.qc | 2259 +---------------- .../gamemodes/gamemode/onslaught/onslaught.qh | 4 + .../gamemode/onslaught/sv_controlpoint.qh | 5 +- .../gamemode/onslaught/sv_generator.qh | 5 +- .../gamemode/onslaught/sv_onslaught.qc | 2128 ++++++++++++++++ .../gamemode/onslaught/sv_onslaught.qh | 117 + qcsrc/common/items/item/jetpack.qh | 1 + qcsrc/common/minigames/_mod.inc | 4 +- qcsrc/common/minigames/_mod.qh | 10 +- qcsrc/common/minigames/minigame/bd.qh | 1 + qcsrc/common/minigames/minigame/c4.qh | 1 + qcsrc/common/minigames/minigame/nmm.qh | 1 + qcsrc/common/minigames/minigame/pong.qh | 1 + qcsrc/common/minigames/minigame/pp.qh | 1 + qcsrc/common/minigames/minigame/ps.qh | 1 + qcsrc/common/minigames/minigame/snake.qh | 1 + qcsrc/common/minigames/minigame/ttt.qh | 1 + qcsrc/common/monsters/_mod.inc | 4 +- qcsrc/common/monsters/_mod.qh | 4 +- qcsrc/common/monsters/monster/mage.qh | 1 + qcsrc/common/monsters/monster/shambler.qh | 1 + qcsrc/common/monsters/monster/spider.qh | 1 + qcsrc/common/monsters/monster/wyvern.qh | 1 + qcsrc/common/monsters/monster/zombie.qh | 1 + qcsrc/common/mutators/_all.inc | 2 + qcsrc/common/mutators/_all.qh | 2 + qcsrc/common/mutators/_mod.inc | 1 - qcsrc/common/mutators/_mod.qh | 1 - qcsrc/common/mutators/all.inc | 39 - qcsrc/common/mutators/all.qc | 5 - qcsrc/common/mutators/all.qh | 6 - qcsrc/common/mutators/mutator/_all.inc | 43 + qcsrc/common/mutators/mutator/_all.qh | 43 + qcsrc/common/mutators/mutator/_mod.inc | 1 - qcsrc/common/mutators/mutator/_mod.qh | 1 - .../mutators/mutator/bloodloss/_mod.inc | 4 +- .../common/mutators/mutator/bloodloss/_mod.qh | 4 +- .../mutators/mutator/bloodloss/module.inc | 3 - .../{bloodloss.qc => sv_bloodloss.qc} | 4 +- .../mutator/bloodloss/sv_bloodloss.qh | 1 + .../mutators/mutator/breakablehook/_mod.inc | 4 +- .../mutators/mutator/breakablehook/_mod.qh | 4 +- .../mutators/mutator/breakablehook/module.inc | 3 - .../{breakablehook.qc => sv_breakablehook.qc} | 4 +- .../mutator/breakablehook/sv_breakablehook.qh | 1 + qcsrc/common/mutators/mutator/buffs/_mod.inc | 7 +- qcsrc/common/mutators/mutator/buffs/_mod.qh | 7 +- qcsrc/common/mutators/mutator/buffs/all.qc | 1 - qcsrc/common/mutators/mutator/buffs/buffs.qc | 1085 +------- .../mutator/buffs/{all.qh => buffs.qh} | 5 +- .../mutator/buffs/{module.inc => cl_buffs.qc} | 26 +- .../common/mutators/mutator/buffs/cl_buffs.qh | 3 + .../common/mutators/mutator/buffs/sv_buffs.qc | 1002 ++++++++ .../common/mutators/mutator/buffs/sv_buffs.qh | 77 + .../mutators/mutator/bugrigs/bugrigs.qc | 6 +- .../mutators/mutator/bugrigs/bugrigs.qh | 1 + .../mutators/mutator/bugrigs/module.inc | 3 - .../mutators/mutator/campcheck/_mod.inc | 3 + .../common/mutators/mutator/campcheck/_mod.qh | 3 + .../mutators/mutator/campcheck/campcheck.qc | 92 +- .../mutators/mutator/campcheck/campcheck.qh | 1 + .../mutators/mutator/campcheck/module.inc | 3 - .../mutator/campcheck/sv_campcheck.qc | 91 + .../mutator/campcheck/sv_campcheck.qh | 1 + .../common/mutators/mutator/cloaked/_mod.inc | 4 +- qcsrc/common/mutators/mutator/cloaked/_mod.qh | 4 +- .../mutators/mutator/cloaked/module.inc | 3 - .../cloaked/{cloaked.qc => sv_cloaked.qc} | 4 +- .../mutators/mutator/cloaked/sv_cloaked.qh | 1 + .../mutators/mutator/damagetext/damagetext.qc | 16 +- .../mutators/mutator/damagetext/damagetext.qh | 5 + .../mutators/mutator/damagetext/module.inc | 1 - .../common/mutators/mutator/dodging/_mod.inc | 4 +- qcsrc/common/mutators/mutator/dodging/_mod.qh | 4 +- .../mutators/mutator/dodging/module.inc | 3 - .../dodging/{dodging.qc => sv_dodging.qc} | 3 +- .../mutators/mutator/dodging/sv_dodging.qh | 1 + .../mutators/mutator/doublejump/doublejump.qc | 5 +- .../mutators/mutator/doublejump/doublejump.qh | 1 + .../mutators/mutator/doublejump/module.inc | 3 - .../mutators/mutator/globalforces/_mod.inc | 4 +- .../mutators/mutator/globalforces/_mod.qh | 4 +- .../mutators/mutator/globalforces/module.inc | 3 - .../{globalforces.qc => sv_globalforces.qc} | 4 +- .../mutator/globalforces/sv_globalforces.qh | 1 + qcsrc/common/mutators/mutator/hook/_mod.inc | 4 +- qcsrc/common/mutators/mutator/hook/_mod.qh | 4 +- qcsrc/common/mutators/mutator/hook/module.inc | 3 - .../mutator/hook/{hook.qc => sv_hook.qc} | 4 +- qcsrc/common/mutators/mutator/hook/sv_hook.qh | 1 + .../common/mutators/mutator/instagib/_mod.inc | 4 +- .../common/mutators/mutator/instagib/_mod.qh | 4 +- .../common/mutators/mutator/instagib/items.qc | 85 +- .../common/mutators/mutator/instagib/items.qh | 84 + .../mutators/mutator/instagib/module.inc | 1 - .../instagib/{instagib.qc => sv_instagib.qc} | 19 +- .../mutators/mutator/instagib/sv_instagib.qh | 5 + .../mutators/mutator/invincibleproj/_mod.inc | 4 +- .../mutators/mutator/invincibleproj/_mod.qh | 4 +- .../mutator/invincibleproj/module.inc | 3 - ...invincibleproj.qc => sv_invincibleproj.qc} | 4 +- .../invincibleproj/sv_invincibleproj.qh | 1 + .../mutators/mutator/itemstime/_mod.inc | 2 + .../common/mutators/mutator/itemstime/_mod.qh | 2 + .../mutator/{ => itemstime}/itemstime.qc | 4 +- .../mutators/mutator/itemstime/itemstime.qh | 1 + .../mutators/mutator/melee_only/_mod.inc | 4 +- .../mutators/mutator/melee_only/_mod.qh | 4 +- .../mutators/mutator/melee_only/module.inc | 3 - .../{melee_only.qc => sv_melee_only.qc} | 4 +- .../mutator/melee_only/sv_melee_only.qh | 1 + qcsrc/common/mutators/mutator/midair/_mod.inc | 4 +- qcsrc/common/mutators/mutator/midair/_mod.qh | 4 +- .../common/mutators/mutator/midair/module.inc | 3 - .../midair/{midair.qc => sv_midair.qc} | 3 +- .../mutators/mutator/midair/sv_midair.qh | 1 + .../mutators/mutator/multijump/module.inc | 3 - .../mutators/mutator/multijump/multijump.qc | 6 +- .../mutators/mutator/multijump/multijump.qh | 1 + .../common/mutators/mutator/nades/module.inc | 4 - qcsrc/common/mutators/mutator/nades/nades.qc | 5 +- qcsrc/common/mutators/mutator/nades/nades.qh | 5 +- qcsrc/common/mutators/mutator/nades/net.qc | 6 +- qcsrc/common/mutators/mutator/nades/net.qh | 1 + .../common/mutators/mutator/new_toys/_mod.inc | 4 +- .../common/mutators/mutator/new_toys/_mod.qh | 4 +- .../mutators/mutator/new_toys/module.inc | 3 - .../new_toys/{new_toys.qc => sv_new_toys.qc} | 4 +- .../mutators/mutator/new_toys/sv_new_toys.qh | 1 + qcsrc/common/mutators/mutator/nix/_mod.inc | 4 +- qcsrc/common/mutators/mutator/nix/_mod.qh | 4 +- qcsrc/common/mutators/mutator/nix/module.inc | 3 - .../mutator/nix/{nix.qc => sv_nix.qc} | 4 +- qcsrc/common/mutators/mutator/nix/sv_nix.qh | 1 + .../common/mutators/mutator/overkill/_mod.inc | 6 + .../common/mutators/mutator/overkill/_mod.qh | 6 + .../mutators/mutator/overkill/cl_overkill.qc | 11 + .../mutators/mutator/overkill/cl_overkill.qh | 1 + qcsrc/common/mutators/mutator/overkill/hmg.qc | 45 +- qcsrc/common/mutators/mutator/overkill/hmg.qh | 42 + .../mutators/mutator/overkill/module.inc | 19 - .../mutators/mutator/overkill/overkill.qc | 410 --- .../mutators/mutator/overkill/overkill.qh | 1 + qcsrc/common/mutators/mutator/overkill/rpc.qc | 50 +- qcsrc/common/mutators/mutator/overkill/rpc.qh | 47 + .../mutators/mutator/overkill/sv_overkill.qc | 410 +++ .../mutators/mutator/overkill/sv_overkill.qh | 1 + .../mutators/mutator/physical_items/_mod.inc | 4 +- .../mutators/mutator/physical_items/_mod.qh | 4 +- .../mutator/physical_items/module.inc | 3 - ...physical_items.qc => sv_physical_items.qc} | 4 +- .../physical_items/sv_physical_items.qh | 1 + qcsrc/common/mutators/mutator/pinata/_mod.inc | 4 +- qcsrc/common/mutators/mutator/pinata/_mod.qh | 4 +- .../common/mutators/mutator/pinata/module.inc | 3 - .../pinata/{pinata.qc => sv_pinata.qc} | 5 +- .../mutators/mutator/pinata/sv_pinata.qh | 1 + .../mutators/mutator/random_gravity/_mod.inc | 4 +- .../mutators/mutator/random_gravity/_mod.qh | 4 +- .../mutator/random_gravity/module.inc | 3 - ...random_gravity.qc => sv_random_gravity.qc} | 6 +- .../random_gravity/sv_random_gravity.qh | 1 + .../mutators/mutator/rocketflying/_mod.inc | 4 +- .../mutators/mutator/rocketflying/_mod.qh | 4 +- .../mutators/mutator/rocketflying/module.inc | 3 - .../{rocketflying.qc => sv_rocketflying.qc} | 4 +- .../mutator/rocketflying/sv_rocketflying.qh | 1 + .../mutators/mutator/rocketminsta/_mod.inc | 4 +- .../mutators/mutator/rocketminsta/_mod.qh | 4 +- .../mutators/mutator/rocketminsta/module.inc | 3 - .../{rocketminsta.qc => sv_rocketminsta.qc} | 5 +- .../mutator/rocketminsta/sv_rocketminsta.qh | 1 + .../mutators/mutator/running_guns/_mod.inc | 4 +- .../mutators/mutator/running_guns/_mod.qh | 4 +- .../mutators/mutator/running_guns/module.inc | 3 - .../{running_guns.qc => sv_running_guns.qc} | 5 +- .../mutator/running_guns/sv_running_guns.qh | 1 + .../common/mutators/mutator/sandbox/_mod.inc | 4 +- qcsrc/common/mutators/mutator/sandbox/_mod.qh | 4 +- .../mutators/mutator/sandbox/module.inc | 4 - .../sandbox/{sandbox.qc => sv_sandbox.qc} | 4 +- .../mutators/mutator/sandbox/sv_sandbox.qh | 1 + .../mutator/spawn_near_teammate/_mod.inc | 4 +- .../mutator/spawn_near_teammate/_mod.qh | 4 +- .../mutator/spawn_near_teammate/module.inc | 3 - ..._teammate.qc => sv_spawn_near_teammate.qc} | 4 +- .../sv_spawn_near_teammate.qh | 1 + .../mutators/mutator/superspec/_mod.inc | 4 +- .../common/mutators/mutator/superspec/_mod.qh | 4 +- .../mutators/mutator/superspec/module.inc | 3 - .../{superspec.qc => sv_superspec.qc} | 4 +- .../mutator/superspec/sv_superspec.qh | 1 + .../mutators/mutator/touchexplode/_mod.inc | 4 +- .../mutators/mutator/touchexplode/_mod.qh | 4 +- .../mutators/mutator/touchexplode/module.inc | 3 - .../{touchexplode.qc => sv_touchexplode.qc} | 4 +- .../mutator/touchexplode/sv_touchexplode.qh | 1 + .../common/mutators/mutator/vampire/_mod.inc | 4 +- qcsrc/common/mutators/mutator/vampire/_mod.qh | 4 +- .../mutators/mutator/vampire/module.inc | 3 - .../vampire/{vampire.qc => sv_vampire.qc} | 4 +- .../mutators/mutator/vampire/sv_vampire.qh | 1 + .../mutators/mutator/vampirehook/_mod.inc | 4 +- .../mutators/mutator/vampirehook/_mod.qh | 4 +- .../mutators/mutator/vampirehook/module.inc | 3 - .../{vampirehook.qc => sv_vampirehook.qc} | 5 +- .../mutator/vampirehook/sv_vampirehook.qh | 1 + .../common/mutators/mutator/waypoints/all.qh | 5 +- .../mutators/mutator/waypoints/module.inc | 1 - .../mutator/waypoints/waypointsprites.qc | 3 - .../mutator/weaponarena_random/_mod.inc | 4 +- .../mutator/weaponarena_random/_mod.qh | 4 +- .../mutator/weaponarena_random/module.inc | 3 - ...ena_random.qc => sv_weaponarena_random.qc} | 5 +- .../sv_weaponarena_random.qh | 1 + qcsrc/common/physics/movetypes/follow.qh | 1 + qcsrc/common/physics/movetypes/step.qh | 1 + qcsrc/common/physics/movetypes/toss.qh | 1 + qcsrc/common/physics/movetypes/walk.qh | 1 + qcsrc/common/stats.qh | 2 +- qcsrc/common/triggers/func/bobbing.qh | 1 + qcsrc/common/triggers/func/button.qh | 1 + qcsrc/common/triggers/func/conveyor.qh | 1 + qcsrc/common/triggers/func/door_rotating.qh | 1 + qcsrc/common/triggers/func/door_secret.qh | 1 + qcsrc/common/triggers/func/fourier.qh | 1 + qcsrc/common/triggers/func/pendulum.qh | 1 + qcsrc/common/triggers/func/plat.qh | 1 + qcsrc/common/triggers/func/pointparticles.qh | 1 + qcsrc/common/triggers/func/rainsnow.qh | 1 + qcsrc/common/triggers/func/rotating.qh | 1 + qcsrc/common/triggers/func/stardust.qh | 1 + qcsrc/common/triggers/func/vectormamamam.qh | 1 + qcsrc/common/triggers/misc/corner.qh | 1 + qcsrc/common/triggers/misc/follow.qh | 1 + qcsrc/common/triggers/misc/include.qh | 1 + qcsrc/common/triggers/misc/laser.qh | 1 + qcsrc/common/triggers/misc/teleport_dest.qh | 1 + qcsrc/common/triggers/target/changelevel.qh | 1 + qcsrc/common/triggers/target/location.qh | 1 + qcsrc/common/triggers/target/spawn.qh | 1 + qcsrc/common/triggers/target/speaker.qh | 1 + qcsrc/common/triggers/target/voicescript.qh | 1 + qcsrc/common/triggers/trigger/counter.qh | 1 + qcsrc/common/triggers/trigger/delay.qh | 1 + qcsrc/common/triggers/trigger/disablerelay.qh | 1 + qcsrc/common/triggers/trigger/flipflop.qh | 1 + qcsrc/common/triggers/trigger/gamestart.qh | 1 + qcsrc/common/triggers/trigger/gravity.qh | 1 + qcsrc/common/triggers/trigger/heal.qh | 1 + qcsrc/common/triggers/trigger/hurt.qh | 1 + qcsrc/common/triggers/trigger/magicear.qh | 1 + qcsrc/common/triggers/trigger/monoflop.qh | 1 + .../common/triggers/trigger/multivibrator.qh | 1 + qcsrc/common/triggers/trigger/relay.qh | 1 + .../triggers/trigger/relay_activators.qh | 1 + qcsrc/common/triggers/trigger/relay_if.qh | 1 + .../triggers/trigger/relay_teamcheck.qh | 1 + qcsrc/common/triggers/trigger/teleport.qh | 1 + qcsrc/common/turrets/_mod.inc | 9 +- qcsrc/common/turrets/_mod.qh | 9 +- qcsrc/common/turrets/checkpoint.qh | 1 + qcsrc/common/turrets/cl_turrets.qh | 1 + qcsrc/common/turrets/targettrigger.qh | 1 + qcsrc/common/turrets/turrets.qc | 0 qcsrc/common/turrets/turrets.qh | 1 + qcsrc/common/vehicles/_mod.inc | 9 +- qcsrc/common/vehicles/_mod.qh | 9 +- qcsrc/common/vehicles/vehicles.qc | 0 qcsrc/common/vehicles/vehicles.qh | 1 + qcsrc/common/weapons/weapon/arc.qh | 1 + qcsrc/common/weapons/weapon/blaster.qh | 1 + qcsrc/common/weapons/weapon/crylink.qh | 1 + qcsrc/common/weapons/weapon/devastator.qh | 1 + qcsrc/common/weapons/weapon/electro.qh | 1 + qcsrc/common/weapons/weapon/fireball.qh | 1 + qcsrc/common/weapons/weapon/hagar.qh | 1 + qcsrc/common/weapons/weapon/hlac.qh | 1 + qcsrc/common/weapons/weapon/hook.qh | 1 + qcsrc/common/weapons/weapon/machinegun.qh | 1 + qcsrc/common/weapons/weapon/minelayer.qh | 1 + qcsrc/common/weapons/weapon/mortar.qh | 1 + qcsrc/common/weapons/weapon/porto.qh | 1 + qcsrc/common/weapons/weapon/rifle.qh | 1 + qcsrc/common/weapons/weapon/seeker.qh | 1 + qcsrc/common/weapons/weapon/shockwave.qh | 1 + qcsrc/common/weapons/weapon/shotgun.qh | 1 + qcsrc/common/weapons/weapon/tuba.qh | 1 + qcsrc/common/weapons/weapon/vaporizer.qh | 1 + qcsrc/common/weapons/weapon/vortex.qh | 1 + qcsrc/lib/angle.qh | 1 + qcsrc/lib/csqcmodel/_mod.inc | 14 +- qcsrc/lib/csqcmodel/_mod.qh | 14 +- qcsrc/lib/csqcmodel/model.qc | 0 qcsrc/lib/csqcmodel/model.qh | 1 + qcsrc/lib/csqcmodel/player.qc | 0 qcsrc/lib/csqcmodel/player.qh | 1 + qcsrc/lib/json.qh | 1 + qcsrc/server/_mod.inc | 10 +- qcsrc/server/_mod.qh | 10 +- qcsrc/server/bot/default/bot.qc | 2 +- qcsrc/server/{cl_client.qc => client.qc} | 6 +- qcsrc/server/{cl_client.qh => client.qh} | 0 qcsrc/server/command/_mod.qh | 3 + qcsrc/server/command/banning.qc | 2 +- qcsrc/server/command/cmd.qc | 2 +- qcsrc/server/command/sv_cmd.qc | 4 +- qcsrc/server/g_hook.qc | 2 +- qcsrc/server/g_world.qc | 2 +- qcsrc/server/{cl_impulse.qc => impulse.qc} | 2 +- qcsrc/server/{cl_impulse.qh => impulse.qh} | 0 qcsrc/server/matrix.qc | 2 +- qcsrc/server/mutators/events.qh | 4 +- qcsrc/server/mutators/gamemode.qh | 6 +- qcsrc/server/mutators/mutator.qh | 6 +- qcsrc/server/{cl_player.qc => player.qc} | 2 +- qcsrc/server/{cl_player.qh => player.qh} | 0 qcsrc/server/race.qc | 2 +- qcsrc/server/scores_rules.qc | 2 +- qcsrc/server/teamplay.qc | 6 +- qcsrc/server/tests.qh | 2 +- qcsrc/tools/genmod.sh | 14 +- 354 files changed, 4710 insertions(+), 4512 deletions(-) create mode 100644 qcsrc/common/campaign_file.qh create mode 100644 qcsrc/common/campaign_setup.qh create mode 100644 qcsrc/common/effects/effectinfo.qh create mode 100644 qcsrc/common/effects/qc/casings.qh create mode 100644 qcsrc/common/effects/qc/damageeffects.qh delete mode 100644 qcsrc/common/gamemodes/all.inc delete mode 100644 qcsrc/common/gamemodes/all.qc delete mode 100644 qcsrc/common/gamemodes/all.qh create mode 100644 qcsrc/common/gamemodes/gamemode/_all.inc create mode 100644 qcsrc/common/gamemodes/gamemode/_all.qh delete mode 100644 qcsrc/common/gamemodes/gamemode/nexball/module.inc create mode 100644 qcsrc/common/gamemodes/gamemode/nexball/weapon.qh create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/generator.qc create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/generator.qh delete mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/module.inc create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc create mode 100644 qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh create mode 100644 qcsrc/common/items/item/jetpack.qh create mode 100644 qcsrc/common/minigames/minigame/bd.qh create mode 100644 qcsrc/common/minigames/minigame/c4.qh create mode 100644 qcsrc/common/minigames/minigame/nmm.qh create mode 100644 qcsrc/common/minigames/minigame/pong.qh create mode 100644 qcsrc/common/minigames/minigame/pp.qh create mode 100644 qcsrc/common/minigames/minigame/ps.qh create mode 100644 qcsrc/common/minigames/minigame/snake.qh create mode 100644 qcsrc/common/minigames/minigame/ttt.qh create mode 100644 qcsrc/common/monsters/monster/mage.qh create mode 100644 qcsrc/common/monsters/monster/shambler.qh create mode 100644 qcsrc/common/monsters/monster/spider.qh create mode 100644 qcsrc/common/monsters/monster/wyvern.qh create mode 100644 qcsrc/common/monsters/monster/zombie.qh delete mode 100644 qcsrc/common/mutators/all.inc delete mode 100644 qcsrc/common/mutators/all.qc delete mode 100644 qcsrc/common/mutators/all.qh create mode 100644 qcsrc/common/mutators/mutator/_all.inc create mode 100644 qcsrc/common/mutators/mutator/_all.qh delete mode 100644 qcsrc/common/mutators/mutator/bloodloss/module.inc rename qcsrc/common/mutators/mutator/bloodloss/{bloodloss.qc => sv_bloodloss.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh delete mode 100644 qcsrc/common/mutators/mutator/breakablehook/module.inc rename qcsrc/common/mutators/mutator/breakablehook/{breakablehook.qc => sv_breakablehook.qc} (96%) create mode 100644 qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh delete mode 100644 qcsrc/common/mutators/mutator/buffs/all.qc rename qcsrc/common/mutators/mutator/buffs/{all.qh => buffs.qh} (97%) rename qcsrc/common/mutators/mutator/buffs/{module.inc => cl_buffs.qc} (61%) create mode 100644 qcsrc/common/mutators/mutator/buffs/cl_buffs.qh create mode 100644 qcsrc/common/mutators/mutator/buffs/sv_buffs.qc create mode 100644 qcsrc/common/mutators/mutator/buffs/sv_buffs.qh create mode 100644 qcsrc/common/mutators/mutator/bugrigs/bugrigs.qh delete mode 100644 qcsrc/common/mutators/mutator/bugrigs/module.inc create mode 100644 qcsrc/common/mutators/mutator/campcheck/campcheck.qh delete mode 100644 qcsrc/common/mutators/mutator/campcheck/module.inc create mode 100644 qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc create mode 100644 qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qh delete mode 100644 qcsrc/common/mutators/mutator/cloaked/module.inc rename qcsrc/common/mutators/mutator/cloaked/{cloaked.qc => sv_cloaked.qc} (93%) create mode 100644 qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qh create mode 100644 qcsrc/common/mutators/mutator/damagetext/damagetext.qh delete mode 100644 qcsrc/common/mutators/mutator/damagetext/module.inc delete mode 100644 qcsrc/common/mutators/mutator/dodging/module.inc rename qcsrc/common/mutators/mutator/dodging/{dodging.qc => sv_dodging.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/dodging/sv_dodging.qh create mode 100644 qcsrc/common/mutators/mutator/doublejump/doublejump.qh delete mode 100644 qcsrc/common/mutators/mutator/doublejump/module.inc delete mode 100644 qcsrc/common/mutators/mutator/globalforces/module.inc rename qcsrc/common/mutators/mutator/globalforces/{globalforces.qc => sv_globalforces.qc} (98%) create mode 100644 qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qh delete mode 100644 qcsrc/common/mutators/mutator/hook/module.inc rename qcsrc/common/mutators/mutator/hook/{hook.qc => sv_hook.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/hook/sv_hook.qh create mode 100644 qcsrc/common/mutators/mutator/instagib/items.qh delete mode 100644 qcsrc/common/mutators/mutator/instagib/module.inc rename qcsrc/common/mutators/mutator/instagib/{instagib.qc => sv_instagib.qc} (98%) create mode 100644 qcsrc/common/mutators/mutator/instagib/sv_instagib.qh delete mode 100644 qcsrc/common/mutators/mutator/invincibleproj/module.inc rename qcsrc/common/mutators/mutator/invincibleproj/{invincibleproj.qc => sv_invincibleproj.qc} (94%) create mode 100644 qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qh create mode 100644 qcsrc/common/mutators/mutator/itemstime/_mod.inc create mode 100644 qcsrc/common/mutators/mutator/itemstime/_mod.qh rename qcsrc/common/mutators/mutator/{ => itemstime}/itemstime.qc (99%) create mode 100644 qcsrc/common/mutators/mutator/itemstime/itemstime.qh delete mode 100644 qcsrc/common/mutators/mutator/melee_only/module.inc rename qcsrc/common/mutators/mutator/melee_only/{melee_only.qc => sv_melee_only.qc} (96%) create mode 100644 qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qh delete mode 100644 qcsrc/common/mutators/mutator/midair/module.inc rename qcsrc/common/mutators/mutator/midair/{midair.qc => sv_midair.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/midair/sv_midair.qh delete mode 100644 qcsrc/common/mutators/mutator/multijump/module.inc create mode 100644 qcsrc/common/mutators/mutator/multijump/multijump.qh delete mode 100644 qcsrc/common/mutators/mutator/nades/module.inc create mode 100644 qcsrc/common/mutators/mutator/nades/net.qh delete mode 100644 qcsrc/common/mutators/mutator/new_toys/module.inc rename qcsrc/common/mutators/mutator/new_toys/{new_toys.qc => sv_new_toys.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qh delete mode 100644 qcsrc/common/mutators/mutator/nix/module.inc rename qcsrc/common/mutators/mutator/nix/{nix.qc => sv_nix.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/nix/sv_nix.qh create mode 100644 qcsrc/common/mutators/mutator/overkill/cl_overkill.qc create mode 100644 qcsrc/common/mutators/mutator/overkill/cl_overkill.qh create mode 100644 qcsrc/common/mutators/mutator/overkill/hmg.qh delete mode 100644 qcsrc/common/mutators/mutator/overkill/module.inc create mode 100644 qcsrc/common/mutators/mutator/overkill/overkill.qh create mode 100644 qcsrc/common/mutators/mutator/overkill/rpc.qh create mode 100644 qcsrc/common/mutators/mutator/overkill/sv_overkill.qc create mode 100644 qcsrc/common/mutators/mutator/overkill/sv_overkill.qh delete mode 100644 qcsrc/common/mutators/mutator/physical_items/module.inc rename qcsrc/common/mutators/mutator/physical_items/{physical_items.qc => sv_physical_items.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qh delete mode 100644 qcsrc/common/mutators/mutator/pinata/module.inc rename qcsrc/common/mutators/mutator/pinata/{pinata.qc => sv_pinata.qc} (96%) create mode 100644 qcsrc/common/mutators/mutator/pinata/sv_pinata.qh delete mode 100644 qcsrc/common/mutators/mutator/random_gravity/module.inc rename qcsrc/common/mutators/mutator/random_gravity/{random_gravity.qc => sv_random_gravity.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qh delete mode 100644 qcsrc/common/mutators/mutator/rocketflying/module.inc rename qcsrc/common/mutators/mutator/rocketflying/{rocketflying.qc => sv_rocketflying.qc} (94%) create mode 100644 qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qh delete mode 100644 qcsrc/common/mutators/mutator/rocketminsta/module.inc rename qcsrc/common/mutators/mutator/rocketminsta/{rocketminsta.qc => sv_rocketminsta.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qh delete mode 100644 qcsrc/common/mutators/mutator/running_guns/module.inc rename qcsrc/common/mutators/mutator/running_guns/{running_guns.qc => sv_running_guns.qc} (87%) create mode 100644 qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qh delete mode 100644 qcsrc/common/mutators/mutator/sandbox/module.inc rename qcsrc/common/mutators/mutator/sandbox/{sandbox.qc => sv_sandbox.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh delete mode 100644 qcsrc/common/mutators/mutator/spawn_near_teammate/module.inc rename qcsrc/common/mutators/mutator/spawn_near_teammate/{spawn_near_teammate.qc => sv_spawn_near_teammate.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qh delete mode 100644 qcsrc/common/mutators/mutator/superspec/module.inc rename qcsrc/common/mutators/mutator/superspec/{superspec.qc => sv_superspec.qc} (99%) create mode 100644 qcsrc/common/mutators/mutator/superspec/sv_superspec.qh delete mode 100644 qcsrc/common/mutators/mutator/touchexplode/module.inc rename qcsrc/common/mutators/mutator/touchexplode/{touchexplode.qc => sv_touchexplode.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qh delete mode 100644 qcsrc/common/mutators/mutator/vampire/module.inc rename qcsrc/common/mutators/mutator/vampire/{vampire.qc => sv_vampire.qc} (96%) create mode 100644 qcsrc/common/mutators/mutator/vampire/sv_vampire.qh delete mode 100644 qcsrc/common/mutators/mutator/vampirehook/module.inc rename qcsrc/common/mutators/mutator/vampirehook/{vampirehook.qc => sv_vampirehook.qc} (97%) create mode 100644 qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qh delete mode 100644 qcsrc/common/mutators/mutator/waypoints/module.inc delete mode 100644 qcsrc/common/mutators/mutator/weaponarena_random/module.inc rename qcsrc/common/mutators/mutator/weaponarena_random/{weaponarena_random.qc => sv_weaponarena_random.qc} (92%) create mode 100644 qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qh create mode 100644 qcsrc/common/physics/movetypes/follow.qh create mode 100644 qcsrc/common/physics/movetypes/step.qh create mode 100644 qcsrc/common/physics/movetypes/toss.qh create mode 100644 qcsrc/common/physics/movetypes/walk.qh create mode 100644 qcsrc/common/triggers/func/bobbing.qh create mode 100644 qcsrc/common/triggers/func/button.qh create mode 100644 qcsrc/common/triggers/func/conveyor.qh create mode 100644 qcsrc/common/triggers/func/door_rotating.qh create mode 100644 qcsrc/common/triggers/func/door_secret.qh create mode 100644 qcsrc/common/triggers/func/fourier.qh create mode 100644 qcsrc/common/triggers/func/pendulum.qh create mode 100644 qcsrc/common/triggers/func/plat.qh create mode 100644 qcsrc/common/triggers/func/pointparticles.qh create mode 100644 qcsrc/common/triggers/func/rainsnow.qh create mode 100644 qcsrc/common/triggers/func/rotating.qh create mode 100644 qcsrc/common/triggers/func/stardust.qh create mode 100644 qcsrc/common/triggers/func/vectormamamam.qh create mode 100644 qcsrc/common/triggers/misc/corner.qh create mode 100644 qcsrc/common/triggers/misc/follow.qh create mode 100644 qcsrc/common/triggers/misc/include.qh create mode 100644 qcsrc/common/triggers/misc/laser.qh create mode 100644 qcsrc/common/triggers/misc/teleport_dest.qh create mode 100644 qcsrc/common/triggers/target/changelevel.qh create mode 100644 qcsrc/common/triggers/target/location.qh create mode 100644 qcsrc/common/triggers/target/spawn.qh create mode 100644 qcsrc/common/triggers/target/speaker.qh create mode 100644 qcsrc/common/triggers/target/voicescript.qh create mode 100644 qcsrc/common/triggers/trigger/counter.qh create mode 100644 qcsrc/common/triggers/trigger/delay.qh create mode 100644 qcsrc/common/triggers/trigger/disablerelay.qh create mode 100644 qcsrc/common/triggers/trigger/flipflop.qh create mode 100644 qcsrc/common/triggers/trigger/gamestart.qh create mode 100644 qcsrc/common/triggers/trigger/gravity.qh create mode 100644 qcsrc/common/triggers/trigger/heal.qh create mode 100644 qcsrc/common/triggers/trigger/hurt.qh create mode 100644 qcsrc/common/triggers/trigger/magicear.qh create mode 100644 qcsrc/common/triggers/trigger/monoflop.qh create mode 100644 qcsrc/common/triggers/trigger/multivibrator.qh create mode 100644 qcsrc/common/triggers/trigger/relay.qh create mode 100644 qcsrc/common/triggers/trigger/relay_activators.qh create mode 100644 qcsrc/common/triggers/trigger/relay_if.qh create mode 100644 qcsrc/common/triggers/trigger/relay_teamcheck.qh create mode 100644 qcsrc/common/triggers/trigger/teleport.qh create mode 100644 qcsrc/common/turrets/checkpoint.qh create mode 100644 qcsrc/common/turrets/cl_turrets.qh create mode 100644 qcsrc/common/turrets/targettrigger.qh create mode 100644 qcsrc/common/turrets/turrets.qc create mode 100644 qcsrc/common/turrets/turrets.qh create mode 100644 qcsrc/common/vehicles/vehicles.qc create mode 100644 qcsrc/common/vehicles/vehicles.qh create mode 100644 qcsrc/common/weapons/weapon/arc.qh create mode 100644 qcsrc/common/weapons/weapon/blaster.qh create mode 100644 qcsrc/common/weapons/weapon/crylink.qh create mode 100644 qcsrc/common/weapons/weapon/devastator.qh create mode 100644 qcsrc/common/weapons/weapon/electro.qh create mode 100644 qcsrc/common/weapons/weapon/fireball.qh create mode 100644 qcsrc/common/weapons/weapon/hagar.qh create mode 100644 qcsrc/common/weapons/weapon/hlac.qh create mode 100644 qcsrc/common/weapons/weapon/hook.qh create mode 100644 qcsrc/common/weapons/weapon/machinegun.qh create mode 100644 qcsrc/common/weapons/weapon/minelayer.qh create mode 100644 qcsrc/common/weapons/weapon/mortar.qh create mode 100644 qcsrc/common/weapons/weapon/porto.qh create mode 100644 qcsrc/common/weapons/weapon/rifle.qh create mode 100644 qcsrc/common/weapons/weapon/seeker.qh create mode 100644 qcsrc/common/weapons/weapon/shockwave.qh create mode 100644 qcsrc/common/weapons/weapon/shotgun.qh create mode 100644 qcsrc/common/weapons/weapon/tuba.qh create mode 100644 qcsrc/common/weapons/weapon/vaporizer.qh create mode 100644 qcsrc/common/weapons/weapon/vortex.qh create mode 100644 qcsrc/lib/angle.qh create mode 100644 qcsrc/lib/csqcmodel/model.qc create mode 100644 qcsrc/lib/csqcmodel/model.qh create mode 100644 qcsrc/lib/csqcmodel/player.qc create mode 100644 qcsrc/lib/csqcmodel/player.qh create mode 100644 qcsrc/lib/json.qh rename qcsrc/server/{cl_client.qc => client.qc} (99%) rename qcsrc/server/{cl_client.qh => client.qh} (100%) rename qcsrc/server/{cl_impulse.qc => impulse.qc} (99%) rename qcsrc/server/{cl_impulse.qh => impulse.qh} (100%) rename qcsrc/server/{cl_player.qc => player.qc} (99%) rename qcsrc/server/{cl_player.qh => player.qh} (100%) diff --git a/qcsrc/client/commands/_mod.inc b/qcsrc/client/commands/_mod.inc index 49fd90b32..dcfc6ecea 100644 --- a/qcsrc/client/commands/_mod.inc +++ b/qcsrc/client/commands/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef CSQC + #include +#endif diff --git a/qcsrc/client/commands/_mod.qh b/qcsrc/client/commands/_mod.qh index 9e5aa9974..7829965a2 100644 --- a/qcsrc/client/commands/_mod.qh +++ b/qcsrc/client/commands/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef CSQC + #include +#endif diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 8070d0c44..86b2db13f 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/qcsrc/common/campaign_file.qh b/qcsrc/common/campaign_file.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/campaign_file.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/campaign_setup.qh b/qcsrc/common/campaign_setup.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/campaign_setup.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/effects/effectinfo.qh b/qcsrc/common/effects/effectinfo.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/effects/effectinfo.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/effects/qc/casings.qh b/qcsrc/common/effects/qc/casings.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/effects/qc/casings.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/effects/qc/damageeffects.qh b/qcsrc/common/effects/qc/damageeffects.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/effects/qc/damageeffects.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/effects/qc/globalsound.qc b/qcsrc/common/effects/qc/globalsound.qc index 573b52f22..d60b2e8a6 100644 --- a/qcsrc/common/effects/qc/globalsound.qc +++ b/qcsrc/common/effects/qc/globalsound.qc @@ -6,7 +6,7 @@ #include #ifdef SVQC - #include + #include #endif REGISTER_NET_TEMP(globalsound) diff --git a/qcsrc/common/gamemodes/_all.inc b/qcsrc/common/gamemodes/_all.inc index 8bc63f720..21f512ae2 100644 --- a/qcsrc/common/gamemodes/_all.inc +++ b/qcsrc/common/gamemodes/_all.inc @@ -1,2 +1,4 @@ #include "_all.qh" #include "_mod.inc" + +#include "gamemode/_all.inc" diff --git a/qcsrc/common/gamemodes/_all.qh b/qcsrc/common/gamemodes/_all.qh index 947026dd5..8aed6ca80 100644 --- a/qcsrc/common/gamemodes/_all.qh +++ b/qcsrc/common/gamemodes/_all.qh @@ -1,2 +1,4 @@ #pragma once #include "_mod.qh" + +#include "gamemode/_all.qh" diff --git a/qcsrc/common/gamemodes/_mod.inc b/qcsrc/common/gamemodes/_mod.inc index 0b779498b..98fb4815c 100644 --- a/qcsrc/common/gamemodes/_mod.inc +++ b/qcsrc/common/gamemodes/_mod.inc @@ -1,2 +1 @@ // generated file; do not modify -#include diff --git a/qcsrc/common/gamemodes/_mod.qh b/qcsrc/common/gamemodes/_mod.qh index a7b7a54af..98fb4815c 100644 --- a/qcsrc/common/gamemodes/_mod.qh +++ b/qcsrc/common/gamemodes/_mod.qh @@ -1,2 +1 @@ // generated file; do not modify -#include diff --git a/qcsrc/common/gamemodes/all.inc b/qcsrc/common/gamemodes/all.inc deleted file mode 100644 index bcdcd7c4c..000000000 --- a/qcsrc/common/gamemodes/all.inc +++ /dev/null @@ -1,2 +0,0 @@ -#include "gamemode/nexball/module.inc" -#include "gamemode/onslaught/module.inc" diff --git a/qcsrc/common/gamemodes/all.qc b/qcsrc/common/gamemodes/all.qc deleted file mode 100644 index f0fc7195a..000000000 --- a/qcsrc/common/gamemodes/all.qc +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.qh" - -#define IMPLEMENTATION -#include "all.inc" -#undef IMPLEMENTATION diff --git a/qcsrc/common/gamemodes/all.qh b/qcsrc/common/gamemodes/all.qh deleted file mode 100644 index 62ba61696..000000000 --- a/qcsrc/common/gamemodes/all.qh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GAMEMODES_ALL_H -#define GAMEMODES_ALL_H - -#include "all.inc" - -#endif diff --git a/qcsrc/common/gamemodes/gamemode/_all.inc b/qcsrc/common/gamemodes/gamemode/_all.inc new file mode 100644 index 000000000..7c51f951b --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/_all.inc @@ -0,0 +1,5 @@ +#include "_all.qh" +#include "_mod.inc" + +#include "nexball/_mod.inc" +#include "onslaught/_mod.inc" diff --git a/qcsrc/common/gamemodes/gamemode/_all.qh b/qcsrc/common/gamemodes/gamemode/_all.qh new file mode 100644 index 000000000..dd16f04dd --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/_all.qh @@ -0,0 +1,5 @@ +#pragma once +#include "_mod.qh" + +#include "nexball/_mod.qh" +#include "onslaught/_mod.qh" diff --git a/qcsrc/common/gamemodes/gamemode/nexball/module.inc b/qcsrc/common/gamemodes/gamemode/nexball/module.inc deleted file mode 100644 index 0d809629d..000000000 --- a/qcsrc/common/gamemodes/gamemode/nexball/module.inc +++ /dev/null @@ -1,2 +0,0 @@ -#include "nexball.qc" -#include "weapon.qc" diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 0f0ecb471..9c6c9f080 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -1,6 +1,5 @@ #include "nexball.qh" -#ifdef IMPLEMENTATION #ifdef CSQC int autocvar_cl_eventchase_nexball = 1; @@ -1157,4 +1156,3 @@ REGISTER_MUTATOR(nb, g_nexball) } #endif -#endif diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh index 9dd8042be..53797d2bc 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh @@ -1,5 +1,4 @@ -#ifndef GAMEMODE_NEXBALL_H -#define GAMEMODE_NEXBALL_H +#pragma once #ifdef SVQC //EF_BRIGHTFIELD|EF_BRIGHTLIGHT|EF_DIMLIGHT|EF_BLUE|EF_RED|EF_FLAME @@ -35,4 +34,3 @@ float nb_teams; .float teamtime; #endif -#endif diff --git a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qc b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qc index c6aa4be21..f20726353 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qc @@ -1,12 +1 @@ -#ifndef GAMEMODE_NEXBALL_WEAPON_H -#define GAMEMODE_NEXBALL_WEAPON_H - -CLASS(BallStealer, PortoLaunch) -/* flags */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED); -/* impulse */ ATTRIB(BallStealer, impulse, int, 0); -/* refname */ ATTRIB(BallStealer, netname, string, "ballstealer"); -/* wepname */ ATTRIB(BallStealer, m_name, string, _("Ball Stealer")); -ENDCLASS(BallStealer) -REGISTER_WEAPON(NEXBALL, NEW(BallStealer)); - -#endif +#include "weapon.qh" diff --git a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh new file mode 100644 index 000000000..73b887260 --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh @@ -0,0 +1,9 @@ +#pragma once + +CLASS(BallStealer, PortoLaunch) +/* flags */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED); +/* impulse */ ATTRIB(BallStealer, impulse, int, 0); +/* refname */ ATTRIB(BallStealer, netname, string, "ballstealer"); +/* wepname */ ATTRIB(BallStealer, m_name, string, _("Ball Stealer")); +ENDCLASS(BallStealer) +REGISTER_WEAPON(NEXBALL, NEW(BallStealer)); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc b/qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc index 334eb561e..ca8c83c19 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/_mod.inc @@ -1,6 +1,19 @@ // generated file; do not modify -#include -#include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif #include -#include -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/_mod.qh b/qcsrc/common/gamemodes/gamemode/onslaught/_mod.qh index e89549558..bb95416b3 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/_mod.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/_mod.qh @@ -1,6 +1,19 @@ // generated file; do not modify -#include -#include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif #include -#include -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qh b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qh index 15586ea5d..d5437338e 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qh @@ -1,10 +1,7 @@ -#ifndef CLIENT_CONTROLPOINT_H -#define CLIENT_CONTROLPOINT_H +#pragma once const vector CPICON_MIN = '-32 -32 -9'; const vector CPICON_MAX = '32 32 25'; const int CPSF_STATUS = 4; const int CPSF_SETUP = 8; - -#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qh b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qh index 3c0cf2869..49524687f 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qh @@ -1,9 +1,7 @@ -#ifndef CLIENT_GENERATOR_H -#define CLIENT_GENERATOR_H +#pragma once + const vector GENERATOR_MIN = '-52 -52 -14'; const vector GENERATOR_MAX = '52 52 75'; const int GSF_STATUS = 4; const int GSF_SETUP = 8; - -#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc new file mode 100644 index 000000000..b21f5fd22 --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qc @@ -0,0 +1 @@ +#include "controlpoint.qh" diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh b/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/controlpoint.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/generator.qc new file mode 100644 index 000000000..f9415f619 --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/generator.qc @@ -0,0 +1 @@ +#include "generator.qh" diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/generator.qh b/qcsrc/common/gamemodes/gamemode/onslaught/generator.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/generator.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/module.inc b/qcsrc/common/gamemodes/gamemode/onslaught/module.inc deleted file mode 100644 index fee33b14e..000000000 --- a/qcsrc/common/gamemodes/gamemode/onslaught/module.inc +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ONS_CONSTANTS - #define ONS_CONSTANTS - REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR) - REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON) -#endif - -#if defined(SVQC) - #include "onslaught.qc" - #ifndef IMPLEMENTATION - #include "sv_controlpoint.qh" - #include "sv_generator.qh" - #else - #include "sv_controlpoint.qc" - #include "sv_generator.qc" - #endif -#elif defined(CSQC) - #ifndef IMPLEMENTATION - #include "cl_controlpoint.qh" - #include "cl_generator.qh" - #else - #include "cl_controlpoint.qc" - #include "cl_generator.qc" - #endif -#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index 713c5d7de..36926b754 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -1,2258 +1 @@ -#ifndef GAMEMODE_ONSLAUGHT_H -#define GAMEMODE_ONSLAUGHT_H - -float autocvar_g_onslaught_point_limit; -void ons_Initialize(); - -REGISTER_MUTATOR(ons, false) -{ - MUTATOR_ONADD - { - if (time > 1) // game loads at time 1 - error("This is a game type and it cannot be added at runtime."); - ons_Initialize(); - - ActivateTeamplay(); - SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1); - have_team_spawns = -1; // request team spawns - } - - MUTATOR_ONROLLBACK_OR_REMOVE - { - // we actually cannot roll back ons_Initialize here - // BUT: we don't need to! If this gets called, adding always - // succeeds. - } - - MUTATOR_ONREMOVE - { - LOG_INFO("This is a game type and it cannot be removed at runtime."); - return -1; - } - - return false; -} - -#ifdef SVQC - -.entity ons_toucher; // player who touched the control point - -// control point / generator constants -const float ONS_CP_THINKRATE = 0.2; -const float GEN_THINKRATE = 1; -#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13)) -const vector CPGEN_WAYPOINT_OFFSET = ('0 0 128'); -const vector CPICON_OFFSET = ('0 0 96'); - -// list of generators on the map -entity ons_worldgeneratorlist; -.entity ons_worldgeneratornext; -.entity ons_stalegeneratornext; - -// list of control points on the map -entity ons_worldcplist; -.entity ons_worldcpnext; -.entity ons_stalecpnext; - -// list of links on the map -entity ons_worldlinklist; -.entity ons_worldlinknext; -.entity ons_stalelinknext; - -// definitions -.entity sprite; -.string target2; -.int iscaptured; -.int islinked; -.int isshielded; -.float lasthealth; -.int lastteam; -.int lastshielded; -.int lastcaptured; - -.bool waslinked; - -bool ons_stalemate; - -.float teleport_antispam; - -.bool ons_roundlost = _STAT(ROUNDLOST); - -// waypoint sprites -.entity bot_basewaypoint; // generator waypointsprite - -.bool isgenneighbor[17]; -.bool iscpneighbor[17]; -float ons_notification_time[17]; - -.float ons_overtime_damagedelay; - -.vector ons_deathloc; - -.entity ons_spawn_by; - -// declarations for functions used outside gamemode_onslaught.qc -void ons_Generator_UpdateSprite(entity e); -void ons_ControlPoint_UpdateSprite(entity e); -bool ons_ControlPoint_Attackable(entity cp, int teamnumber); - -// CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet -float ons_captureshield_force; // push force of the shield - -// bot player logic -const int HAVOCBOT_ONS_ROLE_NONE = 0; -const int HAVOCBOT_ONS_ROLE_DEFENSE = 2; -const int HAVOCBOT_ONS_ROLE_ASSISTANT = 4; -const int HAVOCBOT_ONS_ROLE_OFFENSE = 8; - -.entity havocbot_ons_target; - -.int havocbot_role_flags; -.float havocbot_attack_time; - -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 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; - -#endif -#endif - -#ifdef IMPLEMENTATION - -#include "sv_controlpoint.qh" -#include "sv_generator.qh" - -bool g_onslaught; - -float autocvar_g_onslaught_teleport_wait; -bool autocvar_g_onslaught_spawn_at_controlpoints; -bool autocvar_g_onslaught_spawn_at_generator; -float autocvar_g_onslaught_cp_proxydecap; -float autocvar_g_onslaught_cp_proxydecap_distance = 512; -float autocvar_g_onslaught_cp_proxydecap_dps = 100; -float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5; -float autocvar_g_onslaught_spawn_at_controlpoints_random; -float autocvar_g_onslaught_spawn_at_generator_chance; -float autocvar_g_onslaught_spawn_at_generator_random; -float autocvar_g_onslaught_cp_buildhealth; -float autocvar_g_onslaught_cp_buildtime; -float autocvar_g_onslaught_cp_health; -float autocvar_g_onslaught_cp_regen; -float autocvar_g_onslaught_gen_health; -float autocvar_g_onslaught_shield_force = 100; -float autocvar_g_onslaught_allow_vehicle_touch; -float autocvar_g_onslaught_round_timelimit; -float autocvar_g_onslaught_warmup; -float autocvar_g_onslaught_teleport_radius; -float autocvar_g_onslaught_spawn_choose; -float autocvar_g_onslaught_click_radius; - -void FixSize(entity e); - -// ======================= -// CaptureShield Functions -// ======================= - -bool ons_CaptureShield_Customize(entity this, entity client) -{ - entity e = WaypointSprite_getviewentity(client); - - if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; } - if(SAME_TEAM(this, e)) { return false; } - - return true; -} - -void ons_CaptureShield_Touch(entity this, entity toucher) -{ - if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; } - if(!IS_PLAYER(toucher)) { return; } - if(SAME_TEAM(toucher, this)) { return; } - - vector mymid = (this.absmin + this.absmax) * 0.5; - vector theirmid = (toucher.absmin + toucher.absmax) * 0.5; - - Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force); - - if(IS_REAL_CLIENT(toucher)) - { - play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); - - if(this.enemy.classname == "onslaught_generator") - Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); - else - Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED); - } -} - -void ons_CaptureShield_Reset(entity this) -{ - this.colormap = this.enemy.colormap; - this.team = this.enemy.team; -} - -void ons_CaptureShield_Spawn(entity generator, bool is_generator) -{ - entity shield = new(ons_captureshield); - - shield.enemy = generator; - shield.team = generator.team; - shield.colormap = generator.colormap; - shield.reset = ons_CaptureShield_Reset; - settouch(shield, ons_CaptureShield_Touch); - setcefc(shield, ons_CaptureShield_Customize); - shield.effects = EF_ADDITIVE; - set_movetype(shield, MOVETYPE_NOCLIP); - shield.solid = SOLID_TRIGGER; - shield.avelocity = '7 0 11'; - shield.scale = 1; - shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3"); - - precache_model(shield.model); - setorigin(shield, generator.origin); - _setmodel(shield, shield.model); - setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs); -} - - -// ========== -// Junk Pile -// ========== - -void setmodel_fixsize(entity e, Model m) -{ - setmodel(e, m); - FixSize(e); -} - -void onslaught_updatelinks() -{ - entity l; - // first check if the game has ended - LOG_DEBUG("--- updatelinks ---"); - // mark generators as being shielded and networked - for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) - { - if (l.iscaptured) - LOG_DEBUG(etos(l), " (generator) belongs to team ", ftos(l.team)); - else - LOG_DEBUG(etos(l), " (generator) is destroyed"); - l.islinked = l.iscaptured; - l.isshielded = l.iscaptured; - l.sprite.SendFlags |= 16; - } - // mark points as shielded and not networked - for(l = ons_worldcplist; l; l = l.ons_worldcpnext) - { - l.islinked = false; - l.isshielded = true; - int i; - for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; } - LOG_DEBUG(etos(l), " (point) belongs to team ", ftos(l.team)); - l.sprite.SendFlags |= 16; - } - // flow power outward from the generators through the network - bool stop = false; - while (!stop) - { - stop = true; - for(l = ons_worldlinklist; l; l = l.ons_worldlinknext) - { - // if both points are captured by the same team, and only one of - // them is powered, mark the other one as powered as well - if (l.enemy.iscaptured && l.goalentity.iscaptured) - if (l.enemy.islinked != l.goalentity.islinked) - if(SAME_TEAM(l.enemy, l.goalentity)) - { - if (!l.goalentity.islinked) - { - stop = false; - l.goalentity.islinked = true; - LOG_DEBUG(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)"); - } - else if (!l.enemy.islinked) - { - stop = false; - l.enemy.islinked = true; - LOG_DEBUG(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)"); - } - } - } - } - // now that we know which points are powered we can mark their neighbors - // as unshielded if team differs - for(l = ons_worldlinklist; l; l = l.ons_worldlinknext) - { - if (l.goalentity.islinked) - { - if(DIFF_TEAM(l.goalentity, l.enemy)) - { - LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)"); - l.enemy.isshielded = false; - } - if(l.goalentity.classname == "onslaught_generator") - l.enemy.isgenneighbor[l.goalentity.team] = true; - else - l.enemy.iscpneighbor[l.goalentity.team] = true; - } - if (l.enemy.islinked) - { - if(DIFF_TEAM(l.goalentity, l.enemy)) - { - LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)"); - l.goalentity.isshielded = false; - } - if(l.enemy.classname == "onslaught_generator") - l.goalentity.isgenneighbor[l.enemy.team] = true; - else - l.goalentity.iscpneighbor[l.enemy.team] = true; - } - } - // now update the generators - for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) - { - if (l.isshielded) - { - LOG_DEBUG(etos(l), " (generator) is shielded"); - l.takedamage = DAMAGE_NO; - l.bot_attack = false; - } - else - { - LOG_DEBUG(etos(l), " (generator) is not shielded"); - l.takedamage = DAMAGE_AIM; - l.bot_attack = true; - } - - ons_Generator_UpdateSprite(l); - } - // now update the takedamage and alpha variables on control point icons - for(l = ons_worldcplist; l; l = l.ons_worldcpnext) - { - if (l.isshielded) - { - LOG_DEBUG(etos(l), " (point) is shielded"); - if (l.goalentity) - { - l.goalentity.takedamage = DAMAGE_NO; - l.goalentity.bot_attack = false; - } - } - else - { - LOG_DEBUG(etos(l), " (point) is not shielded"); - if (l.goalentity) - { - l.goalentity.takedamage = DAMAGE_AIM; - l.goalentity.bot_attack = true; - } - } - ons_ControlPoint_UpdateSprite(l); - } - FOREACH_ENTITY_CLASS("ons_captureshield", true, - { - it.team = it.enemy.team; - it.colormap = it.enemy.colormap; - }); -} - - -// =================== -// Main Link Functions -// =================== - -bool ons_Link_Send(entity this, entity to, int sendflags) -{ - WriteHeader(MSG_ENTITY, ENT_CLIENT_RADARLINK); - WriteByte(MSG_ENTITY, sendflags); - if(sendflags & 1) - { - WriteCoord(MSG_ENTITY, this.goalentity.origin_x); - WriteCoord(MSG_ENTITY, this.goalentity.origin_y); - WriteCoord(MSG_ENTITY, this.goalentity.origin_z); - } - if(sendflags & 2) - { - WriteCoord(MSG_ENTITY, this.enemy.origin_x); - WriteCoord(MSG_ENTITY, this.enemy.origin_y); - WriteCoord(MSG_ENTITY, this.enemy.origin_z); - } - if(sendflags & 4) - { - WriteByte(MSG_ENTITY, this.clientcolors); // which is goalentity's color + enemy's color * 16 - } - return true; -} - -void ons_Link_CheckUpdate(entity this) -{ - // TODO check if the two sides have moved (currently they won't move anyway) - float cc = 0, cc1 = 0, cc2 = 0; - - if(this.goalentity.islinked || this.goalentity.iscaptured) { cc1 = (this.goalentity.team - 1) * 0x01; } - if(this.enemy.islinked || this.enemy.iscaptured) { cc2 = (this.enemy.team - 1) * 0x10; } - - cc = cc1 + cc2; - - if(cc != this.clientcolors) - { - this.clientcolors = cc; - this.SendFlags |= 4; - } - - this.nextthink = time; -} - -void ons_DelayedLinkSetup(entity this) -{ - this.goalentity = find(NULL, targetname, this.target); - this.enemy = find(NULL, targetname, this.target2); - if(!this.goalentity) { objerror(this, "can not find target\n"); } - if(!this.enemy) { objerror(this, "can not find target2\n"); } - - LOG_DEBUG(etos(this.goalentity), " linked with ", etos(this.enemy)); - this.SendFlags |= 3; - setthink(this, ons_Link_CheckUpdate); - this.nextthink = time; -} - - -// ============================= -// Main Control Point Functions -// ============================= - -int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber) -{ - if(cp.isgenneighbor[teamnumber]) { return 2; } - if(cp.iscpneighbor[teamnumber]) { return 1; } - - return 0; -} - -int ons_ControlPoint_Attackable(entity cp, int teamnumber) - // -2: SAME TEAM, attackable by enemy! - // -1: SAME TEAM! - // 0: off limits - // 1: attack it - // 2: touch it - // 3: attack it (HIGH PRIO) - // 4: touch it (HIGH PRIO) -{ - int a; - - if(cp.isshielded) - { - return 0; - } - else if(cp.goalentity) - { - // if there's already an icon built, nothing happens - if(cp.team == teamnumber) - { - a = ons_ControlPoint_CanBeLinked(cp, teamnumber); - if(a) // attackable by enemy? - return -2; // EMERGENCY! - return -1; - } - // we know it can be linked, so no need to check - // but... - a = ons_ControlPoint_CanBeLinked(cp, teamnumber); - if(a == 2) // near our generator? - return 3; // EMERGENCY! - return 1; - } - else - { - // free point - if(ons_ControlPoint_CanBeLinked(cp, teamnumber)) - { - a = ons_ControlPoint_CanBeLinked(cp, teamnumber); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t - if(a == 2) - return 4; // GET THIS ONE NOW! - else - return 2; // TOUCH ME - } - } - return 0; -} - -void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ - if(damage <= 0) { return; } - - if (this.owner.isshielded) - { - // this is protected by a shield, so ignore the damage - if (time > this.pain_finished) - if (IS_PLAYER(attacker)) - { - play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); - this.pain_finished = time + 1; - attacker.typehitsound += 1; // play both sounds (shield is way too quiet) - } - - return; - } - - if(IS_PLAYER(attacker)) - if(time - ons_notification_time[this.team] > 10) - { - play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK)); - ons_notification_time[this.team] = time; - } - - this.health = this.health - damage; - if(this.owner.iscaptured) - WaypointSprite_UpdateHealth(this.owner.sprite, this.health); - else - WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE)); - this.pain_finished = time + 1; - // particles on every hit - pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1); - //sound on every hit - if (random() < 0.5) - sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM); - else - sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM); - - if (this.health < 0) - { - sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); - pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname); - - PlayerScore_Add(attacker, SP_ONS_TAKES, 1); - PlayerScore_Add(attacker, SP_SCORE, 10); - - this.owner.goalentity = NULL; - this.owner.islinked = false; - this.owner.iscaptured = false; - this.owner.team = 0; - this.owner.colormap = 1024; - - WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0); - - onslaught_updatelinks(); - - // Use targets now (somebody make sure this is in the right place..) - SUB_UseTargets(this.owner, this, NULL); - - this.owner.waslinked = this.owner.islinked; - if(this.owner.model != "models/onslaught/controlpoint_pad.md3") - setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1); - //setsize(this, '-32 -32 0', '32 32 8'); - - delete(this); - } - - this.SendFlags |= CPSF_STATUS; -} - -void ons_ControlPoint_Icon_Think(entity this) -{ - this.nextthink = time + ONS_CP_THINKRATE; - - if(autocvar_g_onslaught_cp_proxydecap) - { - int _enemy_count = 0; - int _friendly_count = 0; - - FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), { - if(vdist(it.origin - this.origin, <, autocvar_g_onslaught_cp_proxydecap_distance)) - { - if(SAME_TEAM(it, this)) - ++_friendly_count; - else - ++_enemy_count; - } - }); - - _friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE); - _enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE); - - this.health = bound(0, this.health + (_friendly_count - _enemy_count), this.max_health); - this.SendFlags |= CPSF_STATUS; - if(this.health <= 0) - { - ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, this.origin, '0 0 0'); - return; - } - } - - if (time > this.pain_finished + 5) - { - if(this.health < this.max_health) - { - this.health = this.health + this.count; - if (this.health >= this.max_health) - this.health = this.max_health; - WaypointSprite_UpdateHealth(this.owner.sprite, this.health); - } - } - - if(this.owner.islinked != this.owner.waslinked) - { - // unteam the spawnpoint if needed - int t = this.owner.team; - if(!this.owner.islinked) - this.owner.team = 0; - - SUB_UseTargets(this.owner, this, NULL); - - this.owner.team = t; - - this.owner.waslinked = this.owner.islinked; - } - - // damaged fx - if(random() < 0.6 - this.health / this.max_health) - { - Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1); - - if(random() > 0.8) - sound(this, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM); - else if (random() > 0.5) - sound(this, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM); - } -} - -void ons_ControlPoint_Icon_BuildThink(entity this) -{ - int a; - - this.nextthink = time + ONS_CP_THINKRATE; - - // only do this if there is power - a = ons_ControlPoint_CanBeLinked(this.owner, this.owner.team); - if(!a) - return; - - this.health = this.health + this.count; - - this.SendFlags |= CPSF_STATUS; - - if (this.health >= this.max_health) - { - this.health = this.max_health; - this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on - setthink(this, ons_ControlPoint_Icon_Think); - sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM); - this.owner.iscaptured = true; - this.solid = SOLID_BBOX; - - Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1); - - WaypointSprite_UpdateMaxHealth(this.owner.sprite, this.max_health); - WaypointSprite_UpdateHealth(this.owner.sprite, this.health); - - if(IS_PLAYER(this.owner.ons_toucher)) - { - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message); - Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE), this.owner.message); - Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message); - PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1); - PlayerTeamScore_AddScore(this.owner.ons_toucher, 10); - } - - this.owner.ons_toucher = NULL; - - onslaught_updatelinks(); - - // Use targets now (somebody make sure this is in the right place..) - SUB_UseTargets(this.owner, this, NULL); - - this.SendFlags |= CPSF_SETUP; - } - if(this.owner.model != MDL_ONS_CP_PAD2.model_str()) - setmodel_fixsize(this.owner, MDL_ONS_CP_PAD2); - - if(random() < 0.9 - this.health / this.max_health) - Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1); -} - -void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc); - -void ons_ControlPoint_Icon_Spawn(entity cp, entity player) -{ - entity e = new(onslaught_controlpoint_icon); - - setsize(e, CPICON_MIN, CPICON_MAX); - setorigin(e, cp.origin + CPICON_OFFSET); - - e.owner = cp; - e.max_health = autocvar_g_onslaught_cp_health; - e.health = autocvar_g_onslaught_cp_buildhealth; - e.solid = SOLID_NOT; - e.takedamage = DAMAGE_AIM; - e.bot_attack = true; - e.event_damage = ons_ControlPoint_Icon_Damage; - e.team = player.team; - e.colormap = 1024 + (e.team - 1) * 17; - e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build - - sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM); - - cp.goalentity = e; - cp.team = e.team; - cp.colormap = e.colormap; - - Send_Effect(EFFECT_FLAG_TOUCH(player.team), e.origin, '0 0 0', 1); - - WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - e.health) / (e.count / ONS_CP_THINKRATE)); - WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY); - cp.sprite.SendFlags |= 16; - - onslaught_controlpoint_icon_link(e, ons_ControlPoint_Icon_BuildThink); -} - -entity ons_ControlPoint_Waypoint(entity e) -{ - if(e.team) - { - int a = ons_ControlPoint_Attackable(e, e.team); - - if(a == -2) { return WP_OnsCPDefend; } // defend now - if(a == -1 || a == 1 || a == 2) { return WP_OnsCP; } // touch - if(a == 3 || a == 4) { return WP_OnsCPAttack; } // attack - } - else - return WP_OnsCP; - - return WP_Null; -} - -void ons_ControlPoint_UpdateSprite(entity e) -{ - entity s1 = ons_ControlPoint_Waypoint(e); - WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1); - - bool sh; - sh = !(ons_ControlPoint_CanBeLinked(e, NUM_TEAM_1) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_2) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_3) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_4)); - - if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured) - { - if(e.iscaptured) // don't mess up build bars! - { - if(sh) - { - WaypointSprite_UpdateMaxHealth(e.sprite, 0); - } - else - { - WaypointSprite_UpdateMaxHealth(e.sprite, e.goalentity.max_health); - WaypointSprite_UpdateHealth(e.sprite, e.goalentity.health); - } - } - if(e.lastshielded) - { - if(e.team) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false)); - else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5'); - } - else - { - if(e.team) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false)); - else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75'); - } - WaypointSprite_Ping(e.sprite); - - e.lastteam = e.team + 2; - e.lastshielded = sh; - e.lastcaptured = e.iscaptured; - } -} - -void ons_ControlPoint_Touch(entity this, entity toucher) -{ - int attackable; - - if(IS_VEHICLE(toucher) && toucher.owner) - if(autocvar_g_onslaught_allow_vehicle_touch) - toucher = toucher.owner; - else - return; - - if(!IS_PLAYER(toucher)) { return; } - if(STAT(FROZEN, toucher)) { return; } - if(IS_DEAD(toucher)) { return; } - - if ( SAME_TEAM(this,toucher) ) - if ( this.iscaptured ) - { - if(time <= toucher.teleport_antispam) - Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT_ANTISPAM, rint(toucher.teleport_antispam - time)); - else - Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT); - } - - attackable = ons_ControlPoint_Attackable(this, toucher.team); - if(attackable != 2 && attackable != 4) - return; - // we've verified that this player has a legitimate claim to this point, - // so start building the captured point icon (which only captures this - // point if it successfully builds without being destroyed first) - ons_ControlPoint_Icon_Spawn(this, toucher); - - this.ons_toucher = toucher; - - onslaught_updatelinks(); -} - -void ons_ControlPoint_Think(entity this) -{ - this.nextthink = time + ONS_CP_THINKRATE; - CSQCMODEL_AUTOUPDATE(this); -} - -void ons_ControlPoint_Reset(entity this) -{ - if(this.goalentity) - delete(this.goalentity); - - this.goalentity = NULL; - this.team = 0; - this.colormap = 1024; - this.iscaptured = false; - this.islinked = false; - this.isshielded = true; - setthink(this, ons_ControlPoint_Think); - this.ons_toucher = NULL; - this.nextthink = time + ONS_CP_THINKRATE; - setmodel_fixsize(this, MDL_ONS_CP_PAD1); - - WaypointSprite_UpdateMaxHealth(this.sprite, 0); - WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY); - - onslaught_updatelinks(); - - SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc. - - CSQCMODEL_AUTOUPDATE(this); -} - -void ons_DelayedControlPoint_Setup(entity this) -{ - onslaught_updatelinks(); - - // captureshield setup - ons_CaptureShield_Spawn(this, false); - - CSQCMODEL_AUTOINIT(this); -} - -void ons_ControlPoint_Setup(entity cp) -{ - // main setup - cp.ons_worldcpnext = ons_worldcplist; // link control point into ons_worldcplist - ons_worldcplist = cp; - - cp.netname = "Control point"; - cp.team = 0; - cp.solid = SOLID_BBOX; - set_movetype(cp, MOVETYPE_NONE); - settouch(cp, ons_ControlPoint_Touch); - setthink(cp, ons_ControlPoint_Think); - cp.nextthink = time + ONS_CP_THINKRATE; - cp.reset = ons_ControlPoint_Reset; - cp.colormap = 1024; - cp.iscaptured = false; - cp.islinked = false; - cp.isshielded = true; - - if(cp.message == "") { cp.message = "a"; } - - // appearence - setmodel_fixsize(cp, MDL_ONS_CP_PAD1); - - // control point placement - if((cp.spawnflags & 1) || cp.noalign) // don't drop to floor, just stay at fixed location - { - cp.noalign = true; - set_movetype(cp, MOVETYPE_NONE); - } - else // drop to floor, automatically find a platform and set that as spawn origin - { - setorigin(cp, cp.origin + '0 0 20'); - cp.noalign = false; - droptofloor(cp); - set_movetype(cp, MOVETYPE_TOSS); - } - - // waypointsprites - WaypointSprite_SpawnFixed(WP_Null, cp.origin + CPGEN_WAYPOINT_OFFSET, cp, sprite, RADARICON_NONE); - WaypointSprite_UpdateRule(cp.sprite, cp.team, SPRITERULE_TEAMPLAY); - - InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION); -} - - -// ========================= -// Main Generator Functions -// ========================= - -entity ons_Generator_Waypoint(entity e) -{ - if (e.isshielded) - return WP_OnsGenShielded; - return WP_OnsGen; -} - -void ons_Generator_UpdateSprite(entity e) -{ - entity s1 = ons_Generator_Waypoint(e); - WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1); - - if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded) - { - e.lastteam = e.team + 2; - e.lastshielded = e.isshielded; - if(e.lastshielded) - { - if(e.team) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false)); - else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5'); - } - else - { - if(e.team) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false)); - else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75'); - } - WaypointSprite_Ping(e.sprite); - } -} - -void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ - if(damage <= 0) { return; } - if(warmup_stage || gameover) { return; } - if(!round_handler_IsRoundStarted()) { return; } - - if (attacker != this) - { - if (this.isshielded) - { - // this is protected by a shield, so ignore the damage - if (time > this.pain_finished) - if (IS_PLAYER(attacker)) - { - play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); - attacker.typehitsound += 1; - this.pain_finished = time + 1; - } - return; - } - if (time > this.pain_finished) - { - this.pain_finished = time + 10; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK)); - play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK)); - } - } - this.health = this.health - damage; - WaypointSprite_UpdateHealth(this.sprite, this.health); - // choose an animation frame based on health - this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1); - // see if the generator is still functional, or dying - if (this.health > 0) - { - this.lasthealth = this.health; - } - else - { - if (attacker == this) - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME)); - else - { - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED)); - PlayerScore_Add(attacker, SP_SCORE, 100); - } - this.iscaptured = false; - this.islinked = false; - this.isshielded = false; - this.takedamage = DAMAGE_NO; // can't be hurt anymore - this.event_damage = func_null; // won't do anything if hurt - this.count = 0; // reset counter - setthink(this, func_null); - this.nextthink = 0; - //this.think(); // do the first explosion now - - WaypointSprite_UpdateMaxHealth(this.sprite, 0); - WaypointSprite_Ping(this.sprite); - //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor - - onslaught_updatelinks(); - } - - // Throw some flaming gibs on damage, more damage = more chance for gib - if(random() < damage/220) - { - sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - } - else - { - // particles on every hit - Send_Effect(EFFECT_SPARKS, hitloc, force * -1, 1); - - //sound on every hit - if (random() < 0.5) - sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM); - else - sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM); - } - - this.SendFlags |= GSF_STATUS; -} - -void ons_GeneratorThink(entity this) -{ - this.nextthink = time + GEN_THINKRATE; - if (!gameover) - { - if(!this.isshielded && this.wait < time) - { - this.wait = time + 5; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { - if(SAME_TEAM(it, this)) - { - Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM); - soundto(MSG_ONE, it, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE); // FIXME: unique sound? - } - else - Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_ONS_NOTSHIELDED)); - }); - } - } -} - -void ons_GeneratorReset(entity this) -{ - this.team = this.team_saved; - this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health; - this.takedamage = DAMAGE_AIM; - this.bot_attack = true; - this.iscaptured = true; - this.islinked = true; - this.isshielded = true; - this.event_damage = ons_GeneratorDamage; - setthink(this, ons_GeneratorThink); - this.nextthink = time + GEN_THINKRATE; - - Net_LinkEntity(this, false, 0, generator_send); - - this.SendFlags = GSF_SETUP; // just incase - this.SendFlags |= GSF_STATUS; - - WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health); - WaypointSprite_UpdateHealth(this.sprite, this.health); - WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY); - - onslaught_updatelinks(); -} - -void ons_DelayedGeneratorSetup(entity this) -{ - // bot waypoints - waypoint_spawnforitem_force(this, this.origin); - this.nearestwaypointtimeout = 0; // activate waypointing again - this.bot_basewaypoint = this.nearestwaypoint; - - // captureshield setup - ons_CaptureShield_Spawn(this, true); - - onslaught_updatelinks(); - - Net_LinkEntity(this, false, 0, generator_send); -} - - -void onslaught_generator_touch(entity this, entity toucher) -{ - if ( IS_PLAYER(toucher) ) - if ( SAME_TEAM(this,toucher) ) - if ( this.iscaptured ) - { - Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT); - } -} - -void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc -{ - // declarations - int teamnumber = gen.team; - - // main setup - gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist - ons_worldgeneratorlist = gen; - - gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber)); - gen.classname = "onslaught_generator"; - gen.solid = SOLID_BBOX; - gen.team_saved = teamnumber; - set_movetype(gen, MOVETYPE_NONE); - gen.lasthealth = gen.max_health = gen.health = autocvar_g_onslaught_gen_health; - gen.takedamage = DAMAGE_AIM; - gen.bot_attack = true; - gen.event_damage = ons_GeneratorDamage; - gen.reset = ons_GeneratorReset; - setthink(gen, ons_GeneratorThink); - gen.nextthink = time + GEN_THINKRATE; - gen.iscaptured = true; - gen.islinked = true; - gen.isshielded = true; - settouch(gen, onslaught_generator_touch); - - // appearence - // model handled by CSQC - setsize(gen, GENERATOR_MIN, GENERATOR_MAX); - setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET)); - gen.colormap = 1024 + (teamnumber - 1) * 17; - - // generator placement - droptofloor(gen); - - // waypointsprites - WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE); - WaypointSprite_UpdateRule(gen.sprite, gen.team, SPRITERULE_TEAMPLAY); - WaypointSprite_UpdateMaxHealth(gen.sprite, gen.max_health); - WaypointSprite_UpdateHealth(gen.sprite, gen.health); - - InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION); -} - - -// =============== -// Round Handler -// =============== - -int total_generators; -void Onslaught_count_generators() -{ - entity e; - total_generators = redowned = blueowned = yellowowned = pinkowned = 0; - for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext) - { - ++total_generators; - redowned += (e.team == NUM_TEAM_1 && e.health > 0); - blueowned += (e.team == NUM_TEAM_2 && e.health > 0); - yellowowned += (e.team == NUM_TEAM_3 && e.health > 0); - pinkowned += (e.team == NUM_TEAM_4 && e.health > 0); - } -} - -int Onslaught_GetWinnerTeam() -{ - int winner_team = 0; - if(redowned > 0) - winner_team = NUM_TEAM_1; - if(blueowned > 0) - { - if(winner_team) return 0; - winner_team = NUM_TEAM_2; - } - if(yellowowned > 0) - { - if(winner_team) return 0; - winner_team = NUM_TEAM_3; - } - if(pinkowned > 0) - { - if(winner_team) return 0; - winner_team = NUM_TEAM_4; - } - if(winner_team) - return winner_team; - return -1; // no generators left? -} - -void nades_Clear(entity e); - -#define ONS_OWNED_GENERATORS() ((redowned > 0) + (blueowned > 0) + (yellowowned > 0) + (pinkowned > 0)) -#define ONS_OWNED_GENERATORS_OK() (ONS_OWNED_GENERATORS() > 1) -bool Onslaught_CheckWinner() -{ - if ((autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60) || (round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)) - { - ons_stalemate = true; - - if (!wpforenemy_announced) - { - Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); - sound(NULL, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE); - - wpforenemy_announced = true; - } - - entity tmp_entity; // temporary entity - float d; - for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) if(time >= tmp_entity.ons_overtime_damagedelay) - { - // tmp_entity.max_health / 300 gives 5 minutes of overtime. - // control points reduce the overtime duration. - d = 1; - entity e; - for(e = ons_worldcplist; e; e = e.ons_worldcpnext) - { - if(DIFF_TEAM(e, tmp_entity)) - if(e.islinked) - d = d + 1; - } - - if(autocvar_g_campaign && autocvar__campaign_testrun) - d = d * tmp_entity.max_health; - else - d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath); - - Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, tmp_entity.origin, '0 0 0'); - - tmp_entity.sprite.SendFlags |= 16; - - tmp_entity.ons_overtime_damagedelay = time + 1; - } - } - else { wpforenemy_announced = false; ons_stalemate = false; } - - Onslaught_count_generators(); - - if(ONS_OWNED_GENERATORS_OK()) - return 0; - - int winner_team = Onslaught_GetWinnerTeam(); - - if(winner_team > 0) - { - Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN)); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN)); - TeamScore_AddToTeam(winner_team, ST_ONS_CAPS, +1); - } - else if(winner_team == -1) - { - Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_TIED); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED); - } - - ons_stalemate = false; - - play2all(SND(CTF_CAPTURE(winner_team))); - - round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit); - - FOREACH_CLIENT(IS_PLAYER(it), { - it.ons_roundlost = true; - it.player_blocked = true; - - nades_Clear(it); - }); - - return 1; -} - -bool Onslaught_CheckPlayers() -{ - return 1; -} - -void Onslaught_RoundStart() -{ - entity tmp_entity; - FOREACH_CLIENT(IS_PLAYER(it), it.player_blocked = false); - - for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext) - tmp_entity.sprite.SendFlags |= 16; - - for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) - tmp_entity.sprite.SendFlags |= 16; -} - - -// ================ -// Bot player logic -// ================ - -// NOTE: LEGACY CODE, needs to be re-written! - -void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius) -{ - bool needarmor = false, needweapons = false; - - // Needs armor/health? - if(this.health<100) - needarmor = true; - - // Needs weapons? - int c = 0; - FOREACH(Weapons, it != WEP_Null, { - if(this.weapons & (it.m_wepset)) - if(++c >= 4) - break; - }); - - if(c<4) - needweapons = true; - - if(!needweapons && !needarmor) - return; - - LOG_DEBUG(this.netname, " needs weapons ", ftos(needweapons)); - LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor)); - - // See what is around - FOREACH_ENTITY_FLOAT(bot_pickup, true, - { - // gather health and armor only - if (it.solid) - if ( ((it.health || it.armorvalue) && needarmor) || (it.weapons && needweapons ) ) - if (vdist(it.origin - org, <, sradius)) - { - int t = it.bot_pickupevalfunc(this, it); - if (t > 0) - navigation_routerating(this, it, t * ratingscale, 500); - } - }); -} - -void havocbot_role_ons_setrole(entity this, int role) -{ - LOG_DEBUG(this.netname," switched to "); - switch(role) - { - case HAVOCBOT_ONS_ROLE_DEFENSE: - LOG_DEBUG("defense"); - 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"); - 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"); - this.havocbot_role = havocbot_role_ons_offense; - this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE; - this.havocbot_role_timeout = 0; - break; - } - LOG_DEBUG(""); -} - -void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale) -{ - entity cp, cp1, cp2, best, wp; - float radius, bestvalue; - int c; - bool found; - - // Filter control points - for(cp2 = ons_worldcplist; cp2; cp2 = cp2.ons_worldcpnext) - { - cp2.wpcost = c = 0; - cp2.wpconsidered = false; - - if(cp2.isshielded) - continue; - - // Ignore owned controlpoints - 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, this)) - if(it.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE) - if(it.havocbot_ons_target == cp2) - ++c; - }); - - // NOTE: probably decrease the cost of attackable control points - cp2.wpcost = c; - cp2.wpconsidered = true; - } - - // We'll consider only the best case - bestvalue = 99999999999; - cp = NULL; - for(cp1 = ons_worldcplist; cp1; cp1 = cp1.ons_worldcpnext) - { - if (!cp1.wpconsidered) - continue; - - if(cp1.wpcost this.havocbot_role_timeout) - { - havocbot_ons_reset_role(this); - return; - } - - if(this.havocbot_attack_time>time) - return; - - if (this.bot_strategytime < time) - { - 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); - - this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; - } -} - -void havocbot_role_ons_assistant(entity this) -{ - havocbot_ons_reset_role(this); -} - -void havocbot_role_ons_defense(entity this) -{ - havocbot_ons_reset_role(this); -} - -void havocbot_ons_reset_role(entity this) -{ - if(IS_DEAD(this)) - return; - - this.havocbot_ons_target = NULL; - - // TODO: Defend control points or generator if necessary - - havocbot_role_ons_setrole(this, HAVOCBOT_ONS_ROLE_OFFENSE); -} - - -/* - * Find control point or generator owned by the same team self which is nearest to pos - * if max_dist is positive, only control points within this range will be considered - */ -entity ons_Nearest_ControlPoint(entity this, vector pos, float max_dist) -{ - entity closest_target = NULL; - FOREACH_ENTITY_CLASS("onslaught_controlpoint", true, - { - if(SAME_TEAM(it, this)) - if(it.iscaptured) - if(max_dist <= 0 || vdist(it.origin - pos, <=, max_dist)) - if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL) - closest_target = it; - }); - FOREACH_ENTITY_CLASS("onslaught_generator", true, - { - if(SAME_TEAM(it, this)) - if(max_dist <= 0 || vdist(it.origin - pos, <, max_dist)) - if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL) - closest_target = it; - }); - - return closest_target; -} - -/* - * Find control point or generator owned by the same team self which is nearest to pos - * if max_dist is positive, only control points within this range will be considered - * This function only check distances on the XY plane, disregarding Z - */ -entity ons_Nearest_ControlPoint_2D(entity this, vector pos, float max_dist) -{ - entity closest_target = NULL; - vector delta; - float smallest_distance = 0, distance; - - FOREACH_ENTITY_CLASS("onslaught_controlpoint", true, - { - delta = it.origin - pos; - delta_z = 0; - distance = vlen(delta); - - if(SAME_TEAM(it, this)) - if(it.iscaptured) - if(max_dist <= 0 || distance <= max_dist) - if(closest_target == NULL || distance <= smallest_distance ) - { - closest_target = it; - smallest_distance = distance; - } - }); - FOREACH_ENTITY_CLASS("onslaught_generator", true, - { - delta = it.origin - pos; - delta_z = 0; - distance = vlen(delta); - - if(SAME_TEAM(it, this)) - if(max_dist <= 0 || distance <= max_dist) - if(closest_target == NULL || distance <= smallest_distance ) - { - closest_target = it; - smallest_distance = distance; - } - }); - - return closest_target; -} -/** - * find the number of control points and generators in the same team as this - */ -int ons_Count_SelfControlPoints(entity this) -{ - int n = 0; - FOREACH_ENTITY_CLASS("onslaught_controlpoint", true, - { - if(SAME_TEAM(it, this)) - if(it.iscaptured) - n++; - }); - FOREACH_ENTITY_CLASS("onslaught_generator", true, - { - if(SAME_TEAM(it, this)) - n++; - }); - return n; -} - -/** - * Teleport player to a random position near tele_target - * if tele_effects is true, teleport sound+particles are created - * return false on failure - */ -bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effects) -{ - if ( !tele_target ) - return false; - - int i; - vector loc; - float theta; - // narrow the range for each iteration to increase chances that a spawnpoint - // can be found even if there's little room around the control point - float iteration_scale = 1; - for(i = 0; i < 16; ++i) - { - iteration_scale -= i / 16; - theta = random() * 2 * M_PI; - loc_y = sin(theta); - loc_x = cos(theta); - loc_z = 0; - loc *= random() * range * iteration_scale; - - loc += tele_target.origin + '0 0 128' * iteration_scale; - - tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); - if(trace_fraction == 1.0 && !trace_startsolid) - { - traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the NULL - if(trace_fraction == 1.0 && !trace_startsolid) - { - if ( tele_effects ) - { - Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1); - sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM); - } - setorigin(player, loc); - player.angles = '0 1 0' * ( theta * RAD2DEG + 180 ); - makevectors(player.angles); - player.fixangle = true; - player.teleport_antispam = time + autocvar_g_onslaught_teleport_wait; - - if ( tele_effects ) - Send_Effect(EFFECT_TELEPORT, player.origin + v_forward * 32, '0 0 0', 1); - return true; - } - } - } - - return false; -} - -// ============== -// Hook Functions -// ============== - -MUTATOR_HOOKFUNCTION(ons, reset_map_global) -{ - FOREACH_CLIENT(IS_PLAYER(it), { - it.ons_roundlost = false; - it.ons_deathloc = '0 0 0'; - PutClientInServer(it); - }); - return false; -} - -MUTATOR_HOOKFUNCTION(ons, ClientDisconnect) -{ - entity player = M_ARGV(0, entity); - - player.ons_deathloc = '0 0 0'; -} - -MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver) -{ - entity player = M_ARGV(0, entity); - - player.ons_deathloc = '0 0 0'; -} - -MUTATOR_HOOKFUNCTION(ons, PlayerSpawn) -{ - entity player = M_ARGV(0, entity); - - if(!round_handler_IsRoundStarted()) - { - player.player_blocked = true; - return false; - } - - entity l; - for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) - { - l.sprite.SendFlags |= 16; - } - for(l = ons_worldcplist; l; l = l.ons_worldcpnext) - { - l.sprite.SendFlags |= 16; - } - - if(ons_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); } - - if ( autocvar_g_onslaught_spawn_choose ) - if ( player.ons_spawn_by ) - if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) ) - { - player.ons_spawn_by = NULL; - return false; - } - - if(autocvar_g_onslaught_spawn_at_controlpoints) - if(random() <= autocvar_g_onslaught_spawn_at_controlpoints_chance) - { - float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random; - entity tmp_entity, closest_target = NULL; - vector spawn_loc = player.ons_deathloc; - - // new joining player or round reset, don't bother checking - if(spawn_loc == '0 0 0') { return false; } - - if(random_target) { RandomSelection_Init(); } - - for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext) - { - if(SAME_TEAM(tmp_entity, player)) - if(random_target) - RandomSelection_Add(tmp_entity, 0, string_null, 1, 1); - else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL) - closest_target = tmp_entity; - } - - if(random_target) { closest_target = RandomSelection_chosen_ent; } - - if(closest_target) - { - float i; - vector loc; - float iteration_scale = 1; - for(i = 0; i < 10; ++i) - { - iteration_scale -= i / 10; - loc = closest_target.origin + '0 0 96' * iteration_scale; - loc += ('0 1 0' * random()) * 128 * iteration_scale; - tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); - if(trace_fraction == 1.0 && !trace_startsolid) - { - traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL - if(trace_fraction == 1.0 && !trace_startsolid) - { - setorigin(player, loc); - player.angles = normalize(loc - closest_target.origin) * RAD2DEG; - return false; - } - } - } - } - } - - if(autocvar_g_onslaught_spawn_at_generator) - if(random() <= autocvar_g_onslaught_spawn_at_generator_chance) - { - float random_target = autocvar_g_onslaught_spawn_at_generator_random; - entity tmp_entity, closest_target = NULL; - vector spawn_loc = player.ons_deathloc; - - // new joining player or round reset, don't bother checking - if(spawn_loc == '0 0 0') { return false; } - - if(random_target) { RandomSelection_Init(); } - - for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) - { - if(random_target) - RandomSelection_Add(tmp_entity, 0, string_null, 1, 1); - else - { - if(SAME_TEAM(tmp_entity, player)) - if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL) - closest_target = tmp_entity; - } - } - - if(random_target) { closest_target = RandomSelection_chosen_ent; } - - if(closest_target) - { - float i; - vector loc; - float iteration_scale = 1; - for(i = 0; i < 10; ++i) - { - iteration_scale -= i / 10; - loc = closest_target.origin + '0 0 128' * iteration_scale; - loc += ('0 1 0' * random()) * 256 * iteration_scale; - tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); - if(trace_fraction == 1.0 && !trace_startsolid) - { - traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL - if(trace_fraction == 1.0 && !trace_startsolid) - { - setorigin(player, loc); - player.angles = normalize(loc - closest_target.origin) * RAD2DEG; - return false; - } - } - } - } - } - - return false; -} - -MUTATOR_HOOKFUNCTION(ons, PlayerDies) -{ - entity frag_target = M_ARGV(2, entity); - - frag_target.ons_deathloc = frag_target.origin; - entity l; - for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) - { - l.sprite.SendFlags |= 16; - } - for(l = ons_worldcplist; l; l = l.ons_worldcpnext) - { - l.sprite.SendFlags |= 16; - } - - if ( autocvar_g_onslaught_spawn_choose ) - if ( ons_Count_SelfControlPoints(frag_target) > 1 ) - stuffcmd(frag_target, "qc_cmd_cl hud clickradar\n"); - - return false; -} - -MUTATOR_HOOKFUNCTION(ons, MonsterMove) -{ - entity mon = M_ARGV(0, entity); - - entity e = find(NULL, targetname, mon.target); - if (e != NULL) - mon.team = e.team; -} - -void ons_MonsterSpawn_Delayed(entity this) -{ - entity own = this.owner; - - if(!own) { delete(this); return; } - - if(own.targetname) - { - entity e = find(NULL, target, own.targetname); - if(e != NULL) - { - own.team = e.team; - - own.use(own, e, NULL); - } - } - - delete(this); -} - -MUTATOR_HOOKFUNCTION(ons, MonsterSpawn) -{ - entity mon = M_ARGV(0, entity); - - entity e = spawn(); - e.owner = mon; - InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET); -} - -void ons_TurretSpawn_Delayed(entity this) -{ - entity own = this.owner; - - if(!own) { delete(this); return; } - - if(own.targetname) - { - entity e = find(NULL, target, own.targetname); - if(e != NULL) - { - own.team = e.team; - own.active = ACTIVE_NOT; - - own.use(own, e, NULL); - } - } - - delete(this); -} - -MUTATOR_HOOKFUNCTION(ons, TurretSpawn) -{ - entity turret = M_ARGV(0, entity); - - entity e = spawn(); - e.owner = turret; - InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET); - - return false; -} - -MUTATOR_HOOKFUNCTION(ons, HavocBot_ChooseRole) -{ - entity bot = M_ARGV(0, entity); - - havocbot_ons_reset_role(bot); - return true; -} - -MUTATOR_HOOKFUNCTION(ons, GetTeamCount) -{ - // onslaught is special - for(entity tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) - { - switch(tmp_entity.team) - { - case NUM_TEAM_1: c1 = 0; break; - case NUM_TEAM_2: c2 = 0; break; - case NUM_TEAM_3: c3 = 0; break; - case NUM_TEAM_4: c4 = 0; break; - } - } - - return true; -} - -MUTATOR_HOOKFUNCTION(ons, SpectateCopy) -{ - entity spectatee = M_ARGV(0, entity); - entity client = M_ARGV(1, entity); - - client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too -} - -MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand) -{ - if(MUTATOR_RETURNVALUE) // command was already handled? - return false; - - entity player = M_ARGV(0, entity); - string cmd_name = M_ARGV(1, string); - int cmd_argc = M_ARGV(2, int); - - if ( cmd_name == "ons_spawn" ) - { - vector pos = player.origin; - if(cmd_argc > 1) - pos_x = stof(argv(1)); - if(cmd_argc > 2) - pos_y = stof(argv(2)); - if(cmd_argc > 3) - pos_z = stof(argv(3)); - - if ( IS_PLAYER(player) ) - { - if ( !STAT(FROZEN, player) ) - { - entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius); - - if ( !source_point && player.health > 0 ) - { - sprint(player, "\nYou need to be next to a control point\n"); - return true; - } - - - entity closest_target = ons_Nearest_ControlPoint_2D(player, pos, autocvar_g_onslaught_click_radius); - - if ( closest_target == NULL ) - { - sprint(player, "\nNo control point found\n"); - return true; - } - - if ( player.health <= 0 ) - { - player.ons_spawn_by = closest_target; - player.respawn_flags = player.respawn_flags | RESPAWN_FORCE; - } - else - { - if ( source_point == closest_target ) - { - sprint(player, "\nTeleporting to the same point\n"); - return true; - } - - if ( !ons_Teleport(player,closest_target,autocvar_g_onslaught_teleport_radius,true) ) - sprint(player, "\nUnable to teleport there\n"); - } - - return true; - } - - sprint(player, "\nNo teleportation for you\n"); - } - - return true; - } - return false; -} - -MUTATOR_HOOKFUNCTION(ons, PlayerUseKey) -{ - if(MUTATOR_RETURNVALUE || gameover) { return false; } - - entity player = M_ARGV(0, entity); - - if((time > player.teleport_antispam) && (!IS_DEAD(player)) && !player.vehicle) - { - entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius); - if ( source_point ) - { - stuffcmd(player, "qc_cmd_cl hud clickradar\n"); - return true; - } - } -} - -MUTATOR_HOOKFUNCTION(ons, PlayHitsound) -{ - entity frag_victim = M_ARGV(0, entity); - - return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded) - || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded); -} - -MUTATOR_HOOKFUNCTION(ons, SendWaypoint) -{ - entity wp = M_ARGV(0, entity); - entity to = M_ARGV(1, entity); - int sf = M_ARGV(2, int); - int wp_flag = M_ARGV(3, int); - - if(sf & 16) - { - if(wp.owner.classname == "onslaught_controlpoint") - { - entity wp_owner = wp.owner; - entity e = WaypointSprite_getviewentity(to); - if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; } - if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; } - } - if(wp.owner.classname == "onslaught_generator") - { - entity wp_owner = wp.owner; - if(wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { wp_flag |= 2; } - if(wp_owner.health <= 0) { wp_flag |= 2; } - } - } - - M_ARGV(3, int) = wp_flag; -} - -MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget) -{ - entity turret_target = M_ARGV(1, entity); - - if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job! - { - M_ARGV(3, float) = -3; - return true; - } - - return false; -} - -MUTATOR_HOOKFUNCTION(ons, TurretThink) -{ - entity turret = M_ARGV(0, entity); - - // ONS uses somewhat backwards linking. - if(turret.target) - { - entity e = find(NULL, targetname, turret.target); - if (e != NULL) - turret.team = e.team; - } - - if(turret.team != turret.tur_head.team) - turret_respawn(turret); -} - - -// ========== -// Spawnfuncs -// ========== - -/*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16) - Link between control points. - - This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams. - -keys: -"target" - first control point. -"target2" - second control point. - */ -spawnfunc(onslaught_link) -{ - if(!g_onslaught) { delete(this); return; } - - if (this.target == "" || this.target2 == "") - objerror(this, "target and target2 must be set\n"); - - this.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist - ons_worldlinklist = this; - - InitializeEntity(this, ons_DelayedLinkSetup, INITPRIO_FINDTARGET); - Net_LinkEntity(this, false, 0, ons_Link_Send); -} - -/*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128) - Control point. Be sure to give this enough clearance so that the shootable part has room to exist - - This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity. - -keys: -"targetname" - name that spawnfunc_onslaught_link entities will use to target this. -"target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities. -"message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc) - */ - -spawnfunc(onslaught_controlpoint) -{ - if(!g_onslaught) { delete(this); return; } - - ons_ControlPoint_Setup(this); -} - -/*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64) - Base generator. - - spawnfunc_onslaught_link entities can target this. - -keys: -"team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET. -"targetname" - name that spawnfunc_onslaught_link entities will use to target this. - */ -spawnfunc(onslaught_generator) -{ - if(!g_onslaught) { delete(this); return; } - if(!this.team) { objerror(this, "team must be set"); } - - ons_GeneratorSetup(this); -} - -// scoreboard setup -void ons_ScoreRules() -{ - CheckAllowedTeams(NULL); - int teams = 0; - if(c1 >= 0) teams |= BIT(0); - if(c2 >= 0) teams |= BIT(1); - if(c3 >= 0) teams |= BIT(2); - if(c4 >= 0) teams |= BIT(3); - ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true); - ScoreInfo_SetLabel_TeamScore (ST_ONS_CAPS, "destroyed", SFL_SORT_PRIO_PRIMARY); - ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY); - ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES, "takes", 0); - ScoreRules_basics_end(); -} - -void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up -{ - ons_ScoreRules(); - - round_handler_Spawn(Onslaught_CheckPlayers, Onslaught_CheckWinner, Onslaught_RoundStart); - round_handler_Init(5, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit); -} - -void ons_Initialize() -{ - g_onslaught = true; - ons_captureshield_force = autocvar_g_onslaught_shield_force; - - InitializeEntity(NULL, ons_DelayedInit, INITPRIO_GAMETYPE); -} - -#endif +#include "onslaught.qh" diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh new file mode 100644 index 000000000..be9b8203c --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh @@ -0,0 +1,4 @@ +#pragma once + +REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR) +REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON) diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qh index d76f0ea06..d5437338e 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qh @@ -1,10 +1,7 @@ -#ifndef CONTROLPOINT_H -#define CONTROLPOINT_H +#pragma once const vector CPICON_MIN = '-32 -32 -9'; const vector CPICON_MAX = '32 32 25'; const int CPSF_STATUS = 4; const int CPSF_SETUP = 8; - -#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qh index 003c2b1d6..8356689e2 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qh @@ -1,5 +1,5 @@ -#ifndef GENERATOR_H -#define GENERATOR_H +#pragma once + const vector GENERATOR_MIN = '-52 -52 -14'; const vector GENERATOR_MAX = '52 52 75'; @@ -7,4 +7,3 @@ const int GSF_STATUS = 4; const int GSF_SETUP = 8; bool generator_send(entity this, entity to, int sf); -#endif diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc new file mode 100644 index 000000000..9551e9d85 --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -0,0 +1,2128 @@ +#include "sv_controlpoint.qh" +#include "sv_generator.qh" + +bool g_onslaught; + +float autocvar_g_onslaught_teleport_wait; +bool autocvar_g_onslaught_spawn_at_controlpoints; +bool autocvar_g_onslaught_spawn_at_generator; +float autocvar_g_onslaught_cp_proxydecap; +float autocvar_g_onslaught_cp_proxydecap_distance = 512; +float autocvar_g_onslaught_cp_proxydecap_dps = 100; +float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5; +float autocvar_g_onslaught_spawn_at_controlpoints_random; +float autocvar_g_onslaught_spawn_at_generator_chance; +float autocvar_g_onslaught_spawn_at_generator_random; +float autocvar_g_onslaught_cp_buildhealth; +float autocvar_g_onslaught_cp_buildtime; +float autocvar_g_onslaught_cp_health; +float autocvar_g_onslaught_cp_regen; +float autocvar_g_onslaught_gen_health; +float autocvar_g_onslaught_shield_force = 100; +float autocvar_g_onslaught_allow_vehicle_touch; +float autocvar_g_onslaught_round_timelimit; +float autocvar_g_onslaught_warmup; +float autocvar_g_onslaught_teleport_radius; +float autocvar_g_onslaught_spawn_choose; +float autocvar_g_onslaught_click_radius; + +void FixSize(entity e); + +// ======================= +// CaptureShield Functions +// ======================= + +bool ons_CaptureShield_Customize(entity this, entity client) +{ + entity e = WaypointSprite_getviewentity(client); + + if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; } + if(SAME_TEAM(this, e)) { return false; } + + return true; +} + +void ons_CaptureShield_Touch(entity this, entity toucher) +{ + if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; } + if(!IS_PLAYER(toucher)) { return; } + if(SAME_TEAM(toucher, this)) { return; } + + vector mymid = (this.absmin + this.absmax) * 0.5; + vector theirmid = (toucher.absmin + toucher.absmax) * 0.5; + + Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force); + + if(IS_REAL_CLIENT(toucher)) + { + play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); + + if(this.enemy.classname == "onslaught_generator") + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); + else + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED); + } +} + +void ons_CaptureShield_Reset(entity this) +{ + this.colormap = this.enemy.colormap; + this.team = this.enemy.team; +} + +void ons_CaptureShield_Spawn(entity generator, bool is_generator) +{ + entity shield = new(ons_captureshield); + + shield.enemy = generator; + shield.team = generator.team; + shield.colormap = generator.colormap; + shield.reset = ons_CaptureShield_Reset; + settouch(shield, ons_CaptureShield_Touch); + setcefc(shield, ons_CaptureShield_Customize); + shield.effects = EF_ADDITIVE; + set_movetype(shield, MOVETYPE_NOCLIP); + shield.solid = SOLID_TRIGGER; + shield.avelocity = '7 0 11'; + shield.scale = 1; + shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3"); + + precache_model(shield.model); + setorigin(shield, generator.origin); + _setmodel(shield, shield.model); + setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs); +} + + +// ========== +// Junk Pile +// ========== + +void setmodel_fixsize(entity e, Model m) +{ + setmodel(e, m); + FixSize(e); +} + +void onslaught_updatelinks() +{ + entity l; + // first check if the game has ended + LOG_DEBUG("--- updatelinks ---"); + // mark generators as being shielded and networked + for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) + { + if (l.iscaptured) + LOG_DEBUG(etos(l), " (generator) belongs to team ", ftos(l.team)); + else + LOG_DEBUG(etos(l), " (generator) is destroyed"); + l.islinked = l.iscaptured; + l.isshielded = l.iscaptured; + l.sprite.SendFlags |= 16; + } + // mark points as shielded and not networked + for(l = ons_worldcplist; l; l = l.ons_worldcpnext) + { + l.islinked = false; + l.isshielded = true; + int i; + for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; } + LOG_DEBUG(etos(l), " (point) belongs to team ", ftos(l.team)); + l.sprite.SendFlags |= 16; + } + // flow power outward from the generators through the network + bool stop = false; + while (!stop) + { + stop = true; + for(l = ons_worldlinklist; l; l = l.ons_worldlinknext) + { + // if both points are captured by the same team, and only one of + // them is powered, mark the other one as powered as well + if (l.enemy.iscaptured && l.goalentity.iscaptured) + if (l.enemy.islinked != l.goalentity.islinked) + if(SAME_TEAM(l.enemy, l.goalentity)) + { + if (!l.goalentity.islinked) + { + stop = false; + l.goalentity.islinked = true; + LOG_DEBUG(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)"); + } + else if (!l.enemy.islinked) + { + stop = false; + l.enemy.islinked = true; + LOG_DEBUG(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)"); + } + } + } + } + // now that we know which points are powered we can mark their neighbors + // as unshielded if team differs + for(l = ons_worldlinklist; l; l = l.ons_worldlinknext) + { + if (l.goalentity.islinked) + { + if(DIFF_TEAM(l.goalentity, l.enemy)) + { + LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)"); + l.enemy.isshielded = false; + } + if(l.goalentity.classname == "onslaught_generator") + l.enemy.isgenneighbor[l.goalentity.team] = true; + else + l.enemy.iscpneighbor[l.goalentity.team] = true; + } + if (l.enemy.islinked) + { + if(DIFF_TEAM(l.goalentity, l.enemy)) + { + LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)"); + l.goalentity.isshielded = false; + } + if(l.enemy.classname == "onslaught_generator") + l.goalentity.isgenneighbor[l.enemy.team] = true; + else + l.goalentity.iscpneighbor[l.enemy.team] = true; + } + } + // now update the generators + for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) + { + if (l.isshielded) + { + LOG_DEBUG(etos(l), " (generator) is shielded"); + l.takedamage = DAMAGE_NO; + l.bot_attack = false; + } + else + { + LOG_DEBUG(etos(l), " (generator) is not shielded"); + l.takedamage = DAMAGE_AIM; + l.bot_attack = true; + } + + ons_Generator_UpdateSprite(l); + } + // now update the takedamage and alpha variables on control point icons + for(l = ons_worldcplist; l; l = l.ons_worldcpnext) + { + if (l.isshielded) + { + LOG_DEBUG(etos(l), " (point) is shielded"); + if (l.goalentity) + { + l.goalentity.takedamage = DAMAGE_NO; + l.goalentity.bot_attack = false; + } + } + else + { + LOG_DEBUG(etos(l), " (point) is not shielded"); + if (l.goalentity) + { + l.goalentity.takedamage = DAMAGE_AIM; + l.goalentity.bot_attack = true; + } + } + ons_ControlPoint_UpdateSprite(l); + } + FOREACH_ENTITY_CLASS("ons_captureshield", true, + { + it.team = it.enemy.team; + it.colormap = it.enemy.colormap; + }); +} + + +// =================== +// Main Link Functions +// =================== + +bool ons_Link_Send(entity this, entity to, int sendflags) +{ + WriteHeader(MSG_ENTITY, ENT_CLIENT_RADARLINK); + WriteByte(MSG_ENTITY, sendflags); + if(sendflags & 1) + { + WriteCoord(MSG_ENTITY, this.goalentity.origin_x); + WriteCoord(MSG_ENTITY, this.goalentity.origin_y); + WriteCoord(MSG_ENTITY, this.goalentity.origin_z); + } + if(sendflags & 2) + { + WriteCoord(MSG_ENTITY, this.enemy.origin_x); + WriteCoord(MSG_ENTITY, this.enemy.origin_y); + WriteCoord(MSG_ENTITY, this.enemy.origin_z); + } + if(sendflags & 4) + { + WriteByte(MSG_ENTITY, this.clientcolors); // which is goalentity's color + enemy's color * 16 + } + return true; +} + +void ons_Link_CheckUpdate(entity this) +{ + // TODO check if the two sides have moved (currently they won't move anyway) + float cc = 0, cc1 = 0, cc2 = 0; + + if(this.goalentity.islinked || this.goalentity.iscaptured) { cc1 = (this.goalentity.team - 1) * 0x01; } + if(this.enemy.islinked || this.enemy.iscaptured) { cc2 = (this.enemy.team - 1) * 0x10; } + + cc = cc1 + cc2; + + if(cc != this.clientcolors) + { + this.clientcolors = cc; + this.SendFlags |= 4; + } + + this.nextthink = time; +} + +void ons_DelayedLinkSetup(entity this) +{ + this.goalentity = find(NULL, targetname, this.target); + this.enemy = find(NULL, targetname, this.target2); + if(!this.goalentity) { objerror(this, "can not find target\n"); } + if(!this.enemy) { objerror(this, "can not find target2\n"); } + + LOG_DEBUG(etos(this.goalentity), " linked with ", etos(this.enemy)); + this.SendFlags |= 3; + setthink(this, ons_Link_CheckUpdate); + this.nextthink = time; +} + + +// ============================= +// Main Control Point Functions +// ============================= + +int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber) +{ + if(cp.isgenneighbor[teamnumber]) { return 2; } + if(cp.iscpneighbor[teamnumber]) { return 1; } + + return 0; +} + +int ons_ControlPoint_Attackable(entity cp, int teamnumber) + // -2: SAME TEAM, attackable by enemy! + // -1: SAME TEAM! + // 0: off limits + // 1: attack it + // 2: touch it + // 3: attack it (HIGH PRIO) + // 4: touch it (HIGH PRIO) +{ + int a; + + if(cp.isshielded) + { + return 0; + } + else if(cp.goalentity) + { + // if there's already an icon built, nothing happens + if(cp.team == teamnumber) + { + a = ons_ControlPoint_CanBeLinked(cp, teamnumber); + if(a) // attackable by enemy? + return -2; // EMERGENCY! + return -1; + } + // we know it can be linked, so no need to check + // but... + a = ons_ControlPoint_CanBeLinked(cp, teamnumber); + if(a == 2) // near our generator? + return 3; // EMERGENCY! + return 1; + } + else + { + // free point + if(ons_ControlPoint_CanBeLinked(cp, teamnumber)) + { + a = ons_ControlPoint_CanBeLinked(cp, teamnumber); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t + if(a == 2) + return 4; // GET THIS ONE NOW! + else + return 2; // TOUCH ME + } + } + return 0; +} + +void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(damage <= 0) { return; } + + if (this.owner.isshielded) + { + // this is protected by a shield, so ignore the damage + if (time > this.pain_finished) + if (IS_PLAYER(attacker)) + { + play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); + this.pain_finished = time + 1; + attacker.typehitsound += 1; // play both sounds (shield is way too quiet) + } + + return; + } + + if(IS_PLAYER(attacker)) + if(time - ons_notification_time[this.team] > 10) + { + play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK)); + ons_notification_time[this.team] = time; + } + + this.health = this.health - damage; + if(this.owner.iscaptured) + WaypointSprite_UpdateHealth(this.owner.sprite, this.health); + else + WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE)); + this.pain_finished = time + 1; + // particles on every hit + pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1); + //sound on every hit + if (random() < 0.5) + sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM); + else + sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM); + + if (this.health < 0) + { + sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); + pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname); + + PlayerScore_Add(attacker, SP_ONS_TAKES, 1); + PlayerScore_Add(attacker, SP_SCORE, 10); + + this.owner.goalentity = NULL; + this.owner.islinked = false; + this.owner.iscaptured = false; + this.owner.team = 0; + this.owner.colormap = 1024; + + WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0); + + onslaught_updatelinks(); + + // Use targets now (somebody make sure this is in the right place..) + SUB_UseTargets(this.owner, this, NULL); + + this.owner.waslinked = this.owner.islinked; + if(this.owner.model != "models/onslaught/controlpoint_pad.md3") + setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1); + //setsize(this, '-32 -32 0', '32 32 8'); + + delete(this); + } + + this.SendFlags |= CPSF_STATUS; +} + +void ons_ControlPoint_Icon_Think(entity this) +{ + this.nextthink = time + ONS_CP_THINKRATE; + + if(autocvar_g_onslaught_cp_proxydecap) + { + int _enemy_count = 0; + int _friendly_count = 0; + + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), { + if(vdist(it.origin - this.origin, <, autocvar_g_onslaught_cp_proxydecap_distance)) + { + if(SAME_TEAM(it, this)) + ++_friendly_count; + else + ++_enemy_count; + } + }); + + _friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE); + _enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE); + + this.health = bound(0, this.health + (_friendly_count - _enemy_count), this.max_health); + this.SendFlags |= CPSF_STATUS; + if(this.health <= 0) + { + ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, this.origin, '0 0 0'); + return; + } + } + + if (time > this.pain_finished + 5) + { + if(this.health < this.max_health) + { + this.health = this.health + this.count; + if (this.health >= this.max_health) + this.health = this.max_health; + WaypointSprite_UpdateHealth(this.owner.sprite, this.health); + } + } + + if(this.owner.islinked != this.owner.waslinked) + { + // unteam the spawnpoint if needed + int t = this.owner.team; + if(!this.owner.islinked) + this.owner.team = 0; + + SUB_UseTargets(this.owner, this, NULL); + + this.owner.team = t; + + this.owner.waslinked = this.owner.islinked; + } + + // damaged fx + if(random() < 0.6 - this.health / this.max_health) + { + Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1); + + if(random() > 0.8) + sound(this, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM); + else if (random() > 0.5) + sound(this, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM); + } +} + +void ons_ControlPoint_Icon_BuildThink(entity this) +{ + int a; + + this.nextthink = time + ONS_CP_THINKRATE; + + // only do this if there is power + a = ons_ControlPoint_CanBeLinked(this.owner, this.owner.team); + if(!a) + return; + + this.health = this.health + this.count; + + this.SendFlags |= CPSF_STATUS; + + if (this.health >= this.max_health) + { + this.health = this.max_health; + this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on + setthink(this, ons_ControlPoint_Icon_Think); + sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM); + this.owner.iscaptured = true; + this.solid = SOLID_BBOX; + + Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1); + + WaypointSprite_UpdateMaxHealth(this.owner.sprite, this.max_health); + WaypointSprite_UpdateHealth(this.owner.sprite, this.health); + + if(IS_PLAYER(this.owner.ons_toucher)) + { + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message); + Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE), this.owner.message); + Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message); + PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1); + PlayerTeamScore_AddScore(this.owner.ons_toucher, 10); + } + + this.owner.ons_toucher = NULL; + + onslaught_updatelinks(); + + // Use targets now (somebody make sure this is in the right place..) + SUB_UseTargets(this.owner, this, NULL); + + this.SendFlags |= CPSF_SETUP; + } + if(this.owner.model != MDL_ONS_CP_PAD2.model_str()) + setmodel_fixsize(this.owner, MDL_ONS_CP_PAD2); + + if(random() < 0.9 - this.health / this.max_health) + Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1); +} + +void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc); + +void ons_ControlPoint_Icon_Spawn(entity cp, entity player) +{ + entity e = new(onslaught_controlpoint_icon); + + setsize(e, CPICON_MIN, CPICON_MAX); + setorigin(e, cp.origin + CPICON_OFFSET); + + e.owner = cp; + e.max_health = autocvar_g_onslaught_cp_health; + e.health = autocvar_g_onslaught_cp_buildhealth; + e.solid = SOLID_NOT; + e.takedamage = DAMAGE_AIM; + e.bot_attack = true; + e.event_damage = ons_ControlPoint_Icon_Damage; + e.team = player.team; + e.colormap = 1024 + (e.team - 1) * 17; + e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build + + sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM); + + cp.goalentity = e; + cp.team = e.team; + cp.colormap = e.colormap; + + Send_Effect(EFFECT_FLAG_TOUCH(player.team), e.origin, '0 0 0', 1); + + WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - e.health) / (e.count / ONS_CP_THINKRATE)); + WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY); + cp.sprite.SendFlags |= 16; + + onslaught_controlpoint_icon_link(e, ons_ControlPoint_Icon_BuildThink); +} + +entity ons_ControlPoint_Waypoint(entity e) +{ + if(e.team) + { + int a = ons_ControlPoint_Attackable(e, e.team); + + if(a == -2) { return WP_OnsCPDefend; } // defend now + if(a == -1 || a == 1 || a == 2) { return WP_OnsCP; } // touch + if(a == 3 || a == 4) { return WP_OnsCPAttack; } // attack + } + else + return WP_OnsCP; + + return WP_Null; +} + +void ons_ControlPoint_UpdateSprite(entity e) +{ + entity s1 = ons_ControlPoint_Waypoint(e); + WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1); + + bool sh; + sh = !(ons_ControlPoint_CanBeLinked(e, NUM_TEAM_1) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_2) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_3) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_4)); + + if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured) + { + if(e.iscaptured) // don't mess up build bars! + { + if(sh) + { + WaypointSprite_UpdateMaxHealth(e.sprite, 0); + } + else + { + WaypointSprite_UpdateMaxHealth(e.sprite, e.goalentity.max_health); + WaypointSprite_UpdateHealth(e.sprite, e.goalentity.health); + } + } + if(e.lastshielded) + { + if(e.team) + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false)); + else + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5'); + } + else + { + if(e.team) + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false)); + else + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75'); + } + WaypointSprite_Ping(e.sprite); + + e.lastteam = e.team + 2; + e.lastshielded = sh; + e.lastcaptured = e.iscaptured; + } +} + +void ons_ControlPoint_Touch(entity this, entity toucher) +{ + int attackable; + + if(IS_VEHICLE(toucher) && toucher.owner) + if(autocvar_g_onslaught_allow_vehicle_touch) + toucher = toucher.owner; + else + return; + + if(!IS_PLAYER(toucher)) { return; } + if(STAT(FROZEN, toucher)) { return; } + if(IS_DEAD(toucher)) { return; } + + if ( SAME_TEAM(this,toucher) ) + if ( this.iscaptured ) + { + if(time <= toucher.teleport_antispam) + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT_ANTISPAM, rint(toucher.teleport_antispam - time)); + else + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT); + } + + attackable = ons_ControlPoint_Attackable(this, toucher.team); + if(attackable != 2 && attackable != 4) + return; + // we've verified that this player has a legitimate claim to this point, + // so start building the captured point icon (which only captures this + // point if it successfully builds without being destroyed first) + ons_ControlPoint_Icon_Spawn(this, toucher); + + this.ons_toucher = toucher; + + onslaught_updatelinks(); +} + +void ons_ControlPoint_Think(entity this) +{ + this.nextthink = time + ONS_CP_THINKRATE; + CSQCMODEL_AUTOUPDATE(this); +} + +void ons_ControlPoint_Reset(entity this) +{ + if(this.goalentity) + delete(this.goalentity); + + this.goalentity = NULL; + this.team = 0; + this.colormap = 1024; + this.iscaptured = false; + this.islinked = false; + this.isshielded = true; + setthink(this, ons_ControlPoint_Think); + this.ons_toucher = NULL; + this.nextthink = time + ONS_CP_THINKRATE; + setmodel_fixsize(this, MDL_ONS_CP_PAD1); + + WaypointSprite_UpdateMaxHealth(this.sprite, 0); + WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY); + + onslaught_updatelinks(); + + SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc. + + CSQCMODEL_AUTOUPDATE(this); +} + +void ons_DelayedControlPoint_Setup(entity this) +{ + onslaught_updatelinks(); + + // captureshield setup + ons_CaptureShield_Spawn(this, false); + + CSQCMODEL_AUTOINIT(this); +} + +void ons_ControlPoint_Setup(entity cp) +{ + // main setup + cp.ons_worldcpnext = ons_worldcplist; // link control point into ons_worldcplist + ons_worldcplist = cp; + + cp.netname = "Control point"; + cp.team = 0; + cp.solid = SOLID_BBOX; + set_movetype(cp, MOVETYPE_NONE); + settouch(cp, ons_ControlPoint_Touch); + setthink(cp, ons_ControlPoint_Think); + cp.nextthink = time + ONS_CP_THINKRATE; + cp.reset = ons_ControlPoint_Reset; + cp.colormap = 1024; + cp.iscaptured = false; + cp.islinked = false; + cp.isshielded = true; + + if(cp.message == "") { cp.message = "a"; } + + // appearence + setmodel_fixsize(cp, MDL_ONS_CP_PAD1); + + // control point placement + if((cp.spawnflags & 1) || cp.noalign) // don't drop to floor, just stay at fixed location + { + cp.noalign = true; + set_movetype(cp, MOVETYPE_NONE); + } + else // drop to floor, automatically find a platform and set that as spawn origin + { + setorigin(cp, cp.origin + '0 0 20'); + cp.noalign = false; + droptofloor(cp); + set_movetype(cp, MOVETYPE_TOSS); + } + + // waypointsprites + WaypointSprite_SpawnFixed(WP_Null, cp.origin + CPGEN_WAYPOINT_OFFSET, cp, sprite, RADARICON_NONE); + WaypointSprite_UpdateRule(cp.sprite, cp.team, SPRITERULE_TEAMPLAY); + + InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION); +} + + +// ========================= +// Main Generator Functions +// ========================= + +entity ons_Generator_Waypoint(entity e) +{ + if (e.isshielded) + return WP_OnsGenShielded; + return WP_OnsGen; +} + +void ons_Generator_UpdateSprite(entity e) +{ + entity s1 = ons_Generator_Waypoint(e); + WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1); + + if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded) + { + e.lastteam = e.team + 2; + e.lastshielded = e.isshielded; + if(e.lastshielded) + { + if(e.team) + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false)); + else + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5'); + } + else + { + if(e.team) + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false)); + else + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75'); + } + WaypointSprite_Ping(e.sprite); + } +} + +void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(damage <= 0) { return; } + if(warmup_stage || gameover) { return; } + if(!round_handler_IsRoundStarted()) { return; } + + if (attacker != this) + { + if (this.isshielded) + { + // this is protected by a shield, so ignore the damage + if (time > this.pain_finished) + if (IS_PLAYER(attacker)) + { + play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); + attacker.typehitsound += 1; + this.pain_finished = time + 1; + } + return; + } + if (time > this.pain_finished) + { + this.pain_finished = time + 10; + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK)); + play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK)); + } + } + this.health = this.health - damage; + WaypointSprite_UpdateHealth(this.sprite, this.health); + // choose an animation frame based on health + this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1); + // see if the generator is still functional, or dying + if (this.health > 0) + { + this.lasthealth = this.health; + } + else + { + if (attacker == this) + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME)); + else + { + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED)); + PlayerScore_Add(attacker, SP_SCORE, 100); + } + this.iscaptured = false; + this.islinked = false; + this.isshielded = false; + this.takedamage = DAMAGE_NO; // can't be hurt anymore + this.event_damage = func_null; // won't do anything if hurt + this.count = 0; // reset counter + setthink(this, func_null); + this.nextthink = 0; + //this.think(); // do the first explosion now + + WaypointSprite_UpdateMaxHealth(this.sprite, 0); + WaypointSprite_Ping(this.sprite); + //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor + + onslaught_updatelinks(); + } + + // Throw some flaming gibs on damage, more damage = more chance for gib + if(random() < damage/220) + { + sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + } + else + { + // particles on every hit + Send_Effect(EFFECT_SPARKS, hitloc, force * -1, 1); + + //sound on every hit + if (random() < 0.5) + sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM); + else + sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM); + } + + this.SendFlags |= GSF_STATUS; +} + +void ons_GeneratorThink(entity this) +{ + this.nextthink = time + GEN_THINKRATE; + if (!gameover) + { + if(!this.isshielded && this.wait < time) + { + this.wait = time + 5; + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { + if(SAME_TEAM(it, this)) + { + Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM); + soundto(MSG_ONE, it, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE); // FIXME: unique sound? + } + else + Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_ONS_NOTSHIELDED)); + }); + } + } +} + +void ons_GeneratorReset(entity this) +{ + this.team = this.team_saved; + this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health; + this.takedamage = DAMAGE_AIM; + this.bot_attack = true; + this.iscaptured = true; + this.islinked = true; + this.isshielded = true; + this.event_damage = ons_GeneratorDamage; + setthink(this, ons_GeneratorThink); + this.nextthink = time + GEN_THINKRATE; + + Net_LinkEntity(this, false, 0, generator_send); + + this.SendFlags = GSF_SETUP; // just incase + this.SendFlags |= GSF_STATUS; + + WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health); + WaypointSprite_UpdateHealth(this.sprite, this.health); + WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY); + + onslaught_updatelinks(); +} + +void ons_DelayedGeneratorSetup(entity this) +{ + // bot waypoints + waypoint_spawnforitem_force(this, this.origin); + this.nearestwaypointtimeout = 0; // activate waypointing again + this.bot_basewaypoint = this.nearestwaypoint; + + // captureshield setup + ons_CaptureShield_Spawn(this, true); + + onslaught_updatelinks(); + + Net_LinkEntity(this, false, 0, generator_send); +} + + +void onslaught_generator_touch(entity this, entity toucher) +{ + if ( IS_PLAYER(toucher) ) + if ( SAME_TEAM(this,toucher) ) + if ( this.iscaptured ) + { + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT); + } +} + +void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc +{ + // declarations + int teamnumber = gen.team; + + // main setup + gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist + ons_worldgeneratorlist = gen; + + gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber)); + gen.classname = "onslaught_generator"; + gen.solid = SOLID_BBOX; + gen.team_saved = teamnumber; + set_movetype(gen, MOVETYPE_NONE); + gen.lasthealth = gen.max_health = gen.health = autocvar_g_onslaught_gen_health; + gen.takedamage = DAMAGE_AIM; + gen.bot_attack = true; + gen.event_damage = ons_GeneratorDamage; + gen.reset = ons_GeneratorReset; + setthink(gen, ons_GeneratorThink); + gen.nextthink = time + GEN_THINKRATE; + gen.iscaptured = true; + gen.islinked = true; + gen.isshielded = true; + settouch(gen, onslaught_generator_touch); + + // appearence + // model handled by CSQC + setsize(gen, GENERATOR_MIN, GENERATOR_MAX); + setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET)); + gen.colormap = 1024 + (teamnumber - 1) * 17; + + // generator placement + droptofloor(gen); + + // waypointsprites + WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE); + WaypointSprite_UpdateRule(gen.sprite, gen.team, SPRITERULE_TEAMPLAY); + WaypointSprite_UpdateMaxHealth(gen.sprite, gen.max_health); + WaypointSprite_UpdateHealth(gen.sprite, gen.health); + + InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION); +} + + +// =============== +// Round Handler +// =============== + +int total_generators; +void Onslaught_count_generators() +{ + entity e; + total_generators = redowned = blueowned = yellowowned = pinkowned = 0; + for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext) + { + ++total_generators; + redowned += (e.team == NUM_TEAM_1 && e.health > 0); + blueowned += (e.team == NUM_TEAM_2 && e.health > 0); + yellowowned += (e.team == NUM_TEAM_3 && e.health > 0); + pinkowned += (e.team == NUM_TEAM_4 && e.health > 0); + } +} + +int Onslaught_GetWinnerTeam() +{ + int winner_team = 0; + if(redowned > 0) + winner_team = NUM_TEAM_1; + if(blueowned > 0) + { + if(winner_team) return 0; + winner_team = NUM_TEAM_2; + } + if(yellowowned > 0) + { + if(winner_team) return 0; + winner_team = NUM_TEAM_3; + } + if(pinkowned > 0) + { + if(winner_team) return 0; + winner_team = NUM_TEAM_4; + } + if(winner_team) + return winner_team; + return -1; // no generators left? +} + +void nades_Clear(entity e); + +#define ONS_OWNED_GENERATORS() ((redowned > 0) + (blueowned > 0) + (yellowowned > 0) + (pinkowned > 0)) +#define ONS_OWNED_GENERATORS_OK() (ONS_OWNED_GENERATORS() > 1) +bool Onslaught_CheckWinner() +{ + if ((autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60) || (round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)) + { + ons_stalemate = true; + + if (!wpforenemy_announced) + { + Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); + sound(NULL, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE); + + wpforenemy_announced = true; + } + + entity tmp_entity; // temporary entity + float d; + for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) if(time >= tmp_entity.ons_overtime_damagedelay) + { + // tmp_entity.max_health / 300 gives 5 minutes of overtime. + // control points reduce the overtime duration. + d = 1; + entity e; + for(e = ons_worldcplist; e; e = e.ons_worldcpnext) + { + if(DIFF_TEAM(e, tmp_entity)) + if(e.islinked) + d = d + 1; + } + + if(autocvar_g_campaign && autocvar__campaign_testrun) + d = d * tmp_entity.max_health; + else + d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath); + + Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, tmp_entity.origin, '0 0 0'); + + tmp_entity.sprite.SendFlags |= 16; + + tmp_entity.ons_overtime_damagedelay = time + 1; + } + } + else { wpforenemy_announced = false; ons_stalemate = false; } + + Onslaught_count_generators(); + + if(ONS_OWNED_GENERATORS_OK()) + return 0; + + int winner_team = Onslaught_GetWinnerTeam(); + + if(winner_team > 0) + { + Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN)); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN)); + TeamScore_AddToTeam(winner_team, ST_ONS_CAPS, +1); + } + else if(winner_team == -1) + { + Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_TIED); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED); + } + + ons_stalemate = false; + + play2all(SND(CTF_CAPTURE(winner_team))); + + round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit); + + FOREACH_CLIENT(IS_PLAYER(it), { + it.ons_roundlost = true; + it.player_blocked = true; + + nades_Clear(it); + }); + + return 1; +} + +bool Onslaught_CheckPlayers() +{ + return 1; +} + +void Onslaught_RoundStart() +{ + entity tmp_entity; + FOREACH_CLIENT(IS_PLAYER(it), it.player_blocked = false); + + for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext) + tmp_entity.sprite.SendFlags |= 16; + + for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) + tmp_entity.sprite.SendFlags |= 16; +} + + +// ================ +// Bot player logic +// ================ + +// NOTE: LEGACY CODE, needs to be re-written! + +void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius) +{ + bool needarmor = false, needweapons = false; + + // Needs armor/health? + if(this.health<100) + needarmor = true; + + // Needs weapons? + int c = 0; + FOREACH(Weapons, it != WEP_Null, { + if(this.weapons & (it.m_wepset)) + if(++c >= 4) + break; + }); + + if(c<4) + needweapons = true; + + if(!needweapons && !needarmor) + return; + + LOG_DEBUG(this.netname, " needs weapons ", ftos(needweapons)); + LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor)); + + // See what is around + FOREACH_ENTITY_FLOAT(bot_pickup, true, + { + // gather health and armor only + if (it.solid) + if ( ((it.health || it.armorvalue) && needarmor) || (it.weapons && needweapons ) ) + if (vdist(it.origin - org, <, sradius)) + { + int t = it.bot_pickupevalfunc(this, it); + if (t > 0) + navigation_routerating(this, it, t * ratingscale, 500); + } + }); +} + +void havocbot_role_ons_setrole(entity this, int role) +{ + LOG_DEBUG(this.netname," switched to "); + switch(role) + { + case HAVOCBOT_ONS_ROLE_DEFENSE: + LOG_DEBUG("defense"); + 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"); + 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"); + this.havocbot_role = havocbot_role_ons_offense; + this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE; + this.havocbot_role_timeout = 0; + break; + } + LOG_DEBUG(""); +} + +void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale) +{ + entity cp, cp1, cp2, best, wp; + float radius, bestvalue; + int c; + bool found; + + // Filter control points + for(cp2 = ons_worldcplist; cp2; cp2 = cp2.ons_worldcpnext) + { + cp2.wpcost = c = 0; + cp2.wpconsidered = false; + + if(cp2.isshielded) + continue; + + // Ignore owned controlpoints + 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, this)) + if(it.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE) + if(it.havocbot_ons_target == cp2) + ++c; + }); + + // NOTE: probably decrease the cost of attackable control points + cp2.wpcost = c; + cp2.wpconsidered = true; + } + + // We'll consider only the best case + bestvalue = 99999999999; + cp = NULL; + for(cp1 = ons_worldcplist; cp1; cp1 = cp1.ons_worldcpnext) + { + if (!cp1.wpconsidered) + continue; + + if(cp1.wpcost this.havocbot_role_timeout) + { + havocbot_ons_reset_role(this); + return; + } + + if(this.havocbot_attack_time>time) + return; + + if (this.bot_strategytime < time) + { + 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); + + this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; + } +} + +void havocbot_role_ons_assistant(entity this) +{ + havocbot_ons_reset_role(this); +} + +void havocbot_role_ons_defense(entity this) +{ + havocbot_ons_reset_role(this); +} + +void havocbot_ons_reset_role(entity this) +{ + if(IS_DEAD(this)) + return; + + this.havocbot_ons_target = NULL; + + // TODO: Defend control points or generator if necessary + + havocbot_role_ons_setrole(this, HAVOCBOT_ONS_ROLE_OFFENSE); +} + + +/* + * Find control point or generator owned by the same team self which is nearest to pos + * if max_dist is positive, only control points within this range will be considered + */ +entity ons_Nearest_ControlPoint(entity this, vector pos, float max_dist) +{ + entity closest_target = NULL; + FOREACH_ENTITY_CLASS("onslaught_controlpoint", true, + { + if(SAME_TEAM(it, this)) + if(it.iscaptured) + if(max_dist <= 0 || vdist(it.origin - pos, <=, max_dist)) + if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL) + closest_target = it; + }); + FOREACH_ENTITY_CLASS("onslaught_generator", true, + { + if(SAME_TEAM(it, this)) + if(max_dist <= 0 || vdist(it.origin - pos, <, max_dist)) + if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL) + closest_target = it; + }); + + return closest_target; +} + +/* + * Find control point or generator owned by the same team self which is nearest to pos + * if max_dist is positive, only control points within this range will be considered + * This function only check distances on the XY plane, disregarding Z + */ +entity ons_Nearest_ControlPoint_2D(entity this, vector pos, float max_dist) +{ + entity closest_target = NULL; + vector delta; + float smallest_distance = 0, distance; + + FOREACH_ENTITY_CLASS("onslaught_controlpoint", true, + { + delta = it.origin - pos; + delta_z = 0; + distance = vlen(delta); + + if(SAME_TEAM(it, this)) + if(it.iscaptured) + if(max_dist <= 0 || distance <= max_dist) + if(closest_target == NULL || distance <= smallest_distance ) + { + closest_target = it; + smallest_distance = distance; + } + }); + FOREACH_ENTITY_CLASS("onslaught_generator", true, + { + delta = it.origin - pos; + delta_z = 0; + distance = vlen(delta); + + if(SAME_TEAM(it, this)) + if(max_dist <= 0 || distance <= max_dist) + if(closest_target == NULL || distance <= smallest_distance ) + { + closest_target = it; + smallest_distance = distance; + } + }); + + return closest_target; +} +/** + * find the number of control points and generators in the same team as this + */ +int ons_Count_SelfControlPoints(entity this) +{ + int n = 0; + FOREACH_ENTITY_CLASS("onslaught_controlpoint", true, + { + if(SAME_TEAM(it, this)) + if(it.iscaptured) + n++; + }); + FOREACH_ENTITY_CLASS("onslaught_generator", true, + { + if(SAME_TEAM(it, this)) + n++; + }); + return n; +} + +/** + * Teleport player to a random position near tele_target + * if tele_effects is true, teleport sound+particles are created + * return false on failure + */ +bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effects) +{ + if ( !tele_target ) + return false; + + int i; + vector loc; + float theta; + // narrow the range for each iteration to increase chances that a spawnpoint + // can be found even if there's little room around the control point + float iteration_scale = 1; + for(i = 0; i < 16; ++i) + { + iteration_scale -= i / 16; + theta = random() * 2 * M_PI; + loc_y = sin(theta); + loc_x = cos(theta); + loc_z = 0; + loc *= random() * range * iteration_scale; + + loc += tele_target.origin + '0 0 128' * iteration_scale; + + tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); + if(trace_fraction == 1.0 && !trace_startsolid) + { + traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the NULL + if(trace_fraction == 1.0 && !trace_startsolid) + { + if ( tele_effects ) + { + Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1); + sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM); + } + setorigin(player, loc); + player.angles = '0 1 0' * ( theta * RAD2DEG + 180 ); + makevectors(player.angles); + player.fixangle = true; + player.teleport_antispam = time + autocvar_g_onslaught_teleport_wait; + + if ( tele_effects ) + Send_Effect(EFFECT_TELEPORT, player.origin + v_forward * 32, '0 0 0', 1); + return true; + } + } + } + + return false; +} + +// ============== +// Hook Functions +// ============== + +MUTATOR_HOOKFUNCTION(ons, reset_map_global) +{ + FOREACH_CLIENT(IS_PLAYER(it), { + it.ons_roundlost = false; + it.ons_deathloc = '0 0 0'; + PutClientInServer(it); + }); + return false; +} + +MUTATOR_HOOKFUNCTION(ons, ClientDisconnect) +{ + entity player = M_ARGV(0, entity); + + player.ons_deathloc = '0 0 0'; +} + +MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver) +{ + entity player = M_ARGV(0, entity); + + player.ons_deathloc = '0 0 0'; +} + +MUTATOR_HOOKFUNCTION(ons, PlayerSpawn) +{ + entity player = M_ARGV(0, entity); + + if(!round_handler_IsRoundStarted()) + { + player.player_blocked = true; + return false; + } + + entity l; + for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) + { + l.sprite.SendFlags |= 16; + } + for(l = ons_worldcplist; l; l = l.ons_worldcpnext) + { + l.sprite.SendFlags |= 16; + } + + if(ons_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); } + + if ( autocvar_g_onslaught_spawn_choose ) + if ( player.ons_spawn_by ) + if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) ) + { + player.ons_spawn_by = NULL; + return false; + } + + if(autocvar_g_onslaught_spawn_at_controlpoints) + if(random() <= autocvar_g_onslaught_spawn_at_controlpoints_chance) + { + float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random; + entity tmp_entity, closest_target = NULL; + vector spawn_loc = player.ons_deathloc; + + // new joining player or round reset, don't bother checking + if(spawn_loc == '0 0 0') { return false; } + + if(random_target) { RandomSelection_Init(); } + + for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext) + { + if(SAME_TEAM(tmp_entity, player)) + if(random_target) + RandomSelection_Add(tmp_entity, 0, string_null, 1, 1); + else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL) + closest_target = tmp_entity; + } + + if(random_target) { closest_target = RandomSelection_chosen_ent; } + + if(closest_target) + { + float i; + vector loc; + float iteration_scale = 1; + for(i = 0; i < 10; ++i) + { + iteration_scale -= i / 10; + loc = closest_target.origin + '0 0 96' * iteration_scale; + loc += ('0 1 0' * random()) * 128 * iteration_scale; + tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); + if(trace_fraction == 1.0 && !trace_startsolid) + { + traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL + if(trace_fraction == 1.0 && !trace_startsolid) + { + setorigin(player, loc); + player.angles = normalize(loc - closest_target.origin) * RAD2DEG; + return false; + } + } + } + } + } + + if(autocvar_g_onslaught_spawn_at_generator) + if(random() <= autocvar_g_onslaught_spawn_at_generator_chance) + { + float random_target = autocvar_g_onslaught_spawn_at_generator_random; + entity tmp_entity, closest_target = NULL; + vector spawn_loc = player.ons_deathloc; + + // new joining player or round reset, don't bother checking + if(spawn_loc == '0 0 0') { return false; } + + if(random_target) { RandomSelection_Init(); } + + for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) + { + if(random_target) + RandomSelection_Add(tmp_entity, 0, string_null, 1, 1); + else + { + if(SAME_TEAM(tmp_entity, player)) + if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL) + closest_target = tmp_entity; + } + } + + if(random_target) { closest_target = RandomSelection_chosen_ent; } + + if(closest_target) + { + float i; + vector loc; + float iteration_scale = 1; + for(i = 0; i < 10; ++i) + { + iteration_scale -= i / 10; + loc = closest_target.origin + '0 0 128' * iteration_scale; + loc += ('0 1 0' * random()) * 256 * iteration_scale; + tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); + if(trace_fraction == 1.0 && !trace_startsolid) + { + traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL + if(trace_fraction == 1.0 && !trace_startsolid) + { + setorigin(player, loc); + player.angles = normalize(loc - closest_target.origin) * RAD2DEG; + return false; + } + } + } + } + } + + return false; +} + +MUTATOR_HOOKFUNCTION(ons, PlayerDies) +{ + entity frag_target = M_ARGV(2, entity); + + frag_target.ons_deathloc = frag_target.origin; + entity l; + for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) + { + l.sprite.SendFlags |= 16; + } + for(l = ons_worldcplist; l; l = l.ons_worldcpnext) + { + l.sprite.SendFlags |= 16; + } + + if ( autocvar_g_onslaught_spawn_choose ) + if ( ons_Count_SelfControlPoints(frag_target) > 1 ) + stuffcmd(frag_target, "qc_cmd_cl hud clickradar\n"); + + return false; +} + +MUTATOR_HOOKFUNCTION(ons, MonsterMove) +{ + entity mon = M_ARGV(0, entity); + + entity e = find(NULL, targetname, mon.target); + if (e != NULL) + mon.team = e.team; +} + +void ons_MonsterSpawn_Delayed(entity this) +{ + entity own = this.owner; + + if(!own) { delete(this); return; } + + if(own.targetname) + { + entity e = find(NULL, target, own.targetname); + if(e != NULL) + { + own.team = e.team; + + own.use(own, e, NULL); + } + } + + delete(this); +} + +MUTATOR_HOOKFUNCTION(ons, MonsterSpawn) +{ + entity mon = M_ARGV(0, entity); + + entity e = spawn(); + e.owner = mon; + InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET); +} + +void ons_TurretSpawn_Delayed(entity this) +{ + entity own = this.owner; + + if(!own) { delete(this); return; } + + if(own.targetname) + { + entity e = find(NULL, target, own.targetname); + if(e != NULL) + { + own.team = e.team; + own.active = ACTIVE_NOT; + + own.use(own, e, NULL); + } + } + + delete(this); +} + +MUTATOR_HOOKFUNCTION(ons, TurretSpawn) +{ + entity turret = M_ARGV(0, entity); + + entity e = spawn(); + e.owner = turret; + InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET); + + return false; +} + +MUTATOR_HOOKFUNCTION(ons, HavocBot_ChooseRole) +{ + entity bot = M_ARGV(0, entity); + + havocbot_ons_reset_role(bot); + return true; +} + +MUTATOR_HOOKFUNCTION(ons, GetTeamCount) +{ + // onslaught is special + for(entity tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) + { + switch(tmp_entity.team) + { + case NUM_TEAM_1: c1 = 0; break; + case NUM_TEAM_2: c2 = 0; break; + case NUM_TEAM_3: c3 = 0; break; + case NUM_TEAM_4: c4 = 0; break; + } + } + + return true; +} + +MUTATOR_HOOKFUNCTION(ons, SpectateCopy) +{ + entity spectatee = M_ARGV(0, entity); + entity client = M_ARGV(1, entity); + + client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too +} + +MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand) +{ + if(MUTATOR_RETURNVALUE) // command was already handled? + return false; + + entity player = M_ARGV(0, entity); + string cmd_name = M_ARGV(1, string); + int cmd_argc = M_ARGV(2, int); + + if ( cmd_name == "ons_spawn" ) + { + vector pos = player.origin; + if(cmd_argc > 1) + pos_x = stof(argv(1)); + if(cmd_argc > 2) + pos_y = stof(argv(2)); + if(cmd_argc > 3) + pos_z = stof(argv(3)); + + if ( IS_PLAYER(player) ) + { + if ( !STAT(FROZEN, player) ) + { + entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius); + + if ( !source_point && player.health > 0 ) + { + sprint(player, "\nYou need to be next to a control point\n"); + return true; + } + + + entity closest_target = ons_Nearest_ControlPoint_2D(player, pos, autocvar_g_onslaught_click_radius); + + if ( closest_target == NULL ) + { + sprint(player, "\nNo control point found\n"); + return true; + } + + if ( player.health <= 0 ) + { + player.ons_spawn_by = closest_target; + player.respawn_flags = player.respawn_flags | RESPAWN_FORCE; + } + else + { + if ( source_point == closest_target ) + { + sprint(player, "\nTeleporting to the same point\n"); + return true; + } + + if ( !ons_Teleport(player,closest_target,autocvar_g_onslaught_teleport_radius,true) ) + sprint(player, "\nUnable to teleport there\n"); + } + + return true; + } + + sprint(player, "\nNo teleportation for you\n"); + } + + return true; + } + return false; +} + +MUTATOR_HOOKFUNCTION(ons, PlayerUseKey) +{ + if(MUTATOR_RETURNVALUE || gameover) { return false; } + + entity player = M_ARGV(0, entity); + + if((time > player.teleport_antispam) && (!IS_DEAD(player)) && !player.vehicle) + { + entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius); + if ( source_point ) + { + stuffcmd(player, "qc_cmd_cl hud clickradar\n"); + return true; + } + } +} + +MUTATOR_HOOKFUNCTION(ons, PlayHitsound) +{ + entity frag_victim = M_ARGV(0, entity); + + return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded) + || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded); +} + +MUTATOR_HOOKFUNCTION(ons, SendWaypoint) +{ + entity wp = M_ARGV(0, entity); + entity to = M_ARGV(1, entity); + int sf = M_ARGV(2, int); + int wp_flag = M_ARGV(3, int); + + if(sf & 16) + { + if(wp.owner.classname == "onslaught_controlpoint") + { + entity wp_owner = wp.owner; + entity e = WaypointSprite_getviewentity(to); + if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; } + if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; } + } + if(wp.owner.classname == "onslaught_generator") + { + entity wp_owner = wp.owner; + if(wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { wp_flag |= 2; } + if(wp_owner.health <= 0) { wp_flag |= 2; } + } + } + + M_ARGV(3, int) = wp_flag; +} + +MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget) +{ + entity turret_target = M_ARGV(1, entity); + + if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job! + { + M_ARGV(3, float) = -3; + return true; + } + + return false; +} + +MUTATOR_HOOKFUNCTION(ons, TurretThink) +{ + entity turret = M_ARGV(0, entity); + + // ONS uses somewhat backwards linking. + if(turret.target) + { + entity e = find(NULL, targetname, turret.target); + if (e != NULL) + turret.team = e.team; + } + + if(turret.team != turret.tur_head.team) + turret_respawn(turret); +} + + +// ========== +// Spawnfuncs +// ========== + +/*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16) + Link between control points. + + This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams. + +keys: +"target" - first control point. +"target2" - second control point. + */ +spawnfunc(onslaught_link) +{ + if(!g_onslaught) { delete(this); return; } + + if (this.target == "" || this.target2 == "") + objerror(this, "target and target2 must be set\n"); + + this.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist + ons_worldlinklist = this; + + InitializeEntity(this, ons_DelayedLinkSetup, INITPRIO_FINDTARGET); + Net_LinkEntity(this, false, 0, ons_Link_Send); +} + +/*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128) + Control point. Be sure to give this enough clearance so that the shootable part has room to exist + + This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity. + +keys: +"targetname" - name that spawnfunc_onslaught_link entities will use to target this. +"target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities. +"message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc) + */ + +spawnfunc(onslaught_controlpoint) +{ + if(!g_onslaught) { delete(this); return; } + + ons_ControlPoint_Setup(this); +} + +/*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64) + Base generator. + + spawnfunc_onslaught_link entities can target this. + +keys: +"team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET. +"targetname" - name that spawnfunc_onslaught_link entities will use to target this. + */ +spawnfunc(onslaught_generator) +{ + if(!g_onslaught) { delete(this); return; } + if(!this.team) { objerror(this, "team must be set"); } + + ons_GeneratorSetup(this); +} + +// scoreboard setup +void ons_ScoreRules() +{ + CheckAllowedTeams(NULL); + int teams = 0; + if(c1 >= 0) teams |= BIT(0); + if(c2 >= 0) teams |= BIT(1); + if(c3 >= 0) teams |= BIT(2); + if(c4 >= 0) teams |= BIT(3); + ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true); + ScoreInfo_SetLabel_TeamScore (ST_ONS_CAPS, "destroyed", SFL_SORT_PRIO_PRIMARY); + ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY); + ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES, "takes", 0); + ScoreRules_basics_end(); +} + +void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up +{ + ons_ScoreRules(); + + round_handler_Spawn(Onslaught_CheckPlayers, Onslaught_CheckWinner, Onslaught_RoundStart); + round_handler_Init(5, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit); +} + +void ons_Initialize() +{ + g_onslaught = true; + ons_captureshield_force = autocvar_g_onslaught_shield_force; + + InitializeEntity(NULL, ons_DelayedInit, INITPRIO_GAMETYPE); +} diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh new file mode 100644 index 000000000..c8f94c9d8 --- /dev/null +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh @@ -0,0 +1,117 @@ +float autocvar_g_onslaught_point_limit; +void ons_Initialize(); + +REGISTER_MUTATOR(ons, false) +{ + MUTATOR_ONADD + { + if (time > 1) // game loads at time 1 + error("This is a game type and it cannot be added at runtime."); + ons_Initialize(); + + ActivateTeamplay(); + SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1); + have_team_spawns = -1; // request team spawns + } + + MUTATOR_ONROLLBACK_OR_REMOVE + { + // we actually cannot roll back ons_Initialize here + // BUT: we don't need to! If this gets called, adding always + // succeeds. + } + + MUTATOR_ONREMOVE + { + LOG_INFO("This is a game type and it cannot be removed at runtime."); + return -1; + } + + return false; +} + +.entity ons_toucher; // player who touched the control point + +// control point / generator constants +const float ONS_CP_THINKRATE = 0.2; +const float GEN_THINKRATE = 1; +#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13)) +const vector CPGEN_WAYPOINT_OFFSET = ('0 0 128'); +const vector CPICON_OFFSET = ('0 0 96'); + +// list of generators on the map +entity ons_worldgeneratorlist; +.entity ons_worldgeneratornext; +.entity ons_stalegeneratornext; + +// list of control points on the map +entity ons_worldcplist; +.entity ons_worldcpnext; +.entity ons_stalecpnext; + +// list of links on the map +entity ons_worldlinklist; +.entity ons_worldlinknext; +.entity ons_stalelinknext; + +// definitions +.entity sprite; +.string target2; +.int iscaptured; +.int islinked; +.int isshielded; +.float lasthealth; +.int lastteam; +.int lastshielded; +.int lastcaptured; + +.bool waslinked; + +bool ons_stalemate; + +.float teleport_antispam; + +.bool ons_roundlost = _STAT(ROUNDLOST); + +// waypoint sprites +.entity bot_basewaypoint; // generator waypointsprite + +.bool isgenneighbor[17]; +.bool iscpneighbor[17]; +float ons_notification_time[17]; + +.float ons_overtime_damagedelay; + +.vector ons_deathloc; + +.entity ons_spawn_by; + +// declarations for functions used outside gamemode_onslaught.qc +void ons_Generator_UpdateSprite(entity e); +void ons_ControlPoint_UpdateSprite(entity e); +bool ons_ControlPoint_Attackable(entity cp, int teamnumber); + +// CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet +float ons_captureshield_force; // push force of the shield + +// bot player logic +const int HAVOCBOT_ONS_ROLE_NONE = 0; +const int HAVOCBOT_ONS_ROLE_DEFENSE = 2; +const int HAVOCBOT_ONS_ROLE_ASSISTANT = 4; +const int HAVOCBOT_ONS_ROLE_OFFENSE = 8; + +.entity havocbot_ons_target; + +.int havocbot_role_flags; +.float havocbot_attack_time; + +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 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; diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/items/item/jetpack.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/_mod.inc b/qcsrc/common/minigames/_mod.inc index 43ad69de5..66693ef2a 100644 --- a/qcsrc/common/minigames/_mod.inc +++ b/qcsrc/common/minigames/_mod.inc @@ -1,5 +1,7 @@ // generated file; do not modify -#include +#ifdef CSQC + #include +#endif #include #ifdef CSQC #include diff --git a/qcsrc/common/minigames/_mod.qh b/qcsrc/common/minigames/_mod.qh index 36f5de2f1..9c3376003 100644 --- a/qcsrc/common/minigames/_mod.qh +++ b/qcsrc/common/minigames/_mod.qh @@ -1,3 +1,11 @@ // generated file; do not modify -#include +#ifdef CSQC + #include +#endif #include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/minigames/minigame/bd.qh b/qcsrc/common/minigames/minigame/bd.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/bd.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/c4.qh b/qcsrc/common/minigames/minigame/c4.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/c4.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/nmm.qh b/qcsrc/common/minigames/minigame/nmm.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/nmm.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/pong.qh b/qcsrc/common/minigames/minigame/pong.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/pong.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/pp.qh b/qcsrc/common/minigames/minigame/pp.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/pp.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/ps.qh b/qcsrc/common/minigames/minigame/ps.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/ps.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/snake.qh b/qcsrc/common/minigames/minigame/snake.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/snake.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/minigames/minigame/ttt.qh b/qcsrc/common/minigames/minigame/ttt.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/minigames/minigame/ttt.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/monsters/_mod.inc b/qcsrc/common/monsters/_mod.inc index f9d80b3f4..0478f09ee 100644 --- a/qcsrc/common/monsters/_mod.inc +++ b/qcsrc/common/monsters/_mod.inc @@ -1,4 +1,6 @@ // generated file; do not modify #include #include -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/monsters/_mod.qh b/qcsrc/common/monsters/_mod.qh index 48427f94f..39d594e4c 100644 --- a/qcsrc/common/monsters/_mod.qh +++ b/qcsrc/common/monsters/_mod.qh @@ -1,4 +1,6 @@ // generated file; do not modify #include #include -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/monsters/monster/mage.qh b/qcsrc/common/monsters/monster/mage.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/monsters/monster/mage.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/monsters/monster/shambler.qh b/qcsrc/common/monsters/monster/shambler.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/monsters/monster/shambler.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/monsters/monster/spider.qh b/qcsrc/common/monsters/monster/spider.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/monsters/monster/spider.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/monsters/monster/wyvern.qh b/qcsrc/common/monsters/monster/wyvern.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/monsters/monster/wyvern.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/monsters/monster/zombie.qh b/qcsrc/common/monsters/monster/zombie.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/monsters/monster/zombie.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/_all.inc b/qcsrc/common/mutators/_all.inc index 8bc63f720..65d709243 100644 --- a/qcsrc/common/mutators/_all.inc +++ b/qcsrc/common/mutators/_all.inc @@ -1,2 +1,4 @@ #include "_all.qh" #include "_mod.inc" + +#include "mutator/_all.inc" diff --git a/qcsrc/common/mutators/_all.qh b/qcsrc/common/mutators/_all.qh index 947026dd5..bae58a55c 100644 --- a/qcsrc/common/mutators/_all.qh +++ b/qcsrc/common/mutators/_all.qh @@ -1,2 +1,4 @@ #pragma once #include "_mod.qh" + +#include "mutator/_all.qh" diff --git a/qcsrc/common/mutators/_mod.inc b/qcsrc/common/mutators/_mod.inc index 8220b2d19..98fb4815c 100644 --- a/qcsrc/common/mutators/_mod.inc +++ b/qcsrc/common/mutators/_mod.inc @@ -1,2 +1 @@ // generated file; do not modify -#include diff --git a/qcsrc/common/mutators/_mod.qh b/qcsrc/common/mutators/_mod.qh index 5d6ac5628..98fb4815c 100644 --- a/qcsrc/common/mutators/_mod.qh +++ b/qcsrc/common/mutators/_mod.qh @@ -1,2 +1 @@ // generated file; do not modify -#include diff --git a/qcsrc/common/mutators/all.inc b/qcsrc/common/mutators/all.inc deleted file mode 100644 index 622587233..000000000 --- a/qcsrc/common/mutators/all.inc +++ /dev/null @@ -1,39 +0,0 @@ -#include "mutator/waypoints/module.inc" - -#include "mutator/itemstime.qc" -#include "mutator/multijump/module.inc" -#include "mutator/nades/module.inc" -#include "mutator/superspec/module.inc" - -// completely self contained - -#include "mutator/bloodloss/module.inc" -#include "mutator/breakablehook/module.inc" -#include "mutator/buffs/module.inc" -#include "mutator/bugrigs/module.inc" -#include "mutator/campcheck/module.inc" -#include "mutator/cloaked/module.inc" -#include "mutator/damagetext/module.inc" -#include "mutator/dodging/module.inc" -#include "mutator/doublejump/module.inc" -#include "mutator/globalforces/module.inc" -#include "mutator/hook/module.inc" -#include "mutator/instagib/module.inc" -#include "mutator/invincibleproj/module.inc" -#include "mutator/melee_only/module.inc" -#include "mutator/midair/module.inc" -#include "mutator/new_toys/module.inc" -#include "mutator/nix/module.inc" -#include "mutator/overkill/module.inc" -#include "mutator/physical_items/module.inc" -#include "mutator/pinata/module.inc" -#include "mutator/random_gravity/module.inc" -#include "mutator/rocketflying/module.inc" -#include "mutator/rocketminsta/module.inc" -#include "mutator/running_guns/module.inc" -#include "mutator/sandbox/module.inc" -#include "mutator/spawn_near_teammate/module.inc" -#include "mutator/touchexplode/module.inc" -#include "mutator/vampirehook/module.inc" -#include "mutator/vampire/module.inc" -#include "mutator/weaponarena_random/module.inc" diff --git a/qcsrc/common/mutators/all.qc b/qcsrc/common/mutators/all.qc deleted file mode 100644 index f0fc7195a..000000000 --- a/qcsrc/common/mutators/all.qc +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.qh" - -#define IMPLEMENTATION -#include "all.inc" -#undef IMPLEMENTATION diff --git a/qcsrc/common/mutators/all.qh b/qcsrc/common/mutators/all.qh deleted file mode 100644 index ceb4b51dd..000000000 --- a/qcsrc/common/mutators/all.qh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MUTATORS_ALL_H -#define MUTATORS_ALL_H - -#include "all.inc" - -#endif diff --git a/qcsrc/common/mutators/mutator/_all.inc b/qcsrc/common/mutators/mutator/_all.inc new file mode 100644 index 000000000..9b557a22b --- /dev/null +++ b/qcsrc/common/mutators/mutator/_all.inc @@ -0,0 +1,43 @@ +#include "_all.qh" +#include "_mod.inc" + +#include "waypoints/_mod.inc" + +#include "itemstime/_mod.inc" +#include "multijump/_mod.inc" +#include "nades/_mod.inc" +#include "superspec/_mod.inc" + +// completely self contained + +#include "bloodloss/_mod.inc" +#include "breakablehook/_mod.inc" +#include "buffs/_mod.inc" +#include "bugrigs/_mod.inc" +#include "campcheck/_mod.inc" +#include "cloaked/_mod.inc" +#include "damagetext/_mod.inc" +#include "dodging/_mod.inc" +#include "doublejump/_mod.inc" +#include "globalforces/_mod.inc" +#include "hook/_mod.inc" +#include "instagib/_mod.inc" +#include "invincibleproj/_mod.inc" +#include "melee_only/_mod.inc" +#include "midair/_mod.inc" +#include "new_toys/_mod.inc" +#include "nix/_mod.inc" +#include "overkill/_mod.inc" +#include "physical_items/_mod.inc" +#include "pinata/_mod.inc" +#include "random_gravity/_mod.inc" +#include "rocketflying/_mod.inc" +#include "rocketminsta/_mod.inc" +#include "running_guns/_mod.inc" +#include "sandbox/_mod.inc" +#include "spawn_near_teammate/_mod.inc" +#include "touchexplode/_mod.inc" +#include "vampirehook/_mod.inc" +#include "vampire/_mod.inc" +#include "weaponarena_random/_mod.inc" + diff --git a/qcsrc/common/mutators/mutator/_all.qh b/qcsrc/common/mutators/mutator/_all.qh new file mode 100644 index 000000000..b49167e7e --- /dev/null +++ b/qcsrc/common/mutators/mutator/_all.qh @@ -0,0 +1,43 @@ +#pragma once +#include "_mod.qh" + +#include "waypoints/_mod.qh" + +#include "itemstime/_mod.qh" +#include "multijump/_mod.qh" +#include "nades/_mod.qh" +#include "superspec/_mod.qh" + +// completely self contained + +#include "bloodloss/_mod.qh" +#include "breakablehook/_mod.qh" +#include "buffs/_mod.qh" +#include "bugrigs/_mod.qh" +#include "campcheck/_mod.qh" +#include "cloaked/_mod.qh" +#include "damagetext/_mod.qh" +#include "dodging/_mod.qh" +#include "doublejump/_mod.qh" +#include "globalforces/_mod.qh" +#include "hook/_mod.qh" +#include "instagib/_mod.qh" +#include "invincibleproj/_mod.qh" +#include "melee_only/_mod.qh" +#include "midair/_mod.qh" +#include "new_toys/_mod.qh" +#include "nix/_mod.qh" +#include "overkill/_mod.qh" +#include "physical_items/_mod.qh" +#include "pinata/_mod.qh" +#include "random_gravity/_mod.qh" +#include "rocketflying/_mod.qh" +#include "rocketminsta/_mod.qh" +#include "running_guns/_mod.qh" +#include "sandbox/_mod.qh" +#include "spawn_near_teammate/_mod.qh" +#include "touchexplode/_mod.qh" +#include "vampirehook/_mod.qh" +#include "vampire/_mod.qh" +#include "weaponarena_random/_mod.qh" + diff --git a/qcsrc/common/mutators/mutator/_mod.inc b/qcsrc/common/mutators/mutator/_mod.inc index 30d67e34b..98fb4815c 100644 --- a/qcsrc/common/mutators/mutator/_mod.inc +++ b/qcsrc/common/mutators/mutator/_mod.inc @@ -1,2 +1 @@ // generated file; do not modify -#include diff --git a/qcsrc/common/mutators/mutator/_mod.qh b/qcsrc/common/mutators/mutator/_mod.qh index ac056ac68..98fb4815c 100644 --- a/qcsrc/common/mutators/mutator/_mod.qh +++ b/qcsrc/common/mutators/mutator/_mod.qh @@ -1,2 +1 @@ // generated file; do not modify -#include diff --git a/qcsrc/common/mutators/mutator/bloodloss/_mod.inc b/qcsrc/common/mutators/mutator/bloodloss/_mod.inc index 16e6308ac..768808db7 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/_mod.inc +++ b/qcsrc/common/mutators/mutator/bloodloss/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/bloodloss/_mod.qh b/qcsrc/common/mutators/mutator/bloodloss/_mod.qh index b1d45e279..e6ad248c6 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/_mod.qh +++ b/qcsrc/common/mutators/mutator/bloodloss/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/bloodloss/module.inc b/qcsrc/common/mutators/mutator/bloodloss/module.inc deleted file mode 100644 index d3f665a18..000000000 --- a/qcsrc/common/mutators/mutator/bloodloss/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "bloodloss.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc similarity index 97% rename from qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc rename to qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc index a335bf1cc..61b0c0601 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc +++ b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_bloodloss.qh" + REGISTER_MUTATOR(bloodloss, cvar("g_bloodloss")); .float bloodloss_timer; @@ -40,4 +41,3 @@ MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss"); } -#endif diff --git a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/breakablehook/_mod.inc b/qcsrc/common/mutators/mutator/breakablehook/_mod.inc index bdbbae46c..11a080ef4 100644 --- a/qcsrc/common/mutators/mutator/breakablehook/_mod.inc +++ b/qcsrc/common/mutators/mutator/breakablehook/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/breakablehook/_mod.qh b/qcsrc/common/mutators/mutator/breakablehook/_mod.qh index 8a41908af..f8b2d1bc6 100644 --- a/qcsrc/common/mutators/mutator/breakablehook/_mod.qh +++ b/qcsrc/common/mutators/mutator/breakablehook/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/breakablehook/module.inc b/qcsrc/common/mutators/mutator/breakablehook/module.inc deleted file mode 100644 index 484eb4c56..000000000 --- a/qcsrc/common/mutators/mutator/breakablehook/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "breakablehook.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/breakablehook/breakablehook.qc b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc similarity index 96% rename from qcsrc/common/mutators/mutator/breakablehook/breakablehook.qc rename to qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc index ca266eb5a..fdb0dc38d 100644 --- a/qcsrc/common/mutators/mutator/breakablehook/breakablehook.qc +++ b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_breakablehook.qh" + #include #include @@ -27,4 +28,3 @@ MUTATOR_HOOKFUNCTION(breakablehook, PlayerDamage_Calculate) } } } -#endif diff --git a/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/buffs/_mod.inc b/qcsrc/common/mutators/mutator/buffs/_mod.inc index c06263a92..715a3acfc 100644 --- a/qcsrc/common/mutators/mutator/buffs/_mod.inc +++ b/qcsrc/common/mutators/mutator/buffs/_mod.inc @@ -1,3 +1,8 @@ // generated file; do not modify -#include #include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/buffs/_mod.qh b/qcsrc/common/mutators/mutator/buffs/_mod.qh index 2133c7250..78217bb46 100644 --- a/qcsrc/common/mutators/mutator/buffs/_mod.qh +++ b/qcsrc/common/mutators/mutator/buffs/_mod.qh @@ -1,3 +1,8 @@ // generated file; do not modify -#include #include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/buffs/all.qc b/qcsrc/common/mutators/mutator/buffs/all.qc deleted file mode 100644 index b05675162..000000000 --- a/qcsrc/common/mutators/mutator/buffs/all.qc +++ /dev/null @@ -1 +0,0 @@ -#include "all.qh" diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 29a0a3925..f38d39d61 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -1,1081 +1,16 @@ -#ifndef MUTATOR_BUFFS_H -#define MUTATOR_BUFFS_H +#include "buffs.qh" -#include "../instagib/module.inc" - -bool autocvar_g_buffs_effects; -float autocvar_g_buffs_waypoint_distance; -bool autocvar_g_buffs_randomize; -float autocvar_g_buffs_random_lifetime; -bool autocvar_g_buffs_random_location; -int autocvar_g_buffs_random_location_attempts; -int autocvar_g_buffs_spawn_count; -bool autocvar_g_buffs_replace_powerups; -float autocvar_g_buffs_cooldown_activate; -float autocvar_g_buffs_cooldown_respawn; -float autocvar_g_buffs_resistance_blockpercent; -float autocvar_g_buffs_medic_survive_chance; -float autocvar_g_buffs_medic_survive_health; -float autocvar_g_buffs_medic_rot; -float autocvar_g_buffs_medic_max; -float autocvar_g_buffs_medic_regen; -float autocvar_g_buffs_medic_heal_amount = 15; -float autocvar_g_buffs_medic_heal_delay = 1; -float autocvar_g_buffs_medic_heal_range = 400; -float autocvar_g_buffs_vengeance_damage_multiplier; -float autocvar_g_buffs_bash_force; -float autocvar_g_buffs_bash_force_self; -float autocvar_g_buffs_disability_slowtime; -float autocvar_g_buffs_disability_speed; -float autocvar_g_buffs_disability_rate; -float autocvar_g_buffs_disability_weaponspeed; -float autocvar_g_buffs_speed_speed; -float autocvar_g_buffs_speed_rate; -float autocvar_g_buffs_speed_weaponspeed; -float autocvar_g_buffs_speed_damage_take; -float autocvar_g_buffs_speed_regen; -float autocvar_g_buffs_vampire_damage_steal; -float autocvar_g_buffs_invisible_alpha; -float autocvar_g_buffs_jump_height; -float autocvar_g_buffs_inferno_burntime_factor; -float autocvar_g_buffs_inferno_burntime_min_time; -float autocvar_g_buffs_inferno_burntime_target_damage; -float autocvar_g_buffs_inferno_burntime_target_time; -float autocvar_g_buffs_inferno_damagemultiplier; -float autocvar_g_buffs_swapper_range; -float autocvar_g_buffs_magnet_range_item; -float autocvar_g_buffs_magnet_range_buff = 200; -float autocvar_g_buffs_luck_chance = 0.15; -float autocvar_g_buffs_luck_damagemultiplier = 3; - -// ammo -.float buff_ammo_prev_infitems; -.int buff_ammo_prev_clipload; -// invisible -.float buff_invisible_prev_alpha; -// medic -.float buff_medic_healtime; -// disability -.float buff_disability_time; -.float buff_disability_effect_time; -// common buff variables -.float buff_effect_delay; - -// buff definitions -.float buff_active; -.float buff_activetime; -.float buff_activetime_updated; -.entity buff_waypoint; -.int oldbuffs; // for updating effects -.entity buff_model; // controls effects (TODO: make csqc) - -const vector BUFF_MIN = ('-16 -16 -20'); -const vector BUFF_MAX = ('16 16 20'); - -// client side options -.float cvar_cl_buffs_autoreplace; -#endif - -#ifdef IMPLEMENTATION - -#include -#include - -.float buff_time = _STAT(BUFF_TIME); -void buffs_DelayedInit(entity this); - -REGISTER_MUTATOR(buffs, cvar("g_buffs")) -{ - MUTATOR_ONADD - { - InitializeEntity(NULL, buffs_DelayedInit, INITPRIO_FINDTARGET); - } -} - -bool buffs_BuffModel_Customize(entity this, entity client) -{ - entity player, myowner; - bool same_team; - - player = WaypointSprite_getviewentity(client); - myowner = this.owner; - same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner)); - - if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0) - return false; - - if(MUTATOR_CALLHOOK(BuffModel_Customize, this, player)) - return false; - - if(player == myowner || (IS_SPEC(client) && client.enemy == myowner)) - { - // somewhat hide the model, but keep the glow - this.effects = 0; - this.alpha = -1; - } - else - { - this.effects = EF_FULLBRIGHT | EF_LOWPRECISION; - this.alpha = 1; - } - return true; -} - -void buffs_BuffModel_Spawn(entity player) -{ - player.buff_model = spawn(); - setmodel(player.buff_model, MDL_BUFF); - setsize(player.buff_model, '0 0 -40', '0 0 40'); - setattachment(player.buff_model, player, ""); - setorigin(player.buff_model, '0 0 1' * (player.buff_model.maxs.z * 1)); - player.buff_model.owner = player; - player.buff_model.scale = 0.7; - player.buff_model.pflags = PFLAGS_FULLDYNAMIC; - player.buff_model.light_lev = 200; - setcefc(player.buff_model, buffs_BuffModel_Customize); -} - -vector buff_GlowColor(entity buff) -{ - //if(buff.team) { return Team_ColorRGB(buff.team); } - return buff.m_color; -} - -void buff_Effect(entity player, string eff) -{ - if(!autocvar_g_buffs_effects) { return; } - - if(time >= player.buff_effect_delay) - { - Send_Effect_(eff, player.origin + ((player.mins + player.maxs) * 0.5), '0 0 0', 1); - player.buff_effect_delay = time + 0.05; // prevent spam - } -} - -// buff item -bool buff_Waypoint_visible_for_player(entity this, entity player, entity view) -{ - if(!this.owner.buff_active && !this.owner.buff_activetime) - return false; - - if (view.buffs) - { - return view.cvar_cl_buffs_autoreplace == false || view.buffs != this.owner.buffs; - } - - return WaypointSprite_visible_for_player(this, player, view); -} - -void buff_Waypoint_Spawn(entity e) -{ - entity buff = buff_FirstFromFlags(e.buffs); - entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team, e, buff_waypoint, true, RADARICON_Buff); - wp.wp_extra = buff.m_id; - WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod); - e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player; -} - -void buff_SetCooldown(entity this, float cd) -{ - cd = max(0, cd); - - if(!this.buff_waypoint) - buff_Waypoint_Spawn(this); - - WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + cd); - this.buff_activetime = cd; - this.buff_active = !cd; -} - -void buff_Respawn(entity this) -{ - if(gameover) { return; } - - vector oldbufforigin = this.origin; - this.velocity = '0 0 200'; - - if(!MoveToRandomMapLocation(this, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, - ((autocvar_g_buffs_random_location_attempts > 0) ? autocvar_g_buffs_random_location_attempts : 10), 1024, 256)) - { - entity spot = SelectSpawnPoint(this, true); - setorigin(this, spot.origin); - this.velocity = ((randomvec() * 100) + '0 0 200'); - this.angles = spot.angles; - } - - tracebox(this.origin, this.mins * 1.5, this.maxs * 1.5, this.origin, MOVE_NOMONSTERS, this); - - setorigin(this, trace_endpos); // attempt to unstick - - set_movetype(this, MOVETYPE_TOSS); - - makevectors(this.angles); - this.angles = '0 0 0'; - if(autocvar_g_buffs_random_lifetime > 0) - this.lifetime = time + autocvar_g_buffs_random_lifetime; - - Send_Effect(EFFECT_ELECTRO_COMBO, oldbufforigin + ((this.mins + this.maxs) * 0.5), '0 0 0', 1); - Send_Effect(EFFECT_ELECTRO_COMBO, CENTER_OR_VIEWOFS(this), '0 0 0', 1); - - WaypointSprite_Ping(this.buff_waypoint); - - sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) -} - -void buff_Touch(entity this, entity toucher) -{ - if(gameover) { return; } - - if(ITEM_TOUCH_NEEDKILL()) - { - buff_Respawn(this); - return; - } - - if((this.team && DIFF_TEAM(toucher, this)) - || (STAT(FROZEN, toucher)) - || (toucher.vehicle) - || (!this.buff_active) - ) - { - // can't touch this - return; - } - - if(MUTATOR_CALLHOOK(BuffTouch, this, toucher)) - return; - toucher = M_ARGV(1, entity); - - if(!IS_PLAYER(toucher)) - return; // incase mutator changed toucher - - if (toucher.buffs) - { - if (toucher.cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs) - { - int buffid = buff_FirstFromFlags(toucher.buffs).m_id; - //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, toucher.buffs); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid); - - toucher.buffs = 0; - //sound(toucher, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); - } - else { return; } // do nothing - } - - this.owner = toucher; - this.buff_active = false; - this.lifetime = 0; - int buffid = buff_FirstFromFlags(this.buffs).m_id; - Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_GOT, buffid); - Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF, toucher.netname, buffid); - - Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1); - sound(toucher, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM); - toucher.buffs |= (this.buffs); -} - -float buff_Available(entity buff) -{ - if (buff == BUFF_Null) - return false; - if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_AMMO) || (cvar("g_melee_only")))) - return false; - if (buff == BUFF_VAMPIRE && cvar("g_vampire")) - return false; - return cvar(strcat("g_buffs_", buff.m_name)); -} - -.int buff_seencount; - -void buff_NewType(entity ent, float cb) -{ - RandomSelection_Init(); - FOREACH(Buffs, buff_Available(it), LAMBDA( - it.buff_seencount += 1; - // if it's already been chosen, give it a lower priority - RandomSelection_Add(NULL, it.m_itemid, string_null, 1, max(0.2, 1 / it.buff_seencount)); - )); - ent.buffs = RandomSelection_chosen_float; -} - -void buff_Think(entity this) -{ - if(this.buffs != this.oldbuffs) - { - entity buff = buff_FirstFromFlags(this.buffs); - this.color = buff.m_color; - this.glowmod = buff_GlowColor(buff); - this.skin = buff.m_skin; - - setmodel(this, MDL_BUFF); - - if(this.buff_waypoint) - { - //WaypointSprite_Disown(this.buff_waypoint, 1); - WaypointSprite_Kill(this.buff_waypoint); - buff_Waypoint_Spawn(this); - if(this.buff_activetime) - WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + this.buff_activetime - frametime); - } - - this.oldbuffs = this.buffs; - } - - if(!gameover) - if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime) - if(!this.buff_activetime_updated) - { - buff_SetCooldown(this, this.buff_activetime); - this.buff_activetime_updated = true; - } - - if(!this.buff_active && !this.buff_activetime) - if(!this.owner || STAT(FROZEN, this.owner) || IS_DEAD(this.owner) || !this.owner.iscreature || !(this.owner.buffs & this.buffs)) - { - buff_SetCooldown(this, autocvar_g_buffs_cooldown_respawn + frametime); - this.owner = NULL; - if(autocvar_g_buffs_randomize) - buff_NewType(this, this.buffs); - - if(autocvar_g_buffs_random_location || (this.spawnflags & 64)) - buff_Respawn(this); - } - - if(this.buff_activetime) - if(!gameover) - if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime) - { - this.buff_activetime = max(0, this.buff_activetime - frametime); - - if(!this.buff_activetime) - { - this.buff_active = true; - sound(this, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTN_NORM); - Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(this), '0 0 0', 1); - } - } - - if(this.buff_active) - { - if(this.team && !this.buff_waypoint) - buff_Waypoint_Spawn(this); - - if(this.lifetime) - if(time >= this.lifetime) - buff_Respawn(this); - } - - this.nextthink = time; - //this.angles_y = time * 110.1; -} - -void buff_Waypoint_Reset(entity this) -{ - WaypointSprite_Kill(this.buff_waypoint); - - if(this.buff_activetime) { buff_Waypoint_Spawn(this); } -} - -void buff_Reset(entity this) -{ - if(autocvar_g_buffs_randomize) - buff_NewType(this, this.buffs); - this.owner = NULL; - buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate); - buff_Waypoint_Reset(this); - this.buff_activetime_updated = false; - - if(autocvar_g_buffs_random_location || (this.spawnflags & 64)) - buff_Respawn(this); -} - -bool buff_Customize(entity this, entity client) -{ - entity player = WaypointSprite_getviewentity(client); - if(!this.buff_active || (this.team && DIFF_TEAM(player, this))) - { - this.alpha = 0.3; - if(this.effects & EF_FULLBRIGHT) { this.effects &= ~(EF_FULLBRIGHT); } - this.pflags = 0; - } - else - { - this.alpha = 1; - if(!(this.effects & EF_FULLBRIGHT)) { this.effects |= EF_FULLBRIGHT; } - this.light_lev = 220 + 36 * sin(time); - this.pflags = PFLAGS_FULLDYNAMIC; - } - return true; -} - -void buff_Init(entity this) -{ - if(!cvar("g_buffs")) { delete(this); return; } - - if(!teamplay && this.team) { this.team = 0; } - - entity buff = buff_FirstFromFlags(this.buffs); - - if(!this.buffs || buff_Available(buff)) - buff_NewType(this, 0); - - this.classname = "item_buff"; - this.solid = SOLID_TRIGGER; - this.flags = FL_ITEM; - setthink(this, buff_Think); - settouch(this, buff_Touch); - this.reset = buff_Reset; - this.nextthink = time + 0.1; - this.gravity = 1; - set_movetype(this, MOVETYPE_TOSS); - this.scale = 1; - this.skin = buff.m_skin; - this.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW; - this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; - setcefc(this, buff_Customize); - //this.gravity = 100; - this.color = buff.m_color; - this.glowmod = buff_GlowColor(this); - buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate + game_starttime); - this.buff_active = !this.buff_activetime; - this.pflags = PFLAGS_FULLDYNAMIC; - - if(this.spawnflags & 1) - this.noalign = true; - - if(this.noalign) - set_movetype(this, MOVETYPE_NONE); // reset by random location - - setmodel(this, MDL_BUFF); - setsize(this, BUFF_MIN, BUFF_MAX); - - if(cvar("g_buffs_random_location") || (this.spawnflags & 64)) - buff_Respawn(this); -} - -void buff_Init_Compat(entity ent, entity replacement) -{ - if (ent.spawnflags & 2) - ent.team = NUM_TEAM_1; - else if (ent.spawnflags & 4) - ent.team = NUM_TEAM_2; - - ent.buffs = replacement.m_itemid; - - buff_Init(ent); -} - -void buff_SpawnReplacement(entity ent, entity old) -{ - setorigin(ent, old.origin); - ent.angles = old.angles; - ent.noalign = (old.noalign || (old.spawnflags & 1)); - - buff_Init(ent); -} - -void buff_Vengeance_DelayedDamage(entity this) -{ - if(this.enemy) - Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, this.enemy.origin, '0 0 0'); - - delete(this); - return; -} - -// note: only really useful in teamplay -void buff_Medic_Heal(entity this) -{ - FOREACH_CLIENT(IS_PLAYER(it) && it != this && vdist(it.origin - this.origin, <=, autocvar_g_buffs_medic_heal_range), - { - if(SAME_TEAM(it, this)) - if(it.health < autocvar_g_balance_health_regenstable) - { - Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); - it.health = bound(0, it.health + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable); - } - }); -} - -float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base) -{ - return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base); -} - -// mutator hooks -MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor) -{ - entity frag_target = M_ARGV(2, entity); - float frag_deathtype = M_ARGV(6, float); - float frag_damage = M_ARGV(7, float); - - if(frag_deathtype == DEATH_BUFF.m_id) { return; } - - if(frag_target.buffs & BUFF_RESISTANCE.m_itemid) - { - vector v = healtharmor_applydamage(50, autocvar_g_buffs_resistance_blockpercent, frag_deathtype, frag_damage); - M_ARGV(4, float) = v.x; // take - M_ARGV(5, float) = v.y; // save - } -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate) -{ - entity frag_attacker = M_ARGV(1, entity); - entity frag_target = M_ARGV(2, entity); - float frag_deathtype = M_ARGV(3, float); - float frag_damage = M_ARGV(4, float); - vector frag_force = M_ARGV(6, vector); - - if(frag_deathtype == DEATH_BUFF.m_id) { return; } - - if(frag_target.buffs & BUFF_SPEED.m_itemid) - if(frag_target != frag_attacker) - frag_damage *= autocvar_g_buffs_speed_damage_take; - - if(frag_target.buffs & BUFF_MEDIC.m_itemid) - if((frag_target.health - frag_damage) <= 0) - if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) - if(frag_attacker) - if(random() <= autocvar_g_buffs_medic_survive_chance) - frag_damage = max(5, frag_target.health - autocvar_g_buffs_medic_survive_health); - - if(frag_target.buffs & BUFF_JUMP.m_itemid) - if(frag_deathtype == DEATH_FALL.m_id) - frag_damage = 0; - - if(frag_target.buffs & BUFF_VENGEANCE.m_itemid) - if(frag_attacker) - if(frag_attacker != frag_target) - if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) - { - entity dmgent = spawn(); - - dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier; - dmgent.enemy = frag_attacker; - dmgent.owner = frag_target; - setthink(dmgent, buff_Vengeance_DelayedDamage); - dmgent.nextthink = time + 0.1; - } - - if(frag_target.buffs & BUFF_BASH.m_itemid) - if(frag_attacker != frag_target) - frag_force = '0 0 0'; - - if(frag_attacker.buffs & BUFF_BASH.m_itemid) - if(frag_force) - if(frag_attacker == frag_target) - frag_force *= autocvar_g_buffs_bash_force_self; - else - frag_force *= autocvar_g_buffs_bash_force; - - if(frag_attacker.buffs & BUFF_DISABILITY.m_itemid) - if(frag_target != frag_attacker) - frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime; - - if(frag_target.buffs & BUFF_INFERNO.m_itemid) - { - if(frag_deathtype == DEATH_FIRE.m_id) - frag_damage = 0; - if(frag_deathtype == DEATH_LAVA.m_id) - frag_damage *= 0.5; // TODO: cvarize? - } - - if(frag_attacker.buffs & BUFF_LUCK.m_itemid) - if(frag_attacker != frag_target) - if(autocvar_g_buffs_luck_damagemultiplier > 0) - if(random() <= autocvar_g_buffs_luck_chance) - frag_damage *= autocvar_g_buffs_luck_damagemultiplier; - - if(frag_attacker.buffs & BUFF_INFERNO.m_itemid) - if(frag_target != frag_attacker) { - float btime = buff_Inferno_CalculateTime( - frag_damage, - 0, - autocvar_g_buffs_inferno_burntime_min_time, - autocvar_g_buffs_inferno_burntime_target_damage, - autocvar_g_buffs_inferno_burntime_target_time, - autocvar_g_buffs_inferno_burntime_factor - ); - Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier), btime, DEATH_BUFF.m_id); - } - - // this... is ridiculous (TODO: fix!) - if(frag_attacker.buffs & BUFF_VAMPIRE.m_itemid) - if(!frag_target.vehicle) - if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) - if(!IS_DEAD(frag_target)) - if(IS_PLAYER(frag_target) || IS_MONSTER(frag_target)) - if(frag_attacker != frag_target) - if(!STAT(FROZEN, frag_target)) - if(frag_target.takedamage) - if(DIFF_TEAM(frag_attacker, frag_target)) - { - frag_attacker.health = bound(0, frag_attacker.health + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.health), g_pickup_healthsmall_max); - if(frag_target.armorvalue) - frag_attacker.armorvalue = bound(0, frag_attacker.armorvalue + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.armorvalue), g_pickup_armorsmall_max); - } - - M_ARGV(4, float) = frag_damage; - M_ARGV(6, vector) = frag_force; -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn) -{ - entity player = M_ARGV(0, entity); - - player.buffs = 0; - player.buff_time = 0; - // reset timers here to prevent them continuing after re-spawn - player.buff_disability_time = 0; - player.buff_disability_effect_time = 0; -} - -.float stat_sv_maxspeed; -.float stat_sv_airspeedlimit_nonqw; -.float stat_sv_jumpvelocity; - -MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics) -{ - entity player = M_ARGV(0, entity); - - if(player.buffs & BUFF_SPEED.m_itemid) - { - player.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed; - player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed; - } - - if(time < player.buff_disability_time) - { - player.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed; - player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed; - } - - if(player.buffs & BUFF_JUMP.m_itemid) - { - // automatically reset, no need to worry - player.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height; - } -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerJump) -{ - entity player = M_ARGV(0, entity); - - if(player.buffs & BUFF_JUMP.m_itemid) - M_ARGV(1, float) = autocvar_g_buffs_jump_height; -} - -MUTATOR_HOOKFUNCTION(buffs, MonsterMove) -{ - entity mon = M_ARGV(0, entity); - - if(time < mon.buff_disability_time) - { - M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed - M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed - } -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerDies) -{ - entity frag_target = M_ARGV(2, entity); - - if(frag_target.buffs) - { - int buffid = buff_FirstFromFlags(frag_target.buffs).m_id; - Send_Notification(NOTIF_ALL_EXCEPT, frag_target, MSG_INFO, INFO_ITEM_BUFF_LOST, frag_target.netname, buffid); - frag_target.buffs = 0; - - if(frag_target.buff_model) - { - delete(frag_target.buff_model); - frag_target.buff_model = NULL; - } - } -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST) -{ - if(MUTATOR_RETURNVALUE || gameover) { return; } - - entity player = M_ARGV(0, entity); - - if(player.buffs) - { - int buffid = buff_FirstFromFlags(player.buffs).m_id; - Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid); - Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid); - - player.buffs = 0; - player.buff_time = 0; // already notified - sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); - return true; - } -} - -MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) -{ - if(MUTATOR_RETURNVALUE || gameover) { return; } - entity player = M_ARGV(0, entity); - - if(player.buffs & BUFF_SWAPPER.m_itemid) - { - float best_distance = autocvar_g_buffs_swapper_range; - entity closest = NULL; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( - if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle) - if(DIFF_TEAM(it, player)) - { - float test = vlen2(player.origin - it.origin); - if(test <= best_distance * best_distance) - { - best_distance = sqrt(test); - closest = it; - } - } - )); - - if(closest) - { - vector my_org, my_vel, my_ang, their_org, their_vel, their_ang; - - my_org = player.origin; - my_vel = player.velocity; - my_ang = player.angles; - their_org = closest.origin; - their_vel = closest.velocity; - their_ang = closest.angles; - - Drop_Special_Items(closest); - - MUTATOR_CALLHOOK(PortalTeleport, player); // initiate flag dropper - - setorigin(player, their_org); - setorigin(closest, my_org); - - closest.velocity = my_vel; - closest.angles = my_ang; - closest.fixangle = true; - closest.oldorigin = my_org; - closest.oldvelocity = my_vel; - player.velocity = their_vel; - player.angles = their_ang; - player.fixangle = true; - player.oldorigin = their_org; - player.oldvelocity = their_vel; - - // set pusher so player gets the kill if they fall into void - closest.pusher = player; - closest.pushltime = time + autocvar_g_maxpushtime; - closest.istypefrag = PHYS_INPUT_BUTTON_CHAT(closest); - - Send_Effect(EFFECT_ELECTRO_COMBO, their_org, '0 0 0', 1); - Send_Effect(EFFECT_ELECTRO_COMBO, my_org, '0 0 0', 1); - - sound(player, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); - sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); - - // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam - player.buffs = 0; - return true; - } - } -} - -bool buffs_RemovePlayer(entity player) -{ - if(player.buff_model) - { - delete(player.buff_model); - player.buff_model = NULL; - } - - // also reset timers here to prevent them continuing after spectating - player.buff_disability_time = 0; - player.buff_disability_effect_time = 0; - - return false; -} -MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); } -MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); } - -MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint) -{ - entity wp = M_ARGV(0, entity); - entity player = M_ARGV(1, entity); - - entity e = WaypointSprite_getviewentity(player); - - // if you have the invisibility powerup, sprites ALWAYS are restricted to your team - // but only apply this to real players, not to spectators - if((wp.owner.flags & FL_CLIENT) && (wp.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == player)) - if(DIFF_TEAM(wp.owner, e)) - return true; -} - -MUTATOR_HOOKFUNCTION(buffs, OnEntityPreSpawn, CBC_ORDER_LAST) -{ - entity ent = M_ARGV(0, entity); - - if(autocvar_g_buffs_replace_powerups) - switch(ent.classname) - { - case "item_strength": - case "item_invincible": - { - entity e = spawn(); - buff_SpawnReplacement(e, ent); - return true; - } - } -} - -MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor) -{ - entity player = M_ARGV(1, entity); - - if(player.buffs & BUFF_SPEED.m_itemid) - M_ARGV(0, float) *= autocvar_g_buffs_speed_rate; - - if(time < player.buff_disability_time) - M_ARGV(0, float) *= autocvar_g_buffs_disability_rate; -} - -MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor) -{ - entity player = M_ARGV(1, entity); - - if(player.buffs & BUFF_SPEED.m_itemid) - M_ARGV(0, float) *= autocvar_g_buffs_speed_weaponspeed; - - if(time < player.buff_disability_time) - M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed; -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) -{ - entity player = M_ARGV(0, entity); - - if(gameover || IS_DEAD(player)) { return; } - - if(time < player.buff_disability_time) - if(time >= player.buff_disability_effect_time) - { - Send_Effect(EFFECT_SMOKING, player.origin + ((player.mins + player.maxs) * 0.5), '0 0 0', 1); - player.buff_disability_effect_time = time + 0.5; - } - - // handle buff lost status - // 1: notify everyone else - // 2: notify carrier as well - int buff_lost = 0; - - if(player.buff_time && player.buffs) - if(time >= player.buff_time) - { - player.buff_time = 0; - buff_lost = 2; - } - - if(STAT(FROZEN, player)) { buff_lost = 1; } - - if(buff_lost) - { - if(player.buffs) - { - int buffid = buff_FirstFromFlags(player.buffs).m_id; - if(buff_lost == 2) - { - Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message? - sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); - } - else - Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid); - player.buffs = 0; - } - } - - if(player.buffs & BUFF_MAGNET.m_itemid) - { - vector pickup_size; - FOREACH_ENTITY_FLAGS(flags, FL_ITEM, - { - if(it.buffs) - pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_buff; - else - pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_item; - - if(boxesoverlap(player.absmin - pickup_size, player.absmax + pickup_size, it.absmin, it.absmax)) - { - if(gettouch(it)) - gettouch(it)(it, player); - } - }); - } - - if(player.buffs & BUFF_AMMO.m_itemid) - if(player.clip_size) - player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size; - - if((player.buffs & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid)) - if(player.alpha != autocvar_g_buffs_invisible_alpha) - player.alpha = autocvar_g_buffs_invisible_alpha; // powerups reset alpha, so we must enforce this (TODO) - - if(player.buffs & BUFF_MEDIC.m_itemid) - if(time >= player.buff_medic_healtime) - { - buff_Medic_Heal(player); - player.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay; - } - -#define BUFF_ONADD(b) if ( (player.buffs & (b).m_itemid) && !(player.oldbuffs & (b).m_itemid)) -#define BUFF_ONREM(b) if (!(player.buffs & (b).m_itemid) && (player.oldbuffs & (b).m_itemid)) - - if(player.buffs != player.oldbuffs) - { - entity buff = buff_FirstFromFlags(player.buffs); - float bufftime = buff != BUFF_Null ? buff.m_time(buff) : 0; - player.buff_time = (bufftime) ? time + bufftime : 0; - - BUFF_ONADD(BUFF_AMMO) - { - player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_WEAPON_AMMO); - player.items |= IT_UNLIMITED_WEAPON_AMMO; - - if(player.clip_load) - player.buff_ammo_prev_clipload = player.clip_load; - player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size; - } - - BUFF_ONREM(BUFF_AMMO) - { - if(player.buff_ammo_prev_infitems) - player.items |= IT_UNLIMITED_WEAPON_AMMO; - else - player.items &= ~IT_UNLIMITED_WEAPON_AMMO; - - if(player.buff_ammo_prev_clipload) - player.clip_load = player.buff_ammo_prev_clipload; - } - - BUFF_ONADD(BUFF_INVISIBLE) - { - if(time < player.strength_finished && g_instagib) - player.alpha = autocvar_g_instagib_invis_alpha; - else - player.alpha = player.buff_invisible_prev_alpha; - player.alpha = autocvar_g_buffs_invisible_alpha; - } - - BUFF_ONREM(BUFF_INVISIBLE) - player.alpha = player.buff_invisible_prev_alpha; - - player.oldbuffs = player.buffs; - if(player.buffs) - { - if(!player.buff_model) - buffs_BuffModel_Spawn(player); - - player.buff_model.color = buff.m_color; - player.buff_model.glowmod = buff_GlowColor(player.buff_model); - player.buff_model.skin = buff.m_skin; - - player.effects |= EF_NOSHADOW; - } - else - { - delete(player.buff_model); - player.buff_model = NULL; - - player.effects &= ~(EF_NOSHADOW); - } - } - - if(player.buff_model) - { - player.buff_model.effects = player.effects; - player.buff_model.effects |= EF_LOWPRECISION; - player.buff_model.effects = player.buff_model.effects & EFMASK_CHEAP; // eat performance - - player.buff_model.alpha = player.alpha; - } - -#undef BUFF_ONADD -#undef BUFF_ONREM -} - -MUTATOR_HOOKFUNCTION(buffs, SpectateCopy) -{ - entity spectatee = M_ARGV(0, entity); - entity client = M_ARGV(1, entity); - - client.buffs = spectatee.buffs; -} - -MUTATOR_HOOKFUNCTION(buffs, VehicleEnter) -{ - entity player = M_ARGV(0, entity); - entity veh = M_ARGV(1, entity); - - veh.buffs = player.buffs; - player.buffs = 0; - veh.buff_time = max(0, player.buff_time - time); - player.buff_time = 0; -} - -MUTATOR_HOOKFUNCTION(buffs, VehicleExit) -{ - entity player = M_ARGV(0, entity); - entity veh = M_ARGV(1, entity); - - player.buffs = player.oldbuffs = veh.buffs; - veh.buffs = 0; - player.buff_time = time + veh.buff_time; - veh.buff_time = 0; -} - -MUTATOR_HOOKFUNCTION(buffs, PlayerRegen) -{ - entity player = M_ARGV(0, entity); - - if(player.buffs & BUFF_MEDIC.m_itemid) - { - M_ARGV(2, float) = autocvar_g_buffs_medic_rot; // rot_mod - M_ARGV(4, float) = M_ARGV(1, float) = autocvar_g_buffs_medic_max; // limit_mod = max_mod - M_ARGV(2, float) = autocvar_g_buffs_medic_regen; // regen_mod - } - - if(player.buffs & BUFF_SPEED.m_itemid) - M_ARGV(2, float) = autocvar_g_buffs_speed_regen; // regen_mod -} - -REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace"); - -MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString) -{ - M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Buffs"); -} - -MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsPrettyString) +string BUFF_NAME(int i) { - M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Buffs"); + Buff b = Buffs_from(i); + return sprintf("%s%s", rgb_to_hexcolor(b.m_color), b.m_prettyName); } -void buffs_DelayedInit(entity this) +entity buff_FirstFromFlags(int _buffs) { - if(autocvar_g_buffs_spawn_count > 0) - if(find(NULL, classname, "item_buff") == NULL) - { - float i; - for(i = 0; i < autocvar_g_buffs_spawn_count; ++i) - { - entity e = spawn(); - e.spawnflags |= 64; // always randomize - e.velocity = randomvec() * 250; // this gets reset anyway if random location works - buff_Init(e); - } - } + if (flags) + { + FOREACH(Buffs, it.m_itemid & _buffs, LAMBDA(return it)); + } + return BUFF_Null; } -#endif diff --git a/qcsrc/common/mutators/mutator/buffs/all.qh b/qcsrc/common/mutators/mutator/buffs/buffs.qh similarity index 97% rename from qcsrc/common/mutators/mutator/buffs/all.qh rename to qcsrc/common/mutators/mutator/buffs/buffs.qh index 79117c95a..89c550f7a 100644 --- a/qcsrc/common/mutators/mutator/buffs/all.qh +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qh @@ -1,5 +1,4 @@ -#ifndef BUFFS_ALL_H -#define BUFFS_ALL_H +#pragma once #include #include @@ -67,5 +66,3 @@ REGISTER_BUFF(Null); BUFF_SPAWNFUNCS(random, BUFF_Null) #include "all.inc" - -#endif diff --git a/qcsrc/common/mutators/mutator/buffs/module.inc b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qc similarity index 61% rename from qcsrc/common/mutators/mutator/buffs/module.inc rename to qcsrc/common/mutators/mutator/buffs/cl_buffs.qc index c24892836..ca1475372 100644 --- a/qcsrc/common/mutators/mutator/buffs/module.inc +++ b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qc @@ -1,26 +1,5 @@ -#include "all.qc" -#ifdef SVQC -#include "buffs.qc" -#endif +#include "cl_buffs.qh" -#ifdef IMPLEMENTATION - -string BUFF_NAME(int i) -{ - Buff b = Buffs_from(i); - return sprintf("%s%s", rgb_to_hexcolor(b.m_color), b.m_prettyName); -} - -entity buff_FirstFromFlags(int _buffs) -{ - if (flags) - { - FOREACH(Buffs, it.m_itemid & _buffs, LAMBDA(return it)); - } - return BUFF_Null; -} - -#ifdef CSQC REGISTER_MUTATOR(cl_buffs, true); MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add) { @@ -41,6 +20,3 @@ MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format) return true; } } - -#endif -#endif diff --git a/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh new file mode 100644 index 000000000..c93902291 --- /dev/null +++ b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh @@ -0,0 +1,3 @@ +#pragma once + +#include "buffs.qh" diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc new file mode 100644 index 000000000..0ea6b057a --- /dev/null +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -0,0 +1,1002 @@ +#include "sv_buffs.qh" + +#include +#include + +.float buff_time = _STAT(BUFF_TIME); +void buffs_DelayedInit(entity this); + +REGISTER_MUTATOR(buffs, cvar("g_buffs")) +{ + MUTATOR_ONADD + { + InitializeEntity(NULL, buffs_DelayedInit, INITPRIO_FINDTARGET); + } +} + +bool buffs_BuffModel_Customize(entity this, entity client) +{ + entity player, myowner; + bool same_team; + + player = WaypointSprite_getviewentity(client); + myowner = this.owner; + same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner)); + + if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0) + return false; + + if(MUTATOR_CALLHOOK(BuffModel_Customize, this, player)) + return false; + + if(player == myowner || (IS_SPEC(client) && client.enemy == myowner)) + { + // somewhat hide the model, but keep the glow + this.effects = 0; + this.alpha = -1; + } + else + { + this.effects = EF_FULLBRIGHT | EF_LOWPRECISION; + this.alpha = 1; + } + return true; +} + +void buffs_BuffModel_Spawn(entity player) +{ + player.buff_model = spawn(); + setmodel(player.buff_model, MDL_BUFF); + setsize(player.buff_model, '0 0 -40', '0 0 40'); + setattachment(player.buff_model, player, ""); + setorigin(player.buff_model, '0 0 1' * (player.buff_model.maxs.z * 1)); + player.buff_model.owner = player; + player.buff_model.scale = 0.7; + player.buff_model.pflags = PFLAGS_FULLDYNAMIC; + player.buff_model.light_lev = 200; + setcefc(player.buff_model, buffs_BuffModel_Customize); +} + +vector buff_GlowColor(entity buff) +{ + //if(buff.team) { return Team_ColorRGB(buff.team); } + return buff.m_color; +} + +void buff_Effect(entity player, string eff) +{ + if(!autocvar_g_buffs_effects) { return; } + + if(time >= player.buff_effect_delay) + { + Send_Effect_(eff, player.origin + ((player.mins + player.maxs) * 0.5), '0 0 0', 1); + player.buff_effect_delay = time + 0.05; // prevent spam + } +} + +// buff item +bool buff_Waypoint_visible_for_player(entity this, entity player, entity view) +{ + if(!this.owner.buff_active && !this.owner.buff_activetime) + return false; + + if (view.buffs) + { + return view.cvar_cl_buffs_autoreplace == false || view.buffs != this.owner.buffs; + } + + return WaypointSprite_visible_for_player(this, player, view); +} + +void buff_Waypoint_Spawn(entity e) +{ + entity buff = buff_FirstFromFlags(e.buffs); + entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team, e, buff_waypoint, true, RADARICON_Buff); + wp.wp_extra = buff.m_id; + WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod); + e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player; +} + +void buff_SetCooldown(entity this, float cd) +{ + cd = max(0, cd); + + if(!this.buff_waypoint) + buff_Waypoint_Spawn(this); + + WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + cd); + this.buff_activetime = cd; + this.buff_active = !cd; +} + +void buff_Respawn(entity this) +{ + if(gameover) { return; } + + vector oldbufforigin = this.origin; + this.velocity = '0 0 200'; + + if(!MoveToRandomMapLocation(this, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, + ((autocvar_g_buffs_random_location_attempts > 0) ? autocvar_g_buffs_random_location_attempts : 10), 1024, 256)) + { + entity spot = SelectSpawnPoint(this, true); + setorigin(this, spot.origin); + this.velocity = ((randomvec() * 100) + '0 0 200'); + this.angles = spot.angles; + } + + tracebox(this.origin, this.mins * 1.5, this.maxs * 1.5, this.origin, MOVE_NOMONSTERS, this); + + setorigin(this, trace_endpos); // attempt to unstick + + set_movetype(this, MOVETYPE_TOSS); + + makevectors(this.angles); + this.angles = '0 0 0'; + if(autocvar_g_buffs_random_lifetime > 0) + this.lifetime = time + autocvar_g_buffs_random_lifetime; + + Send_Effect(EFFECT_ELECTRO_COMBO, oldbufforigin + ((this.mins + this.maxs) * 0.5), '0 0 0', 1); + Send_Effect(EFFECT_ELECTRO_COMBO, CENTER_OR_VIEWOFS(this), '0 0 0', 1); + + WaypointSprite_Ping(this.buff_waypoint); + + sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) +} + +void buff_Touch(entity this, entity toucher) +{ + if(gameover) { return; } + + if(ITEM_TOUCH_NEEDKILL()) + { + buff_Respawn(this); + return; + } + + if((this.team && DIFF_TEAM(toucher, this)) + || (STAT(FROZEN, toucher)) + || (toucher.vehicle) + || (!this.buff_active) + ) + { + // can't touch this + return; + } + + if(MUTATOR_CALLHOOK(BuffTouch, this, toucher)) + return; + toucher = M_ARGV(1, entity); + + if(!IS_PLAYER(toucher)) + return; // incase mutator changed toucher + + if (toucher.buffs) + { + if (toucher.cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs) + { + int buffid = buff_FirstFromFlags(toucher.buffs).m_id; + //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, toucher.buffs); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid); + + toucher.buffs = 0; + //sound(toucher, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); + } + else { return; } // do nothing + } + + this.owner = toucher; + this.buff_active = false; + this.lifetime = 0; + int buffid = buff_FirstFromFlags(this.buffs).m_id; + Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_GOT, buffid); + Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF, toucher.netname, buffid); + + Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1); + sound(toucher, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM); + toucher.buffs |= (this.buffs); +} + +float buff_Available(entity buff) +{ + if (buff == BUFF_Null) + return false; + if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_AMMO) || (cvar("g_melee_only")))) + return false; + if (buff == BUFF_VAMPIRE && cvar("g_vampire")) + return false; + return cvar(strcat("g_buffs_", buff.m_name)); +} + +.int buff_seencount; + +void buff_NewType(entity ent, float cb) +{ + RandomSelection_Init(); + FOREACH(Buffs, buff_Available(it), LAMBDA( + it.buff_seencount += 1; + // if it's already been chosen, give it a lower priority + RandomSelection_Add(NULL, it.m_itemid, string_null, 1, max(0.2, 1 / it.buff_seencount)); + )); + ent.buffs = RandomSelection_chosen_float; +} + +void buff_Think(entity this) +{ + if(this.buffs != this.oldbuffs) + { + entity buff = buff_FirstFromFlags(this.buffs); + this.color = buff.m_color; + this.glowmod = buff_GlowColor(buff); + this.skin = buff.m_skin; + + setmodel(this, MDL_BUFF); + + if(this.buff_waypoint) + { + //WaypointSprite_Disown(this.buff_waypoint, 1); + WaypointSprite_Kill(this.buff_waypoint); + buff_Waypoint_Spawn(this); + if(this.buff_activetime) + WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + this.buff_activetime - frametime); + } + + this.oldbuffs = this.buffs; + } + + if(!gameover) + if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime) + if(!this.buff_activetime_updated) + { + buff_SetCooldown(this, this.buff_activetime); + this.buff_activetime_updated = true; + } + + if(!this.buff_active && !this.buff_activetime) + if(!this.owner || STAT(FROZEN, this.owner) || IS_DEAD(this.owner) || !this.owner.iscreature || !(this.owner.buffs & this.buffs)) + { + buff_SetCooldown(this, autocvar_g_buffs_cooldown_respawn + frametime); + this.owner = NULL; + if(autocvar_g_buffs_randomize) + buff_NewType(this, this.buffs); + + if(autocvar_g_buffs_random_location || (this.spawnflags & 64)) + buff_Respawn(this); + } + + if(this.buff_activetime) + if(!gameover) + if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime) + { + this.buff_activetime = max(0, this.buff_activetime - frametime); + + if(!this.buff_activetime) + { + this.buff_active = true; + sound(this, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTN_NORM); + Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(this), '0 0 0', 1); + } + } + + if(this.buff_active) + { + if(this.team && !this.buff_waypoint) + buff_Waypoint_Spawn(this); + + if(this.lifetime) + if(time >= this.lifetime) + buff_Respawn(this); + } + + this.nextthink = time; + //this.angles_y = time * 110.1; +} + +void buff_Waypoint_Reset(entity this) +{ + WaypointSprite_Kill(this.buff_waypoint); + + if(this.buff_activetime) { buff_Waypoint_Spawn(this); } +} + +void buff_Reset(entity this) +{ + if(autocvar_g_buffs_randomize) + buff_NewType(this, this.buffs); + this.owner = NULL; + buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate); + buff_Waypoint_Reset(this); + this.buff_activetime_updated = false; + + if(autocvar_g_buffs_random_location || (this.spawnflags & 64)) + buff_Respawn(this); +} + +bool buff_Customize(entity this, entity client) +{ + entity player = WaypointSprite_getviewentity(client); + if(!this.buff_active || (this.team && DIFF_TEAM(player, this))) + { + this.alpha = 0.3; + if(this.effects & EF_FULLBRIGHT) { this.effects &= ~(EF_FULLBRIGHT); } + this.pflags = 0; + } + else + { + this.alpha = 1; + if(!(this.effects & EF_FULLBRIGHT)) { this.effects |= EF_FULLBRIGHT; } + this.light_lev = 220 + 36 * sin(time); + this.pflags = PFLAGS_FULLDYNAMIC; + } + return true; +} + +void buff_Init(entity this) +{ + if(!cvar("g_buffs")) { delete(this); return; } + + if(!teamplay && this.team) { this.team = 0; } + + entity buff = buff_FirstFromFlags(this.buffs); + + if(!this.buffs || buff_Available(buff)) + buff_NewType(this, 0); + + this.classname = "item_buff"; + this.solid = SOLID_TRIGGER; + this.flags = FL_ITEM; + setthink(this, buff_Think); + settouch(this, buff_Touch); + this.reset = buff_Reset; + this.nextthink = time + 0.1; + this.gravity = 1; + set_movetype(this, MOVETYPE_TOSS); + this.scale = 1; + this.skin = buff.m_skin; + this.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW; + this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; + setcefc(this, buff_Customize); + //this.gravity = 100; + this.color = buff.m_color; + this.glowmod = buff_GlowColor(this); + buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate + game_starttime); + this.buff_active = !this.buff_activetime; + this.pflags = PFLAGS_FULLDYNAMIC; + + if(this.spawnflags & 1) + this.noalign = true; + + if(this.noalign) + set_movetype(this, MOVETYPE_NONE); // reset by random location + + setmodel(this, MDL_BUFF); + setsize(this, BUFF_MIN, BUFF_MAX); + + if(cvar("g_buffs_random_location") || (this.spawnflags & 64)) + buff_Respawn(this); +} + +void buff_Init_Compat(entity ent, entity replacement) +{ + if (ent.spawnflags & 2) + ent.team = NUM_TEAM_1; + else if (ent.spawnflags & 4) + ent.team = NUM_TEAM_2; + + ent.buffs = replacement.m_itemid; + + buff_Init(ent); +} + +void buff_SpawnReplacement(entity ent, entity old) +{ + setorigin(ent, old.origin); + ent.angles = old.angles; + ent.noalign = (old.noalign || (old.spawnflags & 1)); + + buff_Init(ent); +} + +void buff_Vengeance_DelayedDamage(entity this) +{ + if(this.enemy) + Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, this.enemy.origin, '0 0 0'); + + delete(this); + return; +} + +// note: only really useful in teamplay +void buff_Medic_Heal(entity this) +{ + FOREACH_CLIENT(IS_PLAYER(it) && it != this && vdist(it.origin - this.origin, <=, autocvar_g_buffs_medic_heal_range), + { + if(SAME_TEAM(it, this)) + if(it.health < autocvar_g_balance_health_regenstable) + { + Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); + it.health = bound(0, it.health + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable); + } + }); +} + +float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base) +{ + return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base); +} + +// mutator hooks +MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor) +{ + entity frag_target = M_ARGV(2, entity); + float frag_deathtype = M_ARGV(6, float); + float frag_damage = M_ARGV(7, float); + + if(frag_deathtype == DEATH_BUFF.m_id) { return; } + + if(frag_target.buffs & BUFF_RESISTANCE.m_itemid) + { + vector v = healtharmor_applydamage(50, autocvar_g_buffs_resistance_blockpercent, frag_deathtype, frag_damage); + M_ARGV(4, float) = v.x; // take + M_ARGV(5, float) = v.y; // save + } +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate) +{ + entity frag_attacker = M_ARGV(1, entity); + entity frag_target = M_ARGV(2, entity); + float frag_deathtype = M_ARGV(3, float); + float frag_damage = M_ARGV(4, float); + vector frag_force = M_ARGV(6, vector); + + if(frag_deathtype == DEATH_BUFF.m_id) { return; } + + if(frag_target.buffs & BUFF_SPEED.m_itemid) + if(frag_target != frag_attacker) + frag_damage *= autocvar_g_buffs_speed_damage_take; + + if(frag_target.buffs & BUFF_MEDIC.m_itemid) + if((frag_target.health - frag_damage) <= 0) + if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) + if(frag_attacker) + if(random() <= autocvar_g_buffs_medic_survive_chance) + frag_damage = max(5, frag_target.health - autocvar_g_buffs_medic_survive_health); + + if(frag_target.buffs & BUFF_JUMP.m_itemid) + if(frag_deathtype == DEATH_FALL.m_id) + frag_damage = 0; + + if(frag_target.buffs & BUFF_VENGEANCE.m_itemid) + if(frag_attacker) + if(frag_attacker != frag_target) + if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) + { + entity dmgent = spawn(); + + dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier; + dmgent.enemy = frag_attacker; + dmgent.owner = frag_target; + setthink(dmgent, buff_Vengeance_DelayedDamage); + dmgent.nextthink = time + 0.1; + } + + if(frag_target.buffs & BUFF_BASH.m_itemid) + if(frag_attacker != frag_target) + frag_force = '0 0 0'; + + if(frag_attacker.buffs & BUFF_BASH.m_itemid) + if(frag_force) + if(frag_attacker == frag_target) + frag_force *= autocvar_g_buffs_bash_force_self; + else + frag_force *= autocvar_g_buffs_bash_force; + + if(frag_attacker.buffs & BUFF_DISABILITY.m_itemid) + if(frag_target != frag_attacker) + frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime; + + if(frag_target.buffs & BUFF_INFERNO.m_itemid) + { + if(frag_deathtype == DEATH_FIRE.m_id) + frag_damage = 0; + if(frag_deathtype == DEATH_LAVA.m_id) + frag_damage *= 0.5; // TODO: cvarize? + } + + if(frag_attacker.buffs & BUFF_LUCK.m_itemid) + if(frag_attacker != frag_target) + if(autocvar_g_buffs_luck_damagemultiplier > 0) + if(random() <= autocvar_g_buffs_luck_chance) + frag_damage *= autocvar_g_buffs_luck_damagemultiplier; + + if(frag_attacker.buffs & BUFF_INFERNO.m_itemid) + if(frag_target != frag_attacker) { + float btime = buff_Inferno_CalculateTime( + frag_damage, + 0, + autocvar_g_buffs_inferno_burntime_min_time, + autocvar_g_buffs_inferno_burntime_target_damage, + autocvar_g_buffs_inferno_burntime_target_time, + autocvar_g_buffs_inferno_burntime_factor + ); + Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier), btime, DEATH_BUFF.m_id); + } + + // this... is ridiculous (TODO: fix!) + if(frag_attacker.buffs & BUFF_VAMPIRE.m_itemid) + if(!frag_target.vehicle) + if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) + if(!IS_DEAD(frag_target)) + if(IS_PLAYER(frag_target) || IS_MONSTER(frag_target)) + if(frag_attacker != frag_target) + if(!STAT(FROZEN, frag_target)) + if(frag_target.takedamage) + if(DIFF_TEAM(frag_attacker, frag_target)) + { + frag_attacker.health = bound(0, frag_attacker.health + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.health), g_pickup_healthsmall_max); + if(frag_target.armorvalue) + frag_attacker.armorvalue = bound(0, frag_attacker.armorvalue + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.armorvalue), g_pickup_armorsmall_max); + } + + M_ARGV(4, float) = frag_damage; + M_ARGV(6, vector) = frag_force; +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn) +{ + entity player = M_ARGV(0, entity); + + player.buffs = 0; + player.buff_time = 0; + // reset timers here to prevent them continuing after re-spawn + player.buff_disability_time = 0; + player.buff_disability_effect_time = 0; +} + +.float stat_sv_maxspeed; +.float stat_sv_airspeedlimit_nonqw; +.float stat_sv_jumpvelocity; + +MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics) +{ + entity player = M_ARGV(0, entity); + + if(player.buffs & BUFF_SPEED.m_itemid) + { + player.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed; + player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed; + } + + if(time < player.buff_disability_time) + { + player.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed; + player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed; + } + + if(player.buffs & BUFF_JUMP.m_itemid) + { + // automatically reset, no need to worry + player.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height; + } +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerJump) +{ + entity player = M_ARGV(0, entity); + + if(player.buffs & BUFF_JUMP.m_itemid) + M_ARGV(1, float) = autocvar_g_buffs_jump_height; +} + +MUTATOR_HOOKFUNCTION(buffs, MonsterMove) +{ + entity mon = M_ARGV(0, entity); + + if(time < mon.buff_disability_time) + { + M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed + M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed + } +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerDies) +{ + entity frag_target = M_ARGV(2, entity); + + if(frag_target.buffs) + { + int buffid = buff_FirstFromFlags(frag_target.buffs).m_id; + Send_Notification(NOTIF_ALL_EXCEPT, frag_target, MSG_INFO, INFO_ITEM_BUFF_LOST, frag_target.netname, buffid); + frag_target.buffs = 0; + + if(frag_target.buff_model) + { + delete(frag_target.buff_model); + frag_target.buff_model = NULL; + } + } +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST) +{ + if(MUTATOR_RETURNVALUE || gameover) { return; } + + entity player = M_ARGV(0, entity); + + if(player.buffs) + { + int buffid = buff_FirstFromFlags(player.buffs).m_id; + Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid); + Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid); + + player.buffs = 0; + player.buff_time = 0; // already notified + sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); + return true; + } +} + +MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) +{ + if(MUTATOR_RETURNVALUE || gameover) { return; } + entity player = M_ARGV(0, entity); + + if(player.buffs & BUFF_SWAPPER.m_itemid) + { + float best_distance = autocvar_g_buffs_swapper_range; + entity closest = NULL; + FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle) + if(DIFF_TEAM(it, player)) + { + float test = vlen2(player.origin - it.origin); + if(test <= best_distance * best_distance) + { + best_distance = sqrt(test); + closest = it; + } + } + )); + + if(closest) + { + vector my_org, my_vel, my_ang, their_org, their_vel, their_ang; + + my_org = player.origin; + my_vel = player.velocity; + my_ang = player.angles; + their_org = closest.origin; + their_vel = closest.velocity; + their_ang = closest.angles; + + Drop_Special_Items(closest); + + MUTATOR_CALLHOOK(PortalTeleport, player); // initiate flag dropper + + setorigin(player, their_org); + setorigin(closest, my_org); + + closest.velocity = my_vel; + closest.angles = my_ang; + closest.fixangle = true; + closest.oldorigin = my_org; + closest.oldvelocity = my_vel; + player.velocity = their_vel; + player.angles = their_ang; + player.fixangle = true; + player.oldorigin = their_org; + player.oldvelocity = their_vel; + + // set pusher so player gets the kill if they fall into void + closest.pusher = player; + closest.pushltime = time + autocvar_g_maxpushtime; + closest.istypefrag = PHYS_INPUT_BUTTON_CHAT(closest); + + Send_Effect(EFFECT_ELECTRO_COMBO, their_org, '0 0 0', 1); + Send_Effect(EFFECT_ELECTRO_COMBO, my_org, '0 0 0', 1); + + sound(player, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); + sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); + + // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam + player.buffs = 0; + return true; + } + } +} + +bool buffs_RemovePlayer(entity player) +{ + if(player.buff_model) + { + delete(player.buff_model); + player.buff_model = NULL; + } + + // also reset timers here to prevent them continuing after spectating + player.buff_disability_time = 0; + player.buff_disability_effect_time = 0; + + return false; +} +MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); } +MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); } + +MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint) +{ + entity wp = M_ARGV(0, entity); + entity player = M_ARGV(1, entity); + + entity e = WaypointSprite_getviewentity(player); + + // if you have the invisibility powerup, sprites ALWAYS are restricted to your team + // but only apply this to real players, not to spectators + if((wp.owner.flags & FL_CLIENT) && (wp.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == player)) + if(DIFF_TEAM(wp.owner, e)) + return true; +} + +MUTATOR_HOOKFUNCTION(buffs, OnEntityPreSpawn, CBC_ORDER_LAST) +{ + entity ent = M_ARGV(0, entity); + + if(autocvar_g_buffs_replace_powerups) + switch(ent.classname) + { + case "item_strength": + case "item_invincible": + { + entity e = spawn(); + buff_SpawnReplacement(e, ent); + return true; + } + } +} + +MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor) +{ + entity player = M_ARGV(1, entity); + + if(player.buffs & BUFF_SPEED.m_itemid) + M_ARGV(0, float) *= autocvar_g_buffs_speed_rate; + + if(time < player.buff_disability_time) + M_ARGV(0, float) *= autocvar_g_buffs_disability_rate; +} + +MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor) +{ + entity player = M_ARGV(1, entity); + + if(player.buffs & BUFF_SPEED.m_itemid) + M_ARGV(0, float) *= autocvar_g_buffs_speed_weaponspeed; + + if(time < player.buff_disability_time) + M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed; +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) +{ + entity player = M_ARGV(0, entity); + + if(gameover || IS_DEAD(player)) { return; } + + if(time < player.buff_disability_time) + if(time >= player.buff_disability_effect_time) + { + Send_Effect(EFFECT_SMOKING, player.origin + ((player.mins + player.maxs) * 0.5), '0 0 0', 1); + player.buff_disability_effect_time = time + 0.5; + } + + // handle buff lost status + // 1: notify everyone else + // 2: notify carrier as well + int buff_lost = 0; + + if(player.buff_time && player.buffs) + if(time >= player.buff_time) + { + player.buff_time = 0; + buff_lost = 2; + } + + if(STAT(FROZEN, player)) { buff_lost = 1; } + + if(buff_lost) + { + if(player.buffs) + { + int buffid = buff_FirstFromFlags(player.buffs).m_id; + if(buff_lost == 2) + { + Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message? + sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); + } + else + Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid); + player.buffs = 0; + } + } + + if(player.buffs & BUFF_MAGNET.m_itemid) + { + vector pickup_size; + FOREACH_ENTITY_FLAGS(flags, FL_ITEM, + { + if(it.buffs) + pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_buff; + else + pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_item; + + if(boxesoverlap(player.absmin - pickup_size, player.absmax + pickup_size, it.absmin, it.absmax)) + { + if(gettouch(it)) + gettouch(it)(it, player); + } + }); + } + + if(player.buffs & BUFF_AMMO.m_itemid) + if(player.clip_size) + player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size; + + if((player.buffs & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid)) + if(player.alpha != autocvar_g_buffs_invisible_alpha) + player.alpha = autocvar_g_buffs_invisible_alpha; // powerups reset alpha, so we must enforce this (TODO) + + if(player.buffs & BUFF_MEDIC.m_itemid) + if(time >= player.buff_medic_healtime) + { + buff_Medic_Heal(player); + player.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay; + } + +#define BUFF_ONADD(b) if ( (player.buffs & (b).m_itemid) && !(player.oldbuffs & (b).m_itemid)) +#define BUFF_ONREM(b) if (!(player.buffs & (b).m_itemid) && (player.oldbuffs & (b).m_itemid)) + + if(player.buffs != player.oldbuffs) + { + entity buff = buff_FirstFromFlags(player.buffs); + float bufftime = buff != BUFF_Null ? buff.m_time(buff) : 0; + player.buff_time = (bufftime) ? time + bufftime : 0; + + BUFF_ONADD(BUFF_AMMO) + { + player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_WEAPON_AMMO); + player.items |= IT_UNLIMITED_WEAPON_AMMO; + + if(player.clip_load) + player.buff_ammo_prev_clipload = player.clip_load; + player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size; + } + + BUFF_ONREM(BUFF_AMMO) + { + if(player.buff_ammo_prev_infitems) + player.items |= IT_UNLIMITED_WEAPON_AMMO; + else + player.items &= ~IT_UNLIMITED_WEAPON_AMMO; + + if(player.buff_ammo_prev_clipload) + player.clip_load = player.buff_ammo_prev_clipload; + } + + BUFF_ONADD(BUFF_INVISIBLE) + { + if(time < player.strength_finished && g_instagib) + player.alpha = autocvar_g_instagib_invis_alpha; + else + player.alpha = player.buff_invisible_prev_alpha; + player.alpha = autocvar_g_buffs_invisible_alpha; + } + + BUFF_ONREM(BUFF_INVISIBLE) + player.alpha = player.buff_invisible_prev_alpha; + + player.oldbuffs = player.buffs; + if(player.buffs) + { + if(!player.buff_model) + buffs_BuffModel_Spawn(player); + + player.buff_model.color = buff.m_color; + player.buff_model.glowmod = buff_GlowColor(player.buff_model); + player.buff_model.skin = buff.m_skin; + + player.effects |= EF_NOSHADOW; + } + else + { + delete(player.buff_model); + player.buff_model = NULL; + + player.effects &= ~(EF_NOSHADOW); + } + } + + if(player.buff_model) + { + player.buff_model.effects = player.effects; + player.buff_model.effects |= EF_LOWPRECISION; + player.buff_model.effects = player.buff_model.effects & EFMASK_CHEAP; // eat performance + + player.buff_model.alpha = player.alpha; + } + +#undef BUFF_ONADD +#undef BUFF_ONREM +} + +MUTATOR_HOOKFUNCTION(buffs, SpectateCopy) +{ + entity spectatee = M_ARGV(0, entity); + entity client = M_ARGV(1, entity); + + client.buffs = spectatee.buffs; +} + +MUTATOR_HOOKFUNCTION(buffs, VehicleEnter) +{ + entity player = M_ARGV(0, entity); + entity veh = M_ARGV(1, entity); + + veh.buffs = player.buffs; + player.buffs = 0; + veh.buff_time = max(0, player.buff_time - time); + player.buff_time = 0; +} + +MUTATOR_HOOKFUNCTION(buffs, VehicleExit) +{ + entity player = M_ARGV(0, entity); + entity veh = M_ARGV(1, entity); + + player.buffs = player.oldbuffs = veh.buffs; + veh.buffs = 0; + player.buff_time = time + veh.buff_time; + veh.buff_time = 0; +} + +MUTATOR_HOOKFUNCTION(buffs, PlayerRegen) +{ + entity player = M_ARGV(0, entity); + + if(player.buffs & BUFF_MEDIC.m_itemid) + { + M_ARGV(2, float) = autocvar_g_buffs_medic_rot; // rot_mod + M_ARGV(4, float) = M_ARGV(1, float) = autocvar_g_buffs_medic_max; // limit_mod = max_mod + M_ARGV(2, float) = autocvar_g_buffs_medic_regen; // regen_mod + } + + if(player.buffs & BUFF_SPEED.m_itemid) + M_ARGV(2, float) = autocvar_g_buffs_speed_regen; // regen_mod +} + +REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace"); + +MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString) +{ + M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Buffs"); +} + +MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsPrettyString) +{ + M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Buffs"); +} + +void buffs_DelayedInit(entity this) +{ + if(autocvar_g_buffs_spawn_count > 0) + if(find(NULL, classname, "item_buff") == NULL) + { + float i; + for(i = 0; i < autocvar_g_buffs_spawn_count; ++i) + { + entity e = spawn(); + e.spawnflags |= 64; // always randomize + e.velocity = randomvec() * 250; // this gets reset anyway if random location works + buff_Init(e); + } + } +} diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh new file mode 100644 index 000000000..b9fc1e42d --- /dev/null +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh @@ -0,0 +1,77 @@ +#pragma once + +#include "buffs.qh" + +#include "../instagib/_mod.qh" + +bool autocvar_g_buffs_effects; +float autocvar_g_buffs_waypoint_distance; +bool autocvar_g_buffs_randomize; +float autocvar_g_buffs_random_lifetime; +bool autocvar_g_buffs_random_location; +int autocvar_g_buffs_random_location_attempts; +int autocvar_g_buffs_spawn_count; +bool autocvar_g_buffs_replace_powerups; +float autocvar_g_buffs_cooldown_activate; +float autocvar_g_buffs_cooldown_respawn; +float autocvar_g_buffs_resistance_blockpercent; +float autocvar_g_buffs_medic_survive_chance; +float autocvar_g_buffs_medic_survive_health; +float autocvar_g_buffs_medic_rot; +float autocvar_g_buffs_medic_max; +float autocvar_g_buffs_medic_regen; +float autocvar_g_buffs_medic_heal_amount = 15; +float autocvar_g_buffs_medic_heal_delay = 1; +float autocvar_g_buffs_medic_heal_range = 400; +float autocvar_g_buffs_vengeance_damage_multiplier; +float autocvar_g_buffs_bash_force; +float autocvar_g_buffs_bash_force_self; +float autocvar_g_buffs_disability_slowtime; +float autocvar_g_buffs_disability_speed; +float autocvar_g_buffs_disability_rate; +float autocvar_g_buffs_disability_weaponspeed; +float autocvar_g_buffs_speed_speed; +float autocvar_g_buffs_speed_rate; +float autocvar_g_buffs_speed_weaponspeed; +float autocvar_g_buffs_speed_damage_take; +float autocvar_g_buffs_speed_regen; +float autocvar_g_buffs_vampire_damage_steal; +float autocvar_g_buffs_invisible_alpha; +float autocvar_g_buffs_jump_height; +float autocvar_g_buffs_inferno_burntime_factor; +float autocvar_g_buffs_inferno_burntime_min_time; +float autocvar_g_buffs_inferno_burntime_target_damage; +float autocvar_g_buffs_inferno_burntime_target_time; +float autocvar_g_buffs_inferno_damagemultiplier; +float autocvar_g_buffs_swapper_range; +float autocvar_g_buffs_magnet_range_item; +float autocvar_g_buffs_magnet_range_buff = 200; +float autocvar_g_buffs_luck_chance = 0.15; +float autocvar_g_buffs_luck_damagemultiplier = 3; + +// ammo +.float buff_ammo_prev_infitems; +.int buff_ammo_prev_clipload; +// invisible +.float buff_invisible_prev_alpha; +// medic +.float buff_medic_healtime; +// disability +.float buff_disability_time; +.float buff_disability_effect_time; +// common buff variables +.float buff_effect_delay; + +// buff definitions +.float buff_active; +.float buff_activetime; +.float buff_activetime_updated; +.entity buff_waypoint; +.int oldbuffs; // for updating effects +.entity buff_model; // controls effects (TODO: make csqc) + +const vector BUFF_MIN = ('-16 -16 -20'); +const vector BUFF_MAX = ('16 16 20'); + +// client side options +.float cvar_cl_buffs_autoreplace; diff --git a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc index f636696e6..a7df2853c 100644 --- a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc +++ b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc @@ -1,4 +1,7 @@ -#ifdef IMPLEMENTATION +#include "bugrigs.qh" + +#ifndef MENUQC + #ifdef SVQC #include #endif @@ -311,4 +314,5 @@ MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsPrettyString) } #endif + #endif diff --git a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qh b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/bugrigs/module.inc b/qcsrc/common/mutators/mutator/bugrigs/module.inc deleted file mode 100644 index cef744fdc..000000000 --- a/qcsrc/common/mutators/mutator/bugrigs/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef MENUQC -#include "bugrigs.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/campcheck/_mod.inc b/qcsrc/common/mutators/mutator/campcheck/_mod.inc index 3ddb376fc..07c2ae272 100644 --- a/qcsrc/common/mutators/mutator/campcheck/_mod.inc +++ b/qcsrc/common/mutators/mutator/campcheck/_mod.inc @@ -1,2 +1,5 @@ // generated file; do not modify #include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/campcheck/_mod.qh b/qcsrc/common/mutators/mutator/campcheck/_mod.qh index 81345f1cf..c52811129 100644 --- a/qcsrc/common/mutators/mutator/campcheck/_mod.qh +++ b/qcsrc/common/mutators/mutator/campcheck/_mod.qh @@ -1,2 +1,5 @@ // generated file; do not modify #include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/campcheck/campcheck.qc b/qcsrc/common/mutators/mutator/campcheck/campcheck.qc index 1ab6fb462..822d4af78 100644 --- a/qcsrc/common/mutators/mutator/campcheck/campcheck.qc +++ b/qcsrc/common/mutators/mutator/campcheck/campcheck.qc @@ -1,91 +1 @@ -#ifdef IMPLEMENTATION -float autocvar_g_campcheck_damage; -float autocvar_g_campcheck_distance; -float autocvar_g_campcheck_interval; - -REGISTER_MUTATOR(campcheck, cvar("g_campcheck")); - -.float campcheck_nextcheck; -.float campcheck_traveled_distance; - -MUTATOR_HOOKFUNCTION(campcheck, PlayerDies) -{ - entity frag_target = M_ARGV(2, entity); - - Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CPID_CAMPCHECK); -} - -MUTATOR_HOOKFUNCTION(campcheck, PlayerDamage_Calculate) -{ - entity frag_attacker = M_ARGV(1, entity); - entity frag_target = M_ARGV(2, entity); - - if(IS_PLAYER(frag_target)) - if(IS_PLAYER(frag_attacker)) - if(frag_attacker != frag_target) - { - frag_target.campcheck_traveled_distance = autocvar_g_campcheck_distance; - frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance; - } -} - -MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink) -{ - entity player = M_ARGV(0, entity); - - if(!gameover) - if(!warmup_stage) // don't consider it camping during warmup? - if(time >= game_starttime) - if(IS_PLAYER(player)) - if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them - if(!IS_DEAD(player)) - if(!STAT(FROZEN, player)) - if(!PHYS_INPUT_BUTTON_CHAT(player)) - if(autocvar_g_campcheck_interval) - { - vector dist; - - // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement) - dist = player.prevorigin - player.origin; - dist.z = 0; - player.campcheck_traveled_distance += fabs(vlen(dist)); - - if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted())) - { - player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2; - player.campcheck_traveled_distance = 0; - } - - if(time > player.campcheck_nextcheck) - { - if(player.campcheck_traveled_distance < autocvar_g_campcheck_distance) - { - Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CAMPCHECK); - if(player.vehicle) - Damage(player.vehicle, NULL, NULL, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, player.vehicle.origin, '0 0 0'); - else - Damage(player, NULL, NULL, bound(0, autocvar_g_campcheck_damage, player.health + player.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, player.origin, '0 0 0'); - } - player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; - player.campcheck_traveled_distance = 0; - } - - return; - } - - player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date -} - -MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn) -{ - entity player = M_ARGV(0, entity); - - player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2; - player.campcheck_traveled_distance = 0; -} - -MUTATOR_HOOKFUNCTION(campcheck, BuildMutatorsString) -{ - M_ARGV(0, string) = strcat(M_ARGV(0, string), ":CampCheck"); -} -#endif +#include "campcheck.qh" diff --git a/qcsrc/common/mutators/mutator/campcheck/campcheck.qh b/qcsrc/common/mutators/mutator/campcheck/campcheck.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/campcheck/campcheck.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/campcheck/module.inc b/qcsrc/common/mutators/mutator/campcheck/module.inc deleted file mode 100644 index 9f4181f16..000000000 --- a/qcsrc/common/mutators/mutator/campcheck/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "campcheck.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc b/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc new file mode 100644 index 000000000..be7d3a2e2 --- /dev/null +++ b/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc @@ -0,0 +1,91 @@ +#include "sv_campcheck.qh" + +float autocvar_g_campcheck_damage; +float autocvar_g_campcheck_distance; +float autocvar_g_campcheck_interval; + +REGISTER_MUTATOR(campcheck, cvar("g_campcheck")); + +.float campcheck_nextcheck; +.float campcheck_traveled_distance; + +MUTATOR_HOOKFUNCTION(campcheck, PlayerDies) +{ + entity frag_target = M_ARGV(2, entity); + + Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CPID_CAMPCHECK); +} + +MUTATOR_HOOKFUNCTION(campcheck, PlayerDamage_Calculate) +{ + entity frag_attacker = M_ARGV(1, entity); + entity frag_target = M_ARGV(2, entity); + + if(IS_PLAYER(frag_target)) + if(IS_PLAYER(frag_attacker)) + if(frag_attacker != frag_target) + { + frag_target.campcheck_traveled_distance = autocvar_g_campcheck_distance; + frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance; + } +} + +MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink) +{ + entity player = M_ARGV(0, entity); + + if(!gameover) + if(!warmup_stage) // don't consider it camping during warmup? + if(time >= game_starttime) + if(IS_PLAYER(player)) + if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them + if(!IS_DEAD(player)) + if(!STAT(FROZEN, player)) + if(!PHYS_INPUT_BUTTON_CHAT(player)) + if(autocvar_g_campcheck_interval) + { + vector dist; + + // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement) + dist = player.prevorigin - player.origin; + dist.z = 0; + player.campcheck_traveled_distance += fabs(vlen(dist)); + + if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted())) + { + player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2; + player.campcheck_traveled_distance = 0; + } + + if(time > player.campcheck_nextcheck) + { + if(player.campcheck_traveled_distance < autocvar_g_campcheck_distance) + { + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CAMPCHECK); + if(player.vehicle) + Damage(player.vehicle, NULL, NULL, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, player.vehicle.origin, '0 0 0'); + else + Damage(player, NULL, NULL, bound(0, autocvar_g_campcheck_damage, player.health + player.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, player.origin, '0 0 0'); + } + player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; + player.campcheck_traveled_distance = 0; + } + + return; + } + + player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date +} + +MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn) +{ + entity player = M_ARGV(0, entity); + + player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2; + player.campcheck_traveled_distance = 0; +} + +MUTATOR_HOOKFUNCTION(campcheck, BuildMutatorsString) +{ + M_ARGV(0, string) = strcat(M_ARGV(0, string), ":CampCheck"); +} diff --git a/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qh b/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/cloaked/_mod.inc b/qcsrc/common/mutators/mutator/cloaked/_mod.inc index 721369522..34fdea747 100644 --- a/qcsrc/common/mutators/mutator/cloaked/_mod.inc +++ b/qcsrc/common/mutators/mutator/cloaked/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/cloaked/_mod.qh b/qcsrc/common/mutators/mutator/cloaked/_mod.qh index 5606b9aaf..b225a2be5 100644 --- a/qcsrc/common/mutators/mutator/cloaked/_mod.qh +++ b/qcsrc/common/mutators/mutator/cloaked/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/cloaked/module.inc b/qcsrc/common/mutators/mutator/cloaked/module.inc deleted file mode 100644 index 3d3a04293..000000000 --- a/qcsrc/common/mutators/mutator/cloaked/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "cloaked.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/cloaked/cloaked.qc b/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc similarity index 93% rename from qcsrc/common/mutators/mutator/cloaked/cloaked.qc rename to qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc index 4fca53276..eb45d4baf 100644 --- a/qcsrc/common/mutators/mutator/cloaked/cloaked.qc +++ b/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc @@ -1,4 +1,4 @@ -#ifdef IMPLEMENTATION +#include "sv_cloaked.qh" REGISTER_MUTATOR(cloaked, cvar("g_cloaked")); @@ -15,5 +15,3 @@ MUTATOR_HOOKFUNCTION(cloaked, BuildMutatorsPrettyString) { if (!g_cts) M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Cloaked"); } - -#endif diff --git a/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qh b/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/damagetext/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/damagetext.qc index 878a854fb..88af5496b 100644 --- a/qcsrc/common/mutators/mutator/damagetext/damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext/damagetext.qc @@ -1,13 +1,5 @@ -#ifndef MUTATOR_DAMAGETEXT_H -#define MUTATOR_DAMAGETEXT_H +#include "damagetext.qh" -#ifdef MENUQC -#include -#endif - -#endif - -#ifdef IMPLEMENTATION REGISTER_MUTATOR(damagetext, true); #if defined(CSQC) || defined(MENUQC) @@ -157,8 +149,10 @@ NET_HANDLE(damagetext, bool isNew) #endif #ifdef MENUQC + +#include + CLASS(XonoticDamageTextSettings, XonoticTab) - #include REGISTER_SETTINGS(damagetext, NEW(XonoticDamageTextSettings)); ATTRIB(XonoticDamageTextSettings, title, string, _("Damage text")); ATTRIB(XonoticDamageTextSettings, intendedWidth, float, 0.9); @@ -193,7 +187,6 @@ CLASS(XonoticDamageTextSettings, XonoticTab) setDependent(e, "cl_damagetext", 1, 1); this.TR(this); this.TR(this); - // friendly fire this.TD(this, 1, 3, e = makeXonoticCheckBox(0, "cl_damagetext_friendlyfire", _("Draw damage numbers for friendly fire"))); setDependent(e, "cl_damagetext", 1, 1); this.TR(this); @@ -205,4 +198,3 @@ CLASS(XonoticDamageTextSettings, XonoticTab) } ENDCLASS(XonoticDamageTextSettings) #endif -#endif diff --git a/qcsrc/common/mutators/mutator/damagetext/damagetext.qh b/qcsrc/common/mutators/mutator/damagetext/damagetext.qh new file mode 100644 index 000000000..7228f37ea --- /dev/null +++ b/qcsrc/common/mutators/mutator/damagetext/damagetext.qh @@ -0,0 +1,5 @@ +#pragma once + +#ifdef MENUQC +#include +#endif diff --git a/qcsrc/common/mutators/mutator/damagetext/module.inc b/qcsrc/common/mutators/mutator/damagetext/module.inc deleted file mode 100644 index 8e70be7c6..000000000 --- a/qcsrc/common/mutators/mutator/damagetext/module.inc +++ /dev/null @@ -1 +0,0 @@ -#include "damagetext.qc" diff --git a/qcsrc/common/mutators/mutator/dodging/_mod.inc b/qcsrc/common/mutators/mutator/dodging/_mod.inc index 4902d5fc1..80a7828a7 100644 --- a/qcsrc/common/mutators/mutator/dodging/_mod.inc +++ b/qcsrc/common/mutators/mutator/dodging/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/dodging/_mod.qh b/qcsrc/common/mutators/mutator/dodging/_mod.qh index b2b65f02f..fef7b8e6e 100644 --- a/qcsrc/common/mutators/mutator/dodging/_mod.qh +++ b/qcsrc/common/mutators/mutator/dodging/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/dodging/module.inc b/qcsrc/common/mutators/mutator/dodging/module.inc deleted file mode 100644 index 60b193fdf..000000000 --- a/qcsrc/common/mutators/mutator/dodging/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC - #include "dodging.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/dodging/dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc similarity index 99% rename from qcsrc/common/mutators/mutator/dodging/dodging.qc rename to qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 7ddfcea2b..f9cee61f1 100644 --- a/qcsrc/common/mutators/mutator/dodging/dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -1,4 +1,4 @@ -#ifdef IMPLEMENTATION +#include "sv_dodging.qh" #define PHYS_DODGING STAT(DODGING, this) #define PHYS_DODGING_DELAY STAT(DODGING_DELAY, this) @@ -289,4 +289,3 @@ MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys) } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qh b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/doublejump/doublejump.qc b/qcsrc/common/mutators/mutator/doublejump/doublejump.qc index d490ecaaf..f9821b13a 100644 --- a/qcsrc/common/mutators/mutator/doublejump/doublejump.qc +++ b/qcsrc/common/mutators/mutator/doublejump/doublejump.qc @@ -1,4 +1,6 @@ -#ifdef IMPLEMENTATION +#include "doublejump.qh" + +#ifndef MENUQC #ifdef SVQC #include #endif @@ -31,5 +33,4 @@ MUTATOR_HOOKFUNCTION(doublejump, PlayerJump) } } } - #endif diff --git a/qcsrc/common/mutators/mutator/doublejump/doublejump.qh b/qcsrc/common/mutators/mutator/doublejump/doublejump.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/doublejump/doublejump.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/doublejump/module.inc b/qcsrc/common/mutators/mutator/doublejump/module.inc deleted file mode 100644 index f4c695be0..000000000 --- a/qcsrc/common/mutators/mutator/doublejump/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef MENUQC -#include "doublejump.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/globalforces/_mod.inc b/qcsrc/common/mutators/mutator/globalforces/_mod.inc index 006a5d5c7..2302d85fb 100644 --- a/qcsrc/common/mutators/mutator/globalforces/_mod.inc +++ b/qcsrc/common/mutators/mutator/globalforces/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/globalforces/_mod.qh b/qcsrc/common/mutators/mutator/globalforces/_mod.qh index ac5cfd244..c31ee5cfc 100644 --- a/qcsrc/common/mutators/mutator/globalforces/_mod.qh +++ b/qcsrc/common/mutators/mutator/globalforces/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/globalforces/module.inc b/qcsrc/common/mutators/mutator/globalforces/module.inc deleted file mode 100644 index 2a0eec8bf..000000000 --- a/qcsrc/common/mutators/mutator/globalforces/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC - #include "globalforces.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/globalforces/globalforces.qc b/qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qc similarity index 98% rename from qcsrc/common/mutators/mutator/globalforces/globalforces.qc rename to qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qc index 49ac468ba..3e9cd0d51 100644 --- a/qcsrc/common/mutators/mutator/globalforces/globalforces.qc +++ b/qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qc @@ -1,4 +1,4 @@ -#ifdef IMPLEMENTATION +#include "sv_globalforces.qh" AUTOCVAR(g_globalforces, float, false, "Global forces: knockback affects everyone"); AUTOCVAR(g_globalforces_noself, bool, true, "Global forces: ignore self damage"); @@ -29,5 +29,3 @@ MUTATOR_HOOKFUNCTION(mutator_globalforces, PlayerDamage_SplitHealthArmor) { it.velocity += damage_explosion_calcpush(f * it.damageforcescale * damage_force, it.velocity, autocvar_g_balance_damagepush_speedfactor); }); } - -#endif diff --git a/qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qh b/qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/globalforces/sv_globalforces.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/hook/_mod.inc b/qcsrc/common/mutators/mutator/hook/_mod.inc index ec6da662e..e5e68b610 100644 --- a/qcsrc/common/mutators/mutator/hook/_mod.inc +++ b/qcsrc/common/mutators/mutator/hook/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/hook/_mod.qh b/qcsrc/common/mutators/mutator/hook/_mod.qh index 50c0c1372..5a5d26e81 100644 --- a/qcsrc/common/mutators/mutator/hook/_mod.qh +++ b/qcsrc/common/mutators/mutator/hook/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/hook/module.inc b/qcsrc/common/mutators/mutator/hook/module.inc deleted file mode 100644 index 61600c47b..000000000 --- a/qcsrc/common/mutators/mutator/hook/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "hook.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/hook/hook.qc b/qcsrc/common/mutators/mutator/hook/sv_hook.qc similarity index 97% rename from qcsrc/common/mutators/mutator/hook/hook.qc rename to qcsrc/common/mutators/mutator/hook/sv_hook.qc index e72134e0e..b5a196c51 100644 --- a/qcsrc/common/mutators/mutator/hook/hook.qc +++ b/qcsrc/common/mutators/mutator/hook/sv_hook.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_hook.qh" + AUTOCVAR(g_grappling_hook, bool, false, _("let players spawn with the grappling hook which allows them to pull themselves up")); #ifdef SVQC REGISTER_MUTATOR(hook, autocvar_g_grappling_hook) { @@ -44,4 +45,3 @@ MUTATOR_HOOKFUNCTION(hook, FilterItem) } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/hook/sv_hook.qh b/qcsrc/common/mutators/mutator/hook/sv_hook.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/hook/sv_hook.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/instagib/_mod.inc b/qcsrc/common/mutators/mutator/instagib/_mod.inc index dad005fe4..2195111f0 100644 --- a/qcsrc/common/mutators/mutator/instagib/_mod.inc +++ b/qcsrc/common/mutators/mutator/instagib/_mod.inc @@ -1,3 +1,5 @@ // generated file; do not modify -#include #include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/instagib/_mod.qh b/qcsrc/common/mutators/mutator/instagib/_mod.qh index 2e88f427e..7097eaf39 100644 --- a/qcsrc/common/mutators/mutator/instagib/_mod.qh +++ b/qcsrc/common/mutators/mutator/instagib/_mod.qh @@ -1,3 +1,5 @@ // generated file; do not modify -#include #include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/instagib/items.qc b/qcsrc/common/mutators/mutator/instagib/items.qc index 269ec2d24..b0205a5f7 100644 --- a/qcsrc/common/mutators/mutator/instagib/items.qc +++ b/qcsrc/common/mutators/mutator/instagib/items.qc @@ -1,84 +1 @@ -#pragma once - -#include -#include -#include - -float instagib_respawntime_ammo = 45; -float instagib_respawntimejitter_ammo = 0; -GETTER(float, instagib_respawntime_ammo) -GETTER(float, instagib_respawntimejitter_ammo) - -#ifndef MENUQC -MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3")); -SOUND(VaporizerCells, "misc/itempickup"); -#endif - -REGISTER_ITEM(VaporizerCells, Ammo) { -#ifndef MENUQC - this.m_model = MDL_VaporizerCells_ITEM; - this.m_sound = SND_VaporizerCells; -#endif - this.m_name = "Vaporizer Ammo"; - this.m_icon = "ammo_supercells"; -#ifdef SVQC - this.m_botvalue = 100; - this.m_itemid = IT_CELLS; - this.m_respawntime = GET(instagib_respawntime_ammo); - this.m_respawntimejitter = GET(instagib_respawntimejitter_ammo); -#endif -} - -#ifndef MENUQC -MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3")); -SOUND(ExtraLife, "misc/megahealth"); -#endif - -REGISTER_ITEM(ExtraLife, Powerup) { -#ifndef MENUQC - this.m_model = MDL_ExtraLife_ITEM; - this.m_sound = SND_ExtraLife; -#endif - this.m_name = "Extra life"; - this.m_icon = "item_mega_health"; - this.m_color = '1 0 0'; - this.m_waypoint = _("Extra life"); - this.m_waypointblink = 2; - this.m_itemid = IT_NAILS; -} - -#ifndef MENUQC -MODEL(Invisibility_ITEM, Item_Model("g_strength.md3")); -SOUND(Invisibility, "misc/powerup"); -#endif - -REGISTER_ITEM(Invisibility, Powerup) { -#ifndef MENUQC - this.m_model = MDL_Invisibility_ITEM; - this.m_sound = SND_Invisibility; -#endif - this.m_name = "Invisibility"; - this.m_icon = "strength"; - this.m_color = '0 0 1'; - this.m_waypoint = _("Invisibility"); - this.m_waypointblink = 2; - this.m_itemid = IT_STRENGTH; -} - -#ifndef MENUQC -MODEL(Speed_ITEM, Item_Model("g_invincible.md3")); -SOUND(Speed, "misc/powerup_shield"); -#endif - -REGISTER_ITEM(Speed, Powerup) { -#ifndef MENUQC - this.m_model = MDL_Speed_ITEM; - this.m_sound = SND_Speed; -#endif - this.m_name = "Speed"; - this.m_icon = "shield"; - this.m_color = '1 0 1'; - this.m_waypoint = _("Speed"); - this.m_waypointblink = 2; - this.m_itemid = IT_INVINCIBLE; -} +#include "items.qh" diff --git a/qcsrc/common/mutators/mutator/instagib/items.qh b/qcsrc/common/mutators/mutator/instagib/items.qh new file mode 100644 index 000000000..269ec2d24 --- /dev/null +++ b/qcsrc/common/mutators/mutator/instagib/items.qh @@ -0,0 +1,84 @@ +#pragma once + +#include +#include +#include + +float instagib_respawntime_ammo = 45; +float instagib_respawntimejitter_ammo = 0; +GETTER(float, instagib_respawntime_ammo) +GETTER(float, instagib_respawntimejitter_ammo) + +#ifndef MENUQC +MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3")); +SOUND(VaporizerCells, "misc/itempickup"); +#endif + +REGISTER_ITEM(VaporizerCells, Ammo) { +#ifndef MENUQC + this.m_model = MDL_VaporizerCells_ITEM; + this.m_sound = SND_VaporizerCells; +#endif + this.m_name = "Vaporizer Ammo"; + this.m_icon = "ammo_supercells"; +#ifdef SVQC + this.m_botvalue = 100; + this.m_itemid = IT_CELLS; + this.m_respawntime = GET(instagib_respawntime_ammo); + this.m_respawntimejitter = GET(instagib_respawntimejitter_ammo); +#endif +} + +#ifndef MENUQC +MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3")); +SOUND(ExtraLife, "misc/megahealth"); +#endif + +REGISTER_ITEM(ExtraLife, Powerup) { +#ifndef MENUQC + this.m_model = MDL_ExtraLife_ITEM; + this.m_sound = SND_ExtraLife; +#endif + this.m_name = "Extra life"; + this.m_icon = "item_mega_health"; + this.m_color = '1 0 0'; + this.m_waypoint = _("Extra life"); + this.m_waypointblink = 2; + this.m_itemid = IT_NAILS; +} + +#ifndef MENUQC +MODEL(Invisibility_ITEM, Item_Model("g_strength.md3")); +SOUND(Invisibility, "misc/powerup"); +#endif + +REGISTER_ITEM(Invisibility, Powerup) { +#ifndef MENUQC + this.m_model = MDL_Invisibility_ITEM; + this.m_sound = SND_Invisibility; +#endif + this.m_name = "Invisibility"; + this.m_icon = "strength"; + this.m_color = '0 0 1'; + this.m_waypoint = _("Invisibility"); + this.m_waypointblink = 2; + this.m_itemid = IT_STRENGTH; +} + +#ifndef MENUQC +MODEL(Speed_ITEM, Item_Model("g_invincible.md3")); +SOUND(Speed, "misc/powerup_shield"); +#endif + +REGISTER_ITEM(Speed, Powerup) { +#ifndef MENUQC + this.m_model = MDL_Speed_ITEM; + this.m_sound = SND_Speed; +#endif + this.m_name = "Speed"; + this.m_icon = "shield"; + this.m_color = '1 0 1'; + this.m_waypoint = _("Speed"); + this.m_waypointblink = 2; + this.m_itemid = IT_INVINCIBLE; +} diff --git a/qcsrc/common/mutators/mutator/instagib/module.inc b/qcsrc/common/mutators/mutator/instagib/module.inc deleted file mode 100644 index 7270067d3..000000000 --- a/qcsrc/common/mutators/mutator/instagib/module.inc +++ /dev/null @@ -1 +0,0 @@ -#include "instagib.qc" diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc similarity index 98% rename from qcsrc/common/mutators/mutator/instagib/instagib.qc rename to qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 25edbb225..6176ebbab 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -1,22 +1,10 @@ -#ifndef MUTATOR_INSTAGIB_H -#define MUTATOR_INSTAGIB_H - -#include "items.qc" - -#ifdef SVQC -float autocvar_g_instagib_invis_alpha; -#endif - -#endif - -#ifdef IMPLEMENTATION -#ifdef SVQC +#include "sv_instagib.qh" int autocvar_g_instagib_ammo_drop; int autocvar_g_instagib_extralives; float autocvar_g_instagib_speed_highspeed; -#include +#include #include @@ -500,6 +488,3 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, SetModname) M_ARGV(0, string) = "InstaGib"; return true; } - -#endif -#endif diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh new file mode 100644 index 000000000..4c6d20b12 --- /dev/null +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh @@ -0,0 +1,5 @@ +#pragma once + +#include "items.qh" + +float autocvar_g_instagib_invis_alpha; diff --git a/qcsrc/common/mutators/mutator/invincibleproj/_mod.inc b/qcsrc/common/mutators/mutator/invincibleproj/_mod.inc index 68d313e95..eb8c95fcb 100644 --- a/qcsrc/common/mutators/mutator/invincibleproj/_mod.inc +++ b/qcsrc/common/mutators/mutator/invincibleproj/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/invincibleproj/_mod.qh b/qcsrc/common/mutators/mutator/invincibleproj/_mod.qh index dc3f32f10..2d59a0891 100644 --- a/qcsrc/common/mutators/mutator/invincibleproj/_mod.qh +++ b/qcsrc/common/mutators/mutator/invincibleproj/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/invincibleproj/module.inc b/qcsrc/common/mutators/mutator/invincibleproj/module.inc deleted file mode 100644 index 61d038350..000000000 --- a/qcsrc/common/mutators/mutator/invincibleproj/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "invincibleproj.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/invincibleproj/invincibleproj.qc b/qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qc similarity index 94% rename from qcsrc/common/mutators/mutator/invincibleproj/invincibleproj.qc rename to qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qc index 5bdafa1f1..23e0d0d85 100644 --- a/qcsrc/common/mutators/mutator/invincibleproj/invincibleproj.qc +++ b/qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_invincibleproj.qh" + REGISTER_MUTATOR(invincibleprojectiles, cvar("g_invincible_projectiles")); MUTATOR_HOOKFUNCTION(invincibleprojectiles, EditProjectile) @@ -21,4 +22,3 @@ MUTATOR_HOOKFUNCTION(invincibleprojectiles, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Invincible Projectiles"); } -#endif diff --git a/qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qh b/qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/itemstime/_mod.inc b/qcsrc/common/mutators/mutator/itemstime/_mod.inc new file mode 100644 index 000000000..5b34dd621 --- /dev/null +++ b/qcsrc/common/mutators/mutator/itemstime/_mod.inc @@ -0,0 +1,2 @@ +// generated file; do not modify +#include diff --git a/qcsrc/common/mutators/mutator/itemstime/_mod.qh b/qcsrc/common/mutators/mutator/itemstime/_mod.qh new file mode 100644 index 000000000..5c73eea2e --- /dev/null +++ b/qcsrc/common/mutators/mutator/itemstime/_mod.qh @@ -0,0 +1,2 @@ +// generated file; do not modify +#include diff --git a/qcsrc/common/mutators/mutator/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc similarity index 99% rename from qcsrc/common/mutators/mutator/itemstime.qc rename to qcsrc/common/mutators/mutator/itemstime/itemstime.qc index c6afa3316..0c348b624 100644 --- a/qcsrc/common/mutators/mutator/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "itemstime.qh" + REGISTER_MUTATOR(itemstime, true); REGISTER_NET_TEMP(itemstime) @@ -431,4 +432,3 @@ LABEL(iteration) } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/itemstime/itemstime.qh b/qcsrc/common/mutators/mutator/itemstime/itemstime.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/itemstime/itemstime.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/melee_only/_mod.inc b/qcsrc/common/mutators/mutator/melee_only/_mod.inc index db31be3fd..da02f0808 100644 --- a/qcsrc/common/mutators/mutator/melee_only/_mod.inc +++ b/qcsrc/common/mutators/mutator/melee_only/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/melee_only/_mod.qh b/qcsrc/common/mutators/mutator/melee_only/_mod.qh index 2228d64f1..297bb2b96 100644 --- a/qcsrc/common/mutators/mutator/melee_only/_mod.qh +++ b/qcsrc/common/mutators/mutator/melee_only/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/melee_only/module.inc b/qcsrc/common/mutators/mutator/melee_only/module.inc deleted file mode 100644 index c711556cc..000000000 --- a/qcsrc/common/mutators/mutator/melee_only/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "melee_only.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/melee_only/melee_only.qc b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc similarity index 96% rename from qcsrc/common/mutators/mutator/melee_only/melee_only.qc rename to qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc index ecd5fc7c8..e07034baf 100644 --- a/qcsrc/common/mutators/mutator/melee_only/melee_only.qc +++ b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_melee_only.qh" + REGISTER_MUTATOR(melee_only, cvar("g_melee_only") && !cvar("g_instagib") && !g_nexball); MUTATOR_HOOKFUNCTION(melee_only, SetStartItems) @@ -35,4 +36,3 @@ MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee Only Arena"); } -#endif diff --git a/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qh b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/midair/_mod.inc b/qcsrc/common/mutators/mutator/midair/_mod.inc index 8fcc96ea2..b144ca4b6 100644 --- a/qcsrc/common/mutators/mutator/midair/_mod.inc +++ b/qcsrc/common/mutators/mutator/midair/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/midair/_mod.qh b/qcsrc/common/mutators/mutator/midair/_mod.qh index 48272b870..f96da1386 100644 --- a/qcsrc/common/mutators/mutator/midair/_mod.qh +++ b/qcsrc/common/mutators/mutator/midair/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/midair/module.inc b/qcsrc/common/mutators/mutator/midair/module.inc deleted file mode 100644 index 10b178915..000000000 --- a/qcsrc/common/mutators/mutator/midair/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "midair.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/midair/midair.qc b/qcsrc/common/mutators/mutator/midair/sv_midair.qc similarity index 97% rename from qcsrc/common/mutators/mutator/midair/midair.qc rename to qcsrc/common/mutators/mutator/midair/sv_midair.qc index 1fa69a60e..40747ff05 100644 --- a/qcsrc/common/mutators/mutator/midair/midair.qc +++ b/qcsrc/common/mutators/mutator/midair/sv_midair.qc @@ -1,4 +1,4 @@ -#ifdef IMPLEMENTATION +#include "sv_midair.qh" float autocvar_g_midair_shieldtime; @@ -46,4 +46,3 @@ MUTATOR_HOOKFUNCTION(midair, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Midair"); } -#endif diff --git a/qcsrc/common/mutators/mutator/midair/sv_midair.qh b/qcsrc/common/mutators/mutator/midair/sv_midair.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/midair/sv_midair.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/multijump/module.inc b/qcsrc/common/mutators/mutator/multijump/module.inc deleted file mode 100644 index 310332099..000000000 --- a/qcsrc/common/mutators/mutator/multijump/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef MENUQC -#include "multijump.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/multijump/multijump.qc b/qcsrc/common/mutators/mutator/multijump/multijump.qc index d6dc30cee..aeee45e12 100644 --- a/qcsrc/common/mutators/mutator/multijump/multijump.qc +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qc @@ -1,4 +1,7 @@ -#ifdef IMPLEMENTATION +#include "multijump.qh" + +#ifndef MENUQC + #ifdef SVQC #include #endif @@ -126,4 +129,5 @@ MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsPrettyString) } #endif + #endif diff --git a/qcsrc/common/mutators/mutator/multijump/multijump.qh b/qcsrc/common/mutators/mutator/multijump/multijump.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/nades/module.inc b/qcsrc/common/mutators/mutator/nades/module.inc deleted file mode 100644 index e03900d6a..000000000 --- a/qcsrc/common/mutators/mutator/nades/module.inc +++ /dev/null @@ -1,4 +0,0 @@ -#include "nades.qc" -#ifndef MENUQC -#include "net.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index d785124a7..b8d100786 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1,7 +1,5 @@ #include "nades.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC bool autocvar_g_nades_nade_small; float autocvar_g_nades_spread = 0.04; @@ -147,7 +145,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan #ifdef SVQC -#include +#include #include #include #include @@ -1486,4 +1484,3 @@ MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString) } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index d4f6f7e36..0402295e2 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -1,5 +1,4 @@ -#ifndef NADES_ALL_H -#define NADES_ALL_H +#pragma once #include @@ -102,5 +101,3 @@ void nades_GiveBonus(entity player, float score); MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage); #endif - -#endif diff --git a/qcsrc/common/mutators/mutator/nades/net.qc b/qcsrc/common/mutators/mutator/nades/net.qc index e2659c7af..ea7874580 100644 --- a/qcsrc/common/mutators/mutator/nades/net.qc +++ b/qcsrc/common/mutators/mutator/nades/net.qc @@ -1,6 +1,8 @@ -#include "nades.qh" +#include "net.qh" + +#ifndef MENUQC -#ifdef IMPLEMENTATION +#include "nades.qh" #ifdef CSQC .float ltime; diff --git a/qcsrc/common/mutators/mutator/nades/net.qh b/qcsrc/common/mutators/mutator/nades/net.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/nades/net.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/new_toys/_mod.inc b/qcsrc/common/mutators/mutator/new_toys/_mod.inc index 90e9811ea..67ee4f534 100644 --- a/qcsrc/common/mutators/mutator/new_toys/_mod.inc +++ b/qcsrc/common/mutators/mutator/new_toys/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/new_toys/_mod.qh b/qcsrc/common/mutators/mutator/new_toys/_mod.qh index ec3b8105f..97f88a519 100644 --- a/qcsrc/common/mutators/mutator/new_toys/_mod.qh +++ b/qcsrc/common/mutators/mutator/new_toys/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/new_toys/module.inc b/qcsrc/common/mutators/mutator/new_toys/module.inc deleted file mode 100644 index 1217177c5..000000000 --- a/qcsrc/common/mutators/mutator/new_toys/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "new_toys.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/new_toys/new_toys.qc b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc similarity index 99% rename from qcsrc/common/mutators/mutator/new_toys/new_toys.qc rename to qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc index 27d179506..6c0647b1e 100644 --- a/qcsrc/common/mutators/mutator/new_toys/new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_new_toys.qh" + /* CORE laser vortex lg rl cry gl elec hagar fireb hook @@ -226,4 +227,3 @@ MUTATOR_HOOKFUNCTION(nt, FilterItem) item.item_pickupsound_ent = SND_WEAPONPICKUP_NEW_TOYS; } } -#endif diff --git a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qh b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/nix/_mod.inc b/qcsrc/common/mutators/mutator/nix/_mod.inc index a669175da..3c3141d6f 100644 --- a/qcsrc/common/mutators/mutator/nix/_mod.inc +++ b/qcsrc/common/mutators/mutator/nix/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/nix/_mod.qh b/qcsrc/common/mutators/mutator/nix/_mod.qh index 6c012fe65..affbae20a 100644 --- a/qcsrc/common/mutators/mutator/nix/_mod.qh +++ b/qcsrc/common/mutators/mutator/nix/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/nix/module.inc b/qcsrc/common/mutators/mutator/nix/module.inc deleted file mode 100644 index fb4f9ec2b..000000000 --- a/qcsrc/common/mutators/mutator/nix/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "nix.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/nix/nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc similarity index 99% rename from qcsrc/common/mutators/mutator/nix/nix.qc rename to qcsrc/common/mutators/mutator/nix/sv_nix.qc index f52d75a9e..97ed4361b 100644 --- a/qcsrc/common/mutators/mutator/nix/nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_nix.qh" + int autocvar_g_balance_nix_ammo_cells; int autocvar_g_balance_nix_ammo_plasma; int autocvar_g_balance_nix_ammo_fuel; @@ -285,4 +286,3 @@ MUTATOR_HOOKFUNCTION(nix, SetModname, CBC_ORDER_LAST) { M_ARGV(0, string) = "NIX"; } -#endif diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qh b/qcsrc/common/mutators/mutator/nix/sv_nix.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/overkill/_mod.inc b/qcsrc/common/mutators/mutator/overkill/_mod.inc index 5b42a4dd1..0552173c1 100644 --- a/qcsrc/common/mutators/mutator/overkill/_mod.inc +++ b/qcsrc/common/mutators/mutator/overkill/_mod.inc @@ -1,4 +1,10 @@ // generated file; do not modify #include #include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif #include diff --git a/qcsrc/common/mutators/mutator/overkill/_mod.qh b/qcsrc/common/mutators/mutator/overkill/_mod.qh index 7a4669444..13e42431b 100644 --- a/qcsrc/common/mutators/mutator/overkill/_mod.qh +++ b/qcsrc/common/mutators/mutator/overkill/_mod.qh @@ -1,4 +1,10 @@ // generated file; do not modify #include #include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif #include diff --git a/qcsrc/common/mutators/mutator/overkill/cl_overkill.qc b/qcsrc/common/mutators/mutator/overkill/cl_overkill.qc new file mode 100644 index 000000000..eb2195395 --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/cl_overkill.qc @@ -0,0 +1,11 @@ +#include "cl_overkill.qh" + +REGISTER_MUTATOR(ok, false) +{ + MUTATOR_ONADD { + cvar_settemp("g_overkill", "1"); + WEP_SHOTGUN.mdl = "ok_shotgun"; + WEP_MACHINEGUN.mdl = "ok_mg"; + WEP_VORTEX.mdl = "ok_sniper"; + } +} diff --git a/qcsrc/common/mutators/mutator/overkill/cl_overkill.qh b/qcsrc/common/mutators/mutator/overkill/cl_overkill.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/cl_overkill.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qc b/qcsrc/common/mutators/mutator/overkill/hmg.qc index 1512992c2..024fdb1cc 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qc @@ -1,47 +1,5 @@ -#ifndef IMPLEMENTATION -CLASS(HeavyMachineGun, Weapon) -/* ammotype */ ATTRIB(HeavyMachineGun, ammo_field, .int, ammo_nails); -/* impulse */ ATTRIB(HeavyMachineGun, impulse, int, 3); -/* flags */ ATTRIB(HeavyMachineGun, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_SUPERWEAPON); -/* rating */ ATTRIB(HeavyMachineGun, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH); -/* color */ ATTRIB(HeavyMachineGun, wpcolor, vector, '0.5 0.5 0'); -/* modelname */ ATTRIB(HeavyMachineGun, mdl, string, "ok_hmg"); -#ifndef MENUQC -/* model */ ATTRIB(HeavyMachineGun, m_model, Model, MDL_HMG_ITEM); -#endif -/* crosshair */ ATTRIB(HeavyMachineGun, w_crosshair, string, "gfx/crosshairuzi"); -/* crosshair */ ATTRIB(HeavyMachineGun, w_crosshair_size, float, 0.6); -/* wepimg */ ATTRIB(HeavyMachineGun, model2, string, "weaponhmg"); -/* refname */ ATTRIB(HeavyMachineGun, netname, string, "hmg"); -/* wepname */ ATTRIB(HeavyMachineGun, m_name, string, _("Heavy Machine Gun")); - -#define X(BEGIN, P, END, class, prefix) \ - BEGIN(class) \ - P(class, prefix, ammo, float, NONE) \ - P(class, prefix, damage, float, NONE) \ - P(class, prefix, force, float, NONE) \ - P(class, prefix, refire, float, NONE) \ - P(class, prefix, reload_ammo, float, NONE) \ - P(class, prefix, reload_time, float, NONE) \ - P(class, prefix, solidpenetration, float, NONE) \ - P(class, prefix, spread_add, float, NONE) \ - P(class, prefix, spread_max, float, NONE) \ - P(class, prefix, spread_min, float, NONE) \ - P(class, prefix, switchdelay_drop, float, NONE) \ - P(class, prefix, switchdelay_raise, float, NONE) \ - P(class, prefix, weaponreplace, string, NONE) \ - P(class, prefix, weaponstartoverride, float, NONE) \ - P(class, prefix, weaponstart, float, NONE) \ - P(class, prefix, weaponthrowable, float, NONE) \ - END() - W_PROPS(X, HeavyMachineGun, hmg) -#undef X - -ENDCLASS(HeavyMachineGun) -REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun)); +#include "hmg.qh" -#endif -#ifdef IMPLEMENTATION #ifdef SVQC REGISTER_MUTATOR(hmg_nadesupport, true); @@ -174,4 +132,3 @@ METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep, entity actor)) } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qh b/qcsrc/common/mutators/mutator/overkill/hmg.qh new file mode 100644 index 000000000..671caa47b --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qh @@ -0,0 +1,42 @@ +#pragma once + +CLASS(HeavyMachineGun, Weapon) +/* ammotype */ ATTRIB(HeavyMachineGun, ammo_field, .int, ammo_nails); +/* impulse */ ATTRIB(HeavyMachineGun, impulse, int, 3); +/* flags */ ATTRIB(HeavyMachineGun, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_SUPERWEAPON); +/* rating */ ATTRIB(HeavyMachineGun, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH); +/* color */ ATTRIB(HeavyMachineGun, wpcolor, vector, '0.5 0.5 0'); +/* modelname */ ATTRIB(HeavyMachineGun, mdl, string, "ok_hmg"); +#ifndef MENUQC +/* model */ ATTRIB(HeavyMachineGun, m_model, Model, MDL_HMG_ITEM); +#endif +/* crosshair */ ATTRIB(HeavyMachineGun, w_crosshair, string, "gfx/crosshairuzi"); +/* crosshair */ ATTRIB(HeavyMachineGun, w_crosshair_size, float, 0.6); +/* wepimg */ ATTRIB(HeavyMachineGun, model2, string, "weaponhmg"); +/* refname */ ATTRIB(HeavyMachineGun, netname, string, "hmg"); +/* wepname */ ATTRIB(HeavyMachineGun, m_name, string, _("Heavy Machine Gun")); + +#define X(BEGIN, P, END, class, prefix) \ + BEGIN(class) \ + P(class, prefix, ammo, float, NONE) \ + P(class, prefix, damage, float, NONE) \ + P(class, prefix, force, float, NONE) \ + P(class, prefix, refire, float, NONE) \ + P(class, prefix, reload_ammo, float, NONE) \ + P(class, prefix, reload_time, float, NONE) \ + P(class, prefix, solidpenetration, float, NONE) \ + P(class, prefix, spread_add, float, NONE) \ + P(class, prefix, spread_max, float, NONE) \ + P(class, prefix, spread_min, float, NONE) \ + P(class, prefix, switchdelay_drop, float, NONE) \ + P(class, prefix, switchdelay_raise, float, NONE) \ + P(class, prefix, weaponreplace, string, NONE) \ + P(class, prefix, weaponstartoverride, float, NONE) \ + P(class, prefix, weaponstart, float, NONE) \ + P(class, prefix, weaponthrowable, float, NONE) \ + END() + W_PROPS(X, HeavyMachineGun, hmg) +#undef X + +ENDCLASS(HeavyMachineGun) +REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun)); diff --git a/qcsrc/common/mutators/mutator/overkill/module.inc b/qcsrc/common/mutators/mutator/overkill/module.inc deleted file mode 100644 index a7acff5a0..000000000 --- a/qcsrc/common/mutators/mutator/overkill/module.inc +++ /dev/null @@ -1,19 +0,0 @@ -#include "hmg.qc" -#include "rpc.qc" - -#ifdef SVQC - #include "overkill.qc" -#endif -#ifdef CSQC - #ifdef IMPLEMENTATION - REGISTER_MUTATOR(ok, false) - { - MUTATOR_ONADD { - cvar_settemp("g_overkill", "1"); - WEP_SHOTGUN.mdl = "ok_shotgun"; - WEP_MACHINEGUN.mdl = "ok_mg"; - WEP_VORTEX.mdl = "ok_sniper"; - } - } - #endif -#endif diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index f49fdc11b..e69de29bb 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -1,410 +0,0 @@ -#ifdef IMPLEMENTATION -bool autocvar_g_overkill_powerups_replace; -float autocvar_g_overkill_superguns_respawn_time; -bool autocvar_g_overkill_100h_anyway; -bool autocvar_g_overkill_100a_anyway; -bool autocvar_g_overkill_ammo_charge; -float autocvar_g_overkill_ammo_charge_notice; -float autocvar_g_overkill_ammo_charge_limit; - -.vector ok_deathloc; -.float ok_spawnsys_timer; -.float ok_lastwep; -.float ok_item; - -.float ok_notice_time; -.float ammo_charge[Weapons_MAX]; -.float ok_use_ammocharge = _STAT(OK_AMMO_CHARGE); -.float ok_ammo_charge = _STAT(OK_AMMO_CHARGEPOOL); - -.float ok_pauseregen_finished; - -void(entity ent, float wep) ok_DecreaseCharge; - -void ok_Initialize(); - -REGISTER_MUTATOR(ok, cvar("g_overkill") && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill") -{ - MUTATOR_ONADD - { - ok_Initialize(); - } - - MUTATOR_ONREMOVE - { - WEP_RPC.spawnflags |= WEP_FLAG_MUTATORBLOCKED; - WEP_HMG.spawnflags |= WEP_FLAG_MUTATORBLOCKED; - } -} - -MUTATOR_HOOKFUNCTION(ok, W_DecreaseAmmo) -{ - entity actor = M_ARGV(0, entity); - if (actor.ok_use_ammocharge) - { - ok_DecreaseCharge(actor, PS(actor).m_weapon.m_id); - return true; - } -} - -MUTATOR_HOOKFUNCTION(ok, W_Reload) -{ - entity actor = M_ARGV(0, entity); - return actor.ok_use_ammocharge; -} - -void W_Blaster_Attack(entity, .entity, float, float, float, float, float, float, float, float, float, float); -spawnfunc(weapon_hmg); -spawnfunc(weapon_rpc); - -void ok_DecreaseCharge(entity ent, int wep) -{ - if(!ent.ok_use_ammocharge) return; - - entity wepent = Weapons_from(wep); - - if (wepent == WEP_Null) return; // dummy - - ent.ammo_charge[wep] -= max(0, cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname))); -} - -void ok_IncreaseCharge(entity ent, int wep) -{ - entity wepent = Weapons_from(wep); - - if (wepent == WEP_Null) return; // dummy - - if(ent.ok_use_ammocharge) - if(!PHYS_INPUT_BUTTON_ATCK(ent)) // not while attacking? - ent.ammo_charge[wep] = min(autocvar_g_overkill_ammo_charge_limit, ent.ammo_charge[wep] + cvar(sprintf("g_overkill_ammo_charge_rate_%s", wepent.netname)) * frametime / W_TICSPERFRAME); -} - -float ok_CheckWeaponCharge(entity ent, int wep) -{ - if(!ent.ok_use_ammocharge) return true; - - entity wepent = Weapons_from(wep); - - if(wepent == WEP_Null) return false; // dummy - - return (ent.ammo_charge[wep] >= cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname))); -} - -MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST) -{ - entity frag_attacker = M_ARGV(1, entity); - entity frag_target = M_ARGV(2, entity); - float frag_deathtype = M_ARGV(3, float); - - if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target)) - if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER)) - { - if(frag_attacker != frag_target) - if(frag_target.health > 0) - if(STAT(FROZEN, frag_target) == 0) - if(!IS_DEAD(frag_target)) - { - Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); - M_ARGV(6, vector) = '0 0 0'; - } - - M_ARGV(4, float) = 0; - } -} - -MUTATOR_HOOKFUNCTION(ok, PlayerDamage_SplitHealthArmor) -{ - entity frag_target = M_ARGV(2, entity); - float damage_take = M_ARGV(4, float); - - if(damage_take) - frag_target.ok_pauseregen_finished = max(frag_target.ok_pauseregen_finished, time + 2); -} - -void ok_DropItem(entity this, entity targ) -{ - entity e = new(droppedweapon); // hax - e.ok_item = true; - e.noalign = true; - e.pickup_anyway = true; - e.spawnfunc_checked = true; - spawnfunc_item_armor_small(e); - if (!wasfreed(e)) { // might have been blocked by a mutator - set_movetype(e, MOVETYPE_TOSS); - e.gravity = 1; - e.reset = SUB_Remove; - setorigin(e, this.origin + '0 0 32'); - e.velocity = '0 0 200' + normalize(targ.origin - this.origin) * 500; - SUB_SetFade(e, time + 5, 1); - } -} - -MUTATOR_HOOKFUNCTION(ok, PlayerDies) -{ - entity frag_attacker = M_ARGV(1, entity); - entity frag_target = M_ARGV(2, entity); - - entity targ = ((frag_attacker) ? frag_attacker : frag_target); - - ok_DropItem(frag_target, targ); - - frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id; -} - -MUTATOR_HOOKFUNCTION(ok, MonsterDropItem) -{ - entity mon = M_ARGV(0, entity); - entity olditem = M_ARGV(1, entity); - entity frag_attacker = M_ARGV(2, entity); - - delete(olditem); - - M_ARGV(1, entity) = NULL; - - ok_DropItem(mon, frag_attacker); -} - -MUTATOR_HOOKFUNCTION(ok, PlayerRegen) -{ - entity player = M_ARGV(0, entity); - - // overkill's values are different, so use custom regen - if(!STAT(FROZEN, player)) - { - player.armorvalue = CalcRotRegen(player.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, - 1 * frametime * (time > player.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > player.pauserotarmor_finished), autocvar_g_balance_armor_limit); - player.health = CalcRotRegen(player.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > player.ok_pauseregen_finished), 200, 0, - autocvar_g_balance_health_rotlinear, 1 * frametime * (time > player.pauserothealth_finished), autocvar_g_balance_health_limit); - - float minf, maxf, limitf; - - maxf = autocvar_g_balance_fuel_rotstable; - minf = autocvar_g_balance_fuel_regenstable; - limitf = autocvar_g_balance_fuel_limit; - - player.ammo_fuel = CalcRotRegen(player.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, - frametime * (time > player.pauseregen_finished) * ((player.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > player.pauserotfuel_finished), limitf); - } - return true; // return true anyway, as frozen uses no regen -} - -MUTATOR_HOOKFUNCTION(ok, ForbidThrowCurrentWeapon) -{ - return true; -} - -MUTATOR_HOOKFUNCTION(ok, PlayerPreThink) -{ - if(intermission_running || gameover) - return; - - entity player = M_ARGV(0, entity); - - if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player)) - return; - - if(player.ok_lastwep) - { - Weapon newwep = Weapons_from(player.ok_lastwep); - if(player.ok_lastwep == WEP_HMG.m_id) - newwep = WEP_MACHINEGUN; - if(player.ok_lastwep == WEP_RPC.m_id) - newwep = WEP_VORTEX; - PS(player).m_switchweapon = newwep; - player.ok_lastwep = 0; - } - - ok_IncreaseCharge(player, PS(player).m_weapon.m_id); - - if(PHYS_INPUT_BUTTON_ATCK2(player)) - if(!forbidWeaponUse(player) || player.weapon_blocked) // allow if weapon is blocked - if(time >= player.jump_interval) - { - player.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(player); - makevectors(player.v_angle); - - Weapon oldwep = PS(player).m_weapon; - PS(player).m_weapon = WEP_BLASTER; - W_Blaster_Attack( - player, - weaponentities[0], // TODO: unhardcode - WEP_BLASTER.m_id | HITTYPE_SECONDARY, - WEP_CVAR_SEC(vaporizer, shotangle), - WEP_CVAR_SEC(vaporizer, damage), - WEP_CVAR_SEC(vaporizer, edgedamage), - WEP_CVAR_SEC(vaporizer, radius), - WEP_CVAR_SEC(vaporizer, force), - WEP_CVAR_SEC(vaporizer, speed), - WEP_CVAR_SEC(vaporizer, spread), - WEP_CVAR_SEC(vaporizer, delay), - WEP_CVAR_SEC(vaporizer, lifetime) - ); - PS(player).m_weapon = oldwep; - } - - player.weapon_blocked = false; - - player.ok_ammo_charge = player.ammo_charge[PS(player).m_weapon.m_id]; - - if(player.ok_use_ammocharge) - if(!ok_CheckWeaponCharge(player, PS(player).m_weapon.m_id)) - { - if(autocvar_g_overkill_ammo_charge_notice && time > player.ok_notice_time && PHYS_INPUT_BUTTON_ATCK(player) && IS_REAL_CLIENT(player) && PS(player).m_weapon == PS(player).m_switchweapon) - { - //Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERKILL_CHARGE); - player.ok_notice_time = time + 2; - play2(player, SND(DRYFIRE)); - } - Weapon wpn = PS(player).m_weapon; - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - if(player.(weaponentity).state != WS_CLEAR) - w_ready(wpn, player, weaponentity, PHYS_INPUT_BUTTON_ATCK(player) | (PHYS_INPUT_BUTTON_ATCK2(player) << 1)); - - player.weapon_blocked = true; - } - - PHYS_INPUT_BUTTON_ATCK2(player) = false; -} - -MUTATOR_HOOKFUNCTION(ok, PlayerSpawn) -{ - entity player = M_ARGV(0, entity); - - if(autocvar_g_overkill_ammo_charge) - { - FOREACH(Weapons, it != WEP_Null, LAMBDA(player.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit)); - - player.ok_use_ammocharge = 1; - player.ok_notice_time = time; - } - else - player.ok_use_ammocharge = 0; - - // if player changed their weapon while dead, don't switch to their death weapon - if(player.impulse) - player.ok_lastwep = 0; - - player.ok_pauseregen_finished = time + 2; -} - -void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); } -void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); } - -MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) -{ - entity ent = M_ARGV(0, entity); - - if(autocvar_g_powerups) - if(autocvar_g_overkill_powerups_replace) - { - if(ent.classname == "item_strength") - { - entity wep = new(weapon_hmg); - setorigin(wep, ent.origin); - setmodel(wep, MDL_OK_HMG); - wep.ok_item = true; - wep.noalign = ent.noalign; - wep.cnt = ent.cnt; - wep.team = ent.team; - wep.respawntime = autocvar_g_overkill_superguns_respawn_time; - wep.pickup_anyway = true; - wep.spawnfunc_checked = true; - setthink(wep, self_spawnfunc_weapon_hmg); - wep.nextthink = time + 0.1; - return true; - } - - if(ent.classname == "item_invincible") - { - entity wep = new(weapon_rpc); - setorigin(wep, ent.origin); - setmodel(wep, MDL_OK_RPC); - wep.ok_item = true; - wep.noalign = ent.noalign; - wep.cnt = ent.cnt; - wep.team = ent.team; - wep.respawntime = autocvar_g_overkill_superguns_respawn_time; - wep.pickup_anyway = true; - wep.spawnfunc_checked = true; - setthink(wep, self_spawnfunc_weapon_rpc); - wep.nextthink = time + 0.1; - return true; - } - } -} - -MUTATOR_HOOKFUNCTION(ok, FilterItem) -{ - entity item = M_ARGV(0, entity); - - if(item.ok_item) - return; - - switch(item.items) - { - case ITEM_HealthMega.m_itemid: return !(autocvar_g_overkill_100h_anyway); - case ITEM_ArmorMega.m_itemid: return !(autocvar_g_overkill_100a_anyway); - } - - return true; -} - -MUTATOR_HOOKFUNCTION(ok, SpectateCopy) -{ - entity spectatee = M_ARGV(0, entity); - entity client = M_ARGV(1, entity); - - client.ammo_charge[PS(client).m_weapon.m_id] = spectatee.ammo_charge[PS(spectatee).m_weapon.m_id]; - client.ok_use_ammocharge = spectatee.ok_use_ammocharge; -} - -MUTATOR_HOOKFUNCTION(ok, SetStartItems) -{ - WepSet ok_start_items = (WEPSET(MACHINEGUN) | WEPSET(VORTEX) | WEPSET(SHOTGUN)); - - if(WEP_RPC.weaponstart > 0) { ok_start_items |= WEPSET(RPC); } - if(WEP_HMG.weaponstart > 0) { ok_start_items |= WEPSET(HMG); } - - start_items |= IT_UNLIMITED_WEAPON_AMMO; - start_weapons = warmup_start_weapons = ok_start_items; -} - -MUTATOR_HOOKFUNCTION(ok, BuildMutatorsString) -{ - M_ARGV(0, string) = strcat(M_ARGV(0, string), ":OK"); -} - -MUTATOR_HOOKFUNCTION(ok, BuildMutatorsPrettyString) -{ - M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Overkill"); -} - -MUTATOR_HOOKFUNCTION(ok, SetModname) -{ - M_ARGV(0, string) = "Overkill"; - return true; -} - -void ok_SetCvars() -{ - // hack to force overkill playermodels - cvar_settemp("sv_defaultcharacter", "1"); - cvar_settemp("sv_defaultplayermodel", "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"); - cvar_settemp("sv_defaultplayermodel_red", "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm"); - cvar_settemp("sv_defaultplayermodel_blue", "models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"); -} - -void ok_Initialize() -{ - ok_SetCvars(); - - precache_all_playermodels("models/ok_player/*.dpm"); - - WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; - WEP_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; - - WEP_SHOTGUN.mdl = "ok_shotgun"; - WEP_MACHINEGUN.mdl = "ok_mg"; - WEP_VORTEX.mdl = "ok_sniper"; -} -#endif diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qh b/qcsrc/common/mutators/mutator/overkill/overkill.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index f9be2ad9f..4540a26f2 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -1,52 +1,5 @@ -#ifndef IMPLEMENTATION -CLASS(RocketPropelledChainsaw, Weapon) -/* ammotype */ ATTRIB(RocketPropelledChainsaw, ammo_field, .int, ammo_rockets); -/* impulse */ ATTRIB(RocketPropelledChainsaw, impulse, int, 7); -/* flags */ ATTRIB(RocketPropelledChainsaw, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON); -/* rating */ ATTRIB(RocketPropelledChainsaw, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH); -/* color */ ATTRIB(RocketPropelledChainsaw, wpcolor, vector, '0.5 0.5 0'); -/* modelname */ ATTRIB(RocketPropelledChainsaw, mdl, string, "ok_rl"); -#ifndef MENUQC -/* model */ ATTRIB(RocketPropelledChainsaw, m_model, Model, MDL_RPC_ITEM); -#endif -/* crosshair */ ATTRIB(RocketPropelledChainsaw, w_crosshair, string, "gfx/crosshairrocketlauncher"); -/* crosshair */ ATTRIB(RocketPropelledChainsaw, w_crosshair_size, float, 0.6); -/* wepimg */ ATTRIB(RocketPropelledChainsaw, model2, string, "weaponrpc"); -/* refname */ ATTRIB(RocketPropelledChainsaw, netname, string, "rpc"); -/* wepname */ ATTRIB(RocketPropelledChainsaw, m_name, string, _("Rocket Propelled Chainsaw")); - -#define X(BEGIN, P, END, class, prefix) \ - BEGIN(class) \ - P(class, prefix, ammo, float, NONE) \ - P(class, prefix, animtime, float, NONE) \ - P(class, prefix, damage2, float, NONE) \ - P(class, prefix, damageforcescale, float, NONE) \ - P(class, prefix, damage, float, NONE) \ - P(class, prefix, edgedamage, float, NONE) \ - P(class, prefix, force, float, NONE) \ - P(class, prefix, health, float, NONE) \ - P(class, prefix, lifetime, float, NONE) \ - P(class, prefix, radius, float, NONE) \ - P(class, prefix, refire, float, NONE) \ - P(class, prefix, reload_ammo, float, NONE) \ - P(class, prefix, reload_time, float, NONE) \ - P(class, prefix, speedaccel, float, NONE) \ - P(class, prefix, speed, float, NONE) \ - P(class, prefix, switchdelay_drop, float, NONE) \ - P(class, prefix, switchdelay_raise, float, NONE) \ - P(class, prefix, weaponreplace, string, NONE) \ - P(class, prefix, weaponstartoverride, float, NONE) \ - P(class, prefix, weaponstart, float, NONE) \ - P(class, prefix, weaponthrowable, float, NONE) \ - END() - W_PROPS(X, RocketPropelledChainsaw, rpc) -#undef X - -ENDCLASS(RocketPropelledChainsaw) -REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw)); +#include "rpc.qh" -#endif -#ifdef IMPLEMENTATION #ifdef SVQC spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); } @@ -232,4 +185,3 @@ METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity act } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qh b/qcsrc/common/mutators/mutator/overkill/rpc.qh new file mode 100644 index 000000000..d68c9d980 --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qh @@ -0,0 +1,47 @@ +#pragma once + +CLASS(RocketPropelledChainsaw, Weapon) +/* ammotype */ ATTRIB(RocketPropelledChainsaw, ammo_field, .int, ammo_rockets); +/* impulse */ ATTRIB(RocketPropelledChainsaw, impulse, int, 7); +/* flags */ ATTRIB(RocketPropelledChainsaw, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON); +/* rating */ ATTRIB(RocketPropelledChainsaw, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH); +/* color */ ATTRIB(RocketPropelledChainsaw, wpcolor, vector, '0.5 0.5 0'); +/* modelname */ ATTRIB(RocketPropelledChainsaw, mdl, string, "ok_rl"); +#ifndef MENUQC +/* model */ ATTRIB(RocketPropelledChainsaw, m_model, Model, MDL_RPC_ITEM); +#endif +/* crosshair */ ATTRIB(RocketPropelledChainsaw, w_crosshair, string, "gfx/crosshairrocketlauncher"); +/* crosshair */ ATTRIB(RocketPropelledChainsaw, w_crosshair_size, float, 0.6); +/* wepimg */ ATTRIB(RocketPropelledChainsaw, model2, string, "weaponrpc"); +/* refname */ ATTRIB(RocketPropelledChainsaw, netname, string, "rpc"); +/* wepname */ ATTRIB(RocketPropelledChainsaw, m_name, string, _("Rocket Propelled Chainsaw")); + +#define X(BEGIN, P, END, class, prefix) \ + BEGIN(class) \ + P(class, prefix, ammo, float, NONE) \ + P(class, prefix, animtime, float, NONE) \ + P(class, prefix, damage2, float, NONE) \ + P(class, prefix, damageforcescale, float, NONE) \ + P(class, prefix, damage, float, NONE) \ + P(class, prefix, edgedamage, float, NONE) \ + P(class, prefix, force, float, NONE) \ + P(class, prefix, health, float, NONE) \ + P(class, prefix, lifetime, float, NONE) \ + P(class, prefix, radius, float, NONE) \ + P(class, prefix, refire, float, NONE) \ + P(class, prefix, reload_ammo, float, NONE) \ + P(class, prefix, reload_time, float, NONE) \ + P(class, prefix, speedaccel, float, NONE) \ + P(class, prefix, speed, float, NONE) \ + P(class, prefix, switchdelay_drop, float, NONE) \ + P(class, prefix, switchdelay_raise, float, NONE) \ + P(class, prefix, weaponreplace, string, NONE) \ + P(class, prefix, weaponstartoverride, float, NONE) \ + P(class, prefix, weaponstart, float, NONE) \ + P(class, prefix, weaponthrowable, float, NONE) \ + END() + W_PROPS(X, RocketPropelledChainsaw, rpc) +#undef X + +ENDCLASS(RocketPropelledChainsaw) +REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw)); diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc new file mode 100644 index 000000000..6d5ac8086 --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -0,0 +1,410 @@ +#include "sv_overkill.qh" + +bool autocvar_g_overkill_powerups_replace; +float autocvar_g_overkill_superguns_respawn_time; +bool autocvar_g_overkill_100h_anyway; +bool autocvar_g_overkill_100a_anyway; +bool autocvar_g_overkill_ammo_charge; +float autocvar_g_overkill_ammo_charge_notice; +float autocvar_g_overkill_ammo_charge_limit; + +.vector ok_deathloc; +.float ok_spawnsys_timer; +.float ok_lastwep; +.float ok_item; + +.float ok_notice_time; +.float ammo_charge[Weapons_MAX]; +.float ok_use_ammocharge = _STAT(OK_AMMO_CHARGE); +.float ok_ammo_charge = _STAT(OK_AMMO_CHARGEPOOL); + +.float ok_pauseregen_finished; + +void(entity ent, float wep) ok_DecreaseCharge; + +void ok_Initialize(); + +REGISTER_MUTATOR(ok, cvar("g_overkill") && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill") +{ + MUTATOR_ONADD + { + ok_Initialize(); + } + + MUTATOR_ONREMOVE + { + WEP_RPC.spawnflags |= WEP_FLAG_MUTATORBLOCKED; + WEP_HMG.spawnflags |= WEP_FLAG_MUTATORBLOCKED; + } +} + +MUTATOR_HOOKFUNCTION(ok, W_DecreaseAmmo) +{ + entity actor = M_ARGV(0, entity); + if (actor.ok_use_ammocharge) + { + ok_DecreaseCharge(actor, PS(actor).m_weapon.m_id); + return true; + } +} + +MUTATOR_HOOKFUNCTION(ok, W_Reload) +{ + entity actor = M_ARGV(0, entity); + return actor.ok_use_ammocharge; +} + +void W_Blaster_Attack(entity, .entity, float, float, float, float, float, float, float, float, float, float); +spawnfunc(weapon_hmg); +spawnfunc(weapon_rpc); + +void ok_DecreaseCharge(entity ent, int wep) +{ + if(!ent.ok_use_ammocharge) return; + + entity wepent = Weapons_from(wep); + + if (wepent == WEP_Null) return; // dummy + + ent.ammo_charge[wep] -= max(0, cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname))); +} + +void ok_IncreaseCharge(entity ent, int wep) +{ + entity wepent = Weapons_from(wep); + + if (wepent == WEP_Null) return; // dummy + + if(ent.ok_use_ammocharge) + if(!PHYS_INPUT_BUTTON_ATCK(ent)) // not while attacking? + ent.ammo_charge[wep] = min(autocvar_g_overkill_ammo_charge_limit, ent.ammo_charge[wep] + cvar(sprintf("g_overkill_ammo_charge_rate_%s", wepent.netname)) * frametime / W_TICSPERFRAME); +} + +float ok_CheckWeaponCharge(entity ent, int wep) +{ + if(!ent.ok_use_ammocharge) return true; + + entity wepent = Weapons_from(wep); + + if(wepent == WEP_Null) return false; // dummy + + return (ent.ammo_charge[wep] >= cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname))); +} + +MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST) +{ + entity frag_attacker = M_ARGV(1, entity); + entity frag_target = M_ARGV(2, entity); + float frag_deathtype = M_ARGV(3, float); + + if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER)) + { + if(frag_attacker != frag_target) + if(frag_target.health > 0) + if(STAT(FROZEN, frag_target) == 0) + if(!IS_DEAD(frag_target)) + { + Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); + M_ARGV(6, vector) = '0 0 0'; + } + + M_ARGV(4, float) = 0; + } +} + +MUTATOR_HOOKFUNCTION(ok, PlayerDamage_SplitHealthArmor) +{ + entity frag_target = M_ARGV(2, entity); + float damage_take = M_ARGV(4, float); + + if(damage_take) + frag_target.ok_pauseregen_finished = max(frag_target.ok_pauseregen_finished, time + 2); +} + +void ok_DropItem(entity this, entity targ) +{ + entity e = new(droppedweapon); // hax + e.ok_item = true; + e.noalign = true; + e.pickup_anyway = true; + e.spawnfunc_checked = true; + spawnfunc_item_armor_small(e); + if (!wasfreed(e)) { // might have been blocked by a mutator + set_movetype(e, MOVETYPE_TOSS); + e.gravity = 1; + e.reset = SUB_Remove; + setorigin(e, this.origin + '0 0 32'); + e.velocity = '0 0 200' + normalize(targ.origin - this.origin) * 500; + SUB_SetFade(e, time + 5, 1); + } +} + +MUTATOR_HOOKFUNCTION(ok, PlayerDies) +{ + entity frag_attacker = M_ARGV(1, entity); + entity frag_target = M_ARGV(2, entity); + + entity targ = ((frag_attacker) ? frag_attacker : frag_target); + + ok_DropItem(frag_target, targ); + + frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id; +} + +MUTATOR_HOOKFUNCTION(ok, MonsterDropItem) +{ + entity mon = M_ARGV(0, entity); + entity olditem = M_ARGV(1, entity); + entity frag_attacker = M_ARGV(2, entity); + + delete(olditem); + + M_ARGV(1, entity) = NULL; + + ok_DropItem(mon, frag_attacker); +} + +MUTATOR_HOOKFUNCTION(ok, PlayerRegen) +{ + entity player = M_ARGV(0, entity); + + // overkill's values are different, so use custom regen + if(!STAT(FROZEN, player)) + { + player.armorvalue = CalcRotRegen(player.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, + 1 * frametime * (time > player.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > player.pauserotarmor_finished), autocvar_g_balance_armor_limit); + player.health = CalcRotRegen(player.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > player.ok_pauseregen_finished), 200, 0, + autocvar_g_balance_health_rotlinear, 1 * frametime * (time > player.pauserothealth_finished), autocvar_g_balance_health_limit); + + float minf, maxf, limitf; + + maxf = autocvar_g_balance_fuel_rotstable; + minf = autocvar_g_balance_fuel_regenstable; + limitf = autocvar_g_balance_fuel_limit; + + player.ammo_fuel = CalcRotRegen(player.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, + frametime * (time > player.pauseregen_finished) * ((player.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > player.pauserotfuel_finished), limitf); + } + return true; // return true anyway, as frozen uses no regen +} + +MUTATOR_HOOKFUNCTION(ok, ForbidThrowCurrentWeapon) +{ + return true; +} + +MUTATOR_HOOKFUNCTION(ok, PlayerPreThink) +{ + if(intermission_running || gameover) + return; + + entity player = M_ARGV(0, entity); + + if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player)) + return; + + if(player.ok_lastwep) + { + Weapon newwep = Weapons_from(player.ok_lastwep); + if(player.ok_lastwep == WEP_HMG.m_id) + newwep = WEP_MACHINEGUN; + if(player.ok_lastwep == WEP_RPC.m_id) + newwep = WEP_VORTEX; + PS(player).m_switchweapon = newwep; + player.ok_lastwep = 0; + } + + ok_IncreaseCharge(player, PS(player).m_weapon.m_id); + + if(PHYS_INPUT_BUTTON_ATCK2(player)) + if(!forbidWeaponUse(player) || player.weapon_blocked) // allow if weapon is blocked + if(time >= player.jump_interval) + { + player.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(player); + makevectors(player.v_angle); + + Weapon oldwep = PS(player).m_weapon; + PS(player).m_weapon = WEP_BLASTER; + W_Blaster_Attack( + player, + weaponentities[0], // TODO: unhardcode + WEP_BLASTER.m_id | HITTYPE_SECONDARY, + WEP_CVAR_SEC(vaporizer, shotangle), + WEP_CVAR_SEC(vaporizer, damage), + WEP_CVAR_SEC(vaporizer, edgedamage), + WEP_CVAR_SEC(vaporizer, radius), + WEP_CVAR_SEC(vaporizer, force), + WEP_CVAR_SEC(vaporizer, speed), + WEP_CVAR_SEC(vaporizer, spread), + WEP_CVAR_SEC(vaporizer, delay), + WEP_CVAR_SEC(vaporizer, lifetime) + ); + PS(player).m_weapon = oldwep; + } + + player.weapon_blocked = false; + + player.ok_ammo_charge = player.ammo_charge[PS(player).m_weapon.m_id]; + + if(player.ok_use_ammocharge) + if(!ok_CheckWeaponCharge(player, PS(player).m_weapon.m_id)) + { + if(autocvar_g_overkill_ammo_charge_notice && time > player.ok_notice_time && PHYS_INPUT_BUTTON_ATCK(player) && IS_REAL_CLIENT(player) && PS(player).m_weapon == PS(player).m_switchweapon) + { + //Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERKILL_CHARGE); + player.ok_notice_time = time + 2; + play2(player, SND(DRYFIRE)); + } + Weapon wpn = PS(player).m_weapon; + .entity weaponentity = weaponentities[0]; // TODO: unhardcode + if(player.(weaponentity).state != WS_CLEAR) + w_ready(wpn, player, weaponentity, PHYS_INPUT_BUTTON_ATCK(player) | (PHYS_INPUT_BUTTON_ATCK2(player) << 1)); + + player.weapon_blocked = true; + } + + PHYS_INPUT_BUTTON_ATCK2(player) = false; +} + +MUTATOR_HOOKFUNCTION(ok, PlayerSpawn) +{ + entity player = M_ARGV(0, entity); + + if(autocvar_g_overkill_ammo_charge) + { + FOREACH(Weapons, it != WEP_Null, LAMBDA(player.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit)); + + player.ok_use_ammocharge = 1; + player.ok_notice_time = time; + } + else + player.ok_use_ammocharge = 0; + + // if player changed their weapon while dead, don't switch to their death weapon + if(player.impulse) + player.ok_lastwep = 0; + + player.ok_pauseregen_finished = time + 2; +} + +void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); } +void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); } + +MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) +{ + entity ent = M_ARGV(0, entity); + + if(autocvar_g_powerups) + if(autocvar_g_overkill_powerups_replace) + { + if(ent.classname == "item_strength") + { + entity wep = new(weapon_hmg); + setorigin(wep, ent.origin); + setmodel(wep, MDL_OK_HMG); + wep.ok_item = true; + wep.noalign = ent.noalign; + wep.cnt = ent.cnt; + wep.team = ent.team; + wep.respawntime = autocvar_g_overkill_superguns_respawn_time; + wep.pickup_anyway = true; + wep.spawnfunc_checked = true; + setthink(wep, self_spawnfunc_weapon_hmg); + wep.nextthink = time + 0.1; + return true; + } + + if(ent.classname == "item_invincible") + { + entity wep = new(weapon_rpc); + setorigin(wep, ent.origin); + setmodel(wep, MDL_OK_RPC); + wep.ok_item = true; + wep.noalign = ent.noalign; + wep.cnt = ent.cnt; + wep.team = ent.team; + wep.respawntime = autocvar_g_overkill_superguns_respawn_time; + wep.pickup_anyway = true; + wep.spawnfunc_checked = true; + setthink(wep, self_spawnfunc_weapon_rpc); + wep.nextthink = time + 0.1; + return true; + } + } +} + +MUTATOR_HOOKFUNCTION(ok, FilterItem) +{ + entity item = M_ARGV(0, entity); + + if(item.ok_item) + return; + + switch(item.items) + { + case ITEM_HealthMega.m_itemid: return !(autocvar_g_overkill_100h_anyway); + case ITEM_ArmorMega.m_itemid: return !(autocvar_g_overkill_100a_anyway); + } + + return true; +} + +MUTATOR_HOOKFUNCTION(ok, SpectateCopy) +{ + entity spectatee = M_ARGV(0, entity); + entity client = M_ARGV(1, entity); + + client.ammo_charge[PS(client).m_weapon.m_id] = spectatee.ammo_charge[PS(spectatee).m_weapon.m_id]; + client.ok_use_ammocharge = spectatee.ok_use_ammocharge; +} + +MUTATOR_HOOKFUNCTION(ok, SetStartItems) +{ + WepSet ok_start_items = (WEPSET(MACHINEGUN) | WEPSET(VORTEX) | WEPSET(SHOTGUN)); + + if(WEP_RPC.weaponstart > 0) { ok_start_items |= WEPSET(RPC); } + if(WEP_HMG.weaponstart > 0) { ok_start_items |= WEPSET(HMG); } + + start_items |= IT_UNLIMITED_WEAPON_AMMO; + start_weapons = warmup_start_weapons = ok_start_items; +} + +MUTATOR_HOOKFUNCTION(ok, BuildMutatorsString) +{ + M_ARGV(0, string) = strcat(M_ARGV(0, string), ":OK"); +} + +MUTATOR_HOOKFUNCTION(ok, BuildMutatorsPrettyString) +{ + M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Overkill"); +} + +MUTATOR_HOOKFUNCTION(ok, SetModname) +{ + M_ARGV(0, string) = "Overkill"; + return true; +} + +void ok_SetCvars() +{ + // hack to force overkill playermodels + cvar_settemp("sv_defaultcharacter", "1"); + cvar_settemp("sv_defaultplayermodel", "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"); + cvar_settemp("sv_defaultplayermodel_red", "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm"); + cvar_settemp("sv_defaultplayermodel_blue", "models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"); +} + +void ok_Initialize() +{ + ok_SetCvars(); + + precache_all_playermodels("models/ok_player/*.dpm"); + + WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; + WEP_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; + + WEP_SHOTGUN.mdl = "ok_shotgun"; + WEP_MACHINEGUN.mdl = "ok_mg"; + WEP_VORTEX.mdl = "ok_sniper"; +} diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/physical_items/_mod.inc b/qcsrc/common/mutators/mutator/physical_items/_mod.inc index 4d4ef59f8..e99d4e257 100644 --- a/qcsrc/common/mutators/mutator/physical_items/_mod.inc +++ b/qcsrc/common/mutators/mutator/physical_items/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/physical_items/_mod.qh b/qcsrc/common/mutators/mutator/physical_items/_mod.qh index a347cec04..1aab8b0a8 100644 --- a/qcsrc/common/mutators/mutator/physical_items/_mod.qh +++ b/qcsrc/common/mutators/mutator/physical_items/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/physical_items/module.inc b/qcsrc/common/mutators/mutator/physical_items/module.inc deleted file mode 100644 index 7ed9b039b..000000000 --- a/qcsrc/common/mutators/mutator/physical_items/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "physical_items.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc similarity index 99% rename from qcsrc/common/mutators/mutator/physical_items/physical_items.qc rename to qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc index f015baeaa..62b30e2d1 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_physical_items.qh" + int autocvar_g_physical_items; float autocvar_g_physical_items_damageforcescale; float autocvar_g_physical_items_reset; @@ -138,4 +139,3 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn) item.aiment = wep; // attach the original weapon setSendEntity(item, func_null); } -#endif diff --git a/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qh b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/pinata/_mod.inc b/qcsrc/common/mutators/mutator/pinata/_mod.inc index a0bd94d00..5859c5510 100644 --- a/qcsrc/common/mutators/mutator/pinata/_mod.inc +++ b/qcsrc/common/mutators/mutator/pinata/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/pinata/_mod.qh b/qcsrc/common/mutators/mutator/pinata/_mod.qh index 1602640e0..fdb51ed25 100644 --- a/qcsrc/common/mutators/mutator/pinata/_mod.qh +++ b/qcsrc/common/mutators/mutator/pinata/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/pinata/module.inc b/qcsrc/common/mutators/mutator/pinata/module.inc deleted file mode 100644 index 4e2296686..000000000 --- a/qcsrc/common/mutators/mutator/pinata/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "pinata.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/pinata/pinata.qc b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc similarity index 96% rename from qcsrc/common/mutators/mutator/pinata/pinata.qc rename to qcsrc/common/mutators/mutator/pinata/sv_pinata.qc index acdf1718b..bc3887e86 100644 --- a/qcsrc/common/mutators/mutator/pinata/pinata.qc +++ b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_pinata.qh" + REGISTER_MUTATOR(pinata, cvar("g_pinata") && !cvar("g_instagib") && !cvar("g_overkill")); MUTATOR_HOOKFUNCTION(pinata, PlayerDies) @@ -24,5 +25,3 @@ MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Piñata"); } - -#endif diff --git a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qh b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/random_gravity/_mod.inc b/qcsrc/common/mutators/mutator/random_gravity/_mod.inc index feeaec8d6..846bd8bf8 100644 --- a/qcsrc/common/mutators/mutator/random_gravity/_mod.inc +++ b/qcsrc/common/mutators/mutator/random_gravity/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/random_gravity/_mod.qh b/qcsrc/common/mutators/mutator/random_gravity/_mod.qh index 99a11ed63..2cdf72402 100644 --- a/qcsrc/common/mutators/mutator/random_gravity/_mod.qh +++ b/qcsrc/common/mutators/mutator/random_gravity/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/random_gravity/module.inc b/qcsrc/common/mutators/mutator/random_gravity/module.inc deleted file mode 100644 index 91baa4310..000000000 --- a/qcsrc/common/mutators/mutator/random_gravity/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "random_gravity.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/random_gravity/random_gravity.qc b/qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qc similarity index 97% rename from qcsrc/common/mutators/mutator/random_gravity/random_gravity.qc rename to qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qc index 9706aeca7..f6f28a7dc 100644 --- a/qcsrc/common/mutators/mutator/random_gravity/random_gravity.qc +++ b/qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qc @@ -1,6 +1,7 @@ -#ifdef IMPLEMENTATION +#include "sv_random_gravity.qh" + // Random Gravity -// + // Mutator by Mario // Inspired by Player 2 @@ -47,4 +48,3 @@ MUTATOR_HOOKFUNCTION(random_gravity, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Random gravity"); } -#endif diff --git a/qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qh b/qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/random_gravity/sv_random_gravity.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/rocketflying/_mod.inc b/qcsrc/common/mutators/mutator/rocketflying/_mod.inc index 0841ae680..537a2b37b 100644 --- a/qcsrc/common/mutators/mutator/rocketflying/_mod.inc +++ b/qcsrc/common/mutators/mutator/rocketflying/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/rocketflying/_mod.qh b/qcsrc/common/mutators/mutator/rocketflying/_mod.qh index 75ca141bf..b24545f8c 100644 --- a/qcsrc/common/mutators/mutator/rocketflying/_mod.qh +++ b/qcsrc/common/mutators/mutator/rocketflying/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/rocketflying/module.inc b/qcsrc/common/mutators/mutator/rocketflying/module.inc deleted file mode 100644 index 7036bc49d..000000000 --- a/qcsrc/common/mutators/mutator/rocketflying/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "rocketflying.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/rocketflying/rocketflying.qc b/qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qc similarity index 94% rename from qcsrc/common/mutators/mutator/rocketflying/rocketflying.qc rename to qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qc index da7e1c3ec..9f0d8fbf0 100644 --- a/qcsrc/common/mutators/mutator/rocketflying/rocketflying.qc +++ b/qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_rocketflying.qh" + REGISTER_MUTATOR(rocketflying, cvar("g_rocket_flying")); MUTATOR_HOOKFUNCTION(rocketflying, EditProjectile) @@ -21,4 +22,3 @@ MUTATOR_HOOKFUNCTION(rocketflying, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Rocket Flying"); } -#endif diff --git a/qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qh b/qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/rocketminsta/_mod.inc b/qcsrc/common/mutators/mutator/rocketminsta/_mod.inc index bc579ec51..bb75554ba 100644 --- a/qcsrc/common/mutators/mutator/rocketminsta/_mod.inc +++ b/qcsrc/common/mutators/mutator/rocketminsta/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/rocketminsta/_mod.qh b/qcsrc/common/mutators/mutator/rocketminsta/_mod.qh index 29a367d3c..832c5da2c 100644 --- a/qcsrc/common/mutators/mutator/rocketminsta/_mod.qh +++ b/qcsrc/common/mutators/mutator/rocketminsta/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/rocketminsta/module.inc b/qcsrc/common/mutators/mutator/rocketminsta/module.inc deleted file mode 100644 index b7d02a9f6..000000000 --- a/qcsrc/common/mutators/mutator/rocketminsta/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "rocketminsta.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/rocketminsta/rocketminsta.qc b/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc similarity index 97% rename from qcsrc/common/mutators/mutator/rocketminsta/rocketminsta.qc rename to qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc index b0a740391..04d8099e0 100644 --- a/qcsrc/common/mutators/mutator/rocketminsta/rocketminsta.qc +++ b/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_rocketminsta.qh" + #include #include @@ -36,5 +37,3 @@ MUTATOR_HOOKFUNCTION(rm, PlayerDies) if(DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR) || DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO)) M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death } - -#endif diff --git a/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qh b/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/running_guns/_mod.inc b/qcsrc/common/mutators/mutator/running_guns/_mod.inc index f88b36a53..d1db34cf7 100644 --- a/qcsrc/common/mutators/mutator/running_guns/_mod.inc +++ b/qcsrc/common/mutators/mutator/running_guns/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/running_guns/_mod.qh b/qcsrc/common/mutators/mutator/running_guns/_mod.qh index 559be4c98..cc0c58eff 100644 --- a/qcsrc/common/mutators/mutator/running_guns/_mod.qh +++ b/qcsrc/common/mutators/mutator/running_guns/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/running_guns/module.inc b/qcsrc/common/mutators/mutator/running_guns/module.inc deleted file mode 100644 index 036b70ff6..000000000 --- a/qcsrc/common/mutators/mutator/running_guns/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "running_guns.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/running_guns/running_guns.qc b/qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qc similarity index 87% rename from qcsrc/common/mutators/mutator/running_guns/running_guns.qc rename to qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qc index cad4d5f2f..797108e01 100644 --- a/qcsrc/common/mutators/mutator/running_guns/running_guns.qc +++ b/qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qc @@ -1,7 +1,6 @@ -#ifdef IMPLEMENTATION +#include "sv_running_guns.qh" bool autocvar_g_running_guns; - REGISTER_MUTATOR(running_guns, autocvar_g_running_guns); MUTATOR_HOOKFUNCTION(running_guns, SetDefaultAlpha) @@ -10,5 +9,3 @@ MUTATOR_HOOKFUNCTION(running_guns, SetDefaultAlpha) default_weapon_alpha = +1; return true; } - -#endif diff --git a/qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qh b/qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/running_guns/sv_running_guns.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/sandbox/_mod.inc b/qcsrc/common/mutators/mutator/sandbox/_mod.inc index 8e54c1f95..569c25319 100644 --- a/qcsrc/common/mutators/mutator/sandbox/_mod.inc +++ b/qcsrc/common/mutators/mutator/sandbox/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/sandbox/_mod.qh b/qcsrc/common/mutators/mutator/sandbox/_mod.qh index 81e250c7f..86b112934 100644 --- a/qcsrc/common/mutators/mutator/sandbox/_mod.qh +++ b/qcsrc/common/mutators/mutator/sandbox/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/sandbox/module.inc b/qcsrc/common/mutators/mutator/sandbox/module.inc deleted file mode 100644 index 0715d5b40..000000000 --- a/qcsrc/common/mutators/mutator/sandbox/module.inc +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef SVQC -#include "sandbox.qc" - -#endif diff --git a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc similarity index 99% rename from qcsrc/common/mutators/mutator/sandbox/sandbox.qc rename to qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc index 577e29c6b..d0739c2e4 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_sandbox.qh" + int autocvar_g_sandbox_info; bool autocvar_g_sandbox_readonly; string autocvar_g_sandbox_storage_name; @@ -822,4 +823,3 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_StartFrame) return true; } -#endif diff --git a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc b/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc index b7d3af7f4..fe3a6ebc5 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.qh b/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.qh index 5f53e95c8..b34f8f8f1 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.qh +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/module.inc b/qcsrc/common/mutators/mutator/spawn_near_teammate/module.inc deleted file mode 100644 index f88a768a2..000000000 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "spawn_near_teammate.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc similarity index 99% rename from qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc rename to qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc index b16a6c9ac..4c57d0189 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc @@ -1,4 +1,4 @@ -#ifdef IMPLEMENTATION +#include "sv_spawn_near_teammate.qh" float autocvar_g_spawn_near_teammate_distance; int autocvar_g_spawn_near_teammate_ignore_spawnpoint; @@ -185,5 +185,3 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies) } REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate"); - -#endif diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qh b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/superspec/_mod.inc b/qcsrc/common/mutators/mutator/superspec/_mod.inc index d5005242f..262c7fcdb 100644 --- a/qcsrc/common/mutators/mutator/superspec/_mod.inc +++ b/qcsrc/common/mutators/mutator/superspec/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/superspec/_mod.qh b/qcsrc/common/mutators/mutator/superspec/_mod.qh index b544ffc61..110087b67 100644 --- a/qcsrc/common/mutators/mutator/superspec/_mod.qh +++ b/qcsrc/common/mutators/mutator/superspec/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/superspec/module.inc b/qcsrc/common/mutators/mutator/superspec/module.inc deleted file mode 100644 index 8e0a998c2..000000000 --- a/qcsrc/common/mutators/mutator/superspec/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "superspec.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/superspec/superspec.qc b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc similarity index 99% rename from qcsrc/common/mutators/mutator/superspec/superspec.qc rename to qcsrc/common/mutators/mutator/superspec/sv_superspec.qc index 947ff01bb..c423042a3 100644 --- a/qcsrc/common/mutators/mutator/superspec/superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_superspec.qh" + REGISTER_MUTATOR(superspec, cvar("g_superspectate")); #define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1" @@ -456,4 +457,3 @@ MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect) superspec_save_client_conf(player); } -#endif diff --git a/qcsrc/common/mutators/mutator/superspec/sv_superspec.qh b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/touchexplode/_mod.inc b/qcsrc/common/mutators/mutator/touchexplode/_mod.inc index 42dad3926..f341e2afe 100644 --- a/qcsrc/common/mutators/mutator/touchexplode/_mod.inc +++ b/qcsrc/common/mutators/mutator/touchexplode/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/touchexplode/_mod.qh b/qcsrc/common/mutators/mutator/touchexplode/_mod.qh index ec71f52d7..18cdcc60f 100644 --- a/qcsrc/common/mutators/mutator/touchexplode/_mod.qh +++ b/qcsrc/common/mutators/mutator/touchexplode/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/touchexplode/module.inc b/qcsrc/common/mutators/mutator/touchexplode/module.inc deleted file mode 100644 index d3b0ea5af..000000000 --- a/qcsrc/common/mutators/mutator/touchexplode/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "touchexplode.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/touchexplode/touchexplode.qc b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc similarity index 97% rename from qcsrc/common/mutators/mutator/touchexplode/touchexplode.qc rename to qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc index c585e7e90..38ac30595 100644 --- a/qcsrc/common/mutators/mutator/touchexplode/touchexplode.qc +++ b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_touchexplode.qh" + float autocvar_g_touchexplode_radius; float autocvar_g_touchexplode_damage; float autocvar_g_touchexplode_edgedamage; @@ -44,4 +45,3 @@ MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink) } )); } -#endif diff --git a/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qh b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/vampire/_mod.inc b/qcsrc/common/mutators/mutator/vampire/_mod.inc index 856ed84c4..57b844451 100644 --- a/qcsrc/common/mutators/mutator/vampire/_mod.inc +++ b/qcsrc/common/mutators/mutator/vampire/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/vampire/_mod.qh b/qcsrc/common/mutators/mutator/vampire/_mod.qh index 551184c77..d7d8a4143 100644 --- a/qcsrc/common/mutators/mutator/vampire/_mod.qh +++ b/qcsrc/common/mutators/mutator/vampire/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/vampire/module.inc b/qcsrc/common/mutators/mutator/vampire/module.inc deleted file mode 100644 index 864ea28b2..000000000 --- a/qcsrc/common/mutators/mutator/vampire/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "vampire.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/vampire/vampire.qc b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc similarity index 96% rename from qcsrc/common/mutators/mutator/vampire/vampire.qc rename to qcsrc/common/mutators/mutator/vampire/sv_vampire.qc index d245c8059..3a435c5ed 100644 --- a/qcsrc/common/mutators/mutator/vampire/vampire.qc +++ b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_vampire.qh" + REGISTER_MUTATOR(vampire, cvar("g_vampire") && !cvar("g_instagib")); MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor) @@ -25,4 +26,3 @@ MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Vampire"); } -#endif diff --git a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qh b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/vampirehook/_mod.inc b/qcsrc/common/mutators/mutator/vampirehook/_mod.inc index 868a4ef3f..72b2bacb9 100644 --- a/qcsrc/common/mutators/mutator/vampirehook/_mod.inc +++ b/qcsrc/common/mutators/mutator/vampirehook/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/vampirehook/_mod.qh b/qcsrc/common/mutators/mutator/vampirehook/_mod.qh index 5d57816c9..eaa7b320a 100644 --- a/qcsrc/common/mutators/mutator/vampirehook/_mod.qh +++ b/qcsrc/common/mutators/mutator/vampirehook/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/vampirehook/module.inc b/qcsrc/common/mutators/mutator/vampirehook/module.inc deleted file mode 100644 index 17ecf6005..000000000 --- a/qcsrc/common/mutators/mutator/vampirehook/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "vampirehook.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/vampirehook/vampirehook.qc b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc similarity index 97% rename from qcsrc/common/mutators/mutator/vampirehook/vampirehook.qc rename to qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc index a54dc74e4..e2b0f57d7 100644 --- a/qcsrc/common/mutators/mutator/vampirehook/vampirehook.qc +++ b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_vampirehook.qh" + REGISTER_MUTATOR(vh, cvar("g_vampirehook")); bool autocvar_g_vampirehook_teamheal; @@ -34,5 +35,3 @@ MUTATOR_HOOKFUNCTION(vh, GrappleHookThink) dmgent.health -= autocvar_g_vampirehook_damage; // FIXME: friendly fire?! } } - -#endif diff --git a/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qh b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/waypoints/all.qh b/qcsrc/common/mutators/mutator/waypoints/all.qh index 464513055..d99b27e93 100644 --- a/qcsrc/common/mutators/mutator/waypoints/all.qh +++ b/qcsrc/common/mutators/mutator/waypoints/all.qh @@ -1,5 +1,4 @@ -#ifndef WAYPOINTS_ALL_H -#define WAYPOINTS_ALL_H +#pragma once #include "waypointsprites.qh" @@ -58,5 +57,3 @@ REGISTER_RADARICON(Vehicle, 1); REGISTER_RADARICON(Weapon, 1); #include "all.inc" - -#endif diff --git a/qcsrc/common/mutators/mutator/waypoints/module.inc b/qcsrc/common/mutators/mutator/waypoints/module.inc deleted file mode 100644 index 50bb5b4d6..000000000 --- a/qcsrc/common/mutators/mutator/waypoints/module.inc +++ /dev/null @@ -1 +0,0 @@ -#include "waypointsprites.qc" diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index e99303823..8bcb2d62a 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -1,7 +1,5 @@ #include "waypointsprites.qh" -#ifdef IMPLEMENTATION - REGISTER_MUTATOR(waypointsprites, true); REGISTER_NET_LINKED(waypointsprites) @@ -1147,4 +1145,3 @@ void WaypointSprite_PlayerGone(entity this) WaypointSprite_DetachCarrier(this); } #endif -#endif diff --git a/qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc b/qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc index 742510b88..034b51d11 100644 --- a/qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc +++ b/qcsrc/common/mutators/mutator/weaponarena_random/_mod.inc @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/weaponarena_random/_mod.qh b/qcsrc/common/mutators/mutator/weaponarena_random/_mod.qh index 68d6a24c4..05b87c73d 100644 --- a/qcsrc/common/mutators/mutator/weaponarena_random/_mod.qh +++ b/qcsrc/common/mutators/mutator/weaponarena_random/_mod.qh @@ -1,2 +1,4 @@ // generated file; do not modify -#include +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/weaponarena_random/module.inc b/qcsrc/common/mutators/mutator/weaponarena_random/module.inc deleted file mode 100644 index b7a5f6690..000000000 --- a/qcsrc/common/mutators/mutator/weaponarena_random/module.inc +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef SVQC -#include "weaponarena_random.qc" -#endif diff --git a/qcsrc/common/mutators/mutator/weaponarena_random/weaponarena_random.qc b/qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qc similarity index 92% rename from qcsrc/common/mutators/mutator/weaponarena_random/weaponarena_random.qc rename to qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qc index e4d400db7..7ac4504ec 100644 --- a/qcsrc/common/mutators/mutator/weaponarena_random/weaponarena_random.qc +++ b/qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qc @@ -1,4 +1,5 @@ -#ifdef IMPLEMENTATION +#include "sv_weaponarena_random.qh" + // WEAPONTODO: rename the cvars REGISTER_MUTATOR(weaponarena_random, true); @@ -11,5 +12,3 @@ MUTATOR_HOOKFUNCTION(weaponarena_random, PlayerSpawn) W_RandomWeapons(player, g_weaponarena_random); if (g_weaponarena_random_with_blaster) player.weapons |= WEPSET(BLASTER); } - -#endif diff --git a/qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qh b/qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/physics/movetypes/follow.qh b/qcsrc/common/physics/movetypes/follow.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/physics/movetypes/follow.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/physics/movetypes/step.qh b/qcsrc/common/physics/movetypes/step.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/physics/movetypes/step.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/physics/movetypes/toss.qh b/qcsrc/common/physics/movetypes/toss.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/physics/movetypes/toss.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/physics/movetypes/walk.qh b/qcsrc/common/physics/movetypes/walk.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/physics/movetypes/walk.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index a24243bb6..61a4bfeae 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -1,7 +1,7 @@ #pragma once #ifdef SVQC -#include +#include #endif // Full list of all stat constants, included in a single location for easy reference diff --git a/qcsrc/common/triggers/func/bobbing.qh b/qcsrc/common/triggers/func/bobbing.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/bobbing.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/button.qh b/qcsrc/common/triggers/func/button.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/button.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/conveyor.qh b/qcsrc/common/triggers/func/conveyor.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/conveyor.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/door_rotating.qh b/qcsrc/common/triggers/func/door_rotating.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/door_rotating.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/door_secret.qh b/qcsrc/common/triggers/func/door_secret.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/door_secret.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/fourier.qh b/qcsrc/common/triggers/func/fourier.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/fourier.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/pendulum.qh b/qcsrc/common/triggers/func/pendulum.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/pendulum.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/plat.qh b/qcsrc/common/triggers/func/plat.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/plat.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/pointparticles.qh b/qcsrc/common/triggers/func/pointparticles.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/pointparticles.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/rainsnow.qh b/qcsrc/common/triggers/func/rainsnow.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/rainsnow.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/rotating.qh b/qcsrc/common/triggers/func/rotating.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/rotating.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/stardust.qh b/qcsrc/common/triggers/func/stardust.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/stardust.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/func/vectormamamam.qh b/qcsrc/common/triggers/func/vectormamamam.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/func/vectormamamam.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/misc/corner.qh b/qcsrc/common/triggers/misc/corner.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/misc/corner.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/misc/follow.qh b/qcsrc/common/triggers/misc/follow.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/misc/follow.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/misc/include.qh b/qcsrc/common/triggers/misc/include.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/misc/include.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/misc/laser.qh b/qcsrc/common/triggers/misc/laser.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/misc/laser.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/misc/teleport_dest.qh b/qcsrc/common/triggers/misc/teleport_dest.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/misc/teleport_dest.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/target/changelevel.qh b/qcsrc/common/triggers/target/changelevel.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/target/changelevel.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/target/location.qh b/qcsrc/common/triggers/target/location.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/target/location.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/target/spawn.qh b/qcsrc/common/triggers/target/spawn.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/target/spawn.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/target/speaker.qh b/qcsrc/common/triggers/target/speaker.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/target/speaker.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/target/voicescript.qh b/qcsrc/common/triggers/target/voicescript.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/target/voicescript.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/counter.qh b/qcsrc/common/triggers/trigger/counter.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/counter.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/delay.qh b/qcsrc/common/triggers/trigger/delay.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/delay.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/disablerelay.qh b/qcsrc/common/triggers/trigger/disablerelay.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/disablerelay.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/flipflop.qh b/qcsrc/common/triggers/trigger/flipflop.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/flipflop.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/gamestart.qh b/qcsrc/common/triggers/trigger/gamestart.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/gamestart.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/gravity.qh b/qcsrc/common/triggers/trigger/gravity.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/gravity.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/heal.qh b/qcsrc/common/triggers/trigger/heal.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/heal.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/hurt.qh b/qcsrc/common/triggers/trigger/hurt.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/hurt.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/magicear.qh b/qcsrc/common/triggers/trigger/magicear.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/magicear.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/monoflop.qh b/qcsrc/common/triggers/trigger/monoflop.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/monoflop.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/multivibrator.qh b/qcsrc/common/triggers/trigger/multivibrator.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/multivibrator.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/relay.qh b/qcsrc/common/triggers/trigger/relay.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/relay.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/relay_activators.qh b/qcsrc/common/triggers/trigger/relay_activators.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/relay_activators.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/relay_if.qh b/qcsrc/common/triggers/trigger/relay_if.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/relay_if.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/relay_teamcheck.qh b/qcsrc/common/triggers/trigger/relay_teamcheck.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/relay_teamcheck.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/triggers/trigger/teleport.qh b/qcsrc/common/triggers/trigger/teleport.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/trigger/teleport.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/turrets/_mod.inc b/qcsrc/common/turrets/_mod.inc index 40c3114ba..8fff9535c 100644 --- a/qcsrc/common/turrets/_mod.inc +++ b/qcsrc/common/turrets/_mod.inc @@ -1,8 +1,13 @@ // generated file; do not modify #include #include -#include #include -#include #include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif #include diff --git a/qcsrc/common/turrets/_mod.qh b/qcsrc/common/turrets/_mod.qh index 6da539e85..06978f1d4 100644 --- a/qcsrc/common/turrets/_mod.qh +++ b/qcsrc/common/turrets/_mod.qh @@ -1,8 +1,13 @@ // generated file; do not modify #include #include -#include #include -#include #include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif #include diff --git a/qcsrc/common/turrets/checkpoint.qh b/qcsrc/common/turrets/checkpoint.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/turrets/checkpoint.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/turrets/cl_turrets.qh b/qcsrc/common/turrets/cl_turrets.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/turrets/cl_turrets.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/turrets/targettrigger.qh b/qcsrc/common/turrets/targettrigger.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/turrets/targettrigger.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/turrets/turrets.qc b/qcsrc/common/turrets/turrets.qc new file mode 100644 index 000000000..e69de29bb diff --git a/qcsrc/common/turrets/turrets.qh b/qcsrc/common/turrets/turrets.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/turrets/turrets.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/vehicles/_mod.inc b/qcsrc/common/vehicles/_mod.inc index 269858f84..ed26659da 100644 --- a/qcsrc/common/vehicles/_mod.inc +++ b/qcsrc/common/vehicles/_mod.inc @@ -1,4 +1,9 @@ // generated file; do not modify #include -#include -#include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/vehicles/_mod.qh b/qcsrc/common/vehicles/_mod.qh index d21e829f7..4892b0f31 100644 --- a/qcsrc/common/vehicles/_mod.qh +++ b/qcsrc/common/vehicles/_mod.qh @@ -1,4 +1,9 @@ // generated file; do not modify #include -#include -#include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/vehicles/vehicles.qc b/qcsrc/common/vehicles/vehicles.qc new file mode 100644 index 000000000..e69de29bb diff --git a/qcsrc/common/vehicles/vehicles.qh b/qcsrc/common/vehicles/vehicles.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/vehicles/vehicles.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/arc.qh b/qcsrc/common/weapons/weapon/arc.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/arc.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/blaster.qh b/qcsrc/common/weapons/weapon/blaster.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/blaster.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/crylink.qh b/qcsrc/common/weapons/weapon/crylink.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/crylink.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/devastator.qh b/qcsrc/common/weapons/weapon/devastator.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/devastator.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/electro.qh b/qcsrc/common/weapons/weapon/electro.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/electro.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/fireball.qh b/qcsrc/common/weapons/weapon/fireball.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/fireball.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/hagar.qh b/qcsrc/common/weapons/weapon/hagar.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/hagar.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/hlac.qh b/qcsrc/common/weapons/weapon/hlac.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/hlac.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/hook.qh b/qcsrc/common/weapons/weapon/hook.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/hook.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/machinegun.qh b/qcsrc/common/weapons/weapon/machinegun.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/machinegun.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/minelayer.qh b/qcsrc/common/weapons/weapon/minelayer.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/minelayer.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/mortar.qh b/qcsrc/common/weapons/weapon/mortar.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/mortar.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/porto.qh b/qcsrc/common/weapons/weapon/porto.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/porto.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/rifle.qh b/qcsrc/common/weapons/weapon/rifle.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/rifle.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/seeker.qh b/qcsrc/common/weapons/weapon/seeker.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/seeker.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/shockwave.qh b/qcsrc/common/weapons/weapon/shockwave.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/shockwave.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/shotgun.qh b/qcsrc/common/weapons/weapon/shotgun.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/shotgun.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/tuba.qh b/qcsrc/common/weapons/weapon/tuba.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/tuba.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/weapons/weapon/vortex.qh b/qcsrc/common/weapons/weapon/vortex.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/weapons/weapon/vortex.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/lib/angle.qh b/qcsrc/lib/angle.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/lib/angle.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/lib/csqcmodel/_mod.inc b/qcsrc/lib/csqcmodel/_mod.inc index a2012c8fa..cd9569e50 100644 --- a/qcsrc/lib/csqcmodel/_mod.inc +++ b/qcsrc/lib/csqcmodel/_mod.inc @@ -1,5 +1,13 @@ // generated file; do not modify -#include -#include #include -#include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif +#include +#ifdef CSQC + #include +#endif diff --git a/qcsrc/lib/csqcmodel/_mod.qh b/qcsrc/lib/csqcmodel/_mod.qh index de3102fa8..1b0535192 100644 --- a/qcsrc/lib/csqcmodel/_mod.qh +++ b/qcsrc/lib/csqcmodel/_mod.qh @@ -1,5 +1,13 @@ // generated file; do not modify -#include -#include #include -#include +#include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif +#include +#ifdef CSQC + #include +#endif diff --git a/qcsrc/lib/csqcmodel/model.qc b/qcsrc/lib/csqcmodel/model.qc new file mode 100644 index 000000000..e69de29bb diff --git a/qcsrc/lib/csqcmodel/model.qh b/qcsrc/lib/csqcmodel/model.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/lib/csqcmodel/model.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/lib/csqcmodel/player.qc b/qcsrc/lib/csqcmodel/player.qc new file mode 100644 index 000000000..e69de29bb diff --git a/qcsrc/lib/csqcmodel/player.qh b/qcsrc/lib/csqcmodel/player.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/lib/csqcmodel/player.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/lib/json.qh b/qcsrc/lib/json.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/lib/json.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/server/_mod.inc b/qcsrc/server/_mod.inc index f22742f1d..4ecc610c7 100644 --- a/qcsrc/server/_mod.inc +++ b/qcsrc/server/_mod.inc @@ -3,20 +3,20 @@ #include #include #include -#include -#include -#include +#include #include #include #include #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -25,7 +25,9 @@ #include #include #include -#include +#ifdef SVQC + #include +#endif #include #include #include diff --git a/qcsrc/server/_mod.qh b/qcsrc/server/_mod.qh index 17e0a829d..8162606c7 100644 --- a/qcsrc/server/_mod.qh +++ b/qcsrc/server/_mod.qh @@ -3,20 +3,20 @@ #include #include #include -#include -#include -#include +#include #include #include #include #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -25,7 +25,9 @@ #include #include #include -#include +#ifdef SVQC + #include +#endif #include #include #include diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 3f117de84..7b742e5aa 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -15,7 +15,7 @@ #include "../../antilag.qh" #include "../../autocvars.qh" #include "../../campaign.qh" -#include "../../cl_client.qh" +#include "../../client.qh" #include "../../constants.qh" #include "../../defs.qh" #include "../../race.qh" diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/client.qc similarity index 99% rename from qcsrc/server/cl_client.qc rename to qcsrc/server/client.qc index a280b275e..68fa35e00 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/client.qc @@ -1,8 +1,8 @@ -#include "cl_client.qh" +#include "client.qh" #include "anticheat.qh" -#include "cl_impulse.qh" -#include "cl_player.qh" +#include "impulse.qh" +#include "player.qh" #include "ipban.qh" #include "miscfunctions.qh" #include "portals.qh" diff --git a/qcsrc/server/cl_client.qh b/qcsrc/server/client.qh similarity index 100% rename from qcsrc/server/cl_client.qh rename to qcsrc/server/client.qh diff --git a/qcsrc/server/command/_mod.qh b/qcsrc/server/command/_mod.qh index b95b1e0a6..6a3b175a4 100644 --- a/qcsrc/server/command/_mod.qh +++ b/qcsrc/server/command/_mod.qh @@ -1,6 +1,9 @@ // generated file; do not modify #include #include +#ifdef SVQC + #include +#endif #include #include #include diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index d450ca4c8..6a9b2b361 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -4,7 +4,7 @@ #include "common.qh" -#include "../cl_player.qh" +#include "../player.qh" #include "../ipban.qh" #include diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 19ee99a1a..48ac3bff5 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -6,7 +6,7 @@ #include "../campaign.qh" #include "../cheats.qh" -#include "../cl_player.qh" +#include "../player.qh" #include "../ipban.qh" #include "../mapvoting.qh" #include "../scores.qh" diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 18a424a1d..f0efcba46 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -9,8 +9,8 @@ #include "../anticheat.qh" #include "../campaign.qh" -#include "../cl_client.qh" -#include "../cl_player.qh" +#include "../client.qh" +#include "../player.qh" #include "../g_world.qh" #include "../ipban.qh" #include "../playerdemo.qh" diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 1b2662d6e..168457328 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -5,7 +5,7 @@ #include "weapons/weaponsystem.qh" #include "weapons/selection.qh" #include "weapons/tracing.qh" -#include "cl_player.qh" +#include "player.qh" #include "command/common.qh" #include "round_handler.qh" #include "../common/state.qh" diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 8f10ea9db..a04d6d440 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -5,7 +5,7 @@ #include "bot/api.qh" #include "campaign.qh" #include "cheats.qh" -#include "cl_client.qh" +#include "client.qh" #include "command/common.qh" #include "command/getreplies.qh" #include "command/sv_cmd.qh" diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/impulse.qc similarity index 99% rename from qcsrc/server/cl_impulse.qc rename to qcsrc/server/impulse.qc index 00c4ec22c..c797c5771 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/impulse.qc @@ -1,4 +1,4 @@ -#include "cl_impulse.qh" +#include "impulse.qh" #include "round_handler.qh" #include "bot/api.qh" diff --git a/qcsrc/server/cl_impulse.qh b/qcsrc/server/impulse.qh similarity index 100% rename from qcsrc/server/cl_impulse.qh rename to qcsrc/server/impulse.qh diff --git a/qcsrc/server/matrix.qc b/qcsrc/server/matrix.qc index b7d26decf..4d235da69 100644 --- a/qcsrc/server/matrix.qc +++ b/qcsrc/server/matrix.qc @@ -1,6 +1,6 @@ #include "matrix.qh" -#include "cl_player.qh" +#include "player.qh" var void MX_Handle(int buf, string ancestor) { diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 0d53e054f..89021e323 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -350,7 +350,7 @@ MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo); /**/ MUTATOR_HOOKABLE(W_Reload, EV_W_Reload); -/** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */ +/** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */ #define EV_PlayerPowerups(i, o) \ /** player */ i(entity, MUTATOR_ARGV_0_entity) \ /** old items */ i(int, MUTATOR_ARGV_1_int) \ @@ -499,7 +499,7 @@ MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack); MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport); /** - * called whenever a player uses impulse 33 (help me) in cl_impulse.qc + * called whenever a player uses impulse 33 (help me) in impulse.qc * normally help me ping uses .waypointsprite_attachedforcarrier, * but if your mutator uses something different then you can handle it * in a special manner using this hook diff --git a/qcsrc/server/mutators/gamemode.qh b/qcsrc/server/mutators/gamemode.qh index abd29740a..64577fa6b 100644 --- a/qcsrc/server/mutators/gamemode.qh +++ b/qcsrc/server/mutators/gamemode.qh @@ -71,9 +71,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/qcsrc/server/mutators/mutator.qh b/qcsrc/server/mutators/mutator.qh index 5344a91bb..d00a20b0f 100644 --- a/qcsrc/server/mutators/mutator.qh +++ b/qcsrc/server/mutators/mutator.qh @@ -2,9 +2,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/player.qc similarity index 99% rename from qcsrc/server/cl_player.qc rename to qcsrc/server/player.qc index 1ae97c99e..5316a85b5 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/player.qc @@ -1,4 +1,4 @@ -#include "cl_player.qh" +#include "player.qh" #include "bot/api.qh" #include "cheats.qh" diff --git a/qcsrc/server/cl_player.qh b/qcsrc/server/player.qh similarity index 100% rename from qcsrc/server/cl_player.qh rename to qcsrc/server/player.qh diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index b315d6cad..fc5ba4d61 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -1,6 +1,6 @@ #include "race.qh" -#include "cl_client.qh" +#include "client.qh" #include "portals.qh" #include "scores.qh" #include "spawnpoints.qh" diff --git a/qcsrc/server/scores_rules.qc b/qcsrc/server/scores_rules.qc index d3aceac50..718ebd265 100644 --- a/qcsrc/server/scores_rules.qc +++ b/qcsrc/server/scores_rules.qc @@ -1,6 +1,6 @@ #include "scores_rules.qh" -#include "cl_client.qh" +#include "client.qh" #include "scores.qh" int ScoreRules_teams; diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 1d742375d..974495bb6 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -1,6 +1,6 @@ #include "teamplay.qh" -#include "cl_client.qh" +#include "client.qh" #include "race.qh" #include "scores.qh" #include "scores_rules.qh" @@ -12,7 +12,7 @@ #include "mutators/_all.qh" #include "../common/deathtypes/all.qh" -#include "../common/gamemodes/all.qh" +#include "../common/gamemodes/_all.qh" #include "../common/teams.qh" void TeamchangeFrags(entity e) @@ -540,7 +540,7 @@ int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam) SetPlayerColors(this, selectedteam - 1); // when JoinBestTeam is called by client.qc/ClientKill_Now_TeamChange the players team is -1 and thus skipped - // when JoinBestTeam is called by cl_client.qc/ClientConnect the player_id is 0 the log attempt is rejected + // when JoinBestTeam is called by client.qc/ClientConnect the player_id is 0 the log attempt is rejected LogTeamchange(this.playerid, this.team, 99); } return selectedteam; diff --git a/qcsrc/server/tests.qh b/qcsrc/server/tests.qh index ec56918c7..865d3f70b 100644 --- a/qcsrc/server/tests.qh +++ b/qcsrc/server/tests.qh @@ -1,7 +1,7 @@ #pragma once #include "autocvars.qh" -#include "cl_client.qh" +#include "client.qh" #include "command/_all.qh" #include "weapons/common.qh" #include "weapons/selection.qh" diff --git a/qcsrc/tools/genmod.sh b/qcsrc/tools/genmod.sh index 2c34e6713..5998184bf 100755 --- a/qcsrc/tools/genmod.sh +++ b/qcsrc/tools/genmod.sh @@ -12,15 +12,19 @@ function genmod() { echo '// generated file; do not modify' > ${MOD}.inc echo '// generated file; do not modify' > ${MOD}.qh for f in $(ls | sort -k 1,1 -t .); do - if [[ "$f" == cl_* ]]; then if [[ -f "${f#cl_}" ]]; then continue; fi; fi - if [[ "$f" == sv_* ]]; then if [[ -f "${f#sv_}" ]]; then continue; fi; fi - if [[ "$f" == ui_* ]]; then if [[ -f "${f#ui_}" ]]; then continue; fi; fi + if [[ "$f" == cl_* ]]; then f="${f#cl_}"; if [[ -f "$f" ]]; then continue; fi + elif [[ "$f" == sv_* ]]; then f="${f#sv_}"; if [[ -f "$f" ]]; then continue; fi + elif [[ "$f" == ui_* ]]; then f="${f#ui_}"; if [[ -f "$f" ]]; then continue; fi + fi if [[ "$f" == *.qc ]]; then - echo "#include <${CTX}$f>" >> ${MOD}.inc - echo "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh + if [[ -f "$f" ]]; then echo -e "#include <${CTX}$f>" >> ${MOD}.inc; fi + if [[ -f "${f%.qc}.qh" ]]; then echo -e "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh; fi if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_$f>\n#endif" >> ${MOD}.inc; fi + if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_$f>\n#endif" >> ${MOD}.inc; fi + if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_$f>\n#endif" >> ${MOD}.inc; fi + if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi fi done # echo >> ${MOD} -- 2.39.2