]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamec/g_damage.c
PLEASE TEST: Improved LMS display in the scoreboard (dead players now have -place...
[divverent/nexuiz.git] / data / qcsrc / server / gamec / g_damage.c
1
2 float checkrules_firstblood;
3
4 void GiveFrags (entity attacker, entity targ, float f)
5 {
6
7         if(gameover) return;
8
9         if(f > 0 && cvar("g_domination") && cvar("g_domination_disable_frags"))
10                 return;
11         else if(f > 0 && cvar("g_runematch"))
12                 f = RunematchHandleFrags(attacker, targ, f);
13         else if(cvar("g_lms"))
14         {
15                 // count remaining lives, not frags in lms
16                 targ.frags -= 1;
17                 // keep track of the worst players lives
18                 if(targ.frags < lms_lowest_lives)
19                         lms_lowest_lives = targ.frags;
20                 // player has no more lives left
21                 if (!targ.frags)
22                 {
23                         lms_dead_count += 1;
24                         if(!lms_next_place)
25                                 lms_next_place = player_count;
26                         targ.frags = -lms_next_place;
27                         lms_next_place -= 1;
28                 }
29                 return;
30         }
31
32         if(f)
33                 attacker.frags = attacker.frags + f;
34 }
35
36 string AppendItemcodes(string s, entity player)
37 {
38         float w;
39         w = player.weapon;
40         if(w == 0)
41                 w = player.switchweapon;
42         if(w == 0)
43                 w = player.cnt; // previous weapon!
44         s = strcat(s, ftos(weapon_translateindextoflag(w)));
45         if(time < player.strength_finished)
46                 s = strcat(s, "S");
47         if(time < player.invincible_finished)
48                 s = strcat(s, "I");
49         if(player.flagcarried != world)
50                 s = strcat(s, "F");
51         if(player.runes)
52                 s = strcat(s, "|", ftos(player.runes));
53         return s;
54 }
55
56 void LogDeath(string mode, float deathtype, entity killer, entity killed)
57 {
58         string s;
59         if(!cvar("sv_eventlog"))
60                 return;
61         s = strcat(":kill:", mode);
62         s = strcat(s, ":", ftos(killer.playerid));
63         s = strcat(s, ":", ftos(killed.playerid));
64         s = strcat(s, ":type=", ftos(deathtype));
65         s = strcat(s, ":items=");
66         s = AppendItemcodes(s, killer);
67         if(killed != killer)
68         {
69                 s = strcat(s, ":victimitems=");
70                 s = AppendItemcodes(s, killed);
71         }
72         GameLogEcho(s, FALSE);
73 }
74
75 void Obituary (entity attacker, entity targ, float deathtype)
76 {
77         string  s, m;
78
79         if (targ.classname == "player" || targ.classname == "corpse")
80         {
81                 if (targ.classname == "corpse")
82                         s = "A corpse";
83                 else
84                         s = targ.netname;
85
86                 if (targ == attacker)
87                 {
88                         if (deathtype == DEATH_NOAMMO)
89                                 centerprint(targ, strcat("^1You were killed for running out of ammo...\n\n\n"));
90                         if (deathtype == DEATH_TEAMCHANGE)
91                         {
92                                 m = "You are now on: ";
93                                 if (targ.team == 5)
94                                         m = strcat(m, "^1Red Team");
95                                 else if (targ.team == 14)
96                                         m = strcat(m, "^4Blue Team");
97                                 else if (targ.team == 10)
98                                         m = strcat(m, "^6Pink Team");
99                                 else if (targ.team == 13)
100                                         m = strcat(m, "^3Yellow Team");
101                                 centerprint(targ, m);
102                         }
103                         else if (deathtype == DEATH_AUTOTEAMCHANGE)
104                         {
105                                 m = "You have been moved into a different team to improve team balance\nYou are now on: ";
106                                 if (targ.team == 5)
107                                         m = strcat(m, "^1Red Team");
108                                 else if (targ.team == 14)
109                                         m = strcat(m, "^4Blue Team");
110                                 else if (targ.team == 10)
111                                         m = strcat(m, "^6Pink Team");
112                                 else if (targ.team == 13)
113                                         m = strcat(m, "^3Yellow Team");
114                                 centerprint(targ, m);
115                                 return;
116                         }
117                         else if (deathtype == DEATH_CAMP)
118                                 centerprint(targ, strcat("^1Die camper!\n\n\n"));
119                         else
120                                 centerprint(targ, strcat("^1You killed your own dumb self!\n\n\n"));
121
122                         if (deathtype == IT_GRENADE_LAUNCHER)
123                                 bprint ("^1",s, "^1 detonated\n");
124                         else if (deathtype == IT_ELECTRO)
125                                 bprint ("^1",s, "^1 played with plasma\n");
126                         else if (deathtype == IT_ROCKET_LAUNCHER)
127                                 bprint ("^1",s, "^1 exploded\n");
128                         else if (deathtype == DEATH_KILL)
129                                 bprint ("^1",s, "^1 couldn't take it anymore\n");
130                         else if (deathtype == DEATH_NOAMMO)
131                         {
132                                 bprint ("^7",s, " ^7committed suicide. What's the point of living without ammo?\n");
133                                 //sound (self, CHAN_BODY, "minstagib/mockery.ogg", 1, ATTN_NONE);
134                         }
135                         else if (deathtype == DEATH_CAMP)
136                                 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
137                         else if (deathtype != DEATH_TEAMCHANGE)
138                                 bprint ("^1",s, "^1 couldn't resist the urge to self-destruct\n");
139
140                         if(deathtype != DEATH_TEAMCHANGE)
141                                 LogDeath("suicide", deathtype, targ, targ);
142
143                         GiveFrags(attacker, targ, -1);
144                         //targ.frags = targ.frags - 1;
145                         if (targ.killcount > 2)
146                                 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," kill spree\n");
147                 }
148                 else if (teamplay && attacker.team == targ.team)
149                 {
150                         centerprint(attacker, strcat("^1Moron! You fragged a teammate!\n\n\n"));
151                         bprint ("^1", attacker.netname, "^1 mows down a teammate\n");
152                         GiveFrags(attacker, targ, -1);
153                         //attacker.frags = attacker.frags - 1;
154                         if (targ.killcount > 2)
155                                 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," kill spree was endeded by a teammate!\n");
156                         if (attacker.killcount > 2)
157                                 bprint ("^1",attacker.netname,"^1 ended a ",ftos(attacker.killcount)," kill spree by killing a teammate\n");
158                         attacker.killcount = 0;
159
160                         LogDeath("tk", deathtype, attacker, targ);
161                 }
162                 else if (attacker.classname == "player" || attacker.classname == "gib")
163                 {
164                         if (!checkrules_firstblood)
165                         {
166                                 checkrules_firstblood = TRUE;
167                                 //sound(world, CHAN_AUTO, "announcer/firstblood.wav", 1, ATTN_NONE);
168                                 //if (cvar("g_minstagib"))
169                                         //sound(world, CHAN_AUTO, "announce/male/mapkill1.ogg", 1, ATTN_NONE);
170                                 bprint("^1",attacker.netname, "^1 drew first blood", "\n");
171                         }
172
173                         centerprint(attacker, strcat("^4You fragged ^7", s, "\n\n\n"));
174                         centerprint(targ, strcat("^1You were fragged by ^7", attacker.netname, "\n\n\n"));
175
176                         if (deathtype == IT_LASER)
177                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
178                         else if (deathtype == IT_UZI)
179                                 bprint ("^1",s, "^1 was riddled full of holes by ", attacker.netname, "\n");
180                         else if (deathtype == IT_SHOTGUN)
181                                 bprint ("^1",s, "^1 was gunned by ", attacker.netname, "\n");
182                         else if (deathtype == IT_GRENADE_LAUNCHER)
183                                 bprint ("^1", s, "^1 was blasted by ", attacker.netname, "\n");
184                         else if (deathtype == IT_ELECTRO)
185                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
186                         else if (deathtype == IT_CRYLINK)
187                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
188                         else if (deathtype == IT_NEX)
189                                 bprint ("^1",s, "^1 has been vaporized by ", attacker.netname, "\n");
190                         else if (deathtype == IT_HAGAR)
191                                 bprint ("^1",s, "^1 was pummeled by ", attacker.netname, "\n");
192                         else if (deathtype == IT_ROCKET_LAUNCHER)
193                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
194                         else if (deathtype == DEATH_TELEFRAG)
195                                 bprint ("^1",s, "^1 was telefragged by ", attacker.netname, "\n");
196                         else if (deathtype == DEATH_DROWN)
197                                 bprint ("^1",s, "^1 was drowned by ", attacker.netname, "\n");
198                         else if (deathtype == DEATH_SLIME)
199                                 bprint ("^1",s, "^1 was slimed by ", attacker.netname, "\n");
200                         else if (deathtype == DEATH_LAVA)
201                                 bprint ("^1",s, "^1 was cooked by ", attacker.netname, "\n");
202                         else if (deathtype == DEATH_FALL)
203                                 bprint ("^1",s, "^1 was grounded by ", attacker.netname, "\n");
204                         else if (deathtype == DEATH_SWAMP)
205                                 bprint ("^1",s, "^1 was conserved by ", attacker.netname, "\n");
206                         else if (deathtype == DEATH_HURTTRIGGER)
207                                 bprint ("^1",s, "^1 was thrown into a world of hurt by ", attacker.netname, "\n");
208                         else
209                                 bprint ("^1",s, "^1 was fragged by ", attacker.netname, "\n");
210
211                         GiveFrags(attacker, targ, 1);
212                         //attacker.frags = attacker.frags + 1;
213                         if (targ.killcount > 2)
214                                 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " kill spree was ended by ", attacker.netname, "\n");
215                         attacker.killcount = attacker.killcount + 1;
216                         if (attacker.killcount > 2)
217                                 bprint ("^1",attacker.netname,"^1 has ",ftos(attacker.killcount)," frags in a row\n");
218
219                         LogDeath("frag", deathtype, attacker, targ);
220
221                         if (attacker.killcount == 3)
222                         {
223                                 bprint (attacker.netname,"^7 made a ^1TRIPLE FRAG\n");
224                                 stuffcmd(attacker, "play2 announcer/male/03kills.ogg\n");
225                         }
226                         else if (attacker.killcount == 5)
227                         {
228                                 bprint (attacker.netname,"^7 made a ^1FIVE FRAG COMBO\n");
229                                 stuffcmd(attacker, "play2 announcer/male/05kills.ogg\n");
230                         }
231                         else if (attacker.killcount == 10)
232                         {
233                                 bprint (attacker.netname,"^7 is on a ^1RAGE\n");
234                                 stuffcmd(attacker, "play2 announcer/male/10kills.ogg\n");
235                         }
236                         else if (attacker.killcount == 15)
237                         {
238                                 bprint (attacker.netname,"^7 has done a ^1MASSACRE!\n");
239                                 stuffcmd(attacker, "play2 announcer/male/15kills.ogg\n");
240                         }
241                         else if (attacker.killcount == 20)
242                         {
243                                 bprint (attacker.netname,"^7 is ^1UNHUMAN!\n");
244                                 stuffcmd(attacker, "play2 announcer/male/20kills.ogg\n");
245                         }
246                         else if (attacker.killcount == 25)
247                         {
248                                 bprint (attacker.netname,"^7 is a ^1DEATH INCARNATION!\n");
249                                 stuffcmd(attacker, "play2 announcer/male/25kills.ogg\n");
250                         }
251                         else if (attacker.killcount == 30)
252                         {
253                                 bprint (attacker.netname,"^7 is maybe a ^1AIMBOTTER?!\n");
254                                 stuffcmd(attacker, "play2 announcer/male/30kills.ogg\n");
255                         }
256                 }
257                 else
258                 {
259                         centerprint(targ, strcat("^1Watch your step!\n\n\n"));
260                         if (deathtype == DEATH_HURTTRIGGER && attacker.message != "")
261                                 bprint ("^1",s, "^1 ", attacker.message, "\n");
262                         else if (deathtype == DEATH_DROWN)
263                                 bprint ("^1",s, "^1 drowned\n");
264                         else if (deathtype == DEATH_SLIME)
265                                 bprint ("^1",s, "^1 was slimed\n");
266                         else if (deathtype == DEATH_LAVA)
267                                 bprint ("^1",s, "^1 turned into hot slag\n");
268                         else if (deathtype == DEATH_FALL)
269                                 bprint ("^1",s, "^1 hit the ground with a crunch\n");
270                         else if (deathtype == DEATH_SWAMP)
271                                 bprint ("^1",s, "^1 is now conserved for centuries to come\n");
272                         else
273                                 bprint ("^1",s, "^1 died\n");
274                         GiveFrags(targ, targ, -1);
275                         if(targ.frags == -5) {
276                                 stuffcmd(targ, "play2 announcer/male/botlike.ogg\n");
277                         }
278
279                         //targ.frags = targ.frags - 1;
280                         if (targ.killcount > 2)
281                                 bprint ("^1",s,"^1 died with a ",ftos(targ.killcount)," kill spree\n");
282
283                         LogDeath("accident", deathtype, targ, targ);
284                 }
285                 // FIXME: this should go in PutClientInServer
286                 if (targ.killcount)
287                         targ.killcount = 0;
288         }
289 }
290
291 // these are updated by each Damage call for use in button triggering and such
292 entity damage_targ;
293 entity damage_inflictor;
294 entity damage_attacker;
295
296 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
297 {
298         if (gameover || targ.killcount == -666)
299                 return;
300
301         local entity oldself;
302         oldself = self;
303         self = targ;
304         damage_targ = targ;
305         damage_inflictor = inflictor;
306         damage_attacker = attacker;
307         // nullify damage if teamplay is on
308         if (teamplay)
309         if (attacker.team)
310         if (attacker.team == targ.team)
311         if ((teamplay == 1 || teamplay == 3) && attacker != targ)
312                 damage = 0;
313
314         if(cvar("g_lms"))
315         if(targ.classname == "player")
316         if(attacker.classname == "player")
317         if(attacker != targ)
318         {
319                 targ.lms_traveled_distance = cvar("g_lms_campcheck_distance");
320                 attacker.lms_traveled_distance = cvar("g_lms_campcheck_distance");
321         }
322
323         if(damage > 0 && targ != attacker && clienttype(attacker) == CLIENTTYPE_REAL && targ.classname == "player")
324                 stuffcmd(attacker, "play2 misc/hit.wav\n");
325
326         if (cvar("g_minstagib"))
327         {
328                 if ((deathtype == DEATH_FALL)  ||
329                     (deathtype == DEATH_DROWN) ||
330                     (deathtype == DEATH_SLIME) ||
331                     (deathtype == DEATH_LAVA))
332                         return;
333                 if (targ.extralives && (deathtype == IT_NEX) && damage)
334                 {
335                         targ.extralives -= 1;
336                         centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.extralives),"\n"));
337                         damage = 0;
338                         targ.armorvalue = targ.extralives;
339                         if(clienttype(targ) == CLIENTTYPE_REAL) stuffcmd(targ, "play2 misc/hit.wav\n");
340                         //stuffcmd(attacker, "play2 misc/hit.wav\n");
341                 }
342                 else if (deathtype == IT_NEX && targ.items & IT_STRENGTH)
343                 {
344                         if(clienttype(attacker) == CLIENTTYPE_REAL) stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n");
345                 }
346                 if (deathtype == IT_LASER)
347                 {
348                         damage = 0;
349                         if (targ != attacker)
350                         {
351                                 if (targ.classname == "player")
352                                         centerprint(attacker, "Secondary fire inflicts no damage!\n");
353                                 damage = 0;
354                                 force = '0 0 0';
355                                 attacker = targ;
356                         }
357                 }
358         } else {
359                 if (deathtype == IT_NEX && !(attacker.flags & FL_ONGROUND) && !(targ.flags & FL_ONGROUND) && attacker.waterlevel < 2 && targ.waterlevel < 2 && attacker.killcount != 3 && attacker.killcount != 5 && attacker.killcount != 10 && attacker.killcount != 15 && attacker.killcount != 20 && attacker.killcount != 25 && attacker.killcount != 30)
360                 {
361                         if(clienttype(attacker) == CLIENTTYPE_REAL)  stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n");
362                 }
363         }
364
365         // apply strength multiplier
366         if (attacker.items & IT_STRENGTH && !cvar("g_minstagib"))
367         {
368                 damage = damage * cvar("g_balance_powerup_strength_damage");
369                 force = force * cvar("g_balance_powerup_strength_force");
370         }
371         // apply invincibility multiplier
372         if (targ.items & IT_INVINCIBLE && !cvar("g_minstagib"))
373                 damage = damage * cvar("g_balance_powerup_invincible_takedamage");
374
375
376         if(cvar("g_runematch"))
377         {
378                 // apply strength rune
379                 if (attacker.runes & RUNE_STRENGTH)
380                 {
381                         if(attacker.runes & CURSE_WEAK) // have both curse & rune
382                         {
383                                 damage = damage * cvar("g_balance_rune_strength_combo_damage");
384                                 force = force * cvar("g_balance_rune_strength_combo_force");
385                         }
386                         else
387                         {
388                                 damage = damage * cvar("g_balance_rune_strength_damage");
389                                 force = force * cvar("g_balance_rune_strength_force");
390                         }
391                 }
392                 else if (attacker.runes & CURSE_WEAK)
393                 {
394                         damage = damage * cvar("g_balance_curse_weak_damage");
395                         force = force * cvar("g_balance_curse_weak_force");
396                 }
397
398                 // apply defense rune
399                 if (targ.runes & RUNE_DEFENSE)
400                 {
401                         if (targ.runes & CURSE_VULNER) // have both curse & rune
402                                 damage = damage * cvar("g_balance_rune_defense_combo_takedamage");
403                         else
404                                 damage = damage * cvar("g_balance_rune_defense_takedamage");
405                 }
406                 else if (targ.runes & CURSE_VULNER)
407                         damage = damage * cvar("g_balance_curse_vulner_takedamage");
408         }
409
410         // apply push
411         if (self.damageforcescale)
412         {
413                 self.velocity = self.velocity + self.damageforcescale * force;
414                 self.flags = self.flags - (self.flags & FL_ONGROUND);
415         }
416         // apply damage
417         if (self.event_damage)
418                 self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
419         self = oldself;
420
421         if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
422         {
423                 // Savage: vampire mode
424                 if(cvar("g_vampire") && !cvar("g_minstagib"))
425                 {
426                         attacker.health += damage;
427                 }
428                 if(cvar("g_runematch"))
429                 {
430                         if (attacker.runes & RUNE_VAMPIRE)
431                         {
432                         // apply vampire rune
433                                 if (attacker.runes & CURSE_EMPATHY) // have the curse too
434                                 {
435                                         //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb");
436                                         attacker.health = bound(
437                                                 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 40
438                                                 attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"),
439                                                 cvar("g_balance_rune_vampire_maxhealth"));      // LA: was 1000, now 500
440                                 }
441                                 else
442                                 {
443                                         //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_absorb");
444                                         attacker.health = bound(
445                                                 attacker.health,        // LA: was 3, but changed so that you can't lose health
446                                                                                         // empathy won't let you gain health in the same way...
447                                                 attacker.health + damage * cvar("g_balance_rune_vampire_absorb"),
448                                                 cvar("g_balance_rune_vampire_maxhealth"));      // LA: was 1000, now 500
449                                         }
450                         }
451                         // apply empathy curse
452                         else if (attacker.runes & CURSE_EMPATHY)
453                         {
454                                 attacker.health = bound(
455                                         cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 20
456                                         attacker.health + damage * cvar("g_balance_curse_empathy_takedamage"),
457                                         attacker.health);
458                         }
459                 }
460         }
461 }
462
463 void RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype)
464 {
465         entity  targ;
466         float   finaldmg;
467         float   power;
468         vector  blastorigin;
469         vector  force;
470         vector  m1;
471         vector  m2;
472         vector  nearest;
473         vector  diff;
474
475         blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
476
477         targ = findradius (blastorigin, rad);
478         while (targ)
479         {
480                 if (targ != inflictor)
481                         if (ignore != targ)
482                         {
483                                 // LordHavoc: measure distance to nearest point on target (not origin)
484                                 // (this guarentees 100% damage on a touch impact)
485                                 nearest = blastorigin;
486                                 m1 = targ.origin + targ.mins;
487                                 m2 = targ.origin + targ.maxs;
488                                 if (nearest_x < m1_x) nearest_x = m1_x;
489                                 if (nearest_y < m1_y) nearest_y = m1_y;
490                                 if (nearest_z < m1_z) nearest_z = m1_z;
491                                 if (nearest_x > m2_x) nearest_x = m2_x;
492                                 if (nearest_y > m2_y) nearest_y = m2_y;
493                                 if (nearest_z > m2_z) nearest_z = m2_z;
494                                 diff = nearest - blastorigin;
495                                 // round up a little on the damage to ensure full damage on impacts
496                                 // and turn the distance into a fraction of the radius
497                                 power = 1 - ((vlen (diff) - 2) / rad);
498                                 //bprint(" ");
499                                 //bprint(ftos(power));
500                                 if (power > 0)
501                                 {
502                                         if (power > 1)
503                                                 power = 1;
504                                         finaldmg = coredamage * power + edgedamage * (1 - power);
505                                         if (finaldmg > 0)
506                                         {
507                                                 force = normalize((m1 + m2) * 0.5 - blastorigin) * (finaldmg / coredamage) * forceintensity;
508                                                 if (targ == attacker)
509                                                         finaldmg = finaldmg * cvar("g_balance_selfdamagepercent");      // Partial damage if the attacker hits himself
510                                                 Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
511                                         }
512                                 }
513                         }
514                 targ = targ.chain;
515         }
516 }
517
518 /*
519 entity  multi_ent;
520 float   multi_damage;
521 vector  multi_force;
522
523 void ClearMultiDamage (void)
524 {
525         multi_ent = world;
526         multi_damage = 0;
527         multi_force = '0 0 0';
528 }
529
530 void ApplyMultiDamage (void)
531 {
532         if (!multi_ent)
533                 return;
534
535         Damage (self, multi_ent.origin, multi_ent, 0, multi_damage, multi_force);
536 }
537
538 void AddMultiDamage (entity hit, float damage, vector force)
539 {
540         if (!hit)
541                 return;
542
543         if (hit != multi_ent)
544         {
545                 ApplyMultiDamage ();
546                 ClearMultiDamage ();
547                 multi_ent = hit;
548         }
549         multi_damage = multi_damage + damage;
550         multi_force = multi_force + force;
551 }
552
553 void FireBullets (float shotcount, vector dir, vector spread, float deathtype)
554 {
555         vector  direction;
556         vector  source;
557         vector  vel;
558         vector  org;
559
560         makevectors (self.v_angle);
561
562         source = self.origin + v_forward * 10;  // FIXME
563         source_x = self.absmin_z + self.size_z * 0.7;   // ??? whaddabout view_ofs
564
565         // LordHavoc: better to use normal damage
566         //ClearMultiDamage ();
567         while (shotcount > 0)
568         {
569                 direction = dir + crandom () * spread_x * v_right + crandom () * spread_y * v_up;
570
571                 traceline (source, source + direction * 2048, FALSE, self);
572                 if (trace_fraction != 1.0)
573                 {
574                         vel = normalize (direction + v_up * crandom () + v_right * crandom ());
575                         vel = vel + 2 * trace_plane_normal;
576                         vel = vel * 200;
577
578                         org = trace_endpos - direction * 4;
579
580                         if (!trace_ent.takedamage)
581                                 te_gunshot (org);
582                         // LordHavoc: better to use normal damage
583                         //AddMultiDamage (trace_ent, 4, direction * 4);
584                         Damage (trace_ent, self, self, 4, deathtype, trace_endpos, direction * 4);
585                 }
586
587                 shotcount = shotcount + 1;
588         }
589
590         // LordHavoc: better to use normal damage
591         //ApplyMultiDamage ();
592 }
593 */
594
595
596