Don't allow weapon to be fired if owner's facing is FACING_DIE.
This commit is contained in:
parent
501db4420b
commit
4ff02a82e5
|
@ -69,6 +69,8 @@ void firePistol(void)
|
||||||
{
|
{
|
||||||
Bullet *bullet;
|
Bullet *bullet;
|
||||||
|
|
||||||
|
if (world.bob->facing != FACING_DIE)
|
||||||
|
{
|
||||||
bullet = createBaseBullet((Unit*)world.bob);
|
bullet = createBaseBullet((Unit*)world.bob);
|
||||||
bullet->weaponType = WPN_PISTOL;
|
bullet->weaponType = WPN_PISTOL;
|
||||||
bullet->facing = world.bob->facing;
|
bullet->facing = world.bob->facing;
|
||||||
|
@ -77,7 +79,8 @@ void firePistol(void)
|
||||||
|
|
||||||
world.bob->reload = 20;
|
world.bob->reload = 20;
|
||||||
|
|
||||||
playSound(SND_PISTOL, CH_BOB);
|
playSound(SND_PISTOL, world.bob->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireAimedShot(Unit *owner)
|
void fireAimedShot(Unit *owner)
|
||||||
|
@ -86,6 +89,8 @@ void fireAimedShot(Unit *owner)
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
Bullet *bullet;
|
Bullet *bullet;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
x = (int) (world.bob->x + rrnd(-8, 24));
|
x = (int) (world.bob->x + rrnd(-8, 24));
|
||||||
y = (int) (world.bob->y + rrnd(-8, 24));
|
y = (int) (world.bob->y + rrnd(-8, 24));
|
||||||
|
|
||||||
|
@ -100,26 +105,32 @@ void fireAimedShot(Unit *owner)
|
||||||
|
|
||||||
owner->reload = 15;
|
owner->reload = 15;
|
||||||
|
|
||||||
playSound(SND_PISTOL, CH_WEAPON);
|
playSound(SND_PISTOL, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireMachineGun(Unit *owner)
|
void fireMachineGun(Unit *owner)
|
||||||
{
|
{
|
||||||
Bullet *bullet;
|
Bullet *bullet;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
bullet = createBaseBullet(owner);
|
bullet = createBaseBullet(owner);
|
||||||
bullet->weaponType = WPN_MACHINE_GUN;
|
bullet->weaponType = WPN_MACHINE_GUN;
|
||||||
bullet->sprite[0] = bulletSprite[0];
|
bullet->sprite[0] = bulletSprite[0];
|
||||||
bullet->sprite[1] = bulletSprite[1];
|
bullet->sprite[1] = bulletSprite[1];
|
||||||
owner->reload = 8;
|
owner->reload = 8;
|
||||||
|
|
||||||
playSound(SND_MACHINE_GUN, CH_WEAPON);
|
playSound(SND_MACHINE_GUN, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void firePlasma(Unit *owner)
|
void firePlasma(Unit *owner)
|
||||||
{
|
{
|
||||||
Bullet *bullet;
|
Bullet *bullet;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
bullet = createBaseBullet(owner);
|
bullet = createBaseBullet(owner);
|
||||||
bullet->weaponType = WPN_PLASMA;
|
bullet->weaponType = WPN_PLASMA;
|
||||||
bullet->sprite[0] = plasmaSprite[0];
|
bullet->sprite[0] = plasmaSprite[0];
|
||||||
|
@ -128,7 +139,8 @@ void firePlasma(Unit *owner)
|
||||||
|
|
||||||
owner->reload = owner->type == ET_BOB ? 4 : 8;
|
owner->reload = owner->type == ET_BOB ? 4 : 8;
|
||||||
|
|
||||||
playSound(SND_PLASMA, owner->type == ET_BOB ? CH_BOB : CH_WEAPON);
|
playSound(SND_PLASMA, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireSpread(Unit *owner, int numberOfShots)
|
void fireSpread(Unit *owner, int numberOfShots)
|
||||||
|
@ -137,6 +149,8 @@ void fireSpread(Unit *owner, int numberOfShots)
|
||||||
int i;
|
int i;
|
||||||
float dy;
|
float dy;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
dy = -(numberOfShots / 2) * 3;
|
dy = -(numberOfShots / 2) * 3;
|
||||||
|
|
||||||
for (i = 0 ; i < numberOfShots ; i++)
|
for (i = 0 ; i < numberOfShots ; i++)
|
||||||
|
@ -152,13 +166,16 @@ void fireSpread(Unit *owner, int numberOfShots)
|
||||||
owner->reload = 16;
|
owner->reload = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
playSound(SND_SPREAD, owner->type == ET_BOB ? CH_BOB : CH_WEAPON);
|
playSound(SND_SPREAD, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireLaser(Unit *owner)
|
void fireLaser(Unit *owner)
|
||||||
{
|
{
|
||||||
Bullet *laser;
|
Bullet *laser;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
laser = createBaseBullet(owner);
|
laser = createBaseBullet(owner);
|
||||||
laser->x = owner->x + owner->w / 2;
|
laser->x = owner->x + owner->w / 2;
|
||||||
laser->y = owner->y + owner->h / 2;
|
laser->y = owner->y + owner->h / 2;
|
||||||
|
@ -171,13 +188,16 @@ void fireLaser(Unit *owner)
|
||||||
|
|
||||||
owner->reload = owner->type == ET_BOB ? FPS / 2 : FPS;
|
owner->reload = owner->type == ET_BOB ? FPS / 2 : FPS;
|
||||||
|
|
||||||
playSound(SND_LASER, owner->type == ET_BOB ? CH_BOB : CH_WEAPON);
|
playSound(SND_LASER, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireGrenade(Unit *owner)
|
void fireGrenade(Unit *owner)
|
||||||
{
|
{
|
||||||
Bullet *grenade;
|
Bullet *grenade;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
grenade = createBaseBullet(owner);
|
grenade = createBaseBullet(owner);
|
||||||
grenade->x = owner->x + owner->w / 2;
|
grenade->x = owner->x + owner->w / 2;
|
||||||
grenade->y = owner->y;
|
grenade->y = owner->y;
|
||||||
|
@ -191,7 +211,8 @@ void fireGrenade(Unit *owner)
|
||||||
|
|
||||||
owner->reload = FPS / 2;
|
owner->reload = FPS / 2;
|
||||||
|
|
||||||
playSound(SND_THROW, owner->type == ET_BOB ? CH_BOB : CH_WEAPON);
|
playSound(SND_THROW, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireShotgun(Unit *owner)
|
void fireShotgun(Unit *owner)
|
||||||
|
@ -200,6 +221,8 @@ void fireShotgun(Unit *owner)
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
Bullet *bullet;
|
Bullet *bullet;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
for (i = 0 ; i < 8 ; i++)
|
for (i = 0 ; i < 8 ; i++)
|
||||||
{
|
{
|
||||||
getSlope(world.bob->x + rrnd(0, 40), world.bob->y + rrnd(0, 40), owner->x, owner->y, &dx, &dy);
|
getSlope(world.bob->x + rrnd(0, 40), world.bob->y + rrnd(0, 40), owner->x, owner->y, &dx, &dy);
|
||||||
|
@ -216,13 +239,16 @@ void fireShotgun(Unit *owner)
|
||||||
owner->reload = 15;
|
owner->reload = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
playSound(SND_SHOTGUN, CH_WEAPON);
|
playSound(SND_SHOTGUN, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireMissile(Unit *owner)
|
void fireMissile(Unit *owner)
|
||||||
{
|
{
|
||||||
Bullet *missile;
|
Bullet *missile;
|
||||||
|
|
||||||
|
if (owner->facing != FACING_DIE)
|
||||||
|
{
|
||||||
missile = createBaseBullet(owner);
|
missile = createBaseBullet(owner);
|
||||||
missile->x = owner->x + owner->w / 2;
|
missile->x = owner->x + owner->w / 2;
|
||||||
missile->y = owner->y + 10;
|
missile->y = owner->y + 10;
|
||||||
|
@ -236,7 +262,8 @@ void fireMissile(Unit *owner)
|
||||||
|
|
||||||
owner->reload = FPS / 2;
|
owner->reload = FPS / 2;
|
||||||
|
|
||||||
playSound(SND_MISSILE, CH_WEAPON);
|
playSound(SND_MISSILE, owner->uniqueId % MAX_SND_CHANNELS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRandomPlayerWeapon(int excludeGrenades)
|
int getRandomPlayerWeapon(int excludeGrenades)
|
||||||
|
|
Loading…
Reference in New Issue