3 float w_deathtype, w_issilent, w_random;
4 vector w_org, w_backoff;
6 void Ent_DamageInfo(float isNew)
8 float dmg, rad, edge, thisdmg, forcemul;
9 vector force, thisforce;
14 w_deathtype = ReadShort();
15 w_issilent = (w_deathtype & 0x8000);
16 w_deathtype = (w_deathtype & 0x7FFF);
18 w_org_x = ReadCoord();
19 w_org_y = ReadCoord();
20 w_org_z = ReadCoord();
25 force = decompressShortVector(ReadShort());
38 for(self = findradius(w_org, rad); self; self = self.chain)
42 thisdmg = vlen(self.origin - w_org) / rad;
47 thisdmg = dmg + (edge - dmg) * thisdmg;
48 thisforce = forcemul * vlen(force) * (thisdmg / dmg) * normalize(self.origin - w_org);
53 thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
59 thisforce = forcemul * force;
62 //print("check ", ftos(num_for_edict(self)), " ", self.classname, "\n");
63 //print(ftos(self.damageforcescale), "\n");
64 //print(vtos(thisforce), "\n");
65 if(self.damageforcescale)
68 self.move_velocity = self.move_velocity + self.damageforcescale * thisforce;
69 self.move_flags &~= FL_ONGROUND;
70 //print("pushed ", ftos(num_for_edict(self)), " loose\n");
77 self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
82 // TODO spawn particle effects and sounds based on w_deathtype
84 if(!DEATH_ISSPECIAL(w_deathtype))
88 hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype);
91 traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world);
92 if(trace_fraction < 1 && hitwep != WEP_NEX && hitwep != WEP_MINSTANEX)
93 w_backoff = trace_plane_normal;
95 w_backoff = -1 * normalize(force);
96 setorigin(self, w_org + w_backoff * 2); // for sound() calls
98 (get_weaponinfo(hitwep)).weapon_func(WR_IMPACTEFFECT);
102 void DamageInfo_Precache()
105 for(i = WEP_FIRST; i <= WEP_LAST; ++i)
106 (get_weaponinfo(i)).weapon_func(WR_PRECACHE);