X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fcasings.qc;h=6068a799f752892a2d1dc8f86b7d412537c0644c;hb=dc647e251ac9cce3239475da19cf24cfdd24bc56;hp=d4d1041c80b5b2bfb63cbf1208021b9cb3ad55af;hpb=dbdc35464a18f62bf550a20eddac9ec16b0eacee;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/casings.qc b/qcsrc/client/casings.qc index d4d1041c8..6068a799f 100644 --- a/qcsrc/client/casings.qc +++ b/qcsrc/client/casings.qc @@ -1,4 +1,17 @@ -.float silent; +#if defined(CSQC) + #include "movetypes.qh" + #include "prandom.qh" + #include "rubble.qh" + + .float cnt; + .float alpha; + .int state; +#elif defined(MENUQC) +#elif defined(SVQC) +#endif + + +.bool silent; void Casing_Delete() { @@ -11,7 +24,7 @@ void Casing_Draw() { self.move_angles_x = 0; self.move_angles_z = 0; - self.flags &~= FL_ONGROUND; + self.flags &= ~FL_ONGROUND; } Movetype_Physics_MatchTicrate(autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy); @@ -44,20 +57,19 @@ void Casing_Touch() if(time >= self.nextthink) { string s; - float f; + int f = floor(prandom() * 3) + 1; - f = floor(prandom() * 3) + 1; switch(self.state) { case 1: - s = strcat("weapons/casings", ftos(f), ".wav"); + s = strcat("weapons/casings", itos(f), ".wav"); break; default: - s = strcat("weapons/brass", ftos(f), ".wav"); + s = strcat("weapons/brass", itos(f), ".wav"); break; } - sound (self, CH_SHOTS, s, VOL_BASE, ATTN_LARGE); + sound (self, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE); } } } @@ -65,25 +77,26 @@ void Casing_Touch() self.nextthink = time + 0.2; } -void Casing_Damage(float thisdmg, float hittype, vector org, vector thisforce) +void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce) { - if(thisforce_z < 0) - thisforce_z = 0; + if(thisforce.z < 0) + thisforce.z = 0; self.move_velocity = self.move_velocity + thisforce + '0 0 100'; - self.move_flags &~= FL_ONGROUND; + self.move_flags &= ~FL_ONGROUND; } void Ent_Casing(float isNew) { entity casing; - casing = RubbleNew("casing"); + casing = RubbleNew("casing"); casing.state = ReadByte(); casing.silent = (casing.state & 0x80); casing.state = (casing.state & 0x7F); casing.origin_x = ReadCoord(); casing.origin_y = ReadCoord(); casing.origin_z = ReadCoord(); + setorigin(casing, casing.origin); casing.velocity = decompressShortVector(ReadShort()); casing.angles_x = ReadByte() * 360 / 256; casing.angles_y = ReadByte() * 360 / 256; @@ -115,11 +128,16 @@ void Ent_Casing(float isNew) } setsize(casing, '0 0 -1', '0 0 -1'); - } - else - Casing_Delete(); - RubbleLimit("casing", autocvar_cl_casings_maxcount, Casing_Delete); + RubbleLimit("casing", autocvar_cl_casings_maxcount, Casing_Delete); + } + else + { + entity oldself = self; + self = casing; + Casing_Delete(); // yes, this IS stupid, but I don't need to duplicate all the read* stuff then + self = oldself; + } } void Casings_Precache()