ASYLUM: Fixed scene reloading, to get the good palette after showing intro & when exiting menu

Fixed some places where the added sound looping argument was not set, so it looped but shouldn't (in example, in menu)

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@534 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Arthur Blot
2021-05-17 15:36:17 +02:00
committed by Eugene Sandulenko
parent 71125b9916
commit 5bd13afb2b
5 changed files with 25 additions and 25 deletions
+5 -5
View File
@@ -172,10 +172,10 @@ void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
error("[AsylumEngine::startGame] Invalid start game type!");
case kStartGamePlayIntro:
_scene->enter(sceneId);
playIntro();
_scene->enter(sceneId);
_cursor->show();
break;
@@ -259,7 +259,7 @@ void AsylumEngine::handleEvents(bool doUpdate) { // k_sub_40AE30 (0040AE30)
if (_mainMenu->isActive()) {
if (_scene) {
_mainMenu->closeMenu();
// FIXME _scene->enterScene();
_scene->activate();
}
} else if (_scene && _scene->isActive()) {
_mainMenu->openMenu();
@@ -317,8 +317,8 @@ void AsylumEngine::processDelayedEvents() {
if (_mainMenu->isActive())
_mainMenu->openMenu();
// FIXME else if (_scene->isActive())
// FIXME _scene->enterScene();
else if (_scene->isActive())
_scene->activate();
}
// check for a delayed scene change
+2 -4
View File
@@ -125,7 +125,7 @@ void BlowUpPuzzleVCR::handleEvent(Common::Event *event, bool doUpdate) {
}
void BlowUpPuzzle::playSound(ResourceId resourceId, bool loop) {
getSound()->playSound(resourceId, Config.sfxVolume, loop, 0/*, true*/);
getSound()->playSound(resourceId, loop, Config.sfxVolume, 0);
}
int BlowUpPuzzleVCR::inPolyRegion(int x, int y, int polyIdx) {
@@ -140,7 +140,6 @@ void BlowUpPuzzleVCR::update() {
_rightClickDown = false;
closeBlowUp();
getSound()->stopAll();
// FIXME getScene()->enterScene();
}
if (_leftClickDown) {
@@ -184,8 +183,7 @@ void BlowUpPuzzleVCR::update() {
getVideo()->playVideo(2, true);
_isAccomplished = false;
_active = false;
// FIXME getScene()->enterScene();
closeBlowUp();
} else {
getScreen()->drawGraphicsInQueue();
}
+2 -4
View File
@@ -234,10 +234,8 @@ void MainMenu::update() {
getSound()->playMusic(MAKE_RESOURCE(kResourcePackShared, 38));
break;
case kReturnToGame:
if (_vm->scene()) { // FIXME: do this properly
if (_vm->scene()) // FIXME: do this properly
closeMenu();
// FIXME _vm->scene()->enterScene();
}
break;
}
}
@@ -327,7 +325,7 @@ void MainMenu::updateMainMenu() {
// Play creepy voice
if (_activeIcon != _previousActiveIcon) {
getSound()->playSound(MAKE_RESOURCE(kResourcePackShared, iconNum + 44), Config.sfxVolume);
getSound()->playSound(MAKE_RESOURCE(kResourcePackShared, iconNum + 44), false, Config.sfxVolume);
_previousActiveIcon = _activeIcon;
}
+15 -11
View File
@@ -206,15 +206,7 @@ void Scene::enter(ResourcePackId packId) {
_ws->field_E860C = -1;
}
//////////////////////////////////////////////////////////////////////////
// FIXME: get rid of this
_isActive = true;
getScreen()->setPalette(_ws->currentPaletteId);
_background = _bgResource->getFrame(0);
_vm->screen()->copyToBackBuffer(
((byte *)_background->surface.pixels) + _ws->yTop * _background->surface.w + _ws->xLeft, _background->surface.w,
0, 0, 640, 480);
activate();
}
void Scene::load(ResourcePackId packId) {
@@ -372,7 +364,7 @@ void Scene::handleEvent(Common::Event *event, bool doUpdate) {
_title->update(_vm->getTick());
if (_title->loadingComplete()) {
_titleLoaded = true;
// FIXME enterScene();
activate();
}
return;
}
@@ -397,6 +389,18 @@ void Scene::handleEvent(Common::Event *event, bool doUpdate) {
}
}
void Scene::activate() {
//////////////////////////////////////////////////////////////////////////
// FIXME: get rid of this?
_isActive = true;
getScreen()->setPalette(_ws->currentPaletteId);
_background = _bgResource->getFrame(0);
_vm->screen()->copyToBackBuffer(
((byte *)_background->surface.pixels) + _ws->yTop * _background->surface.w + _ws->xLeft, _background->surface.w,
0, 0, 640, 480);
}
bool Scene::update() {
#ifdef DEBUG_SCENE_TIMES
#define MESURE_TICKS(func) { \
@@ -886,7 +890,7 @@ void Scene::updateAmbientSounds() {
else
if (tmpVol <= -10000)
tmpVol = -10000;
getSound()->playSound(snd->resourceId, 0, tmpVol, vm()->getRandom(20001) - 10000);
getSound()->playSound(snd->resourceId, false, tmpVol, vm()->getRandom(20001) - 10000);
}
}
} else {
+1 -1
View File
@@ -91,7 +91,7 @@ public:
void handleEvent(Common::Event *event, bool doUpdate);
void activate() { _isActive = true; }
void activate();
void deactivate() { _isActive = false; }
bool isActive() { return _isActive; }
ResourcePackId getPackId() { return _packId; }