shotline sound fx, grenade explosion fixes
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1491 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+1
-3
@@ -342,13 +342,11 @@ struct playerent : dynent, playerstate
|
||||
weapon *weapons[NUMGUNS];
|
||||
weapon *weaponsel, *nextweaponsel, *primweap, *nextprimweap, *lastattackweapon;
|
||||
|
||||
struct bounceent *inhandnade;
|
||||
|
||||
poshist history; // Previous stored locations of this player
|
||||
|
||||
playerent() : clientnum(-1), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), lastpain(0), clientrole(CR_DEFAULT),
|
||||
skin(0), nextskin(0), spectating(SM_NONE), followplayercn(0),
|
||||
weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL), inhandnade(NULL)
|
||||
weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL)
|
||||
{
|
||||
type = ENT_PLAYER;
|
||||
name[0] = team[0] = 0;
|
||||
|
||||
@@ -182,7 +182,7 @@ bool collide(physent *d, bool spawn, float drop, float rise)
|
||||
if(!plcollide(d, o, headspace, hi, lo)) return false;
|
||||
}
|
||||
|
||||
if(d!=player1 && !(d->type==ENT_BOUNCE && player1->inhandnade==((bounceent *)d))) if(!plcollide(d, player1, headspace, hi, lo)) return false;
|
||||
if(d!=player1 && !(d->type==ENT_BOUNCE && ((bounceent *)d)->bouncestate==NADE_ACTIVATED || ((bounceent *)d)->bouncestate==NADE_THROWED)) if(!plcollide(d, player1, headspace, hi, lo)) return false;
|
||||
headspace -= 0.01f;
|
||||
|
||||
mmcollide(d, hi, lo); // collide with map models
|
||||
|
||||
@@ -542,11 +542,19 @@ void addshotline(dynent *pl, vec &from, vec &to)
|
||||
float dist = to.dist(from, unitv);
|
||||
unitv.div(dist);
|
||||
|
||||
// shotline visuals
|
||||
vec o = unitv;
|
||||
o.mul(dist/10+start).add(from);
|
||||
vec d = unitv;
|
||||
d.mul(dist/10*-(10-start-2)).add(to);
|
||||
newparticle(o, d, fx ? shotlinettl : 75, 6);
|
||||
//playsound(S_BULLETAIR, NULL, NULL, NULL),
|
||||
|
||||
// shotline sound fx
|
||||
vec fromuv, touv, soundpos(unitv);
|
||||
float fd = camera1->o.dist(from, fromuv);
|
||||
float td = camera1->o.dist(to, touv);
|
||||
soundpos.mul(fd/(fd+td)*dist);
|
||||
soundpos.add(from);
|
||||
playsound(S_BULLETAIR, NULL, NULL, &soundpos);
|
||||
}
|
||||
|
||||
|
||||
+15
-12
@@ -670,10 +670,11 @@ struct grenadeent : bounceent
|
||||
|
||||
struct grenades : weapon
|
||||
{
|
||||
grenadeent *inhandnade;
|
||||
const int throwwait;
|
||||
int throwmillis;
|
||||
|
||||
grenades(playerent *owner) : weapon(owner, GUN_GRENADE), throwwait((13*1000)/40), throwmillis(0) {}
|
||||
grenades(playerent *owner) : weapon(owner, GUN_GRENADE), inhandnade(NULL), throwwait((13*1000)/40), throwmillis(0) {}
|
||||
|
||||
bool attack(vec &targ)
|
||||
{
|
||||
@@ -696,11 +697,12 @@ struct grenades : weapon
|
||||
|
||||
gunwait = reloading = 0;
|
||||
|
||||
if(owner->attacking && !owner->inhandnade) // activate
|
||||
if(owner->attacking && !inhandnade) // activate
|
||||
{
|
||||
if(!mag) return false;
|
||||
throwmillis = 0;
|
||||
owner->inhandnade = bounceents.add(new grenadeent(owner));
|
||||
inhandnade = new grenadeent(owner);
|
||||
bounceents.add(inhandnade);
|
||||
updatelastaction(owner);
|
||||
mag--;
|
||||
gunwait = info.attackdelay;
|
||||
@@ -711,7 +713,7 @@ struct grenades : weapon
|
||||
0);
|
||||
playsound(S_GRENADEPULL);
|
||||
}
|
||||
else if(!owner->attacking && owner->inhandnade && attackmillis>info.attackdelay) thrownade();
|
||||
else if(inhandnade && attackmillis>info.attackdelay && (!owner->attacking || !inhandnade->isalive(lastmillis))) thrownade();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -721,8 +723,9 @@ struct grenades : weapon
|
||||
if(millis == 0) playsound(S_GRENADEPULL, owner); // activate
|
||||
else if(millis > 0) // throw
|
||||
{
|
||||
owner->inhandnade = bounceents.add(new grenadeent(owner, millis));
|
||||
thrownade(from, to, owner->inhandnade);
|
||||
inhandnade = new grenadeent(owner, millis);
|
||||
bounceents.add(inhandnade);
|
||||
thrownade(from, to, inhandnade);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,8 +740,8 @@ struct grenades : weapon
|
||||
return ANIM_GUN_IDLE;
|
||||
}
|
||||
|
||||
bool throwing() { return throwmillis && !owner->inhandnade; }
|
||||
bool inhand() { return throwmillis <= 0 && owner->inhandnade; }
|
||||
bool throwing() { return throwmillis && !inhandnade; }
|
||||
bool inhand() { return throwmillis <= 0 && inhandnade; }
|
||||
|
||||
void thrownade()
|
||||
{
|
||||
@@ -748,7 +751,7 @@ struct grenades : weapon
|
||||
vec from(vel);
|
||||
from.mul(1.1f*owner->radius);
|
||||
from.add(owner->o);
|
||||
thrownade(from, vel, owner->inhandnade);
|
||||
thrownade(from, vel, inhandnade);
|
||||
}
|
||||
|
||||
void thrownade(const vec &from, const vec &vel, bounceent *p)
|
||||
@@ -760,7 +763,7 @@ struct grenades : weapon
|
||||
loopi(10) moveplayer(p, 10, true, 10);
|
||||
|
||||
p->bouncestate = NADE_THROWED;
|
||||
owner->inhandnade = NULL;
|
||||
inhandnade = NULL;
|
||||
|
||||
throwmillis = lastmillis;
|
||||
|
||||
@@ -788,7 +791,7 @@ struct grenades : weapon
|
||||
void onownerdies()
|
||||
{
|
||||
reset();
|
||||
if(owner==player1 && owner->inhandnade) ((grenadeent *)owner->inhandnade)->explode();
|
||||
if(owner==player1 && inhandnade) inhandnade->explode();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -954,7 +957,7 @@ struct akimbo : gun
|
||||
akimbomillis = lastmillis + 30000;
|
||||
if(owner==player1)
|
||||
{
|
||||
if(owner->weaponsel->type!=GUN_SNIPER && !owner->inhandnade) weaponswitch(this);
|
||||
if(owner->weaponsel->type!=GUN_SNIPER && owner->weaponsel->type!=GUN_GRENADE) weaponswitch(this);
|
||||
addmsg(SV_AKIMBO, "ri", lastmillis);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user