.vector viewmodel_origin, viewmodel_angles;
.float weapon_nextthink;
.float weapon_eta_last;
+.float weapon_switchdelay;
void viewmodel_draw(entity this)
{
{
case WS_RAISE:
{
- // entity newwep = Weapons_from(activeweapon);
- float delay = 0.2; // TODO: newwep.switchdelay_raise;
- f = eta / max(eta, delay);
+ f = eta / max(eta, this.weapon_switchdelay);
break;
}
case WS_DROP:
{
- // entity oldwep = Weapons_from(activeweapon);
- float delay = 0.2; // TODO: newwep.switchdelay_drop;
- f = 1 - eta / max(eta, delay);
+ f = 1 - eta / max(eta, this.weapon_switchdelay);
break;
}
case WS_CLEAR:
viewmodel.state = ReadByte();
viewmodel.weapon_nextthink = ReadFloat();
viewmodel.alpha = ReadByte() / 255;
+ switch (viewmodel.state)
+ {
+ case WS_RAISE:
+ case WS_DROP:
+ viewmodel.weapon_switchdelay = ReadFloat();
+ break;
+ default:
+ viewmodel.weapon_switchdelay = 0;
+ break;
+ }
return true;
}
#endif
WriteByte(channel, weaponentity.state);
WriteFloat(channel, weaponentity.weapon_nextthink);
WriteByte(channel, weaponentity.alpha * 255);
+ Weapon w = Weapons_from(actor.weapon);
+ switch (weaponentity.state)
+ {
+ case WS_RAISE:
+ WriteFloat(channel, w.switchdelay_raise);
+ break;
+ case WS_DROP:
+ WriteFloat(channel, w.switchdelay_drop);
+ break;
+ }
}
#endif