diff options
author | Max Horn | 2004-01-08 20:37:26 +0000 |
---|---|---|
committer | Max Horn | 2004-01-08 20:37:26 +0000 |
commit | ebecf1dbaa0284f22a053e5b2e9510d6e6db4fdf (patch) | |
tree | 98b45acc08e3f2a2ecaf22fb60a614d9f31f17e6 /scumm | |
parent | e68a3650594fc3a62a26aece5705eb3602b6d1ad (diff) | |
download | scummvm-rg350-ebecf1dbaa0284f22a053e5b2e9510d6e6db4fdf.tar.gz scummvm-rg350-ebecf1dbaa0284f22a053e5b2e9510d6e6db4fdf.tar.bz2 scummvm-rg350-ebecf1dbaa0284f22a053e5b2e9510d6e6db4fdf.zip |
unify _vm / _scumm usage
svn-id: r12262
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/dialogs.cpp | 46 | ||||
-rw-r--r-- | scumm/dialogs.h | 6 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 70 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 2 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_sndmgr.cpp | 44 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_sndmgr.h | 2 | ||||
-rw-r--r-- | scumm/player_v1.cpp | 2 | ||||
-rw-r--r-- | scumm/player_v2.cpp | 4 | ||||
-rw-r--r-- | scumm/player_v2.h | 2 | ||||
-rw-r--r-- | scumm/player_v2a.cpp | 6 | ||||
-rw-r--r-- | scumm/player_v2a.h | 2 | ||||
-rw-r--r-- | scumm/player_v3a.cpp | 18 | ||||
-rw-r--r-- | scumm/player_v3a.h | 2 | ||||
-rw-r--r-- | scumm/script.cpp | 10 | ||||
-rw-r--r-- | scumm/scumm.h | 2 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 2 | ||||
-rw-r--r-- | scumm/smush/insane.cpp | 128 | ||||
-rw-r--r-- | scumm/smush/insane.h | 2 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 96 | ||||
-rw-r--r-- | scumm/smush/smush_player.h | 2 | ||||
-rw-r--r-- | scumm/sound.cpp | 194 | ||||
-rw-r--r-- | scumm/sound.h | 2 |
22 files changed, 322 insertions, 322 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 50345c1976..bfbc5ef578 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -152,19 +152,19 @@ const Common::String ScummDialog::queryResString(int stringno) { if (stringno == 0) return String(); - if (_scumm->_version >= 7) - result = _scumm->getStringAddressVar(string_map_table_v7[stringno - 1].num); - else if (_scumm->_version == 6) - result = _scumm->getStringAddressVar(string_map_table_v6[stringno - 1].num); - else if (_scumm->_version == 5) - result = _scumm->getStringAddress(string_map_table_v5[stringno - 1].num); + if (_vm->_version >= 7) + result = _vm->getStringAddressVar(string_map_table_v7[stringno - 1].num); + else if (_vm->_version == 6) + result = _vm->getStringAddressVar(string_map_table_v6[stringno - 1].num); + else if (_vm->_version == 5) + result = _vm->getStringAddress(string_map_table_v5[stringno - 1].num); else // TODO: For V8 games, maybe grab the strings from the language file? return string_map_table_v5[stringno - 1].string; if (result && *result == '/') { byte tmp[256]; - _scumm->translateText(result, tmp); + _vm->translateText(result, tmp); // FIXME: AARGH! We shouldn't just strcpy into the data we got from getStringAddress strcpy((char *)result, (char *)tmp); @@ -344,7 +344,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat close(); break; case kOptionsCmd: - _scumm->optionsDialog(); + _vm->optionsDialog(); break; case kAboutCmd: _aboutDialog->runModal(); @@ -355,7 +355,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; #endif case kQuitCmd: - _scumm->_quit = true; + _vm->_quit = true; close(); break; default: @@ -373,7 +373,7 @@ void MainMenuDialog::close() { void MainMenuDialog::save() { int idx; - _saveDialog->setList(generateSavegameList(_scumm, true)); + _saveDialog->setList(generateSavegameList(_vm, true)); idx = _saveDialog->runModal(); if (idx >= 0) { const String &result = _saveDialog->getResultString(); @@ -385,17 +385,17 @@ void MainMenuDialog::save() { str = buffer; } else str = result.c_str(); - _scumm->requestSave(idx + 1, str); + _vm->requestSave(idx + 1, str); close(); } } void MainMenuDialog::load() { int idx; - _loadDialog->setList(generateSavegameList(_scumm, false)); + _loadDialog->setList(generateSavegameList(_vm, false)); idx = _loadDialog->runModal(); if (idx >= 0) { - _scumm->requestLoad(idx); + _vm->requestLoad(idx); close(); } } @@ -412,10 +412,10 @@ enum { #ifndef _WIN32_WCE ConfigDialog::ConfigDialog(ScummEngine *scumm) - : GUI::OptionsDialog("", 40, 30, 240, 124), _scumm(scumm) { + : GUI::OptionsDialog("", 40, 30, 240, 124), _vm(scumm) { #else ConfigDialog::ConfigDialog(ScummEngine *scumm) - : GUI::OptionsDialog("", 40, 30, 240, 124 + 4), _scumm(scumm) { + : GUI::OptionsDialog("", 40, 30, 240, 124 + 4), _vm(scumm) { #endif // // Add the buttons @@ -475,15 +475,15 @@ void ConfigDialog::close() { int soundVolumeMusic = ConfMan.getInt("music_volume"); int soundVolumeSfx = ConfMan.getInt("sfx_volume"); - if (_scumm->_imuse) { - _scumm->_imuse->set_music_volume(soundVolumeMusic); + if (_vm->_imuse) { + _vm->_imuse->set_music_volume(soundVolumeMusic); } - if (_scumm->_musicEngine) { - _scumm->_musicEngine->setMasterVolume(soundVolumeMaster); + if (_vm->_musicEngine) { + _vm->_musicEngine->setMasterVolume(soundVolumeMaster); } - _scumm->_mixer->setVolume(soundVolumeSfx * soundVolumeMaster / 255); - _scumm->_mixer->setMusicVolume(soundVolumeMusic); + _vm->_mixer->setVolume(soundVolumeSfx * soundVolumeMaster / 255); + _vm->_mixer->setMusicVolume(soundVolumeMusic); } @@ -532,7 +532,7 @@ void HelpDialog::displayKeyBindings() { String titleStr, *keyStr, *dscStr; - ScummHelp::updateStrings(_scumm->_gameId, _scumm->_version, _page, titleStr, keyStr, dscStr); + ScummHelp::updateStrings(_vm->_gameId, _vm->_version, _page, titleStr, keyStr, dscStr); _title->setLabel(titleStr); for (int i = 0; i < HELP_NUM_LINES; i++) { @@ -591,7 +591,7 @@ InfoDialog::InfoDialog(ScummEngine *scumm, const String& message) void InfoDialog::setInfoText(const String& message) { int width = g_gui.getStringWidth(message) + 16; - _x = (_scumm->_screenWidth - width) >> 1; + _x = (_vm->_screenWidth - width) >> 1; _w = width; new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter); diff --git a/scumm/dialogs.h b/scumm/dialogs.h index d8b7390fb2..b649099a35 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -43,12 +43,12 @@ class ScummEngine; class ScummDialog : public GUI::Dialog { public: ScummDialog(ScummEngine *scumm, int x, int y, int w, int h) - : GUI::Dialog(x, y, w, h), _scumm(scumm) {} + : GUI::Dialog(x, y, w, h), _vm(scumm) {} protected: typedef Common::String String; - ScummEngine *_scumm; + ScummEngine *_vm; // Query a string from the resources const String queryResString(int stringno); @@ -103,7 +103,7 @@ protected: class ConfigDialog : public GUI::OptionsDialog { protected: - ScummEngine *_scumm; + ScummEngine *_vm; #ifdef _WIN32_WCE GUI::Dialog *_keysDialog; #endif diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index e7231dd6c2..b0b45daf37 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -42,15 +42,15 @@ void IMuseDigital::timer_handler(void *refCon) { } IMuseDigital::IMuseDigital(ScummEngine *scumm) - : _scumm(scumm) { + : _vm(scumm) { _pause = false; - _sound = new ImuseDigiSndMgr(_scumm); - _scumm->_timer->installTimerProc(timer_handler, 1000000 / 25, this); + _sound = new ImuseDigiSndMgr(_vm); + _vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this); _curMusicId = -1; } IMuseDigital::~IMuseDigital() { - _scumm->_timer->removeTimerProc(timer_handler); + _vm->_timer->removeTimerProc(timer_handler); stopAllSounds(); delete _sound; } @@ -58,7 +58,7 @@ IMuseDigital::~IMuseDigital() { void IMuseDigital::callback() { int l = 0; - if (_pause || !_scumm) + if (_pause || !_vm) return; for (l = 0; l < MAX_DIGITAL_TRACKS;l ++) { @@ -109,14 +109,14 @@ void IMuseDigital::callback() { int pan = (_track[l].pan != 64) ? 2 * _track[l].pan - 127 : 0; - if (_scumm->_mixer->isReady()) { + if (_vm->_mixer->isReady()) { if (_track[l].stream2) { if (!_track[l].started) { _track[l].started = true; - _scumm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, true, _track[l].vol / 1000, _track[l].pan, -1, false); + _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, true, _track[l].vol / 1000, _track[l].pan, -1, false); } else { - _scumm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); - _scumm->_mixer->setChannelPan(_track[l].handle, pan); + _vm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); + _vm->_mixer->setChannelPan(_track[l].handle, pan); } continue; } @@ -164,9 +164,9 @@ void IMuseDigital::callback() { if (result > mixer_size) result = mixer_size; - if (_scumm->_mixer->isReady()) { - _scumm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); - _scumm->_mixer->setChannelPan(_track[l].handle, pan); + if (_vm->_mixer->isReady()) { + _vm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); + _vm->_mixer->setChannelPan(_track[l].handle, pan); _track[l].stream->append(data, result); _track[l].regionOffset += result; _track[l].trackOffset += result; @@ -189,7 +189,7 @@ void IMuseDigital::callback() { void IMuseDigital::switchToNextRegion(int track) { int num_regions = _sound->getNumRegions(_track[track].soundHandle); int num_jumps = _sound->getNumJumps(_track[track].soundHandle); - if ((_scumm->_gameId == GID_FT) && (num_jumps != 0)) { + if ((_vm->_gameId == GID_FT) && (num_jumps != 0)) { _track[track].regionOffset = 0; return; } @@ -280,7 +280,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, } else { _track[l].stream2 = NULL; _track[l].stream = makeAppendableAudioStream(freq, mixerFlags, 100000); - _scumm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, true, _track[l].vol / 1000, _track[l].pan, -1); + _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, true, _track[l].vol / 1000, _track[l].pan, -1); } if (soundGroup == IMUSE_MUSIC) { @@ -315,7 +315,7 @@ void IMuseDigital::stopSound(int soundId) { _track[l].toBeRemoved = true; } else if (_track[l].stream2) - _scumm->_mixer->stopHandle(_track[l].handle); + _vm->_mixer->stopHandle(_track[l].handle); } } } @@ -327,7 +327,7 @@ void IMuseDigital::stopAllSounds(bool waitForStop) { if (_track[l].stream) { _track[l].toBeRemoved = true; } else if (_track[l].stream2) - _scumm->_mixer->stopHandle(_track[l].handle); + _vm->_mixer->stopHandle(_track[l].handle); } } _curMusicId = -1; @@ -347,7 +347,7 @@ void IMuseDigital::stopAllSounds(bool waitForStop) { void IMuseDigital::pause(bool p) { for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { if (_track[l].used) { - _scumm->_mixer->pauseHandle(_track[l].handle, p); + _vm->_mixer->pauseHandle(_track[l].handle, p); } } _pause = p; @@ -407,7 +407,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int switch (sub_cmd) { case 0x600: // set new volume with fading debug(5, "ImuseFadeParam - fade sample(%d), to volume(%d) with 60hz ticks(%d)", sample, d, e); - if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) { + if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) { stopSound(sample); return; } @@ -432,14 +432,14 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; case 0x1000: // ImuseSetState debug(5, "ImuseSetState (%d)", b); - if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) { + if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) { if (b == 1) startMusic(1); else { if (getSoundStatus(2) == 0) startMusic(2); } - } else if (_scumm->_gameId == GID_DIG) { + } else if (_vm->_gameId == GID_DIG) { if (b == 1000) { // STATE_NULL stopMusic(); return; @@ -454,7 +454,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; } } - } else if ((_scumm->_gameId == GID_CMI) && (_scumm->_features & GF_DEMO)) { + } else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) { if (b == 2) { startMusic("in1.imx", 2002); } else if (b == 4) { @@ -466,9 +466,9 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int } else if (b == 16) { startMusic("gun.imx", 2016); } else { - warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, this->_scumm->_currentRoom); + warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, this->_vm->_currentRoom); } - } else if (_scumm->_gameId == GID_CMI) { + } else if (_vm->_gameId == GID_CMI) { if (b == 1000) { // STATE_NULL stopMusic(); return; @@ -482,7 +482,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; } } - } else if (_scumm->_gameId == GID_FT) { + } else if (_vm->_gameId == GID_FT) { for (l = 0;; l++) { if (_ftStateMusicTable[l].index == -1) { return; @@ -490,8 +490,8 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int if (_ftStateMusicTable[l].index == b) { debug(5, "Play imuse music: %s, %s", _ftStateMusicTable[l].name, _ftStateMusicTable[l].audioname); if (_ftStateMusicTable[l].audioname[0] != 0) { - for (r = 0; r < _scumm->_numAudioNames; r++) { - if (strcmp(_ftStateMusicTable[l].audioname, &_scumm->_audioNames[r * 9]) == 0) { + for (r = 0; r < _vm->_numAudioNames; r++) { + if (strcmp(_ftStateMusicTable[l].audioname, &_vm->_audioNames[r * 9]) == 0) { startMusic(r); parseScriptCmds(12, r, 0x600, _ftStateMusicTable[l].volume, 0, 0, 0, 0); } @@ -503,7 +503,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; case 0x1001: // ImuseSetSequence debug(5, "ImuseSetSequence (%d)", b); - if (_scumm->_gameId == GID_DIG) { + if (_vm->_gameId == GID_DIG) { for (l = 0; _digSeqMusicTable[l].room != -1; l++) { if (_digSeqMusicTable[l].room == b) { debug(5, "Play imuse music: %s, %s, %s", _digSeqMusicTable[l].name, _digSeqMusicTable[l].title, _digSeqMusicTable[l].filename); @@ -513,7 +513,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; } } - } else if (_scumm->_gameId == GID_CMI) { + } else if (_vm->_gameId == GID_CMI) { for (l = 0; _comiSeqMusicTable[l].id != -1; l++) { if (_comiSeqMusicTable[l].id == b) { debug(5, "Play imuse music: %s, %s, %s", _comiSeqMusicTable[l].name, _comiSeqMusicTable[l].title, _comiSeqMusicTable[l].filename); @@ -523,13 +523,13 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; } } - } else if (_scumm->_gameId == GID_FT) { + } else if (_vm->_gameId == GID_FT) { for (l = 0; _ftSeqMusicTable[l].index != -1; l++) { if (_ftSeqMusicTable[l].index == b) { debug(5, "Play imuse music: %s, %s", _ftSeqMusicTable[l].name, _ftSeqMusicTable[l].audioname); if (_ftSeqMusicTable[l].audioname[0] != 0) { - for (r = 0; r < _scumm->_numAudioNames; r++) { - if (strcmp(_ftSeqMusicTable[l].audioname, &_scumm->_audioNames[r * 9]) == 0) { + for (r = 0; r < _vm->_numAudioNames; r++) { + if (strcmp(_ftSeqMusicTable[l].audioname, &_vm->_audioNames[r * 9]) == 0) { // startMusic(r); // parseScriptCmds(12, r, 0x600, _ftSeqMusicTable[l].volume, 0, 0, 0, 0); } @@ -593,22 +593,22 @@ int32 IMuseDigital::getCurMusicPosInMs() { int32 IMuseDigital::getCurVoiceLipSyncWidth() { // int32 pos = getPosInMs(kTalkSoundID); - return _scumm->_rnd.getRandomNumber(255); + return _vm->_rnd.getRandomNumber(255); } int32 IMuseDigital::getCurVoiceLipSyncHeight() { // int32 pos = getPosInMs(kTalkSoundID); - return _scumm->_rnd.getRandomNumber(255); + return _vm->_rnd.getRandomNumber(255); } int32 IMuseDigital::getCurMusicLipSyncWidth(int32 param) { // int32 pos = getPosInMs(_curMusicId); - return _scumm->_rnd.getRandomNumber(255); + return _vm->_rnd.getRandomNumber(255); } int32 IMuseDigital::getCurMusicLipSyncHeight(int32 param) { // int32 pos = getPosInMs(_curMusicId); - return _scumm->_rnd.getRandomNumber(255); + return _vm->_rnd.getRandomNumber(255); } } // End of namespace Scumm diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index d4260a333b..ba2485b9aa 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -68,7 +68,7 @@ private: Track _track[MAX_DIGITAL_TRACKS]; - ScummEngine *_scumm; + ScummEngine *_vm; ImuseDigiSndMgr *_sound; bool _pause; int _curMusicId; diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp index 18db14f6f6..1028ff0b17 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -30,7 +30,7 @@ namespace Scumm { ImuseDigiSndMgr::ImuseDigiSndMgr(ScummEngine *scumm) { memset(&_sounds, 0, sizeof(_sounds)); - _scumm = scumm; + _vm = scumm; _mutex = g_system->create_mutex(); _disk = 0; _cacheBundleDir = new BundleDirCache(); @@ -145,23 +145,23 @@ bool ImuseDigiSndMgr::openMusicBundle(int slot) { bool result = false; _sounds[slot]._bundle = new BundleMgr(_cacheBundleDir); - if (_scumm->_gameId == GID_CMI) { - if (_scumm->_features & GF_DEMO) { - result = _sounds[slot]._bundle->openFile("music.bun", _scumm->getGameDataPath()); + if (_vm->_gameId == GID_CMI) { + if (_vm->_features & GF_DEMO) { + result = _sounds[slot]._bundle->openFile("music.bun", _vm->getGameDataPath()); } else { char musicfile[20]; - sprintf(musicfile, "musdisk%d.bun", _scumm->VAR(_scumm->VAR_CURRENTDISK)); - if (_disk != _scumm->VAR(_scumm->VAR_CURRENTDISK)) + sprintf(musicfile, "musdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK)); + if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) _sounds[slot]._bundle->closeFile(); - result = _sounds[slot]._bundle->openFile(musicfile, _scumm->getGameDataPath()); + result = _sounds[slot]._bundle->openFile(musicfile, _vm->getGameDataPath()); if (result == false) - result = _sounds[slot]._bundle->openFile("music.bun", _scumm->getGameDataPath()); - _disk = (byte)_scumm->VAR(_scumm->VAR_CURRENTDISK); + result = _sounds[slot]._bundle->openFile("music.bun", _vm->getGameDataPath()); + _disk = (byte)_vm->VAR(_vm->VAR_CURRENTDISK); } - } else if (_scumm->_gameId == GID_DIG) - result = _sounds[slot]._bundle->openFile("digmusic.bun", _scumm->getGameDataPath()); + } else if (_vm->_gameId == GID_DIG) + result = _sounds[slot]._bundle->openFile("digmusic.bun", _vm->getGameDataPath()); else error("ImuseDigiSndMgr::openMusicBundle() Don't know which bundle file to load"); @@ -172,23 +172,23 @@ bool ImuseDigiSndMgr::openVoiceBundle(int slot) { bool result = false; _sounds[slot]._bundle = new BundleMgr(_cacheBundleDir); - if (_scumm->_gameId == GID_CMI) { - if (_scumm->_features & GF_DEMO) { - result = _sounds[slot]._bundle->openFile("voice.bun", _scumm->getGameDataPath()); + if (_vm->_gameId == GID_CMI) { + if (_vm->_features & GF_DEMO) { + result = _sounds[slot]._bundle->openFile("voice.bun", _vm->getGameDataPath()); } else { char voxfile[20]; - sprintf(voxfile, "voxdisk%d.bun", _scumm->VAR(_scumm->VAR_CURRENTDISK)); - if (_disk != _scumm->VAR(_scumm->VAR_CURRENTDISK)) + sprintf(voxfile, "voxdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK)); + if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) _sounds[slot]._bundle->closeFile(); - result = _sounds[slot]._bundle->openFile(voxfile, _scumm->getGameDataPath()); + result = _sounds[slot]._bundle->openFile(voxfile, _vm->getGameDataPath()); if (result == false) - result = _sounds[slot]._bundle->openFile("voice.bun", _scumm->getGameDataPath()); - _disk = (byte)_scumm->VAR(_scumm->VAR_CURRENTDISK); + result = _sounds[slot]._bundle->openFile("voice.bun", _vm->getGameDataPath()); + _disk = (byte)_vm->VAR(_vm->VAR_CURRENTDISK); } - } else if (_scumm->_gameId == GID_DIG) - result = _sounds[slot]._bundle->openFile("digvoice.bun", _scumm->getGameDataPath()); + } else if (_vm->_gameId == GID_DIG) + result = _sounds[slot]._bundle->openFile("digvoice.bun", _vm->getGameDataPath()); else error("ImuseDigiSndMgr::openVoiceBundle() Don't know which bundle file to load"); @@ -210,7 +210,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch if (soundName == NULL) { if ((soundType == IMUSE_RESOURCE)) { - ptr = _scumm->getResourceAddress(rtSound, soundId); + ptr = _vm->getResourceAddress(rtSound, soundId); if (ptr == NULL) { closeSound(&_sounds[slot]); return NULL; diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h index 8e27d5693e..d53eefbb52 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.h +++ b/scumm/imuse_digi/dimuse_sndmgr.h @@ -94,7 +94,7 @@ private: int allocSlot(); void prepareSound(byte *ptr, int slot); - ScummEngine *_scumm; + ScummEngine *_vm; OSystem::MutexRef _mutex; byte _disk; BundleDirCache *_cacheBundleDir; diff --git a/scumm/player_v1.cpp b/scumm/player_v1.cpp index 6af19808df..909fa4a54d 100644 --- a/scumm/player_v1.cpp +++ b/scumm/player_v1.cpp @@ -64,7 +64,7 @@ void Player_V1::chainSound(int nr, byte *data) { } void Player_V1::startSound(int nr) { - byte *data = _scumm->getResourceAddress(rtSound, nr); + byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); mutex_up(); diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index c191282f98..e44cb7ae98 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -345,7 +345,7 @@ Player_V2::Player_V2(ScummEngine *scumm, bool pcjr) { int i; _isV3Game = (scumm->_version >= 3); - _scumm = scumm; + _vm = scumm; _system = scumm->_system; _mixer = scumm->_mixer; _sample_rate = _system->property(OSystem::PROP_GET_SAMPLE_RATE, 0); @@ -491,7 +491,7 @@ void Player_V2::stopSound(int nr) { } void Player_V2::startSound(int nr) { - byte *data = _scumm->getResourceAddress(rtSound, nr); + byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); mutex_up(); diff --git a/scumm/player_v2.h b/scumm/player_v2.h index c8c42f5402..98cf424c52 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -88,7 +88,7 @@ protected: bool _isV3Game; SoundMixer *_mixer; OSystem *_system; - ScummEngine *_scumm; + ScummEngine *_vm; bool _pcjr; int _header_len; diff --git a/scumm/player_v2a.cpp b/scumm/player_v2a.cpp index b82c13467b..216d2ad168 100644 --- a/scumm/player_v2a.cpp +++ b/scumm/player_v2a.cpp @@ -1154,7 +1154,7 @@ static V2A_Sound *findSound (unsigned long crc) { Player_V2A::Player_V2A(ScummEngine *scumm) { int i; - _scumm = scumm; + _vm = scumm; _system = scumm->_system; #ifdef __PALM_OS__ @@ -1221,8 +1221,8 @@ void Player_V2A::stopSound(int nr) { } void Player_V2A::startSound(int nr) { - assert(_scumm); - byte *data = _scumm->getResourceAddress(rtSound, nr); + assert(_vm); + byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); uint32 crc = GetCRC(data + 0x0A, READ_BE_UINT16(data + 0x08)); V2A_Sound *snd = findSound(crc); diff --git a/scumm/player_v2a.h b/scumm/player_v2a.h index 5b2883d141..8ff38ab990 100644 --- a/scumm/player_v2a.h +++ b/scumm/player_v2a.h @@ -61,7 +61,7 @@ private: }; OSystem *_system; - ScummEngine *_scumm; + ScummEngine *_vm; Player_MOD *_mod; soundSlot _slot[V2A_MAXSLOTS]; diff --git a/scumm/player_v3a.cpp b/scumm/player_v3a.cpp index a724d7cf2c..3a4356c169 100644 --- a/scumm/player_v3a.cpp +++ b/scumm/player_v3a.cpp @@ -36,7 +36,7 @@ static const uint16 note_freqs[4][12] = { Player_V3A::Player_V3A(ScummEngine *scumm) { int i; - _scumm = scumm; + _vm = scumm; _system = scumm->_system; for (i = 0; i < V3A_MAXMUS; i++) { _mus[i].id = 0; @@ -154,11 +154,11 @@ void Player_V3A::stopSound(int nr) { } void Player_V3A::startSound(int nr) { - assert(_scumm); - byte *data = _scumm->getResourceAddress(rtSound, nr); + assert(_vm); + byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); - if ((_scumm->_gameId != GID_INDY3) && (_scumm->_gameId != GID_LOOM)) + if ((_vm->_gameId != GID_INDY3) && (_vm->_gameId != GID_LOOM)) error("player_v3a - unknown game!"); if (!_isinit) { @@ -167,11 +167,11 @@ void Player_V3A::startSound(int nr) { int offset = 4; int numInstruments; - if (_scumm->_gameId == GID_INDY3) { - ptr = _scumm->getResourceAddress(rtSound, 83); + if (_vm->_gameId == GID_INDY3) { + ptr = _vm->getResourceAddress(rtSound, 83); numInstruments = 12; } else { - ptr = _scumm->getResourceAddress(rtSound, 79); + ptr = _vm->getResourceAddress(rtSound, 79); numInstruments = 9; } assert(ptr); @@ -195,7 +195,7 @@ void Player_V3A::startSound(int nr) { _wavetable[i]->_oct[j] = READ_BE_UINT16(ptr + offset + 8); offset += 10; } - if (_scumm->_gameId == GID_INDY3) { + if (_vm->_gameId == GID_INDY3) { _wavetable[i]->_pitadjust = 0; offset += 2; } else { @@ -239,7 +239,7 @@ void Player_V3A::startSound(int nr) { } _sfx[i].id = nr; _sfx[i].dur = looped ? -1 : (1 + 60 * size / rate); - if ((_scumm->_gameId == GID_INDY3) && (nr == 60)) + if ((_vm->_gameId == GID_INDY3) && (nr == 60)) _sfx[i].dur = 240; _mod->startChannel(nr | 0x100, sound, size, rate, vol, loopStart, loopEnd); } diff --git a/scumm/player_v3a.h b/scumm/player_v3a.h index 885e8199bc..434c0de207 100644 --- a/scumm/player_v3a.h +++ b/scumm/player_v3a.h @@ -76,7 +76,7 @@ private: }; OSystem *_system; - ScummEngine *_scumm; + ScummEngine *_vm; Player_MOD *_mod; musChan _mus[V3A_MAXMUS]; diff --git a/scumm/script.cpp b/scumm/script.cpp index 9beea1d698..70bafab194 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -399,7 +399,7 @@ void ScummEngine::executeScript() { if (_showStack == 1) { printf("Stack:"); for (c=0; c < _scummStackPos; c++) { - printf(" %d", _scummStack[c]); + printf(" %d", _vmStack[c]); } printf("\n"); } @@ -617,16 +617,16 @@ void ScummEngine::setResult(int value) { } void ScummEngine::push(int a) { - assert(_scummStackPos >= 0 && _scummStackPos < ARRAYSIZE(_scummStack)); - _scummStack[_scummStackPos++] = a; + assert(_scummStackPos >= 0 && _scummStackPos < ARRAYSIZE(_vmStack)); + _vmStack[_scummStackPos++] = a; } int ScummEngine::pop() { - if (_scummStackPos < 1 || _scummStackPos > ARRAYSIZE(_scummStack)) { + if (_scummStackPos < 1 || _scummStackPos > ARRAYSIZE(_vmStack)) { error("No items on stack to pop() for %s (0x%X) at [%d-%d]", getOpcodeDesc(_opcode), _opcode, _roomResource, vm.slot[_currentScript].number); } - return _scummStack[--_scummStackPos]; + return _vmStack[--_scummStackPos]; } void ScummEngine::stopObjectCode() { diff --git a/scumm/scumm.h b/scumm/scumm.h index bbc90076d0..29072a4bef 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -473,7 +473,7 @@ protected: uint16 _curExecScript; byte **_lastCodePtr; int _resultVarNumber, _scummStackPos; - int _scummStack[150]; + int _vmStack[150]; int _keyScriptKey, _keyScriptNo; virtual void setupOpcodes() = 0; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index b90b4efaa3..f55d05eb30 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -388,7 +388,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _lastCodePtr = NULL; _resultVarNumber = 0; _scummStackPos = 0; - memset(_scummStack, 0, sizeof(_scummStack)); + memset(_vmStack, 0, sizeof(_vmStack)); _keyScriptKey = 0; _keyScriptNo = 0; _fileOffset = 0; diff --git a/scumm/smush/insane.cpp b/scumm/smush/insane.cpp index e92b0b2b2a..9d4d2eae4c 100644 --- a/scumm/smush/insane.cpp +++ b/scumm/smush/insane.cpp @@ -59,10 +59,10 @@ static const int actorAnimationData[21] = {20, 21, 22, 23, 24, 25, 26, 13, 14, 1 Insane::Insane(ScummEngine *scumm) { - _scumm = scumm; + _vm = scumm; // Demo has different insane, so disable it now - if (_scumm->_features & GF_DEMO) + if (_vm->_features & GF_DEMO) return; initvars(); @@ -77,14 +77,14 @@ Insane::Insane(ScummEngine *scumm) { readFileToMem("minedriv.flu", &_smush_minedrivFlu); readFileToMem("minefite.flu", &_smush_minefiteFlu); - _smush_iconsNut = new NutRenderer(_scumm); - _smush_iconsNut->loadFont("icons.nut", _scumm->getGameDataPath()); - _smush_icons2Nut = new NutRenderer(_scumm); - _smush_icons2Nut->loadFont("icons2.nut", _scumm->getGameDataPath()); - _smush_bensgoggNut = new NutRenderer(_scumm); - _smush_bensgoggNut->loadFont("bensgogg.nut", _scumm->getGameDataPath()); - _smush_bencutNut = new NutRenderer(_scumm); - _smush_bencutNut->loadFont("bencut.nut", _scumm->getGameDataPath()); + _smush_iconsNut = new NutRenderer(_vm); + _smush_iconsNut->loadFont("icons.nut", _vm->getGameDataPath()); + _smush_icons2Nut = new NutRenderer(_vm); + _smush_icons2Nut->loadFont("icons2.nut", _vm->getGameDataPath()); + _smush_bensgoggNut = new NutRenderer(_vm); + _smush_bensgoggNut->loadFont("bensgogg.nut", _vm->getGameDataPath()); + _smush_bencutNut = new NutRenderer(_vm); + _smush_bencutNut->loadFont("bencut.nut", _vm->getGameDataPath()); // FIXME: implement // openManyResource(0, 4, "specfnt.nut", "titlfnt.nut", "techfnt.nut", "scummfnt.nut"); @@ -733,7 +733,7 @@ int32 Insane::enemy0handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = -160; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -878,7 +878,7 @@ int32 Insane::enemy1handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = -160; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -1027,7 +1027,7 @@ int32 Insane::enemy2handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = -160; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -1185,7 +1185,7 @@ int32 Insane::enemy3handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = -160; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -1355,7 +1355,7 @@ int32 Insane::enemy4handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = -160; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -1499,7 +1499,7 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) { _enHdlVar[EN_VULTF2][0]++; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -1626,7 +1626,7 @@ int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = -160; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[0].act[2].state = 97; @@ -1714,7 +1714,7 @@ int32 Insane::enemy7handler(int32 actor1, int32 actor2, int32 probability) { _enHdlVar[EN_CAVEFISH][0] = act1damage; // Shift+V cheat to win the battle - if (_scumm->getKeyState(0x56) && !_beenCheated && + if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { _beenCheated = 1; _actor[1].damage = _actor[1].maxdamage + 10; @@ -1771,11 +1771,11 @@ int32 Insane::enemyBenHandler(int32 actor1, int32 actor2, int32 probability) { int32 Insane::processMouse(void) { int32 buttons = 0; - _enemyState[EN_BEN][0] = _scumm->_mouse.x; - _enemyState[EN_BEN][1] = _scumm->_mouse.y; + _enemyState[EN_BEN][0] = _vm->_mouse.x; + _enemyState[EN_BEN][1] = _vm->_mouse.y; - buttons = _scumm->VAR(_scumm->VAR_LEFTBTN_HOLD) ? 1 : 0; - buttons |= _scumm->VAR(_scumm->VAR_RIGHTBTN_HOLD) ? 2 : 0; + buttons = _vm->VAR(_vm->VAR_LEFTBTN_HOLD) ? 1 : 0; + buttons |= _vm->VAR(_vm->VAR_RIGHTBTN_HOLD) ? 2 : 0; return buttons; } @@ -1785,16 +1785,16 @@ int32 Insane::processKeyboard(void) { int dx = 0, dy = 0; int tmpx, tmpy; - if (_scumm->getKeyState(0x14f) || _scumm->getKeyState(0x14b) || _scumm->getKeyState(0x147)) + if (_vm->getKeyState(0x14f) || _vm->getKeyState(0x14b) || _vm->getKeyState(0x147)) dx--; - if (_scumm->getKeyState(0x151) || _scumm->getKeyState(0x14d) || _scumm->getKeyState(0x149)) + if (_vm->getKeyState(0x151) || _vm->getKeyState(0x14d) || _vm->getKeyState(0x149)) dx++; - if (_scumm->getKeyState(0x147) || _scumm->getKeyState(0x148) || _scumm->getKeyState(0x149)) + if (_vm->getKeyState(0x147) || _vm->getKeyState(0x148) || _vm->getKeyState(0x149)) dy--; - if (_scumm->getKeyState(0x14f) || _scumm->getKeyState(0x150) || _scumm->getKeyState(0x151)) + if (_vm->getKeyState(0x14f) || _vm->getKeyState(0x150) || _vm->getKeyState(0x151)) dy++; if (dx == _keybOldDx) @@ -1830,10 +1830,10 @@ int32 Insane::processKeyboard(void) { _enemyState[EN_BEN][1] += tmpy; } - if (_scumm->getKeyState(0x0d)) + if (_vm->getKeyState(0x0d)) retval |= 1; - if (_scumm->getKeyState(0x09)) + if (_vm->getKeyState(0x09)) retval |= 2; return retval; @@ -1844,7 +1844,7 @@ void Insane::readFileToMem(const char *name, byte **buf) { uint32 len; in = new File(); - in->open(name, _scumm->getGameDataPath()); + in->open(name, _vm->getGameDataPath()); len = in->size(); *buf = (byte *)malloc(len); in->read(*buf, len); @@ -1858,7 +1858,7 @@ void Insane::runScene(int arraynum) { // ptrMainLoop = &ptrMainLoopBody; _insaneIsRunning = true; - _player = new SmushPlayer(_scumm, _speed); + _player = new SmushPlayer(_vm, _speed); _player->insanity(true); _numberArray = arraynum; @@ -1966,7 +1966,7 @@ void Insane::runScene(int arraynum) { smush_proc39(); putActors(); smush_proc40(); - _scumm->_sound->pauseSounds(0); // IMUSE_Resume(); + _vm->_sound->pauseSounds(0); // IMUSE_Resume(); _enemy[EN_ROTT3].maxdamage = 120; _insaneIsRunning = false; @@ -1990,7 +1990,7 @@ void Insane::runScene(int arraynum) { setWordInString(_numberArray, 56, _enemy[EN_CAVEFISH].field_10); setWordInString(_numberArray, 340, _enemy[EN_VULTM2].field_10); // insane_unlock(); // FIXME - _scumm->_sound->stopAllSounds(); // IMUSE_StopAllSounds(); + _vm->_sound->stopAllSounds(); // IMUSE_StopAllSounds(); if (_memoryAllocatedNotOK) { error("Memory Alloc Error in Mineroad (Heap Size?)"); } @@ -2002,7 +2002,7 @@ void Insane::startVideo(const char *filename, int num, int argC, int frameRate, int doMainLoop, byte *fluPtr, int32 numFrames) { // Demo has different insane, so disable it now - if (_scumm->_features & GF_DEMO) + if (_vm->_features & GF_DEMO) return; _smush_curFrame = 0; @@ -2019,7 +2019,7 @@ void Insane::startVideo(const char *filename, int num, int argC, int frameRate, smush_setupSanFromStart(filename, 0, -1, -1, 0); } - _player->play(filename, _scumm->getGameDataPath()); + _player->play(filename, _vm->getGameDataPath()); } int Insane::smlayer_mainLoop(void) { @@ -2045,7 +2045,7 @@ void Insane::smush_proc41(void) { } void Insane::smush_warpMouse(int x, int y, int buttons) { - _scumm->_system->warp_mouse(x, y); + _vm->_system->warp_mouse(x, y); } void Insane::putActors(void) { @@ -2745,15 +2745,15 @@ void Insane::mainLoop(void) { if(!(resid = idx2Tweak())) continue; - _scumm->ensureResourceLoaded(rtSound, resid); - _scumm->setResourceCounter(rtSound, resid, 1); + _vm->ensureResourceLoaded(rtSound, resid); + _vm->setResourceCounter(rtSound, resid, 1); } - _scumm->increaseResourceCounter(); + _vm->increaseResourceCounter(); while (!idx1Compare()) { resid = idx1Tweak(); - _scumm->ensureResourceLoaded(rtCostume, resid); - _scumm->setResourceCounter(rtCostume, resid, 1); + _vm->ensureResourceLoaded(rtCostume, resid); + _vm->setResourceCounter(rtCostume, resid, 1); // smlayer_lock (rtCostume, resid); } @@ -2809,12 +2809,12 @@ int32 Insane::idx2Tweak(void) { void Insane::smush_setToFinish(void) { debug(0, "Video is set to finish"); - _scumm->_videoFinished = 1; + _vm->_videoFinished = 1; } // smlayer_stopSound void Insane::smlayer_stopSound(int idx) { - _scumm->_sound->stopSound(readArray(_numberArray, idx)); + _vm->_sound->stopSound(readArray(_numberArray, idx)); } void Insane::procPreRendering(void) { @@ -3045,7 +3045,7 @@ void Insane::procPostRendering(byte *renderBitmap, int32 codecparam, int32 setup smlayer_drawSomething(renderBitmap, codecparam, 89, 56, 1, _smush_bencutNut, 0, 0, 0); if (!_keyboardDisable && !_val116w) - _scumm->processActors(); + _vm->processActors(); if (needMore) postCaseMore(renderBitmap, codecparam, setupsan12, setupsan13, curFrame, maxFrame); @@ -5665,7 +5665,7 @@ void Insane::escapeKeyHandler(void) { //if (!_ptrMainLoop) { } // We don't need it // Demo has different insane, so disable it now - if (!_insaneIsRunning || _scumm->_features & GF_DEMO) { + if (!_insaneIsRunning || _vm->_features & GF_DEMO) { smush_setToFinish(); return; } @@ -5834,9 +5834,9 @@ int Insane::smlayer_loadSound(int id, int flag, int phase) { return 0; if (phase == 2) - _scumm->ensureResourceLoaded(rtSound, resid); + _vm->ensureResourceLoaded(rtSound, resid); - _scumm->setResourceCounter(rtSound, resid, 1); + _vm->setResourceCounter(rtSound, resid, 1); if (phase == 1) { _objArray2Idx2++; @@ -5851,12 +5851,12 @@ int Insane::smlayer_loadSound(int id, int flag, int phase) { void Insane::IMUSE_shutVolume(void) { debug(0, "***************************************************"); - _scumm->_imuse->pause(true); + _vm->_imuse->pause(true); } void Insane::IMUSE_restoreVolume(void) { debug(0, "***************************************************"); - _scumm->_imuse->pause(false); + _vm->_imuse->pause(false); } // smlayer_loadCostume1 && smlayer_loadCostume2 @@ -5867,8 +5867,8 @@ int Insane::smlayer_loadCostume(int id, int phase) { if (!resid) return 0; - _scumm->ensureResourceLoaded(rtCostume, resid); - _scumm->setResourceCounter(rtCostume, resid, 1); + _vm->ensureResourceLoaded(rtCostume, resid); + _vm->setResourceCounter(rtCostume, resid, 1); // smlayer_lock(rtCostume, resid); // FIXME @@ -5883,7 +5883,7 @@ int Insane::smlayer_loadCostume(int id, int phase) { } void Insane::smlayer_setActorCostume(int actornum, int actnum, int costume) { - Actor *a = _scumm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_setActorCostume"); + Actor *a = _vm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_setActorCostume"); a->setActorCostume(costume); a->setDirection(180); a->startAnimActor(1); @@ -5891,12 +5891,12 @@ void Insane::smlayer_setActorCostume(int actornum, int actnum, int costume) { } void Insane::smlayer_putActor(int actornum, int actnum, int x, int y, byte room) { - Actor *a = _scumm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_putActor"); + Actor *a = _vm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_putActor"); a->putActor(x, y, room); } void Insane::smlayer_setActorLayer(int actornum, int actnum, int layer) { - Actor *a = _scumm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_setActorLayer"); + Actor *a = _vm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_setActorLayer"); a->layer = layer; } @@ -5910,12 +5910,12 @@ void Insane::smlayer_setFluPalette(byte *pal, int shut_flag) { } bool Insane::smlayer_isSoundRunning(int32 sound) { - return _scumm->_sound->isSoundRunning(readArray(_numberArray, sound)) != 0; + return _vm->_sound->isSoundRunning(readArray(_numberArray, sound)) != 0; } bool Insane::smlayer_startSound1(int32 sound) { if (smlayer_loadSound(sound, 0, 2)) { - _scumm->_imuseDigital->startSfx(readArray(_numberArray, sound)); + _vm->_imuseDigital->startSfx(readArray(_numberArray, sound)); return true; } else return false; @@ -5923,14 +5923,14 @@ bool Insane::smlayer_startSound1(int32 sound) { bool Insane::smlayer_startSound2(int32 sound) { if (smlayer_loadSound(sound, 0, 2)) { - _scumm->_imuseDigital->startSfx(readArray(_numberArray, sound)); + _vm->_imuseDigital->startSfx(readArray(_numberArray, sound)); return true; } else return false; } void Insane::smlayer_soundSetPan(int32 soundid, int32 pan) { - _scumm->_imuseDigital->parseScriptCmds(12, soundid, 0x700, pan, 0, 0, 0, 0); + _vm->_imuseDigital->parseScriptCmds(12, soundid, 0x700, pan, 0, 0, 0, 0); } void Insane::smlayer_soundSetPriority(int32 sound, int32 priority) { @@ -8061,7 +8061,7 @@ void Insane::clearBit(int n) { void Insane::smlayer_setActorFacing(int actornum, int actnum, int frame, int direction) { if (_actor[actornum].act[actnum].room) { - Actor *a = _scumm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_setActorFacing"); + Actor *a = _vm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_setActorFacing"); a->setDirection(direction); a->startAnimActor(frame); _actor[actornum].act[actnum].frame = 0; @@ -8100,11 +8100,11 @@ bool Insane::smush_eitherNotStartNewFrame(void) { } int32 Insane::getLastKey(bool arg_0) { - return _scumm->_lastKeyHit; + return _vm->_lastKeyHit; } bool Insane::smlayer_actorNeedRedraw(int actornum, int actnum) { - Actor *a = _scumm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_actorNeedRedraw"); + Actor *a = _vm->derefActor(_actor[actornum].act[actnum].actor, "smlayer_actorNeedRedraw"); return a->needRedraw; } @@ -8115,11 +8115,11 @@ void Insane::smush_setPaletteValue(int where, int r, int g, int b) { } int32 Insane::readArray (int number, int item) { - return _scumm->readArray (number, 0, item); + return _vm->readArray (number, 0, item); } void Insane::setWordInString(int number, int item, int value) { - _scumm->writeArray(number, 0, item, value); + _vm->writeArray(number, 0, item, value); } void Insane::smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 step1, @@ -8179,9 +8179,9 @@ void Insane::smush_setFrameSteps(int32 step1, int32 step2) { void Insane::smush_setupSanFile(const char *filename, int32 offset, int32 contFrame) { debug(0, "smush_setupSanFile(%s, %x)", filename, offset); - _player->seekSan(filename, _scumm->getGameDataPath(), offset, contFrame); + _player->seekSan(filename, _vm->getGameDataPath(), offset, contFrame); - _scumm->_imuseDigital->pause(false); + _vm->_imuseDigital->pause(false); } } diff --git a/scumm/smush/insane.h b/scumm/smush/insane.h index 032b6e4780..1f04bfe82c 100644 --- a/scumm/smush/insane.h +++ b/scumm/smush/insane.h @@ -71,7 +71,7 @@ class Insane { private: - ScummEngine *_scumm; + ScummEngine *_vm; SmushPlayer *_player; int32 _speed; diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index d3e6867fdf..6eb5a29f35 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -211,7 +211,7 @@ void SmushPlayer::timerCallback(void *refCon) { } SmushPlayer::SmushPlayer(ScummEngine *scumm, int speed) { - _scumm = scumm; + _vm = scumm; _version = -1; _nbframes = 0; _smixer = 0; @@ -245,20 +245,20 @@ void SmushPlayer::init() { _frame = 0; - _scumm->_videoFinished = false; - _scumm->_insaneState = true; + _vm->_videoFinished = false; + _vm->_insaneState = true; - _smixer = new SmushMixer(_scumm->_mixer); + _smixer = new SmushMixer(_vm->_mixer); - _scumm->setDirtyColors(0, 255); - _dst = _scumm->virtscr[0].screenPtr + _scumm->virtscr[0].xstart; + _vm->setDirtyColors(0, 255); + _dst = _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart; g_timer->installTimerProc(&timerCallback, _speed, this); _alreadyInit = false; } void SmushPlayer::deinit() { - _scumm->_timer->removeTimerProc(&timerCallback); + _vm->_timer->removeTimerProc(&timerCallback); for (int i = 0; i < 5; i++) { if (_sf[i]) { @@ -283,10 +283,10 @@ void SmushPlayer::deinit() { _base = NULL; } - _scumm->_mixer->stopHandle(_IACTchannel); + _vm->_mixer->stopHandle(_IACTchannel); - _scumm->_insaneState = false; - _scumm->_fullRedraw = true; + _vm->_insaneState = false; + _vm->_fullRedraw = true; } void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, uint32 min_size) { @@ -381,7 +381,7 @@ void SmushPlayer::handleIACT(Chunk &b) { int32 size = b.getDword(); int32 bsize = b.getSize() - 18; - if (_scumm->_gameId != GID_CMI) { + if (_vm->_gameId != GID_CMI) { int32 track = track_id; if (track_flags == 1) { track = track_id + 100; @@ -456,8 +456,8 @@ void SmushPlayer::handleIACT(Chunk &b) { } while (--count); if (!_IACTchannel.isActive()) - _scumm->_mixer->newStream(&_IACTchannel, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); - _scumm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); + _vm->_mixer->newStream(&_IACTchannel, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); + _vm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); bsize -= len; d_src += len; @@ -512,11 +512,11 @@ void SmushPlayer::handleTextResource(Chunk &b) { str++; // For Full Throttle text resources } - if (_scumm->_gameId == GID_CMI) { - _scumm->translateText((const byte *)str - 1, _scumm->_transText); + if (_vm->_gameId == GID_CMI) { + _vm->translateText((const byte *)str - 1, _vm->_transText); while (*str++ != '/') ; - string2 = (char *)_scumm->_transText; + string2 = (char *)_vm->_transText; // If string2 contains formatting information there probably // wasn't any translation for it in the language.tab file. In @@ -548,7 +548,7 @@ void SmushPlayer::handleTextResource(Chunk &b) { assert(sf != NULL); sf->setColor(color); - if (_scumm->_gameId == GID_CMI && string2[0] != 0) { + if (_vm->_gameId == GID_CMI && string2[0] != 0) { str = string2; } @@ -673,7 +673,7 @@ void SmushPlayer::handleFrameObject(Chunk &b) { int width = b.getWord(); int height = b.getWord(); - if ((height != _scumm->_screenHeight) || (width != _scumm->_screenWidth)) + if ((height != _vm->_screenHeight) || (width != _vm->_screenWidth)) return; if (!_alreadyInit) { @@ -725,11 +725,11 @@ void SmushPlayer::handleFrame(Chunk &b) { _skipNext = false; uint32 start_time, end_time; - start_time = _scumm->_system->get_msecs(); + start_time = _vm->_system->get_msecs(); #ifdef INSANE if (_insanity) { - _scumm->_insane->procPreRendering(); + _vm->_insane->procPreRendering(); } #endif @@ -756,7 +756,7 @@ void SmushPlayer::handleFrame(Chunk &b) { #ifdef INSANE // FIXME: check parameters if (_insanity) - _scumm->_insane->procIACT(_dst, 0, 0, 0, *sub, 0, 0); + _vm->_insane->procIACT(_dst, 0, 0, 0, *sub, 0, 0); else handleIACT(*sub); #else @@ -772,7 +772,7 @@ void SmushPlayer::handleFrame(Chunk &b) { case TYPE_SKIP: #ifdef INSANE if (_insanity) - _scumm->_insane->procSKIP(*sub); + _vm->_insane->procSKIP(*sub); else handleSkip(*sub); #else @@ -791,11 +791,11 @@ void SmushPlayer::handleFrame(Chunk &b) { #ifdef INSANE // FIXME: Check either parameters are valid if (_insanity) { - _scumm->_insane->procPostRendering(_dst, 0, 0, 0, _frame, _nbframes-1); + _vm->_insane->procPostRendering(_dst, 0, 0, 0, _frame, _nbframes-1); } #endif - end_time = _scumm->_system->get_msecs(); + end_time = _vm->_system->get_msecs(); updateScreen(); _smixer->handleFrame(); @@ -827,29 +827,29 @@ void SmushPlayer::setupAnim(const char *file, const char *directory) { handleAnimHeader(*sub); if (_insanity) { - if(!(_scumm->_features & GF_DEMO)) + if(!(_vm->_features & GF_DEMO)) readString("mineroad.trs", directory); } else readString(file, directory); - if (_scumm->_gameId == GID_FT) { - if (!(_scumm->_features & GF_DEMO)) { + if (_vm->_gameId == GID_FT) { + if (!(_vm->_features & GF_DEMO)) { _sf[0] = new SmushFont(true, false); _sf[2] = new SmushFont(true, false); _sf[0]->loadFont("scummfnt.nut", directory); _sf[2]->loadFont("titlfnt.nut", directory); } - } else if (_scumm->_gameId == GID_DIG) { - if (!(_scumm->_features & GF_DEMO)) { + } else if (_vm->_gameId == GID_DIG) { + if (!(_vm->_features & GF_DEMO)) { for (i = 0; i < 4; i++) { sprintf(file_font, "font%d.nut", i); _sf[i] = new SmushFont(i != 0, false); _sf[i]->loadFont(file_font, directory); } } - } else if (_scumm->_gameId == GID_CMI) { + } else if (_vm->_gameId == GID_CMI) { for (i = 0; i < 5; i++) { - if ((_scumm->_features & GF_DEMO) && (i == 4)) + if ((_vm->_features & GF_DEMO) && (i == 4)) break; sprintf(file_font, "font%d.nut", i); _sf[i] = new SmushFont(false, true); @@ -863,11 +863,11 @@ void SmushPlayer::setupAnim(const char *file, const char *directory) { } void SmushPlayer::parseNextFrame() { - if (_scumm->_smushPaused) + if (_vm->_smushPaused) return; if (_base->eof()) { - _scumm->_videoFinished = true; + _vm->_videoFinished = true; return; } @@ -894,14 +894,14 @@ void SmushPlayer::setPalette(const byte *palette) { *p++ = 0; } - _scumm->_system->set_palette(palette_colors, 0, 256); + _vm->_system->set_palette(palette_colors, 0, 256); } void SmushPlayer::updateScreen() { #ifdef DUMP_SMUSH_FRAMES char fileName[100]; // change path below for dump png files - sprintf(fileName, "/path/to/somethere/%s%04d.png", _scumm->getGameName(), _frame); + sprintf(fileName, "/path/to/somethere/%s%04d.png", _vm->getGameName(), _frame); FILE *file = fopen(fileName, "wb"); if (file == NULL) error("can't open file for writing png"); @@ -949,10 +949,10 @@ void SmushPlayer::updateScreen() { png_destroy_write_struct(&png_ptr, &info_ptr); #endif - uint32 end_time, start_time = _scumm->_system->get_msecs(); - _scumm->_system->copy_rect(_dst, _width, 0, 0, _width, _height); + uint32 end_time, start_time = _vm->_system->get_msecs(); + _vm->_system->copy_rect(_dst, _width, 0, 0, _width, _height); _updateNeeded = true; - end_time = _scumm->_system->get_msecs(); + end_time = _vm->_system->get_msecs(); debug(4, "Smush stats: updateScreen( %03d )", end_time - start_time); } @@ -1000,40 +1000,40 @@ void SmushPlayer::play(const char *filename, const char *directory) { _updateNeeded = false; // Hide mouse - bool oldMouseState = _scumm->_system->show_mouse(false); + bool oldMouseState = _vm->_system->show_mouse(false); // Load the video setupAnim(filename, directory); init(); while (true) { - _scumm->parseEvents(); - _scumm->processKbd(); + _vm->parseEvents(); + _vm->processKbd(); if (_updateNeeded) { uint32 end_time, start_time; - start_time = _scumm->_system->get_msecs(); - _scumm->_system->update_screen(); + start_time = _vm->_system->get_msecs(); + _vm->_system->update_screen(); _updateNeeded = false; if (_insanity) - _scumm->_sound->processSoundQues(); + _vm->_sound->processSoundQues(); - end_time = _scumm->_system->get_msecs(); + end_time = _vm->_system->get_msecs(); debug(4, "Smush stats: BackendUpdateScreen( %03d )", end_time - start_time); } - if (_scumm->_videoFinished || _scumm->_quit || _scumm->_saveLoadFlag) + if (_vm->_videoFinished || _vm->_quit || _vm->_saveLoadFlag) break; - _scumm->_system->delay_msecs(10); + _vm->_system->delay_msecs(10); }; deinit(); // Reset mouse state - _scumm->_system->show_mouse(oldMouseState); + _vm->_system->show_mouse(oldMouseState); } } // End of namespace Scumm diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index e3b6b437d0..0dd25270ff 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -37,7 +37,7 @@ class StringResource; class SmushPlayer { friend class Insane; private: - ScummEngine *_scumm; + ScummEngine *_vm; int _version; int32 _nbframes; SmushMixer *_smixer; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index cf0e42d9ab..110a3dc262 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -52,7 +52,7 @@ struct MP3OffsetTable { /* Compressed Sound (.SO3) */ Sound::Sound(ScummEngine *parent) { memset(this,0,sizeof(Sound)); // palmos - _scumm = parent; + _vm = parent; _currentCDSound = 0; _sfxFile = 0; @@ -64,8 +64,8 @@ Sound::~Sound() { } void Sound::addSoundToQueue(int sound) { - _scumm->VAR(_scumm->VAR_LAST_SOUND) = sound; - _scumm->ensureResourceLoaded(rtSound, sound); + _vm->VAR(_vm->VAR_LAST_SOUND) = sound; + _vm->ensureResourceLoaded(rtSound, sound); addSoundToQueue2(sound); } @@ -80,7 +80,7 @@ void Sound::processSoundQues() { processSfxQueues(); - if (_scumm->_features & GF_DIGI_IMUSE) + if (_vm->_features & GF_DIGI_IMUSE) return; while (_soundQue2Pos) { @@ -105,8 +105,8 @@ void Sound::processSoundQues() { data[0] >> 8, data[0] & 0xFF, data[1], data[2], data[3], data[4], data[5], data[6], data[7]); - if (_scumm->_imuse) { - _scumm->VAR(_scumm->VAR_SOUNDRESULT) = (short)_scumm->_imuse->doCommand (num, data); + if (_vm->_imuse) { + _vm->VAR(_vm->VAR_SOUNDRESULT) = (short)_vm->_imuse->doCommand (num, data); } } } @@ -120,8 +120,8 @@ void Sound::playSound(int soundID) { int rate; byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE; - debug(3, "playSound #%d (room %d)", soundID, _scumm->getResourceRoomNr(rtSound, soundID)); - ptr = _scumm->getResourceAddress(rtSound, soundID); + debug(3, "playSound #%d (room %d)", soundID, _vm->getResourceRoomNr(rtSound, soundID)); + ptr = _vm->getResourceAddress(rtSound, soundID); if (!ptr) { return; } @@ -141,7 +141,7 @@ void Sound::playSound(int soundID) { // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); memcpy(sound, ptr, size); - _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); + _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } // Support for Putt-Putt sounds - very hackish, too 8-) else if (READ_UINT32(ptr) == MKID('DIGI')) { @@ -158,7 +158,7 @@ void Sound::playSound(int soundID) { // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); memcpy(sound, ptr + 8, size); - _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); + _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } else if (READ_UINT32(ptr) == MKID('MRAW')) { // pcm music in 3DO humongous games @@ -174,7 +174,7 @@ void Sound::playSound(int soundID) { // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); memcpy(sound, ptr + 8, size); - _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); + _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } // Support for sampled sound effects in Monkey Island 1 and 2 else if (READ_UINT32(ptr) == MKID('SBL ')) { @@ -218,7 +218,7 @@ void Sound::playSound(int soundID) { // then a semi-sane VOC header is revealed, with // a sampling rate of ~25000 Hz (does that make sense?). // I'll add some code to test that theory for now. - if (_scumm->_gameId == GID_MONKEY_SEGA) { + if (_vm->_gameId == GID_MONKEY_SEGA) { size = READ_BE_UINT32(ptr + 4) - 27; for (int i = 0; i < size; i++) ptr[27 + i] ^= 0x16; @@ -233,7 +233,7 @@ void Sound::playSound(int soundID) { // FIXME: SBL resources are apparently horribly // distorted on segacd even though it shares the same // header etc. So don't try to play them for now. - if (_scumm->_gameId == GID_MONKEY_SEGA) { + if (_vm->_gameId == GID_MONKEY_SEGA) { return; } @@ -248,12 +248,12 @@ void Sound::playSound(int soundID) { // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); memcpy(sound, ptr + 33, size); - _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); + _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } - else if ((_scumm->_features & GF_FMTOWNS) || READ_UINT32(ptr) == MKID('SOUN') || READ_UINT32(ptr) == MKID('TOWS')) { + else if ((_vm->_features & GF_FMTOWNS) || READ_UINT32(ptr) == MKID('SOUN') || READ_UINT32(ptr) == MKID('TOWS')) { bool tows = READ_UINT32(ptr) == MKID('TOWS'); - if (_scumm->_features & GF_FMTOWNS) { + if (_vm->_features & GF_FMTOWNS) { size = READ_LE_UINT32(ptr); } else { size = READ_BE_UINT32(ptr + 4) - 2; @@ -301,14 +301,14 @@ void Sound::playSound(int soundID) { if (loopEnd > 0) flags |= SoundMixer::FLAG_LOOP; - _scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd); + _vm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd); } break; case 1: case 255: // 255 is the type used in Indy3 FMTowns // Music (Euphony format) - if (_scumm->_musicEngine) - _scumm->_musicEngine->startSound(soundID); + if (_vm->_musicEngine) + _vm->_musicEngine->startSound(soundID); break; case 2: // CD track resource ptr += 0x16; @@ -333,7 +333,7 @@ void Sound::playSound(int soundID) { break; } } - else if ((_scumm->_gameId == GID_LOOM) && (_scumm->_features & GF_MACINTOSH)) { + else if ((_vm->_gameId == GID_LOOM) && (_vm->_features & GF_MACINTOSH)) { // Mac version of Loom uses yet another sound format /* playSound #9 (room 70) @@ -356,19 +356,19 @@ void Sound::playSound(int soundID) { 000070: 01 18 5a 00 10 00 02 28 5f 00 01 00 00 00 00 00 |..Z....(_.......| */ } - else if ((_scumm->_features & GF_MACINTOSH) && (_scumm->_gameId == GID_INDY3) && (ptr[26] == 0)) { + else if ((_vm->_features & GF_MACINTOSH) && (_vm->_gameId == GID_INDY3) && (ptr[26] == 0)) { size = READ_BE_UINT16(ptr + 12); rate = 3579545 / READ_BE_UINT16(ptr + 20); sound = (char *)malloc(size); int vol = ptr[24] * 4; memcpy(sound,ptr + READ_BE_UINT16(ptr + 8), size); - _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0); + _vm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0); } else { - if (_scumm->_gameId == GID_MONKEY_VGA || _scumm->_gameId == GID_MONKEY_EGA) { + if (_vm->_gameId == GID_MONKEY_VGA || _vm->_gameId == GID_MONKEY_EGA) { // Sound is currently not supported at all in the amiga versions of these games - if (_scumm->_features & GF_AMIGA) { + if (_vm->_features & GF_AMIGA) { int track = -1; if (soundID == 50) track = 17; @@ -390,14 +390,14 @@ void Sound::playSound(int soundID) { // the music is never explicitly stopped. // Rather it seems that starting a new music is supposed to // automatically stop the old song. - if (_scumm->_imuse) { + if (_vm->_imuse) { if (READ_UINT32(ptr) != MKID('ASFX')) - _scumm->_imuse->stopAllSounds(); + _vm->_imuse->stopAllSounds(); } } - if (_scumm->_musicEngine) { - _scumm->_musicEngine->startSound(soundID); + if (_vm->_musicEngine) { + _vm->_musicEngine->startSound(soundID); } } } @@ -416,17 +416,17 @@ void Sound::processSfxQueues() { _talk_sound_mode = 0; } - if ((_sfxMode & 2) && _scumm->VAR(_scumm->VAR_TALK_ACTOR)) { - act = _scumm->VAR(_scumm->VAR_TALK_ACTOR); + if ((_sfxMode & 2) && _vm->VAR(_vm->VAR_TALK_ACTOR)) { + act = _vm->VAR(_vm->VAR_TALK_ACTOR); - if (_scumm->_imuseDigital) { + if (_vm->_imuseDigital) { finished = !isSoundRunning(kTalkSoundID); } else { finished = !_talkChannelHandle.isActive(); } - if (act != 0 && (uint) act < 0x80 && !_scumm->_string[0].no_talk_anim) { - a = _scumm->derefActor(act, "processSfxQueues"); + if (act != 0 && (uint) act < 0x80 && !_vm->_string[0].no_talk_anim) { + a = _vm->derefActor(act, "processSfxQueues"); if (a->isInCurrentRoom() && (finished || !_endOfMouthSync)) { b = finished || isMouthSyncOff(_curSoundPos); if (_mouthSyncMode != b) { @@ -440,8 +440,8 @@ void Sound::processSfxQueues() { } } - if (finished && _scumm->_talkDelay == 0) { - _scumm->stopTalk(); + if (finished && _vm->_talkDelay == 0) { + _vm->stopTalk(); } } @@ -462,7 +462,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle byte *sound; int id = -1; - if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) { + if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) { char filename[30]; char roomname[10]; @@ -508,13 +508,13 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle // FIXME hack until more is known // the size of the data after the sample isn't known // 64 is just a guess - if (_scumm->_features & GF_HUMONGOUS) { + if (_vm->_features & GF_HUMONGOUS) { // SKIP TLKB (8) TALK (8) HSHD (24) and SDAT (8) _sfxMode |= mode; _sfxFile->seek(offset + 48, SEEK_SET); sound = (byte *)malloc(b - 64); _sfxFile->read(sound, b - 64); - _scumm->_mixer->playRaw(handle, sound, b - 64, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE); + _vm->_mixer->playRaw(handle, sound, b - 64, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE); return; } @@ -527,10 +527,10 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle // HACK: Checking for script 99 in Sam & Max is to keep Conroy's song // from being interrupted. - if (mode == 1 && (_scumm->_gameId == GID_TENTACLE - || (_scumm->_gameId == GID_SAMNMAX && !_scumm->isScriptRunning(99)))) { + if (mode == 1 && (_vm->_gameId == GID_TENTACLE + || (_vm->_gameId == GID_SAMNMAX && !_vm->isScriptRunning(99)))) { id = 777777; - _scumm->_mixer->stopID(id); + _vm->_mixer->stopID(id); } if (b > 8) { @@ -572,16 +572,16 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle _mouthSyncMode = true; } - if (!_soundsPaused && _scumm->_mixer->isReady()) + if (!_soundsPaused && _vm->_mixer->isReady()) startSfxSound(_sfxFile, size, handle, id); } void Sound::stopTalkSound() { if (_sfxMode & 2) { - if (_scumm->_imuseDigital) { - _scumm->_imuseDigital->stopSound(kTalkSoundID); + if (_vm->_imuseDigital) { + _vm->_imuseDigital->stopSound(kTalkSoundID); } else { - _scumm->_mixer->stopHandle(_talkChannelHandle); + _vm->_mixer->stopHandle(_talkChannelHandle); } _sfxMode &= ~2; } @@ -607,31 +607,31 @@ bool Sound::isMouthSyncOff(uint pos) { int Sound::isSoundRunning(int sound) const { - if (_scumm->_imuseDigital) - return (_scumm->_imuseDigital->getSoundStatus(sound) != 0); + if (_vm->_imuseDigital) + return (_vm->_imuseDigital->getSoundStatus(sound) != 0); if (sound == _currentCDSound) return pollCD(); - if (_scumm->_features & GF_HUMONGOUS) { + if (_vm->_features & GF_HUMONGOUS) { if (sound == -2) { return isSfxFinished(); } else if (sound == -1) { // getSoundStatus(), with a -1, will return the // ID number of the first active music it finds. // TODO handle MRAW (pcm music) in humongous games - return _scumm->_imuse->getSoundStatus(sound); + return _vm->_imuse->getSoundStatus(sound); } } if (isSoundInQueue(sound)) return 1; - if (!_scumm->isResourceLoaded(rtSound, sound)) + if (!_vm->isResourceLoaded(rtSound, sound)) return 0; - if (_scumm->_musicEngine) - return _scumm->_musicEngine->getSoundStatus(sound); + if (_vm->_musicEngine) + return _vm->_musicEngine->getSoundStatus(sound); return 0; } @@ -649,8 +649,8 @@ int Sound::isSoundRunning(int sound) const { */ bool Sound::isSoundInUse(int sound) const { - if (_scumm->_imuseDigital) - return (_scumm->_imuseDigital->getSoundStatus(sound) != 0); + if (_vm->_imuseDigital) + return (_vm->_imuseDigital->getSoundStatus(sound) != 0); if (sound == _currentCDSound) return pollCD() != 0; @@ -658,11 +658,11 @@ bool Sound::isSoundInUse(int sound) const { if (isSoundInQueue(sound)) return true; - if (!_scumm->isResourceLoaded(rtSound, sound)) + if (!_vm->isResourceLoaded(rtSound, sound)) return false; - if (_scumm->_imuse) - return _scumm->_imuse->get_sound_active(sound); + if (_vm->_imuse) + return _vm->_imuse->get_sound_active(sound); return false; } @@ -698,11 +698,11 @@ void Sound::stopSound(int a) { stopCDTimer(); } - if (!(_scumm->_features & GF_DIGI_IMUSE)) - _scumm->_mixer->stopID(a); + if (!(_vm->_features & GF_DIGI_IMUSE)) + _vm->_mixer->stopID(a); - if (_scumm->_musicEngine) - _scumm->_musicEngine->stopSound(a); + if (_vm->_musicEngine) + _vm->_musicEngine->stopSound(a); for (i = 0; i < ARRAYSIZE(_soundQue2); i++) if (_soundQue2[i] == a) @@ -720,26 +720,26 @@ void Sound::stopAllSounds() { _soundQue2Pos = 0; memset(_soundQue2, 0, sizeof(_soundQue2)); - if (_scumm->_musicEngine) { - _scumm->_musicEngine->stopAllSounds(); + if (_vm->_musicEngine) { + _vm->_musicEngine->stopAllSounds(); } - if (_scumm->_imuse) { + if (_vm->_imuse) { // FIXME: Maybe we could merge this call to clear_queue() // into IMuse::stopAllSounds() ? - _scumm->_imuse->clear_queue(); + _vm->_imuse->clear_queue(); } // Stop all SFX - if (!_scumm->_imuseDigital) { - _scumm->_mixer->stopAll(); + if (!_vm->_imuseDigital) { + _vm->_mixer->stopAll(); } } void Sound::soundKludge(int *list, int num) { int i; - if (_scumm->_imuseDigital) { - _scumm->_imuseDigital->parseScriptCmds(list[0], list[1], list[2], list[3], list[4], + if (_vm->_imuseDigital) { + _vm->_imuseDigital->parseScriptCmds(list[0], list[1], list[2], list[3], list[4], list[5], list[6], list[7]); return; } @@ -781,24 +781,24 @@ void Sound::setupSound() { } void Sound::pauseSounds(bool pause) { - if (_scumm->_imuse) - _scumm->_imuse->pause(pause); + if (_vm->_imuse) + _vm->_imuse->pause(pause); // Don't pause sounds if the game isn't active // FIXME - this is quite a nasty hack, replace with something cleaner, and w/o // having to access member vars directly! - if (!_scumm->_roomResource) + if (!_vm->_roomResource) return; _soundsPaused = pause; - _scumm->_mixer->pauseAll(pause); + _vm->_mixer->pauseAll(pause); - if (_scumm->_imuseDigital) { - _scumm->_imuseDigital->pause(pause); + if (_vm->_imuseDigital) { + _vm->_imuseDigital->pause(pause); } - if ((_scumm->_features & GF_AUDIOTRACKS) && _scumm->VAR(_scumm->VAR_MUSIC_TIMER) > 0) { + if ((_vm->_features & GF_AUDIOTRACKS) && _vm->VAR(_vm->VAR_MUSIC_TIMER) > 0) { if (pause) stopCDTimer(); else @@ -824,11 +824,11 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, input = makeVOCStream(_sfxFile); } - if (_scumm->_imuseDigital) { - //_scumm->_imuseDigital->stopSound(kTalkSoundID); - _scumm->_imuseDigital->startVoice(kTalkSoundID, input); + if (_vm->_imuseDigital) { + //_vm->_imuseDigital->stopSound(kTalkSoundID); + _vm->_imuseDigital->startVoice(kTalkSoundID, input); } else { - _scumm->_mixer->playInputStream(handle, input, false, 255, 0, id); + _vm->_mixer->playInputStream(handle, input, false, 255, 0, id); } } @@ -842,9 +842,9 @@ File *Sound::openSfxFile() { offset_table = NULL; #ifdef USE_MAD - sprintf(buf, "%s.so3", _scumm->getGameName()); - if (!file->open(buf, _scumm->getGameDataPath())) { - file->open("monster.so3", _scumm->getGameDataPath()); + sprintf(buf, "%s.so3", _vm->getGameName()); + if (!file->open(buf, _vm->getGameDataPath())) { + file->open("monster.so3", _vm->getGameDataPath()); } if (file->isOpen()) _vorbis_mode = false; @@ -852,9 +852,9 @@ File *Sound::openSfxFile() { #ifdef USE_VORBIS if (!file->isOpen()) { - sprintf(buf, "%s.sog", _scumm->getGameName()); - if (!file->open(buf, _scumm->getGameDataPath())) - file->open("monster.sog", _scumm->getGameDataPath()); + sprintf(buf, "%s.sog", _vm->getGameName()); + if (!file->open(buf, _vm->getGameDataPath())) + file->open("monster.sog", _vm->getGameDataPath()); if (file->isOpen()) _vorbis_mode = true; } @@ -894,20 +894,20 @@ File *Sound::openSfxFile() { return file; } - sprintf(buf, "%s.sou", _scumm->getGameName()); - if (!file->open(buf, _scumm->getGameDataPath())) { - file->open("monster.sou", _scumm->getGameDataPath()); + sprintf(buf, "%s.sou", _vm->getGameName()); + if (!file->open(buf, _vm->getGameDataPath())) { + file->open("monster.sou", _vm->getGameDataPath()); } if (!file->isOpen()) { - sprintf(buf, "%s.tlk", _scumm->getGameName()); - file->open(buf, _scumm->getGameDataPath(), File::kFileReadMode, 0x69); + sprintf(buf, "%s.tlk", _vm->getGameName()); + file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69); } return file; } bool Sound::isSfxFinished() const { - return !_scumm->_mixer->hasActiveSFXChannel(); + return !_vm->_mixer->hasActiveSFXChannel(); } // We use a real timer in an attempt to get better sync with CD tracks. This is @@ -931,22 +931,22 @@ void Sound::startCDTimer() { // when Chaos first appears, and I have to use 101 for Monkey 1 or the // intro music will be cut short. - if (_scumm->_gameId == GID_LOOM256) + if (_vm->_gameId == GID_LOOM256) timer_interval = 100; else timer_interval = 101; - _scumm->_timer->removeTimerProc(&cd_timer_handler); - _scumm->_timer->installTimerProc(&cd_timer_handler, 1000 * timer_interval, _scumm); + _vm->_timer->removeTimerProc(&cd_timer_handler); + _vm->_timer->installTimerProc(&cd_timer_handler, 1000 * timer_interval, _vm); } void Sound::stopCDTimer() { - _scumm->_timer->removeTimerProc(&cd_timer_handler); + _vm->_timer->removeTimerProc(&cd_timer_handler); } void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) { // Reset the music timer variable at the start of a new track - _scumm->VAR(_scumm->VAR_MUSIC_TIMER) = 0; + _vm->VAR(_vm->VAR_MUSIC_TIMER) = 0; // Play it if (!_soundsPaused) diff --git a/scumm/sound.h b/scumm/sound.h index 93b2e57523..c785853018 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -56,7 +56,7 @@ protected: int _currentCDSound; - ScummEngine *_scumm; + ScummEngine *_vm; public: PlayingSoundHandle _talkChannelHandle; // Handle of mixer channel actor is talking on |