[Quake-C] Counting hits in FireBullets ()
Quake C mods and support - SSQC / CSQC
Brought to you by:
teknoskillz
From: Cobalt <co...@te...> - 2015-12-24 21:51:47
|
Experimenting a little trying to tell if the shotcount winds up contacting multiple players / clients to give credit for possible multifrag. Came up with this so far....seems to sort of work, but not sure if it can be improved? void (float shotcount, vector dir, vector spread) FireBullets = { local vector direction; local vector src; local entity a,b,c; makevectors (self.v_angle); src = (self.origin + (v_forward * MOVETYPE_BOUNCE)); src_z = (self.absmin_z + (self.size_z * 0.700)); ClearMultiDamage (); while (shotcount > 0) { direction = ((dir + ((crandom () * spread_x) * v_right)) + ((crandom () * spread_y) * v_up)); traceline (src,(src + (direction * FL_WATERJUMP)),FALSE,self); if (trace_fraction != 1) { if (trace_ent.flags & FL_CLIENT) // count hits for a player { if (a == world) a = trace_ent; else { if (trace_ent != a && b == world) b = trace_ent; else if (c != a && c != b && c == world) c = trace_ent; } } // heres where it gets buggy maybe ? max is 3 players hit if (a != world && b != world && b != a) bprint ("Hit 2 players\n"); if (a != world && b == world && c == world) bprint ("Hit 1 player\n"); if (a != world && b != world && c == trace_ent) bprint ("Hit 3 players\n"); TraceAttack (MOVETYPE_STEP,direction); } shotcount = shotcount - 1; } ApplyMultiDamage (); }; |