X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Feffects%2Fqc%2Fcasings.qc;h=589e343c8df91ae795a94c1375903c429ae17296;hp=60f9633027eb2125d0278bd6abaaa2cb9ed1505a;hb=565754a35f9e84a3b8e6eac08635ec27145b369a;hpb=768c6757ba5495053ebc2dd75f6c728e07a4af70 diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 60f963302..589e343c8 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -9,9 +9,19 @@ REGISTER_NET_TEMP(casings) +#if defined(SVQC) +.bool cvar_cl_casings; +#elif defined(CSQC) +bool cvar_cl_casings; +#endif +REPLICATE(cvar_cl_casings, bool, "cl_casings"); + #ifdef SVQC void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity) { + if (!(CS(casingowner).cvar_cl_casings)) + return; + 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; @@ -20,9 +30,7 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran WriteHeader(MSG_ALL, casings); WriteByte(MSG_ALL, casingtype); - WriteCoord(MSG_ALL, org.x); - WriteCoord(MSG_ALL, org.y); - WriteCoord(MSG_ALL, org.z); + WriteVector(MSG_ALL, org); WriteShort(MSG_ALL, compressShortVector(vel)); // actually compressed velocity WriteByte(MSG_ALL, ang.x * 256 / 360); WriteByte(MSG_ALL, ang.y * 256 / 360); @@ -32,10 +40,10 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran #ifdef CSQC entityclass(Casing); -class(Casing) .float alpha; -class(Casing) .bool silent; -class(Casing) .int state; -class(Casing) .float cnt; +classfield(Casing) .float alpha; +classfield(Casing) .bool silent; +classfield(Casing) .int state; +classfield(Casing) .float cnt; void Casing_Delete(entity this) { @@ -123,10 +131,7 @@ void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector t NET_HANDLE(casings, bool isNew) { int _state = ReadByte(); - vector org; - org_x = ReadCoord(); - org_y = ReadCoord(); - org_z = ReadCoord(); + vector org = ReadVector(); vector vel = decompressShortVector(ReadShort()); vector ang; ang_x = ReadByte() * 360 / 256; @@ -134,8 +139,6 @@ NET_HANDLE(casings, bool isNew) ang_z = ReadByte() * 360 / 256; return = true; - if (!autocvar_cl_casings) return; - Casing casing = RubbleNew("casing"); casing.silent = (_state & 0x80); casing.state = (_state & 0x7F);