- bugfix so player who dies and becomes an observer can hear sounds from other players units

This commit is contained in:
Mark Vejvoda 2011-10-12 16:03:55 +00:00
parent 4f233d3628
commit b1ed59959e
3 changed files with 8 additions and 8 deletions

View File

@ -844,7 +844,7 @@ void Faction::applyCostsOnInterval(const ResourceType *rtApply) {
}
StaticSound *sound= unit->getType()->getFirstStOfClass(scDie)->getSound();
if(sound != NULL &&
(thisFaction == true || (world->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) {
(thisFaction == true || world->showWorldForPlayer(world->getThisTeamIndex()) == true)) {
SoundRenderer::getInstance().playFx(sound);
}
}

View File

@ -1911,7 +1911,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
if(sound != NULL &&
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) {
SoundRenderer::getInstance().playFx(sound);
}
@ -1980,7 +1980,7 @@ void Unit::deapplyAttackBoost(const AttackBoost *boost, const Unit *source) {
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
if(sound != NULL &&
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) {
SoundRenderer::getInstance().playFx(sound);
}
@ -2032,7 +2032,7 @@ void Unit::tick() {
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
if(sound != NULL &&
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) {
SoundRenderer::getInstance().playFx(sound);
}
}
@ -2056,7 +2056,7 @@ void Unit::tick() {
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
if(sound != NULL &&
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) {
SoundRenderer::getInstance().playFx(sound);
}
}

View File

@ -126,7 +126,7 @@ void UnitUpdater::updateUnit(Unit *unit) {
float soundStartTime= currSkill->getSoundStartTime();
if(soundStartTime >= unit->getLastAnimProgress() && soundStartTime < unit->getAnimProgress()) {
if(map->getSurfaceCell(Map::toSurfCoords(unit->getPos()))->isVisible(world->getThisTeamIndex()) ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
soundRenderer.playFx(currSkill->getSound(), unit->getCurrVector(), gameCamera->getPos());
}
}
@ -806,7 +806,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
//play start sound
if(unit->getFactionIndex() == world->getThisFactionIndex() ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
SoundRenderer::getInstance().playFx(
bct->getStartSound(),
unit->getCurrVector(),
@ -878,7 +878,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
builtUnit->born();
scriptManager->onUnitCreated(builtUnit);
if(unit->getFactionIndex() == world->getThisFactionIndex() ||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) {
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
SoundRenderer::getInstance().playFx(
bct->getBuiltSound(),
unit->getCurrVector(),