SCUMM works with new GMM implementation

svn-id: r33001
This commit is contained in:
Christopher Page 2008-07-11 01:22:37 +00:00
parent cbadb51ce7
commit e9c6b03fc7
13 changed files with 22 additions and 36 deletions

View file

@ -496,7 +496,7 @@ void ScummMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
break; break;
#endif #endif
case kQuitCmd: case kQuitCmd:
_vm->_quit = true; _vm->quitGame();
close(); close();
break; break;
default: default:

View file

@ -99,7 +99,7 @@ void CUP_Player::play() {
debug(1, "rate %d width %d height %d", _playbackRate, _width, _height); debug(1, "rate %d width %d height %d", _playbackRate, _width, _height);
int ticks = _system->getMillis(); int ticks = _system->getMillis();
while (_dataSize != 0 && !_vm->_quit) { while (_dataSize != 0 && !_vm->quit()) {
while (parseNextBlockTag(_fileStream)) { while (parseNextBlockTag(_fileStream)) {
if (_fileStream.ioFailed()) { if (_fileStream.ioFailed()) {
return; return;
@ -190,7 +190,7 @@ void CUP_Player::waitForSfxChannel(int channel) {
CUP_SfxChannel *sfxChannel = &_sfxChannels[channel]; CUP_SfxChannel *sfxChannel = &_sfxChannels[channel];
debug(1, "waitForSfxChannel %d", channel); debug(1, "waitForSfxChannel %d", channel);
if ((sfxChannel->flags & kSfxFlagLoop) == 0) { if ((sfxChannel->flags & kSfxFlagLoop) == 0) {
while (_mixer->isSoundHandleActive(sfxChannel->handle) && !_vm->_quit) { while (_mixer->isSoundHandleActive(sfxChannel->handle) && !_vm->quit()) {
_vm->parseEvents(); _vm->parseEvents();
_system->delayMillis(10); _system->delayMillis(10);
} }
@ -496,7 +496,7 @@ void CUP_Player::handleTOIL(Common::SeekableReadStream &dataStream, uint32 dataS
for (int i = 0; i < kSfxChannels; ++i) { for (int i = 0; i < kSfxChannels; ++i) {
waitForSfxChannel(i); waitForSfxChannel(i);
} }
_vm->_quit = true; _vm->quitGame();
break; break;
case 7: { case 7: {
int channelSync = dataStream.readUint32LE(); int channelSync = dataStream.readUint32LE();

View file

@ -2147,10 +2147,10 @@ void ScummEngine_v100he::o100_systemOps() {
break; break;
case 71: case 71:
// Confirm shutdown // Confirm shutdown
shutDown(); quitGame();
break; break;
case 72: case 72:
shutDown(); quitGame();
break; break;
case 73: case 73:
copyScriptString(string, sizeof(string)); copyScriptString(string, sizeof(string));

View file

@ -634,10 +634,10 @@ void ScummEngine_v70he::o70_systemOps() {
break; break;
case 160: case 160:
// Confirm shutdown // Confirm shutdown
shutDown(); quitGame();
break; break;
case 244: case 244:
shutDown(); quitGame();
break; break;
case 250: case 250:
id = pop(); id = pop();

View file

@ -1485,10 +1485,10 @@ void ScummEngine_v72he::o72_systemOps() {
break; break;
case 160: case 160:
// Confirm shutdown // Confirm shutdown
shutDown(); quitGame();
break; break;
case 244: case 244:
shutDown(); quitGame();
break; break;
case 251: case 251:
copyScriptString(string, sizeof(string)); copyScriptString(string, sizeof(string));

View file

@ -192,10 +192,6 @@ void ScummEngine::parseEvents() {
_keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6' _keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6'
break; break;
case Common::EVENT_QUIT:
_quit = true;
break;
default: default:
break; break;
} }

View file

@ -291,7 +291,7 @@ void ScummEngine::readIndexFile() {
if (checkTryMedia(_fileHandle)) { if (checkTryMedia(_fileHandle)) {
displayMessage(NULL, "You're trying to run game encrypted by ActiveMark. This is not supported."); displayMessage(NULL, "You're trying to run game encrypted by ActiveMark. This is not supported.");
_quit = true; quitGame();
return; return;
} }

View file

@ -1769,7 +1769,7 @@ void ScummEngine_v5::o5_systemOps() {
pauseGame(); pauseGame();
break; break;
case 3: // SO_QUIT case 3: // SO_QUIT
shutDown(); quitGame();
break; break;
default: default:
error("o5_systemOps: unknown subopcode %d", subOp); error("o5_systemOps: unknown subopcode %d", subOp);

View file

@ -2310,7 +2310,7 @@ void ScummEngine_v6::o6_systemOps() {
pauseGame(); pauseGame();
break; break;
case 160: // SO_QUIT case 160: // SO_QUIT
shutDown(); quitGame();
break; break;
default: default:
error("o6_systemOps invalid case %d", subOp); error("o6_systemOps invalid case %d", subOp);

View file

@ -1170,7 +1170,7 @@ void ScummEngine_v8::o8_systemOps() {
restart(); restart();
break; break;
case 0x29: // SO_SYSTEM_QUIT Quit game case 0x29: // SO_SYSTEM_QUIT Quit game
shutDown(); quitGame();
break; break;
default: default:
error("o8_systemOps: invalid case 0x%x", subOp); error("o8_systemOps: invalid case 0x%x", subOp);
@ -1289,7 +1289,7 @@ void ScummEngine_v8::o8_kernelSetFunctions() {
if (ConfMan.getBool("confirm_exit")) if (ConfMan.getBool("confirm_exit"))
confirmExitDialog(); confirmExitDialog();
else else
_quit = true; quitGame();
break; break;
case 108: // buildPaletteShadow case 108: // buildPaletteShadow
setShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]); setShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);

View file

@ -143,7 +143,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_objs = NULL; _objs = NULL;
_sound = NULL; _sound = NULL;
memset(&vm, 0, sizeof(vm)); memset(&vm, 0, sizeof(vm));
_quit = false;
_pauseDialog = NULL; _pauseDialog = NULL;
_scummMenuDialog = NULL; _scummMenuDialog = NULL;
_versionDialog = NULL; _versionDialog = NULL;
@ -815,7 +814,6 @@ ScummEngine_vCUPhe::ScummEngine_vCUPhe(OSystem *syst, const DetectorResult &dr)
_syst = syst; _syst = syst;
_game = dr.game; _game = dr.game;
_filenamePattern = dr.fp, _filenamePattern = dr.fp,
_quit = false;
_cupPlayer = new CUP_Player(syst, this, _mixer); _cupPlayer = new CUP_Player(syst, this, _mixer);
} }
@ -846,9 +844,6 @@ void ScummEngine_vCUPhe::parseEvents() {
while (_eventMan->pollEvent(event)) { while (_eventMan->pollEvent(event)) {
switch (event.type) { switch (event.type) {
case Common::EVENT_QUIT:
_quit = true;
break;
default: default:
break; break;
@ -1722,7 +1717,7 @@ int ScummEngine::go() {
int diff = 0; // Duration of one loop iteration int diff = 0; // Duration of one loop iteration
while (!_quit) { while (!quit()) {
if (_debugger->isAttached()) if (_debugger->isAttached())
_debugger->onFrame(); _debugger->onFrame();
@ -1755,12 +1750,12 @@ int ScummEngine::go() {
diff = _system->getMillis() - diff; diff = _system->getMillis() - diff;
if (_quit) { if (quit()) {
// TODO: Maybe perform an autosave on exit? // TODO: Maybe perform an autosave on exit?
} }
} }
return _rtl; return _eventMan->shouldRTL();
} }
void ScummEngine::waitForTimer(int msec_delay) { void ScummEngine::waitForTimer(int msec_delay) {
@ -1773,7 +1768,7 @@ void ScummEngine::waitForTimer(int msec_delay) {
start_time = _system->getMillis(); start_time = _system->getMillis();
while (!_quit) { while (!quit()) {
_sound->updateCD(); // Loop CD Audio if needed _sound->updateCD(); // Loop CD Audio if needed
parseEvents(); parseEvents();
_system->updateScreen(); _system->updateScreen();
@ -1896,7 +1891,7 @@ load_game:
checkExecVerbs(); checkExecVerbs();
checkAndRunSentenceScript(); checkAndRunSentenceScript();
if (_quit) if (quit())
return; return;
// HACK: If a load was requested, immediately perform it. This avoids // HACK: If a load was requested, immediately perform it. This avoids
@ -2161,10 +2156,6 @@ void ScummEngine::pauseGame() {
pauseDialog(); pauseDialog();
} }
void ScummEngine::shutDown() {
_quit = true;
}
void ScummEngine::restart() { void ScummEngine::restart() {
// TODO: Check this function - we should probably be reinitting a lot more stuff, and I suspect // TODO: Check this function - we should probably be reinitting a lot more stuff, and I suspect
// this leaks memory like a sieve // this leaks memory like a sieve
@ -2317,7 +2308,7 @@ void ScummEngine::confirmExitDialog() {
ConfirmDialog d(this, 6); ConfirmDialog d(this, 6);
if (runDialog(d)) { if (runDialog(d)) {
_quit = true; quitGame();
} }
} }

View file

@ -496,7 +496,6 @@ protected:
public: public:
void pauseGame(); void pauseGame();
void restart(); void restart();
void shutDown();
protected: protected:
Dialog *_pauseDialog; Dialog *_pauseDialog;

View file

@ -1333,7 +1333,7 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st
} }
if (_endOfFile) if (_endOfFile)
break; break;
if (_vm->_quit || _vm->_saveLoadFlag || _vm->_smushVideoShouldFinish) { if (_vm->quit() || _vm->_saveLoadFlag || _vm->_smushVideoShouldFinish) {
_smixer->stop(); _smixer->stop();
_vm->_mixer->stopHandle(_compressedFileSoundHandle); _vm->_mixer->stopHandle(_compressedFileSoundHandle);
_vm->_mixer->stopHandle(_IACTchannel); _vm->_mixer->stopHandle(_IACTchannel);