/*
Copyright (C) 2004-2011 Parallel Realities
+Copyright (C) 2011-2015 Perpendicular Dimensions
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
bullet->id = owner->currentWeapon->id;
bullet->dx = dx;
bullet->dy = owner->currentWeapon->dy + dy;
+
+ // Add motion of the player and any platform he/she is on to grenades
+ if (owner->currentWeapon->dy)
+ {
+ int tdx, tdy;
+ getTrainMotion(owner, tdx, tdy);
+ bullet->dx += owner->dx - tdx;
+ bullet->dy += -tdy;
+ }
+
bullet->next = NULL;
bullet->health = owner->currentWeapon->health;
bullet->damage = owner->currentWeapon->damage;
if (owner->currentWeapon->fireSound > -1)
{
- audio.playSound(owner->currentWeapon->fireSound, CH_WEAPON);
+ audio.playSound(owner->currentWeapon->fireSound, CH_WEAPON, owner->x);
}
if (owner->flags & ENT_AIMS)
if (bullet->flags & ENT_SPARKS)
{
- audio.playSound(bullet->deathSound, CH_TOUCH);
+ audio.playSound(bullet->deathSound, CH_TOUCH, bullet->x);
}
if (bullet->flags & ENT_EXPLODES)
if (bullet->id != WP_LASER)
{
bullet->dx *= 0.75;
- audio.playSound(SND_GRBOUNCE, CH_TOUCH);
+ audio.playSound(SND_GRBOUNCE, CH_TOUCH, bullet->x);
}
bullet->face = !bullet->face;
}
if (bullet->id != WP_LASER)
{
bullet->dy *= 0.75;
- audio.playSound(SND_GRBOUNCE, CH_TOUCH);
+ audio.playSound(SND_GRBOUNCE, CH_TOUCH, bullet->x);
}
if ((bullet->dy > -2) && (bullet->dy <= 0)) bullet->dy = -2;
{
Math::removeBit(&bullet->flags, ENT_BOUNCES);
map.data[x][y] = MAP_AIR;
- audio.playSound(SND_STONEBREAK, CH_EXPLODE);
+ audio.playSound(SND_STONEBREAK, CH_EXPLODE, bullet->x);
throwBrickParticles(x << BRICKSHIFT, y << BRICKSHIFT);
}
else
if ((Math::prand() % 2) == 0)
{
map.data[x][y] = MAP_AIR;
- audio.playSound(SND_STONEBREAK, CH_EXPLODE);
+ audio.playSound(SND_STONEBREAK, CH_EXPLODE, bullet->x);
throwBrickParticles(x << BRICKSHIFT, y << BRICKSHIFT);
}
}
checkSwitchContact(bullet);
- if ((checkTrainContact(bullet, 0)) || (checkObstacleContact(bullet, 0)))
+ if ((checkTrainContact(bullet, DIR_XY)) || (checkObstacleContact(bullet, DIR_XY)))
{
if (bullet->flags & ENT_BOUNCES)
bounceBullet(bullet, dx, dy);