-.float silent;
+#if defined(CSQC)
+ #include "../common/movetypes/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()
{
{
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);
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);
}
}
}
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;
}
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()