From 66823befe2bafb7bfbab9ec03c7981a3fda2c601 Mon Sep 17 00:00:00 2001 From: Robert Göffringmann Date: Mon, 14 Jul 2003 20:01:54 +0000 Subject: maybe this fixed those random crashes... svn-id: r9021 --- sky/control.cpp | 2 +- sky/logic.cpp | 5 +++-- sky/sound.cpp | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sky/control.cpp b/sky/control.cpp index 094373d5b7..d6b29b3e84 100644 --- a/sky/control.cpp +++ b/sky/control.cpp @@ -1447,6 +1447,7 @@ uint16 SkyControl::parseSaveData(uint8 *srcBuf) { if (srcPos - srcBuf != (int32)size) error("Restore failed! Savegame data = %d bytes. Expected size: %d", srcPos-srcBuf, size); + SkyState::_systemVars.systemFlags |= SF_GAME_RESTORED; if (!SkyState::isDemo()) { _skyLogic->fnLeaveSection(oldSection, 0, 0); _skyLogic->fnEnterSection(SkyLogic::_scriptVariables[CUR_SECTION], 0, 0); @@ -1457,7 +1458,6 @@ uint16 SkyControl::parseSaveData(uint8 *srcBuf) { _skyMusic->startMusic((uint16)music); _savedMouse = (uint16)mouseType; SkyState::_systemVars.currentPalette = palette; // will be set when doControlPanel ends - SkyState::_systemVars.systemFlags |= SF_GAME_RESTORED; // what's that for? return GAME_RESTORED; } diff --git a/sky/logic.cpp b/sky/logic.cpp index eddb74c449..dea313a8cf 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -2215,7 +2215,7 @@ bool SkyLogic::fnLeaveSection(uint32 sectionNo, uint32 b, uint32 c) { if (sectionNo == 5) //linc section - has different mouse icons _skyMouse->replaceMouseCursors(60301); - _currentSection = 0xFF; // force music-, sound- and gridreload + //_currentSection = 0xFF; // force music-, sound- and gridreload return true; } @@ -2231,13 +2231,14 @@ bool SkyLogic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) { if (sectionNo == 5) //linc section - has different mouse icons _skyMouse->replaceMouseCursors(60302); - if (sectionNo != _currentSection) { + if ((sectionNo != _currentSection) || (SkyState::_systemVars.systemFlags & SF_GAME_RESTORED)) { _currentSection = sectionNo; sectionNo++; _skyMusic->loadSection((byte)sectionNo); _skySound->loadSection((byte)sectionNo); _skyGrid->loadGrids(); + SkyState::_systemVars.systemFlags &= ~SF_GAME_RESTORED; } return true; diff --git a/sky/sound.cpp b/sky/sound.cpp index 3244c94834..3563dbaa05 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1067,6 +1067,7 @@ int SkySound::playSound(uint32 id, byte *sound, uint32 size, PlayingSoundHandle void SkySound::loadSection(uint8 pSection) { fnStopFx(); + _mixer->stopAll(); if (_soundData) free(_soundData); _soundData = _skyDisk->loadFile(pSection * 4 + SOUND_FILE_BASE, NULL); -- cgit v1.2.3