From 55ad2c1f6812d71cd1e79f53002c6f3693cad18d Mon Sep 17 00:00:00 2001 From: driAn Date: Mon, 15 Jan 2007 23:18:53 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@820 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/weapon.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 4317c869..1579319c 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -156,7 +156,6 @@ void createrays(vec &from, vec &to) // create random spread of rays }; }; -//bool intersect(dynent *d, vec &from, vec &to) // if lineseg hits entity bounding box bool intersect(dynent *d, vec &from, vec &to, vec *end) // if lineseg hits entity bounding box { vec v = to, w = d->o, *p; @@ -496,6 +495,10 @@ void raydamage(vec &from, vec &to, playerent *d) } else if((o = intersectclosest(from, to, i, d))) { + playerent head = *o; // check headshot + head.eyeheight = head.aboveeye/3; + if(d->gunselect == GUN_SNIPER && intersect(&head, from, to)) gdam = guns[d->gunselect].damage * 3; + hitpush(i, gdam, o, d, from, to); shorten(from, o->o, to); }; @@ -609,6 +612,7 @@ void shoot(playerent *d, vec &targ) if(d->gunselect!=GUN_KNIFE && !hasammo(d)) { d->shots = 0; return; }; if(guns[d->gunselect].isauto) d->shots++; + else if(d->gunselect == GUN_ASSAULT) { if(++d->shots >= 2) d->attacking = false; } else d->attacking = false; if(d->gunselect==GUN_PISTOL && d->akimbo)