enemy->health = -1;
if (enemy->health % 10)
{
- audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
Math::limitInt(&(++self->health), 0, self->maxHealth);
Math::removeBit(&bullet->flags, ENT_WEIGHTLESS);
Math::removeBit(&bullet->flags, ENT_BOUNCES);
- audio.playSound(SND_RICO1, CH_ANY);
+ audio.playSound(SND_RICO1, CH_ANY, bullet->x);
return false;
}
if (!(self->flags & ENT_IMMUNE))
{
self->health -= bullet->damage;
- audio.playSound(SND_CLANG, CH_ANY);
+ audio.playSound(SND_CLANG, CH_ANY, bullet->x);
addColorParticles(bullet->x, bullet->y, Math::rrand(25, 75), -1);
Math::removeBit(&bullet->flags, ENT_SPARKS);
Math::removeBit(&bullet->flags, ENT_PUFFS);
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);
}
}
break;
}
- audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE, self->x);
}
void droidBossDie()
if ((Math::prand() % 10) == 0)
{
Math::addBit(&self->flags, ENT_IMMUNE);
- audio.playSound(SND_BOSSCUSTOM2, CH_SPAWN);
+ audio.playSound(SND_BOSSCUSTOM2, CH_SPAWN, self->x);
self->custom = 5;
self->think = &droidGoCrazy;
self->setActionFinished(2);
if (!(enemy->flags & ENT_EXPLODES))
{
- audio.playSound(SND_HIT, CH_ANY);
+ audio.playSound(SND_HIT, CH_ANY, enemy->x);
if (game.gore)
{
addBlood(enemy, bullet->dx / 4, Math::rrand(-6, -3), 1);
}
else
{
- audio.playSound(SND_CLANG, CH_ANY);
+ audio.playSound(SND_CLANG, CH_ANY, enemy->x);
addColorParticles(bullet->x, bullet->y, Math::rrand(25, 75), -1);
}
if (enemy->flags & ENT_EXPLODES)
{
- audio.playSound(SND_ELECDEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_ELECDEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
else if (game.gore)
{
- audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
}
}
if (enemy->flags & ENT_EXPLODES)
{
- audio.playSound(SND_ELECDEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_ELECDEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
else if (game.gore)
{
- audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
if (bullet->owner == &player)
}
}
- (game.gore) ? audio.playSound(SND_SPLAT, CH_ANY) : audio.playSound(SND_POP, CH_ANY);
+ (game.gore) ? audio.playSound(SND_SPLAT, CH_ANY) : audio.playSound(SND_POP, CH_ANY, enemy->x);
}
void doEnemies()
{
if (game.gore)
{
- audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
}
}
if (!(ent->flags & ENT_EXPLODES))
{
- audio.playSound(SND_HIT, CH_ANY);
+ audio.playSound(SND_HIT, CH_ANY, ent->x);
for (int i = 0 ; i < 4 ; i++)
{
addBlood(ent, Math::rrand(-5, 5), Math::rrand(-6, -3), i);
}
else
{
- audio.playSound(SND_CLANG, CH_ANY);
+ audio.playSound(SND_CLANG, CH_ANY, ent->x);
addColorParticles(ent->x, ent->y, Math::rrand(25, 75), -1);
}
if (player.health <= 0)
{
- audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH, player.x);
player.health = 0;
}
void addExplosion(float x, float y, int radius, Entity *owner)
{
- audio.playSound(SND_GRENADE, CH_EXPLODE);
+ audio.playSound(SND_GRENADE, CH_EXPLODE, x);
float dx, dy;
int distX, distY;
{
if (enemy->flags & ENT_EXPLODES)
{
- audio.playSound(SND_ELECDEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_ELECDEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
else
{
if (game.gore)
{
- audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH);
+ audio.playSound(SND_DEATH1 + Math::prand() % 3, CH_DEATH, enemy->x);
}
}
}
map.boss[0]->health = 30 * game.skill;
map.boss[0]->setSprites(graphics.getSprite("GaldovPain", true), graphics.getSprite("GaldovPain", true), graphics.getSprite("GaldovPain", true));
engine.setInfoMessage("Galdov has dropped the crystal! Quick! Get it!!", 99, INFO_HINT);
- audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE, x);
}
}
{
game.missionOverReason = MIS_GAMECOMPLETE;
audio.stopMusic();
- audio.playSound(SND_BOSSCUSTOM3, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM3, CH_AMBIANCE, self->x);
player.health = 10;
self->dx = 5;
self->dy = -6;
self->think = &galdovFinalTeleport;
self->currentWeapon = getRandomGaldovWeapon();
- audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE, self->x);
map.setMainBossPart(map.boss[0]);
addTeleportParticles(map.boss[i]->x + 10 + map.boss[i]->dx, map.boss[i]->y + 10 + map.boss[i]->dy, 75, -1);
}
+ audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE, map.boss[0]->x);
+
map.boss[0]->place(9999, 9999);
map.boss[0]->setThinkTime(2);
map.boss[0]->setActionFinished(Math::rrand(10, 15) * 60);
map.boss[0]->think = &galdovRejoin;
map.boss[0]->active = true;
- audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE);
map.setMainBossPart(NULL);
debug(("galdovFinalSplit: Done\n"));
self->setActionFinished(60);
self->setThinkTime(60);
addExplosion(self->x, self->y, 75, &player);
+ audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE, self->x);
self->place(9999, 9999);
map.boss[0]->setSprites(graphics.getSprite("GaldovPain", true), graphics.getSprite("GaldovPain", true), graphics.getSprite("GaldovPain", true));
map.boss[0]->think = &galdovFinalPainThrow2;
map.boss[0]->health -= (3 * game.skill);
Math::removeBit(&map.boss[0]->flags, ENT_FLIES);
Math::removeBit(&map.boss[0]->flags, ENT_FIRETRAIL);
- audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE);
}
}
void galdovSplit(int i)
{
- audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE, map.boss[0]->x);
map.boss[i]->active = true;
map.boss[i]->health = 4 * game.skill;
if (map.mainBossPart != NULL)
{
map.mainBossPart = NULL;
- audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE, self->x);
}
if ((self->health % 5) == 0)
unsigned int frameLimit = SDL_GetTicks() + 16;
- audio.playSound(SND_TELEPORT1, CH_ANY);
+ audio.playSound(SND_TELEPORT1, CH_ANY, player.x);
engine.setPlayerPosition((int)player.x, (int)player.y, map.limitLeft, map.limitRight, map.limitUp, map.limitDown);
case ITEM_SPREAD:
player.currentWeapon = &weapon[item->id];
game.currentWeapon = item->id;
- audio.playSound(SND_GETWEAPON, CH_ITEM);
+ audio.playSound(SND_GETWEAPON, CH_ITEM, item->x);
break;
case ITEM_POINTS:
case ITEM_POINTS2:
case ITEM_POINTS6:
case ITEM_POINTS7:
addPlayerScore(item->value);
- audio.playSound(SND_ITEM, CH_ITEM);
+ audio.playSound(SND_ITEM, CH_ITEM, item->x);
break;
case ITEM_CHERRY:
case ITEM_DOUBLECHERRY:
case ITEM_TRIPLECHERRY:
Math::limitInt(&(player.health += item->value), 0, MAX_HEALTH);
- audio.playSound(SND_GULP + (Math::prand() % 2), CH_ITEM);
+ audio.playSound(SND_GULP + (Math::prand() % 2), CH_ITEM, item->x);
break;
case ITEM_MISC:
item->owner = &player;
case ITEM_MISC_NOSHOW:
- audio.playSound(SND_ITEM, CH_ITEM);
+ audio.playSound(SND_ITEM, CH_ITEM, item->x);
break;
}
if (ent->dy < 0)
{
- audio.playSound(SND_WATEROUT, CH_TOUCH);
+ audio.playSound(SND_WATEROUT, CH_TOUCH, ent->x);
}
ent->checkEnvironment();
if (ent->environment == ENV_AIR)
{
- audio.playSound(SND_WATERIN, CH_TOUCH);
+ audio.playSound(SND_WATERIN, CH_TOUCH, ent->x);
if ((mapAttribute == MAP_SLIME) || (mapAttribute == MAP_LAVA))
ent->thinktime = 1;
}
{
Math::addBit(&mia->flags, ENT_WEIGHTLESS);
Math::addBit(&mia->flags, ENT_DYING);
- audio.playSound(SND_TELEPORT1, CH_ANY);
+ audio.playSound(SND_TELEPORT1, CH_ANY, mia->x);
}
}
if (soundToPlay != -1)
{
- audio.playSound(soundToPlay, CH_SPAWN);
+ audio.playSound(soundToPlay, CH_SPAWN, x);
}
}
{
if ((swt->type == SWT_NORMAL) || (swt->type == SWT_WATERLEVEL))
{
- audio.playSound(SND_SWITCH1, CH_TOUCH);
+ audio.playSound(SND_SWITCH1, CH_TOUCH, swt->x);
swt->activated = !swt->activated;
activateTrigger(swt->linkName, swt->activateMessage, swt->activated);
swt->health = 1;
}
else if (swt->type == SWT_TOGGLE)
{
- audio.playSound(SND_SWITCH1, CH_TOUCH);
+ audio.playSound(SND_SWITCH1, CH_TOUCH, swt->x);
activateTrigger(swt->linkName, swt->activateMessage, !swt->activated);
swt->activated = !swt->activated;
}
else if (swt->type == SWT_PRESSURE)
{
- audio.playSound(SND_SWITCH1, CH_TOUCH);
+ audio.playSound(SND_SWITCH1, CH_TOUCH, swt->x);
swt->activated = true;
activateTrigger(swt->linkName, swt->activateMessage, true);
swt->health = 2;
}
else if ((swt->type == SWT_TIMED) || (swt->type == SWT_RESET))
{
- audio.playSound(SND_SWITCH1, CH_TOUCH);
+ audio.playSound(SND_SWITCH1, CH_TOUCH, swt->x);
activateTrigger(swt->linkName, swt->activateMessage, true);
swt->activated = !swt->activated;
swt->health = 240;
if (self->custom == 0)
{
self->think = tankBossMGCannonFire;
- audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM2, CH_AMBIANCE, self->x);
}
}
self->think = &tankBossMGCannonChargeFire;
self->setThinkTime(0);
self->setActionFinished(2);
- audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE);
+ audio.playSound(SND_BOSSCUSTOM1, CH_AMBIANCE, self->x);
Math::addBit(&self->flags, ENT_IMMUNE);
}
else
train->active = true;
- audio.playSound(SND_OPENDOOR, CH_TOUCH);
+ audio.playSound(SND_OPENDOOR, CH_TOUCH, train->x);
}
/**
if ((train->isReady()) && (!train->active))
{
engine.setInfoMessage(message, 1, INFO_NORMAL);
- audio.playSound(SND_LOCKEDDOOR, CH_TOUCH);
+ audio.playSound(SND_LOCKEDDOOR, CH_TOUCH, train->x);
}
}
}
else if (playSound)
{
- audio.playSound(SND_DOOROPENED, CH_TOUCH);
+ audio.playSound(SND_DOOROPENED, CH_TOUCH, train->x);
}
}
}
switch (trap->type)
{
case TRAP_TYPE_MINE:
- audio.playSound(SND_ROCKET, CH_SPAWN);
+ audio.playSound(SND_ROCKET, CH_SPAWN, trap->x);
break;
case TRAP_TYPE_SPIKE:
- audio.playSound(SND_ROCKET, CH_SPAWN);
+ audio.playSound(SND_ROCKET, CH_SPAWN, trap->x);
break;
case TRAP_TYPE_SWING:
- audio.playSound(SND_THROW, CH_SPAWN);
+ audio.playSound(SND_THROW, CH_SPAWN, trap->x);
break;
case TRAP_TYPE_BARRIER:
if ((absX <= 640) && (absY <= 480))
{
- audio.playSound(SND_ELECTRICITY1 + Math::prand() % 3, CH_SPAWN);
+ audio.playSound(SND_ELECTRICITY1 + Math::prand() % 3, CH_SPAWN, trap->x);
}
break;
case TRAP_TYPE_FLAME:
if ((absX <= 640) && (absY <= 480))
{
- audio.playSound(SND_FIRECRACKLE, CH_SPAWN);
+ audio.playSound(SND_FIRECRACKLE, CH_SPAWN, trap->x);
}
break;
}
engine.setInfoMessage(activateMessage, 1, INFO_ACTIVATE);
if (train->type != TR_TRAIN)
- audio.playSound(SND_OPENDOOR, CH_TOUCH);
+ audio.playSound(SND_OPENDOOR, CH_TOUCH, train->x);
linkOkay = true;
}