summaryrefslogtreecommitdiff
path: root/src/fpsgame/weapon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fpsgame/weapon.cpp')
-rw-r--r--src/fpsgame/weapon.cpp97
1 files changed, 51 insertions, 46 deletions
diff --git a/src/fpsgame/weapon.cpp b/src/fpsgame/weapon.cpp
index f516c2e..6ade009 100644
--- a/src/fpsgame/weapon.cpp
+++ b/src/fpsgame/weapon.cpp
@@ -13,7 +13,7 @@ namespace game
};
vector<hitmsg> hits;
- VARP(maxdebris, 10, 25, 1000);
+ //~VARP(maxdebris, 10, 25, 1000);
ICOMMAND(getweapon, "", (), intret(player1->gunselect));
@@ -133,7 +133,8 @@ namespace game
loopi(guns[gun].rays) offsetray(from, to, guns[gun].spread, guns[gun].range, rays[i]);
}
- enum { BNC_GRENADE, BNC_GIBS, BNC_DEBRIS };
+ //~enum { BNC_GRENADE, BNC_GIBS, BNC_DEBRIS };
+ enum { BNC_GRENADE };
struct bouncer : physent
{
@@ -180,7 +181,8 @@ namespace game
{
bouncer &bnc = *bouncers.add(new bouncer);
bnc.o = from;
- bnc.radius = bnc.xradius = bnc.yradius = type==BNC_DEBRIS ? 0.5f : 1.5f;
+ //~bnc.radius = bnc.xradius = bnc.yradius = type==BNC_DEBRIS ? 0.5f : 1.5f;
+ bnc.radius = bnc.xradius = bnc.yradius = 1.5f;
bnc.eyeheight = bnc.radius;
bnc.aboveeye = bnc.radius;
bnc.lifetime = lifetime;
@@ -190,12 +192,14 @@ namespace game
bnc.id = local ? lastmillis : id;
if(light) bnc.light = *light;
- switch(type)
- {
- case BNC_GRENADE: bnc.collidetype = COLLIDE_ELLIPSE_PRECISE; break;
- case BNC_DEBRIS: bnc.variant = rnd(4); break;
- case BNC_GIBS: bnc.variant = rnd(3); break;
- }
+ bnc.collidetype = COLLIDE_ELLIPSE_PRECISE;
+
+ //~switch(type)
+ //~{
+ //~case BNC_GRENADE: bnc.collidetype = COLLIDE_ELLIPSE_PRECISE; break;
+ //~case BNC_DEBRIS: bnc.variant = rnd(4); break;
+ //~case BNC_GIBS: bnc.variant = rnd(3); break;
+ //~}
vec dir(to);
dir.sub(from).safenormalize();
@@ -221,7 +225,8 @@ namespace game
{
if(d->type != ENT_BOUNCE) return;
bouncer *b = (bouncer *)d;
- if(b->bouncetype != BNC_GIBS || b->bounces >= 2) return;
+ //~if(b->bouncetype != BNC_GIBS || b->bounces >= 2) return;
+ if(b->bounces >= 2) return;
b->bounces++;
adddecal(DECAL_BLOOD, vec(b->o).sub(vec(surface).mul(b->radius)), surface, 2.96f/b->bounces, bvec(0x60, 0xFF, 0xFF), rnd(4));
}
@@ -239,16 +244,16 @@ namespace game
vec old(bnc.o);
bool stopped = false;
if(bnc.bouncetype==BNC_GRENADE) stopped = bounce(&bnc, 0.6f, 0.5f, 0.8f) || (bnc.lifetime -= time)<0;
- else
- {
- // cheaper variable rate physics for debris, gibs, etc.
- for(int rtime = time; rtime > 0;)
- {
- int qtime = min(30, rtime);
- rtime -= qtime;
- if((bnc.lifetime -= qtime)<0 || bounce(&bnc, qtime/1000.0f, 0.6f, 0.5f, 1)) { stopped = true; break; }
- }
- }
+ //~else
+ //~{
+ //~// cheaper variable rate physics for debris, gibs, etc.
+ //~for(int rtime = time; rtime > 0;)
+ //~{
+ //~int qtime = min(30, rtime);
+ //~rtime -= qtime;
+ //~if((bnc.lifetime -= qtime)<0 || bounce(&bnc, qtime/1000.0f, 0.6f, 0.5f, 1)) { stopped = true; break; }
+ //~}
+ //~}
if(stopped)
{
if(bnc.bouncetype==BNC_GRENADE)
@@ -340,12 +345,12 @@ namespace game
newbouncer(p, to, true, 0, d, type, rnd(1000)+1000, rnd(100)+20, light);
}
- void gibeffect(int damage, const vec &vel, fpsent *d)
- {
- if(!blood || damage <= 0) return;
- vec from = d->abovehead();
- loopi(min(damage/25, 40)+1) spawnbouncer(from, vel, d, BNC_GIBS);
- }
+ //~void gibeffect(int damage, const vec &vel, fpsent *d)
+ //~{
+ //~if(!blood || damage <= 0) return;
+ //~vec from = d->abovehead();
+ //~loopi(min(damage/25, 40)+1) spawnbouncer(from, vel, d, BNC_GIBS);
+ //~}
void hit(int damage, dynent *d, fpsent *at, const vec &vel, int gun, float info1, int info2 = 1)
{
@@ -428,16 +433,16 @@ namespace game
if(gun==GUN_RL) adddynlight(v, 1.15f*guns[gun].exprad, vec(2, 1.5f, 1), 700, 100, 0, guns[gun].exprad/2, vec(1, 0.75f, 0.5f));
else if(gun==GUN_GL) adddynlight(v, 1.15f*guns[gun].exprad, vec(0.5f, 1.5f, 2), 600, 100, 0, 8, vec(0.25f, 1, 1));
else adddynlight(v, 1.15f*guns[gun].exprad, vec(2, 1.5f, 1), 700, 100);
- int numdebris = rnd(maxdebris-5)+5;
- vec debrisvel = vec(owner->o).sub(v).safenormalize(), debrisorigin(v);
- if(gun==GUN_RL) debrisorigin.add(vec(debrisvel).mul(8));
- if(numdebris)
- {
- entitylight light;
- lightreaching(debrisorigin, light.color, light.dir);
- loopi(numdebris)
- spawnbouncer(debrisorigin, debrisvel, owner, BNC_DEBRIS, &light);
- }
+ //~int numdebris = rnd(maxdebris-5)+5;
+ //~vec debrisvel = vec(owner->o).sub(v).safenormalize(), debrisorigin(v);
+ //~if(gun==GUN_RL) debrisorigin.add(vec(debrisvel).mul(8));
+ //~if(numdebris)
+ //~{
+ //~entitylight light;
+ //~lightreaching(debrisorigin, light.color, light.dir);
+ //~loopi(numdebris)
+ //~spawnbouncer(debrisorigin, debrisvel, owner, BNC_DEBRIS, &light);
+ //~}
if(!local) return;
int numdyn = numdynents();
loopi(numdyn)
@@ -836,14 +841,14 @@ namespace game
}
static const char * const projnames[2] = { "projectiles/grenade", "projectiles/rocket" };
- static const char * const gibnames[3] = { "gibs/gib01", "gibs/gib02", "gibs/gib03" };
- static const char * const debrisnames[4] = { "debris/debris01", "debris/debris02", "debris/debris03", "debris/debris04" };
+ //~static const char * const gibnames[3] = { "gibs/gib01", "gibs/gib02", "gibs/gib03" };
+ //~static const char * const debrisnames[4] = { "debris/debris01", "debris/debris02", "debris/debris03", "debris/debris04" };
void preloadbouncers()
{
loopi(sizeof(projnames)/sizeof(projnames[0])) preloadmodel(projnames[i]);
- loopi(sizeof(gibnames)/sizeof(gibnames[0])) preloadmodel(gibnames[i]);
- loopi(sizeof(debrisnames)/sizeof(debrisnames[0])) preloadmodel(debrisnames[i]);
+ //~loopi(sizeof(gibnames)/sizeof(gibnames[0])) preloadmodel(gibnames[i]);
+ //~loopi(sizeof(debrisnames)/sizeof(debrisnames[0])) preloadmodel(debrisnames[i]);
}
void renderbouncers()
@@ -870,12 +875,12 @@ namespace game
int cull = MDL_CULL_VFC|MDL_CULL_DIST|MDL_CULL_OCCLUDED;
float fade = 1;
if(bnc.lifetime < 250) fade = bnc.lifetime/250.0f;
- switch(bnc.bouncetype)
- {
- case BNC_GIBS: mdl = gibnames[bnc.variant]; cull |= MDL_LIGHT|MDL_LIGHT_FAST|MDL_DYNSHADOW; break;
- case BNC_DEBRIS: mdl = debrisnames[bnc.variant]; break;
- default: continue;
- }
+ //~switch(bnc.bouncetype)
+ //~{
+ //~case BNC_GIBS: mdl = gibnames[bnc.variant]; cull |= MDL_LIGHT|MDL_LIGHT_FAST|MDL_DYNSHADOW; break;
+ //~case BNC_DEBRIS: mdl = debrisnames[bnc.variant]; break;
+ //~default: continue;
+ //~}
rendermodel(&bnc.light, mdl, ANIM_MAPMODEL|ANIM_LOOP, pos, yaw, pitch, cull, NULL, NULL, 0, 0, fade);
}
}