r3394 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Feb 20 19:07:20 EST 2008
Author: lordhavoc
Date: 2008-02-20 19:07:20 -0500 (Wed, 20 Feb 2008)
New Revision: 3394
Modified:
trunk/data/qcsrc/server/cl_weapons.qc
trunk/data/qcsrc/server/cl_weaponsystem.qc
Log:
fixed weapon refire timing (both the approach used by the machinegun and
the approach used by the other weapons)
Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc 2008-02-19 23:01:12 UTC (rev 3393)
+++ trunk/data/qcsrc/server/cl_weapons.qc 2008-02-21 00:07:20 UTC (rev 3394)
@@ -248,10 +248,6 @@
}
}
- // don't let attack_finished fall behind when not firing (must be after weapon_setup calls!)
- if (ATTACK_FINISHED(self) < time)
- ATTACK_FINISHED(self) = time;
-
// call the think code which may fire the weapon
// and do so multiple times to resolve framerate dependency issues if the
// server framerate is very low and the weapon fire rate very high
@@ -261,10 +257,17 @@
{
c = c + 1;
weapon_action(self.weapon, WR_THINK);
- if (self.weapon_nextthink > 0 && time >= self.weapon_nextthink)
+ if (time + frametime * 0.5 >= self.weapon_nextthink)
self.weapon_think();
}
+ // don't let attack_finished fall behind when not firing (must be after weapon_setup calls!)
+ //if (ATTACK_FINISHED(self) < time)
+ // ATTACK_FINISHED(self) = time;
+
+ //if (self.weapon_nextthink < time)
+ // self.weapon_nextthink = time;
+
// update currentammo incase it has changed
if (self.items & IT_CELLS)
self.currentammo = self.ammo_cells;
Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-02-19 23:01:12 UTC (rev 3393)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-02-21 00:07:20 UTC (rev 3394)
@@ -375,10 +375,8 @@
void() w_ready =
{
if (self.weaponentity)
- {
self.weaponentity.state = WS_READY;
- weapon_thinkf(WFRAME_IDLE, 0.1, w_ready);
- }
+ weapon_thinkf(WFRAME_IDLE, 1000000, w_ready);
};
// FIXME: add qw-style client-custom weaponrating (cl_weaponrating)?
@@ -428,7 +426,7 @@
return FALSE;
}
// don't fire if previous attack is not finished
- if (ATTACK_FINISHED(self) > time)
+ if (ATTACK_FINISHED(self) > time + frametime * 0.5)
return FALSE;
// don't fire while changing weapon
if (self.weaponentity.state != WS_READY)
@@ -436,8 +434,12 @@
self.weaponentity.state = WS_INUSE;
// if the weapon hasn't been firing continuously, reset the timer
if (ATTACK_FINISHED(self) < time - frametime * 1.5)
+ {
ATTACK_FINISHED(self) = time;
+ //dprint("resetting attack finished to ", ftos(time), "\n");
+ }
ATTACK_FINISHED(self) = ATTACK_FINISHED(self) + attacktime;
+ //dprint("attack finished ", ftos(ATTACK_FINISHED(self)), "\n");
return TRUE;
};
@@ -470,10 +472,19 @@
}
// VorteX: haste can be added here
- if (self.weapon_think == w_ready || self.weapon_nextthink < time - frametime * 1.5)
+ if (self.weapon_think == w_ready)
+ {
self.weapon_nextthink = time;
+ //dprint("started firing at ", ftos(time), "\n");
+ }
+ if (self.weapon_nextthink < time - frametime * 1.5 || self.weapon_nextthink > time + frametime * 1.5)
+ {
+ self.weapon_nextthink = time;
+ //dprint("reset weapon animation timer at ", ftos(time), "\n");
+ }
self.weapon_nextthink = self.weapon_nextthink + t;
self.weapon_think = func;
+ //dprint("next ", ftos(self.weapon_nextthink), "\n");
if (fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2)
if (t)
More information about the nexuiz-commits
mailing list