#include "casings.qh"
+#include <common/replicate.qh>
#include <common/util.qh>
#ifdef CSQC
#if defined(SVQC)
.bool cvar_cl_casings;
+.int cvar_r_drawviewmodel;
#elif defined(CSQC)
bool cvar_cl_casings;
+int cvar_r_drawviewmodel;
#endif
REPLICATE(cvar_cl_casings, bool, "cl_casings");
+REPLICATE(cvar_r_drawviewmodel, int, "r_drawviewmodel");
#ifdef SVQC
void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity)
{
- entity wep = casingowner.(weaponentity);
- vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up;
+ vector org = casingowner.(weaponentity).spawnorigin;
+ org = casingowner.origin + casingowner.view_ofs + org.x * v_forward - org.y * v_right + org.z * v_up;
FOREACH_CLIENT(true, {
- if (!(CS(it).cvar_cl_casings))
+ if (!(CS_CVAR(it).cvar_cl_casings))
+ continue;
+ if (it == casingowner && !(CS_CVAR(it).cvar_r_drawviewmodel))
continue;
msg_entity = it;
//UNSET_ONGROUND(this);
}
- Movetype_Physics_MatchTicrate(this, autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy);
- if (wasfreed(this))
- return; // deleted by touch function
-
this.renderflags = 0;
this.alpha = bound(0, this.cnt - time, 1);
{
Casing_Delete(this);
this.drawmask = 0;
+ return;
}
+
+ Movetype_Physics_MatchTicrate(this, autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy);
+ //if (wasfreed(this))
+ // return; // deleted by touch function
}
SOUND(BRASS1, W_Sound("brass1"));
SOUND(BRASS2, W_Sound("brass2"));
SOUND(BRASS3, W_Sound("brass3"));
Sound SND_BRASS_RANDOM() {
- return Sounds_from(SND_BRASS1.m_id + floor(prandom() * 3));
+ return REGISTRY_GET(Sounds, SND_BRASS1.m_id + floor(prandom() * 3));
}
SOUND(CASINGS1, W_Sound("casings1"));
SOUND(CASINGS2, W_Sound("casings2"));
SOUND(CASINGS3, W_Sound("casings3"));
Sound SND_CASINGS_RANDOM() {
- return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3));
+ return REGISTRY_GET(Sounds, SND_CASINGS1.m_id + floor(prandom() * 3));
}
void Casing_Touch(entity this, entity toucher)
ang_z = ReadByte() * 360 / 256;
return = true;
- Casing casing = RubbleNew("casing");
+ Casing casing = ListNewChildRubble(CasingsNGibs, new(casing));
casing.silent = (_state & 0x80);
casing.state = (_state & 0x7F);
casing.origin = org;
setsize(casing, '0 0 -1', '0 0 -1');
- RubbleLimit("casing", autocvar_cl_casings_maxcount, Casing_Delete);
+ LimitedChildrenRubble(CasingsNGibs, "casing", autocvar_cl_casings_maxcount, Casing_Delete, NULL);
}
#endif