diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 05faec6b..4c89538f 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -312,7 +312,7 @@ void hit(int damage, playerent *d, playerent *at, const vec &vel, int gun, bool { if(d==player1 || d->type==ENT_BOT || !m_mp(gamemode)) d->hitpush(damage, vel, at, gun); - if(at==player1 && d!=player1) + if(at==player1 && d!=player1) { extern int hitsound; extern int lasthit; @@ -933,7 +933,9 @@ gun::gun(playerent *owner, int type) : weapon(owner, type) {} bool gun::attack(vec &targ) { int attackmillis = lastmillis-owner->lastaction; + if(timebalance < gunwait) attackmillis += timebalance; if(attackmillisattacking) diff --git a/source/src/weapon.h b/source/src/weapon.h index 7b5dcf30..2365ada4 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -17,14 +17,14 @@ struct weapon int &ammo, &mag, &gunwait, shots; virtual int dynspread(); virtual float dynrecoil(); - int reloading, lastaction; + int reloading, lastaction, timebalance; virtual bool attack(vec &targ) = 0; virtual void attackfx(const vec &from, const vec &to, int millis) = 0; virtual void attackphysics(vec &from, vec &to); virtual void attacksound(); virtual bool reload(); - virtual void reset() {} + virtual void reset() { timebalance = 0; } virtual bool busy() { return false; } virtual int modelanim() = 0; @@ -34,7 +34,7 @@ struct weapon virtual void renderstats(); virtual void renderhudmodel(); virtual void renderaimhelp(bool teamwarning); - + virtual void onselecting(); virtual void ondeselecting() {} virtual void onammopicked() {} @@ -146,7 +146,7 @@ struct pistol : gun struct akimbo : gun { akimbo(playerent *owner); - + bool akimboside; int akimbomillis; int akimbolastaction[2]; @@ -172,7 +172,7 @@ struct knife : weapon void drawstats(); void attackfx(const vec &from, const vec &to, int millis); void renderstats(); - + int flashtime() const; };