[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.117,1.118 kyra.h,1.66,1.67 saveload.cpp,1.5,1.6
Johannes Schickel
lordhoto at users.sourceforge.net
Thu Jan 12 06:55:01 CET 2006
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27792
Modified Files:
kyra.cpp kyra.h saveload.cpp
Log Message:
Fixed sound while loading games and fixed bug # 1403370.
Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- kyra.cpp 12 Jan 2006 13:16:42 -0000 1.117
+++ kyra.cpp 12 Jan 2006 14:53:23 -0000 1.118
@@ -415,6 +415,8 @@
_mousePressFlag = false;
_targetName = detector._targetName;
+
+ _lastMusicCommand = 0;
return 0;
}
@@ -581,7 +583,7 @@
enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
}
-void KyraEngine::delay(uint32 amount, bool update) {
+void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
OSystem::Event event;
char saveLoadSlot[20];
@@ -596,13 +598,13 @@
} else if (event.kbd.keycode == 'd' && !_debugger->isAttached()) {
_debugger->attach();
} else if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' &&
- (event.kbd.flags == OSystem::KBD_CTRL || event.kbd.flags == OSystem::KBD_ALT)) {
+ (event.kbd.flags == OSystem::KBD_CTRL || event.kbd.flags == OSystem::KBD_ALT) && isMainLoop) {
sprintf(saveLoadSlot, "%s.00%d", _targetName.c_str(), event.kbd.keycode - '0');
if (event.kbd.flags == OSystem::KBD_CTRL)
loadGame(saveLoadSlot);
else
saveGame(saveLoadSlot, saveLoadSlot);
- } else if (event.kbd.flags == OSystem::KBD_CTRL && event.kbd.keycode == 'f') {
+ } else if (event.kbd.flags == OSystem::KBD_CTRL && event.kbd.keycode == 'f') {
_fastMode = !_fastMode;
}
break;
@@ -720,7 +722,7 @@
updateTextFade();
_handleInput = true;
- delay((frameTime + _gameSpeed) - _system->getMillis(), true);
+ delay((frameTime + _gameSpeed) - _system->getMillis(), true, true);
_handleInput = false;
}
}
@@ -1722,8 +1724,8 @@
}
}
-void KyraEngine::snd_playWanderScoreViaMap(int unk1, int unk2) {
- debug(9, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", unk1, unk2);
+void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
+ debug(9, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", command, restart);
const static int8 soundTable[] = {
-1, 0, -1, 1, 0, 3, 0, 2,
0, 4, 1, 2, 1, 3, 1, 4,
@@ -1743,16 +1745,23 @@
//if (!_disableSound) {
// XXX
//}
- assert(unk1*2+1 < ARRAYSIZE(soundTable));
- if (_curMusicTheme != soundTable[unk1*2]+1) {
- if (soundTable[unk1*2] != -1) {
- snd_playTheme(soundTable[unk1*2]+1);
+ assert(command*2+1 < ARRAYSIZE(soundTable));
+ if (_curMusicTheme != soundTable[command*2]+1) {
+ if (soundTable[command*2] != -1) {
+ snd_playTheme(soundTable[command*2]+1);
}
}
- if (unk1 != 1) {
- snd_playTrack(soundTable[unk1*2+1], true);
+ if (restart)
+ _lastMusicCommand = -1;
+
+ if (command != 1) {
+ if (_lastMusicCommand != command) {
+ _lastMusicCommand = command;
+ snd_playTrack(soundTable[command*2+1], true);
+ }
} else {
+ _lastMusicCommand = 1;
_midi->beginFadeOut();
while (_midi->fadeOut()) {
_system->delayMillis(10);
Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- kyra.h 12 Jan 2006 13:16:42 -0000 1.66
+++ kyra.h 12 Jan 2006 14:53:23 -0000 1.67
@@ -219,7 +219,7 @@
void snd_playVoiceFile(int id);
bool snd_voicePlaying();
void snd_playSoundEffect(int track);
- void snd_playWanderScoreViaMap(int unk1, int unk2);
+ void snd_playWanderScoreViaMap(int command, int restart);
void drawSentenceCommand(char *sentence, int unk1);
void updateSentenceCommand(char *str1, char *str2, int unk1);
@@ -559,7 +559,7 @@
void res_freeLangTable(char ***sting, int *size);
void waitForEvent();
- void delay(uint32 millis, bool update = false);
+ void delay(uint32 millis, bool update = false, bool mainLoop = false);
void loadPalette(const char *filename, uint8 *palData);
void loadMouseShapes();
void loadCharacterShapes();
@@ -712,6 +712,7 @@
int _curMusicTheme;
int _newMusicTheme;
+ int16 _lastMusicCommand;
AudioStream *_currentVocFile;
Audio::SoundHandle _vocHandle;
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/saveload.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- saveload.cpp 12 Jan 2006 13:16:42 -0000 1.5
+++ saveload.cpp 12 Jan 2006 14:53:23 -0000 1.6
@@ -27,7 +27,7 @@
#include "common/savefile.h"
#include "common/system.h"
-#define CURRENT_VERSION 2
+#define CURRENT_VERSION 3
namespace Kyra {
void KyraEngine::loadGame(const char *fileName) {
@@ -167,6 +167,11 @@
_roomTable[sceneId].needInit[i] = in->readByte();
}
}
+ if (version >= 3) {
+ _lastMusicCommand = in->readSint16BE();
+ if (_lastMusicCommand != -1)
+ snd_playWanderScoreViaMap(_lastMusicCommand, 1);
+ }
if (queryGameFlag(0x2D)) {
loadMainScreen(8);
@@ -297,6 +302,8 @@
}
// room table terminator
out->writeUint16BE(0xFFFF);
+
+ out->writeSint16BE(_lastMusicCommand);
out->flush();
More information about the Scummvm-git-logs
mailing list