maybe this fixed those random crashes...

svn-id: r9021
This commit is contained in:
Robert Göffringmann 2003-07-14 20:01:54 +00:00
parent 177d5d6b11
commit 66823befe2
3 changed files with 5 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);