}
{
static string name_last;
- string name = get_weaponinfo(activeweapon).mdl;
+ string name = Weapons_from(activeweapon).mdl;
if (name != name_last)
{
name_last = name;
CL_WeaponEntity_SetModel(this, name);
- updateanim(this);
- if (!this.animstate_override)
- setanim(this, this.anim_idle, true, false, false);
}
+ anim_update(this);
+ if (!this.animstate_override)
+ anim_set(this, this.anim_idle, true, false, false);
}
float eta = (getstatf(STAT_WEAPON_NEXTTHINK) - time); // TODO: / W_WeaponRateFactor();
float f = 0; // 0..1; 0: fully active
weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
else
#endif
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
}
if((!actor.arc_beam) || wasfreed(actor.arc_beam))
CL_WeaponEntity_SetModel(this, this.owner.weaponname);
}
- this.effects = EF_NODRAW; // TODO: don't render this entity at all
+ this.effects = EF_NODRAW; // TODO: don't render this entity at all
if (this.owner.alpha == default_player_alpha) this.alpha = default_weapon_alpha;
else if (this.owner.alpha != 0) this.alpha = this.owner.alpha;
else this.alpha = 1;
- if (this.weaponchild)
- {
- this.weaponchild.effects = this.effects;
- }
+ if (this.weaponchild) this.weaponchild.effects = this.effects;
}
void CL_ExteriorWeaponentity_Think()
if (mine.owner == actor) return false;
if (thiswep == WEP_SHOTGUN)
- if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false; // no clicking, just allow
+ if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false; // no clicking, just allow
if (thiswep == Weapons_from(actor.switchweapon) && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
{
void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim);
+/**
+ * @param t defer thinking until time + t
+ * @param func next think function
+ */
void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,
.entity weaponentity, int fire) func)
{
fr = this.wframe;
restartanim = false;
}
- else if (fr == WFRAME_IDLE)
- {
- restartanim = false;
- }
else
{
- restartanim = true;
+ restartanim = fr != WFRAME_IDLE;
}
vector of = v_forward;
else // if (fr == WFRAME_RELOAD)
a = this.anim_reload;
a.z *= g_weaponratefactor;
- entity e; FOR_EACH_CLIENT(e) if (e == actor || (IS_SPEC(e) && e.enemy == actor)) {
- wframe_send(e, this, a, restartanim);
- }
+ entity e;
+ FOR_EACH_CLIENT(e) if (e == actor || (IS_SPEC(e) && e.enemy == actor)) wframe_send(e, this, a, restartanim);
}
v_forward = of;
void W_WeaponFrame(entity actor)
{
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
entity this = actor.(weaponentity);
if (frametime) actor.weapon_frametime = frametime;
- if (!this || actor.health < 1) return; // Dead player can't use weapons and injure impulse commands
+ if (!this || actor.health < 1) return; // Dead player can't use weapons and injure impulse commands
if (forbidWeaponUse(actor))