]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into TimePath/notifications 292/head
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 10 Mar 2016 06:35:55 +0000 (17:35 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 10 Mar 2016 06:39:13 +0000 (17:39 +1100)
# Conflicts:
# qcsrc/common/mutators/mutator/overkill/hmg.qc
# qcsrc/common/mutators/mutator/overkill/rpc.qc
# qcsrc/common/weapons/weapon/arc.qc
# qcsrc/common/weapons/weapon/blaster.qc
# qcsrc/common/weapons/weapon/crylink.qc
# qcsrc/common/weapons/weapon/devastator.qc
# qcsrc/common/weapons/weapon/electro.qc
# qcsrc/common/weapons/weapon/fireball.qc
# qcsrc/common/weapons/weapon/hagar.qc
# qcsrc/common/weapons/weapon/hlac.qc
# qcsrc/common/weapons/weapon/hook.qc
# qcsrc/common/weapons/weapon/machinegun.qc
# qcsrc/common/weapons/weapon/minelayer.qc
# qcsrc/common/weapons/weapon/mortar.qc
# qcsrc/common/weapons/weapon/rifle.qc
# qcsrc/common/weapons/weapon/seeker.qc
# qcsrc/common/weapons/weapon/shockwave.qc
# qcsrc/common/weapons/weapon/shotgun.qc
# qcsrc/common/weapons/weapon/vaporizer.qc
# qcsrc/common/weapons/weapon/vortex.qc

103 files changed:
.gitignore
.gitlab-ci.yml
qcsrc/.gitignore
qcsrc/Makefile
qcsrc/client/autocvars.qh
qcsrc/client/main.qc
qcsrc/common/constants.qh
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/debug.qh
qcsrc/common/effects/qc/globalsound.qh
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/items/item/jetpack.qc
qcsrc/common/items/item/powerup.qc
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/campcheck/campcheck.qc
qcsrc/common/mutators/mutator/damagetext/damagetext.qc
qcsrc/common/mutators/mutator/dodging/dodging.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/sandbox/sandbox.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc
qcsrc/common/mutators/mutator/waypoints/all.qh
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/state.qh
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/util.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/viewloc.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/accumulate.qh
qcsrc/lib/bool.qh
qcsrc/lib/linkedlist.qh
qcsrc/lib/net.qh
qcsrc/lib/oo.qh
qcsrc/lib/replicate.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/string.qh
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/autocvars.qh
qcsrc/server/bot/aim.qc
qcsrc/server/bot/bot.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/cheats.qc
qcsrc/server/cheats.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/playerdemo.qc
qcsrc/server/scores.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/weaponsystem.qc

index 6ecb3d2eb62e1c68d9602b7391a23ec2a6aa44e2..f4611af9310bd9c5c7ab12a06bf04387fd72d086 100644 (file)
@@ -1,6 +1,5 @@
-csprogs.dat
-menu.dat
-progs.dat
-*.lno
+/*.dat
+/*.lno
+
 .DS_Store
 .idea/
index a2eea23bc2c8bad011ce33c6d5507f0815349dff..823b8afdef2fd79e7e9a3c185fb4d7c443e8cc86 100644 (file)
@@ -27,7 +27,7 @@ test_sv_game:
   script:
     - wget -O data/g-23.pk3 http://beta.xonotic.org/autobuild-bsp/latest/g-23.pk3
     - make
-    - EXPECT=0920bfe86d0a02684fd67044233a092e
+    - EXPECT=f077e4e45176d4aedacf943adede6e55
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index 79fce6a59259d580292e269c2db59394f44f8b34..07a5db11e1d70122281df3c605ad7e7790d5cd06 100644 (file)
@@ -1,3 +1,3 @@
-html/
-qccversion*
-*.d
+/html/
+/qccversion*
+/*.pk3
index f6c67bbebcd708c9546928c01ca83f1c8612a202..d73c52f213d7b056c6f09ad7260ba886a180f382 100644 (file)
@@ -1,12 +1,22 @@
-SCM := $(shell if [ -d .svn ]; then echo svn; elif [ -d ../.git ]; then echo git; fi)
-PERL ?= perl
-QCCFLAGS_WATERMARK ?= $(shell git describe)
+QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty=*)
 CPP := cc -xc -E
 QCC ?= gmqcc
 NDEBUG ?= 1
 PROGS_OUT ?= $(CURDIR)/..
 BUILD_MOD ?= 0
 
+ifndef Zip
+    ifneq ($(shell which zip),)
+        Zip := zip -9
+    endif
+    ifneq ($(shell which 7za),)
+        Zip := 7za a -tzip -mx=9
+    endif
+    ifndef Zip
+        $(error "No zip in ($(PATH))")
+    endif
+endif
+
 QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversion.txt && git hash-object qccversion.txt)
 
 # We eventually need to get rid of these
@@ -34,13 +44,31 @@ QCCFLAGS ?= \
 XON_BUILDSYSTEM =
 
 .PHONY: all
-all: qc
+all: qc pk3
 
 .PHONY: qc
 qc: $(PROGS_OUT)/menu.dat $(PROGS_OUT)/progs.dat $(PROGS_OUT)/csprogs.dat
 
+.PHONY: pk3
+pk3: qc
+       $(eval PROG=csprogs)
+       $(eval VER=${QCCFLAGS_WATERMARK})
+       $(eval PK3=${PROG}-${VER}.pk3)
+       $(eval TXT=${PROG}-${VER}.txt)
+       $(eval DAT=${PROG}-${VER}.dat)
+       $(eval LNO=${PROG}-${VER}.lno)
+       @ echo "http://xonotic.org" > ${TXT}
+       @ ln -f $(PROGS_OUT)/${PROG}.dat ${DAT}
+       @ ln -f $(PROGS_OUT)/${PROG}.lno ${LNO}
+       @ rm -f *.pk3
+       $(Zip) ${PK3} ${TXT} ${DAT} ${LNO}
+       @ rm ${TXT} ${DAT} ${LNO}
+
+dirtree:
+       @mkdir -p ../.tmp
+
 .PHONY: clean
-clean:
+clean: | dirtree
        rm -f $(PROGS_OUT)/csprogs.dat
        rm -f $(PROGS_OUT)/progs.dat
        rm -f $(PROGS_OUT)/menu.dat
@@ -57,17 +85,17 @@ export CPP
 export QCCDEFS
 export QCCFLAGS
 
-$(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE)
+$(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | dirtree
        @echo make[1]: Entering directory \`$(PWD)/client\'
        sh ./qcc.sh client $@ $<
 -include ../.tmp/client.d
 
-$(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE)
+$(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) | dirtree
        @echo make[1]: Entering directory \`$(PWD)/server\'
        sh ./qcc.sh server $@ $<
 -include ../.tmp/server.d
 
-$(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE)
+$(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) | dirtree
        @echo make[1]: Entering directory \`$(PWD)/menu\'
        sh ./qcc.sh menu $@ $<
 -include ../.tmp/menu.d
index 49cafb896a18fcc122d751fdcda6180c657ff802..d48fb6333513f9cf4d5d25533ef38627175a422e 100644 (file)
@@ -72,6 +72,8 @@ bool autocvar_cl_spawn_event_particles;
 bool autocvar_cl_spawn_event_sound = 1;
 // float autocvar_cl_spawn_point_model;
 bool autocvar_cl_spawn_point_particles;
+float autocvar_cl_spawn_point_dist_min = 1200;
+float autocvar_cl_spawn_point_dist_max = 1600;
 bool autocvar_cl_spawnzoom = 1;
 float autocvar_cl_spawnzoom_speed = 1;
 float autocvar_cl_spawnzoom_factor = 2;
@@ -193,7 +195,7 @@ float autocvar_hud_dock_alpha;
 string autocvar_hud_dock_color;
 bool autocvar_hud_dock_color_team;
 bool autocvar_hud_panel_ammo;
-bool autocvar_hud_panel_ammo_iconalign; // TODO: check if this should be turned into an int
+bool autocvar_hud_panel_ammo_iconalign;
 int autocvar_hud_panel_ammo_maxammo;
 bool autocvar_hud_panel_ammo_onlycurrent;
 float autocvar_hud_panel_ammo_noncurrent_alpha = 0.7;
@@ -205,8 +207,8 @@ bool autocvar_hud_panel_ammo_text;
 string autocvar_hud_panel_bg;
 float autocvar_hud_panel_bg_alpha;
 float autocvar_hud_panel_bg_border;
-vector autocvar_hud_panel_bg_color; // TODO: int?
-float autocvar_hud_panel_bg_color_team; // ^
+vector autocvar_hud_panel_bg_color;
+float autocvar_hud_panel_bg_color_team;
 float autocvar_hud_panel_bg_padding;
 bool autocvar_hud_panel_centerprint;
 float autocvar_hud_panel_centerprint_align;
index 14279816efdee0f62642a3cfe2fb0fb370fad76b..8cc5745182a2fb1e12f61eefab3e21f42875a192 100644 (file)
@@ -676,13 +676,29 @@ void Spawn_Draw(entity this)
        __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
+void Spawn_PreDraw(entity this)
+{
+       float alph;
+       vector org = getpropertyvec(VF_ORIGIN);
+       if(this.fade_start)
+               alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+       else
+               alph = 1;
+       //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
+       this.alpha = alph;
+       if(alph <= 0)
+               this.drawmask = 0;
+       else
+               this.drawmask = MASK_NORMAL;
+}
+
 NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
 {
        float teamnum = (ReadByte() - 1);
        vector spn_origin;
-       spn_origin.x = ReadShort();
-       spn_origin.y = ReadShort();
-       spn_origin.z = ReadShort();
+       spn_origin.x = ReadCoord();
+       spn_origin.y = ReadCoord();
+       spn_origin.z = ReadCoord();
 
        //if(is_new)
        //{
@@ -716,6 +732,9 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
                        else { this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_NEUTRAL); }
 
                        this.draw = Spawn_Draw;
+                       setpredraw(this, Spawn_PreDraw);
+                       this.fade_start = autocvar_cl_spawn_point_dist_min;
+                       this.fade_end = autocvar_cl_spawn_point_dist_max;
                }
        //}
 
@@ -732,9 +751,9 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new)
 
        if(entnum)
        {
-               this.origin_x = ReadShort();
-               this.origin_y = ReadShort();
-               this.origin_z = ReadShort();
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
 
                if(is_new)
                {
@@ -921,7 +940,6 @@ bool CSQC_Parse_TempEntity()
        return false;
 }
 
-/** TODO somehow thwart prvm_globalset client ... */
 string forcefog;
 void Fog_Force()
 {
index 63ef9bf27ca4419cc57f6338982a595a821b54fd..28db23dc11a13fd08b5365a30ca670e2b8638701 100644 (file)
@@ -1,31 +1,6 @@
 #ifndef CONSTANTS_H
 #define CONSTANTS_H
 
-// COMMIT-TODO: Update if necessary before committing
-// Revision 1: additional statistics sent (flag caps, returns, deaths)
-// Revision 2: Mapvote preview pictures
-// Revision 3: optimized map vote protocol
-// Revision 4: CSQC config var system
-// Revision 5: mapvote time fix
-// Revision 6: more robust against packet loss/delays, also show not yet connected clients
-// Revision 7: packet loss column
-// Revision 8: race
-// Revision 9: race delta
-// Revision 10: scoreboard force
-// Revision 11: scoreboard unforce; spectator support beginning
-// Revision 12: smaller scores updates (SERVER: requires new engine)
-// Revision 13: pointparticles
-// Revision 14: laser
-// Revision 15: zoom
-// Revision 16: multi-weapons
-// Revision 17: multi-weaponimpulses
-// Revision 18: warmup
-// Revision 19: fog
-// Revision 20: naggers
-// Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
-// Revision 22: hook shot origin
-#define CSQC_REVISION 22
-
 REGISTER_NET_TEMP(TE_CSQC_PICTURE)
 REGISTER_NET_TEMP(TE_CSQC_RACE)
 REGISTER_NET_TEMP(TE_CSQC_TEAMNAGGER)
index da2661b9c549e5d2b1f845c1cac73b2d901fdc62..ff890afec629db9f70bf333cc0fbbc053659afc3 100644 (file)
@@ -69,7 +69,7 @@
        CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \
        CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count) \
        CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, MOVETYPE_NAME)
-// TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
+// TODO get rid of colormod/glowmod here; also get rid of some useless properties on non-players that only exist for CopyBody
 
 // add hook function calls here
 #define CSQCPLAYER_HOOK_POSTCAMERASETUP() \
index 4f60e9fe3cf5b5e4334c9c805d87fff81c618ab5..a72d3538a76b3d14d468937f920fc3adbe0fdc30 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef DEBUG_H
-#define DEBUG_H
+#pragma once
 
 #ifndef MENUQC
 .bool debug;
@@ -32,9 +31,10 @@ REGISTER_NET_TEMP(net_debug)
                WriteHeader(channel, net_debug);
                WriteShort(channel, etof(this));
                WriteByte(channel, is_pure(this));
-               WriteCoord(channel, this.origin.x);
-               WriteCoord(channel, this.origin.y);
-               WriteCoord(channel, this.origin.z);
+               vector o = this.origin;
+               if (o == '0 0 0') // brushes
+                   o = (this.absmin + this.absmax) / 2;
+               WriteCoord(channel, o.x); WriteCoord(channel, o.y); WriteCoord(channel, o.z);
                WriteString(channel, this.classname);
                WriteString(channel, this.sourceLoc);
                return true;
@@ -42,6 +42,15 @@ REGISTER_NET_TEMP(net_debug)
 #endif
 
 #ifndef MENUQC
+/**
+ * 0: off
+ * 1: on
+ * 2: on (pure)
+ * 3: on (.entnum != 0)
+ * 4: on (.origin == '0 0 0')
+ * 5: on (.debug != 0), server only
+ * 6: on (.solid != 0)
+ */
 bool autocvar_debugdraw;
 #endif
 
@@ -73,7 +82,11 @@ bool autocvar_debugdraw;
                                {
                                        if (e.origin) continue;
                                }
-                               else if (autocvar_debugdraw > 4)
+                               if (autocvar_debugdraw == 5)
+                {
+                    if (!e.debug) continue;
+                }
+                               else if (autocvar_debugdraw > 5)
                                {
                                        bool flag = true;
                                        do {
@@ -169,8 +182,8 @@ GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
        {
                case CMD_REQUEST_COMMAND:
                {
-                   int bufhandle = stof(argv(1));
-                   int string_index = stof(argv(2));
+                       int bufhandle = stof(argv(1));
+                       int string_index = stof(argv(2));
                        string s = bufstr_get(bufhandle, string_index);
                        LOG_INFOF("%s\n", s);
                        return;
@@ -203,4 +216,57 @@ GENERIC_COMMAND(version, "Print the current version")
        }
 }
 
+REGISTER_STAT(TRACE_ENT, int)
+#ifdef SVQC
+bool autocvar_debugtrace;
+
+REGISTER_MUTATOR(trace, autocvar_debugtrace);
+
+.bool debug_trace_button;
+.int solid_prev;
+MUTATOR_HOOKFUNCTION(trace, SV_StartFrame)
+{
+       FOREACH_CLIENT(true, {
+               bool skip = false;
+               bool btn = PHYS_INPUT_BUTTON_HOOK(it);
+               if (btn == it.debug_trace_button) skip = true;
+               it.debug_trace_button = btn;
+               if (!btn || skip) continue;
+               FOREACH_ENTITY(true, {
+                   it.solid_prev = it.solid;
+                       it.solid = SOLID_BBOX;
+               });
+               vector forward; vector right; vector up;
+               MAKEVECTORS(makevectors, it.v_angle, forward, right, up);
+               vector pos = it.origin + it.view_ofs;
+               traceline(pos, pos + forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, it);
+               FOREACH_ENTITY(true, {
+                   it.solid = it.solid_prev;
+            it.solid_prev = 0;
+               });
+               entity e = trace_ent;
+               int i = etof(e);
+               STAT(TRACE_ENT, it) = i;
+               if (!e) continue;
+               setorigin(e, e.origin + '0 0 100');
+               stuffcmd(it, sprintf("prvm_edict server %d\n", i));
+       });
+}
+#endif
+#ifdef CSQC
+entity TRACE_ENT;
+void Trace_draw2d(entity this)
+{
+       int e = STAT(TRACE_ENT);
+       if (!e) return;
+       vector pos = '0 0 0';
+       pos.y += vid_conheight / 2;
+       drawstring(pos, sprintf("prvm_edict server %d", e), '10 10 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+}
+
+STATIC_INIT(TRACE_ENT)
+{
+       entity e = TRACE_ENT = new_pure(TRACE_ENT);
+       e.draw2d = Trace_draw2d;
+}
 #endif
index 22e04e94a7f6d77a0b5324968cd027de24fe1909..7cb8fdb3e7484fd59f9a02c18738d0f001dd3e12 100644 (file)
@@ -23,8 +23,6 @@ STATIC_INIT(PlayerSounds_renumber)
 }
 REGISTRY_CHECK(PlayerSounds)
 
-// TODO implement fall and falling
-
 REGISTER_PLAYERSOUND(death)
 REGISTER_PLAYERSOUND(drown)
 REGISTER_PLAYERSOUND(fall)
index d1ac1b40ab54be7af3b62ff6bee1b6cecf686734..df062641a6126088cd15e84d732a9748d5448f6c 100644 (file)
@@ -852,48 +852,51 @@ float ball_customize()
        return true;
 }
 
-       METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
-       {
-               if(fire & 1)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
-                               if(autocvar_g_nexball_basketball_meter)
-                               {
-                                       if(self.ballcarried && !self.metertime)
-                                               self.metertime = time;
-                                       else
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-                               }
-                               else
-                               {
-                                       W_Nexball_Attack(-1);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-                               }
-               if(fire & 2)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
-                       {
-                               W_Nexball_Attack2();
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
-                       }
+METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
+            if(autocvar_g_nexball_basketball_meter)
+            {
+                if(self.ballcarried && !self.metertime)
+                    self.metertime = time;
+                else
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+            }
+            else
+            {
+                W_Nexball_Attack(-1);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+            }
+    if(fire & 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
+        {
+            W_Nexball_Attack2();
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
+        }
+
+    if(!(fire & 1) && self.metertime && self.ballcarried)
+    {
+        W_Nexball_Attack(time - self.metertime);
+        // DropBall or stealing will set metertime back to 0
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+    }
+}
 
-               if(!(fire & 1) && self.metertime && self.ballcarried)
-               {
-                       W_Nexball_Attack(time - self.metertime);
-                       // DropBall or stealing will set metertime back to 0
-                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-               }
-       }
-       METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
-       {
-               //weapon_setup(WEP_PORTO.m_id);
-       }
-       METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
-       {
-               return true;
-       }
-       METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
-       {
-               return true;
-       }
+METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
+{
+    //weapon_setup(WEP_PORTO.m_id);
+}
+
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
+{
+    return true;
+}
+
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
+{
+    return true;
+}
 
 void nb_DropBall(entity player)
 {
index 7ccbe8fa3fdbf622290ed3864b538cae91fe2f1b..7fd29e299f57f0034fde2b701fdfe949666f4c34 100644 (file)
@@ -5,6 +5,10 @@
 #include "ammo.qh"
 #include "powerup.qh"
 
+#ifndef SVQC
+.int m_itemid;
+#endif
+
 #ifndef MENUQC
 MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
 #endif
@@ -12,6 +16,7 @@ MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
 REGISTER_ITEM(Jetpack, Powerup) {
 #ifndef MENUQC
     this.m_model                =   MDL_Jetpack_ITEM;
+    this.m_itemid               =   IT_JETPACK;
 #endif
     this.m_name                 =   "Jet pack";
     this.m_icon                 =   "jetpack";
@@ -20,7 +25,6 @@ REGISTER_ITEM(Jetpack, Powerup) {
     this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
-    this.m_itemid               =   IT_JETPACK;
     this.m_pickupevalfunc       =   commodity_pickupevalfunc;
 #endif
 }
index 7deba67df50bb48c9ddedeed3a455c9bab126c0e..375f958a16ddb798c93ab5de7fdfe48f404dabbd 100644 (file)
@@ -1,9 +1,5 @@
 #include "powerup.qh"
 
-#ifndef SVQC
-.int m_itemid;
-#endif
-
 #ifndef MENUQC
 MODEL(Strength_ITEM, Item_Model("g_strength.md3"));
 SOUND(Strength, "misc/powerup");
index 56dcce489cfa9fad4275d0e077a9cf8c16c6a85f..d853eeac3cc2fe690d164226c8757c096f61f280 100644 (file)
     #include "mapinfo.qh"
 #endif
 
-bool autocvar_developer_mapper;
-
-#define LOG_MAPWARN(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNING(__VA_ARGS__); } MACRO_END
-#define LOG_MAPWARNF(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNINGF(__VA_ARGS__); } MACRO_END
-
 // generic string stuff
 
 int _MapInfo_Cache_Active;
index 702798bbf861d3bfcb912ceac3b67a6afcd5052b..ab7233ef269cd60db277aa23c81588a9260b83df 100644 (file)
@@ -1,6 +1,11 @@
 #ifndef MAPINFO_H
 #define MAPINFO_H
 
+bool autocvar_developer_mapper;
+
+#define LOG_MAPWARN(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNING(__VA_ARGS__); } MACRO_END
+#define LOG_MAPWARNF(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNINGF(__VA_ARGS__); } MACRO_END
+
 #include "util.qh"
 
 CLASS(Gametype, Object)
index 37c6301fbdbf8fcd5bd8f97620821f88c7f0914c..c71e8c911ccfa1dde53e7aa85c926437fba453b8 100644 (file)
@@ -408,81 +408,85 @@ spawnfunc(monster_mage) { Monster_Spawn(this, MON_MAGE.monsterid); }
 
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
-               {
-                       bool need_help = false;
+#ifdef SVQC
+METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
+{
+    bool need_help = false;
 
-                       FOREACH_ENTITY_FLOAT(iscreature, true,
-                       {
-                               if(it != actor)
-                               if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
-                               if(M_Mage_Defend_Heal_Check(actor, it))
-                               {
-                                       need_help = true;
-                                       break;
-                               }
-                       });
+    FOREACH_ENTITY_FLOAT(iscreature, true,
+    {
+        if(it != actor)
+        if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
+        if(M_Mage_Defend_Heal_Check(actor, it))
+        {
+            need_help = true;
+            break;
+        }
+    });
+
+    if(actor.health < (autocvar_g_monster_mage_heal_minhealth) || need_help)
+    if(time >= actor.attack_finished_single[0])
+    if(random() < 0.5)
+        M_Mage_Defend_Heal(actor);
+
+    if(time >= actor.mage_shield_time && actor.armorvalue)
+        M_Mage_Defend_Shield_Remove(actor);
+
+    if(actor.enemy)
+    if(actor.health < actor.max_health)
+    if(time >= actor.mage_shield_delay)
+    if(random() < 0.5)
+        M_Mage_Defend_Shield(actor);
+
+    return true;
+}
 
-                       if(actor.health < (autocvar_g_monster_mage_heal_minhealth) || need_help)
-                       if(time >= actor.attack_finished_single[0])
-                       if(random() < 0.5)
-                               M_Mage_Defend_Heal(actor);
+METHOD(Mage, mr_pain, bool(Mage thismon, entity actor))
+{
+    return true;
+}
 
-                       if(time >= actor.mage_shield_time && actor.armorvalue)
-                               M_Mage_Defend_Shield_Remove(actor);
+METHOD(Mage, mr_death, bool(Mage thismon, entity actor))
+{
+    setanim(actor, actor.anim_die1, false, true, true);
+    return true;
+}
 
-                       if(actor.enemy)
-                       if(actor.health < actor.max_health)
-                       if(time >= actor.mage_shield_delay)
-                       if(random() < 0.5)
-                               M_Mage_Defend_Shield(actor);
+#endif
+#ifndef MENUQC
+METHOD(Mage, mr_anim, bool(Mage thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
+    actor.anim_walk = animfixfps(actor, '1 1 1', none);
+    actor.anim_idle = animfixfps(actor, '0 1 1', none);
+    actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
+    actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '5 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+.float speed;
+spawnfunc(item_health_large);
+METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_mage_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_mage_damageforcescale); }
 
-                       return true;
-               }
-               METHOD(Mage, mr_pain, bool(Mage thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Mage, mr_death, bool(Mage thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_die1, false, true, true);
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Mage, mr_anim, bool(Mage thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
-                       actor.anim_walk = animfixfps(actor, '1 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '0 1 1', none);
-                       actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
-                       actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '5 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               .float speed;
-               spawnfunc(item_health_large);
-               METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_mage_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_mage_damageforcescale); }
+    actor.monster_loot = spawnfunc_item_health_large;
+    actor.monster_attackfunc = M_Mage_Attack;
 
-                       actor.monster_loot = spawnfunc_item_health_large;
-                       actor.monster_attackfunc = M_Mage_Attack;
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Mage, mr_precache, bool(Mage thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Mage, mr_precache, bool(Mage thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index 0ffa60f8cc44c2311af878cadd017029b6b060c5..b091712791b9c5001aeed10841458cbd92872fe1 100644 (file)
@@ -224,65 +224,68 @@ bool M_Shambler_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_shambler) { Monster_Spawn(this, MON_SHAMBLER.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
-               {
-                       actor.pain_finished = time + 0.5;
-                       setanim(actor, actor.anim_pain1, true, true, false);
-                       return true;
-               }
-               METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_die1, false, true, true);
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_die1 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
-                       actor.anim_walk = animfixfps(actor, '1 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '0 1 1', none);
-                       actor.anim_pain1 = animfixfps(actor, '7 1 2', none); // 0.5 seconds
-                       actor.anim_melee1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
-                       actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_melee3 = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
-                       actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '2 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               spawnfunc(item_health_mega);
-               .float animstate_endtime;
-               METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
-                       if(!actor.attack_range) actor.attack_range = 150;
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_shambler_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_shambler_damageforcescale); }
+#ifdef SVQC
+METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
+{
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_health_mega;
-                       actor.weapon = WEP_ELECTRO.m_id; // matches attacks better than WEP_VORTEX
+METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
+{
+    actor.pain_finished = time + 0.5;
+    setanim(actor, actor.anim_pain1, true, true, false);
+    return true;
+}
 
-                       setanim(actor, actor.anim_shoot, false, true, true);
-                       actor.spawn_time = actor.animstate_endtime;
-                       actor.spawnshieldtime = actor.spawn_time;
-                       actor.monster_attackfunc = M_Shambler_Attack;
+METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
+{
+    setanim(actor, actor.anim_die1, false, true, true);
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_die1 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
+    actor.anim_walk = animfixfps(actor, '1 1 1', none);
+    actor.anim_idle = animfixfps(actor, '0 1 1', none);
+    actor.anim_pain1 = animfixfps(actor, '7 1 2', none); // 0.5 seconds
+    actor.anim_melee1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
+    actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_melee3 = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
+    actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '2 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_health_mega);
+.float animstate_endtime;
+METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
+    if(!actor.attack_range) actor.attack_range = 150;
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_shambler_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_shambler_damageforcescale); }
+
+    actor.monster_loot = spawnfunc_item_health_mega;
+    actor.weapon = WEP_ELECTRO.m_id; // matches attacks better than WEP_VORTEX
+
+    setanim(actor, actor.anim_shoot, false, true, true);
+    actor.spawn_time = actor.animstate_endtime;
+    actor.spawnshieldtime = actor.spawn_time;
+    actor.monster_attackfunc = M_Shambler_Attack;
+
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Shambler, mr_precache, bool(Shambler thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Shambler, mr_precache, bool(Shambler thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index 89239941ee1d3dfc4c25d60e2f1cb93b21245415..512422d33b9c8227420106035d5b9e41991c3c9e 100644 (file)
@@ -214,53 +214,56 @@ bool M_Spider_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_spider) { Monster_Spawn(this, MON_SPIDER.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Spider, mr_think, bool(Spider thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Spider, mr_pain, bool(Spider thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Spider, mr_death, bool(Spider thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_melee, false, true, true);
-                       actor.angles_x = 180;
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_walk = animfixfps(actor, '1 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '0 1 1', none);
-                       actor.anim_melee = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
-                       actor.anim_shoot = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '1 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               spawnfunc(item_health_medium);
-               METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_spider_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_spider_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_spider_damageforcescale); }
+#ifdef SVQC
+METHOD(Spider, mr_think, bool(Spider thismon, entity actor))
+{
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_health_medium;
-                       actor.monster_attackfunc = M_Spider_Attack;
+METHOD(Spider, mr_pain, bool(Spider thismon, entity actor))
+{
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Spider, mr_precache, bool(Spider thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Spider, mr_death, bool(Spider thismon, entity actor))
+{
+    setanim(actor, actor.anim_melee, false, true, true);
+    actor.angles_x = 180;
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_walk = animfixfps(actor, '1 1 1', none);
+    actor.anim_idle = animfixfps(actor, '0 1 1', none);
+    actor.anim_melee = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
+    actor.anim_shoot = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '1 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_health_medium);
+METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_spider_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_spider_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_spider_damageforcescale); }
+
+    actor.monster_loot = spawnfunc_item_health_medium;
+    actor.monster_attackfunc = M_Spider_Attack;
+
+    return true;
+}
+
+METHOD(Spider, mr_precache, bool(Spider thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index b7d398da6dbdf1874bec30623f4751009a299ee9..fc13de40ffc314aa268794e00068ff9281c622fc 100644 (file)
@@ -142,58 +142,61 @@ bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_wyvern) { Monster_Spawn(this, MON_WYVERN.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Wyvern, mr_think, bool(Wyvern thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Wyvern, mr_pain, bool(Wyvern thismon, entity actor))
-               {
-                       actor.pain_finished = time + 0.5;
-                       setanim(actor, actor.anim_pain1, true, true, false);
-                       return true;
-               }
-               METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_die1, false, true, true);
-                       actor.velocity_x = -200 + 400 * random();
-                       actor.velocity_y = -200 + 400 * random();
-                       actor.velocity_z = 100 + 100 * random();
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
-                       actor.anim_walk = animfixfps(actor, '1 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '0 1 1', none);
-                       actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
-                       actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '1 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               spawnfunc(item_cells);
-               METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
+#ifdef SVQC
+METHOD(Wyvern, mr_think, bool(Wyvern thismon, entity actor))
+{
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_cells;
-                       actor.monster_attackfunc = M_Wyvern_Attack;
+METHOD(Wyvern, mr_pain, bool(Wyvern thismon, entity actor))
+{
+    actor.pain_finished = time + 0.5;
+    setanim(actor, actor.anim_pain1, true, true, false);
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
+{
+    setanim(actor, actor.anim_die1, false, true, true);
+    actor.velocity_x = -200 + 400 * random();
+    actor.velocity_y = -200 + 400 * random();
+    actor.velocity_z = 100 + 100 * random();
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
+    actor.anim_walk = animfixfps(actor, '1 1 1', none);
+    actor.anim_idle = animfixfps(actor, '0 1 1', none);
+    actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
+    actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '1 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_cells);
+METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
+
+    actor.monster_loot = spawnfunc_item_cells;
+    actor.monster_attackfunc = M_Wyvern_Attack;
+
+    return true;
+}
+
+METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index b522a9647e1f6ca6109b9f82731bb74ddae17301..9163aaf071e5f9dea4f2d6f920abf43584d2a51e 100644 (file)
@@ -154,76 +154,79 @@ bool M_Zombie_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_zombie) { Monster_Spawn(this, MON_ZOMBIE.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Zombie, mr_think, bool(Zombie thismon, entity actor))
-               {
-                       if(time >= actor.spawn_time)
-                               actor.damageforcescale = autocvar_g_monster_zombie_damageforcescale;
-                       return true;
-               }
-               METHOD(Zombie, mr_pain, bool(Zombie thismon, entity actor))
-               {
-                       actor.pain_finished = time + 0.34;
-                       setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false);
-                       return true;
-               }
-               METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
-               {
-                       actor.armorvalue = autocvar_g_monsters_armor_blockpercent;
+#ifdef SVQC
+METHOD(Zombie, mr_think, bool(Zombie thismon, entity actor))
+{
+    if(time >= actor.spawn_time)
+        actor.damageforcescale = autocvar_g_monster_zombie_damageforcescale;
+    return true;
+}
 
-                       setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
-                       actor.anim_die2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
-                       actor.anim_spawn = animfixfps(actor, '30 1 3', none);
-                       actor.anim_walk = animfixfps(actor, '27 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '19 1 1', none);
-                       actor.anim_pain1 = animfixfps(actor, '20 1 2', none); // 0.5 seconds
-                       actor.anim_pain2 = animfixfps(actor, '22 1 2', none); // 0.5 seconds
-                       actor.anim_melee1 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_melee3 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_shoot = animfixfps(actor, '0 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '27 1 1', none);
-                       actor.anim_blockstart = animfixfps(actor, '8 1 1', none);
-                       actor.anim_blockend = animfixfps(actor, '7 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_zombie_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_zombie_speed_stop); }
+METHOD(Zombie, mr_pain, bool(Zombie thismon, entity actor))
+{
+    actor.pain_finished = time + 0.34;
+    setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false);
+    return true;
+}
 
-                       if(actor.spawnflags & MONSTERFLAG_NORESPAWN)
-                               actor.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn
+METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
+{
+    actor.armorvalue = autocvar_g_monsters_armor_blockpercent;
 
-                       actor.spawnflags |= MONSTER_RESPAWN_DEATHPOINT;
+    setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
+    actor.anim_die2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
+    actor.anim_spawn = animfixfps(actor, '30 1 3', none);
+    actor.anim_walk = animfixfps(actor, '27 1 1', none);
+    actor.anim_idle = animfixfps(actor, '19 1 1', none);
+    actor.anim_pain1 = animfixfps(actor, '20 1 2', none); // 0.5 seconds
+    actor.anim_pain2 = animfixfps(actor, '22 1 2', none); // 0.5 seconds
+    actor.anim_melee1 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_melee3 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_shoot = animfixfps(actor, '0 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '27 1 1', none);
+    actor.anim_blockstart = animfixfps(actor, '8 1 1', none);
+    actor.anim_blockend = animfixfps(actor, '7 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_zombie_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_zombie_speed_stop); }
 
-                       actor.monster_loot = spawnfunc_item_health_medium;
-                       actor.monster_attackfunc = M_Zombie_Attack;
-                       actor.spawnshieldtime = actor.spawn_time;
-                       actor.respawntime = 0.2;
-                       actor.damageforcescale = 0.0001; // no push while spawning
+    if(actor.spawnflags & MONSTERFLAG_NORESPAWN)
+        actor.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn
 
-                       setanim(actor, actor.anim_spawn, false, true, true);
-                       actor.spawn_time = actor.animstate_endtime;
+    actor.spawnflags |= MONSTER_RESPAWN_DEATHPOINT;
 
-                       return true;
-               }
-               METHOD(Zombie, mr_precache, bool(Zombie thismon))
-               {
-                       return true;
-               }
-               #endif
+    actor.monster_loot = spawnfunc_item_health_medium;
+    actor.monster_attackfunc = M_Zombie_Attack;
+    actor.spawnshieldtime = actor.spawn_time;
+    actor.respawntime = 0.2;
+    actor.damageforcescale = 0.0001; // no push while spawning
+
+    setanim(actor, actor.anim_spawn, false, true, true);
+    actor.spawn_time = actor.animstate_endtime;
+
+    return true;
+}
+
+METHOD(Zombie, mr_precache, bool(Zombie thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index 346062d64bb0da1daa6171a3a739beae051f1547..8f1d8027617fd7443794b47b41fac7ddbd6cce0c 100644 (file)
@@ -90,7 +90,7 @@ bool Monster_ValidTarget(entity this, entity targ)
        || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || targ.health <= 0 || this.health <= 0))
        || (this.monster_follow == targ || targ.monster_follow == this)
        || (!IS_VEHICLE(targ) && (targ.flags & FL_NOTARGET))
-       || (!autocvar_g_monsters_typefrag && targ.BUTTON_CHAT)
+       || (!autocvar_g_monsters_typefrag && PHYS_INPUT_BUTTON_CHAT(targ))
        || (SAME_TEAM(targ, this))
        || (STAT(FROZEN, targ))
        || (targ.alpha != 0 && targ.alpha < 0.5)
index 4543ae10e70833c43d7f0160b81b592fbfef8a3f..de3d19038a0e47adf6cc225ec378615fbc4d365d 100644 (file)
@@ -8,7 +8,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
        if(IS_PLAYER(self))
        if(self.health <= autocvar_g_bloodloss && !IS_DEAD(self))
        {
-               self.BUTTON_CROUCH = true;
+               PHYS_INPUT_BUTTON_CROUCH(self) = true;
 
                if(time >= self.bloodloss_timer)
                {
index 903237f92b1fd6c86d6216b7667b4d1ece3bf770..30e19f0f5429ae82bc7c3864f041c575973eaeea 100644 (file)
@@ -755,7 +755,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
                        // set pusher so self gets the kill if they fall into void
                        closest.pusher = self;
                        closest.pushltime = time + autocvar_g_maxpushtime;
-                       closest.istypefrag = closest.BUTTON_CHAT;
+                       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);
@@ -1031,11 +1031,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(buffs, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_buffs_autoreplace, "cl_buffs_autoreplace");
-       return false;
-}
+REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace");
 
 MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString)
 {
index 11286d9a2ff8088b7f55235997faf59890e89af0..1d0bd19ebc512f315fb5bdede23a9b0a2c3bac09 100644 (file)
@@ -36,7 +36,7 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
        if(IS_REAL_CLIENT(self)) // bots may camp, but that's no reason to constantly kill them
        if(!IS_DEAD(self))
        if(!STAT(FROZEN, self))
-       if(!self.BUTTON_CHAT)
+       if(!PHYS_INPUT_BUTTON_CHAT(self))
        if(autocvar_g_campcheck_interval)
        {
                vector dist;
index 6a33ab34e6268230983db5b642d910a7c8dd7663..866ffeb4c743e155c9f89c8b158d72a4d2d2e98a 100644 (file)
@@ -98,8 +98,8 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) {
         ) {
             msg_entity = it;
             WriteHeader(MSG_ONE, damagetext);
-            WriteShort(MSG_ONE, health);
-            WriteShort(MSG_ONE, armor);
+            WriteShort(MSG_ONE, rint(health));
+            WriteShort(MSG_ONE, rint(armor));
             WriteEntity(MSG_ONE, hit);
             WriteCoord(MSG_ONE, location.x);
             WriteCoord(MSG_ONE, location.y);
index 6d3662c7372ec28e694deab0239616a588ebe70f..1707d0a9d0084d95b927cab079aef6e69d4112e8 100644 (file)
@@ -275,11 +275,7 @@ MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 
 #ifdef SVQC
 
-MUTATOR_HOOKFUNCTION(dodging, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_dodging_timeout, "cl_dodging_timeout");
-       return false;
-}
+REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
 
 MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
 {
index 8eb4b9294427907eb9787eaf6c0960da3e69885d..33773131a9911f1732244f92c2c48f4f576eb68b 100644 (file)
@@ -293,7 +293,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
                                frag_target.armorvalue -= 1;
                                frag_damage = 0;
                                frag_target.damage_dealt += 1;
-                               frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
+                               frag_attacker.damage_dealt += 1;
                                Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
                        }
                }
index 43be345c1e41f23d2a1e74583212cd1ef6dbd362..cd369b87d9b0f62220bfdbb1ddbe4837e41cb2c1 100644 (file)
@@ -116,11 +116,7 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
 
 #ifdef SVQC
 
-MUTATOR_HOOKFUNCTION(multijump, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_multijump, "cl_multijump");
-       return false;
-}
+REPLICATE(cvar_cl_multijump, bool, "cl_multijump");
 
 MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsString)
 {
index b5b97bbf1dd14594029be715c9f91a736fb6774d..16a435dd17339875072602fff898b02a58128f68 100644 (file)
@@ -844,7 +844,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        if (trace_startsolid)
                setorigin(_nade, e.origin);
 
-       if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && self.BUTTON_CROUCH)
+       if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(self))
                _nade.velocity = '0 0 100';
        else if(autocvar_g_nades_nade_newton_style == 1)
                _nade.velocity = e.velocity + _velocity;
@@ -1349,13 +1349,8 @@ MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(nades, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_nade_type, "cl_nade_type");
-       GetCvars_handleString(get_cvars_s, get_cvars_f, cvar_cl_pokenade_type, "cl_pokenade_type");
-
-       return false;
-}
+REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
+REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type");
 
 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
 {
index 415a8526b5e0bb09568377244c9487be3dc0066c..30473e09b8e71365a11db5561a196ade8e285534 100644 (file)
@@ -56,7 +56,7 @@ spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(this, WEP_HMG); }
 
 void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if (!actor.BUTTON_ATCK)
+       if (!PHYS_INPUT_BUTTON_ATCK(actor))
        {
                w_ready(thiswep, actor, weaponentity, fire);
                return;
@@ -98,72 +98,78 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
 }
 
-               METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
-               {
-                       if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
-                       else
-                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
-               }
-               METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               if (fire & 1)
-                               if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
-                               {
-                                       actor.misc_bulletcounter = 0;
-                                       W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
-                               }
-                       }
-               }
-               METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
-
-                       if(autocvar_g_balance_hmg_reload_ammo)
-                               ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
-
-                       return ammo_amount;
-               }
-               METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
-
-                       if(autocvar_g_balance_hmg_reload_ammo)
-                               ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
-
-                       return ammo_amount;
-               }
-               METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
-               }
-               METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_HMG_MURDER_SNIPE;
-                       else
-                               return WEAPON_HMG_MURDER_SPRAY;
-               }
+METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
+{
+    if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+}
+
+METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        if (fire & 1)
+        if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+        {
+            actor.misc_bulletcounter = 0;
+            W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+        }
+    }
+}
+
+METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+
+    if(autocvar_g_balance_hmg_reload_ammo)
+        ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+
+    return ammo_amount;
+}
+
+METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+
+    if(autocvar_g_balance_hmg_reload_ammo)
+        ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+
+    return ammo_amount;
+}
+
+METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
+}
+
+METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+
+METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_HMG_MURDER_SNIPE;
+    else
+        return WEAPON_HMG_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-               }
+METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+}
 
 #endif
 #endif
index f0db0836abce571180cbce94e112276f0db16ccb..972220e7516d21e650870afe7e533f969dc0b5a9 100644 (file)
@@ -77,7 +77,7 @@ void ok_IncreaseCharge(entity ent, int wep)
        if (wepent == WEP_Null) return;  // dummy
 
        if(ent.ok_use_ammocharge)
-       if(!ent.BUTTON_ATCK) // not while attacking?
+       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);
 }
 
@@ -188,7 +188,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
 
        ok_IncreaseCharge(self, PS(self).m_weapon.m_id);
 
-       if(self.BUTTON_ATCK2)
+       if(PHYS_INPUT_BUTTON_ATCK2(self))
        if(!forbidWeaponUse(self) || self.weapon_blocked) // allow if weapon is blocked
        if(time >= self.jump_interval)
        {
@@ -220,7 +220,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
        if(self.ok_use_ammocharge)
        if(!ok_CheckWeaponCharge(self, PS(self).m_weapon.m_id))
        {
-               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && PS(self).m_weapon == PS(self).m_switchweapon)
+               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && PHYS_INPUT_BUTTON_ATCK(self) && IS_REAL_CLIENT(self) && PS(self).m_weapon == PS(self).m_switchweapon)
                {
                        //Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE);
                        self.ok_notice_time = time + 2;
@@ -229,12 +229,12 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                Weapon wpn = PS(self).m_weapon;
                .entity weaponentity = weaponentities[0]; // TODO: unhardcode
                if(self.(weaponentity).state != WS_CLEAR)
-                       w_ready(wpn, self, weaponentity, (self.BUTTON_ATCK ? 1 : 0) | (self.BUTTON_ATCK2 ? 2 : 0));
+                       w_ready(wpn, self, weaponentity, PHYS_INPUT_BUTTON_ATCK(self) | (PHYS_INPUT_BUTTON_ATCK2(self) << 1));
 
                self.weapon_blocked = true;
        }
 
-       self.BUTTON_ATCK2 = 0;
+       PHYS_INPUT_BUTTON_ATCK2(self) = false;
 
        return false;
 }
index c32e613208598c6e7ffaa8ae85a306ae7ede5fa0..50362a1de856c7f9faebe31e61e303ffad5fb796 100644 (file)
@@ -150,74 +150,80 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-               METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
-               {
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
-               }
-               METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               if (fire & 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
-                                       {
-                                               W_RocketPropelledChainsaw_Attack(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
-                                       }
-                               }
-
-                               if (fire & 2)
-                               {
-                                       // to-do
-                               }
-                       }
-               }
-               METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
-                       ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
-                       return ammo_amount;
-               }
-               METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
-               {
-                       return false;
-               }
-               METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
-               }
-               METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
-                               return WEAPON_RPC_SUICIDE_SPLASH;
-                       else
-                               return WEAPON_RPC_SUICIDE_DIRECT;
-               }
-               METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_BLASTER_MURDER;
-                       else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
-                               return WEAPON_RPC_MURDER_SPLASH;
-                       else
-                               return WEAPON_RPC_MURDER_DIRECT;
-               }
+METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+}
+
+METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        if (fire & 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
+            {
+                W_RocketPropelledChainsaw_Attack(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
+            }
+        }
+
+        if (fire & 2)
+        {
+            // to-do
+        }
+    }
+}
+
+METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
+    ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
+    return ammo_amount;
+}
+
+METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
+{
+    return false;
+}
+
+METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
+}
+
+METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
+{
+    if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+        return WEAPON_RPC_SUICIDE_SPLASH;
+    else
+        return WEAPON_RPC_SUICIDE_DIRECT;
+}
+
+METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_BLASTER_MURDER;
+    else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+        return WEAPON_RPC_MURDER_SPLASH;
+    else
+        return WEAPON_RPC_MURDER_DIRECT;
+}
 
 #endif
 
 #ifdef CSQC
 
-               METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-               }
+METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+}
 
 #endif
 #endif
index 2dffb42f89680e5382551472ae9691335a00d967..6391e1f8726b4f7ad17cf5d89d7007a65e0950da 100644 (file)
@@ -213,7 +213,7 @@ entity sandbox_ObjectSpawn(float database)
                e.angles_y = self.v_angle.y;
        }
 
-       WITH(entity, self, e, CSQCMODEL_AUTOINIT(e));
+       CSQCMODEL_AUTOINIT(e);
 
        object_count += 1;
        return e;
index d94cb53974c3e315d612589686bc512eb0aded22..5d3618f9e75f29a0d043d10c34485aa519ead138 100644 (file)
@@ -164,9 +164,6 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies)
        return 0;
 }
 
-MUTATOR_HOOKFUNCTION(spawn_near_teammate, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_spawn_near_teammate, "cl_spawn_near_teammate");
-       return false;
-}
+REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate");
+
 #endif
index 17a103dd448dec20df1a0dafeef5daa2b3314604..2b28784b7cdb284e24ed71fa300f3ebf0b24c701 100644 (file)
@@ -42,7 +42,6 @@ REGISTER_RADARICON(NONE,            0);
 REGISTER_RADARICON(FLAG,            1);
 REGISTER_RADARICON(FLAGCARRIER,     1);
 
-// TODO make these 3 and 4, and make images for them
 REGISTER_RADARICON(HERE,            1);
 REGISTER_RADARICON(DANGER,          1);
 
index 208b16c3b8f6473acde347790d82cd23d0425619..af3f87c158a4bb259dc9d7868b6fc82e03ff30d8 100644 (file)
@@ -690,7 +690,7 @@ void PM_check_nickspam(entity this)
        {
                // slight annoyance for nick change scripts
                this.movement = -1 * this.movement;
-               this.BUTTON_ATCK = this.BUTTON_JUMP = this.BUTTON_ATCK2 = this.BUTTON_ZOOM = this.BUTTON_CROUCH = this.BUTTON_HOOK = this.BUTTON_USE = 0;
+               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = PHYS_INPUT_BUTTON_HOOK(this) = PHYS_INPUT_BUTTON_USE(this) = false;
 
                if (this.nickspamcount >= autocvar_g_nick_flood_penalty_red) // if you are persistent and the slight annoyance above does not stop you, I'll show you!
                {
@@ -992,7 +992,7 @@ void PM_jetpack(entity this, float maxspd_mod)
        // add the unused velocity as up component
        wishvel_z = 0;
 
-       // if (this.BUTTON_JUMP)
+       // if (PHYS_INPUT_BUTTON_JUMP(this))
                wishvel_z = sqrt(max(0, 1 - wishvel * wishvel));
 
        // it is now normalized, so...
index ea318c5b013f540801aa5fa2d196c5e5a8e9ea0a..252b157cdf0f8dfd9c22d873db7630275c57a796 100644 (file)
@@ -99,6 +99,15 @@ bool IsFlying(entity a);
 #define PHYS_INPUT_BUTTON_ZOOM(s)           PHYS_INPUT_BUTTON_BUTTON4(s)
 #define PHYS_INPUT_BUTTON_CROUCH(s)         PHYS_INPUT_BUTTON_BUTTON5(s)
 #define PHYS_INPUT_BUTTON_HOOK(s)           PHYS_INPUT_BUTTON_BUTTON6(s)
+
+#ifdef CSQC
+STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
+{
+       localcmd("alias +hook +button6\n");
+       localcmd("alias -hook -button6\n");
+}
+#endif
+
 #define PHYS_INPUT_BUTTON_INFO(s)           PHYS_INPUT_BUTTON_BUTTON7(s)
 #define PHYS_INPUT_BUTTON_DRAG(s)           PHYS_INPUT_BUTTON_BUTTON8(s)
 #define PHYS_INPUT_BUTTON_USE(s)            PHYS_INPUT_BUTTON_BUTTON_USE(s)
@@ -107,6 +116,14 @@ bool IsFlying(entity a);
 #define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)     PHYS_INPUT_BUTTON_BUTTON9(s)
 #define PHYS_INPUT_BUTTON_JETPACK(s)        PHYS_INPUT_BUTTON_BUTTON10(s)
 
+#ifdef CSQC
+STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
+{
+       localcmd("alias +jetpack +button10\n");
+    localcmd("alias -jetpack -button10\n");
+}
+#endif
+
 // if more buttons are needed, start using impulse bits as buttons
 
 #define PHYS_INPUT_BUTTON_BACKWARD(s)       (PHYS_INPUT_MOVEVALUES(s).x < 0)
index e2ba5f3858b1dcef031e5009b4fcab9d7d7cde76..fcc3656b8dcd710c76305925e1868e18bef0777b 100644 (file)
@@ -30,18 +30,25 @@ ENDCLASS(PlayerState)
        PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
 #endif
 
+void Inventory_new(entity this);
+void Inventory_delete(entity this);
+
+// TODO: renew on death
+
 void PlayerState_attach(entity this)
 {
-       // TODO: dynamic
-       // this._ps = NEW(PlayerState, this);
+       this._ps = NEW(PlayerState, this);
+
+       Inventory_new(this);
 }
 
 void PlayerState_detach(entity this)
 {
-       // TODO: dynamic
-       // if (!PS(this)) return;  // initial connect
-       // remove(PS(this));
-       // this._ps = NULL;
+       if (!PS(this)) return;  // initial connect
+       remove(PS(this));
+       this._ps = NULL;
+
+    Inventory_delete(self);
 }
 
 /**
@@ -66,15 +73,64 @@ ENDCLASS(ClientState)
        ClientState CS(entity this) { assert(IS_CLIENT(this)); assert(this._cs); return this._cs; }
 #endif
 
+void GetCvars(int);
+void DecodeLevelParms(entity this);
+void PlayerScore_Attach(entity this);
+void ClientData_Attach(entity this);
+void accuracy_init(entity this);
+void entcs_attach(entity this);
+void playerdemo_init(entity this);
+void anticheat_init(entity this);
+void W_HitPlotOpen(entity this);
+void bot_clientconnect(entity this);
+
 void ClientState_attach(entity this)
 {
        this._cs = NEW(ClientState, this);
-       this._ps = NEW(PlayerState, this);  // TODO: dynamic
+
+    GetCvars(0);  // get other cvars from player
+
+       // TODO: xonstat elo.txt support, until then just 404s
+       if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
+
+       // TODO: fold all of these into ClientState
+
+       DecodeLevelParms(this);
+
+       PlayerScore_Attach(this);
+       ClientData_Attach(this);
+       accuracy_init(this);
+       entcs_attach(this);
+       playerdemo_init(this);
+       anticheat_init(this);
+       W_HitPlotOpen(this);
+
+       bot_clientconnect(this);
 }
 
+void bot_clientdisconnect();
+void W_HitPlotClose(entity this);
+void anticheat_report();
+void playerdemo_shutdown();
+void entcs_detach(entity this);
+void accuracy_free(entity this);
+void ClientData_Detach(entity this);
+void PlayerScore_Detach(entity this);
+
 void ClientState_detach(entity this)
 {
        remove(CS(this));
        this._cs = NULL;
-       this._ps = NULL;  // TODO: dynamic
+
+    GetCvars(-1);  // free cvars
+
+    bot_clientdisconnect();
+
+    W_HitPlotClose(this);
+    anticheat_report();
+    playerdemo_shutdown();
+    entcs_detach(this);
+    accuracy_free(self);
+    ClientData_Detach(this);
+    PlayerScore_Detach(self);
 }
index 534a22a21a9150fe1d604e8bd1f9335c5a74e797..ef7438c96a186f8f3e4c42c9ba2c03fc07739a11 100644 (file)
@@ -582,7 +582,8 @@ void Item_RespawnThink()
 
 void Item_ScheduleRespawnIn(entity e, float t)
 {
-       if (Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS)
+       // if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
+       if ((Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS) && (t - ITEM_RESPAWN_TICKS) > 0)
        {
                e.think = Item_RespawnCountdown;
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
@@ -615,7 +616,7 @@ void Item_ScheduleRespawn(entity e)
 void Item_ScheduleInitialRespawn(entity e)
 {
        Item_Show(e, 0);
-       Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));
+       Item_ScheduleRespawnIn(e, game_starttime - time + ((e.respawntimestart) ? e.respawntimestart : ITEM_RESPAWNTIME_INITIAL(e)));
 }
 
 float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
@@ -902,7 +903,6 @@ void Item_FindTeam()
 }
 
 // Savage: used for item garbage-collection
-// TODO: perhaps nice special effect?
 void RemoveItem()
 {SELFPARAM();
        if(wasfreed(self) || !self) { return; }
index 86e5c7c8ea1084239c5080344d2370d6ceb9bb33..d6c97445f6be572cbe87f2ebcf7d2cfbbf6cb4f1 100644 (file)
@@ -94,7 +94,6 @@ void Item_Reset(entity this);
 
 void Item_FindTeam();
 // Savage: used for item garbage-collection
-// TODO: perhaps nice special effect?
 
 bool ItemSend(entity this, entity to, int sf);
 void ItemUpdate(entity this);
index eae31ead021891d6b9f8e8803175a4bbda5363b1..801776857a808423b39c30e9b6645209eace97eb 100644 (file)
@@ -160,7 +160,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
                {
                        player.pusher = teleporter.owner;
                        player.pushltime = time + autocvar_g_maxpushtime;
-                       player.istypefrag = player.BUTTON_CHAT;
+                       player.istypefrag = PHYS_INPUT_BUTTON_CHAT(player);
                }
                else
                {
index 3c1534c9785b67859c46eb48f68ce507977cced5..507af7810995a845100a3566ae5b9666086a0e6d 100644 (file)
@@ -417,16 +417,23 @@ bool target_push_send(entity this, entity to, float sf)
        return true;
 }
 
-void target_push_link()
-{SELFPARAM();
-       BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
-       Net_LinkEntity(self, false, 0, target_push_send);
-       //self.SendFlags |= 1; // update
+void target_push_link(entity this)
+{
+       BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
+       Net_LinkEntity(this, false, 0, target_push_send);
+       //this.SendFlags |= 1; // update
+}
+
+void target_push_init(entity this)
+{
+       this.mangle = this.angles;
+       setorigin(this, this.origin);
+       target_push_link(this);
 }
 
-spawnfunc(target_push) { target_push_link(); }
-spawnfunc(info_notnull) { target_push_link(); }
-spawnfunc(target_position) { make_pure(this); target_push_link(); }
+spawnfunc(target_push) { target_push_init(this); }
+spawnfunc(info_notnull) { target_push_init(this); }
+spawnfunc(target_position) { make_pure(this); target_push_init(this); }
 
 #elif defined(CSQC)
 
index 66e0e6305b3029a97a115bc3b99539e664b3d6fc..3b4dbb489a7b31455c1b2d29b6dc12f1dfb1b277 100644 (file)
@@ -83,7 +83,8 @@ spawnfunc(trigger_teleport)
        self.angles = '0 0 0';
 
        self.active = ACTIVE_ACTIVE;
-       trigger_init(self);
+       //trigger_init(self); // only for predicted triggers?
+       EXACTTRIGGER_INIT;
        self.use = trigger_teleport_use;
 
        if(self.noise != "")
index dc3b460e94291277593f33e14d67f6093b56e768..2a537d4e98fdc889f94ebb10ad1b2c1873637925 100644 (file)
@@ -137,102 +137,104 @@ void ewheel_move_idle()
 
 spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
 
-        METHOD(EWheel, tr_think, void(EWheel thistur, entity it))
-        {
-            SELFPARAM();
-            float vz;
-            vector wish_angle, real_angle;
+METHOD(EWheel, tr_think, void(EWheel thistur, entity it))
+{
+    SELFPARAM();
+    float vz;
+    vector wish_angle, real_angle;
 
-            vz = self.velocity_z;
+    vz = self.velocity_z;
 
-            self.angles_x = anglemods(self.angles_x);
-            self.angles_y = anglemods(self.angles_y);
+    self.angles_x = anglemods(self.angles_x);
+    self.angles_y = anglemods(self.angles_y);
 
-            fixedmakevectors(self.angles);
+    fixedmakevectors(self.angles);
 
-            wish_angle = normalize(self.steerto);
-            wish_angle = vectoangles(wish_angle);
-            real_angle = wish_angle - self.angles;
-            real_angle = shortangle_vxy(real_angle, self.tur_head.angles);
+    wish_angle = normalize(self.steerto);
+    wish_angle = vectoangles(wish_angle);
+    real_angle = wish_angle - self.angles;
+    real_angle = shortangle_vxy(real_angle, self.tur_head.angles);
 
-            self.tur_head.spawnshieldtime = fabs(real_angle_y);
-            real_angle_y  = bound(-self.tur_head.aim_speed, real_angle_y, self.tur_head.aim_speed);
-            self.angles_y = (self.angles_y + real_angle_y);
+    self.tur_head.spawnshieldtime = fabs(real_angle_y);
+    real_angle_y  = bound(-self.tur_head.aim_speed, real_angle_y, self.tur_head.aim_speed);
+    self.angles_y = (self.angles_y + real_angle_y);
 
-            if(self.enemy)
-                ewheel_move_enemy();
-            else if(self.pathcurrent)
-                ewheel_move_path();
-            else
-                ewheel_move_idle();
+    if(self.enemy)
+        ewheel_move_enemy();
+    else if(self.pathcurrent)
+        ewheel_move_path();
+    else
+        ewheel_move_idle();
 
-            self.velocity_z = vz;
+    self.velocity_z = vz;
 
-            if(self.velocity)
-                self.SendFlags |= TNSF_MOVE;
-        }
-        METHOD(EWheel, tr_death, void(EWheel this, entity it))
-        {
-            it.velocity = '0 0 0';
+    if(self.velocity)
+        self.SendFlags |= TNSF_MOVE;
+}
+
+METHOD(EWheel, tr_death, void(EWheel this, entity it))
+{
+    it.velocity = '0 0 0';
 
 #ifdef EWHEEL_FANCYPATH
-            if (self.pathcurrent)
-                pathlib_deletepath(it.pathcurrent.owner);
+    if (self.pathcurrent)
+        pathlib_deletepath(it.pathcurrent.owner);
 #endif
-            it.pathcurrent = NULL;
-        }
-        METHOD(EWheel, tr_setup, void(EWheel this, entity it))
-        {
-            entity e;
+    it.pathcurrent = NULL;
+}
 
-            if(it.movetype == MOVETYPE_WALK)
-            {
-                it.velocity = '0 0 0';
-                it.enemy = world;
+METHOD(EWheel, tr_setup, void(EWheel this, entity it))
+{
+    entity e;
+
+    if(it.movetype == MOVETYPE_WALK)
+    {
+        it.velocity = '0 0 0';
+        it.enemy = world;
 
-                setorigin(it, it.pos1);
+        setorigin(it, it.pos1);
 
-                if (it.target != "")
-                {
-                    e = find(world, targetname, it.target);
-                    if (!e)
-                    {
-                        LOG_TRACE("Initital waypoint for ewheel does NOT exsist, fix your map!\n");
-                        it.target = "";
-                    }
-
-                    if (e.classname != "turret_checkpoint")
-                        LOG_TRACE("Warning: not a turrret path\n");
-                    else
-                    {
+        if (it.target != "")
+        {
+            e = find(world, targetname, it.target);
+            if (!e)
+            {
+                LOG_TRACE("Initital waypoint for ewheel does NOT exsist, fix your map!\n");
+                it.target = "";
+            }
+
+            if (e.classname != "turret_checkpoint")
+                LOG_TRACE("Warning: not a turrret path\n");
+            else
+            {
 
 #ifdef EWHEEL_FANCYPATH
-                        it.pathcurrent = WALKER_PATH(it.origin,e.origin);
-                        it.pathgoal = e;
+                it.pathcurrent = WALKER_PATH(it.origin,e.origin);
+                it.pathgoal = e;
 #else
-                        it.pathcurrent  = e;
+                it.pathcurrent  = e;
 #endif
-                    }
-                }
             }
-
-            it.iscreature                              = true;
-            it.teleportable                    = TELEPORT_NORMAL;
-            it.damagedbycontents               = true;
-            it.movetype                                = MOVETYPE_WALK;
-            it.solid                                   = SOLID_SLIDEBOX;
-            it.takedamage                              = DAMAGE_AIM;
-            it.idle_aim                                = '0 0 0';
-            it.pos1                                    = it.origin;
-            it.target_select_flags     = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.target_validate_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.frame                                   = it.tur_head.frame = 1;
-            it.ammo_flags                              = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
-
-            // Convert from dgr / sec to dgr / tic
-            it.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate);
-            it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / it.ticrate);
         }
+    }
+
+    it.iscreature                              = true;
+    it.teleportable                    = TELEPORT_NORMAL;
+    it.damagedbycontents               = true;
+    it.movetype                                = MOVETYPE_WALK;
+    it.solid                                   = SOLID_SLIDEBOX;
+    it.takedamage                              = DAMAGE_AIM;
+    it.idle_aim                                = '0 0 0';
+    it.pos1                                    = it.origin;
+    it.target_select_flags     = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.target_validate_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.frame                                   = it.tur_head.frame = 1;
+    it.ammo_flags                              = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
+
+    // Convert from dgr / sec to dgr / tic
+    it.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate);
+    it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / it.ticrate);
+}
 
 #endif // SVQC
 #ifdef CSQC
index 599e00c29d4e4d82cbc06c52c4087b7d847ca646..bf68e85fd207459861fec6e164e5b7abb0b217a6 100644 (file)
@@ -348,284 +348,284 @@ void walker_move_path()
 
 spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
 
-        METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
-        {
-            fixedmakevectors(self.angles);
+METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
+{
+    fixedmakevectors(self.angles);
 
-            if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
-                walker_move_path();
-            else if (self.enemy == world)
+    if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
+        walker_move_path();
+    else if (self.enemy == world)
+    {
+        if(self.pathcurrent)
+            walker_move_path();
+        else
+        {
+            if(self.enemy_last_time != 0)
             {
-                if(self.pathcurrent)
-                    walker_move_path();
+                if(vdist(self.origin - self.enemy_last_loc, <, 128) || time - self.enemy_last_time > 10)
+                    self.enemy_last_time = 0;
                 else
-                {
-                    if(self.enemy_last_time != 0)
-                    {
-                        if(vdist(self.origin - self.enemy_last_loc, <, 128) || time - self.enemy_last_time > 10)
-                            self.enemy_last_time = 0;
-                        else
-                            walker_move_to(self.enemy_last_loc, 0);
-                    }
-                    else
-                    {
-                        if(self.animflag != ANIM_NO)
-                        {
-                            traceline(self.origin + '0 0 64', self.origin + '0 0 64' + v_forward * 128, MOVE_NORMAL, self);
-
-                            if(trace_fraction != 1.0)
-                                self.tur_head.idletime = -1337;
-                            else
-                            {
-                                traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
-                                if(trace_fraction == 1.0)
-                                    self.tur_head.idletime = -1337;
-                            }
-
-                            if(self.tur_head.idletime == -1337)
-                            {
-                                self.moveto = self.origin + randomvec() * 256;
-                                self.tur_head.idletime = 0;
-                            }
-
-                            self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1;
-                            self.moveto_z = self.origin_z + 64;
-                            walker_move_to(self.moveto, 0);
-                        }
-
-                        if(self.idletime < time)
-                        {
-                            if(random() < 0.5 || !(self.spawnflags & TSL_ROAM))
-                            {
-                                self.idletime = time + 1 + random() * 5;
-                                self.moveto = self.origin;
-                                self.animflag = ANIM_NO;
-                            }
-                            else
-                            {
-                                self.animflag = ANIM_WALK;
-                                self.idletime = time + 4 + random() * 2;
-                                self.moveto = self.origin + randomvec() * 256;
-                                self.tur_head.moveto = self.moveto;
-                                self.tur_head.idletime = 0;
-                            }
-                        }
-                    }
-                }
+                    walker_move_to(self.enemy_last_loc, 0);
             }
             else
             {
-                if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_melee_range) && self.animflag != ANIM_MELEE)
+                if(self.animflag != ANIM_NO)
                 {
-                    vector wish_angle;
+                    traceline(self.origin + '0 0 64', self.origin + '0 0 64' + v_forward * 128, MOVE_NORMAL, self);
+
+                    if(trace_fraction != 1.0)
+                        self.tur_head.idletime = -1337;
+                    else
+                    {
+                        traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
+                        if(trace_fraction == 1.0)
+                            self.tur_head.idletime = -1337;
+                    }
 
-                    wish_angle = angleofs(self, self.enemy);
-                    if (self.animflag != ANIM_SWIM)
-                    if (fabs(wish_angle_y) < 15)
+                    if(self.tur_head.idletime == -1337)
                     {
-                        self.moveto   = self.enemy.origin;
-                        self.steerto  = steerlib_attract2(self, self.moveto, 0.5, 500, 0.95);
-                        self.animflag = ANIM_MELEE;
+                        self.moveto = self.origin + randomvec() * 256;
+                        self.tur_head.idletime = 0;
                     }
+
+                    self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1;
+                    self.moveto_z = self.origin_z + 64;
+                    walker_move_to(self.moveto, 0);
                 }
-                else if (self.tur_head.attack_finished_single[0] < time)
+
+                if(self.idletime < time)
                 {
-                    if(self.tur_head.shot_volly)
+                    if(random() < 0.5 || !(self.spawnflags & TSL_ROAM))
                     {
+                        self.idletime = time + 1 + random() * 5;
+                        self.moveto = self.origin;
                         self.animflag = ANIM_NO;
-
-                        self.tur_head.shot_volly = self.tur_head.shot_volly -1;
-                        if(self.tur_head.shot_volly == 0)
-                            self.tur_head.attack_finished_single[0] = time + (autocvar_g_turrets_unit_walker_rocket_refire);
-                        else
-                            self.tur_head.attack_finished_single[0] = time + 0.2;
-
-                        if(self.tur_head.shot_volly > 1)
-                            walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket01")));
-                        else
-                            walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket02")));
                     }
                     else
                     {
-                        if (self.tur_dist_enemy > (autocvar_g_turrets_unit_walker_rocket_range_min))
-                        if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_rocket_range))
-                            self.tur_head.shot_volly = 4;
+                        self.animflag = ANIM_WALK;
+                        self.idletime = time + 4 + random() * 2;
+                        self.moveto = self.origin + randomvec() * 256;
+                        self.tur_head.moveto = self.moveto;
+                        self.tur_head.idletime = 0;
                     }
                 }
-                else
-                {
-                    if (self.animflag != ANIM_MELEE)
-                        walker_move_to(self.enemy.origin, self.tur_dist_enemy);
-                }
             }
+        }
+    }
+    else
+    {
+        if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_melee_range) && self.animflag != ANIM_MELEE)
+        {
+            vector wish_angle;
 
+            wish_angle = angleofs(self, self.enemy);
+            if (self.animflag != ANIM_SWIM)
+            if (fabs(wish_angle_y) < 15)
             {
-                vector real_angle;
-                float turny = 0, turnx = 0;
-                float vz;
+                self.moveto   = self.enemy.origin;
+                self.steerto  = steerlib_attract2(self, self.moveto, 0.5, 500, 0.95);
+                self.animflag = ANIM_MELEE;
+            }
+        }
+        else if (self.tur_head.attack_finished_single[0] < time)
+        {
+            if(self.tur_head.shot_volly)
+            {
+                self.animflag = ANIM_NO;
 
-                real_angle = vectoangles(self.steerto) - self.angles;
-                vz = self.velocity_z;
+                self.tur_head.shot_volly = self.tur_head.shot_volly -1;
+                if(self.tur_head.shot_volly == 0)
+                    self.tur_head.attack_finished_single[0] = time + (autocvar_g_turrets_unit_walker_rocket_refire);
+                else
+                    self.tur_head.attack_finished_single[0] = time + 0.2;
 
-                switch (self.animflag)
-                {
-                    case ANIM_NO:
-                        movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
-                        break;
-
-                    case ANIM_TURN:
-                        turny = (autocvar_g_turrets_unit_walker_turn);
-                        movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
-                        break;
-
-                    case ANIM_WALK:
-                        turny = (autocvar_g_turrets_unit_walker_turn_walk);
-                        movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_walk), 0.6);
-                        break;
-
-                    case ANIM_RUN:
-                        turny = (autocvar_g_turrets_unit_walker_turn_run);
-                        movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_run), 0.6);
-                        break;
-
-                    case ANIM_STRAFE_L:
-                        turny = (autocvar_g_turrets_unit_walker_turn_strafe);
-                        movelib_move_simple(self, v_right * -1, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
-                        break;
-
-                    case ANIM_STRAFE_R:
-                        turny = (autocvar_g_turrets_unit_walker_turn_strafe);
-                        movelib_move_simple(self, v_right, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
-                        break;
-
-                    case ANIM_JUMP:
-                        self.velocity += '0 0 1' * (autocvar_g_turrets_unit_walker_speed_jump);
-                        break;
-
-                    case ANIM_LAND:
-                        break;
-
-                    case ANIM_PAIN:
-                        if(self.frame != ANIM_PAIN)
-                            defer(self, 0.25, walker_setnoanim);
-
-                        break;
-
-                    case ANIM_MELEE:
-                        if(self.frame != ANIM_MELEE)
-                        {
-                            defer(self, 0.41, walker_setnoanim);
-                            defer(self, 0.21, walker_melee_do_dmg);
-                        }
-
-                        movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
-                        break;
-
-                    case ANIM_SWIM:
-                        turny = (autocvar_g_turrets_unit_walker_turn_swim);
-                        turnx = (autocvar_g_turrets_unit_walker_turn_swim);
-
-                        self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10);
-                        movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_swim), 0.3);
-                        vz = self.velocity_z + sin(time * 4) * 8;
-                        break;
-
-                    case ANIM_ROAM:
-                        turny = (autocvar_g_turrets_unit_walker_turn_walk);
-                        movelib_move_simple(self, v_forward ,(autocvar_g_turrets_unit_walker_speed_roam), 0.5);
-                        break;
-                }
+                if(self.tur_head.shot_volly > 1)
+                    walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket01")));
+                else
+                    walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket02")));
+            }
+            else
+            {
+                if (self.tur_dist_enemy > (autocvar_g_turrets_unit_walker_rocket_range_min))
+                if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_rocket_range))
+                    self.tur_head.shot_volly = 4;
+            }
+        }
+        else
+        {
+            if (self.animflag != ANIM_MELEE)
+                walker_move_to(self.enemy.origin, self.tur_dist_enemy);
+        }
+    }
 
-                if(turny)
-                {
-                    turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny );
-                    self.angles_y += turny;
-                }
+    {
+        vector real_angle;
+        float turny = 0, turnx = 0;
+        float vz;
 
-                if(turnx)
+        real_angle = vectoangles(self.steerto) - self.angles;
+        vz = self.velocity_z;
+
+        switch (self.animflag)
+        {
+            case ANIM_NO:
+                movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
+                break;
+
+            case ANIM_TURN:
+                turny = (autocvar_g_turrets_unit_walker_turn);
+                movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
+                break;
+
+            case ANIM_WALK:
+                turny = (autocvar_g_turrets_unit_walker_turn_walk);
+                movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_walk), 0.6);
+                break;
+
+            case ANIM_RUN:
+                turny = (autocvar_g_turrets_unit_walker_turn_run);
+                movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_run), 0.6);
+                break;
+
+            case ANIM_STRAFE_L:
+                turny = (autocvar_g_turrets_unit_walker_turn_strafe);
+                movelib_move_simple(self, v_right * -1, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
+                break;
+
+            case ANIM_STRAFE_R:
+                turny = (autocvar_g_turrets_unit_walker_turn_strafe);
+                movelib_move_simple(self, v_right, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
+                break;
+
+            case ANIM_JUMP:
+                self.velocity += '0 0 1' * (autocvar_g_turrets_unit_walker_speed_jump);
+                break;
+
+            case ANIM_LAND:
+                break;
+
+            case ANIM_PAIN:
+                if(self.frame != ANIM_PAIN)
+                    defer(self, 0.25, walker_setnoanim);
+
+                break;
+
+            case ANIM_MELEE:
+                if(self.frame != ANIM_MELEE)
                 {
-                    turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx );
-                    self.angles_x += turnx;
+                    defer(self, 0.41, walker_setnoanim);
+                    defer(self, 0.21, walker_melee_do_dmg);
                 }
 
-                self.velocity_z = vz;
-            }
+                movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
+                break;
 
+            case ANIM_SWIM:
+                turny = (autocvar_g_turrets_unit_walker_turn_swim);
+                turnx = (autocvar_g_turrets_unit_walker_turn_swim);
 
-            if(self.origin != self.oldorigin)
-                self.SendFlags |= TNSF_MOVE;
+                self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10);
+                movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_swim), 0.3);
+                vz = self.velocity_z + sin(time * 4) * 8;
+                break;
 
-            self.oldorigin = self.origin;
-            turrets_setframe(self.animflag, false);
+            case ANIM_ROAM:
+                turny = (autocvar_g_turrets_unit_walker_turn_walk);
+                movelib_move_simple(self, v_forward ,(autocvar_g_turrets_unit_walker_speed_roam), 0.5);
+                break;
         }
-        METHOD(WalkerTurret, tr_death, void(WalkerTurret this, entity it))
+
+        if(turny)
         {
-#ifdef WALKER_FANCYPATHING
-            if (it.pathcurrent)
-                pathlib_deletepath(it.pathcurrent.owner);
-#endif
-            it.pathcurrent = NULL;
+            turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny );
+            self.angles_y += turny;
         }
-        METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
+
+        if(turnx)
         {
-            it.ticrate = 0.05;
+            turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx );
+            self.angles_x += turnx;
+        }
 
-            entity e;
+        self.velocity_z = vz;
+    }
 
-            // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
-            if(it.movetype == MOVETYPE_WALK)
-            {
-                if(it.pos1)
-                    setorigin(it, it.pos1);
-                if(it.pos2)
-                    it.angles = it.pos2;
-            }
 
-            it.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
-            it.aim_flags = TFL_AIM_LEAD;
-            it.turret_flags |= TUR_FLAG_HITSCAN;
-
-            it.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.iscreature = true;
-            it.teleportable = TELEPORT_NORMAL;
-            it.damagedbycontents = true;
-            it.solid = SOLID_SLIDEBOX;
-            it.takedamage = DAMAGE_AIM;
-            if(it.movetype != MOVETYPE_WALK)
-            {
-                setorigin(it, it.origin);
-                tracebox(it.origin + '0 0 128', it.mins, it.maxs, it.origin - '0 0 10000', MOVE_NORMAL, it);
-                setorigin(it, trace_endpos + '0 0 4');
-                it.pos1 = it.origin;
-                it.pos2 = it.angles;
-            }
-            it.movetype = MOVETYPE_WALK;
-            it.idle_aim = '0 0 0';
-            it.turret_firecheckfunc = walker_firecheck;
+    if(self.origin != self.oldorigin)
+        self.SendFlags |= TNSF_MOVE;
 
-            if (it.target != "")
-            {
-                e = find(world, targetname, it.target);
-                if (!e)
-                {
-                    LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!\n");
-                    it.target = "";
-                }
+    self.oldorigin = self.origin;
+    turrets_setframe(self.animflag, false);
+}
+METHOD(WalkerTurret, tr_death, void(WalkerTurret this, entity it))
+{
+#ifdef WALKER_FANCYPATHING
+    if (it.pathcurrent)
+        pathlib_deletepath(it.pathcurrent.owner);
+#endif
+    it.pathcurrent = NULL;
+}
+METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
+{
+    it.ticrate = 0.05;
 
-                if (e.classname != "turret_checkpoint")
-                    LOG_TRACE("Warning: not a turrret path\n");
-                else
-                {
+    entity e;
+
+    // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
+    if(it.movetype == MOVETYPE_WALK)
+    {
+        if(it.pos1)
+            setorigin(it, it.pos1);
+        if(it.pos2)
+            it.angles = it.pos2;
+    }
+
+    it.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
+    it.aim_flags = TFL_AIM_LEAD;
+    it.turret_flags |= TUR_FLAG_HITSCAN;
+
+    it.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.iscreature = true;
+    it.teleportable = TELEPORT_NORMAL;
+    it.damagedbycontents = true;
+    it.solid = SOLID_SLIDEBOX;
+    it.takedamage = DAMAGE_AIM;
+    if(it.movetype != MOVETYPE_WALK)
+    {
+        setorigin(it, it.origin);
+        tracebox(it.origin + '0 0 128', it.mins, it.maxs, it.origin - '0 0 10000', MOVE_NORMAL, it);
+        setorigin(it, trace_endpos + '0 0 4');
+        it.pos1 = it.origin;
+        it.pos2 = it.angles;
+    }
+    it.movetype = MOVETYPE_WALK;
+    it.idle_aim = '0 0 0';
+    it.turret_firecheckfunc = walker_firecheck;
+
+    if (it.target != "")
+    {
+        e = find(world, targetname, it.target);
+        if (!e)
+        {
+            LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!\n");
+            it.target = "";
+        }
+
+        if (e.classname != "turret_checkpoint")
+            LOG_TRACE("Warning: not a turrret path\n");
+        else
+        {
 #ifdef WALKER_FANCYPATHING
-                    it.pathcurrent = WALKER_PATH(it.origin, e.origin);
-                    it.pathgoal = e;
+            it.pathcurrent = WALKER_PATH(it.origin, e.origin);
+            it.pathgoal = e;
 #else
-                    it.pathcurrent = e;
+            it.pathcurrent = e;
 #endif
-                }
-            }
         }
+    }
+}
 
 #endif // SVQC
 #ifdef CSQC
index c20e6df6c5885c2a840bb5babd300228a708fbd8..2a6d28e8e295672169956599e0e386fe0b8e916a 100644 (file)
@@ -159,8 +159,6 @@ string getcurrentmod();
 #ifndef MENUQC
 #ifdef CSQC
 int ReadInt24_t();
-vector ReadInt48_t();
-vector ReadInt72_t();
 #else
 void WriteInt24_t(float dest, float val);
 void WriteInt48_t(float dest, vector val);
index f65bb0cd554a728c046ae181cc5f85abaab58ed0..323e485dc5ee737dac65d12062cf5252dcf7a7df 100644 (file)
@@ -178,7 +178,7 @@ float bumblebee_gunner_frame()
                                                  _out * -1,  _in,  autocvar_g_vehicle_bumblebee_cannon_turnspeed);
 
        if(!forbidWeaponUse(gunner))
-       if(gunner.BUTTON_ATCK)
+       if(PHYS_INPUT_BUTTON_ATCK(gunner))
                if(time > gun.attack_finished_single[0])
                        if(gun.vehicle_energy >= autocvar_g_vehicle_bumblebee_cannon_cost)
                        {
@@ -202,7 +202,7 @@ float bumblebee_gunner_frame()
                UpdateAuxiliaryXhair(vehic.owner, trace_endpos, ('1 0 0' * gunner.vehicle_reload1) + ('0 1 0' *(1 - gunner.vehicle_reload1)), ((gunner == vehic.gunner1) ? 1 : 2));
 
        vehic.solid = SOLID_BBOX;
-       gunner.BUTTON_ATCK = gunner.BUTTON_ATCK2 = gunner.BUTTON_CROUCH = 0;
+       PHYS_INPUT_BUTTON_ATCK(gunner) = PHYS_INPUT_BUTTON_ATCK2(gunner) = PHYS_INPUT_BUTTON_CROUCH(gunner) = false;
        gunner.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
 
        setself(gunner);
@@ -436,7 +436,7 @@ float bumblebee_pilot_frame()
        if(IS_DEAD(vehic))
        {
                setself(pilot);
-               pilot.BUTTON_ATCK = pilot.BUTTON_ATCK2 = 0;
+               PHYS_INPUT_BUTTON_ATCK(pilot) = PHYS_INPUT_BUTTON_ATCK2(pilot) = false;
                return 1;
        }
 
@@ -504,9 +504,9 @@ float bumblebee_pilot_frame()
                        vehic.angles_z = 0;
        }
 
-       if(pilot.BUTTON_CROUCH)
+       if(PHYS_INPUT_BUTTON_CROUCH(pilot))
                newvel -=   v_up * autocvar_g_vehicle_bumblebee_speed_down;
-       else if(pilot.BUTTON_JUMP)
+       else if(PHYS_INPUT_BUTTON_JUMP(pilot))
                newvel +=  v_up * autocvar_g_vehicle_bumblebee_speed_up;
 
        vehic.velocity  += newvel * frametime;
@@ -550,7 +550,7 @@ float bumblebee_pilot_frame()
                                          autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1,  autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides,  autocvar_g_vehicle_bumblebee_raygun_turnspeed);
 
        if(!forbidWeaponUse(pilot))
-       if((pilot.BUTTON_ATCK || pilot.BUTTON_ATCK2) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime || autocvar_g_vehicle_bumblebee_raygun == 0))
+       if((PHYS_INPUT_BUTTON_ATCK(pilot) || PHYS_INPUT_BUTTON_ATCK2(pilot)) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime || autocvar_g_vehicle_bumblebee_raygun == 0))
        {
                vehic.gun3.enemy.realowner = pilot;
                vehic.gun3.enemy.effects &= ~EF_NODRAW;
@@ -633,7 +633,7 @@ float bumblebee_pilot_frame()
        vehic.angles_x *= -1;
        setorigin(pilot, vehic.origin + v_up * 48 + v_forward * 160);
 
-       pilot.BUTTON_ATCK = pilot.BUTTON_ATCK2 = pilot.BUTTON_CROUCH = 0;
+       PHYS_INPUT_BUTTON_ATCK(pilot) = PHYS_INPUT_BUTTON_ATCK2(pilot) = PHYS_INPUT_BUTTON_CROUCH(pilot) = false;
        setself(pilot);
 
        return 1;
@@ -736,222 +736,222 @@ spawnfunc(vehicle_bumblebee)
        if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
 }
 
-               METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_bumblebee_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
-               }
-               METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       self.touch = bumblebee_touch;
-                       self.nextthink = 0;
-                       self.movetype = MOVETYPE_BOUNCEMISSILE;
-               }
-               METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       self.angles_z *= 0.8;
-                       self.angles_x *= 0.8;
-
-                       self.nextthink = time;
-
-                       if(!self.owner)
-                       {
-                               entity oldself = self;
-                               if(self.gunner1)
-                               {
-                                       setself(self.gunner1);
-                                       oldself.gun1.vehicle_exit(VHEF_EJECT);
-                                       entity oldother = other;
-                                       other = self;
-                                       setself(oldself);
-                                       self.phase = 0;
-                                       self.touch();
-                                       other = oldother;
-                                       return;
-                               }
-
-                               if(self.gunner2)
-                               {
-                                       setself(self.gunner2);
-                                       oldself.gun2.vehicle_exit(VHEF_EJECT);
-                                       entity oldother = other;
-                                       other = self;
-                                       setself(oldself);
-                                       self.phase = 0;
-                                       self.touch();
-                                       other = oldother;
-                                       return;
-                               }
-                       }
-               }
-               METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
-               {
-                       entity oldself = self;
-                       setself(instance);
-
-                       CSQCModel_UnlinkEntity(self);
-
-                       // Hide beam
-                       if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
-                               self.gun3.enemy.effects |= EF_NODRAW;
-
-                       if(self.gunner1)
-                       {
-                               setself(self.gunner1);
-                               oldself.gun1.vehicle_exit(VHEF_EJECT);
-                               setself(oldself);
-                       }
-
-                       if(self.gunner2)
-                       {
-                               setself(self.gunner2);
-                               oldself.gun2.vehicle_exit(VHEF_EJECT);
-                               setself(oldself);
-                       }
-
-                       self.vehicle_exit(VHEF_EJECT);
-
-                       fixedmakevectors(self.angles);
-                       vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
-                       vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
-                       vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
-
-                       entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
-
-                       if(random() > 0.5)
-                               _body.touch = bumblebee_blowup;
-                       else
-                               _body.touch = func_null;
-
-                       _body.think = bumblebee_diethink;
-                       _body.nextthink = time;
-                       _body.wait = time + 2 + (random() * 8);
-                       _body.owner = self;
-                       _body.enemy = self.enemy;
-                       _body.scale = 1.5;
-                       _body.angles = self.angles;
-
-                       Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(self.origin, 16), '0 0 0', 1);
-
-                       self.health                     = 0;
-                       self.event_damage       = func_null;
-                       self.solid                      = SOLID_NOT;
-                       self.takedamage         = DAMAGE_NO;
-                       self.deadflag           = DEAD_DYING;
-                       self.movetype           = MOVETYPE_NONE;
-                       self.effects            = EF_NODRAW;
-                       self.colormod           = '0 0 0';
-                       self.avelocity          = '0 0 0';
-                       self.velocity           = '0 0 0';
-                       self.touch                      = func_null;
-                       self.nextthink          = 0;
-
-                       setorigin(self, self.pos1);
-
-                       setself(oldself);
-               }
-               METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       if(!self.gun1)
-                       {
-                               // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
-                               self.vehicle_shieldent = spawn();
-                               self.vehicle_shieldent.effects = EF_LOWPRECISION;
-                               setmodel(self.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
-                               setattachment(self.vehicle_shieldent, self, "");
-                               setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
-                               self.vehicle_shieldent.scale       = 512 / vlen(self.maxs - self.mins);
-                               self.vehicle_shieldent.think       = shieldhit_think;
-                               self.vehicle_shieldent.alpha = -1;
-                               self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
-
-                               self.gun1 = new(vehicle_playerslot);
-                               self.gun2 = new(vehicle_playerslot);
-                               self.gun3 = new(bumblebee_raygun);
-
-                               self.vehicle_flags |= VHF_MULTISLOT;
-
-                               self.gun1.owner = self;
-                               self.gun2.owner = self;
-                               self.gun3.owner = self;
-
-                               setmodel(self.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT);
-                               setmodel(self.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT);
-                               setmodel(self.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER);
-
-                               setattachment(self.gun1, self, "cannon_right");
-                               setattachment(self.gun2, self, "cannon_left");
-
-                               // Angled bones are no fun, messes up gun-aim; so work arround it.
-                               self.gun3.pos1 = self.angles;
-                               self.angles = '0 0 0';
-                               vector ofs = gettaginfo(self, gettagindex(self, "raygun"));
-                               ofs -= self.origin;
-                               setattachment(self.gun3, self, "");
-                               setorigin(self.gun3, ofs);
-                               self.angles = self.gun3.pos1;
-
-                               vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
-                               vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
-
-                               setorigin(self.vehicle_hudmodel, '50 0 -5');    // Move cockpit forward - down.
-                               setorigin(self.vehicle_viewport, '5 0 2');    // Move camera forward up
-
-                               //fixme-model-bones
-                               setorigin(self.gun1.vehicle_hudmodel, '90 -27 -23');
-                               setorigin(self.gun1.vehicle_viewport, '-85 0 50');
-                               //fixme-model-bones
-                               setorigin(self.gun2.vehicle_hudmodel, '90 27 -23');
-                               setorigin(self.gun2.vehicle_viewport, '-85 0 50');
-
-                               self.scale = 1.5;
-
-                               // Raygun beam
-                               if(self.gun3.enemy == world)
-                               {
-                                       self.gun3.enemy = spawn();
-                                       Net_LinkEntity(self.gun3.enemy, true, 0, bumble_raygun_send);
-                                       self.gun3.enemy.SendFlags = BRG_SETUP;
-                                       self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
-                                       self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
-                               }
-                       }
-
-                       self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
-                       self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
-                       self.solid = SOLID_BBOX;
-                       self.movetype = MOVETYPE_TOSS;
-                       self.damageforcescale = 0.025;
-
-                       self.PlayerPhysplug = bumblebee_pilot_frame;
-
-                       setorigin(self, self.origin + '0 0 25');
-               }
-               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       if(autocvar_g_vehicle_bumblebee_energy)
-                       if(autocvar_g_vehicle_bumblebee_energy_regen)
-                               self.vehicle_flags |= VHF_ENERGYREGEN;
+METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_bumblebee_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+}
+METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    self.touch = bumblebee_touch;
+    self.nextthink = 0;
+    self.movetype = MOVETYPE_BOUNCEMISSILE;
+}
+METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    self.angles_z *= 0.8;
+    self.angles_x *= 0.8;
+
+    self.nextthink = time;
+
+    if(!self.owner)
+    {
+        entity oldself = self;
+        if(self.gunner1)
+        {
+            setself(self.gunner1);
+            oldself.gun1.vehicle_exit(VHEF_EJECT);
+            entity oldother = other;
+            other = self;
+            setself(oldself);
+            self.phase = 0;
+            self.touch();
+            other = oldother;
+            return;
+        }
+
+        if(self.gunner2)
+        {
+            setself(self.gunner2);
+            oldself.gun2.vehicle_exit(VHEF_EJECT);
+            entity oldother = other;
+            other = self;
+            setself(oldself);
+            self.phase = 0;
+            self.touch();
+            other = oldother;
+            return;
+        }
+    }
+}
+METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
+{
+    entity oldself = self;
+    setself(instance);
+
+    CSQCModel_UnlinkEntity(self);
+
+    // Hide beam
+    if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
+        self.gun3.enemy.effects |= EF_NODRAW;
+
+    if(self.gunner1)
+    {
+        setself(self.gunner1);
+        oldself.gun1.vehicle_exit(VHEF_EJECT);
+        setself(oldself);
+    }
+
+    if(self.gunner2)
+    {
+        setself(self.gunner2);
+        oldself.gun2.vehicle_exit(VHEF_EJECT);
+        setself(oldself);
+    }
+
+    self.vehicle_exit(VHEF_EJECT);
+
+    fixedmakevectors(self.angles);
+    vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+
+    entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+
+    if(random() > 0.5)
+        _body.touch = bumblebee_blowup;
+    else
+        _body.touch = func_null;
+
+    _body.think = bumblebee_diethink;
+    _body.nextthink = time;
+    _body.wait = time + 2 + (random() * 8);
+    _body.owner = self;
+    _body.enemy = self.enemy;
+    _body.scale = 1.5;
+    _body.angles = self.angles;
+
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(self.origin, 16), '0 0 0', 1);
+
+    self.health                        = 0;
+    self.event_damage  = func_null;
+    self.solid                 = SOLID_NOT;
+    self.takedamage            = DAMAGE_NO;
+    self.deadflag              = DEAD_DYING;
+    self.movetype              = MOVETYPE_NONE;
+    self.effects               = EF_NODRAW;
+    self.colormod              = '0 0 0';
+    self.avelocity             = '0 0 0';
+    self.velocity              = '0 0 0';
+    self.touch                         = func_null;
+    self.nextthink             = 0;
+
+    setorigin(self, self.pos1);
+
+    setself(oldself);
+}
+METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    if(!self.gun1)
+    {
+        // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
+        self.vehicle_shieldent = spawn();
+        self.vehicle_shieldent.effects = EF_LOWPRECISION;
+        setmodel(self.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
+        setattachment(self.vehicle_shieldent, self, "");
+        setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
+        self.vehicle_shieldent.scale       = 512 / vlen(self.maxs - self.mins);
+        self.vehicle_shieldent.think       = shieldhit_think;
+        self.vehicle_shieldent.alpha = -1;
+        self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
+
+        self.gun1 = new(vehicle_playerslot);
+        self.gun2 = new(vehicle_playerslot);
+        self.gun3 = new(bumblebee_raygun);
+
+        self.vehicle_flags |= VHF_MULTISLOT;
+
+        self.gun1.owner = self;
+        self.gun2.owner = self;
+        self.gun3.owner = self;
+
+        setmodel(self.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT);
+        setmodel(self.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT);
+        setmodel(self.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER);
+
+        setattachment(self.gun1, self, "cannon_right");
+        setattachment(self.gun2, self, "cannon_left");
+
+        // Angled bones are no fun, messes up gun-aim; so work arround it.
+        self.gun3.pos1 = self.angles;
+        self.angles = '0 0 0';
+        vector ofs = gettaginfo(self, gettagindex(self, "raygun"));
+        ofs -= self.origin;
+        setattachment(self.gun3, self, "");
+        setorigin(self.gun3, ofs);
+        self.angles = self.gun3.pos1;
+
+        vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+        vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+
+        setorigin(self.vehicle_hudmodel, '50 0 -5');    // Move cockpit forward - down.
+        setorigin(self.vehicle_viewport, '5 0 2');    // Move camera forward up
+
+        //fixme-model-bones
+        setorigin(self.gun1.vehicle_hudmodel, '90 -27 -23');
+        setorigin(self.gun1.vehicle_viewport, '-85 0 50');
+        //fixme-model-bones
+        setorigin(self.gun2.vehicle_hudmodel, '90 27 -23');
+        setorigin(self.gun2.vehicle_viewport, '-85 0 50');
+
+        self.scale = 1.5;
+
+        // Raygun beam
+        if(self.gun3.enemy == world)
+        {
+            self.gun3.enemy = spawn();
+            Net_LinkEntity(self.gun3.enemy, true, 0, bumble_raygun_send);
+            self.gun3.enemy.SendFlags = BRG_SETUP;
+            self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
+            self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
+        }
+    }
+
+    self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+    self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+    self.solid = SOLID_BBOX;
+    self.movetype = MOVETYPE_TOSS;
+    self.damageforcescale = 0.025;
+
+    self.PlayerPhysplug = bumblebee_pilot_frame;
+
+    setorigin(self, self.origin + '0 0 25');
+}
+METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    if(autocvar_g_vehicle_bumblebee_energy)
+    if(autocvar_g_vehicle_bumblebee_energy_regen)
+        self.vehicle_flags |= VHF_ENERGYREGEN;
 
-                       if(autocvar_g_vehicle_bumblebee_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
+    if(autocvar_g_vehicle_bumblebee_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
 
-                       if(autocvar_g_vehicle_bumblebee_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
+    if(autocvar_g_vehicle_bumblebee_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
 
-                       if(autocvar_g_vehicle_bumblebee_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
+    if(autocvar_g_vehicle_bumblebee_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
 
-                       self.vehicle_exit = bumblebee_exit;
-                       self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
-                       self.max_health = self.vehicle_health;
-                       self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
-               }
+    self.vehicle_exit = bumblebee_exit;
+    self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+    self.max_health = self.vehicle_health;
+    self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+}
 
 #endif // SVQC
 #ifdef CSQC
@@ -963,40 +963,40 @@ void CSQC_BUMBLE_GUN_HUD()
                                         string_null, '0 0 0');
 }
 
-               METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh))
-               {
-                       Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
-
-                       float hudAlpha = autocvar_hud_panel_fg_alpha;
-                       float blinkValue = 0.55 + sin(time * 7) * 0.45;
-                       vector tmpPos  = '0 0 0';
-                       vector tmpSize = '1 1 1' * hud_fontsize;
-                       tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768);
-
-                       if(!AuxiliaryXhair[1].draw2d)
-                       {
-                               tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (96/256) - tmpSize.y;
-                               drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
-                       }
-
-                       if(!AuxiliaryXhair[2].draw2d)
-                       {
-                               tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (160/256);
-                               drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
-                       }
-               }
-               METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh))
-               {
-                       Vehicles_drawCrosshair(vCROSS_HEAL);
-               }
-               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
-               {
-                       AuxiliaryXhair[0].axh_image = vCROSS_LOCK;  // Raygun-locked
-                       AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1
-                       AuxiliaryXhair[2].axh_image = vCROSS_BURST; // Gunner2
-               }
+METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh))
+{
+    Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
+
+    float hudAlpha = autocvar_hud_panel_fg_alpha;
+    float blinkValue = 0.55 + sin(time * 7) * 0.45;
+    vector tmpPos  = '0 0 0';
+    vector tmpSize = '1 1 1' * hud_fontsize;
+    tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768);
+
+    if(!AuxiliaryXhair[1].draw2d)
+    {
+        tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (96/256) - tmpSize.y;
+        drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+    }
+
+    if(!AuxiliaryXhair[2].draw2d)
+    {
+        tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (160/256);
+        drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+    }
+}
+METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh))
+{
+    Vehicles_drawCrosshair(vCROSS_HEAL);
+}
+METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
+{
+    AuxiliaryXhair[0].axh_image = vCROSS_LOCK;  // Raygun-locked
+    AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1
+    AuxiliaryXhair[2].axh_image = vCROSS_BURST; // Gunner2
+}
 
 #endif
 #endif
index 7e9632d9644b02e1bfcec143cec79218c7f6ecd6..b9a1a71744b4ac487dc68e0cd4bf80de8f79620d 100644 (file)
@@ -127,7 +127,7 @@ void racer_align4point(entity this, float _delta)
        {
                uforce = autocvar_g_vehicle_racer_water_upforcedamper;
 
-               if(this.owner.BUTTON_CROUCH && time < this.air_finished)
+               if(PHYS_INPUT_BUTTON_CROUCH(this.owner) && time < this.air_finished)
                        this.velocity_z += 30;
                else
                        this.velocity_z += 200;
@@ -187,13 +187,13 @@ float racer_frame()
        if(IS_DEAD(racer))
        {
                setself(player);
-               player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
+               PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
                return 1;
        }
 
        racer_align4point(self, PHYS_INPUT_TIMELENGTH);
 
-       player.BUTTON_ZOOM = player.BUTTON_CROUCH = 0;
+       PHYS_INPUT_BUTTON_ZOOM(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
 
        crosshair_trace(player);
 
@@ -311,7 +311,7 @@ float racer_frame()
 #ifdef SVQC
        Weapon wep1 = WEP_RACER;
        if (!forbidWeaponUse(player))
-       if (player.BUTTON_ATCK)
+       if (PHYS_INPUT_BUTTON_ATCK(player))
        if (wep1.wr_checkammo1(wep1))
        {
                string tagname = (racer.cnt)
@@ -346,7 +346,7 @@ float racer_frame()
 
        if(!forbidWeaponUse(player))
        if(time > racer.delay)
-       if(player.BUTTON_ATCK2)
+       if(PHYS_INPUT_BUTTON_ATCK2(player))
        {
                racer.misc_bulletcounter += 1;
                racer.delay = time + 0.3;
@@ -388,7 +388,7 @@ float racer_frame()
        if(racer.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(player, shield, racer);
 
-       player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
+       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
 #endif
 
        setorigin(player,racer.origin + '0 0 32');
@@ -560,140 +560,140 @@ void racer_draw()
 #endif
 #endif
 
-               METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       if(autocvar_g_vehicle_racer_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
-               #endif
-               }
+METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    if(autocvar_g_vehicle_racer_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+#endif
+}
 
-               METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       self.movetype = MOVETYPE_BOUNCE;
-                       self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
-                       self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
+METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    self.movetype = MOVETYPE_BOUNCE;
+    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
+    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
 
-                       if(self.owner.flagcarried)
-                          setorigin(self.owner.flagcarried, '-190 0 96');
-               #elif defined(CSQC)
+    if(self.owner.flagcarried)
+       setorigin(self.owner.flagcarried, '-190 0 96');
+#elif defined(CSQC)
 
-                       self.move_movetype = MOVETYPE_BOUNCE;
-               #endif
-               }
+    self.move_movetype = MOVETYPE_BOUNCE;
+#endif
+}
 
-               METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       if(self.scale != 0.5)
-                       {
-                               if(autocvar_g_vehicle_racer_hovertype != 0)
-                                       racer_force_from_tag = vehicles_force_fromtag_maglev;
-                               else
-                                       racer_force_from_tag = vehicles_force_fromtag_hover;
-
-                               // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
-                               self.scale = 0.5;
-                               setattachment(self.vehicle_hudmodel, self, "");
-                               setattachment(self.vehicle_viewport, self, "tag_viewport");
-
-                               self.mass                          = 900;
-                       }
-
-                       self.think                = racer_think;
-                       self.nextthink    = time;
-                       self.vehicle_health = autocvar_g_vehicle_racer_health;
-                       self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-
-                       self.movetype     = MOVETYPE_TOSS;
-                       self.solid                = SOLID_SLIDEBOX;
-                       self.delay                = time;
-                       self.scale                = 0.5;
-
-                       self.PlayerPhysplug = racer_frame;
-
-                       self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
-                       self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
-                       self.damageforcescale = 0.5;
-                       self.vehicle_health = autocvar_g_vehicle_racer_health;
-                       self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-               #endif
-               }
+METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    if(self.scale != 0.5)
+    {
+        if(autocvar_g_vehicle_racer_hovertype != 0)
+            racer_force_from_tag = vehicles_force_fromtag_maglev;
+        else
+            racer_force_from_tag = vehicles_force_fromtag_hover;
+
+        // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
+        self.scale = 0.5;
+        setattachment(self.vehicle_hudmodel, self, "");
+        setattachment(self.vehicle_viewport, self, "tag_viewport");
+
+        self.mass                         = 900;
+    }
+
+    self.think           = racer_think;
+    self.nextthink       = time;
+    self.vehicle_health = autocvar_g_vehicle_racer_health;
+    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
+
+    self.movetype        = MOVETYPE_TOSS;
+    self.solid           = SOLID_SLIDEBOX;
+    self.delay           = time;
+    self.scale           = 0.5;
+
+    self.PlayerPhysplug = racer_frame;
+
+    self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
+    self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
+    self.damageforcescale = 0.5;
+    self.vehicle_health = autocvar_g_vehicle_racer_health;
+    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
+#endif
+}
 
-               METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       instance.SendEntity             = func_null; // stop networking this racer (for now)
-                       instance.health                 = 0;
-                       instance.event_damage   = func_null;
-                       instance.solid                  = SOLID_CORPSE;
-                       instance.takedamage             = DAMAGE_NO;
-                       instance.deadflag               = DEAD_DYING;
-                       instance.movetype               = MOVETYPE_BOUNCE;
-                       instance.wait                   = time;
-                       instance.delay                  = 2 + time + random() * 3;
-                       instance.cnt                    = 1 + random() * 2;
-                       instance.touch                  = racer_deadtouch;
-
-                       Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
-
-                       if(random() < 0.5)
-                               instance.avelocity_z = 32;
-                       else
-                               instance.avelocity_z = -32;
-
-                       instance.avelocity_x = -vlen(instance.velocity) * 0.2;
-                       instance.velocity += '0 0 700';
-                       instance.colormod = '-0.5 -0.5 -0.5';
-
-                       instance.think = racer_blowup_think;
-                       instance.nextthink = time;
-               #endif
-               }
+METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    instance.SendEntity                = func_null; // stop networking this racer (for now)
+    instance.health                    = 0;
+    instance.event_damage      = func_null;
+    instance.solid                     = SOLID_CORPSE;
+    instance.takedamage                = DAMAGE_NO;
+    instance.deadflag          = DEAD_DYING;
+    instance.movetype          = MOVETYPE_BOUNCE;
+    instance.wait                      = time;
+    instance.delay                     = 2 + time + random() * 3;
+    instance.cnt                       = 1 + random() * 2;
+    instance.touch                     = racer_deadtouch;
+
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
+
+    if(random() < 0.5)
+        instance.avelocity_z = 32;
+    else
+        instance.avelocity_z = -32;
+
+    instance.avelocity_x = -vlen(instance.velocity) * 0.2;
+    instance.velocity += '0 0 700';
+    instance.colormod = '-0.5 -0.5 -0.5';
+
+    instance.think = racer_blowup_think;
+    instance.nextthink = time;
+#endif
+}
 
 #ifdef CSQC
-               METHOD(Racer, vr_hud, void(Racer thisveh))
-               {
-                       Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
-               }
-               METHOD(Racer, vr_crosshair, void(Racer thisveh))
-               {
-                       Vehicles_drawCrosshair(vCROSS_GUIDE);
-               }
+METHOD(Racer, vr_hud, void(Racer thisveh))
+{
+    Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+}
+METHOD(Racer, vr_crosshair, void(Racer thisveh))
+{
+    Vehicles_drawCrosshair(vCROSS_GUIDE);
+}
 #endif
-               METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       self.vehicle_exit = racer_exit;
-               #endif
-
-               #ifdef SVQC
-                       // we have no need to network energy
-                       if(autocvar_g_vehicle_racer_energy)
-                       if(autocvar_g_vehicle_racer_energy_regen)
-                               self.vehicle_flags |= VHF_ENERGYREGEN;
-
-                       if(autocvar_g_vehicle_racer_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
-
-                       if(autocvar_g_vehicle_racer_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
-
-                       if(autocvar_g_vehicle_racer_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
-
-                       self.respawntime = autocvar_g_vehicle_racer_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_racer_health;
-                       self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-                       self.max_health = self.vehicle_health;
-               #endif
-
-               #ifdef CSQC
-                       AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Rocket
-               #endif
-               }
+METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    self.vehicle_exit = racer_exit;
+#endif
+
+#ifdef SVQC
+    // we have no need to network energy
+    if(autocvar_g_vehicle_racer_energy)
+    if(autocvar_g_vehicle_racer_energy_regen)
+        self.vehicle_flags |= VHF_ENERGYREGEN;
+
+    if(autocvar_g_vehicle_racer_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
+
+    if(autocvar_g_vehicle_racer_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
+
+    if(autocvar_g_vehicle_racer_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
+
+    self.respawntime = autocvar_g_vehicle_racer_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_racer_health;
+    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
+    self.max_health = self.vehicle_health;
+#endif
+
+#ifdef CSQC
+    AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Rocket
+#endif
+}
 
 #endif
index 67c67d9483cb490025519d44c6bb7c3fefdfabb9..8f8f3cf72f70ea4ccad7b1a799e0ac034505f749 100644 (file)
@@ -204,7 +204,7 @@ float raptor_frame()
        if(IS_DEAD(raptor))
        {
                setself(player);
-               player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
+               PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
                return 1;
        }
        crosshair_trace(player);
@@ -213,10 +213,10 @@ float raptor_frame()
        //{
                if(raptor.angles_z > 50 || raptor.angles_z < -50)
                {
-                       if(player.BUTTON_JUMP)
+                       if(PHYS_INPUT_BUTTON_JUMP(player))
                        {
-                               player.BUTTON_CROUCH = true;
-                               player.BUTTON_JUMP = false;
+                               PHYS_INPUT_BUTTON_CROUCH(player) = true;
+                               PHYS_INPUT_BUTTON_JUMP(player) = false;
                        }
                }
        //}
@@ -279,9 +279,9 @@ float raptor_frame()
                        raptor.angles_z = 0;
        }
 
-       if(player.BUTTON_CROUCH)
+       if(PHYS_INPUT_BUTTON_CROUCH(player))
                df -=   v_up * autocvar_g_vehicle_raptor_speed_down;
-       else if (player.BUTTON_JUMP)
+       else if (PHYS_INPUT_BUTTON_JUMP(player))
                df +=  v_up * autocvar_g_vehicle_raptor_speed_up;
 
        raptor.velocity  += df * frametime;
@@ -392,7 +392,7 @@ float raptor_frame()
 
        Weapon wep1 = WEP_RAPTOR;
        if(!forbidWeaponUse(player))
-       if(player.BUTTON_ATCK)
+       if(PHYS_INPUT_BUTTON_ATCK(player))
        if (wep1.wr_checkammo1(wep1))
        {
            .entity weaponentity = weaponentities[0];
@@ -413,7 +413,7 @@ float raptor_frame()
        if(raptor.vehicle_weapon2mode == RSM_BOMB)
        {
                if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire)
-               if(player.BUTTON_ATCK2)
+               if(PHYS_INPUT_BUTTON_ATCK2(player))
                {
                    .entity weaponentity = weaponentities[1];
                        wep2a.wr_think(wep2a, self, weaponentity, 2);
@@ -425,7 +425,7 @@ float raptor_frame()
        {
                Weapon wep2b = WEP_RAPTOR_FLARE;
                if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire)
-               if(player.BUTTON_ATCK2)
+               if(PHYS_INPUT_BUTTON_ATCK2(player))
                {
                    .entity weaponentity = weaponentities[1];
                        wep2b.wr_think(wep2b, self, weaponentity, 2);
@@ -464,7 +464,7 @@ float raptor_frame()
        if(self.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(player, shield, raptor);
 
-       player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
+       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
 
        setself(player);
        return 1;
@@ -495,7 +495,7 @@ float raptor_takeoff()
                raptor.velocity_z = min(raptor.velocity_z * 1.5, 256);
                self.bomb1.gun1.avelocity_y = 90 + ((raptor.frame / 25) * 25000);
                self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
-               player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
+               PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
 
                setorigin(player, raptor.origin + '0 0 32');
        }
@@ -521,7 +521,7 @@ float raptor_takeoff()
        if(self.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(player, shield, raptor);
 
-       player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
+       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
        setself(player);
        return 1;
 }
@@ -617,243 +617,243 @@ spawnfunc(vehicle_raptor)
        if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
 }
 
-               METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_raptor_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
-               }
-               METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
-               {
-                       self.vehicle_weapon2mode = RSM_BOMB;
-                       self.owner.PlayerPhysplug = raptor_takeoff;
-                       self.movetype      = MOVETYPE_BOUNCEMISSILE;
-                       self.solid                = SOLID_SLIDEBOX;
-                       self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
-                       self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
-                       self.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
-                       self.tur_head.exteriormodeltoclient = self.owner;
-
-                       self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
-                       self.lip   = time;
-
-                       if(self.owner.flagcarried)
-                          setorigin(self.owner.flagcarried, '-20 0 96');
-
-                       CSQCVehicleSetup(self.owner, 0);
-               }
-               METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
-               {
-                       instance.health                         = 0;
-                       instance.event_damage           = func_null;
-                       instance.solid                          = SOLID_CORPSE;
-                       instance.takedamage                     = DAMAGE_NO;
-                       instance.deadflag                       = DEAD_DYING;
-                       instance.movetype                       = MOVETYPE_BOUNCE;
-                       instance.think                          = raptor_diethink;
-                       instance.nextthink                      = time;
-                       instance.wait                           = time + 5 + (random() * 5);
-
-                       Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
-
-                       instance.velocity_z += 600;
-
-                       instance.avelocity = '0 0.5 1' * (random() * 400);
-                       instance.avelocity -= '0 0.5 1' * (random() * 400);
-
-                       instance.colormod = '-0.5 -0.5 -0.5';
-                       instance.touch = raptor_blowup;
-               }
-               METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
-               {
-                       if(!self.gun1)
-                       {
-                               entity spinner;
-                               vector ofs;
-
-                               //FIXME: Camera is in a bad place in HUD model.
-                               //setorigin(self.vehicle_viewport, '25 0 5');
-
-                               self.vehicles_impulse   = raptor_impulse;
-
-                               self.frame = 0;
-
-                               self.bomb1 = new(raptor_bomb);
-                               self.bomb2 = new(raptor_bomb);
-                               self.gun1  = new(raptor_gun);
-                               self.gun2  = new(raptor_gun);
-
-                               setmodel(self.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
-                               setmodel(self.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
-                               setmodel(self.gun1, MDL_VEH_RAPTOR_GUN);
-                               setmodel(self.gun2, MDL_VEH_RAPTOR_GUN);
-                               setmodel(self.tur_head, MDL_VEH_RAPTOR_TAIL);
-
-                               setattachment(self.bomb1, self, "bombmount_left");
-                               setattachment(self.bomb2, self, "bombmount_right");
-                               setattachment(self.tur_head, self,"root");
-
-                               // FIXMODEL Guns mounts to angled bones
-                               self.bomb1.angles = self.angles;
-                               self.angles = '0 0 0';
-                               // This messes up gun-aim, so work arround it.
-                               //setattachment(self.gun1, self, "gunmount_left");
-                               ofs = gettaginfo(self, gettagindex(self, "gunmount_left"));
-                               ofs -= self.origin;
-                               setattachment(self.gun1, self, "");
-                               setorigin(self.gun1, ofs);
-
-                               //setattachment(self.gun2, self, "gunmount_right");
-                               ofs = gettaginfo(self, gettagindex(self, "gunmount_right"));
-                               ofs -= self.origin;
-                               setattachment(self.gun2, self, "");
-                               setorigin(self.gun2, ofs);
-
-                               self.angles = self.bomb1.angles;
-                               self.bomb1.angles = '0 0 0';
-
-                               spinner = new(raptor_spinner);
-                               spinner.owner = self;
-                               setmodel(spinner, MDL_VEH_RAPTOR_PROP);
-                               setattachment(spinner, self, "engine_left");
-                               spinner.movetype = MOVETYPE_NOCLIP;
-                               spinner.avelocity = '0 90 0';
-                               self.bomb1.gun1 = spinner;
-
-                               spinner = new(raptor_spinner);
-                               spinner.owner = self;
-                               setmodel(spinner, MDL_VEH_RAPTOR_PROP);
-                               setattachment(spinner, self, "engine_right");
-                               spinner.movetype = MOVETYPE_NOCLIP;
-                               spinner.avelocity = '0 -90 0';
-                               self.bomb1.gun2 = spinner;
-
-                               // Sigh.
-                               self.bomb1.think = raptor_rotor_anglefix;
-                               self.bomb1.nextthink = time;
-
-                               self.mass                          = 1 ;
-                       }
-
-                       self.frame                = 0;
-                       self.vehicle_health = autocvar_g_vehicle_raptor_health;
-                       self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-                       self.movetype      = MOVETYPE_TOSS;
-                       self.solid                = SOLID_SLIDEBOX;
-                       self.vehicle_energy = 1;
+METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_raptor_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+}
+METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
+{
+    self.vehicle_weapon2mode = RSM_BOMB;
+    self.owner.PlayerPhysplug = raptor_takeoff;
+    self.movetype         = MOVETYPE_BOUNCEMISSILE;
+    self.solid           = SOLID_SLIDEBOX;
+    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
+    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
+    self.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
+    self.tur_head.exteriormodeltoclient = self.owner;
+
+    self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
+    self.lip   = time;
+
+    if(self.owner.flagcarried)
+       setorigin(self.owner.flagcarried, '-20 0 96');
+
+    CSQCVehicleSetup(self.owner, 0);
+}
+METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
+{
+    instance.health                            = 0;
+    instance.event_damage              = func_null;
+    instance.solid                             = SOLID_CORPSE;
+    instance.takedamage                        = DAMAGE_NO;
+    instance.deadflag                  = DEAD_DYING;
+    instance.movetype                  = MOVETYPE_BOUNCE;
+    instance.think                             = raptor_diethink;
+    instance.nextthink                 = time;
+    instance.wait                              = time + 5 + (random() * 5);
 
-                       self.PlayerPhysplug = raptor_frame;
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
 
-                       self.bomb1.gun1.avelocity_y = 90;
-                       self.bomb1.gun2.avelocity_y = -90;
+    instance.velocity_z += 600;
 
-                       self.delay = time;
+    instance.avelocity = '0 0.5 1' * (random() * 400);
+    instance.avelocity -= '0 0.5 1' * (random() * 400);
 
-                       self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
-                       self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
-                       self.damageforcescale = 0.25;
-                       self.vehicle_health = autocvar_g_vehicle_raptor_health;
-                       self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-               }
-               METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_raptor_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
+    instance.colormod = '-0.5 -0.5 -0.5';
+    instance.touch = raptor_blowup;
+}
+METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
+{
+    if(!self.gun1)
+    {
+        entity spinner;
+        vector ofs;
+
+        //FIXME: Camera is in a bad place in HUD model.
+        //setorigin(self.vehicle_viewport, '25 0 5');
+
+        self.vehicles_impulse   = raptor_impulse;
+
+        self.frame = 0;
+
+        self.bomb1 = new(raptor_bomb);
+        self.bomb2 = new(raptor_bomb);
+        self.gun1  = new(raptor_gun);
+        self.gun2  = new(raptor_gun);
+
+        setmodel(self.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
+        setmodel(self.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
+        setmodel(self.gun1, MDL_VEH_RAPTOR_GUN);
+        setmodel(self.gun2, MDL_VEH_RAPTOR_GUN);
+        setmodel(self.tur_head, MDL_VEH_RAPTOR_TAIL);
+
+        setattachment(self.bomb1, self, "bombmount_left");
+        setattachment(self.bomb2, self, "bombmount_right");
+        setattachment(self.tur_head, self,"root");
+
+        // FIXMODEL Guns mounts to angled bones
+        self.bomb1.angles = self.angles;
+        self.angles = '0 0 0';
+        // This messes up gun-aim, so work arround it.
+        //setattachment(self.gun1, self, "gunmount_left");
+        ofs = gettaginfo(self, gettagindex(self, "gunmount_left"));
+        ofs -= self.origin;
+        setattachment(self.gun1, self, "");
+        setorigin(self.gun1, ofs);
+
+        //setattachment(self.gun2, self, "gunmount_right");
+        ofs = gettaginfo(self, gettagindex(self, "gunmount_right"));
+        ofs -= self.origin;
+        setattachment(self.gun2, self, "");
+        setorigin(self.gun2, ofs);
+
+        self.angles = self.bomb1.angles;
+        self.bomb1.angles = '0 0 0';
+
+        spinner = new(raptor_spinner);
+        spinner.owner = self;
+        setmodel(spinner, MDL_VEH_RAPTOR_PROP);
+        setattachment(spinner, self, "engine_left");
+        spinner.movetype = MOVETYPE_NOCLIP;
+        spinner.avelocity = '0 90 0';
+        self.bomb1.gun1 = spinner;
+
+        spinner = new(raptor_spinner);
+        spinner.owner = self;
+        setmodel(spinner, MDL_VEH_RAPTOR_PROP);
+        setattachment(spinner, self, "engine_right");
+        spinner.movetype = MOVETYPE_NOCLIP;
+        spinner.avelocity = '0 -90 0';
+        self.bomb1.gun2 = spinner;
+
+        // Sigh.
+        self.bomb1.think = raptor_rotor_anglefix;
+        self.bomb1.nextthink = time;
+
+        self.mass                         = 1 ;
+    }
+
+    self.frame           = 0;
+    self.vehicle_health = autocvar_g_vehicle_raptor_health;
+    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+    self.movetype         = MOVETYPE_TOSS;
+    self.solid           = SOLID_SLIDEBOX;
+    self.vehicle_energy = 1;
+
+    self.PlayerPhysplug = raptor_frame;
+
+    self.bomb1.gun1.avelocity_y = 90;
+    self.bomb1.gun2.avelocity_y = -90;
+
+    self.delay = time;
+
+    self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
+    self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
+    self.damageforcescale = 0.25;
+    self.vehicle_health = autocvar_g_vehicle_raptor_health;
+    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+}
+METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_raptor_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
 
-                       if(autocvar_g_vehicle_raptor_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
+    if(autocvar_g_vehicle_raptor_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
 
-                       if(autocvar_g_vehicle_raptor_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
+    if(autocvar_g_vehicle_raptor_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
 
-                       if(autocvar_g_vehicle_raptor_energy_regen)
-                               self.vehicle_flags |= VHF_ENERGYREGEN;
+    if(autocvar_g_vehicle_raptor_energy_regen)
+        self.vehicle_flags |= VHF_ENERGYREGEN;
 
-                       self.vehicle_exit = raptor_exit;
-                       self.respawntime = autocvar_g_vehicle_raptor_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_raptor_health;
-                       self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-                       self.max_health = self.vehicle_health;
-               }
+    self.vehicle_exit = raptor_exit;
+    self.respawntime = autocvar_g_vehicle_raptor_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_raptor_health;
+    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+    self.max_health = self.vehicle_health;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Raptor, vr_hud, void(Raptor thisveh))
-               {
-                       Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
-               }
-               METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
-               {
-                       string crosshair;
-
-                       switch(weapon2mode)
-                       {
-                               case RSM_FLARE: crosshair = vCROSS_RAIN;  break;
-                               case RSM_BOMB:  crosshair = vCROSS_BURST; break;
-                               default:        crosshair = vCROSS_BURST;
-                       }
-
-                       vector tmpSize = '0 0 0';
-                       if(weapon2mode != RSM_FLARE)
-                       {
-                               vector where;
-
-                               if(!dropmark)
-                               {
-                                       dropmark = spawn();
-                                       dropmark.owner = self;
-                                       dropmark.gravity = 1;
-                               }
-
-                               float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
-                               if(reload2 == 1)
-                               {
-                                       setorigin(dropmark, pmove_org);
-                                       dropmark.velocity = pmove_vel;
-                                       tracetoss(dropmark, self);
-
-                                       where = project_3d_to_2d(trace_endpos);
-
-                                       setorigin(dropmark, trace_endpos);
-                                       tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
-
-                                       if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
-                                       {
-                                               where.x -= tmpSize.x * 0.5;
-                                               where.y -= tmpSize.y * 0.5;
-                                               where.z = 0;
-                                               drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
-                                               drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
-                                       }
-                                       dropmark.cnt = time + 5;
-                               }
-                               else
-                               {
-                                       if(dropmark.cnt > time)
-                                       {
-                                               where = project_3d_to_2d(dropmark.origin);
-                                               tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
-
-                                               if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
-                                               {
-                                                       where.x -= tmpSize.x * 0.5;
-                                                       where.y -= tmpSize.y * 0.5;
-                                                       where.z = 0;
-                                                       drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
-                                                       drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
-                                               }
-                                       }
-                               }
-                       }
-
-                       Vehicles_drawCrosshair(crosshair);
-               }
-               METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
-               {
-                       AuxiliaryXhair[1].axh_image = vCROSS_LOCK;
-               }
+METHOD(Raptor, vr_hud, void(Raptor thisveh))
+{
+    Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+}
+METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
+{
+    string crosshair;
+
+    switch(weapon2mode)
+    {
+        case RSM_FLARE: crosshair = vCROSS_RAIN;  break;
+        case RSM_BOMB:  crosshair = vCROSS_BURST; break;
+        default:        crosshair = vCROSS_BURST;
+    }
+
+    vector tmpSize = '0 0 0';
+    if(weapon2mode != RSM_FLARE)
+    {
+        vector where;
+
+        if(!dropmark)
+        {
+            dropmark = spawn();
+            dropmark.owner = self;
+            dropmark.gravity = 1;
+        }
+
+        float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
+        if(reload2 == 1)
+        {
+            setorigin(dropmark, pmove_org);
+            dropmark.velocity = pmove_vel;
+            tracetoss(dropmark, self);
+
+            where = project_3d_to_2d(trace_endpos);
+
+            setorigin(dropmark, trace_endpos);
+            tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
+
+            if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+            {
+                where.x -= tmpSize.x * 0.5;
+                where.y -= tmpSize.y * 0.5;
+                where.z = 0;
+                drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+                drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+            }
+            dropmark.cnt = time + 5;
+        }
+        else
+        {
+            if(dropmark.cnt > time)
+            {
+                where = project_3d_to_2d(dropmark.origin);
+                tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
+
+                if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+                {
+                    where.x -= tmpSize.x * 0.5;
+                    where.y -= tmpSize.y * 0.5;
+                    where.z = 0;
+                    drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+                    drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+                }
+            }
+        }
+    }
+
+    Vehicles_drawCrosshair(crosshair);
+}
+METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
+{
+    AuxiliaryXhair[1].axh_image = vCROSS_LOCK;
+}
 
 #endif
 #endif
index 5bb26070d564e5d7d2523964339e85608b736641..589f6ff9e83635b160f535a8f86056654220e352 100644 (file)
@@ -89,8 +89,8 @@ float spiderbot_frame()
 
        setself(spider);
 
-       player.BUTTON_ZOOM        = 0;
-       player.BUTTON_CROUCH    = 0;
+       PHYS_INPUT_BUTTON_ZOOM(player) = false;
+       PHYS_INPUT_BUTTON_CROUCH(player) = false;
        PS(player).m_switchweapon = WEP_Null;
        player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
 
@@ -149,10 +149,10 @@ float spiderbot_frame()
                        spider.frame = 5;
                }
 
-               if(!player.BUTTON_JUMP)
-                       spider.BUTTON_JUMP = 0;
+               if (!PHYS_INPUT_BUTTON_JUMP(player))
+                       PHYS_INPUT_BUTTON_JUMP(spider) = false;
 
-               if((IS_ONGROUND(spider)) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time)
+               if((IS_ONGROUND(spider)) && PHYS_INPUT_BUTTON_JUMP(player) && !PHYS_INPUT_BUTTON_JUMP(spider) && self.tur_head.wait < time)
                {
                        sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
                        //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
@@ -160,8 +160,8 @@ float spiderbot_frame()
 
                        self.tur_head.wait = time + 2;
                        spider.jump_delay = time + 2;
-                       spider.BUTTON_JUMP = 1; // set spider's jump
-                       //player.BUTTON_JUMP = 0;
+                       PHYS_INPUT_BUTTON_JUMP(spider) = true; // set spider's jump
+                       //PHYS_INPUT_BUTTON_JUMP(player) = false;
 
                        vector movefix = '0 0 0';
                        if(player.movement_x > 0) movefix_x = 1;
@@ -224,7 +224,7 @@ float spiderbot_frame()
                                        }
                                        player.movement_y = 0;
                                        float oldvelz = spider.velocity_z;
-                                       movelib_move_simple(self, normalize(v_forward * player.movement_x),((player.BUTTON_JUMP) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       movelib_move_simple(self, normalize(v_forward * player.movement_x),((PHYS_INPUT_BUTTON_JUMP(player)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
                                        spider.velocity_z = oldvelz;
                                        float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
                                        if(spider.velocity_z <= 20) // not while jumping
@@ -276,7 +276,7 @@ float spiderbot_frame()
        self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
 
        if(!forbidWeaponUse(player))
-       if(player.BUTTON_ATCK)
+       if(PHYS_INPUT_BUTTON_ATCK(player))
        {
                spider.cnt = time;
                if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single[0] <= time)
@@ -328,7 +328,7 @@ float spiderbot_frame()
        if(self.vehicle_flags  & VHF_HEALTHREGEN)
                vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
 
-       player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
+       PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
        //player.vehicle_ammo2 = spider.tur_head.frame;
        player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
 
@@ -554,127 +554,127 @@ spawnfunc(vehicle_spiderbot)
        if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
 }
 
-               METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_spiderbot_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
-               }
-               METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
-               {
-                       self.vehicle_weapon2mode = SBRM_GUIDE;
-                       self.movetype = MOVETYPE_WALK;
-                       CSQCVehicleSetup(self.owner, 0);
-                       self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
-                       self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
-
-                       if(self.owner.flagcarried)
-                       {
-                               setattachment(self.owner.flagcarried, self.tur_head, "");
-                               setorigin(self.owner.flagcarried, '-20 0 120');
-                       }
-               }
-               METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
-               {
-                       if(IS_ONGROUND(self))
-                               movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
-               }
-               METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
-               {
-                       instance.health                         = 0;
-                       instance.event_damage           = func_null;
-                       instance.takedamage                     = DAMAGE_NO;
-                       instance.touch                          = func_null;
-                       instance.cnt                            = 3.4 + time + random() * 2;
-                       instance.think                          = spiderbot_blowup;
-                       instance.nextthink                      = time;
-                       instance.deadflag                       = DEAD_DYING;
-                       instance.frame                          = 5;
-                       instance.tur_head.effects  |= EF_FLAME;
-                       instance.colormod                       = instance.tur_head.colormod = '-1 -1 -1';
-                       instance.frame                          = 10;
-                       instance.movetype                       = MOVETYPE_TOSS;
-
-                       CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
-               }
-               METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
-               {
-                       if(!self.gun1)
-                       {
-                               self.vehicles_impulse = spiderbot_impulse;
-                               self.gun1 = spawn();
-                               self.gun2 = spawn();
-                               setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
-                               setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
-                               setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
-                               setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
-                               self.gravity = 2;
-                               self.mass = 5000;
-                       }
-
-                       self.frame = 5;
-                       self.tur_head.frame = 1;
-                       self.movetype = MOVETYPE_WALK;
-                       self.solid = SOLID_SLIDEBOX;
-                       self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
-                       self.tur_head.angles = '0 0 0';
-                       self.vehicle_exit = spiderbot_exit;
-
-                       setorigin(self, self.pos1 + '0 0 128');
-                       self.angles = self.pos2;
-                       self.damageforcescale = 0.03;
-                       self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
-                       self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-
-                       self.PlayerPhysplug = spiderbot_frame;
-               }
-               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_spiderbot_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
+METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_spiderbot_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+}
+METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
+{
+    self.vehicle_weapon2mode = SBRM_GUIDE;
+    self.movetype = MOVETYPE_WALK;
+    CSQCVehicleSetup(self.owner, 0);
+    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
+    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
+
+    if(self.owner.flagcarried)
+    {
+        setattachment(self.owner.flagcarried, self.tur_head, "");
+        setorigin(self.owner.flagcarried, '-20 0 120');
+    }
+}
+METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
+{
+    if(IS_ONGROUND(self))
+        movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
+}
+METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
+{
+    instance.health                            = 0;
+    instance.event_damage              = func_null;
+    instance.takedamage                        = DAMAGE_NO;
+    instance.touch                             = func_null;
+    instance.cnt                               = 3.4 + time + random() * 2;
+    instance.think                             = spiderbot_blowup;
+    instance.nextthink                 = time;
+    instance.deadflag                  = DEAD_DYING;
+    instance.frame                             = 5;
+    instance.tur_head.effects  |= EF_FLAME;
+    instance.colormod                  = instance.tur_head.colormod = '-1 -1 -1';
+    instance.frame                             = 10;
+    instance.movetype                  = MOVETYPE_TOSS;
+
+    CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
+}
+METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
+{
+    if(!self.gun1)
+    {
+        self.vehicles_impulse = spiderbot_impulse;
+        self.gun1 = spawn();
+        self.gun2 = spawn();
+        setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
+        setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
+        setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
+        setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
+        self.gravity = 2;
+        self.mass = 5000;
+    }
+
+    self.frame = 5;
+    self.tur_head.frame = 1;
+    self.movetype = MOVETYPE_WALK;
+    self.solid = SOLID_SLIDEBOX;
+    self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
+    self.tur_head.angles = '0 0 0';
+    self.vehicle_exit = spiderbot_exit;
+
+    setorigin(self, self.pos1 + '0 0 128');
+    self.angles = self.pos2;
+    self.damageforcescale = 0.03;
+    self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+    self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+
+    self.PlayerPhysplug = spiderbot_frame;
+}
+METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_spiderbot_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
 
-                       if(autocvar_g_vehicle_spiderbot_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
+    if(autocvar_g_vehicle_spiderbot_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
 
-                       if(autocvar_g_vehicle_spiderbot_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
+    if(autocvar_g_vehicle_spiderbot_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
 
-                       self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
-                       self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-                       self.max_health = self.vehicle_health;
-                       self.pushable = true; // spiderbot can use jumppads
-               }
+    self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+    self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+    self.max_health = self.vehicle_health;
+    self.pushable = true; // spiderbot can use jumppads
+}
 
 #endif // SVQC
 #ifdef CSQC
 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
 
-               METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
-               {
-                       Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
-               }
-               METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
-               {
-                       string crosshair;
+METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
+{
+    Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+}
+METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
+{
+    string crosshair;
 
-                       switch(weapon2mode)
-                       {
-                               case SBRM_VOLLY:     crosshair = vCROSS_BURST; break;
-                               case SBRM_GUIDE:     crosshair = vCROSS_GUIDE; break;
-                               case SBRM_ARTILLERY: crosshair = vCROSS_RAIN;  break;
-                               default:             crosshair = vCROSS_BURST;
-                       }
+    switch(weapon2mode)
+    {
+        case SBRM_VOLLY:     crosshair = vCROSS_BURST; break;
+        case SBRM_GUIDE:     crosshair = vCROSS_GUIDE; break;
+        case SBRM_ARTILLERY: crosshair = vCROSS_RAIN;  break;
+        default:             crosshair = vCROSS_BURST;
+    }
 
-                       Vehicles_drawCrosshair(crosshair);
-               }
-               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
-               {
-                       AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
-                       AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2
-               }
+    Vehicles_drawCrosshair(crosshair);
+}
+METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
+{
+    AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
+    AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2
+}
 
 #endif
 #endif
index 257eac801a5c409f854fa7092e5c100fd8b8817f..9dfc72c13e30929ef30746212079fe674183874f 100644 (file)
@@ -174,7 +174,7 @@ void spiderbot_rocket_do()
 
     if (self.wait != -10)
     {
-        if (self.owner.BUTTON_ATCK2 && self.vehicle_weapon2mode == SBRM_GUIDE)
+        if (PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.vehicle_weapon2mode == SBRM_GUIDE)
         {
             if (self.wait == 1)
             if (self.tur_head.frame == 9 || self.tur_head.frame == 1)
@@ -205,7 +205,7 @@ void spiderbot_rocket_do()
     }
 
     if(self.wait != -10)
-    if(!self.owner.BUTTON_ATCK2)
+    if(!PHYS_INPUT_BUTTON_ATCK2(self.owner))
         return;
 
     if(forbidWeaponUse(self.owner))
@@ -226,7 +226,7 @@ void spiderbot_rocket_do()
             rocket.nextthink  = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
             rocket.think        = vehicles_projectile_explode;
 
-            if(self.owner.BUTTON_ATCK2 && self.tur_head.frame == 1)
+            if(PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.tur_head.frame == 1)
                 self.wait = -10;
             break;
         case SBRM_GUIDE:
index f67bbc88796122b20d5d9c0bcf40a2ef10647cde..fb510f8564ba50a59f63edaced5b89ed7a157197 100644 (file)
@@ -45,9 +45,9 @@ void viewloc_PlayerPhysics(entity this)
 
                //if(!PHYS_INPUT_BUTTON_CROUCH(this) && !IS_DUCKED(this))
 #ifdef SVQC
-                       //this.BUTTON_CROUCH = (old_movement_x < 0);
+                       //PHYS_INPUT_BUTTON_CROUCH(this) = (old_movement_x < 0);
                        if (old_movement.x < 0)
-                               this.BUTTON_CROUCH = true;
+                               PHYS_INPUT_BUTTON_CROUCH(this) = true;
 #elif defined(CSQC)
                        if (old_movement.x < 0)
                        {
index 903f6e76cf169e4560366e80f51c0760d09ad42e..6ac3e9274d9b88df0648c2474b551d1a8f5e165d 100644 (file)
@@ -312,7 +312,7 @@ void W_Arc_Beam_Think()
 
 
        float burst = 0;
-       if( (self.owner.BUTTON_ATCK2 && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
+       if( (PHYS_INPUT_BUTTON_ATCK2(self.owner) && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
        {
                if(!self.beam_bursting)
                        self.beam_bursting = true;
@@ -330,7 +330,7 @@ void W_Arc_Beam_Think()
                ||
                gameover
                ||
-               (!self.owner.BUTTON_ATCK && !burst )
+               (!PHYS_INPUT_BUTTON_ATCK(self.owner) && !burst )
                ||
                STAT(FROZEN, self.owner)
                ||
@@ -700,7 +700,7 @@ void Arc_Smoke()
        {
                if ( random() < self.arc_heat_percent )
                        Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
-               if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
+               if ( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) )
                {
                        Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
                        if ( !self.arc_smoke_sound )
@@ -719,166 +719,166 @@ void Arc_Smoke()
        }
 
        if (  self.arc_smoke_sound && ( self.arc_overheat <= time ||
-               !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || PS(self).m_switchweapon != WEP_ARC )
+               !( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) ) ) || PS(self).m_switchweapon != WEP_ARC )
        {
                self.arc_smoke_sound = 0;
                sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
        }
 }
 
-               METHOD(Arc, wr_aim, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       if(WEP_CVAR(arc, beam_botaimspeed))
-                       {
-                               self.BUTTON_ATCK = bot_aim(
-                                       WEP_CVAR(arc, beam_botaimspeed),
-                                       0,
-                                       WEP_CVAR(arc, beam_botaimlifetime),
-                                       false
-                               );
-                       }
-                       else
-                       {
-                               self.BUTTON_ATCK = bot_aim(
-                                       1000000,
-                                       0,
-                                       0.001,
-                                       false
-                               );
-                       }
-               }
-               METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       Arc_Player_SetHeat(actor);
-                       Arc_Smoke();
-
-                       bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
-
-                       if (time >= actor.arc_overheat)
-                       if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
-                       {
-
-                               if(actor.arc_BUTTON_ATCK_prev)
-                               {
-                                       #if 0
-                                       if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
-                                               weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
-                                       else
-                                       #endif
-                                               weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
-                               }
-
-                               if((!actor.arc_beam) || wasfreed(actor.arc_beam))
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
-                                       {
-                                               W_Arc_Beam(boolean(beam_fire2));
-
-                                               if(!actor.arc_BUTTON_ATCK_prev)
-                                               {
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
-                                                       actor.arc_BUTTON_ATCK_prev = true;
-                                               }
-                                       }
-                               }
-
-                               return;
-                       }
-                       else if(fire & 2)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
-                               {
-                                       W_Arc_Attack_Bolt(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
-                               }
-                       }
-
-                       if(actor.arc_BUTTON_ATCK_prev)
-                       {
-                               sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
-                               int slot = weaponslot(weaponentity);
-                               ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
-                       }
-                       actor.arc_BUTTON_ATCK_prev = false;
-
-                       #if 0
-                       if(fire & 2)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
-                       {
-                               W_Arc_Attack2();
-                               actor.arc_count = autocvar_g_balance_arc_secondary_count;
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
-                               actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
-                       }
-                       #endif
-               }
-               METHOD(Arc, wr_init, void(entity thiswep))
-               {
-                       if(!arc_shotorigin[0])
-                       {
-                               arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
-                               arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
-                               arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
-                               arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
-                       }
-               }
-               METHOD(Arc, wr_checkammo1, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
-               }
-               METHOD(Arc, wr_checkammo2, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       if(WEP_CVAR(arc, bolt))
-                       {
-                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
-                               ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
-                               return ammo_amount;
-                       }
-                       else
-                               return WEP_CVAR(arc, overheat_max) > 0 &&
-                                       ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
-               }
-               METHOD(Arc, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_ARC_MURDER_SPRAY;
-                       else
-                               return WEAPON_ARC_MURDER;
-               }
-               METHOD(Arc, wr_drop, void(entity thiswep))
-               {
-                       weapon_dropevent_item.arc_overheat = self.arc_overheat;
-                       weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
-                       self.arc_overheat = 0;
-                       self.arc_cooldown = 0;
-               }
-               METHOD(Arc, wr_pickup, void(entity thiswep))
-               {
-                       if ( !client_hasweapon(self, thiswep, false, false) &&
-                               weapon_dropevent_item.arc_overheat > time )
-                       {
-                               self.arc_overheat = weapon_dropevent_item.arc_overheat;
-                               self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
-                       }
-               }
+METHOD(Arc, wr_aim, void(entity thiswep))
+{
+    SELFPARAM();
+    if(WEP_CVAR(arc, beam_botaimspeed))
+    {
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+            WEP_CVAR(arc, beam_botaimspeed),
+            0,
+            WEP_CVAR(arc, beam_botaimlifetime),
+            false
+        );
+    }
+    else
+    {
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+            1000000,
+            0,
+            0.001,
+            false
+        );
+    }
+}
+METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    Arc_Player_SetHeat(actor);
+    Arc_Smoke();
+
+    bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
+
+    if (time >= actor.arc_overheat)
+    if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
+    {
+
+        if(actor.arc_BUTTON_ATCK_prev)
+        {
+            #if 0
+            if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
+                weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
+            else
+            #endif
+                weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
+        }
+
+        if((!actor.arc_beam) || wasfreed(actor.arc_beam))
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
+            {
+                W_Arc_Beam(boolean(beam_fire2));
+
+                if(!actor.arc_BUTTON_ATCK_prev)
+                {
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+                    actor.arc_BUTTON_ATCK_prev = true;
+                }
+            }
+        }
+
+        return;
+    }
+    else if(fire & 2)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
+        {
+            W_Arc_Attack_Bolt(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+        }
+    }
+
+    if(actor.arc_BUTTON_ATCK_prev)
+    {
+        sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+        int slot = weaponslot(weaponentity);
+        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+    }
+    actor.arc_BUTTON_ATCK_prev = false;
+
+    #if 0
+    if(fire & 2)
+    if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
+    {
+        W_Arc_Attack2();
+        actor.arc_count = autocvar_g_balance_arc_secondary_count;
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
+        actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+    }
+    #endif
+}
+METHOD(Arc, wr_init, void(entity thiswep))
+{
+    if(!arc_shotorigin[0])
+    {
+        arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
+        arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
+        arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
+        arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
+    }
+}
+METHOD(Arc, wr_checkammo1, bool(entity thiswep))
+{
+    SELFPARAM();
+    return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
+}
+METHOD(Arc, wr_checkammo2, bool(entity thiswep))
+{
+    SELFPARAM();
+    if(WEP_CVAR(arc, bolt))
+    {
+        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
+        ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
+        return ammo_amount;
+    }
+    else
+        return WEP_CVAR(arc, overheat_max) > 0 &&
+            ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
+}
+METHOD(Arc, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_ARC_MURDER_SPRAY;
+    else
+        return WEAPON_ARC_MURDER;
+}
+METHOD(Arc, wr_drop, void(entity thiswep))
+{
+    weapon_dropevent_item.arc_overheat = self.arc_overheat;
+    weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
+    self.arc_overheat = 0;
+    self.arc_cooldown = 0;
+}
+METHOD(Arc, wr_pickup, void(entity thiswep))
+{
+    if ( !client_hasweapon(self, thiswep, false, false) &&
+        weapon_dropevent_item.arc_overheat > time )
+    {
+        self.arc_overheat = weapon_dropevent_item.arc_overheat;
+        self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
+    }
+}
 #endif
 #ifdef CSQC
 bool autocvar_cl_arcbeam_teamcolor = true;
 
-               METHOD(Arc, wr_impacteffect, void(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               vector org2;
-                               org2 = w_org + w_backoff * 6;
-                               pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
-                               if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
-                       }
-               }
+METHOD(Arc, wr_impacteffect, void(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        vector org2;
+        org2 = w_org + w_backoff * 6;
+        pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
+        if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+    }
+}
 
 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
 {
index f983bc4b36d850b21893b06230af78623fa2a1fc..362666d27c2bc98f48d1cb6f0d0ebb10554980df 100644 (file)
@@ -150,113 +150,113 @@ void W_Blaster_Attack(
        }
 }
 
-               METHOD(Blaster, wr_aim, void(entity thiswep))
-               {
-                       if(WEP_CVAR(blaster, secondary))
-                       {
-                               if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
-                                       { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
-                               else
-                                       { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
-                       }
-                       else
-                               { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
-               }
+METHOD(Blaster, wr_aim, void(entity thiswep))
+{
+    if(WEP_CVAR(blaster, secondary))
+    {
+        if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
+            { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
+        else
+            { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+    }
+    else
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+}
 
-               METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
-                               {
-                                       W_Blaster_Attack(
-                                               actor,
-                                               WEP_BLASTER.m_id,
-                                               WEP_CVAR_PRI(blaster, shotangle),
-                                               WEP_CVAR_PRI(blaster, damage),
-                                               WEP_CVAR_PRI(blaster, edgedamage),
-                                               WEP_CVAR_PRI(blaster, radius),
-                                               WEP_CVAR_PRI(blaster, force),
-                                               WEP_CVAR_PRI(blaster, speed),
-                                               WEP_CVAR_PRI(blaster, spread),
-                                               WEP_CVAR_PRI(blaster, delay),
-                                               WEP_CVAR_PRI(blaster, lifetime)
-                                       );
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               switch(WEP_CVAR(blaster, secondary))
-                               {
-                                       case 0: // switch to last used weapon
-                                       {
-                                               if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
-                                                       W_LastWeapon(actor);
-                                               break;
-                                       }
+METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
+        {
+            W_Blaster_Attack(
+                actor,
+                WEP_BLASTER.m_id,
+                WEP_CVAR_PRI(blaster, shotangle),
+                WEP_CVAR_PRI(blaster, damage),
+                WEP_CVAR_PRI(blaster, edgedamage),
+                WEP_CVAR_PRI(blaster, radius),
+                WEP_CVAR_PRI(blaster, force),
+                WEP_CVAR_PRI(blaster, speed),
+                WEP_CVAR_PRI(blaster, spread),
+                WEP_CVAR_PRI(blaster, delay),
+                WEP_CVAR_PRI(blaster, lifetime)
+            );
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
+        }
+    }
+    else if(fire & 2)
+    {
+        switch(WEP_CVAR(blaster, secondary))
+        {
+            case 0: // switch to last used weapon
+            {
+                if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
+                    W_LastWeapon(actor);
+                break;
+            }
 
-                                       case 1: // normal projectile secondary
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
-                                               {
-                                                       W_Blaster_Attack(
-                                                               actor,
-                                                               WEP_BLASTER.m_id | HITTYPE_SECONDARY,
-                                                               WEP_CVAR_SEC(blaster, shotangle),
-                                                               WEP_CVAR_SEC(blaster, damage),
-                                                               WEP_CVAR_SEC(blaster, edgedamage),
-                                                               WEP_CVAR_SEC(blaster, radius),
-                                                               WEP_CVAR_SEC(blaster, force),
-                                                               WEP_CVAR_SEC(blaster, speed),
-                                                               WEP_CVAR_SEC(blaster, spread),
-                                                               WEP_CVAR_SEC(blaster, delay),
-                                                               WEP_CVAR_SEC(blaster, lifetime)
-                                                       );
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
-                                               }
+            case 1: // normal projectile secondary
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
+                {
+                    W_Blaster_Attack(
+                        actor,
+                        WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+                        WEP_CVAR_SEC(blaster, shotangle),
+                        WEP_CVAR_SEC(blaster, damage),
+                        WEP_CVAR_SEC(blaster, edgedamage),
+                        WEP_CVAR_SEC(blaster, radius),
+                        WEP_CVAR_SEC(blaster, force),
+                        WEP_CVAR_SEC(blaster, speed),
+                        WEP_CVAR_SEC(blaster, spread),
+                        WEP_CVAR_SEC(blaster, delay),
+                        WEP_CVAR_SEC(blaster, lifetime)
+                    );
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
+                }
 
-                                               break;
-                                       }
-                               }
-                       }
-               }
+                break;
+            }
+        }
+    }
+}
 
-               METHOD(Blaster, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-               }
+METHOD(Blaster, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = ammo_none;
+}
 
-               METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
+METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
+{
+    return true; // infinite ammo
+}
 
-               METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
-               {
-                       return true; // blaster has infinite ammo
-               }
+METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
+{
+    return true; // blaster has infinite ammo
+}
 
-               METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_BLASTER_SUICIDE;
-               }
+METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_BLASTER_SUICIDE;
+}
 
-               METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_BLASTER_MURDER;
-               }
+METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_BLASTER_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Blaster, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
-               }
+METHOD(Blaster, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+}
 
 #endif
 #endif
index c93e34a7f16a5a99c37bb2defba1dc2d6a482fc6..6ad5f957ad70e5e81ab527df505e8e1fc74dc04c 100644 (file)
@@ -567,123 +567,123 @@ void W_Crylink_Attack2(Weapon thiswep)
        }
 }
 
-               METHOD(Crylink, wr_aim, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       if(random() < 0.10)
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
-                       else
-                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
-               }
-               METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       }
-
-                       if(fire & 1)
-                       {
-                               if(actor.crylink_waitrelease != 1)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
-                               {
-                                       W_Crylink_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
-                               }
-                       }
-
-                       if((fire & 2) && autocvar_g_balance_crylink_secondary)
-                       {
-                               if(actor.crylink_waitrelease != 2)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
-                               {
-                                       W_Crylink_Attack2(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
-                               }
-                       }
-
-                       if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
-                       {
-                               if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
-                               {
-                                       // fired and released now!
-                                       if(actor.crylink_lastgroup)
-                                       {
-                                               vector pos;
-                                               entity linkjoineffect;
-                                               float isprimary = (actor.crylink_waitrelease == 1);
-
-                                               pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
-
-                                               linkjoineffect = new(linkjoineffect);
-                                               linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
-                                               linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
-                                               linkjoineffect.owner = actor;
-                                               setorigin(linkjoineffect, pos);
-                                       }
-                                       actor.crylink_waitrelease = 0;
-                                       if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
-                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                       {
-                                               // ran out of ammo!
-                                               actor.cnt = WEP_CRYLINK.m_id;
-                                               PS(actor).m_switchweapon = w_getbestweapon(actor);
-                                       }
-                               }
-                       }
-               }
-               METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       // don't "run out of ammo" and switch weapons while waiting for release
-                       if(self.crylink_lastgroup && self.crylink_waitrelease)
-                               return true;
-
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
-                       ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       // don't "run out of ammo" and switch weapons while waiting for release
-                       if(self.crylink_lastgroup && self.crylink_waitrelease)
-                               return true;
-
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
-                       ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
-               }
-               METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_CRYLINK_SUICIDE;
-               }
-               METHOD(Crylink, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_CRYLINK_MURDER;
-               }
+METHOD(Crylink, wr_aim, void(entity thiswep))
+{
+    SELFPARAM();
+    if(random() < 0.10)
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
+}
+METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    }
+
+    if(fire & 1)
+    {
+        if(actor.crylink_waitrelease != 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
+        {
+            W_Crylink_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
+        }
+    }
+
+    if((fire & 2) && autocvar_g_balance_crylink_secondary)
+    {
+        if(actor.crylink_waitrelease != 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
+        {
+            W_Crylink_Attack2(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
+        }
+    }
+
+    if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
+    {
+        if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
+        {
+            // fired and released now!
+            if(actor.crylink_lastgroup)
+            {
+                vector pos;
+                entity linkjoineffect;
+                float isprimary = (actor.crylink_waitrelease == 1);
+
+                pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
+
+                linkjoineffect = new(linkjoineffect);
+                linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+                linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
+                linkjoineffect.owner = actor;
+                setorigin(linkjoineffect, pos);
+            }
+            actor.crylink_waitrelease = 0;
+            if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
+            if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+            {
+                // ran out of ammo!
+                actor.cnt = WEP_CRYLINK.m_id;
+                PS(actor).m_switchweapon = w_getbestweapon(actor);
+            }
+        }
+    }
+}
+METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
+{
+    SELFPARAM();
+    // don't "run out of ammo" and switch weapons while waiting for release
+    if(self.crylink_lastgroup && self.crylink_waitrelease)
+        return true;
+
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
+    ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
+    return ammo_amount;
+}
+METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
+{
+    SELFPARAM();
+    // don't "run out of ammo" and switch weapons while waiting for release
+    if(self.crylink_lastgroup && self.crylink_waitrelease)
+        return true;
+
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
+    ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
+    return ammo_amount;
+}
+METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
+}
+METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_CRYLINK_SUICIDE;
+}
+METHOD(Crylink, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_CRYLINK_MURDER;
+}
 #endif
 #ifdef CSQC
-               METHOD(Crylink, wr_impacteffect, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM);
-                       }
-                       else
-                       {
-                               pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
-                       }
-               }
+METHOD(Crylink, wr_impacteffect, void(entity thiswep))
+{
+    SELFPARAM();
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM);
+    }
+    else
+    {
+        pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
+    }
+}
 #endif
 #endif
index 0cbaf7980c784b5f85cc8ad9eae642dad8d06767..53d4b8e946b7a057655e1a63df106336255aae4f 100644 (file)
@@ -276,7 +276,7 @@ void W_Devastator_Think()
        {
                if(self == self.realowner.lastrocket)
                if(!self.realowner.rl_release)
-               if(!self.BUTTON_ATCK2)
+               if(!PHYS_INPUT_BUTTON_ATCK2(self))
                if(WEP_CVAR(devastator, guiderate))
                if(time > self.pushltime)
                if(!IS_DEAD(self.realowner))
@@ -404,233 +404,233 @@ void W_Devastator_Attack(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-               #if 0
-               METHOD(Devastator, wr_aim, void(entity thiswep))
-               {
-                       // aim and decide to fire if appropriate
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
-                       if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
-                       {
-                               // decide whether to detonate rockets
-                               entity missile, targetlist, targ;
-                               targetlist = findchainfloat(bot_attack, true);
-                               for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
-                               {
-                                       targ = targetlist;
-                                       while(targ)
-                                       {
-                                               if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
-                                               {
-                                                       self.BUTTON_ATCK2 = true;
-                                                       break;
-                                               }
-                                               targ = targ.chain;
-                                       }
-                               }
-
-                               if(self.BUTTON_ATCK2) self.BUTTON_ATCK = false;
-                       }
-               }
-               #else
-               METHOD(Devastator, wr_aim, void(entity thiswep))
-               {
-                       // aim and decide to fire if appropriate
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
-                       if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
-                       {
-                               // decide whether to detonate rockets
-                               entity targetlist, targ;
-                               float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
-                               float selfdamage, teamdamage, enemydamage;
-                               edgedamage = WEP_CVAR(devastator, edgedamage);
-                               coredamage = WEP_CVAR(devastator, damage);
-                               edgeradius = WEP_CVAR(devastator, radius);
-                               recipricoledgeradius = 1 / edgeradius;
-                               selfdamage = 0;
-                               teamdamage = 0;
-                               enemydamage = 0;
-                               targetlist = findchainfloat(bot_attack, true);
-                               FOREACH_ENTITY_ENT(realowner, self,
-                               {
-                                       if(it.classname != "rocket") continue;
-
-                                       targ = targetlist;
-                                       while(targ)
-                                       {
-                                               d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.origin);
-                                               d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
-                                               // count potential damage according to type of target
-                                               if(targ == self)
-                                                       selfdamage = selfdamage + d;
-                                               else if(targ.team == self.team && teamplay)
-                                                       teamdamage = teamdamage + d;
-                                               else if(bot_shouldattack(targ))
-                                                       enemydamage = enemydamage + d;
-                                               targ = targ.chain;
-                                       }
-                               });
-                               float desirabledamage;
-                               desirabledamage = enemydamage;
-                               if(time > self.invincible_finished && time > self.spawnshieldtime)
-                                       desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
-                               if(teamplay && self.team)
-                                       desirabledamage = desirabledamage - teamdamage;
-
-                               FOREACH_ENTITY_ENT(realowner, self,
-                               {
-                                       if(it.classname != "rocket") continue;
-
-                                       makevectors(it.v_angle);
-                                       targ = targetlist;
-                                       if(skill > 9) // normal players only do this for the target they are tracking
-                                       {
-                                               targ = targetlist;
-                                               while(targ)
-                                               {
-                                                       if(
-                                                               (v_forward * normalize(it.origin - targ.origin)< 0.1)
-                                                               && desirabledamage > 0.1*coredamage
-                                                       )self.BUTTON_ATCK2 = true;
-                                                       targ = targ.chain;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
-                                               //As the distance gets larger, a correct detonation gets near imposible
-                                               //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
-                                               if(v_forward * normalize(it.origin - self.enemy.origin)< 0.1)
-                                                       if(IS_PLAYER(self.enemy))
-                                                               if(desirabledamage >= 0.1*coredamage)
-                                                                       if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
-                                                                               self.BUTTON_ATCK2 = true;
-                                       //      dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
-                                       }
-                               });
-                               // if we would be doing at X percent of the core damage, detonate it
-                               // but don't fire a new shot at the same time!
-                               if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
-                                       self.BUTTON_ATCK2 = true;
-                               if((skill > 6.5) && (selfdamage > self.health))
-                                       self.BUTTON_ATCK2 = false;
-                               //if(self.BUTTON_ATCK2 == true)
-                               //      dprint(ftos(desirabledamage),"\n");
-                               if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
-                       }
-               }
-               #endif
-               METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else {
-                               if(fire & 1)
-                               {
-                                       if(actor.rl_release || WEP_CVAR(devastator, guidestop))
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
-                                       {
-                                               W_Devastator_Attack(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
-                                               actor.rl_release = 0;
-                                       }
-                               }
-                               else
-                                       actor.rl_release = 1;
-
-                               if(fire & 2)
-                               if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
-                               {
-                                       entity rock;
-                                       bool rockfound = false;
-                                       for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
-                                       {
-                                               if(!rock.rl_detonate_later)
-                                               {
-                                                       rock.rl_detonate_later = true;
-                                                       rockfound = true;
-                                               }
-                                       }
-                                       if(rockfound)
-                                               sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
-                               }
-                       }
-               }
-               METHOD(Devastator, wr_setup, void(entity thiswep))
-               {
-                       self.rl_release = 1;
-               }
-               METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
-               {
-                       #if 0
-                       // don't switch while guiding a missile
-                       if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
-                       {
-                               ammo_amount = false;
-                               if(WEP_CVAR(devastator, reload_ammo))
-                               {
-                                       if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
-                                               ammo_amount = true;
-                               }
-                               else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
-                                       ammo_amount = true;
-                               return !ammo_amount;
-                       }
-                       #endif
-                       #if 0
-                       if(self.rl_release == 0)
-                       {
-                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
-                               return true;
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
-                               ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
-                               return ammo_amount;
-                       }
-                       #else
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
-                       ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-                       return ammo_amount;
-                       #endif
-               }
-               METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
-               {
-                       return false;
-               }
-               METHOD(Devastator, wr_resetplayer, void(entity thiswep))
-               {
-                       self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
-                       self.rl_release = 0;
-               }
-               METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
-               }
-               METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_DEVASTATOR_SUICIDE;
-               }
-               METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
-               {
-                       if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
-                               return WEAPON_DEVASTATOR_MURDER_SPLASH;
-                       else
-                               return WEAPON_DEVASTATOR_MURDER_DIRECT;
-               }
+#if 0
+METHOD(Devastator, wr_aim, void(entity thiswep))
+{
+    // aim and decide to fire if appropriate
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+    if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+    {
+        // decide whether to detonate rockets
+        entity missile, targetlist, targ;
+        targetlist = findchainfloat(bot_attack, true);
+        for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
+        {
+            targ = targetlist;
+            while(targ)
+            {
+                if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
+                {
+                    PHYS_INPUT_BUTTON_ATCK2(self) = true;
+                    break;
+                }
+                targ = targ.chain;
+            }
+        }
+
+        if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+    }
+}
+#else
+METHOD(Devastator, wr_aim, void(entity thiswep))
+{
+    // aim and decide to fire if appropriate
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+    if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+    {
+        // decide whether to detonate rockets
+        entity targetlist, targ;
+        float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+        float selfdamage, teamdamage, enemydamage;
+        edgedamage = WEP_CVAR(devastator, edgedamage);
+        coredamage = WEP_CVAR(devastator, damage);
+        edgeradius = WEP_CVAR(devastator, radius);
+        recipricoledgeradius = 1 / edgeradius;
+        selfdamage = 0;
+        teamdamage = 0;
+        enemydamage = 0;
+        targetlist = findchainfloat(bot_attack, true);
+        FOREACH_ENTITY_ENT(realowner, self,
+        {
+            if(it.classname != "rocket") continue;
+
+            targ = targetlist;
+            while(targ)
+            {
+                d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.origin);
+                d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
+                // count potential damage according to type of target
+                if(targ == self)
+                    selfdamage = selfdamage + d;
+                else if(targ.team == self.team && teamplay)
+                    teamdamage = teamdamage + d;
+                else if(bot_shouldattack(targ))
+                    enemydamage = enemydamage + d;
+                targ = targ.chain;
+            }
+        });
+        float desirabledamage;
+        desirabledamage = enemydamage;
+        if(time > self.invincible_finished && time > self.spawnshieldtime)
+            desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
+        if(teamplay && self.team)
+            desirabledamage = desirabledamage - teamdamage;
+
+        FOREACH_ENTITY_ENT(realowner, self,
+        {
+            if(it.classname != "rocket") continue;
+
+            makevectors(it.v_angle);
+            targ = targetlist;
+            if(skill > 9) // normal players only do this for the target they are tracking
+            {
+                targ = targetlist;
+                while(targ)
+                {
+                    if(
+                        (v_forward * normalize(it.origin - targ.origin)< 0.1)
+                        && desirabledamage > 0.1*coredamage
+                    ) PHYS_INPUT_BUTTON_ATCK2(self) = true;
+                    targ = targ.chain;
+                }
+            }
+            else
+            {
+                float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+                //As the distance gets larger, a correct detonation gets near imposible
+                //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
+                if(v_forward * normalize(it.origin - self.enemy.origin)< 0.1)
+                    if(IS_PLAYER(self.enemy))
+                        if(desirabledamage >= 0.1*coredamage)
+                            if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
+                                PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+            }
+        });
+        // if we would be doing at X percent of the core damage, detonate it
+        // but don't fire a new shot at the same time!
+        if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+        if((skill > 6.5) && (selfdamage > self.health))
+            PHYS_INPUT_BUTTON_ATCK2(self) = false;
+        //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
+        //     dprint(ftos(desirabledamage),"\n");
+        if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+    }
+}
+#endif
+METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else {
+        if(fire & 1)
+        {
+            if(actor.rl_release || WEP_CVAR(devastator, guidestop))
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
+            {
+                W_Devastator_Attack(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
+                actor.rl_release = 0;
+            }
+        }
+        else
+            actor.rl_release = 1;
+
+        if(fire & 2)
+        if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
+        {
+            entity rock;
+            bool rockfound = false;
+            for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
+            {
+                if(!rock.rl_detonate_later)
+                {
+                    rock.rl_detonate_later = true;
+                    rockfound = true;
+                }
+            }
+            if(rockfound)
+                sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+        }
+    }
+}
+METHOD(Devastator, wr_setup, void(entity thiswep))
+{
+    self.rl_release = 1;
+}
+METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
+{
+    #if 0
+    // don't switch while guiding a missile
+    if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
+    {
+        ammo_amount = false;
+        if(WEP_CVAR(devastator, reload_ammo))
+        {
+            if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+                ammo_amount = true;
+        }
+        else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
+            ammo_amount = true;
+        return !ammo_amount;
+    }
+    #endif
+    #if 0
+    if(self.rl_release == 0)
+    {
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+        return true;
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+        ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+        return ammo_amount;
+    }
+    #else
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+    ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+    return ammo_amount;
+    #endif
+}
+METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
+{
+    return false;
+}
+METHOD(Devastator, wr_resetplayer, void(entity thiswep))
+{
+    self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
+    self.rl_release = 0;
+}
+METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
+}
+METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_DEVASTATOR_SUICIDE;
+}
+METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
+{
+    if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+        return WEAPON_DEVASTATOR_MURDER_SPLASH;
+    else
+        return WEAPON_DEVASTATOR_MURDER_DIRECT;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Devastator, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(Devastator, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index dde736ba0e6b89e0982440bc03c5864d87c40716..f539b1492c56b7e4c5876de232687adc9b2fdf1f 100644 (file)
@@ -411,7 +411,7 @@ void W_Electro_Attack_Orb(Weapon thiswep)
 void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {SELFPARAM();
        if(self.electro_count > 1)
-       if(self.BUTTON_ATCK2)
+       if(PHYS_INPUT_BUTTON_ATCK2(self))
        if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1))
        {
                W_Electro_Attack_Orb(WEP_ELECTRO);
@@ -425,152 +425,152 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
 
 .float bot_secondary_electromooth;
 
-               METHOD(Electro, wr_aim, void(entity thiswep))
-               {
-                       self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
-                       if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
-                       if(self.bot_secondary_electromooth == 0)
-                       {
-                               float shoot;
-
-                               if(WEP_CVAR_PRI(electro, speed))
-                                       shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
-                               else
-                                       shoot = bot_aim(1000000, 0, 0.001, false);
-
-                               if(shoot)
-                               {
-                                       self.BUTTON_ATCK = true;
-                                       if(random() < 0.01) self.bot_secondary_electromooth = 1;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
-                               {
-                                       self.BUTTON_ATCK2 = true;
-                                       if(random() < 0.03) self.bot_secondary_electromooth = 0;
-                               }
-                       }
-               }
-               METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
-                       {
-                               float ammo_amount = 0;
-                               if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
-                                       ammo_amount = 1;
-                               if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
-                                       ammo_amount += 1;
-
-                               if(!ammo_amount)
-                               {
-                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                                       return;
-                               }
-                       }
-
-                       if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
-                               {
-                                               W_Electro_Attack_Bolt(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               if(time >= actor.electro_secondarytime)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
-                               {
-                                       W_Electro_Attack_Orb(thiswep);
-                                       actor.electro_count = WEP_CVAR_SEC(electro, count);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
-                                       actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
-                               }
-                       }
-               }
-               METHOD(Electro, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
-                       ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Electro, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
-                               ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
-                               ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(Electro, wr_resetplayer, void(entity thiswep))
-               {
-                       self.electro_secondarytime = time;
-               }
-               METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
-               }
-               METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_ELECTRO_SUICIDE_ORBS;
-                       else
-                               return WEAPON_ELECTRO_SUICIDE_BOLT;
-               }
-               METHOD(Electro, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               return WEAPON_ELECTRO_MURDER_ORBS;
-                       }
-                       else
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_ELECTRO_MURDER_COMBO;
-                               else
-                                       return WEAPON_ELECTRO_MURDER_BOLT;
-                       }
-               }
+METHOD(Electro, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
+    if(self.bot_secondary_electromooth == 0)
+    {
+        float shoot;
+
+        if(WEP_CVAR_PRI(electro, speed))
+            shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
+        else
+            shoot = bot_aim(1000000, 0, 0.001, false);
+
+        if(shoot)
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.01) self.bot_secondary_electromooth = 1;
+        }
+    }
+    else
+    {
+        if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.03) self.bot_secondary_electromooth = 0;
+        }
+    }
+}
+METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
+    {
+        float ammo_amount = 0;
+        if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
+            ammo_amount = 1;
+        if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
+            ammo_amount += 1;
+
+        if(!ammo_amount)
+        {
+            thiswep.wr_reload(thiswep, actor, weaponentity);
+            return;
+        }
+    }
+
+    if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
+        {
+                W_Electro_Attack_Bolt(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+        }
+    }
+    else if(fire & 2)
+    {
+        if(time >= actor.electro_secondarytime)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
+        {
+            W_Electro_Attack_Orb(thiswep);
+            actor.electro_count = WEP_CVAR_SEC(electro, count);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
+            actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
+        }
+    }
+}
+METHOD(Electro, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
+    ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
+    return ammo_amount;
+}
+METHOD(Electro, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
+        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
+    }
+    return ammo_amount;
+}
+METHOD(Electro, wr_resetplayer, void(entity thiswep))
+{
+    self.electro_secondarytime = time;
+}
+METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
+}
+METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_ELECTRO_SUICIDE_ORBS;
+    else
+        return WEAPON_ELECTRO_SUICIDE_BOLT;
+}
+METHOD(Electro, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        return WEAPON_ELECTRO_MURDER_ORBS;
+    }
+    else
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+            return WEAPON_ELECTRO_MURDER_COMBO;
+        else
+            return WEAPON_ELECTRO_MURDER_BOLT;
+    }
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Electro, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
-                       }
-                       else
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                               {
-                                       // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
-                                       pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
-                                       if(!w_issilent)
-                                               sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
-                               }
-                               else
-                               {
-                                       pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
-                                       if(!w_issilent)
-                                               sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
-                               }
-                       }
-               }
+METHOD(Electro, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+    }
+    else
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+        {
+            // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
+            pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
+            if(!w_issilent)
+                sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
+        }
+        else
+        {
+            pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
+            if(!w_issilent)
+                sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+        }
+    }
+}
 
 #endif
 #endif
index 62c43a52ea7fdbbdb356c1c77de7e1f95c2e11b9..8c0d928db883e5e03d4342f1237402eaf80dcb6c 100644 (file)
@@ -351,96 +351,96 @@ void W_Fireball_Attack2()
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-               METHOD(Fireball, wr_aim, void(entity thiswep))
-               {
-                       self.BUTTON_ATCK = false;
-                       self.BUTTON_ATCK2 = false;
-                       if(self.bot_primary_fireballmooth == 0)
-                       {
-                               if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
-                               {
-                                       self.BUTTON_ATCK = true;
-                                       if(random() < 0.02) self.bot_primary_fireballmooth = 0;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
-                               {
-                                       self.BUTTON_ATCK2 = true;
-                                       if(random() < 0.01) self.bot_primary_fireballmooth = 1;
-                               }
-                       }
-               }
-               METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       {
-                               if(time >= actor.fireball_primarytime)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
-                               {
-                                       W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
-                                       actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
-                               {
-                                       W_Fireball_Attack2();
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(Fireball, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-               }
-               METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
-               METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
-               {
-                       return true; // fireball has infinite ammo
-               }
-               METHOD(Fireball, wr_resetplayer, void(entity thiswep))
-               {
-                       self.fireball_primarytime = time;
-               }
-               METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_FIREBALL_SUICIDE_FIREMINE;
-                       else
-                               return WEAPON_FIREBALL_SUICIDE_BLAST;
-               }
-               METHOD(Fireball, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_FIREBALL_MURDER_FIREMINE;
-                       else
-                               return WEAPON_FIREBALL_MURDER_BLAST;
-               }
+METHOD(Fireball, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(self.bot_primary_fireballmooth == 0)
+    {
+        if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.02) self.bot_primary_fireballmooth = 0;
+        }
+    }
+    else
+    {
+        if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.01) self.bot_primary_fireballmooth = 1;
+        }
+    }
+}
+METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+    {
+        if(time >= actor.fireball_primarytime)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
+        {
+            W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
+            actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
+        }
+    }
+    else if(fire & 2)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
+        {
+            W_Fireball_Attack2();
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
+        }
+    }
+}
+METHOD(Fireball, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = ammo_none;
+}
+METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
+{
+    return true; // infinite ammo
+}
+METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
+{
+    return true; // fireball has infinite ammo
+}
+METHOD(Fireball, wr_resetplayer, void(entity thiswep))
+{
+    self.fireball_primarytime = time;
+}
+METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_FIREBALL_SUICIDE_FIREMINE;
+    else
+        return WEAPON_FIREBALL_SUICIDE_BLAST;
+}
+METHOD(Fireball, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_FIREBALL_MURDER_FIREMINE;
+    else
+        return WEAPON_FIREBALL_MURDER_BLAST;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Fireball, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               // firemine goes out silently
-                       }
-                       else
-                       {
-                               org2 = w_org + w_backoff * 16;
-                               pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom
-                       }
-               }
+METHOD(Fireball, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        // firemine goes out silently
+    }
+    else
+    {
+        org2 = w_org + w_backoff * 16;
+        pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom
+    }
+}
 
 #endif
 #endif
index 505a656ec8c9866df0b0b8e5e691b7147dc76f14..c66e4a438344f57ab1f304a5f3bfae0c150e6cd6 100644 (file)
@@ -309,9 +309,9 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
 
        bool stopped = loaded || !enough_ammo;
 
-       if(self.BUTTON_ATCK2)
+       if(PHYS_INPUT_BUTTON_ATCK2(self))
        {
-               if(self.BUTTON_ATCK && WEP_CVAR_SEC(hagar, load_abort))
+               if(PHYS_INPUT_BUTTON_ATCK(self) && WEP_CVAR_SEC(hagar, load_abort))
                {
                        if(self.hagar_load)
                        {
@@ -375,7 +375,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                }
 
                // release if player let go of button or if they've held it in too long
-               if(!self.BUTTON_ATCK2 || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
+               if(!PHYS_INPUT_BUTTON_ATCK2(self) || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
                {
                        self.(weaponentity).state = WS_READY;
                        W_Hagar_Attack2_Load_Release(weaponentity);
@@ -397,117 +397,117 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
        }
 }
 
-               METHOD(Hagar, wr_aim, void(entity thiswep))
-               {
-                       if(random()>0.15)
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
-                       else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
-                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
-               }
-               METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       float loadable_secondary;
-                       loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
-
-                       if(loadable_secondary)
-                               W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
-                       if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
-                               {
-                                       W_Hagar_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
-                               }
-                       }
-                       else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
-                               {
-                                       W_Hagar_Attack2(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
-                               }
-                       }
-               }
-               METHOD(Hagar, wr_gonethink, void(entity thiswep))
-               {
-                       // we lost the weapon and want to prepare switching away
-                       if(self.hagar_load)
-                       {
-                               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-                               self.(weaponentity).state = WS_READY;
-                               W_Hagar_Attack2_Load_Release(weaponentity);
-                       }
-               }
-               METHOD(Hagar, wr_setup, void(entity thiswep))
-               {
-                       self.hagar_loadblock = false;
+METHOD(Hagar, wr_aim, void(entity thiswep))
+{
+    if(random()>0.15)
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+    else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+}
+METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    float loadable_secondary;
+    loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
+
+    if(loadable_secondary)
+        W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
+    if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
+        {
+            W_Hagar_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
+        }
+    }
+    else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
+        {
+            W_Hagar_Attack2(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
+        }
+    }
+}
+METHOD(Hagar, wr_gonethink, void(entity thiswep))
+{
+    // we lost the weapon and want to prepare switching away
+    if(self.hagar_load)
+    {
+        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+        self.(weaponentity).state = WS_READY;
+        W_Hagar_Attack2_Load_Release(weaponentity);
+    }
+}
+METHOD(Hagar, wr_setup, void(entity thiswep))
+{
+    self.hagar_loadblock = false;
 
-                       if(self.hagar_load)
-                       {
-                               W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
-                               self.hagar_load = 0;
-                       }
-               }
-               METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Hagar, wr_resetplayer, void(entity thiswep))
-               {
-                       self.hagar_load = 0;
-               }
-               METHOD(Hagar, wr_playerdeath, void(entity thiswep))
-               {
-                       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-                       // if we have any rockets loaded when we die, release them
-                       if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
-                               W_Hagar_Attack2_Load_Release(weaponentity);
-               }
-               METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       if(!self.hagar_load) // require releasing loaded rockets first
-                               W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
-               }
-               METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_HAGAR_SUICIDE;
-               }
-               METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_HAGAR_MURDER_BURST;
-                       else
-                               return WEAPON_HAGAR_MURDER_SPRAY;
-               }
+    if(self.hagar_load)
+    {
+        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
+        self.hagar_load = 0;
+    }
+}
+METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
+    ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
+    return ammo_amount;
+}
+METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
+    ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
+    return ammo_amount;
+}
+METHOD(Hagar, wr_resetplayer, void(entity thiswep))
+{
+    self.hagar_load = 0;
+}
+METHOD(Hagar, wr_playerdeath, void(entity thiswep))
+{
+    .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+    // if we have any rockets loaded when we die, release them
+    if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
+        W_Hagar_Attack2_Load_Release(weaponentity);
+}
+METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    if(!self.hagar_load) // require releasing loaded rockets first
+        W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+}
+METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_HAGAR_SUICIDE;
+}
+METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_HAGAR_MURDER_BURST;
+    else
+        return WEAPON_HAGAR_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Hagar, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                       {
-                               if(w_random<0.15)
-                                       sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
-                               else if(w_random<0.7)
-                                       sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
-                               else
-                                       sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
-                       }
-               }
+METHOD(Hagar, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+    {
+        if(w_random<0.15)
+            sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
+        else if(w_random<0.7)
+            sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
+        else
+            sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
+    }
+}
 
 #endif
 #endif
index da772a8a2b5403e1253a1091581582b7d5c08989..901634506057566d96024b525f7e7eae0f54d8a0 100644 (file)
@@ -169,7 +169,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
                return;
        }
 
-       if(actor.BUTTON_ATCK)
+       if(PHYS_INPUT_BUTTON_ATCK(actor))
        {
                if(!thiswep.wr_checkammo1(thiswep))
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -207,69 +207,69 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
        }
 }
 
-               METHOD(HLAC, wr_aim, void(entity thiswep))
-               {
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
-               }
-               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
-                               {
-                                       actor.misc_bulletcounter = 0;
-                                       W_HLAC_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
-                               }
-                       }
-
-                       else if((fire & 2) && WEP_CVAR(hlac, secondary))
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
-                               {
-                                       W_HLAC_Attack2_Frame(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
-                       return ammo_amount;
-               }
-               METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
-                       return ammo_amount;
-               }
-               METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
-               }
-               METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_HLAC_SUICIDE;
-               }
-               METHOD(HLAC, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_HLAC_MURDER;
-               }
+METHOD(HLAC, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
+}
+METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
+        {
+            actor.misc_bulletcounter = 0;
+            W_HLAC_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+        }
+    }
+
+    else if((fire & 2) && WEP_CVAR(hlac, secondary))
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
+        {
+            W_HLAC_Attack2_Frame(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
+        }
+    }
+}
+METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
+    ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
+    return ammo_amount;
+}
+METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
+    ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
+    return ammo_amount;
+}
+METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
+}
+METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_HLAC_SUICIDE;
+}
+METHOD(HLAC, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_HLAC_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(HLAC, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(HLAC, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index a5c990627a88a518c8a8c8ddc32b1458a76823a8..5af5a9ad1f95a84b0dd7414fc4250a8e5becd2f4 100644 (file)
@@ -180,141 +180,137 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
        MUTATOR_CALLHOOK(EditProjectile, actor, gren);
 }
 
-               METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if (fire & 1) {
-                               if(!actor.hook)
-                               if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
-                               if(time > actor.hook_refire)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
-                               {
-                                       W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
-                                       actor.hook_state |= HOOK_FIRING;
-                                       actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
-                               }
-                       } else {
-                               actor.hook_state |= HOOK_REMOVING;
-                               actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
-                       }
+METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if (fire & 1) {
+        if(!actor.hook)
+        if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
+        if(time > actor.hook_refire)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
+        {
+            W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
+            actor.hook_state |= HOOK_FIRING;
+            actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
+        }
+    } else {
+        actor.hook_state |= HOOK_REMOVING;
+        actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+    }
 
-                       if(fire & 2)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
-                               {
-                                       W_Hook_Attack2(thiswep, actor);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
-                               }
-                       }
+    if(fire & 2)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
+        {
+            W_Hook_Attack2(thiswep, actor);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
+        }
+    }
 
-                       if(actor.hook)
-                       {
-                               // if hooked, no bombs, and increase the timer
-                               actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
+    if(actor.hook)
+    {
+        // if hooked, no bombs, and increase the timer
+        actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
 
-                               // hook also inhibits health regeneration, but only for 1 second
-                               if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                       actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
-                       }
+        // hook also inhibits health regeneration, but only for 1 second
+        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+            actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
+    }
 
-                       if(actor.hook && actor.hook.state == 1)
-                       {
-                               float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
-                               if(hooked_time_max > 0)
-                               {
-                                       if( time > actor.hook_time_hooked + hooked_time_max )
-                                               actor.hook_state |= HOOK_REMOVING;
-                               }
-
-                               float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
-                               if(hooked_fuel > 0)
-                               {
-                                       if( time > actor.hook_time_fueldecrease )
-                                       {
-                                               if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                               {
-                                                       if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
-                                                       {
-                                                               W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
-                                                               actor.hook_time_fueldecrease = time;
-                                                               // decrease next frame again
-                                                       }
-                                                       else
-                                                       {
-                                                               actor.ammo_fuel = 0;
-                                                               actor.hook_state |= HOOK_REMOVING;
-                                                               W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               actor.hook_time_hooked = time;
-                               actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
-                       }
+    if(actor.hook && actor.hook.state == 1)
+    {
+        float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
+        if(hooked_time_max > 0)
+        {
+            if( time > actor.hook_time_hooked + hooked_time_max )
+                actor.hook_state |= HOOK_REMOVING;
+        }
+
+        float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
+        if(hooked_fuel > 0)
+        {
+            if( time > actor.hook_time_fueldecrease )
+            {
+                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+                {
+                    if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
+                    {
+                        W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
+                        actor.hook_time_fueldecrease = time;
+                        // decrease next frame again
+                    }
+                    else
+                    {
+                        actor.ammo_fuel = 0;
+                        actor.hook_state |= HOOK_REMOVING;
+                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        actor.hook_time_hooked = time;
+        actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
+    }
 
-                       actor.hook_state = BITSET(actor.hook_state, HOOK_PULLING, (!actor.BUTTON_CROUCH || !autocvar_g_balance_grapplehook_crouchslide));
+    actor.hook_state = BITSET(actor.hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide));
 
-                       if (actor.hook_state & HOOK_FIRING)
-                       {
-                               if (actor.hook)
-                                       RemoveGrapplingHook(actor);
-                               WITH(entity, self, actor, FireGrapplingHook());
-                               actor.hook_state &= ~HOOK_FIRING;
-                               actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
-                       }
-                       else if (actor.hook_state & HOOK_REMOVING)
-                       {
-                               if (actor.hook)
-                                       RemoveGrapplingHook(actor);
-                               actor.hook_state &= ~HOOK_REMOVING;
-                       }
-               }
-               METHOD(Hook, wr_setup, void(entity thiswep))
-               {
-                       self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
-               }
-               METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
-               {
-                       if (!thiswep.ammo_factor) return true;
-                       if(self.hook)
-                               return self.ammo_fuel > 0;
-                       else
-                               return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
-               }
-               METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
-               {
-                       // infinite ammo for now
-                       return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
-               }
-               METHOD(Hook, wr_resetplayer, void(entity thiswep))
-               {
-                       RemoveGrapplingHook(self);
-                       self.hook_time = 0;
-                       self.hook_refire = time;
-               }
-               METHOD(Hook, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return NULL;
-               }
-               METHOD(Hook, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_HOOK_MURDER;
-               }
+    if (actor.hook_state & HOOK_FIRING)
+    {
+        if (actor.hook)
+            RemoveGrapplingHook(actor);
+        WITH(entity, self, actor, FireGrapplingHook());
+        actor.hook_state &= ~HOOK_FIRING;
+        actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
+    }
+    else if (actor.hook_state & HOOK_REMOVING)
+    {
+        if (actor.hook)
+            RemoveGrapplingHook(actor);
+        actor.hook_state &= ~HOOK_REMOVING;
+    }
+}
+METHOD(Hook, wr_setup, void(entity thiswep))
+{
+    self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+}
+METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
+{
+    if (!thiswep.ammo_factor) return true;
+    if(self.hook)
+        return self.ammo_fuel > 0;
+    else
+        return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
+}
+METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
+{
+    // infinite ammo for now
+    return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
+}
+METHOD(Hook, wr_resetplayer, void(entity thiswep))
+{
+    RemoveGrapplingHook(self);
+    self.hook_time = 0;
+    self.hook_refire = time;
+}
+METHOD(Hook, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_HOOK_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Hook, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(Hook, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 
index aefddc02709617f8eb2ad51a878e53751f66a3da..1b1af4df45475c0c6615c91bbcab42072c840ca5 100644 (file)
@@ -146,7 +146,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit
                w_ready(thiswep, actor, weaponentity, fire);
                return;
        }
-       if(actor.BUTTON_ATCK)
+       if(PHYS_INPUT_BUTTON_ATCK(actor))
        {
                if(!thiswep.wr_checkammo2(thiswep))
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -242,125 +242,125 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
 }
 
-               METHOD(MachineGun, wr_aim, void(entity thiswep))
-               {
-                       if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
-                       else
-                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
-               }
-               METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       if(WEP_CVAR(machinegun, mode) == 1)
-                       {
-                               if(fire & 1)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
-                               {
-                                       actor.misc_bulletcounter = 0;
-                                       W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
-                               }
-
-                               if(fire & 2)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
-                               {
-                                       if(!thiswep.wr_checkammo2(thiswep))
-                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                       {
-                                               W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                                               w_ready(thiswep, actor, weaponentity, fire);
-                                               return;
-                                       }
-
-                                       W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
-
-                                       actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
-                                       W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
-                               }
-                       }
-                       else
-                       {
-
-                               if(fire & 1)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
-                               {
-                                       actor.misc_bulletcounter = 1;
-                                       W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
-                               }
-
-                               if((fire & 2) && WEP_CVAR(machinegun, first))
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
-                               {
-                                       actor.misc_bulletcounter = 1;
-                                       W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
-                               }
-                       }
-               }
-               METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(machinegun, mode) == 1)
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
-                       else
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
-
-                       if(WEP_CVAR(machinegun, reload_ammo))
-                       {
-                               if(WEP_CVAR(machinegun, mode) == 1)
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
-                               else
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(machinegun, mode) == 1)
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
-                       else
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
-
-                       if(WEP_CVAR(machinegun, reload_ammo))
-                       {
-                               if(WEP_CVAR(machinegun, mode) == 1)
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
-                               else
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
-               }
-               METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_MACHINEGUN_MURDER_SNIPE;
-                       else
-                               return WEAPON_MACHINEGUN_MURDER_SPRAY;
-               }
+METHOD(MachineGun, wr_aim, void(entity thiswep))
+{
+    if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+}
+METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    if(WEP_CVAR(machinegun, mode) == 1)
+    {
+        if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+        {
+            actor.misc_bulletcounter = 0;
+            W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+        }
+
+        if(fire & 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+        {
+            if(!thiswep.wr_checkammo2(thiswep))
+            if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+            {
+                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+                w_ready(thiswep, actor, weaponentity, fire);
+                return;
+            }
+
+            W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
+
+            actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
+            W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
+        }
+    }
+    else
+    {
+
+        if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+        {
+            actor.misc_bulletcounter = 1;
+            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
+        }
+
+        if((fire & 2) && WEP_CVAR(machinegun, first))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+        {
+            actor.misc_bulletcounter = 1;
+            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
+        }
+    }
+}
+METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(machinegun, mode) == 1)
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
+    else
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+
+    if(WEP_CVAR(machinegun, reload_ammo))
+    {
+        if(WEP_CVAR(machinegun, mode) == 1)
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
+        else
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(machinegun, mode) == 1)
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
+    else
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+
+    if(WEP_CVAR(machinegun, reload_ammo))
+    {
+        if(WEP_CVAR(machinegun, mode) == 1)
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
+        else
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
+}
+METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_MACHINEGUN_MURDER_SNIPE;
+    else
+        return WEAPON_MACHINEGUN_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
-               }
+METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index 9c6418ffd4f3b4c7009993b0e1ab8434799d4e66..78aabc4510d111d15532563f2f25bbd3a7d4266b 100644 (file)
@@ -404,175 +404,175 @@ float W_MineLayer_PlacedMines(float detonate)
        return minfound;
 }
 
-               METHOD(MineLayer, wr_aim, void(entity thiswep))
-               {
-                       // aim and decide to fire if appropriate
-                       if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
-                               self.BUTTON_ATCK = false;
-                       else
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
-                       if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
-                       {
-                               // decide whether to detonate mines
-                               entity targetlist, targ;
-                               float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
-                               float selfdamage, teamdamage, enemydamage;
-                               edgedamage = WEP_CVAR(minelayer, edgedamage);
-                               coredamage = WEP_CVAR(minelayer, damage);
-                               edgeradius = WEP_CVAR(minelayer, radius);
-                               recipricoledgeradius = 1 / edgeradius;
-                               selfdamage = 0;
-                               teamdamage = 0;
-                               enemydamage = 0;
-                               targetlist = findchainfloat(bot_attack, true);
-                               entity mine = find(world, classname, "mine");
-                               while(mine)
-                               {
-                                       if(mine.realowner != self)
-                                       {
-                                               mine = find(mine, classname, "mine");
-                                               continue;
-                                       }
-                                       targ = targetlist;
-                                       while(targ)
-                                       {
-                                               d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
-                                               d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
-                                               // count potential damage according to type of target
-                                               if(targ == self)
-                                                       selfdamage = selfdamage + d;
-                                               else if(targ.team == self.team && teamplay)
-                                                       teamdamage = teamdamage + d;
-                                               else if(bot_shouldattack(targ))
-                                                       enemydamage = enemydamage + d;
-                                               targ = targ.chain;
-                                       }
-                                       mine = find(mine, classname, "mine");
-                               }
-                               float desirabledamage;
-                               desirabledamage = enemydamage;
-                               if(time > self.invincible_finished && time > self.spawnshieldtime)
-                                       desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
-                               if(teamplay && self.team)
-                                       desirabledamage = desirabledamage - teamdamage;
-
-                               mine = find(world, classname, "mine");
-                               while(mine)
-                               {
-                                       if(mine.realowner != self)
-                                       {
-                                               mine = find(mine, classname, "mine");
-                                               continue;
-                                       }
-                                       makevectors(mine.v_angle);
-                                       targ = targetlist;
-                                       if(skill > 9) // normal players only do this for the target they are tracking
-                                       {
-                                               targ = targetlist;
-                                               while(targ)
-                                               {
-                                                       if(
-                                                               (v_forward * normalize(mine.origin - targ.origin)< 0.1)
-                                                               && desirabledamage > 0.1*coredamage
-                                                       )self.BUTTON_ATCK2 = true;
-                                                       targ = targ.chain;
-                                               }
-                                       }else{
-                                               float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
-                                               //As the distance gets larger, a correct detonation gets near imposible
-                                               //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
-                                               if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
-                                                       if(IS_PLAYER(self.enemy))
-                                                               if(desirabledamage >= 0.1*coredamage)
-                                                                       if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
-                                                                               self.BUTTON_ATCK2 = true;
-                                       //      dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
-                                       }
-
-                                       mine = find(mine, classname, "mine");
-                               }
-                               // if we would be doing at X percent of the core damage, detonate it
-                               // but don't fire a new shot at the same time!
-                               if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
-                                       self.BUTTON_ATCK2 = true;
-                               if((skill > 6.5) && (selfdamage > self.health))
-                                       self.BUTTON_ATCK2 = false;
-                               //if(self.BUTTON_ATCK2 == true)
-                               //      dprint(ftos(desirabledamage),"\n");
-                               if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
-                       }
-               }
-               METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
-                       {
-                               // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-                               if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
-                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                               }
-                       }
-                       else if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
-                               {
-                                       W_MineLayer_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
-                               }
-                       }
-
-                       if(fire & 2)
-                       {
-                               if(W_MineLayer_PlacedMines(true))
-                                       sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
-                       }
-               }
-               METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
-               {
-                       int slot = 0; // TODO: unhardcode
-                       // don't switch while placing a mine
-                       if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
-                       {
-                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
-                               ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
-                               return ammo_amount;
-                       }
-                       return true;
-               }
-               METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(W_MineLayer_PlacedMines(false))
-                               return true;
-                       else
-                               return false;
-               }
-               METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
-               {
-                       self.minelayer_mines = 0;
-               }
-               METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
-               }
-               METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_MINELAYER_SUICIDE;
-               }
-               METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_MINELAYER_MURDER;
-               }
+METHOD(MineLayer, wr_aim, void(entity thiswep))
+{
+    // aim and decide to fire if appropriate
+    if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
+        PHYS_INPUT_BUTTON_ATCK(self) = false;
+    else
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
+    if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
+    {
+        // decide whether to detonate mines
+        entity targetlist, targ;
+        float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+        float selfdamage, teamdamage, enemydamage;
+        edgedamage = WEP_CVAR(minelayer, edgedamage);
+        coredamage = WEP_CVAR(minelayer, damage);
+        edgeradius = WEP_CVAR(minelayer, radius);
+        recipricoledgeradius = 1 / edgeradius;
+        selfdamage = 0;
+        teamdamage = 0;
+        enemydamage = 0;
+        targetlist = findchainfloat(bot_attack, true);
+        entity mine = find(world, classname, "mine");
+        while(mine)
+        {
+            if(mine.realowner != self)
+            {
+                mine = find(mine, classname, "mine");
+                continue;
+            }
+            targ = targetlist;
+            while(targ)
+            {
+                d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
+                d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
+                // count potential damage according to type of target
+                if(targ == self)
+                    selfdamage = selfdamage + d;
+                else if(targ.team == self.team && teamplay)
+                    teamdamage = teamdamage + d;
+                else if(bot_shouldattack(targ))
+                    enemydamage = enemydamage + d;
+                targ = targ.chain;
+            }
+            mine = find(mine, classname, "mine");
+        }
+        float desirabledamage;
+        desirabledamage = enemydamage;
+        if(time > self.invincible_finished && time > self.spawnshieldtime)
+            desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
+        if(teamplay && self.team)
+            desirabledamage = desirabledamage - teamdamage;
+
+        mine = find(world, classname, "mine");
+        while(mine)
+        {
+            if(mine.realowner != self)
+            {
+                mine = find(mine, classname, "mine");
+                continue;
+            }
+            makevectors(mine.v_angle);
+            targ = targetlist;
+            if(skill > 9) // normal players only do this for the target they are tracking
+            {
+                targ = targetlist;
+                while(targ)
+                {
+                    if(
+                        (v_forward * normalize(mine.origin - targ.origin)< 0.1)
+                        && desirabledamage > 0.1*coredamage
+                    ) PHYS_INPUT_BUTTON_ATCK2(self) = true;
+                    targ = targ.chain;
+                }
+            }else{
+                float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+                //As the distance gets larger, a correct detonation gets near imposible
+                //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
+                if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
+                    if(IS_PLAYER(self.enemy))
+                        if(desirabledamage >= 0.1*coredamage)
+                            if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
+                                PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+            }
+
+            mine = find(mine, classname, "mine");
+        }
+        // if we would be doing at X percent of the core damage, detonate it
+        // but don't fire a new shot at the same time!
+        if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+        if((skill > 6.5) && (selfdamage > self.health))
+            PHYS_INPUT_BUTTON_ATCK2(self) = false;
+        //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
+        //     dprint(ftos(desirabledamage),"\n");
+        if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+    }
+}
+METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
+    {
+        // not if we're holding the minelayer without enough ammo, but can detonate existing mines
+        if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
+            thiswep.wr_reload(thiswep, actor, weaponentity);
+        }
+    }
+    else if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
+        {
+            W_MineLayer_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
+        }
+    }
+
+    if(fire & 2)
+    {
+        if(W_MineLayer_PlacedMines(true))
+            sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
+    }
+}
+METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
+{
+    int slot = 0; // TODO: unhardcode
+    // don't switch while placing a mine
+    if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
+    {
+        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
+        ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
+        return ammo_amount;
+    }
+    return true;
+}
+METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
+{
+    if(W_MineLayer_PlacedMines(false))
+        return true;
+    else
+        return false;
+}
+METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
+{
+    self.minelayer_mines = 0;
+}
+METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
+}
+METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_MINELAYER_SUICIDE;
+}
+METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_MINELAYER_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
-               }
+METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index 08b79bb2687b0363658ed82e11b41d0186fe8376..639de3f4c8f83df67db12e593bbc4db40b8d2e5f 100644 (file)
@@ -298,121 +298,121 @@ void W_Mortar_Attack2(Weapon thiswep)
 
 .float bot_secondary_grenademooth;
 
-               METHOD(Mortar, wr_aim, void(entity thiswep))
-               {
-                       self.BUTTON_ATCK = false;
-                       self.BUTTON_ATCK2 = false;
-                       if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
-                       {
-                               if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
-                               {
-                                       self.BUTTON_ATCK = true;
-                                       if(random() < 0.01) self.bot_secondary_grenademooth = 1;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
-                               {
-                                       self.BUTTON_ATCK2 = true;
-                                       if(random() < 0.02) self.bot_secondary_grenademooth = 0;
-                               }
-                       }
-               }
-               /*case WR_CALCINFO:
-               {
-                       wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime));
-                       wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire));
-                       wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed)))));
-
-                       // for the range calculation, closer to 1 is better
-                       wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
-                       wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
-
-                       wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
-                       wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
-
-                       wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
-                       wepinfo_ter_dps = 0;
-                       */
-               METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
-                               {
-                                       W_Mortar_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
-                               {
-                                       bool nadefound = false;
-                                       entity nade;
-                                       for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
-                                       {
-                                               if(!nade.gl_detonate_later)
-                                               {
-                                                       nade.gl_detonate_later = true;
-                                                       nadefound = true;
-                                               }
-                                       }
-                                       if(nadefound)
-                                               sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
-                               }
-                               else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
-                               {
-                                       W_Mortar_Attack2(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
-               }
-               METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_MORTAR_SUICIDE_BOUNCE;
-                       else
-                               return WEAPON_MORTAR_SUICIDE_EXPLODE;
-               }
-               METHOD(Mortar, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_MORTAR_MURDER_BOUNCE;
-                       else
-                               return WEAPON_MORTAR_MURDER_EXPLODE;
-               }
+METHOD(Mortar, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
+    {
+        if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.01) self.bot_secondary_grenademooth = 1;
+        }
+    }
+    else
+    {
+        if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.02) self.bot_secondary_grenademooth = 0;
+        }
+    }
+}
+/*case WR_CALCINFO:
+{
+    wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime));
+    wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire));
+    wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed)))));
+
+    // for the range calculation, closer to 1 is better
+    wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
+    wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
+
+    wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
+    wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
+
+    wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
+    wepinfo_ter_dps = 0;
+    */
+METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
+        {
+            W_Mortar_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
+        }
+    }
+    else if(fire & 2)
+    {
+        if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
+        {
+            bool nadefound = false;
+            entity nade;
+            for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
+            {
+                if(!nade.gl_detonate_later)
+                {
+                    nade.gl_detonate_later = true;
+                    nadefound = true;
+                }
+            }
+            if(nadefound)
+                sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+        }
+        else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
+        {
+            W_Mortar_Attack2(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
+        }
+    }
+}
+METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
+    ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
+    return ammo_amount;
+}
+METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
+    ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
+    return ammo_amount;
+}
+METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
+}
+METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_MORTAR_SUICIDE_BOUNCE;
+    else
+        return WEAPON_MORTAR_SUICIDE_EXPLODE;
+}
+METHOD(Mortar, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_MORTAR_MURDER_BOUNCE;
+    else
+        return WEAPON_MORTAR_MURDER_EXPLODE;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Mortar, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(Mortar, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index 56b2759ec76766db8737e866111d6dd9f7597094..be4387347ab1dbde10fd6fda7c2b1510405bfa0b 100644 (file)
@@ -292,95 +292,95 @@ void W_Porto_Attack(float type)
        MUTATOR_CALLHOOK(EditProjectile, self, gren);
 }
 
-               METHOD(PortoLaunch, wr_aim, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       self.BUTTON_ATCK = false;
-                       self.BUTTON_ATCK2 = false;
-                       if(!WEP_CVAR(porto, secondary))
-                               if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
-                                       self.BUTTON_ATCK = true;
-               }
-               METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(porto, secondary))
-                       {
-                               if(fire & 1)
-                               if(!actor.porto_current)
-                               if(!actor.porto_forbidden)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
-                               {
-                                       W_Porto_Attack(0);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
-                               }
-
-                               if(fire & 2)
-                               if(!actor.porto_current)
-                               if(!actor.porto_forbidden)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
-                               {
-                                       W_Porto_Attack(1);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
-                               }
-                       }
-                       else
-                       {
-                               if(actor.porto_v_angle_held)
-                               {
-                                       if(!(fire & 2))
-                                       {
-                                               actor.porto_v_angle_held = 0;
-
-                                               ClientData_Touch(actor);
-                                       }
-                               }
-                               else
-                               {
-                                       if(fire & 2)
-                                       {
-                                               actor.porto_v_angle = actor.v_angle;
-                                               actor.porto_v_angle_held = 1;
-
-                                               ClientData_Touch(actor);
-                                       }
-                               }
-                               if(actor.porto_v_angle_held)
-                                       makevectors(actor.porto_v_angle); // override the previously set angles
-
-                               if(fire & 1)
-                               if(!actor.porto_current)
-                               if(!actor.porto_forbidden)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
-                               {
-                                       W_Porto_Attack(-1);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(PortoLaunch, wr_checkammo1, bool(entity this))
-               {
-                       // always allow infinite ammo
-                       return true;
-               }
-               METHOD(PortoLaunch, wr_checkammo2, bool(entity this))
-               {
-                       // always allow infinite ammo
-                       return true;
-               }
-               METHOD(PortoLaunch, wr_setup, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       self.ammo_field = ammo_none;
-               }
-               METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       self.porto_current = world;
-               }
+METHOD(PortoLaunch, wr_aim, void(entity thiswep))
+{
+    SELFPARAM();
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(!WEP_CVAR(porto, secondary))
+        if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+}
+METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(porto, secondary))
+    {
+        if(fire & 1)
+        if(!actor.porto_current)
+        if(!actor.porto_forbidden)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
+        {
+            W_Porto_Attack(0);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+        }
+
+        if(fire & 2)
+        if(!actor.porto_current)
+        if(!actor.porto_forbidden)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
+        {
+            W_Porto_Attack(1);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
+        }
+    }
+    else
+    {
+        if(actor.porto_v_angle_held)
+        {
+            if(!(fire & 2))
+            {
+                actor.porto_v_angle_held = 0;
+
+                ClientData_Touch(actor);
+            }
+        }
+        else
+        {
+            if(fire & 2)
+            {
+                actor.porto_v_angle = actor.v_angle;
+                actor.porto_v_angle_held = 1;
+
+                ClientData_Touch(actor);
+            }
+        }
+        if(actor.porto_v_angle_held)
+            makevectors(actor.porto_v_angle); // override the previously set angles
+
+        if(fire & 1)
+        if(!actor.porto_current)
+        if(!actor.porto_forbidden)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
+        {
+            W_Porto_Attack(-1);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+        }
+    }
+}
+METHOD(PortoLaunch, wr_checkammo1, bool(entity this))
+{
+    // always allow infinite ammo
+    return true;
+}
+METHOD(PortoLaunch, wr_checkammo2, bool(entity this))
+{
+    // always allow infinite ammo
+    return true;
+}
+METHOD(PortoLaunch, wr_setup, void(entity thiswep))
+{
+    SELFPARAM();
+    self.ammo_field = ammo_none;
+}
+METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep))
+{
+    SELFPARAM();
+    self.porto_current = world;
+}
 #endif
 #ifdef CSQC
-               METHOD(PortoLaunch, wr_impacteffect, void(entity this)) {
-                       LOG_WARNING("Since when does Porto send DamageInfo?\n");
-               }
+METHOD(PortoLaunch, wr_impacteffect, void(entity this)) {
+    LOG_WARNING("Since when does Porto send DamageInfo?\n");
+}
 #endif
 #endif
index 23f96f6300f66caa00278326f8674e1df98ce164..c0734d77dd87b235902d94a1d15901f029873390 100644 (file)
@@ -66,7 +66,7 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor
 
        Send_Effect(EFFECT_RIFLE_MUZZLEFLASH, w_shotorg, w_shotdir * 2000, 1);
 
-       if(self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) // if zoomed, shoot from the eye
+       if(PHYS_INPUT_BUTTON_ZOOM(self) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)) // if zoomed, shoot from the eye
        {
                w_shotdir = v_forward;
                w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;
@@ -138,139 +138,139 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
 
 .float bot_secondary_riflemooth;
 
-               METHOD(Rifle, wr_aim, void(entity thiswep))
-               {
-                       self.BUTTON_ATCK=false;
-                       self.BUTTON_ATCK2=false;
-                       if(vdist(self.origin - self.enemy.origin, >, 1000))
-                               self.bot_secondary_riflemooth = 0;
-                       if(self.bot_secondary_riflemooth == 0)
-                       {
-                               if(bot_aim(1000000, 0, 0.001, false))
-                               {
-                                       self.BUTTON_ATCK = true;
-                                       if(random() < 0.01) self.bot_secondary_riflemooth = 1;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(1000000, 0, 0.001, false))
-                               {
-                                       self.BUTTON_ATCK2 = true;
-                                       if(random() < 0.03) self.bot_secondary_riflemooth = 0;
-                               }
-                       }
-               }
-               METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
-                               if(fire & 1)
-                               if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
-                               if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
-                               {
-                                       weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
-                                       W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
-                                       actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
-                               }
-                               if(fire & 2)
-                               {
-                                       if(WEP_CVAR(rifle, secondary))
-                                       {
-                                               if(WEP_CVAR_SEC(rifle, reload)) {
-                                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                                               } else
-                                               {
-                                                       if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
-                                                       if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
-                                                       {
-                                                               weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
-                                                               W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
-                                                               actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-               METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
-                       ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
-                       ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Rifle, wr_resetplayer, void(entity thiswep))
-               {
-                       self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
-               }
-               METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
-               }
-               METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Rifle, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
-                               else
-                                       return WEAPON_RIFLE_MURDER_HAIL;
-                       }
-                       else
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_RIFLE_MURDER_PIERCING;
-                               else
-                                       return WEAPON_RIFLE_MURDER;
-                       }
-               }
+METHOD(Rifle, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(vdist(self.origin - self.enemy.origin, >, 1000))
+        self.bot_secondary_riflemooth = 0;
+    if(self.bot_secondary_riflemooth == 0)
+    {
+        if(bot_aim(1000000, 0, 0.001, false))
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.01) self.bot_secondary_riflemooth = 1;
+        }
+    }
+    else
+    {
+        if(bot_aim(1000000, 0, 0.001, false))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.03) self.bot_secondary_riflemooth = 0;
+        }
+    }
+}
+METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
+        if(fire & 1)
+        if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
+        if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
+        {
+            weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
+            W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+            actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
+        }
+        if(fire & 2)
+        {
+            if(WEP_CVAR(rifle, secondary))
+            {
+                if(WEP_CVAR_SEC(rifle, reload)) {
+                    thiswep.wr_reload(thiswep, actor, weaponentity);
+                } else
+                {
+                    if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
+                    if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
+                    {
+                        weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
+                        W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+                        actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
+                    }
+                }
+            }
+        }
+    }
+}
+METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
+    ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
+    return ammo_amount;
+}
+METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
+    ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
+    return ammo_amount;
+}
+METHOD(Rifle, wr_resetplayer, void(entity thiswep))
+{
+    self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
+}
+METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
+}
+METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Rifle, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+            return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
+        else
+            return WEAPON_RIFLE_MURDER_HAIL;
+    }
+    else
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+            return WEAPON_RIFLE_MURDER_PIERCING;
+        else
+            return WEAPON_RIFLE_MURDER;
+    }
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Rifle, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                       {
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
-                       }
-               }
-               METHOD(Rifle, wr_init, void(entity thiswep))
-               {
-                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
-                       {
-                               precache_pic("gfx/reticle_nex");
-                       }
-               }
-               METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
-               {
-                       if(button_zoom || zoomscript_caught)
-                       {
-                               reticle_image = "gfx/reticle_nex";
-                               return true;
-                       }
-                       else
-                       {
-                               // no weapon specific image for this weapon
-                               return false;
-                       }
-               }
+METHOD(Rifle, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+    {
+        sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+    }
+}
+METHOD(Rifle, wr_init, void(entity thiswep))
+{
+    if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+    {
+        precache_pic("gfx/reticle_nex");
+    }
+}
+METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
+{
+    if(button_zoom || zoomscript_caught)
+    {
+        reticle_image = "gfx/reticle_nex";
+        return true;
+    }
+    else
+    {
+        // no weapon specific image for this weapon
+        return false;
+    }
+}
 
 #endif
 #endif
index 94e3abdd59400e0690a690485caa9bf1980f0ea8..a2019025624f2e717bc9256d25ca1c5a3224785a 100644 (file)
@@ -598,148 +598,148 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
 // Begin: Genereal weapon functions
 // ============================
 
-               METHOD(Seeker, wr_aim, void(entity thiswep))
-               {
-                       if(WEP_CVAR(seeker, type) == 1)
-                               if(W_Seeker_Tagged_Info(self, self.enemy) != world)
-                                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
-                               else
-                                       self.BUTTON_ATCK2 = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
-                       else
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
-               }
-               METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(fire & 1)
-                       {
-                               if(WEP_CVAR(seeker, type) == 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
-                                       {
-                                               W_Seeker_Attack();
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
-                                       }
-                               }
-                               else
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
-                                       {
-                                               W_Seeker_Fire_Tag(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
-                                       }
-                               }
-                       }
-
-                       else if(fire & 2)
-                       {
-                               if(WEP_CVAR(seeker, type) == 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
-                                       {
-                                               W_Seeker_Fire_Tag(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
-                                       }
-                               }
-                               else
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
-                                       {
-                                               W_Seeker_Fire_Flac(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
-                                       }
-                               }
-                       }
-               }
-               METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(seeker, type) == 1)
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(seeker, type) == 1)
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
-               }
-               METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_SEEKER_SUICIDE;
-               }
-               METHOD(Seeker, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SEEKER_MURDER_TAG;
-                       else
-                               return WEAPON_SEEKER_MURDER_SPRAY;
-               }
+METHOD(Seeker, wr_aim, void(entity thiswep))
+{
+    if(WEP_CVAR(seeker, type) == 1)
+        if(W_Seeker_Tagged_Info(self, self.enemy) != world)
+            PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
+        else
+            PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+    else
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+}
+METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(fire & 1)
+    {
+        if(WEP_CVAR(seeker, type) == 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
+            {
+                W_Seeker_Attack();
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
+            }
+        }
+        else
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
+            {
+                W_Seeker_Fire_Tag(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+            }
+        }
+    }
+
+    else if(fire & 2)
+    {
+        if(WEP_CVAR(seeker, type) == 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
+            {
+                W_Seeker_Fire_Tag(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+            }
+        }
+        else
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
+            {
+                W_Seeker_Fire_Flac(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
+            }
+        }
+    }
+}
+METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(seeker, type) == 1)
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(seeker, type) == 1)
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
+}
+METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_SEEKER_SUICIDE;
+}
+METHOD(Seeker, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SEEKER_MURDER_TAG;
+    else
+        return WEAPON_SEEKER_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Seeker, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       if(w_deathtype & HITTYPE_BOUNCE)
-                       {
-                               if(w_deathtype & HITTYPE_SECONDARY)
-                               {
-                                       if(!w_issilent)
-                                               sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
-                               }
-                               else
-                               {
-                                       pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
-                                       if(!w_issilent)
-                                       {
-                                               if(w_random<0.15)
-                                                       sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
-                                               else if(w_random<0.7)
-                                                       sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
-                                               else
-                                                       sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                               {
-                                       if(w_random<0.15)
-                                               sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
-                                       else if(w_random<0.7)
-                                               sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
-                                       else
-                                               sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
-                               }
-                       }
-               }
+METHOD(Seeker, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    if(w_deathtype & HITTYPE_BOUNCE)
+    {
+        if(w_deathtype & HITTYPE_SECONDARY)
+        {
+            if(!w_issilent)
+                sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
+        }
+        else
+        {
+            pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+            if(!w_issilent)
+            {
+                if(w_random<0.15)
+                    sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
+                else if(w_random<0.7)
+                    sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
+                else
+                    sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
+            }
+        }
+    }
+    else
+    {
+        pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+        if(!w_issilent)
+        {
+            if(w_random<0.15)
+                sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
+            else if(w_random<0.7)
+                sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
+            else
+                sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
+        }
+    }
+}
 
 #endif
 #endif
index 1bf0b128e1680c57364154184db95da5011a7eaa..bb9a54dcd30b88747147154dc41c31e94e920b05 100644 (file)
@@ -672,58 +672,58 @@ void W_Shockwave_Attack()
        }
 }
 
-               METHOD(Shockwave, wr_aim, void(entity thiswep))
-               {
-                       if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
-                               { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); }
-                       else
-                               { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
-               }
-               METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       {
-                               if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
-                                       {
-                                               W_Shockwave_Attack();
-                                               actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
-                                       }
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               //if(actor.clip_load >= 0) // we are not currently reloading
-                               if(!actor.crouch) // no crouchmelee please
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
-                               {
-                                       // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
-                               }
-                       }
-               }
-               METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
-               METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
-               {
-                       // shockwave has infinite ammo
-                       return true;
-               }
-               METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SHOCKWAVE_MURDER_SLAP;
-                       else
-                               return WEAPON_SHOCKWAVE_MURDER;
-               }
+METHOD(Shockwave, wr_aim, void(entity thiswep))
+{
+    if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
+        { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
+    else
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
+}
+METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+    {
+        if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
+            {
+                W_Shockwave_Attack();
+                actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
+            }
+        }
+    }
+    else if(fire & 2)
+    {
+        //if(actor.clip_load >= 0) // we are not currently reloading
+        if(!actor.crouch) // no crouchmelee please
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
+        {
+            // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
+        }
+    }
+}
+METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
+{
+    return true; // infinite ammo
+}
+METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
+{
+    // shockwave has infinite ammo
+    return true;
+}
+METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SHOCKWAVE_MURDER_SLAP;
+    else
+        return WEAPON_SHOCKWAVE_MURDER;
+}
 
 #endif
 #ifdef CSQC
@@ -853,13 +853,13 @@ void Net_ReadShockwaveParticle()
        shockwave.sw_time = time;
 }
 
-               METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
-               {
-                       // handled by Net_ReadShockwaveParticle
-                       //vector org2;
-                       //org2 = w_org + w_backoff * 2;
-                       //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-               }
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+{
+    // handled by Net_ReadShockwaveParticle
+    //vector org2;
+    //org2 = w_org + w_backoff * 2;
+    //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+}
 
 #endif
 #endif
index 263626b3120d1529f668d66e003ffa4659d0df3d..898f9162cd1cdbd22a20ab840ea5313ded0539e0 100644 (file)
@@ -227,117 +227,117 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
 
 .float shotgun_primarytime;
 
-               METHOD(Shotgun, wr_aim, void(entity thiswep))
-               {
-                       if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
-                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
-                       else
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
-               }
-               METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
-                       {
-                               // don't force reload an empty shotgun if its melee attack is active
-                               if(WEP_CVAR(shotgun, secondary) < 2) {
-                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                               }
-                       }
-                       else
-                       {
-                               if(fire & 1)
-                               {
-                                       if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
-                                               {
-                                                       W_Shotgun_Attack(thiswep, true);
-                                                       actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
-                                               }
-                                       }
-                               }
-                               else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
-                               {
-                                       if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
-                                               {
-                                                       W_Shotgun_Attack(thiswep, false);
-                                                       actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
-                                               }
-                                       }
-                               }
-                       }
-                       if(actor.clip_load >= 0) // we are not currently reloading
-                       if(!actor.crouch) // no crouchmelee please
-                       if(WEP_CVAR(shotgun, secondary) == 1)
-                       if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
-                       {
-                               // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
-                       }
-               }
-               METHOD(Shotgun, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-               }
-               METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
-                       ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(IS_BOT_CLIENT(self))
-                       if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
-                               return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
-                       switch(WEP_CVAR(shotgun, secondary))
-                       {
-                               case 1: return true; // melee does not use ammo
-                               case 2: // secondary triple shot
-                               {
-                                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
-                                       ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
-                                       return ammo_amount;
-                               }
-                               default: return false; // secondary unavailable
-                       }
-               }
-               METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
-               }
-               METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Shotgun, wr_killmessage, Notification(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SHOTGUN_MURDER_SLAP;
-                       else
-                               return WEAPON_SHOTGUN_MURDER;
-               }
+METHOD(Shotgun, wr_aim, void(entity thiswep))
+{
+    if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+}
+METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
+    {
+        // don't force reload an empty shotgun if its melee attack is active
+        if(WEP_CVAR(shotgun, secondary) < 2) {
+            thiswep.wr_reload(thiswep, actor, weaponentity);
+        }
+    }
+    else
+    {
+        if(fire & 1)
+        {
+            if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
+                {
+                    W_Shotgun_Attack(thiswep, true);
+                    actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
+                }
+            }
+        }
+        else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
+        {
+            if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
+                {
+                    W_Shotgun_Attack(thiswep, false);
+                    actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
+                }
+            }
+        }
+    }
+    if(actor.clip_load >= 0) // we are not currently reloading
+    if(!actor.crouch) // no crouchmelee please
+    if(WEP_CVAR(shotgun, secondary) == 1)
+    if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
+    if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
+    {
+        // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+    }
+}
+METHOD(Shotgun, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = ammo_none;
+}
+METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+    ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+    return ammo_amount;
+}
+METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
+{
+    if(IS_BOT_CLIENT(self))
+    if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
+        return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
+    switch(WEP_CVAR(shotgun, secondary))
+    {
+        case 1: return true; // melee does not use ammo
+        case 2: // secondary triple shot
+        {
+            float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+            ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+            return ammo_amount;
+        }
+        default: return false; // secondary unavailable
+    }
+}
+METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
+}
+METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Shotgun, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SHOTGUN_MURDER_SLAP;
+    else
+        return WEAPON_SHOTGUN_MURDER;
+}
 
 #endif
 #ifdef CSQC
 .float prevric;
 
-               METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent && time - self.prevric > 0.25)
-                       {
-                               if(w_random < 0.05)
-                                       sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-                               self.prevric = time;
-                       }
-               }
+METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
+{
+    vector org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent && time - self.prevric > 0.25)
+    {
+        if(w_random < 0.05)
+            sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+        self.prevric = time;
+    }
+}
 
 #endif
 #endif
index 1c9406e80578be96dc35e26810cfe349ccfb5e4d..24b2f69982c0b3faa4639f5922fb981be032efa3 100644 (file)
@@ -213,9 +213,9 @@ int W_Tuba_GetNote(entity pl, int hittype)
                case 8: note = +4; break; // e
                case 9: note = -1; break; // B
        }
-       if(pl.BUTTON_CROUCH)
+       if(PHYS_INPUT_BUTTON_CROUCH(pl))
                note -= 12;
-       if(pl.BUTTON_JUMP)
+       if(PHYS_INPUT_BUTTON_JUMP(pl))
                note += 12;
        if(hittype & HITTYPE_SECONDARY)
                note += 7;
@@ -367,9 +367,9 @@ METHOD(Tuba, wr_aim, void(Tuba this))
        if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
        {
                if (random() > 0.5)
-                       actor.BUTTON_ATCK = 1;
+                       PHYS_INPUT_BUTTON_ATCK(actor) = true;
                else
-                       actor.BUTTON_ATCK2 = 1;
+                       PHYS_INPUT_BUTTON_ATCK2(actor) = true;
        }
 }
 
index e568acac1f9fe6a81d3f9833890e64c95070e994..92c795421a401cb88e6d50490e28e48a5bf73d31 100644 (file)
@@ -339,168 +339,168 @@ void W_RocketMinsta_Attack3 ()
     }
 }
 
-               METHOD(Vaporizer, wr_aim, void(entity thiswep))
-               {
-                       if(self.(thiswep.ammo_field) > 0)
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
-                       else
-                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
-               }
-               METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       // if the laser uses load, we also consider its ammo for reloading
-                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       }
-                       if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
-                               {
-                                       W_Vaporizer_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
-                               }
-                       }
-                       if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
-                       {
-                               if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
-                               {
-                                       bool rapid = autocvar_g_rm_laser_rapid;
-                                       if(actor.jump_interval <= time && !actor.held_down)
-                                       {
-                                               if(rapid)
-                                                       actor.held_down = true;
-                                               actor.jump_interval = time + autocvar_g_rm_laser_refire;
-                                               actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
-                                               damage_goodhits = 0;
-                                               W_RocketMinsta_Attack2();
-                                       }
-                                       else if(rapid && actor.jump_interval2 <= time && actor.held_down)
-                                       {
-                                               actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
-                                               damage_goodhits = 0;
-                                               W_RocketMinsta_Attack3();
-                                               //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
-                                       }
-                               }
-                               else if (actor.jump_interval <= time)
-                               {
-                                       // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
-                                       actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
-
-                                       // decrease ammo for the laser?
-                                       if(WEP_CVAR_SEC(vaporizer, ammo))
-                                               W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
-
-                                       // ugly instagib hack to reuse the fire mode of the laser
-                                       makevectors(actor.v_angle);
-                                       Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
-                                       PS(actor).m_weapon = WEP_BLASTER;
-                                       W_Blaster_Attack(
-                                               actor,
-                                               WEP_BLASTER.m_id | HITTYPE_SECONDARY,
-                                               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(actor).m_weapon = oldwep;
-
-                                       // now do normal refire
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
-                               }
-                       }
-                       else
-                               actor.held_down = false;
-               }
-               METHOD(Vaporizer, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = (thiswep.ammo_field);
-                       self.vaporizer_lasthit = 0;
-               }
-               METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
-               {
-                       float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
-                       ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
-                       return ammo_amount;
-               }
-               METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(!WEP_CVAR_SEC(vaporizer, ammo))
-                               return true;
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
-                       ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
-               {
-                       self.vaporizer_lasthit = 0;
-               }
-               METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       float used_ammo;
-                       if(WEP_CVAR_SEC(vaporizer, ammo))
-                               used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
-                       else
-                               used_ammo = vaporizer_ammo;
-
-                       W_Reload(self, used_ammo, SND(RELOAD));
-               }
-               METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_VAPORIZER_MURDER;
-               }
+METHOD(Vaporizer, wr_aim, void(entity thiswep))
+{
+    if(self.(thiswep.ammo_field) > 0)
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+}
+METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    // if the laser uses load, we also consider its ammo for reloading
+    if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    }
+    if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
+        {
+            W_Vaporizer_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
+        }
+    }
+    if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
+    {
+        if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
+        {
+            bool rapid = autocvar_g_rm_laser_rapid;
+            if(actor.jump_interval <= time && !actor.held_down)
+            {
+                if(rapid)
+                    actor.held_down = true;
+                actor.jump_interval = time + autocvar_g_rm_laser_refire;
+                actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
+                damage_goodhits = 0;
+                W_RocketMinsta_Attack2();
+            }
+            else if(rapid && actor.jump_interval2 <= time && actor.held_down)
+            {
+                actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
+                damage_goodhits = 0;
+                W_RocketMinsta_Attack3();
+                //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
+            }
+        }
+        else if (actor.jump_interval <= time)
+        {
+            // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
+            actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+
+            // decrease ammo for the laser?
+            if(WEP_CVAR_SEC(vaporizer, ammo))
+                W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
+
+            // ugly instagib hack to reuse the fire mode of the laser
+            makevectors(actor.v_angle);
+            Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
+            PS(actor).m_weapon = WEP_BLASTER;
+            W_Blaster_Attack(
+                actor,
+                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+                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(actor).m_weapon = oldwep;
+
+            // now do normal refire
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
+        }
+    }
+    else
+        actor.held_down = false;
+}
+METHOD(Vaporizer, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = (thiswep.ammo_field);
+    self.vaporizer_lasthit = 0;
+}
+METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
+{
+    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
+    ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
+    return ammo_amount;
+}
+METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
+{
+    if(!WEP_CVAR_SEC(vaporizer, ammo))
+        return true;
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
+    ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
+    return ammo_amount;
+}
+METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
+{
+    self.vaporizer_lasthit = 0;
+}
+METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float used_ammo;
+    if(WEP_CVAR_SEC(vaporizer, ammo))
+        used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
+    else
+        used_ammo = vaporizer_ammo;
+
+    W_Reload(self, used_ammo, SND(RELOAD));
+}
+METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_VAPORIZER_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2 = w_org + w_backoff * 6;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-                               if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
-                       }
-                       else
-                       {
-                               pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
-                               if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
-                       }
-               }
-               METHOD(Vaporizer, wr_init, void(entity thiswep))
-               {
-                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
-                       {
-                               precache_pic("gfx/reticle_nex");
-                       }
-               }
-               METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
-               {
-                       if(button_zoom || zoomscript_caught)
-                       {
-                               reticle_image = "gfx/reticle_nex";
-                               return true;
-                       }
-                       else
-                       {
-                               // no weapon specific image for this weapon
-                               return false;
-                       }
-               }
+METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
+{
+    vector org2 = w_org + w_backoff * 6;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+        if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+    }
+    else
+    {
+        pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+        if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
+    }
+}
+METHOD(Vaporizer, wr_init, void(entity thiswep))
+{
+    if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+    {
+        precache_pic("gfx/reticle_nex");
+    }
+}
+METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
+{
+    if(button_zoom || zoomscript_caught)
+    {
+        reticle_image = "gfx/reticle_nex";
+        return true;
+    }
+    else
+    {
+        // no weapon specific image for this weapon
+        return false;
+    }
+}
 
 #endif
 #endif
index 376b8922ac96098db74e81cd1001b1f0b7739a7c..d14457b2e9c35c7f80f019a4af1e20153c908598 100644 (file)
@@ -210,193 +210,193 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
 .float vortex_chargepool_pauseregen_finished;
 
-               METHOD(Vortex, wr_aim, void(entity thiswep))
-               {
-                       if(bot_aim(1000000, 0, 1, false))
-                               self.BUTTON_ATCK = true;
-                       else
-                       {
-                               if(WEP_CVAR(vortex, charge))
-                                       self.BUTTON_ATCK2 = true;
-                       }
-               }
-               METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
-                               actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
-
-                       if(WEP_CVAR_SEC(vortex, chargepool))
-                               if(actor.vortex_chargepool_ammo < 1)
-                               {
-                                       if(actor.vortex_chargepool_pauseregen_finished < time)
-                                               actor.vortex_chargepool_ammo = min(1, actor.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
-                                       actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
-                               }
-
-                       if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               if(fire & 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
-                                       {
-                                               W_Vortex_Attack(thiswep, 0);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
-                                       }
-                               }
-                               if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (actor.BUTTON_ZOOM | actor.BUTTON_ZOOMSCRIPT) : (fire & 2))
-                               {
-                                       if(WEP_CVAR(vortex, charge))
-                                       {
-                                               actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
-                                               float dt = frametime / W_TICSPERFRAME;
-
-                                               if(actor.vortex_charge < 1)
-                                               {
-                                                       if(WEP_CVAR_SEC(vortex, chargepool))
-                                                       {
-                                                               if(WEP_CVAR_SEC(vortex, ammo))
-                                                               {
-                                                                       // always deplete if secondary is held
-                                                                       actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
-
-                                                                       dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
-                                                                       actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
-                                                                       dt = min(dt, actor.vortex_chargepool_ammo);
-                                                                       dt = max(0, dt);
-
-                                                                       actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
-                                                               }
-                                                       }
-
-                                                       else if(WEP_CVAR_SEC(vortex, ammo))
-                                                       {
-                                                               if(fire & 2) // only eat ammo when the button is pressed
-                                                               {
-                                                                       dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
-                                                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                                                       {
-                                                                               // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
-                                                                               if(autocvar_g_balance_vortex_reload_ammo)
-                                                                               {
-                                                                                       dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
-                                                                                       dt = max(0, dt);
-                                                                                       if(dt > 0)
-                                                                                       {
-                                                                                               actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
-                                                                                       }
-                                                                                       actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
-                                                                               }
-                                                                               else
-                                                                               {
-                                                                                       dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
-                                                                                       dt = max(0, dt);
-                                                                                       if(dt > 0)
-                                                                                       {
-                                                                                               actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                                       actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
-                                                               }
-                                                       }
-
-                                                       else
-                                                       {
-                                                               dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
-                                                               actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
-                                                       }
-                                               }
-                                       }
-                                       else if(WEP_CVAR(vortex, secondary))
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
-                                               {
-                                                       W_Vortex_Attack(thiswep, 1);
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
-                                               }
-                                       }
-                               }
-                       }
-               }
-               METHOD(Vortex, wr_setup, void(entity thiswep))
-               {
-                       self.vortex_lasthit = 0;
-               }
-               METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
-                       ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
-                       return ammo_amount;
-               }
-               METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(WEP_CVAR(vortex, secondary))
-                       {
-                               // don't allow charging if we don't have enough ammo
-                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
-                               ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
-                               return ammo_amount;
-                       }
-                       else
-                       {
-                               return false; // zoom is not a fire mode
-                       }
-               }
-               METHOD(Vortex, wr_resetplayer, void(entity thiswep))
-               {
-                       if (WEP_CVAR(vortex, charge)) {
-                               if (WEP_CVAR_SEC(vortex, chargepool)) {
-                                       self.vortex_chargepool_ammo = 1;
-                               }
-                               self.vortex_charge = WEP_CVAR(vortex, charge_start);
-                       }
-                       self.vortex_lasthit = 0;
-               }
-               METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
-               }
-               METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Vortex, wr_killmessage, Notification(entity thiswep))
-               {
-                       return WEAPON_VORTEX_MURDER;
-               }
+METHOD(Vortex, wr_aim, void(entity thiswep))
+{
+    if(bot_aim(1000000, 0, 1, false))
+        PHYS_INPUT_BUTTON_ATCK(self) = true;
+    else
+    {
+        if(WEP_CVAR(vortex, charge))
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+    }
+}
+METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
+        actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
+
+    if(WEP_CVAR_SEC(vortex, chargepool))
+        if(actor.vortex_chargepool_ammo < 1)
+        {
+            if(actor.vortex_chargepool_pauseregen_finished < time)
+                actor.vortex_chargepool_ammo = min(1, actor.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
+            actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
+        }
+
+    if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        if(fire & 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
+            {
+                W_Vortex_Attack(thiswep, 0);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
+            }
+        }
+        if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+        {
+            if(WEP_CVAR(vortex, charge))
+            {
+                actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
+                float dt = frametime / W_TICSPERFRAME;
+
+                if(actor.vortex_charge < 1)
+                {
+                    if(WEP_CVAR_SEC(vortex, chargepool))
+                    {
+                        if(WEP_CVAR_SEC(vortex, ammo))
+                        {
+                            // always deplete if secondary is held
+                            actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
+
+                            dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+                            actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
+                            dt = min(dt, actor.vortex_chargepool_ammo);
+                            dt = max(0, dt);
+
+                            actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+                        }
+                    }
+
+                    else if(WEP_CVAR_SEC(vortex, ammo))
+                    {
+                        if(fire & 2) // only eat ammo when the button is pressed
+                        {
+                            dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+                            if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+                            {
+                                // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+                                if(autocvar_g_balance_vortex_reload_ammo)
+                                {
+                                    dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+                                    dt = max(0, dt);
+                                    if(dt > 0)
+                                    {
+                                        actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
+                                    }
+                                    actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
+                                }
+                                else
+                                {
+                                    dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+                                    dt = max(0, dt);
+                                    if(dt > 0)
+                                    {
+                                        actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
+                                    }
+                                }
+                            }
+                            actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+                        }
+                    }
+
+                    else
+                    {
+                        dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+                        actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+                    }
+                }
+            }
+            else if(WEP_CVAR(vortex, secondary))
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
+                {
+                    W_Vortex_Attack(thiswep, 1);
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
+                }
+            }
+        }
+    }
+}
+METHOD(Vortex, wr_setup, void(entity thiswep))
+{
+    self.vortex_lasthit = 0;
+}
+METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
+    ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
+    return ammo_amount;
+}
+METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
+{
+    if(WEP_CVAR(vortex, secondary))
+    {
+        // don't allow charging if we don't have enough ammo
+        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
+        ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
+        return ammo_amount;
+    }
+    else
+    {
+        return false; // zoom is not a fire mode
+    }
+}
+METHOD(Vortex, wr_resetplayer, void(entity thiswep))
+{
+    if (WEP_CVAR(vortex, charge)) {
+        if (WEP_CVAR_SEC(vortex, chargepool)) {
+            self.vortex_chargepool_ammo = 1;
+        }
+        self.vortex_charge = WEP_CVAR(vortex, charge_start);
+    }
+    self.vortex_lasthit = 0;
+}
+METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
+}
+METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Vortex, wr_killmessage, Notification(entity thiswep))
+{
+    return WEAPON_VORTEX_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Vortex, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
-               }
-               METHOD(Vortex, wr_init, void(entity thiswep))
-               {
-                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
-                       {
-                               precache_pic("gfx/reticle_nex");
-                       }
-               }
-               METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
-               {
-                       if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
-                       {
-                               reticle_image = "gfx/reticle_nex";
-                               return true;
-                       }
-                       else
-                       {
-                               // no weapon specific image for this weapon
-                               return false;
-                       }
-               }
+METHOD(Vortex, wr_impacteffect, void(entity thiswep))
+{
+    vector org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+}
+METHOD(Vortex, wr_init, void(entity thiswep))
+{
+    if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+    {
+        precache_pic("gfx/reticle_nex");
+    }
+}
+METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
+{
+    if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
+    {
+        reticle_image = "gfx/reticle_nex";
+        return true;
+    }
+    else
+    {
+        // no weapon specific image for this weapon
+        return false;
+    }
+}
 
 #endif
 #endif
index a32649f5c8d4118248f8a5cc59412c734c2b6c0e..c265325f8f6c75d20de492fcf1c81211195e5849 100644 (file)
@@ -10,7 +10,6 @@
                func()
 #else
        #ifdef HAVE_YO_DAWG_CPP
-// TODO make ascii art pic of xzibit
 // YO DAWG!
 // I HERD YO LIEK MACROS
 // SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
index 9889f778a442dc381375f96f6ca359c198aa7e09..dc50c771f164470a2a1e9d81d63c838c549abd2e 100644 (file)
@@ -6,10 +6,6 @@
        const int false = 0;
 #endif
 
-// Transitional aliases
-[[deprecated("use true")]][[alias("true")]] const bool TRUE;
-[[deprecated("use false")]][[alias("false")]] const bool FALSE;
-
 #define boolean(value) ((value) != 0)
 
 // get true/false value of a string with multiple different inputs
index a8e4aaa090a0ac9ec09a9fad0c1a047ec86337a4..07d99b4f1226f73d843d0304e302d2439d6947e3 100644 (file)
@@ -67,7 +67,7 @@ entity LL_POP(LinkedList this)
 #define LL_DELETE_2(this, dtor) \
        MACRO_BEGIN \
        { \
-               LL_CLEAR(this, dtor); \
+               LL_CLEAR_2(this, dtor); \
                remove(this); \
                this = NULL; \
        } MACRO_END
index b0320eadb13f3e006fa72f0f301378dfac24ffb9..7ac732f8b65b451608897f313fdd996d32b4bcb4 100644 (file)
@@ -265,28 +265,14 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                        v += ReadByte();          // note: this is unsigned
                        return v;
                }
-               vector ReadInt48_t()
-               {
-                       vector v;
-                       v.x = ReadInt24_t();
-                       v.y = ReadInt24_t();
-                       v.z = 0;
-                       return v;
-               }
-               vector ReadInt72_t()
-               {
-                       vector v;
-                       v.x = ReadInt24_t();
-                       v.y = ReadInt24_t();
-                       v.z = ReadInt24_t();
-                       return v;
-               }
+               #define ReadInt48_t() vec3(ReadInt24_t(), ReadInt24_t(), 0)
+               #define ReadInt72_t() vec3(ReadInt24_t(), ReadInt24_t(), ReadInt24_t())
 
                int _ReadSByte;
                #define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7)))
                #define ReadFloat() ReadCoord()
-        vector ReadVector() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); return v; }
-               vector ReadVector2D() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = 0; return v; }
+               #define ReadVector() vec3(ReadFloat(), ReadFloat(), ReadFloat())
+               #define ReadVector2D() vec3(ReadFloat(), ReadFloat(), 0)
 
                float ReadApproxPastTime()
                {
index 7ecc745d0f436b21d3d950e58401b362c75bfb24..efcb7876a6d448e070828c719ec8d452b224a0ce 100644 (file)
@@ -50,6 +50,9 @@ entity __spawn(string _classname, string _sourceLoc, bool pure)
                #ifdef CSQC
                setorigin(this, '0 0 10000');
                #endif
+               #ifdef SVQC
+        setorigin(this, '0 0 -10000');
+        #endif
        }
        return this;
 }
index eae9a6e6f1389a531d5b5c09a35f241cce8ff11a..f69b6072bea77316d2b5154a20cf760e92cd3c54 100644 (file)
@@ -2,6 +2,13 @@
 
 #ifndef MENUQC
 
+    /**
+     * Replicate a client cvar into a server field
+     *
+     * @param fld   The field to replicate into
+     * @param type  The field type
+     * @param cvar  The cvar name
+     */
        #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__))
        #define EVAL_REPLICATE(...) __VA_ARGS__
 
index f9c056fbd3ab81e30321f673010bd2da0db064b9..9d1090bac1dbe40711a6ed10139894a5fca96ba4 100644 (file)
@@ -152,6 +152,7 @@ noref bool require_spawnfunc_prefix;
                FIELD_SCALAR(fld, platmovetype) \
                FIELD_SCALAR(fld, race_place) \
                FIELD_SCALAR(fld, radius) \
+               FIELD_SCALAR(fld, respawntimestart) \
                FIELD_SCALAR(fld, respawntimejitter) \
                FIELD_SCALAR(fld, respawntime) \
                FIELD_SCALAR(fld, restriction) \
index bd0c8d30f8a97bef964e41990628003627390dda..47a8175cac598554b3f2965a7dfc83db5429d2f5 100644 (file)
@@ -16,7 +16,6 @@
        }
 #endif
 
-// TODO: macro
 string seconds_tostring(float sec)
 {
        float minutes = floor(sec / 60);
index 865010ff5c5a6d8afdfbd0f2280c4dbb1f46edef..982a426068517c811b6b91ad03bb3be4b3e3d3db 100644 (file)
@@ -244,7 +244,3 @@ void anticheat_init(entity this)
        this.anticheat_speedhack_offset = 0;
        this.anticheat_jointime = servertime;
 }
-
-void anticheat_shutdown()
-{
-}
index 5e6599b7e01730b7ce82a2948d0fb951e790a7eb..3bb5d251e95c1765ad20d0a6623ae578fbf03160 100644 (file)
@@ -3,7 +3,6 @@
 
 void anticheat_init(entity this);
 void anticheat_report();
-void anticheat_shutdown();
 
 void anticheat_physics(entity this);
 void anticheat_spectatecopy(entity spectatee);
index 654bd2bc936efffaea6c0df1b8c0f1f6d72961ab..cd950738e9e6736cd8e2f80e9d78a709f2e22032 100644 (file)
@@ -72,7 +72,7 @@ float autocvar_g_antilag_nudge;
 float autocvar_g_balance_armor_blockpercent;
 int autocvar_g_balance_armor_limit;
 float autocvar_g_balance_armor_regen;
-float autocvar_g_balance_armor_regenlinear; // TODO: int/bool?
+float autocvar_g_balance_armor_regenlinear;
 int autocvar_g_balance_armor_regenstable;
 float autocvar_g_balance_armor_rot;
 float autocvar_g_balance_armor_rotlinear;
index 79f0a2758c3b4a7b8c0ddbdf92cdc362eea228d4..67057181b6a9f2c247b82c338db4ee87895cbed8 100644 (file)
@@ -133,7 +133,7 @@ float bot_shouldattack(entity e)
                return false;
        if (IS_DEAD(e))
                return false;
-       if (e.BUTTON_CHAT)
+       if (PHYS_INPUT_BUTTON_CHAT(e))
                return false;
        if(e.flags & FL_NOTARGET)
                return false;
index 468b32c4a57ef46fd2eb6186901475b5aae946fa..72ebfcb2e70d65cecc4aeba4373151514effec6b 100644 (file)
@@ -92,17 +92,16 @@ void bot_think()
        // skill 0 = ping 0.7 (slightly drunk)
 
        // clear buttons
-       self.BUTTON_ATCK = 0;
-       self.button1 = 0;
-       self.BUTTON_JUMP = 0;
-       self.BUTTON_ATCK2 = 0;
-       self.BUTTON_ZOOM = 0;
-       self.BUTTON_CROUCH = 0;
-       self.BUTTON_HOOK = 0;
-       self.BUTTON_INFO = 0;
-       self.button8 = 0;
-       self.BUTTON_CHAT = 0;
-       self.BUTTON_USE = 0;
+       PHYS_INPUT_BUTTON_ATCK(self) = false;
+       PHYS_INPUT_BUTTON_JUMP(self) = false;
+       PHYS_INPUT_BUTTON_ATCK2(self) = false;
+       PHYS_INPUT_BUTTON_ZOOM(self) = false;
+       PHYS_INPUT_BUTTON_CROUCH(self) = false;
+       PHYS_INPUT_BUTTON_HOOK(self) = false;
+       PHYS_INPUT_BUTTON_INFO(self) = false;
+       PHYS_INPUT_BUTTON_DRAG(self) = false;
+       PHYS_INPUT_BUTTON_CHAT(self) = false;
+       PHYS_INPUT_BUTTON_USE(self) = false;
 
        if (time < game_starttime)
        {
@@ -117,7 +116,7 @@ void bot_think()
        {
                if (self.deadflag == DEAD_DEAD)
                {
-                       self.BUTTON_JUMP = 1; // press jump to respawn
+                       PHYS_INPUT_BUTTON_JUMP(self) = true; // press jump to respawn
                        self.bot_strategytime = 0;
                }
        }
index 134e78401f9c2d5eba5ff53c8d366a36d9eb250f..260e8e661f8395109cd62b24a0fe16fd2b09d0fb 100644 (file)
@@ -108,12 +108,12 @@ void havocbot_ai()
                        w.wr_aim(w);
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
                        {
-                               self.BUTTON_ATCK = false;
-                               self.BUTTON_ATCK2 = false;
+                               PHYS_INPUT_BUTTON_ATCK(self) = false;
+                               PHYS_INPUT_BUTTON_ATCK2(self) = false;
                        }
                        else
                        {
-                               if(self.BUTTON_ATCK||self.BUTTON_ATCK2)
+                               if(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))
                                        self.lastfiredweapon = PS(self).m_weapon.m_id;
                        }
                }
@@ -246,7 +246,7 @@ void havocbot_keyboard_movement(vector destorg)
                keyboard.z = 0;
 
        self.havocbot_keyboard = keyboard * maxspeed;
-       if (self.havocbot_ducktime>time) self.BUTTON_CROUCH=true;
+       if (self.havocbot_ducktime>time) PHYS_INPUT_BUTTON_CROUCH(self) = true;
 
        keyboard = self.havocbot_keyboard;
        blend = bound(0,vlen(destorg-self.origin)/autocvar_bot_ai_keyboard_distance,1); // When getting close move with 360 degree
@@ -273,7 +273,7 @@ void havocbot_bunnyhop(vector dir)
        if(self.aistatus & AI_STATUS_DANGER_AHEAD)
        {
                self.aistatus &= ~AI_STATUS_RUNNING;
-               self.BUTTON_JUMP = false;
+               PHYS_INPUT_BUTTON_JUMP(self) = false;
                self.bot_canruntogoal = 0;
                self.bot_timelastseengoal = 0;
                return;
@@ -349,12 +349,12 @@ void havocbot_bunnyhop(vector dir)
                                        {
                                                self.aistatus &= ~AI_STATUS_RUNNING;
                                                if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance)
-                                                       self.BUTTON_JUMP = true;
+                                                       PHYS_INPUT_BUTTON_JUMP(self) = true;
                                        }
                                        else
                                        {
                                                self.aistatus |= AI_STATUS_RUNNING;
-                                               self.BUTTON_JUMP = true;
+                                               PHYS_INPUT_BUTTON_JUMP(self) = true;
                                        }
                                }
                        }
@@ -374,7 +374,7 @@ void havocbot_bunnyhop(vector dir)
        if((IS_ONGROUND(self)) == 0)
        {
                if(self.velocity.z < 0 || vlen(self.velocity)<maxspeed)
-                       self.BUTTON_JUMP = false;
+                       PHYS_INPUT_BUTTON_JUMP(self) = false;
 
                // Strafe
                if(self.aistatus & AI_STATUS_RUNNING)
@@ -477,7 +477,7 @@ void havocbot_movetogoal()
                }
 
                // Flying
-               self.BUTTON_HOOK = true;
+               PHYS_INPUT_BUTTON_HOOK(self) = true;
                if(self.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < self.origin.z)
                {
                        self.movement_x = dir * v_forward * maxspeed;
@@ -565,11 +565,11 @@ void havocbot_movetogoal()
                        {
                                if(self.velocity.z<0)
                                {
-                                       self.BUTTON_HOOK = true;
+                                       PHYS_INPUT_BUTTON_HOOK(self) = true;
                                }
                        }
                        else
-                               self.BUTTON_HOOK = true;
+                               PHYS_INPUT_BUTTON_HOOK(self) = true;
 
                        // If there is no goal try to move forward
 
@@ -609,7 +609,7 @@ void havocbot_movetogoal()
                                {
                                        if(time > self.rocketjumptime)
                                        {
-                                               self.BUTTON_ATCK2 = true;
+                                               PHYS_INPUT_BUTTON_ATCK2(self) = true;
                                                self.rocketjumptime = 0;
                                        }
                                        return;
@@ -617,7 +617,7 @@ void havocbot_movetogoal()
 
                                PS(self).m_switchweapon = WEP_DEVASTATOR;
                                self.v_angle_x = 90;
-                               self.BUTTON_ATCK = true;
+                               PHYS_INPUT_BUTTON_ATCK(self) = true;
                                self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
                                return;
                        }
@@ -638,9 +638,9 @@ void havocbot_movetogoal()
                if(self.waterlevel>WATERLEVEL_SWIMMING)
                        dir.z = 1;
                else if(self.velocity.z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER))
-                       self.BUTTON_JUMP = true;
+                       PHYS_INPUT_BUTTON_JUMP(self) = true;
                else
-                       self.BUTTON_JUMP = false;
+                       PHYS_INPUT_BUTTON_JUMP(self) = false;
                makevectors(self.v_angle.y * '0 1 0');
                self.movement_x = dir * v_forward * maxspeed;
                self.movement_y = dir * v_right * maxspeed;
@@ -696,9 +696,9 @@ void havocbot_movetogoal()
                        {
                                if(self.velocity.z >= 0 && !(self.watertype == CONTENT_WATER && gco.z < self.origin.z) &&
                                        ( !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER) || self.aistatus & AI_STATUS_OUT_WATER))
-                                       self.BUTTON_JUMP = true;
+                                       PHYS_INPUT_BUTTON_JUMP(self) = true;
                                else
-                                       self.BUTTON_JUMP = false;
+                                       PHYS_INPUT_BUTTON_JUMP(self) = false;
                        }
                        dir = normalize(flatdir);
                        makevectors(self.v_angle.y * '0 1 0');
@@ -722,7 +722,7 @@ void havocbot_movetogoal()
                                        s = trace_fraction;
                                        tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, false, self);
                                        if (trace_fraction > s)
-                                               self.BUTTON_JUMP = 1;
+                                               PHYS_INPUT_BUTTON_JUMP(self) = true;
                                }
                        }
 
@@ -738,7 +738,7 @@ void havocbot_movetogoal()
                        // Check head-banging against walls
                        if(vlen(self.origin + self.view_ofs - trace_endpos) < 25 && !(self.aistatus & AI_STATUS_OUT_WATER))
                        {
-                               self.BUTTON_JUMP = true;
+                               PHYS_INPUT_BUTTON_JUMP(self) = true;
                                if(self.facingwalltime && time > self.facingwalltime)
                                {
                                        self.ignoregoal = self.goalcurrent;
@@ -767,7 +767,7 @@ void havocbot_movetogoal()
                        self.aistatus &= ~AI_STATUS_DANGER_AHEAD;
 
                        if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
-                       if((IS_ONGROUND(self)) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == true)
+                       if((IS_ONGROUND(self)) || (self.aistatus & AI_STATUS_RUNNING) || PHYS_INPUT_BUTTON_JUMP(self))
                        {
                                // Look downwards
                                traceline(dst_ahead , dst_down, true, world);
@@ -815,7 +815,7 @@ void havocbot_movetogoal()
 
                dir = normalize(dir + dodge + evadeobstacle + evadelava);
        //      self.bot_dodgevector = dir;
-       //      self.bot_dodgevector_jumpbutton = self.BUTTON_JUMP;
+       //      self.bot_dodgevector_jumpbutton = PHYS_INPUT_BUTTON_JUMP(self);
        }
 
        if(time < self.ladder_time)
@@ -834,7 +834,7 @@ void havocbot_movetogoal()
 
        //dir = self.bot_dodgevector;
        //if (self.bot_dodgevector_jumpbutton)
-       //      self.BUTTON_JUMP = 1;
+       //      PHYS_INPUT_BUTTON_JUMP(self) = true;
        self.movement_x = dir * v_forward * maxspeed;
        self.movement_y = dir * v_right * maxspeed;
        self.movement_z = dir * v_up * maxspeed;
@@ -849,8 +849,8 @@ void havocbot_movetogoal()
        if(skill+self.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
                havocbot_bunnyhop(dir);
 
-       if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(self))) self.BUTTON_JUMP=1;
-       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.BUTTON_JUMP=true;
+       if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(self))) PHYS_INPUT_BUTTON_JUMP(self) = true;
+       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) PHYS_INPUT_BUTTON_JUMP(self) = true;
        if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.havocbot_ducktime=time+0.3/bound(0.1,skill+self.bot_dodgeskill,10);
 }
 
index f42adceef1d56ca6f36ca5429c67aea12b932469..f15c9a6fb6530568c25d8a8ee2a712f3ee58336c 100644 (file)
@@ -824,13 +824,13 @@ const int BOT_CMD_KEY_CHAT                = BIT(10);
 float bot_presskeys()
 {SELFPARAM();
        self.movement = '0 0 0';
-       self.BUTTON_JUMP = false;
-       self.BUTTON_CROUCH = false;
-       self.BUTTON_ATCK = false;
-       self.BUTTON_ATCK2 = false;
-       self.BUTTON_USE = false;
-       self.BUTTON_HOOK = false;
-       self.BUTTON_CHAT = false;
+       PHYS_INPUT_BUTTON_JUMP(self) = false;
+       PHYS_INPUT_BUTTON_CROUCH(self) = false;
+       PHYS_INPUT_BUTTON_ATCK(self) = false;
+       PHYS_INPUT_BUTTON_ATCK2(self) = false;
+       PHYS_INPUT_BUTTON_USE(self) = false;
+       PHYS_INPUT_BUTTON_HOOK(self) = false;
+       PHYS_INPUT_BUTTON_CHAT(self) = false;
 
        if(self.bot_cmd_keys == BOT_CMD_KEY_NONE)
                return false;
@@ -846,25 +846,25 @@ float bot_presskeys()
                self.movement_y = -autocvar_sv_maxspeed;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_JUMP)
-               self.BUTTON_JUMP = true;
+               PHYS_INPUT_BUTTON_JUMP(self) = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_CROUCH)
-               self.BUTTON_CROUCH = true;
+               PHYS_INPUT_BUTTON_CROUCH(self) = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK1)
-               self.BUTTON_ATCK = true;
+               PHYS_INPUT_BUTTON_ATCK(self) = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK2)
-               self.BUTTON_ATCK2 = true;
+               PHYS_INPUT_BUTTON_ATCK2(self) = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_USE)
-               self.BUTTON_USE = true;
+               PHYS_INPUT_BUTTON_USE(self) = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_HOOK)
-               self.BUTTON_HOOK = true;
+               PHYS_INPUT_BUTTON_HOOK(self) = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_CHAT)
-               self.BUTTON_CHAT = true;
+               PHYS_INPUT_BUTTON_CHAT(self) = true;
 
        return true;
 }
@@ -986,15 +986,14 @@ float bot_cmd_releasekey()
 
 float bot_cmd_pause()
 {SELFPARAM();
-       self.button1        = 0;
-       self.button8        = 0;
-       self.BUTTON_USE     = 0;
-       self.BUTTON_ATCK    = 0;
-       self.BUTTON_JUMP    = 0;
-       self.BUTTON_HOOK    = 0;
-       self.BUTTON_CHAT    = 0;
-       self.BUTTON_ATCK2   = 0;
-       self.BUTTON_CROUCH  = 0;
+       PHYS_INPUT_BUTTON_DRAG(self) = false;
+       PHYS_INPUT_BUTTON_USE(self) = false;
+       PHYS_INPUT_BUTTON_ATCK(self) = false;
+       PHYS_INPUT_BUTTON_JUMP(self) = false;
+       PHYS_INPUT_BUTTON_HOOK(self) = false;
+       PHYS_INPUT_BUTTON_CHAT(self) = false;
+       PHYS_INPUT_BUTTON_ATCK2(self) = false;
+       PHYS_INPUT_BUTTON_CROUCH(self) = false;
 
        self.movement = '0 0 0';
        self.bot_cmd_keys = BOT_CMD_KEY_NONE;
index c30e3d45a92160e842e1bfa63fdf3ab9be8bbb77..b82b19a4a7f3a9593e20c556a41ccc27c14562df 100644 (file)
@@ -12,6 +12,8 @@
 #include "../common/deathtypes/all.qh"
 #include "../common/util.qh"
 
+#include <common/physics/player.qh>
+
 #include "../common/monsters/all.qh"
 
 #include "../common/weapons/all.qh"
@@ -34,7 +36,6 @@ float CheatCommand(float argc) { return 0; }
 float CheatFrame() { return 0; }
 void CheatInit() { cheatcount_total = world.cheatcount; }
 void CheatShutdown() { }
-void CheatShutdownClient() { }
 void Drag_MoveDrag(entity from, entity to) { }
 
 #else
@@ -53,10 +54,6 @@ void CheatShutdown()
 {
 }
 
-void CheatShutdownClient()
-{
-}
-
 float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking
 {SELFPARAM();
        // dead people cannot cheat
@@ -784,7 +781,7 @@ float Drag(float force_allow_pick, float ischeat)
                default:
                        if(Drag_IsDragging(self))
                        {
-                               if(self.BUTTON_DRAG)
+                               if(PHYS_INPUT_BUTTON_DRAG(self))
                                {
                                        if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
                                        {
@@ -816,7 +813,7 @@ float Drag(float force_allow_pick, float ischeat)
                        else
                        {
                                if(Drag_CanDrag(self))
-                                       if(self.BUTTON_DRAG)
+                                       if(PHYS_INPUT_BUTTON_DRAG(self))
                                        {
                                                crosshair_trace_plusvisibletriggers(self);
                                                entity e = trace_ent;
index 7301df4a0968b1142b71d549ec5b408cf4771f28..4ead519eb0ff563390abf8afaf409c1288e79872 100644 (file)
@@ -9,7 +9,6 @@ float cheatcount_total;
 .float cheatcount;
 void CheatInit();
 void CheatShutdown();
-void CheatShutdownClient();
 float CheatImpulse(int imp);
 float CheatCommand(float argc);
 float CheatFrame();
index 0c629560fa0b323b6394bc8fcaae30ba438c2c8f..edf70c120e7f3334f4f2f651403116b77029a614 100644 (file)
@@ -161,147 +161,135 @@ void setplayermodel(entity e, string modelname)
        player_setupanimsformodel();
 }
 
-/*
-=============
-PutObserverInServer
-
-putting a client as observer in the server
-=============
-*/
 void FixPlayermodel(entity player);
+/** putting a client as observer in the server */
 void PutObserverInServer()
 {
        SELFPARAM();
+    bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver);
        PlayerState_detach(this);
-       entity  spot;
-    self.hud = HUD_NORMAL;
-
-       if(IS_PLAYER(self)) { Send_Effect(EFFECT_SPAWN_NEUTRAL, self.origin, '0 0 0', 1); }
-
-       spot = SelectSpawnPoint (true);
-       if(!spot)
-               error("No spawnpoints for observers?!?\n");
-       RemoveGrapplingHook(self); // Wazat's Grappling Hook
-
-       if(IS_REAL_CLIENT(self))
-       {
-               msg_entity = self;
-               WriteByte(MSG_ONE, SVC_SETVIEW);
-               WriteEntity(MSG_ONE, self);
-       }
 
-       self.frags = FRAGS_SPECTATOR;
-       self.bot_attack = false;
+       if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
 
-       bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver);
-
-       Portal_ClearAll(self);
+    {
+        entity spot = SelectSpawnPoint(true);
+        if (!spot) LOG_FATAL("No spawnpoints for observers?!?");
+        this.angles = spot.angles;
+        this.angles_z = 0;
+        this.fixangle = true;
+        // offset it so that the spectator spawns higher off the ground, looks better this way
+        setorigin(this, spot.origin + STAT(PL_VIEW_OFS, NULL));
+        this.prevorigin = this.origin;
+        if (IS_REAL_CLIENT(this))
+        {
+            msg_entity = this;
+            WriteByte(MSG_ONE, SVC_SETVIEW);
+            WriteEntity(MSG_ONE, this);
+        }
+        // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
+        // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
+        setsize(this, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL));
+        this.view_ofs = '0 0 0';
+    }
 
-       Unfreeze(self);
+    RemoveGrapplingHook(this);
+       Portal_ClearAll(this);
+       Unfreeze(this);
 
-       if(self.alivetime)
+       if (this.alivetime)
        {
-               if(!warmup_stage)
-                       PS_GR_P_ADDVAL(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
-               self.alivetime = 0;
+               if (!warmup_stage)
+                       PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+               this.alivetime = 0;
        }
 
-       if(self.vehicle)
-               vehicles_exit(VHEF_RELEASE);
+       if (this.vehicle) vehicles_exit(VHEF_RELEASE);
 
-       WaypointSprite_PlayerDead(self);
+       WaypointSprite_PlayerDead(this);
 
-       if(!mutator_returnvalue)  // mutator prevents resetting teams
-               self.team = -1;  // move this as it is needed to log the player spectating in eventlog
+       if (!mutator_returnvalue)  // mutator prevents resetting teams
+               this.team = -1;  // move this as it is needed to log the player spectating in eventlog
 
-       if(self.killcount != FRAGS_SPECTATOR)
+       if (this.killcount != FRAGS_SPECTATOR)
        {
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname);
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, this.netname);
                if(!intermission_running)
                if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2))
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CHAT_NOSPECTATORS);
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
-               if(self.just_joined == false) {
-                       LogTeamchange(self.playerid, -1, 4);
+               if(this.just_joined == false) {
+                       LogTeamchange(this.playerid, -1, 4);
                } else
-                       self.just_joined = false;
+                       this.just_joined = false;
        }
 
-       PlayerScore_Clear(self); // clear scores when needed
+       PlayerScore_Clear(this); // clear scores when needed
 
-       accuracy_resend(self);
+       accuracy_resend(this);
 
-       self.spectatortime = time;
-
-       self.classname = STR_OBSERVER;
-       self.iscreature = false;
-       self.teleportable = TELEPORT_SIMPLE;
-       self.damagedbycontents = false;
-       self.health = FRAGS_SPECTATOR;
-       self.takedamage = DAMAGE_NO;
-       self.solid = SOLID_NOT;
-       self.movetype = MOVETYPE_FLY_WORLDONLY; // user preference is controlled by playerprethink
-       self.flags = FL_CLIENT | FL_NOTARGET;
-       self.armorvalue = 666;
-       self.effects = 0;
-       self.armorvalue = autocvar_g_balance_armor_start;
-       self.pauserotarmor_finished = 0;
-       self.pauserothealth_finished = 0;
-       self.pauseregen_finished = 0;
-       self.damageforcescale = 0;
-       self.death_time = 0;
-       self.respawn_flags = 0;
-       self.respawn_time = 0;
-       self.stat_respawn_time = 0;
-       self.alpha = 0;
-       self.scale = 0;
-       self.fade_time = 0;
-       self.pain_frame = 0;
-       self.pain_finished = 0;
-       self.strength_finished = 0;
-       self.invincible_finished = 0;
-       self.superweapons_finished = 0;
-       self.pushltime = 0;
-       self.istypefrag = 0;
-       self.think = func_null;
-       self.nextthink = 0;
-       self.hook_time = 0;
-       self.deadflag = DEAD_NO;
-       self.angles = spot.angles;
-       self.angles_z = 0;
-       self.fixangle = true;
-       self.crouch = false;
-       self.revival_time = 0;
-
-       setorigin (self, (spot.origin + STAT(PL_VIEW_OFS, NULL))); // offset it so that the spectator spawns higher off the ground, looks better this way
-       self.prevorigin = self.origin;
-       self.items = 0;
-       self.weapons = '0 0 0';
-       self.model = "";
-       FixPlayermodel(self);
-       setmodel(self, MDL_Null);
-       self.drawonlytoclient = self;
-
-       setsize (self, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL)); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
-       self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
-
-       PS(self).m_weapon = WEP_Null;
-       self.weaponname = "";
-       PS(self).m_switchingweapon = WEP_Null;
-       self.weaponmodel = "";
+       this.spectatortime = time;
+    this.frags = FRAGS_SPECTATOR;
+       this.bot_attack = false;
+    this.hud = HUD_NORMAL;
+       this.classname = STR_OBSERVER;
+       this.iscreature = false;
+       this.teleportable = TELEPORT_SIMPLE;
+       this.damagedbycontents = false;
+       this.health = FRAGS_SPECTATOR;
+       this.takedamage = DAMAGE_NO;
+       this.solid = SOLID_NOT;
+       this.movetype = MOVETYPE_FLY_WORLDONLY; // user preference is controlled by playerprethink
+       this.flags = FL_CLIENT | FL_NOTARGET;
+       this.armorvalue = 666;
+       this.effects = 0;
+       this.armorvalue = autocvar_g_balance_armor_start;
+       this.pauserotarmor_finished = 0;
+       this.pauserothealth_finished = 0;
+       this.pauseregen_finished = 0;
+       this.damageforcescale = 0;
+       this.death_time = 0;
+       this.respawn_flags = 0;
+       this.respawn_time = 0;
+       this.stat_respawn_time = 0;
+       this.alpha = 0;
+       this.scale = 0;
+       this.fade_time = 0;
+       this.pain_frame = 0;
+       this.pain_finished = 0;
+       this.strength_finished = 0;
+       this.invincible_finished = 0;
+       this.superweapons_finished = 0;
+       this.pushltime = 0;
+       this.istypefrag = 0;
+       this.think = func_null;
+       this.nextthink = 0;
+       this.hook_time = 0;
+       this.deadflag = DEAD_NO;
+       this.crouch = false;
+       this.revival_time = 0;
+
+       this.items = 0;
+       this.weapons = '0 0 0';
+       this.model = "";
+       FixPlayermodel(this);
+       setmodel(this, MDL_Null);
+       this.drawonlytoclient = this;
+
+       this.weaponname = "";
+       this.weaponmodel = "";
        for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
-               self.weaponentities[slot] = NULL;
-       }
-       self.exteriorweaponentity = world;
-       self.killcount = FRAGS_SPECTATOR;
-       self.velocity = '0 0 0';
-       self.avelocity = '0 0 0';
-       self.punchangle = '0 0 0';
-       self.punchvector = '0 0 0';
-       self.oldvelocity = self.velocity;
-       self.fire_endtime = -1;
-       self.event_damage = func_null;
+               this.weaponentities[slot] = NULL;
+       }
+       this.exteriorweaponentity = NULL;
+       this.killcount = FRAGS_SPECTATOR;
+       this.velocity = '0 0 0';
+       this.avelocity = '0 0 0';
+       this.punchangle = '0 0 0';
+       this.punchvector = '0 0 0';
+       this.oldvelocity = this.velocity;
+       this.fire_endtime = -1;
+       this.event_damage = func_null;
 }
 
 int player_getspecies(entity this)
@@ -557,7 +545,7 @@ void PutClientInServer()
                this.bot_attack = true;
                this.monster_attack = true;
 
-               this.BUTTON_ATCK = this.BUTTON_JUMP = this.BUTTON_ATCK2 = false;
+               PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
 
                if (this.killcount == FRAGS_SPECTATOR) {
                        PlayerScore_Clear(this);
@@ -996,22 +984,7 @@ void ClientConnect()
 #endif
        this.version_nagtime = time + 10 + random() * 10;
 
-       // TODO: xonstat elo.txt support, until then just 404s
-       if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
-
        ClientState_attach(this);
-       // TODO: fold all of these into ClientState
-       DecodeLevelParms(this);
-       PlayerScore_Attach(this);
-       ClientData_Attach(this);
-       accuracy_init(this);
-       Inventory_new(this);
-       playerdemo_init(this);
-       anticheat_init(this);
-       entcs_attach(this);
-       W_HitPlotOpen(this);
-
-       bot_clientconnect(this);
 
        // identify the right forced team
        if (autocvar_g_campaign)
@@ -1085,20 +1058,9 @@ void ClientConnect()
 
        FixClientCvars(this);
 
-       // Grappling hook
-       stuffcmd(this, "alias +hook +button6\n");
-       stuffcmd(this, "alias -hook -button6\n");
-
-       // Jetpack binds
-       stuffcmd(this, "alias +jetpack +button10\n");
-       stuffcmd(this, "alias -jetpack -button10\n");
-
        // get version info from player
        stuffcmd(this, "cmd clientversion $gameversion\n");
 
-       // get other cvars from player
-       GetCvars(0);
-
        // notify about available teams
        if (teamplay)
        {
@@ -1167,45 +1129,24 @@ Called when a client disconnects from the server
 */
 .entity chatbubbleentity;
 void ReadyCount();
-void ClientDisconnect ()
+void ClientDisconnect()
 {
        SELFPARAM();
-       ClientState_detach(this);
-       if(self.vehicle)
-           vehicles_exit(VHEF_RELEASE);
-
-       if (!IS_CLIENT(self))
-       {
-               LOG_INFO("Warning: ClientDisconnect without ClientConnect\n");
-               return;
-       }
-
-       PlayerStats_GameReport_FinalizePlayer(self);
-
-       if ( self.active_minigame )
-               part_minigame(self);
-
-       if(IS_PLAYER(self)) { Send_Effect(EFFECT_SPAWN_NEUTRAL, self.origin, '0 0 0', 1); }
+       assert(IS_CLIENT(this), return);
 
-       CheatShutdownClient();
+       PlayerStats_GameReport_FinalizePlayer(this);
+       if (this.vehicle) vehicles_exit(VHEF_RELEASE);
+       if (this.active_minigame) part_minigame(this);
+       if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
 
-       W_HitPlotClose(self);
-
-       anticheat_report();
-       anticheat_shutdown();
-
-       playerdemo_shutdown();
-
-       bot_clientdisconnect();
-
-       entcs_detach(self);
+       if (autocvar_sv_eventlog)
+               GameLogEcho(strcat(":part:", ftos(this.playerid)));
 
-       if(autocvar_sv_eventlog)
-               GameLogEcho(strcat(":part:", ftos(self.playerid)));
+       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname);
 
-       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, self.netname);
+    MUTATOR_CALLHOOK(ClientDisconnect);
 
-       MUTATOR_CALLHOOK(ClientDisconnect);
+       ClientState_detach(this);
 
        Portal_ClearAll(self);
 
@@ -1217,40 +1158,23 @@ void ClientDisconnect ()
 
        self.flags &= ~FL_CLIENT;
 
-       if (self.chatbubbleentity)
-               remove (self.chatbubbleentity);
-
-       if (self.killindicator)
-               remove (self.killindicator);
+       if (this.chatbubbleentity) remove(this.chatbubbleentity);
+       if (this.killindicator) remove(this.killindicator);
 
        WaypointSprite_PlayerGone();
 
        bot_relinkplayerlist();
 
-       accuracy_free(self);
-       Inventory_delete(self);
-       ClientData_Detach(this);
-       PlayerScore_Detach(self);
-
-       if(self.netname_previous)
-               strunzone(self.netname_previous);
-       if(self.clientstatus)
-               strunzone(self.clientstatus);
-       if(self.weaponorder_byimpulse)
-               strunzone(self.weaponorder_byimpulse);
+       if (self.netname_previous) strunzone(self.netname_previous);
+       if (self.clientstatus) strunzone(self.clientstatus);
+       if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
+       if (self.personal) remove(self.personal);
 
-       if(self.personal)
-               remove(self.personal);
-
-       self.playerid = 0;
+       this.playerid = 0;
        ReadyCount();
-       VoteCount(false);
-
-       // free cvars
-       GetCvars(-1);
+       if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
 }
 
-.float BUTTON_CHAT;
 void ChatBubbleThink()
 {SELFPARAM();
        self.nextthink = time;
@@ -1268,7 +1192,7 @@ void ChatBubbleThink()
        {
                if ( self.owner.active_minigame )
                        self.mdl = "models/sprites/minigame_busy.iqm";
-               else if ( self.owner.BUTTON_CHAT )
+               else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
                        self.mdl = "models/misc/chatbubble.spr";
        }
 
@@ -1643,7 +1567,7 @@ void SpectateCopy(entity this, entity spectatee)
        self.angles = spectatee.v_angle;
        STAT(FROZEN, self) = STAT(FROZEN, spectatee);
        self.revive_progress = spectatee.revive_progress;
-       if(!self.BUTTON_USE)
+       if(!PHYS_INPUT_BUTTON_USE(self))
                self.fixangle = true;
        setorigin(self, spectatee.origin);
        setsize(self, spectatee.mins, spectatee.maxs);
@@ -1903,12 +1827,12 @@ void PrintWelcomeMessage()
        if(self.motd_actived_time == 0)
        {
                if (autocvar_g_campaign) {
-                       if ((IS_PLAYER(self) && self.BUTTON_INFO) || (!IS_PLAYER(self))) {
+                       if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
                                self.motd_actived_time = time;
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
                        }
                } else {
-                       if (self.BUTTON_INFO) {
+                       if (PHYS_INPUT_BUTTON_INFO(self)) {
                                self.motd_actived_time = time;
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
                        }
@@ -1917,14 +1841,14 @@ void PrintWelcomeMessage()
        else if(self.motd_actived_time > 0) // showing MOTD or campaign message
        {
                if (autocvar_g_campaign) {
-                       if (self.BUTTON_INFO)
+                       if (PHYS_INPUT_BUTTON_INFO(self))
                                self.motd_actived_time = time;
                        else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
                                self.motd_actived_time = 0;
                                Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
                        }
                } else {
-                       if (self.BUTTON_INFO)
+                       if (PHYS_INPUT_BUTTON_INFO(self))
                                self.motd_actived_time = time;
                        else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
                                self.motd_actived_time = 0;
@@ -1934,7 +1858,7 @@ void PrintWelcomeMessage()
        }
        else //if(self.motd_actived_time < 0) // just connected, motd is active
        {
-               if(self.BUTTON_INFO) // BUTTON_INFO hides initial MOTD
+               if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
                        self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
                else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
                {
@@ -1954,21 +1878,21 @@ void ObserverThink()
        }
        float prefered_movetype;
        if (self.flags & FL_JUMPRELEASED) {
-               if (self.BUTTON_JUMP && !self.version_mismatch) {
+               if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
                        self.flags &= ~FL_JUMPRELEASED;
                        self.flags |= FL_SPAWNING;
-               } else if(self.BUTTON_ATCK && !self.version_mismatch) {
+               } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
                        self.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext()) {
                                self.classname = STR_SPECTATOR;
                        }
                } else {
-                       prefered_movetype = ((!self.BUTTON_USE ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+                       prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
                        if (self.movetype != prefered_movetype)
                                self.movetype = prefered_movetype;
                }
        } else {
-               if (!(self.BUTTON_ATCK || self.BUTTON_JUMP)) {
+               if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
                        self.flags |= FL_JUMPRELEASED;
                        if(self.flags & FL_SPAWNING)
                        {
@@ -1988,10 +1912,10 @@ void SpectatorThink()
                        self.impulse = 0;
        }
        if (self.flags & FL_JUMPRELEASED) {
-               if (self.BUTTON_JUMP && !self.version_mismatch) {
+               if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
                        self.flags &= ~FL_JUMPRELEASED;
                        self.flags |= FL_SPAWNING;
-               } else if(self.BUTTON_ATCK || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
+               } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
                        self.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext()) {
                                self.classname = STR_SPECTATOR;
@@ -2009,7 +1933,7 @@ void SpectatorThink()
                                PutClientInServer();
                        }
                        self.impulse = 0;
-               } else if (self.BUTTON_ATCK2) {
+               } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
                        self.flags &= ~FL_JUMPRELEASED;
                        self.classname = STR_OBSERVER;
                        PutClientInServer();
@@ -2018,7 +1942,7 @@ void SpectatorThink()
                                PutObserverInServer();
                }
        } else {
-               if (!(self.BUTTON_ATCK || self.BUTTON_ATCK2)) {
+               if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
                        self.flags |= FL_JUMPRELEASED;
                        if(self.flags & FL_SPAWNING)
                        {
@@ -2230,9 +2154,9 @@ void PlayerPreThink ()
 
        if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
        {
-               if(self.BUTTON_USE && !self.usekeypressed)
+               if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
                        PlayerUseKey();
-               self.usekeypressed = self.BUTTON_USE;
+               self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
        }
 
        if(IS_REAL_CLIENT(self))
@@ -2279,7 +2203,7 @@ void PlayerPreThink ()
                                float button_pressed;
                                if(frametime)
                                        player_anim();
-                               button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
+                               button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
 
                                if (self.deadflag == DEAD_DYING)
                                {
@@ -2329,7 +2253,7 @@ void PlayerPreThink ()
 
                self.prevorigin = self.origin;
 
-               float do_crouch = self.BUTTON_CROUCH;
+               float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
                if(self.hook.state)
                        do_crouch = 0;
                if(self.vehicle)
@@ -2416,10 +2340,10 @@ void PlayerPreThink ()
        // WEAPONTODO: Add weapon request for this
        if(!zoomstate_set)
                SetZoomState(
-                       self.BUTTON_ZOOM
-                       || self.BUTTON_ZOOMSCRIPT
-                       || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_VORTEX)
-                       || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+                       PHYS_INPUT_BUTTON_ZOOM(self)
+                       || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
+                       || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
+                       || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
                ); // WEAPONTODO
 
        float oldspectatee_status;
index fe0951e8713f18e7d3c17096fd45a8c310c0c678..46743ce2e16955be47952b6321dd50c6212e8fa2 100644 (file)
@@ -361,7 +361,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        {
                this.pusher = attacker;
                this.pushltime = time + autocvar_g_maxpushtime;
-               this.istypefrag = this.BUTTON_CHAT;
+               this.istypefrag = PHYS_INPUT_BUTTON_CHAT(this);
        }
        else if(time < this.pushltime)
        {
@@ -435,7 +435,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                                        {
                                                if(deathtype == DEATH_FALL.m_id)
                                                        PlayerSound(this, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
-                                               else if(this.health > 75) // TODO make a "gentle" version?
+                                               else if(this.health > 75)
                                                        PlayerSound(this, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
                                                else if(this.health > 50)
                                                        PlayerSound(this, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
@@ -514,7 +514,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                if(valid_damage_for_weaponstats)
                        WeaponStats_LogKill(awep.m_id, abot, PS(this).m_weapon.m_id, vbot);
 
-               if(autocvar_sv_gentle < 1) // TODO make a "gentle" version?
+               if(autocvar_sv_gentle < 1)
                if(sound_allowed(MSG_BROADCAST, attacker))
                {
                        if(deathtype == DEATH_DROWN.m_id)
index dd47b86a461e23ad6bf4bc3217164e84e10cbcf7..27755db96f7cf1122731515f0849210c51f34e21 100644 (file)
@@ -6,22 +6,6 @@
 
 #define INDEPENDENT_ATTACK_FINISHED 1
 
-// TODO: deprecated: remove. Replaced by physics.qh PHYS_INPUT_BUTTON_*
-
-#define BUTTON_ATCK       button0
-#define BUTTON_JUMP       button2
-#define BUTTON_ATCK2      button3
-#define BUTTON_ZOOM       button4
-#define BUTTON_CROUCH     button5
-#define BUTTON_HOOK       button6
-#define BUTTON_INFO       button7
-#define BUTTON_DRAG       button8
-#define BUTTON_USE        buttonuse
-#define BUTTON_CHAT       buttonchat
-#define BUTTON_PRYDON     cursor_active
-#define BUTTON_ZOOMSCRIPT button9
-#define BUTTON_JETPACK    button10
-
 // Globals
 
 float g_footsteps, g_grappling_hook, g_instagib;
@@ -106,6 +90,7 @@ void() player_setupanimsformodel;
 .float scheduledrespawntime;
 .float respawntime;
 .float respawntimejitter;
+.float respawntimestart;
 //.float       chasecam;
 
 .float damageforcescale;
index 9258b3e8237c7147ced213d8f26a3eedc4ca5eee..37ccf37ebd8e43247ad795c7dec27272fca96bcd 100644 (file)
@@ -125,7 +125,7 @@ string AppendItemcodes(string s, entity player)
                s = strcat(s, "I");
        if(player.flagcarried != world)
                s = strcat(s, "F");
-       if(player.BUTTON_CHAT)
+       if(PHYS_INPUT_BUTTON_CHAT(player))
                s = strcat(s, "T");
        if(player.kh_next)
                s = strcat(s, "K");
@@ -801,7 +801,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                                        {
                                                if(deathtype != DEATH_FIRE.m_id)
                                                {
-                                                       if(victim.BUTTON_CHAT)
+                                                       if(PHYS_INPUT_BUTTON_CHAT(victim))
                                                                attacker.typehitsound += 1;
                                                        else
                                                                attacker.damage_dealt += damage;
index 4a32779289d12c54f10da05bb6e357b4c8266a89..c0509a3f69b0d5d8386f7d32a218882980618286 100644 (file)
@@ -251,7 +251,7 @@ void GrapplingHookThink()
                                                        self.aiment.nextthink = time + autocvar_g_balance_grapplehook_nade_time; // set time after letting go?
                                                aim_ent.pusher = self.realowner;
                                                aim_ent.pushltime = time + autocvar_g_maxpushtime;
-                                               aim_ent.istypefrag = aim_ent.BUTTON_CHAT;
+                                               aim_ent.istypefrag = PHYS_INPUT_BUTTON_CHAT(aim_ent);
                                        }
                                }
 
@@ -333,7 +333,7 @@ void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float
                {
                        this.realowner.pusher = attacker;
                        this.realowner.pushltime = time + autocvar_g_maxpushtime;
-                       this.realowner.istypefrag = this.realowner.BUTTON_CHAT;
+                       this.realowner.istypefrag = PHYS_INPUT_BUTTON_CHAT(this.realowner);
                }
                RemoveGrapplingHook(this.realowner);
        }
index 416a1584c21a8a38773aebf6680402532b591b80..c57d545debcd0563b650bfd5784176fe580ef02f 100644 (file)
@@ -269,7 +269,9 @@ void cvar_changes_init()
                BADCVAR("g_nexball");
                BADCVAR("g_onslaught");
                BADCVAR("g_race");
+               BADCVAR("g_race_laps_limit");
                BADCVAR("g_race_qualifying_timelimit");
+               BADCVAR("g_race_qualifying_timelimit_override");
                BADCVAR("g_tdm");
                BADCVAR("g_tdm_teams");
                BADCVAR("leadlimit");
@@ -300,47 +302,52 @@ void cvar_changes_init()
 
                // now check if the changes are actually gameplay relevant
 
-               // does nothing visible
+               // does nothing gameplay relevant
                BADCVAR("captureleadlimit_override");
+               BADCVAR("gameversion");
+               BADCVAR("g_allow_oldvortexbeam");
                BADCVAR("g_balance_kill_delay");
-               BADCVAR("g_ca_point_limit");
+               BADCVAR("g_campcheck_distance");
                BADCVAR("g_ca_point_leadlimit");
+               BADCVAR("g_ca_point_limit");
                BADCVAR("g_ctf_captimerecord_always");
                BADCVAR("g_ctf_flag_glowtrails");
                BADCVAR("g_ctf_flag_pickup_verbosename");
                BADCVAR("g_domination_point_leadlimit");
                BADCVAR("g_forced_respawn");
-               BADCVAR("g_freezetag_point_limit");
                BADCVAR("g_freezetag_point_leadlimit");
-               BADCVAR("g_keyhunt_point_leadlimit");
-               BADPREFIX("g_mod_");
+               BADCVAR("g_freezetag_point_limit");
+               BADCVAR("g_hats");
                BADCVAR("g_invasion_point_limit");
+               BADCVAR("g_keyhunt_point_leadlimit");
                BADCVAR("g_nexball_goalleadlimit");
-               BADCVAR("g_tdm_point_limit");
                BADCVAR("g_tdm_point_leadlimit");
+               BADCVAR("g_tdm_point_limit");
                BADCVAR("leadlimit_and_fraglimit");
                BADCVAR("leadlimit_override");
                BADCVAR("pausable");
                BADCVAR("sv_allow_fullbright");
                BADCVAR("sv_checkforpacketsduringsleep");
+               BADCVAR("sv_intermission_cdtrack");
+               BADCVAR("sv_minigames");
+               BADCVAR("sv_namechangetimer");
+               BADCVAR("sv_precacheplayermodels");
                BADCVAR("sv_timeout");
-               BADPREFIX("sv_timeout_");
                BADPREFIX("crypto_");
+               BADPREFIX("gameversion_");
                BADPREFIX("g_chat_");
                BADPREFIX("g_ctf_captimerecord_");
                BADPREFIX("g_maplist_votable_");
+               BADPREFIX("g_mod_");
                BADPREFIX("net_");
                BADPREFIX("prvm_");
                BADPREFIX("skill_");
                BADPREFIX("sv_cullentities_");
                BADPREFIX("sv_maxidle_");
+               BADPREFIX("sv_minigames_");
+               BADPREFIX("sv_timeout_");
                BADPREFIX("sv_vote_");
                BADPREFIX("timelimit_");
-               BADCVAR("gameversion");
-               BADPREFIX("gameversion_");
-               BADCVAR("sv_minigames");
-               BADPREFIX("sv_minigames_");
-               BADCVAR("sv_namechangetimer");
 
                // allowed changes to server admins (please sync this to server.cfg)
                // vi commands:
@@ -385,7 +392,9 @@ void cvar_changes_init()
                BADCVAR("g_mirrordamage");
                BADCVAR("g_nexball_goallimit");
                BADCVAR("g_powerups");
+               BADCVAR("g_spawnshieldtime");
                BADCVAR("g_start_delay");
+               BADCVAR("g_superspectate");
                BADCVAR("g_tdm_teams_override");
                BADCVAR("g_warmup");
                BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
@@ -423,7 +432,6 @@ void cvar_changes_init()
                BADCVAR("sv_vote_simple_majority_factor");
                BADCVAR("teamplay_mode");
                BADCVAR("timelimit_override");
-               BADCVAR("g_spawnshieldtime");
                BADPREFIX("g_warmup_");
                BADPREFIX("sv_ready_restart_");
 
@@ -1290,7 +1298,7 @@ void IntermissionThink()
                return;
 
        if(!mapvote_initialized)
-               if (time < intermission_exittime + 10 && !(self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE))
+               if (time < intermission_exittime + 10 && !(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self)))
                        return;
 
        MapVote_Start();
index 74fa6399f92b3a87d9a5b96365ea92dc84a2de97..9e40e9d59e832a23dd3125724def5879ec9ec055 100644 (file)
@@ -375,6 +375,36 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo)
        return o;
 }
 
+REPLICATE(autoswitch, bool, "cl_autoswitch");
+
+REPLICATE(cvar_cl_allow_uid2name, bool, "cl_allow_uid2name");
+
+REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
+
+REPLICATE(cvar_cl_autotaunt, float, "cl_autotaunt");
+
+REPLICATE(cvar_cl_clippedspectating, bool, "cl_clippedspectating");
+
+REPLICATE(cvar_cl_handicap, float, "cl_handicap");
+
+REPLICATE(cvar_cl_jetpack_jump, bool, "cl_jetpack_jump");
+
+REPLICATE(cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump");
+
+REPLICATE(cvar_cl_newusekeysupported, bool, "cl_newusekeysupported");
+
+REPLICATE(cvar_cl_noantilag, bool, "cl_noantilag");
+
+REPLICATE(cvar_cl_physics, string, "cl_physics");
+
+REPLICATE(cvar_cl_voice_directional, int, "cl_voice_directional");
+
+REPLICATE(cvar_cl_voice_directional_taunt_attenuation, float, "cl_voice_directional_taunt_attenuation");
+
+REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
+
+REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
+
 /**
  * @param f -1: cleanup, 0: request, 1: receive
  */
@@ -393,13 +423,6 @@ void GetCvars(int f)
 
        ReplicateVars(this, s, f);
 
-       GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
-       GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
-       GetCvars_handleFloat(s, f, cvar_cl_jetpack_jump, "cl_jetpack_jump");
-       GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
-       GetCvars_handleString(s, f, cvar_cl_physics, "cl_physics");
-       GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
-       GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
@@ -411,16 +434,8 @@ void GetCvars(int f)
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleFloat(s, f, cvar_cl_weaponimpulsemode, "cl_weaponimpulsemode");
-       GetCvars_handleFloat(s, f, cvar_cl_autotaunt, "cl_autotaunt");
-       GetCvars_handleFloat(s, f, cvar_cl_noantilag, "cl_noantilag");
-       GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
-       GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
 
-       GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
-       GetCvars_handleFloat(s, f, cvar_cl_movement_track_canjump, "cl_movement_track_canjump");
-       GetCvars_handleFloat(s, f, cvar_cl_newusekeysupported, "cl_newusekeysupported");
 
        // fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
        if (f > 0)
index eb650cbc3ffac72804a1df509673fee3b28a2caf..a6d34c0d4af675506a764d79d2284486e88bdacf 100644 (file)
@@ -2715,7 +2715,7 @@ void ctf_ScoreRules(int teams)
 // code from here on is just to support maps that don't have flag and team entities
 void ctf_SpawnTeam (string teamname, int teamcolor)
 {
-       entity this = new(ctf_team);
+       entity this = new_pure(ctf_team);
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
index de67505bbaf819291fb3197dc3f68f583e2fd10b..6720f053a1e438e112a2a54f8a71d110b089e9f1 100644 (file)
@@ -919,7 +919,7 @@ float kh_CheckPlayers(float num)
                float t_team = kh_Team_ByID(num);
                float players = 0;
                FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-                       if(!IS_DEAD(it) && !it.BUTTON_CHAT && it.team == t_team)
+                       if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == t_team)
                                ++players;
                ));
 
@@ -1005,7 +1005,7 @@ void kh_StartRound()  // runs at the start of each round
                players = 0;
                entity my_player = world;
                FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-                       if(!IS_DEAD(it) && !it.BUTTON_CHAT && it.team == teem)
+                       if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
                        {
                                ++players;
                                if(random() * players <= 1)
index 6f263ae448c9b4e96e0bb664bcf43fa1f2d5b83b..69ad7d0c65144deddf03134a68f83704b9861935 100644 (file)
@@ -59,11 +59,11 @@ void playerdemo_open_write(string f)
        PLAYERDEMO_FIELD(func,float,frame) \
        PLAYERDEMO_FIELD(func,float,effects) \
        /* PLAYERDEMO_FIELD(func,float,switchweapon) */ \
-       PLAYERDEMO_FIELD(func,float,BUTTON_ATCK) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_ATCK2) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_CROUCH) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_HOOK) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_USE) \
+       PLAYERDEMO_FIELD(func,float,button0) /* TODO: PHYS_INPUT_BUTTON_ATCK */ \
+       PLAYERDEMO_FIELD(func,float,button3) /* TODO: PHYS_INPUT_BUTTON_ATCK2 */ \
+       PLAYERDEMO_FIELD(func,float,button5) /* TODO: PHYS_INPUT_BUTTON_CROUCH */ \
+       PLAYERDEMO_FIELD(func,float,button6) /* TODO: PHYS_INPUT_BUTTON_HOOK */ \
+       PLAYERDEMO_FIELD(func,float,buttonuse) /* TODO: PHYS_INPUT_BUTTON_USE */ \
        PLAYERDEMO_FIELD(func,float,flags) \
        // end of list
 
index e01a9904f5186c9aee8e4335914b107b9e42e77d..4e4d69b0663aa3344c9ae8682cd702eeb2a612a1 100644 (file)
@@ -349,7 +349,7 @@ float PlayerScore_Add(entity player, float scorefield, float score)
        {
                if(gameover)
                        return 0;
-               backtrace("Adding score to unknown player!");
+               LOG_WARNING("Adding score to unknown player!");
                return 0;
        }
        if(score)
index 022e27608f34016794153f3dc1dbee12f0167b90..0692d90886521cabe42d84eb1477b32aff438cc6 100644 (file)
@@ -15,9 +15,9 @@ bool SpawnPoint_Send(entity this, entity to, int sf)
        WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT);
 
        WriteByte(MSG_ENTITY, self.team);
-       WriteShort(MSG_ENTITY, self.origin.x);
-       WriteShort(MSG_ENTITY, self.origin.y);
-       WriteShort(MSG_ENTITY, self.origin.z);
+       WriteCoord(MSG_ENTITY, self.origin.x);
+       WriteCoord(MSG_ENTITY, self.origin.y);
+       WriteCoord(MSG_ENTITY, self.origin.z);
 
        return true;
 }
@@ -31,9 +31,9 @@ bool SpawnEvent_Send(entity this, entity to, int sf)
        if(autocvar_g_spawn_alloweffects)
        {
                WriteByte(MSG_ENTITY, etof(self.owner));
-               WriteShort(MSG_ENTITY, self.owner.origin.x);
-               WriteShort(MSG_ENTITY, self.owner.origin.y);
-               WriteShort(MSG_ENTITY, self.owner.origin.z);
+               WriteCoord(MSG_ENTITY, self.owner.origin.x);
+               WriteCoord(MSG_ENTITY, self.owner.origin.y);
+               WriteCoord(MSG_ENTITY, self.owner.origin.z);
                send = true;
        }
        else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) )
index 578c941f7f123528dc29318c2a17dce989e5f805..579e6fdff74ea6793a760cebb27b43ced7940e72 100644 (file)
@@ -29,7 +29,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
        {
                if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
                {
-                       objerror("Attempted to spawn a mutator-blocked weapon rejected");
+                       LOG_MAPWARNF("Attempted to spawn a mutator-blocked weapon rejected: prvm_edict server %i", this);
                        startitem_failed = true;
                        return;
                }
index 62d54973c1d8e97184885a45ff21b7d04c3dfed8..6d33ccb06db2dd35e0ca2cab196375ca8dd89426 100644 (file)
@@ -427,7 +427,7 @@ void W_WeaponFrame(entity actor)
                if (actor.(weaponentity).state != WS_CLEAR)
                {
                        Weapon wpn = PS(actor).m_weapon;
-                       w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+                       w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
                        return;
                }
        }
@@ -533,7 +533,7 @@ void W_WeaponFrame(entity actor)
 
                bool block_weapon = false;
                {
-                       bool key_pressed = actor.BUTTON_HOOK && !actor.vehicle;
+                       bool key_pressed = PHYS_INPUT_BUTTON_HOOK(actor) && !actor.vehicle;
                        Weapon off = actor.offhand;
                        if (off && !(actor.weapons & WEPSET(HOOK)))
                        {
@@ -545,7 +545,7 @@ void W_WeaponFrame(entity actor)
                                        W_SwitchWeapon(WEP_HOOK);
                                actor.hook_switchweapon = key_pressed;
                                Weapon h = WEP_HOOK;
-                               block_weapon = (PS(actor).m_weapon == h && (actor.BUTTON_ATCK || key_pressed));
+                               block_weapon = (PS(actor).m_weapon == h && (PHYS_INPUT_BUTTON_ATCK(actor) || key_pressed));
                                h.wr_think(h, actor, weaponentity, block_weapon ? 1 : 0);
                        }
                }
@@ -559,7 +559,7 @@ void W_WeaponFrame(entity actor)
                        if (w)
                        {
                                Weapon e = PS(actor).m_weapon;
-                               e.wr_think(e, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+                               e.wr_think(e, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
                        }
                        else
                        {
@@ -577,7 +577,7 @@ void W_WeaponFrame(entity actor)
                                v_up = up;
                                Weapon wpn = PS(actor).m_weapon;
                                this.weapon_think(wpn, actor, weaponentity,
-                                       (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+                                       PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
                        }
                        else
                        {
@@ -681,7 +681,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int
        // ATTACK_FINISHED(actor, slot) -= actor.reload_time - 1;
 
        Weapon wpn = Weapons_from(PS(actor).m_weapon.m_id);
-       w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+       w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
 }
 
 void W_Reload(entity actor, float sent_ammo_min, string sent_sound)