diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 4efa258a..991da688 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -1045,12 +1045,12 @@ void renderclient(playerent *d, const char *mdlname, const char *vwepname, int t else if(d->state==CS_EDITING) { anim = ANIM_JUMP|ANIM_END; } else if(d->state==CS_LAGGED) { anim = ANIM_SALUTE|ANIM_LOOP|ANIM_TRANSLUCENT; } else if(lastmillis-d->lastpain<300) { anim = d->crouching ? ANIM_CROUCH_PAIN : ANIM_PAIN; speed = 300.0f/4; varseed += d->lastpain; basetime = d->lastpain; } -// else if(!d->onfloor && d->timeinair>50) { anim = ANIM_JUMP|ANIM_END; } + else if(d->weaponsel==d->lastattackweapon && lastmillis-d->lastaction<300 && d->lastpain < d->lastaction && !d->weaponsel->reloading && (d->weaponsel->type != GUN_GRENADE || ((grenades *)d->weaponsel)->cookingmillis)) + { anim = d->crouching ? ANIM_CROUCH_ATTACK : ANIM_ATTACK; speed = 300.0f/8; basetime = d->lastaction; } else if(!d->onfloor && d->timeinair>50) { anim = (d->crouching ? ANIM_CROUCH_WALK : ANIM_JUMP)|ANIM_END; } - else if(d->weaponsel==d->lastattackweapon && lastmillis-d->lastaction<300 && d->lastpain < d->lastaction) { anim = d->crouching ? ANIM_CROUCH_ATTACK : ANIM_ATTACK; speed = 300.0f/8; basetime = d->lastaction; } else if(!d->move && !d->strafe) { anim = (d->crouching ? ANIM_CROUCH_IDLE : ANIM_IDLE)|ANIM_LOOP; } else { anim = (d->crouching ? ANIM_CROUCH_WALK : ANIM_RUN)|ANIM_LOOP; speed = 1860/d->maxspeed; } - if(d->move < 0) anim |= ANIM_REVERSE; + if(d->move < 0) { anim |= ANIM_REVERSE; } modelattach a[3]; int numattach = 0; if(vwepname) diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index cac1952c..3bf9485a 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -1062,7 +1062,7 @@ void grenadeent::onmoved(const vec &dist) // grenades -grenades::grenades(playerent *owner) : weapon(owner, GUN_GRENADE), inhandnade(NULL), throwwait((13*1000)/40), throwmillis(0), state(GST_NONE) {} +grenades::grenades(playerent *owner) : weapon(owner, GUN_GRENADE), inhandnade(NULL), throwwait((13*1000)/40), throwmillis(0), cookingmillis(0), state(GST_NONE) {} int grenades::flashtime() const { return 0; } @@ -1113,6 +1113,7 @@ bool grenades::attack(vec &targ) void grenades::attackfx(const vec &from, const vec &to, int millis) // other player's grenades { throwmillis = lastmillis-millis; + cookingmillis = millis; if(millis == 0) audiomgr.playsound(S_GRENADEPULL, owner); // activate else if(millis > 0) // throw { @@ -1185,7 +1186,7 @@ void grenades::renderstats() } bool grenades::selectable() { return weapon::selectable() && state != GST_INHAND && mag; } -void grenades::reset() { throwmillis = 0; quicknade = false; state = GST_NONE; } +void grenades::reset() { throwmillis = 0; cookingmillis = 0; quicknade = false; state = GST_NONE; } void grenades::onselecting() { diff --git a/source/src/weapon.h b/source/src/weapon.h index ae9a5ad3..3c648b70 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -59,6 +59,7 @@ struct grenades : weapon grenadeent *inhandnade; const int throwwait; int throwmillis; + int cookingmillis; int state; grenades(playerent *owner);