- bugfix so player who dies and becomes an observer can hear sounds from other players units
This commit is contained in:
parent
4f233d3628
commit
b1ed59959e
|
@ -844,7 +844,7 @@ void Faction::applyCostsOnInterval(const ResourceType *rtApply) {
|
||||||
}
|
}
|
||||||
StaticSound *sound= unit->getType()->getFirstStOfClass(scDie)->getSound();
|
StaticSound *sound= unit->getType()->getFirstStOfClass(scDie)->getSound();
|
||||||
if(sound != NULL &&
|
if(sound != NULL &&
|
||||||
(thisFaction == true || (world->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) {
|
(thisFaction == true || world->showWorldForPlayer(world->getThisTeamIndex()) == true)) {
|
||||||
SoundRenderer::getInstance().playFx(sound);
|
SoundRenderer::getInstance().playFx(sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1911,7 +1911,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||||
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
||||||
if(sound != NULL &&
|
if(sound != NULL &&
|
||||||
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
|
(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);
|
SoundRenderer::getInstance().playFx(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1980,7 +1980,7 @@ void Unit::deapplyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||||
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
||||||
if(sound != NULL &&
|
if(sound != NULL &&
|
||||||
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
|
(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);
|
SoundRenderer::getInstance().playFx(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2032,7 +2032,7 @@ void Unit::tick() {
|
||||||
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
||||||
if(sound != NULL &&
|
if(sound != NULL &&
|
||||||
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
|
(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);
|
SoundRenderer::getInstance().playFx(sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2056,7 +2056,7 @@ void Unit::tick() {
|
||||||
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound();
|
||||||
if(sound != NULL &&
|
if(sound != NULL &&
|
||||||
(this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() ||
|
(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);
|
SoundRenderer::getInstance().playFx(sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ void UnitUpdater::updateUnit(Unit *unit) {
|
||||||
float soundStartTime= currSkill->getSoundStartTime();
|
float soundStartTime= currSkill->getSoundStartTime();
|
||||||
if(soundStartTime >= unit->getLastAnimProgress() && soundStartTime < unit->getAnimProgress()) {
|
if(soundStartTime >= unit->getLastAnimProgress() && soundStartTime < unit->getAnimProgress()) {
|
||||||
if(map->getSurfaceCell(Map::toSurfCoords(unit->getPos()))->isVisible(world->getThisTeamIndex()) ||
|
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());
|
soundRenderer.playFx(currSkill->getSound(), unit->getCurrVector(), gameCamera->getPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,7 +806,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
|
||||||
|
|
||||||
//play start sound
|
//play start sound
|
||||||
if(unit->getFactionIndex() == world->getThisFactionIndex() ||
|
if(unit->getFactionIndex() == world->getThisFactionIndex() ||
|
||||||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) {
|
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
bct->getStartSound(),
|
bct->getStartSound(),
|
||||||
unit->getCurrVector(),
|
unit->getCurrVector(),
|
||||||
|
@ -878,7 +878,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
|
||||||
builtUnit->born();
|
builtUnit->born();
|
||||||
scriptManager->onUnitCreated(builtUnit);
|
scriptManager->onUnitCreated(builtUnit);
|
||||||
if(unit->getFactionIndex() == world->getThisFactionIndex() ||
|
if(unit->getFactionIndex() == world->getThisFactionIndex() ||
|
||||||
(game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) {
|
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
bct->getBuiltSound(),
|
bct->getBuiltSound(),
|
||||||
unit->getCurrVector(),
|
unit->getCurrVector(),
|
||||||
|
|
Loading…
Reference in New Issue