spectfov, weap code restructured
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1800 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -3,6 +3,32 @@
|
||||
#include "pch.h"
|
||||
#include "cube.h"
|
||||
|
||||
|
||||
grenadeent::grenadeent (playerent *owner, int millis)
|
||||
{
|
||||
ASSERT(owner);
|
||||
bounceent::owner = owner;
|
||||
bounceent::millis = lastmillis;
|
||||
timetolife = 2000-millis;
|
||||
bouncestate = NADE_ACTIVATED;
|
||||
maxspeed = 27.0f;
|
||||
rotspeed = 6.0f;
|
||||
}
|
||||
|
||||
void grenadeent::explode()
|
||||
{
|
||||
static vec n(0,0,0);
|
||||
if(bouncestate != NADE_THROWED) owner->weapons[GUN_GRENADE]->attack(n);
|
||||
playsound(S_FEXPLODE, &o);
|
||||
newprojectile(o, o, 1, owner==player1, owner, GUN_GRENADE, millis);
|
||||
}
|
||||
|
||||
void grenadeent::destroy()
|
||||
{
|
||||
if(bouncestate==NADE_ACTIVATED || bouncestate==NADE_THROWED) explode();
|
||||
}
|
||||
|
||||
|
||||
vector<entity> ents;
|
||||
|
||||
const char *entnames[] =
|
||||
|
||||
@@ -459,3 +459,9 @@ struct bounceent : physent // nades, gibs
|
||||
};
|
||||
|
||||
|
||||
struct grenadeent : bounceent
|
||||
{
|
||||
grenadeent (playerent *owner, int millis = 0);
|
||||
void explode();
|
||||
virtual void destroy();
|
||||
};
|
||||
@@ -477,6 +477,7 @@ extern bool intersect(entity *e, const vec &from, const vec &to, vec *end = NULL
|
||||
extern void damageeffect(int damage, playerent *d);
|
||||
extern void tryreload(playerent *p);
|
||||
extern void checkakimbo();
|
||||
extern void newprojectile(vec &from, vec &to, float speed, bool local, playerent *owner, int gun, int id = lastmillis);
|
||||
|
||||
// entities
|
||||
extern const char *entnames[];
|
||||
|
||||
@@ -476,7 +476,8 @@ void initsound()
|
||||
{
|
||||
conoutf("Sound: %s (%s)", alGetString(AL_RENDERER), alGetString(AL_VENDOR));
|
||||
conoutf("Driver: %s", alGetString(AL_VERSION));
|
||||
alDistanceModel(AL_INVERSE_DISTANCE);
|
||||
//alDistanceModel(AL_INVERSE_DISTANCE);
|
||||
alDistanceModel(AL_EXPONENT_DISTANCE_CLAMPED);
|
||||
nosound = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ vector<projectile > projs;
|
||||
|
||||
void projreset() { projs.setsize(0); }
|
||||
|
||||
void newprojectile(vec &from, vec &to, float speed, bool local, playerent *owner, int gun, int id = lastmillis)
|
||||
void newprojectile(vec &from, vec &to, float speed, bool local, playerent *owner, int gun, int id)
|
||||
{
|
||||
projectile &p = projs.add();
|
||||
p.o = from;
|
||||
|
||||
Reference in New Issue
Block a user