aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlyssa Milburn2012-08-22 14:00:46 +0200
committerAlyssa Milburn2012-08-22 21:51:51 +0200
commitc3407390013b1e1826bdb31979a50f5e8a957f04 (patch)
tree4da60e960d3b2d34da582b06bbcdcd714d736df0 /engines
parent482c1a71b04bf1b5d0f18847ce445c45085e77fa (diff)
downloadscummvm-rg350-c3407390013b1e1826bdb31979a50f5e8a957f04.tar.gz
scummvm-rg350-c3407390013b1e1826bdb31979a50f5e8a957f04.tar.bz2
scummvm-rg350-c3407390013b1e1826bdb31979a50f5e8a957f04.zip
TONY: Replace _vm with g_vm.
Diffstat (limited to 'engines')
-rw-r--r--engines/tony/custom.cpp110
-rw-r--r--engines/tony/debugger.cpp6
-rw-r--r--engines/tony/font.cpp58
-rw-r--r--engines/tony/game.cpp66
-rw-r--r--engines/tony/gfxengine.cpp24
-rw-r--r--engines/tony/input.cpp6
-rw-r--r--engines/tony/inventory.cpp32
-rw-r--r--engines/tony/loc.cpp10
-rw-r--r--engines/tony/mpal/mpal.cpp22
-rw-r--r--engines/tony/mpal/mpalutils.cpp2
-rw-r--r--engines/tony/sound.cpp6
-rw-r--r--engines/tony/tony.cpp36
-rw-r--r--engines/tony/tony.h4
-rw-r--r--engines/tony/tonychar.cpp4
-rw-r--r--engines/tony/window.cpp6
15 files changed, 196 insertions, 196 deletions
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp
index 35ae8849f1..6853cf51a0 100644
--- a/engines/tony/custom.cpp
+++ b/engines/tony/custom.cpp
@@ -234,12 +234,12 @@ DECLARE_CUSTOM_FUNCTION(SetPointer)(CORO_PARAM, uint32 dwPointer, uint32, uint32
VoiceHeader *SearchVoiceHeader(uint32 codehi, uint32 codelo) {
int code = (codehi << 16) | codelo;
- if (_vm->_voices.size() == 0)
+ if (g_vm->_voices.size() == 0)
return NULL;
- for (uint i = 0; i < _vm->_voices.size(); i++)
- if (_vm->_voices[i]._code == code)
- return &_vm->_voices[i];
+ for (uint i = 0; i < g_vm->_voices.size(); i++)
+ if (g_vm->_voices[i]._code == code)
+ return &g_vm->_voices[i];
return NULL;
}
@@ -273,11 +273,11 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->curOffset = _ctx->curVoc->_offset;
// First time allocation
- _vm->_vdbFP.seek(_ctx->curOffset);
- _vm->_theSound.createSfx(&_ctx->voice);
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ g_vm->_theSound.createSfx(&_ctx->voice);
- _ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
- _ctx->curOffset = _vm->_vdbFP.pos();
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
+ _ctx->curOffset = g_vm->_vdbFP.pos();
_ctx->voice->setLoop(false);
}
@@ -331,11 +331,11 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->voice->play();
_ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
} else {
- _vm->_vdbFP.seek(_ctx->curOffset);
- _vm->_theSound.createSfx(&_ctx->voice);
- _ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
- _ctx->curOffset = _vm->_vdbFP.pos();
+ _ctx->curOffset = g_vm->_vdbFP.pos();
_ctx->voice->setLoop(false);
_ctx->voice->play();
_ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
@@ -512,7 +512,7 @@ DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint3
CORO_INVOKE_0(GLOBALS.WaitWipeEnd);
}
- _vm->stopMusic(4);
+ g_vm->stopMusic(4);
// On exit, unload and unfreeze
CORO_INVOKE_2(GLOBALS.UnloadLocation, true, NULL);
@@ -535,7 +535,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
}
if (GLOBALS._lastTappeto != GLOBALS._ambiance[nLoc]) {
- _vm->stopMusic(4);
+ g_vm->stopMusic(4);
}
// On exit, unfreeze
@@ -550,7 +550,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
if (GLOBALS._lastTappeto != GLOBALS._ambiance[nLoc]) {
GLOBALS._lastTappeto = GLOBALS._ambiance[nLoc];
if (GLOBALS._lastTappeto != 0)
- _vm->playMusic(4, ambianceFile[GLOBALS._lastTappeto], 0, true, 2000);
+ g_vm->playMusic(4, ambianceFile[GLOBALS._lastTappeto], 0, true, 2000);
}
if (!GLOBALS._bNoBullsEye) {
@@ -1286,7 +1286,7 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
_ctx->startpt = GLOBALS._loc->scrollPosition();
- _ctx->dwStartTime = _vm->getTime();
+ _ctx->dwStartTime = g_vm->getTime();
if (sX)
_ctx->dwTotalTime = _ctx->dimx * (1000 / 35) / sX;
@@ -1294,7 +1294,7 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
_ctx->dwTotalTime = _ctx->dimy * (1000 / 35) / sY;
while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS._bSkipIdle) {
- _ctx->dwCurTime = _vm->getTime() - _ctx->dwStartTime;
+ _ctx->dwCurTime = g_vm->getTime() - _ctx->dwStartTime;
if (_ctx->dwCurTime > _ctx->dwTotalTime)
break;
@@ -1368,11 +1368,11 @@ DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(CORO_PARAM, uint32 dwCode, uint32 nX, uin
DECLARE_CUSTOM_FUNCTION(AutoSave)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->autoSave(coroParam);
+ g_vm->autoSave(coroParam);
}
DECLARE_CUSTOM_FUNCTION(AbortGame)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->abortGame();
+ g_vm->abortGame();
}
DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32, uint32) {
@@ -1384,12 +1384,12 @@ DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32,
CORO_BEGIN_CODE(_ctx);
- _ctx->curTime = _vm->getTime();
+ _ctx->curTime = g_vm->getTime();
_ctx->dirx = 1;
_ctx->diry = 1;
- while (_vm->getTime() < _ctx->curTime + nScosse) {
+ while (g_vm->getTime() < _ctx->curTime + nScosse) {
CORO_INVOKE_0(GLOBALS.WaitFrame);
GLOBALS.Freeze();
@@ -1397,7 +1397,7 @@ DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32,
GLOBALS._tony->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry));
GLOBALS.Unfreeze();
- _ctx->i = _vm->_randomSource.getRandomNumber(2);
+ _ctx->i = g_vm->_randomSource.getRandomNumber(2);
if (_ctx->i == 0 || _ctx->i == 2)
_ctx->dirx = -_ctx->dirx;
@@ -1486,7 +1486,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
- _vm->_vdbFP.seek(_ctx->curVoc->_offset);
+ g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
_ctx->curOffset = _ctx->curVoc->_offset;
}
@@ -1525,14 +1525,14 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
GLOBALS.LinkGraphicTask(_ctx->text);
if (_ctx->curVoc) {
- _vm->_theSound.createSfx(&_ctx->voice);
- _vm->_vdbFP.seek(_ctx->curOffset);
- _ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
_ctx->voice->setLoop(false);
if (bIsBack) _ctx->voice->setVolume(55);
_ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
- _ctx->curOffset = _vm->_vdbFP.pos();
+ _ctx->curOffset = g_vm->_vdbFP.pos();
}
// Wait for the end of display
@@ -1682,7 +1682,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
_ctx->pt = RMPoint(GLOBALS._mCharacter[nChar]._x, GLOBALS._mCharacter[nChar]._y);
// Parameter for special actions: random between the spoken
- _ctx->parm = (GLOBALS._mCharacter[nChar]._curGroup * 10) + _vm->_randomSource.getRandomNumber(
+ _ctx->parm = (GLOBALS._mCharacter[nChar]._curGroup * 10) + g_vm->_randomSource.getRandomNumber(
GLOBALS._mCharacter[nChar]._numTalks[GLOBALS._mCharacter[nChar]._curGroup] - 1) + 1;
// Try to run the custom function to initialize the speech
@@ -1697,8 +1697,8 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
- // fseek(_vm->m_vdbFP, curVoc->offset, SEEK_SET);
- _vm->_vdbFP.seek(_ctx->curVoc->_offset);
+ // fseek(g_vm->m_vdbFP, curVoc->offset, SEEK_SET);
+ g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
_ctx->curOffset = _ctx->curVoc->_offset;
}
@@ -1738,15 +1738,15 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
GLOBALS.LinkGraphicTask(_ctx->text);
if (_ctx->curVoc) {
- _vm->_theSound.createSfx(&_ctx->voice);
- _vm->_vdbFP.seek(_ctx->curOffset);
- _ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ g_vm->_vdbFP.seek(_ctx->curOffset);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
_ctx->voice->setLoop(false);
if (bIsBack)
_ctx->voice->setVolume(55);
_ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
- _ctx->curOffset = _vm->_vdbFP.pos();
+ _ctx->curOffset = g_vm->_vdbFP.pos();
}
// Wait for the end of display
@@ -1806,9 +1806,9 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
- _vm->_vdbFP.seek(_ctx->curVoc->_offset);
- _vm->_theSound.createSfx(&_ctx->voice);
- _ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
+ g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
+ g_vm->_theSound.createSfx(&_ctx->voice);
+ _ctx->voice->loadVoiceFromVDB(g_vm->_vdbFP);
_ctx->voice->setLoop(false);
if (_ctx->bIsBack)
_ctx->voice->setVolume(55);
@@ -1863,7 +1863,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
_ctx->pt = RMPoint(GLOBALS._mCharacter[nPers]._x, GLOBALS._mCharacter[nPers]._y);
// Parameter for special actions. Random between the spoken.
- _ctx->parm = (GLOBALS._mCharacter[nPers]._curGroup * 10) + _vm->_randomSource.getRandomNumber(
+ _ctx->parm = (GLOBALS._mCharacter[nPers]._curGroup * 10) + g_vm->_randomSource.getRandomNumber(
GLOBALS._mCharacter[nPers]._numTalks[GLOBALS._mCharacter[nPers]._curGroup] - 1) + 1;
if (GLOBALS._mCharacter[nPers]._numTexts != 0 && GLOBALS._mCharacter[nPers]._bInTexts) {
@@ -2097,11 +2097,11 @@ void ThreadFadeInMusic(CORO_PARAM, const void *nMusic) {
debug("Start FadeIn Music");
for (_ctx->i = 0; _ctx->i < 16; _ctx->i++) {
- _vm->setMusicVolume(nChannel, _ctx->i * 4);
+ g_vm->setMusicVolume(nChannel, _ctx->i * 4);
CORO_INVOKE_1(CoroScheduler.sleep, 100);
}
- _vm->setMusicVolume(nChannel, 64);
+ g_vm->setMusicVolume(nChannel, 64);
debug("End FadeIn Music");
@@ -2120,23 +2120,23 @@ void ThreadFadeOutMusic(CORO_PARAM, const void *nMusic) {
CORO_BEGIN_CODE(_ctx);
- _ctx->startVolume = _vm->getMusicVolume(nChannel);
+ _ctx->startVolume = g_vm->getMusicVolume(nChannel);
debug("Start FadeOut Music");
for (_ctx->i = 16; _ctx->i > 0 && !GLOBALS._bFadeOutStop; _ctx->i--) {
if (_ctx->i * 4 < _ctx->startVolume)
- _vm->setMusicVolume(nChannel, _ctx->i * 4);
+ g_vm->setMusicVolume(nChannel, _ctx->i * 4);
CORO_INVOKE_1(CoroScheduler.sleep, 100);
}
if (!GLOBALS._bFadeOutStop)
- _vm->setMusicVolume(nChannel, 0);
+ g_vm->setMusicVolume(nChannel, 0);
// If a jingle is played, stop it
if (nChannel == 2)
- _vm->stopMusic(2);
+ g_vm->stopMusic(2);
debug("End FadeOut Music");
@@ -2166,28 +2166,28 @@ DECLARE_CUSTOM_FUNCTION(FadeInJingle)(CORO_PARAM, uint32, uint32, uint32, uint32
}
DECLARE_CUSTOM_FUNCTION(StopSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->stopMusic(GLOBALS._curSoundEffect);
+ g_vm->stopMusic(GLOBALS._curSoundEffect);
}
DECLARE_CUSTOM_FUNCTION(StopJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->stopMusic(2);
+ g_vm->stopMusic(2);
}
DECLARE_CUSTOM_FUNCTION(MuteSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->setMusicVolume(GLOBALS._curSoundEffect, 0);
+ g_vm->setMusicVolume(GLOBALS._curSoundEffect, 0);
}
DECLARE_CUSTOM_FUNCTION(DemuteSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bFadeOutStop = true;
- _vm->setMusicVolume(GLOBALS._curSoundEffect, 64);
+ g_vm->setMusicVolume(GLOBALS._curSoundEffect, 64);
}
DECLARE_CUSTOM_FUNCTION(MuteJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->setMusicVolume(2, 0);
+ g_vm->setMusicVolume(2, 0);
}
DECLARE_CUSTOM_FUNCTION(DemuteJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- _vm->setMusicVolume(2, 64);
+ g_vm->setMusicVolume(2, 64);
}
void CustPlayMusic(uint32 nChannel, const char *mFN, uint32 nFX, bool bLoop, int nSync = 0) {
@@ -2298,7 +2298,7 @@ DECLARE_CUSTOM_FUNCTION(OpenInitLoadMenu)(CORO_PARAM, uint32, uint32, uint32, ui
CORO_BEGIN_CODE(_ctx);
GLOBALS.Freeze();
- CORO_INVOKE_0(_vm->openInitLoadMenu);
+ CORO_INVOKE_0(g_vm->openInitLoadMenu);
GLOBALS.Unfreeze();
CORO_END_CODE;
@@ -2311,7 +2311,7 @@ DECLARE_CUSTOM_FUNCTION(OpenInitOptions)(CORO_PARAM, uint32, uint32, uint32, uin
CORO_BEGIN_CODE(_ctx);
GLOBALS.Freeze();
- CORO_INVOKE_0(_vm->openInitOptions);
+ CORO_INVOKE_0(g_vm->openInitOptions);
GLOBALS.Unfreeze();
CORO_END_CODE;
@@ -2367,13 +2367,13 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
GLOBALS.LinkGraphicTask(&_ctx->text[_ctx->i]);
}
- _ctx->startTime = _vm->getTime();
+ _ctx->startTime = g_vm->getTime();
- while (_ctx->startTime + dwTime * 1000 > _vm->getTime()) {
+ while (_ctx->startTime + dwTime * 1000 > g_vm->getTime()) {
CORO_INVOKE_0(GLOBALS.WaitFrame);
if (GLOBALS._input->mouseLeftClicked() || GLOBALS._input->mouseRightClicked())
break;
- if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
+ if (g_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
break;
}
diff --git a/engines/tony/debugger.cpp b/engines/tony/debugger.cpp
index 75e58d68d4..6355284ece 100644
--- a/engines/tony/debugger.cpp
+++ b/engines/tony/debugger.cpp
@@ -88,7 +88,7 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
}
int sceneNumber = strToInt(argv[1]);
- if (sceneNumber >= _vm->_theBoxes.getLocBoxesCount()) {
+ if (sceneNumber >= g_vm->_theBoxes.getLocBoxesCount()) {
DebugPrintf("Invalid scene\n");
return true;
}
@@ -100,7 +100,7 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
} else {
// Get the box areas for the scene, and choose one so as to have a default
// position for Tony that will be in the walkable areas
- RMBoxLoc *box = _vm->_theBoxes.getBoxes(sceneNumber);
+ RMBoxLoc *box = g_vm->_theBoxes.getBoxes(sceneNumber);
scenePos.set(box->_boxes[0]._hotspot[0]._hotx, box->_boxes[0]._hotspot[0]._hoty);
}
@@ -122,7 +122,7 @@ bool Debugger::Cmd_DirtyRects(int argc, const char **argv) {
DebugPrintf("Usage; %s [on | off]\n", argv[0]);
return true;
} else {
- _vm->_window.showDirtyRects(strcmp(argv[1], "on") == 0);
+ g_vm->_window.showDirtyRects(strcmp(argv[1], "on") == 0);
return false;
}
}
diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp
index efce8dbe6e..2d334434d4 100644
--- a/engines/tony/font.cpp
+++ b/engines/tony/font.cpp
@@ -322,7 +322,7 @@ void RMFontDialog::init() {
_lTable['E'] = 10;
_lTable['F'] = 11;
- if (_vm->getLanguage() == Common::PL_POL) {
+ if (g_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//ꣳ󌜯
@@ -365,7 +365,7 @@ void RMFontDialog::init() {
_lTable[(byte)''] = 14;
_lTable[(byte)''] = 13;
- } else if (_vm->getLanguage() == Common::RU_RUS) {
+ } else if (g_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
@@ -508,7 +508,7 @@ void RMFontDialog::init() {
_lTable[(byte)''] = 15;
_lTable[(byte)''] = 14;
- } else if (_vm->getLanguage() == Common::CZ_CZE) {
+ } else if (g_vm->getLanguage() == Common::CZ_CZE) {
// Czech
_cTable[(byte)''] = 196;
_cTable[(byte)''] = 197;
@@ -574,7 +574,7 @@ void RMFontDialog::init() {
_lTable[(byte)''] = 13;
_lTable[(byte)''] = 13;
- } else if (_vm->getLanguage() == Common::FR_FRA) {
+ } else if (g_vm->getLanguage() == Common::FR_FRA) {
// French
_cTable[(byte)''] = 226;
@@ -595,7 +595,7 @@ void RMFontDialog::init() {
_lTable[(byte)''] = 11;
_lTable[(byte)''] = 11;
- } else if (_vm->getLanguage() == Common::DE_DEU) {
+ } else if (g_vm->getLanguage() == Common::DE_DEU) {
_cTable[(byte)''] = 234;
// 'SS' = 235
_cTable[(byte)''] = 236;
@@ -686,7 +686,7 @@ void RMFontMacc::init() {
//_cTable[(byte)''] = 100; // u with ball
_cTable[(byte)''] = 101;
- if (_vm->getLanguage() == Common::PL_POL) {
+ if (g_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//ꣳ󌜯
@@ -729,7 +729,7 @@ void RMFontMacc::init() {
_lTable[(byte)''] = 14;
_lTable[(byte)''] = 13;
- } else if (_vm->getLanguage() == Common::RU_RUS) {
+ } else if (g_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
// allowing for further translations. To support Tonyin other langauges,
@@ -870,7 +870,7 @@ void RMFontMacc::init() {
_lTable[(byte)''] = 11;
_lTable[(byte)''] = 11;
- } else if (_vm->getLanguage() == Common::CZ_CZE) {
+ } else if (g_vm->getLanguage() == Common::CZ_CZE) {
// Czech
_cTable[(byte)''] = 186;
@@ -937,7 +937,7 @@ void RMFontMacc::init() {
_lTable[(byte)''] = 11;
_lTable[(byte)''] = 11;
- } else if (_vm->getLanguage() == Common::FR_FRA) {
+ } else if (g_vm->getLanguage() == Common::FR_FRA) {
// French
_cTable[(byte)''] = 226;
@@ -958,7 +958,7 @@ void RMFontMacc::init() {
_lTable[(byte)''] = 10;
_lTable[(byte)''] = 10;
- } else if (_vm->getLanguage() == Common::DE_DEU) {
+ } else if (g_vm->getLanguage() == Common::DE_DEU) {
// German
_cTable[(byte)''] = 234;
@@ -1136,7 +1136,7 @@ void RMFontCredits::init() {
_lTable[':'] = 5;
_lTable['\''] = 5;
- if (_vm->getLanguage() == Common::PL_POL) {
+ if (g_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//ꣳ󌜯
@@ -1179,7 +1179,7 @@ void RMFontCredits::init() {
_lTable[(byte)''] = 15;
_lTable[(byte)''] = 10;
- } else if (_vm->getLanguage() == Common::RU_RUS) {
+ } else if (g_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
// allowing for further translations. To support Tonyin other langauges,
@@ -1320,7 +1320,7 @@ void RMFontCredits::init() {
_lTable[(byte)''] = 13;
_lTable[(byte)''] = 11;
- } else if (_vm->getLanguage() == Common::CZ_CZE) {
+ } else if (g_vm->getLanguage() == Common::CZ_CZE) {
// CZECH Language
_cTable[(byte)''] = 196;
@@ -1387,7 +1387,7 @@ void RMFontCredits::init() {
_lTable[(byte)''] = 10;
_lTable[(byte)''] = 10;
- } else if (_vm->getLanguage() == Common::FR_FRA) {
+ } else if (g_vm->getLanguage() == Common::FR_FRA) {
// French
_cTable[(byte)''] = 226;
@@ -1408,7 +1408,7 @@ void RMFontCredits::init() {
_lTable[(byte)''] = 11;
_lTable[(byte)''] = 11;
- } else if (_vm->getLanguage() == Common::DE_DEU) {
+ } else if (g_vm->getLanguage() == Common::DE_DEU) {
// German
_cTable[(byte)''] = 234;
@@ -1580,7 +1580,7 @@ void RMFontObj::init() {
setBothCase('R', 'R', 1);
setBothCase('R', 'U', 3);
- if (_vm->getLanguage() == Common::PL_POL) {
+ if (g_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//ꣳ󌜯
//AaCcEeLlNnOoSsZzZz
@@ -1611,7 +1611,7 @@ void RMFontObj::init() {
_cTable[(byte)''] = _cTable[(byte)''] = 93;
_lTable[(byte)''] = _lTable[(byte)''] = 21;
- } else if (_vm->getLanguage() == Common::RU_RUS) {
+ } else if (g_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
// allowing for further translations. To support Tonyin other langauges,
@@ -1689,7 +1689,7 @@ void RMFontObj::init() {
_lTable[(byte)''] = _lTable[(byte)''] = 18;
_lTable[(byte)''] = _lTable[(byte)''] = 18;
- } else if (_vm->getLanguage() == Common::CZ_CZE) {
+ } else if (g_vm->getLanguage() == Common::CZ_CZE) {
// Czech
_cTable[(byte)''] = _cTable[(byte)''] = 127;
@@ -1724,7 +1724,7 @@ void RMFontObj::init() {
_lTable[(byte)''] = _lTable[(byte)''] = 16;
_lTable[(byte)''] = _lTable[(byte)''] = 16;
- } else if (_vm->getLanguage() == Common::FR_FRA) {
+ } else if (g_vm->getLanguage() == Common::FR_FRA) {
// French
// Translate accented characters as normal letters
@@ -1744,7 +1744,7 @@ void RMFontObj::init() {
_cTable[(byte)''] = _cTable[(byte)''] = 20; // u
_lTable[(byte)''] = _lTable[(byte)''] = 15;
- } else if (_vm->getLanguage() == Common::DE_DEU) {
+ } else if (g_vm->getLanguage() == Common::DE_DEU) {
// German
_cTable[''] = 142;
@@ -2074,14 +2074,14 @@ void RMTextDialog::removeThis(CORO_PARAM, bool &result) {
if (!(GLOBALS._bCfgDubbing && _hCustomSkip2 != CORO_INVALID_PID_VALUE)) {
if (GLOBALS._bCfgTimerizedText) {
if (!_bForceNoTime) {
- if (_vm->getTime() > (uint32)_time + _startTime)
+ if (g_vm->getTime() > (uint32)_time + _startTime)
return;
}
}
}
if (!_bNoTab) {
- if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
+ if (g_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
return;
}
@@ -2095,14 +2095,14 @@ void RMTextDialog::removeThis(CORO_PARAM, bool &result) {
// Erase the background
else if (!(GLOBALS._bCfgDubbing && _hCustomSkip2 != CORO_INVALID_PID_VALUE)) {
if (!_bForceNoTime) {
- if (_vm->getTime() > (uint32)_time + _startTime)
+ if (g_vm->getTime() > (uint32)_time + _startTime)
return;
}
}
// If time is forced
if (_bForceTime) {
- if (_vm->getTime() > (uint32)_time + _startTime)
+ if (g_vm->getTime() > (uint32)_time + _startTime)
return;
}
@@ -2138,7 +2138,7 @@ void RMTextDialog::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *p
CORO_BEGIN_CODE(_ctx);
if (_startTime == 0)
- _startTime = _vm->getTime();
+ _startTime = g_vm->getTime();
if (_bShowed) {
if (GLOBALS._bShowSubtitles || _bAlwaysDisplay) {
@@ -2481,7 +2481,7 @@ void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
if (0) {
_bShow = true;
} else {
- _ctx->starttime = _vm->getTime();
+ _ctx->starttime = g_vm->getTime();
_ctx->deltay = 480 - _ptDrawPos._y;
_ctx->destpt = _ptDrawPos;
_ptDrawPos.set(0, 480);
@@ -2494,7 +2494,7 @@ void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
while (_ctx->elaps < 700) {
CORO_INVOKE_0(mainWaitFrame);
mainFreeze();
- _ctx->elaps = _vm->getTime() - _ctx->starttime;
+ _ctx->elaps = g_vm->getTime() - _ctx->starttime;
_ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * _ctx->elaps) / 100;
mainUnfreeze();
}
@@ -2531,14 +2531,14 @@ void RMDialogChoice::hide(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx);
if (1) {
- _ctx->starttime = _vm->getTime();
+ _ctx->starttime = g_vm->getTime();
_ctx->deltay = 480 - _ptDrawPos._y;
_ctx->elaps = 0;
while (_ctx->elaps < 700) {
CORO_INVOKE_0(mainWaitFrame);
mainFreeze();
- _ctx->elaps = _vm->getTime() - _ctx->starttime;
+ _ctx->elaps = g_vm->getTime() - _ctx->starttime;
_ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100;
mainUnfreeze();
}
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
index f1e8f0e614..d50f480625 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -48,75 +48,75 @@ using namespace MPAL;
/****************************************/
uint32 mainLoadLocation(int nLoc, RMPoint pt, RMPoint start) {
- return _vm->getEngine()->loadLocation(nLoc, pt, start);
+ return g_vm->getEngine()->loadLocation(nLoc, pt, start);
}
void mainUnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
- _vm->getEngine()->unloadLocation(coroParam, bDoOnExit, result);
+ g_vm->getEngine()->unloadLocation(coroParam, bDoOnExit, result);
}
void mainLinkGraphicTask(RMGfxTask *task) {
- _vm->getEngine()->linkGraphicTask(task);
+ g_vm->getEngine()->linkGraphicTask(task);
}
void mainFreeze() {
- _vm->getEngine()->freeze();
+ g_vm->getEngine()->freeze();
}
void mainUnfreeze() {
- _vm->getEngine()->unfreeze();
+ g_vm->getEngine()->unfreeze();
}
void mainWaitFrame(CORO_PARAM) {
- CoroScheduler.waitForSingleObject(coroParam, _vm->_hEndOfFrame, CORO_INFINITE);
+ CoroScheduler.waitForSingleObject(coroParam, g_vm->_hEndOfFrame, CORO_INFINITE);
}
void mainShowMouse() {
- _vm->getEngine()->enableMouse();
+ g_vm->getEngine()->enableMouse();
}
void mainHideMouse() {
- _vm->getEngine()->disableMouse();
+ g_vm->getEngine()->disableMouse();
}
void mainPlayMusic(int nChannel, const char *filename, int nFX, bool bLoop, int nSync) {
- _vm->playMusic(nChannel, filename, nFX, bLoop, nSync);
+ g_vm->playMusic(nChannel, filename, nFX, bLoop, nSync);
}
void mainDisableInput() {
- _vm->getEngine()->disableInput();
+ g_vm->getEngine()->disableInput();
}
void mainEnableInput() {
- _vm->getEngine()->enableInput();
+ g_vm->getEngine()->enableInput();
}
void mainInitWipe(int type) {
- _vm->getEngine()->initWipe(type);
+ g_vm->getEngine()->initWipe(type);
}
void mainCloseWipe() {
- _vm->getEngine()->closeWipe();
+ g_vm->getEngine()->closeWipe();
}
void mainWaitWipeEnd(CORO_PARAM) {
- _vm->getEngine()->waitWipeEnd(coroParam);
+ g_vm->getEngine()->waitWipeEnd(coroParam);
}
void mainEnableGUI() {
- _vm->getEngine()->_bGUIInterface = true;
- _vm->getEngine()->_bGUIInventory = true;
- _vm->getEngine()->_bGUIOption = true;
+ g_vm->getEngine()->_bGUIInterface = true;
+ g_vm->getEngine()->_bGUIInventory = true;
+ g_vm->getEngine()->_bGUIOption = true;
}
void mainDisableGUI() {
- _vm->getEngine()->_bGUIInterface = false;
- _vm->getEngine()->_bGUIInventory = false;
- _vm->getEngine()->_bGUIOption = false;
+ g_vm->getEngine()->_bGUIInterface = false;
+ g_vm->getEngine()->_bGUIInventory = false;
+ g_vm->getEngine()->_bGUIOption = false;
}
void mainSetPerorate(bool bPerorate) {
- _vm->getEngine()->setPerorate(bPerorate);
+ g_vm->getEngine()->setPerorate(bPerorate);
}
/****************************************************************************\
@@ -489,7 +489,7 @@ void RMOptionScreen::refreshAll(CORO_PARAM) {
if (_bEditSaveName) {
_ctx->thumb = new RMGfxSourceBuffer16;
- _ctx->thumb->init((byte *)_vm->getThumbnail(), 640 / 4, 480 / 4);
+ _ctx->thumb->init((byte *)g_vm->getThumbnail(), 640 / 4, 480 / 4);
if (_nEditPos == 0)
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 57)));
@@ -856,7 +856,7 @@ void RMOptionScreen::closeState() {
}
// Save the new settings to ScummVM
- _vm->saveSoundSettings();
+ g_vm->saveSoundSettings();
}
_nState = MENUNONE;
@@ -989,7 +989,7 @@ bool RMOptionScreen::close() {
// Start fade out
_fadeStep++;
- _fadeTime = _vm->getTime();
+ _fadeTime = g_vm->getTime();
return true;
}
@@ -1053,7 +1053,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
// Buttons with graphics
if (!_bNoLoadSave) {
- if (!_vm->getIsDemo()) {
+ if (!g_vm->getIsDemo()) {
_ctx->bRefresh |= _buttonLoad->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
_ctx->bRefresh |= _buttonSave->doFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
}
@@ -1096,7 +1096,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
}
}
-#define KEYPRESS(c) (_vm->getEngine()->getInput().getAsyncKeyState(c))
+#define KEYPRESS(c) (g_vm->getEngine()->getInput().getAsyncKeyState(c))
#define PROCESS_CHAR(cod,c) if (KEYPRESS(cod)) { \
_editName[strlen(_editName) + 1] = '\0'; _editName[strlen(_editName)] = c; _ctx->bRefresh = true; }
@@ -1153,7 +1153,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
// OK
if (KEYPRESS(Common::KEYCODE_RETURN)) {
_bEditSaveName = false;
- _vm->saveState(_statePos + _nEditPos, _editName);
+ g_vm->saveState(_statePos + _nEditPos, _editName);
close();
}
@@ -1191,7 +1191,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
// There by saving or loading!!!
if (_nState == MENULOAD && _curThumb[_ctx->i] != NULL) {
// Loading
- CORO_INVOKE_1(_vm->loadState, _statePos + _ctx->i);
+ CORO_INVOKE_1(g_vm->loadState, _statePos + _ctx->i);
close();
} else if (_nState == MENUSAVE && (_statePos != 0 || _ctx->i != 0)) {
// Turn on edit mode
@@ -1215,7 +1215,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
_bQuitConfirm = false;
_ctx->bRefresh = true;
- _vm->quitGame();
+ g_vm->quitGame();
}
} else {
if (_buttonQuit->isActive()) {
@@ -1281,7 +1281,7 @@ void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
CORO_BEGIN_CODE(_ctx);
- _ctx->curTime = _vm->getTime();
+ _ctx->curTime = g_vm->getTime();
#define FADE_SPEED 20
#define SYNC (_ctx->curTime - _fadeTime) / 25
@@ -1337,7 +1337,7 @@ void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
if (_fadeY > 480) {
_fadeY = 480;
_fadeStep++;
- _vm->hideLocation();
+ g_vm->hideLocation();
}
prim->setSrc(RMRect(0, 480 - _fadeY, 640, 480));
@@ -1347,7 +1347,7 @@ void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
} else if (_fadeStep == 7) {
// Menu OFF
- _vm->showLocation();
+ g_vm->showLocation();
_fadeStep++;
} else if (_fadeStep == 8) {
@@ -1399,7 +1399,7 @@ bool RMOptionScreen::loadThumbnailFromSaveState(int nState, byte *lpDestBuf, RMS
diff = 10;
// Get the savegame filename for the given slot
- buf = _vm->getSaveStateFileName(nState);
+ buf = g_vm->getSaveStateFileName(nState);
// Try and open the savegame
f = g_system->getSavefileManager()->openForLoading(buf);
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index 726ee07e28..183e68c8c6 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -110,7 +110,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) {
CORO_INVOKE_3(_opt.initSaveMenuOnly, _bigBuf, false, _ctx->bRes);
if (_ctx->bRes) {
- _vm->pauseSound(true);
+ g_vm->pauseSound(true);
disableInput();
_inv.endCombine();
@@ -120,7 +120,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) {
_point.setSpecialPointer(RMPointer::PTR_NONE);
_point.setCustomPointer(NULL);
enableMouse();
- _vm->grabThumbnail();
+ g_vm->grabThumbnail();
// Exists the IDLE to avoid premature death in loading
_bMustEnterMenu = true;
@@ -162,7 +162,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) {
disableMouse();
enableInput();
mpalStartIdlePoll(_nCurLoc);
- _vm->pauseSound(false);
+ g_vm->pauseSound(false);
}
}
@@ -214,7 +214,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) {
goto SKIPCLICKSINISTRO;
} else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE))
CORO_INVOKE_1(openOptionScreen, 0);
- else if (!_vm->getIsDemo()) {
+ else if (!g_vm->getIsDemo()) {
if (_input.getAsyncKeyState(Common::KEYCODE_F3) || _input.getAsyncKeyState(Common::KEYCODE_F5))
// Save game screen
CORO_INVOKE_1(openOptionScreen, 4);
@@ -355,7 +355,7 @@ SKIPCLICKSINISTRO:
}
void RMGfxEngine::initCustomDll() {
- setupGlobalVars(&_tony, &_point, &_vm->_theBoxes, &_loc, &_inv, &_input);
+ setupGlobalVars(&_tony, &_point, &g_vm->_theBoxes, &_loc, &_inv, &_input);
}
void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) {
@@ -475,8 +475,8 @@ void RMGfxEngine::init() {
// Display 'Loading' screen
_bigBuf.addDirtyRect(Common::Rect(0, 0, RM_SX, RM_SY));
- _vm->_window.getNewFrame(*this, NULL);
- _vm->_window.repaint();
+ g_vm->_window.getNewFrame(*this, NULL);
+ g_vm->_window.repaint();
GLOBALS._bPatIrqFreeze = true;
@@ -507,7 +507,7 @@ void RMGfxEngine::init() {
// Initialize Tony
_tony.init();
- _tony.linkToBoxes(&_vm->_theBoxes);
+ _tony.linkToBoxes(&g_vm->_theBoxes);
// Initialize the inventory and the interface
_inv.init();
@@ -631,9 +631,9 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
delete[] state;
// boxes
- size = _vm->_theBoxes.getSaveStateSize();
+ size = g_vm->_theBoxes.getSaveStateSize();
state = new byte[size];
- _vm->_theBoxes.saveState(state);
+ g_vm->_theBoxes.saveState(state);
f->writeUint32LE(size);
f->write(state, size);
delete[] state;
@@ -769,7 +769,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
_ctx->size = _ctx->f->readUint32LE();
_ctx->state = new byte[_ctx->size];
_ctx->f->read(_ctx->state, _ctx->size);
- _vm->_theBoxes.loadState(_ctx->state);
+ g_vm->_theBoxes.loadState(_ctx->state);
delete[] _ctx->state;
}
@@ -865,7 +865,7 @@ void RMGfxEngine::waitWipeEnd(CORO_PARAM) {
}
bool RMGfxEngine::canLoadSave() {
- return _bInput && !_tony.inAction() && !_vm->getIsDemo();
+ return _bInput && !_tony.inAction() && !g_vm->getIsDemo();
}
} // End of namespace Tony
diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp
index 7d663c1465..1e79032af2 100644
--- a/engines/tony/input.cpp
+++ b/engines/tony/input.cpp
@@ -52,7 +52,7 @@ void RMInput::poll() {
_leftClickMouse = _leftReleaseMouse = _rightClickMouse = _rightReleaseMouse = false;
// Get pending events
- while (g_system->getEventManager()->pollEvent(_event) && !_vm->shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(_event) && !g_vm->shouldQuit()) {
switch (_event.type) {
case Common::EVENT_MOUSEMOVE:
case Common::EVENT_LBUTTONDOWN:
@@ -83,8 +83,8 @@ void RMInput::poll() {
// Check for debugger
if ((_event.kbd.keycode == Common::KEYCODE_d) && (_event.kbd.flags & Common::KBD_CTRL)) {
// Attach to the debugger
- _vm->_debugger->attach();
- _vm->_debugger->onFrame();
+ g_vm->_debugger->attach();
+ g_vm->_debugger->onFrame();
} else {
// Flag the given key as being down
_keyDown[(int)_event.kbd.keycode] = true;
diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
index 0438d7252b..175d9fc6a9 100644
--- a/engines/tony/inventory.cpp
+++ b/engines/tony/inventory.cpp
@@ -339,7 +339,7 @@ bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) {
_nCombine = _inv[n - 1 + _curPos];
nCombineObj = _nCombine + 10000;
- _vm->playUtilSFX(1);
+ g_vm->playUtilSFX(1);
return true;
}
}
@@ -402,7 +402,7 @@ void RMInventory::rightClick(const RMPoint &mpos) {
_miniAction = 0;
_nSelectObj = n - 1;
- _vm->playUtilSFX(0);
+ g_vm->playUtilSFX(0);
}
}
@@ -524,7 +524,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
g_system->unlockMutex(_csModifyInterface);
}
- if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_i)) {
+ if (g_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_i)) {
GLOBALS._bCfgInvLocked = !GLOBALS._bCfgInvLocked;
}
@@ -538,7 +538,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (!GLOBALS._bCfgInvNoScroll) {
_state = OPENING;
_curPutY = RM_SY - 1;
- _curPutTime = _vm->getTime();
+ _curPutTime = g_vm->getTime();
} else {
_state = OPENED;
_curPutY = RM_SY - 68;
@@ -548,13 +548,13 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (!GLOBALS._bCfgInvNoScroll) {
_state = CLOSING;
_curPutY = RM_SY - 68;
- _curPutTime = _vm->getTime();
+ _curPutTime = g_vm->getTime();
} else {
_state = CLOSED;
}
}
} else if (_state == OPENING) {
- while (_curPutTime + INVSPEED < _vm->getTime()) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
_curPutY -= 3;
_curPutTime += INVSPEED;
}
@@ -565,7 +565,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
}
} else if (_state == CLOSING) {
- while (_curPutTime + INVSPEED < _vm->getTime()) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
_curPutY += 3;
_curPutTime += INVSPEED;
}
@@ -578,7 +578,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (!GLOBALS._bCfgInvNoScroll) {
_state = OPENING;
_curPutY = - 68;
- _curPutTime = _vm->getTime();
+ _curPutTime = g_vm->getTime();
} else {
_state = OPENED;
_curPutY = 0;
@@ -588,13 +588,13 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (!GLOBALS._bCfgInvNoScroll) {
_state = CLOSING;
_curPutY = -2;
- _curPutTime = _vm->getTime();
+ _curPutTime = g_vm->getTime();
} else {
_state = CLOSED;
}
}
} else if (_state == OPENING) {
- while (_curPutTime + INVSPEED < _vm->getTime()) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
_curPutY += 3;
_curPutTime += INVSPEED;
}
@@ -604,7 +604,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
_curPutY = 0;
}
} else if (_state == CLOSING) {
- while (_curPutTime + INVSPEED < _vm->getTime()) {
+ while (_curPutTime + INVSPEED < g_vm->getTime()) {
_curPutY -= 3;
_curPutTime += INVSPEED;
}
@@ -629,19 +629,19 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (_miniAction != 1) {
_miniInterface.setPattern(2);
_miniAction = 1;
- _vm->playUtilSFX(1);
+ g_vm->playUtilSFX(1);
}
} else if (mpos._x >= startx + 40 && mpos._x < startx + 80) {
if (_miniAction != 2) {
_miniInterface.setPattern(3);
_miniAction = 2;
- _vm->playUtilSFX(1);
+ g_vm->playUtilSFX(1);
}
} else if (mpos._x >= startx + 80 && mpos._x < startx + 108) {
if (_miniAction != 3) {
_miniInterface.setPattern(4);
_miniAction = 3;
- _vm->playUtilSFX(1);
+ g_vm->playUtilSFX(1);
}
} else {
_miniInterface.setPattern(1);
@@ -792,7 +792,7 @@ void RMInterface::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
if (_lastHotZone != _ctx->h) {
_lastHotZone = _ctx->h;
- _vm->playUtilSFX(1);
+ g_vm->playUtilSFX(1);
}
if (GLOBALS._bCfgInterTips) {
@@ -832,7 +832,7 @@ void RMInterface::clicked(const RMPoint &mousepos) {
_openStart._y = RM_SY - _dimy;
// Play the sound effect
- _vm->playUtilSFX(0);
+ g_vm->playUtilSFX(0);
}
bool RMInterface::released(const RMPoint &mousepos, RMTonyAction &action) {
diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp
index d02bd9640f..eaed3b49e2 100644
--- a/engines/tony/loc.cpp
+++ b/engines/tony/loc.cpp
@@ -157,7 +157,7 @@ int RMPattern::init(RMSfx *sfx, bool bPlayP0, byte *bFlag) {
int i;
// Read the current time
- _nStartTime = _vm->getTime();
+ _nStartTime = g_vm->getTime();
_nCurSlot = 0;
// Find the first frame of the pattern
@@ -210,7 +210,7 @@ int RMPattern::init(RMSfx *sfx, bool bPlayP0, byte *bFlag) {
}
int RMPattern::update(uint32 hEndPattern, byte &bFlag, RMSfx *sfx) {
- int CurTime = _vm->getTime();
+ int CurTime = g_vm->getTime();
// If the speed is 0, then the pattern never advances
if (_speed == 0) {
@@ -408,7 +408,7 @@ void RMSfx::readFromStream(RMDataStream &ds, bool bLOX) {
Common::SeekableReadStream *stream = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
// Create the sound effect
- _fx = _vm->createSFX(stream);
+ _fx = g_vm->createSFX(stream);
_fx->setLoop(false);
}
@@ -2083,10 +2083,10 @@ bool RMLocation::load(RMDataStream &ds) {
_items = new RMItem[_nItems];
- _vm->freezeTime();
+ g_vm->freezeTime();
for (i = 0; i < _nItems && !ds.isError(); i++)
ds >> _items[i];
- _vm->unfreezeTime();
+ g_vm->unfreezeTime();
return ds.isError();
}
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index 7385e60b66..20c28c5c93 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -607,7 +607,7 @@ void ScriptThread(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
- _ctx->dwStartTime = _vm->getTime();
+ _ctx->dwStartTime = g_vm->getTime();
_ctx->numHandles = 0;
// debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Moments: %u\n",s->nMoments);
@@ -615,9 +615,9 @@ void ScriptThread(CORO_PARAM, const void *param) {
// Sleep for the required time
if (s->Moment[_ctx->i].dwTime == -1) {
CORO_INVOKE_4(CoroScheduler.waitForMultipleObjects, _ctx->numHandles, cfHandles, true, CORO_INFINITE);
- _ctx->dwStartTime = _vm->getTime();
+ _ctx->dwStartTime = g_vm->getTime();
} else {
- _ctx->dwCurTime = _vm->getTime();
+ _ctx->dwCurTime = g_vm->getTime();
if (_ctx->dwCurTime < _ctx->dwStartTime + (s->Moment[_ctx->i].dwTime * 100)) {
// debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Sleeping %lums\n",_ctx->dwStartTime+(s->Moment[_ctx->i].dwTime*100)-_ctx->dwCurTime);
CORO_INVOKE_1(CoroScheduler.sleep, _ctx->dwStartTime+(s->Moment[_ctx->i].dwTime * 100) - _ctx->dwCurTime);
@@ -761,11 +761,11 @@ void ShutUpActionThread(CORO_PARAM, const void *param) {
GLOBALS._bExecutingAction = false;
- if (_vm->_initialLoadSlotNumber != -1) {
- _ctx->slotNumber = _vm->_initialLoadSlotNumber;
- _vm->_initialLoadSlotNumber = -1;
+ if (g_vm->_initialLoadSlotNumber != -1) {
+ _ctx->slotNumber = g_vm->_initialLoadSlotNumber;
+ g_vm->_initialLoadSlotNumber = -1;
- CORO_INVOKE_1(_vm->loadState, _ctx->slotNumber);
+ CORO_INVOKE_1(g_vm->loadState, _ctx->slotNumber);
}
@@ -909,7 +909,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
copyMemory(_ctx->MyActions[_ctx->k].CmdNum, _ctx->curItem->Action[_ctx->j].CmdNum,
MAX_COMMANDS_PER_ACTION * sizeof(uint16));
- _ctx->MyActions[_ctx->k].dwLastTime = _vm->getTime();
+ _ctx->MyActions[_ctx->k].dwLastTime = g_vm->getTime();
_ctx->k++;
}
}
@@ -925,7 +925,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
while (1) {
/* Cerchiamo tra tutte le idle actions quella a cui manca meno tempo per
l'esecuzione */
- _ctx->curTime = _vm->getTime();
+ _ctx->curTime = g_vm->getTime();
_ctx->dwSleepTime = (uint32)-1L;
for (_ctx->k = 0;_ctx->k<_ctx->nIdleActions;_ctx->k++)
@@ -951,7 +951,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
_ctx->MyThreads[_ctx->i].nItem = 0;
}
- _ctx->curTime = _vm->getTime();
+ _ctx->curTime = g_vm->getTime();
/* Loop through all the necessary idle actions */
for (_ctx->k = 0; _ctx->k < _ctx->nIdleActions; _ctx->k++)
@@ -959,7 +959,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
_ctx->MyActions[_ctx->k].dwLastTime += _ctx->MyActions[_ctx->k].wTime;
/* It's time to check to see if fortune is on the side of the idle action */
- byte randomVal = (byte)_vm->_randomSource.getRandomNumber(99);
+ byte randomVal = (byte)g_vm->_randomSource.getRandomNumber(99);
if (randomVal < _ctx->MyActions[_ctx->k].perc) {
/* Check if there is an action running on the item */
if ((GLOBALS._bExecutingAction) && (GLOBALS._nExecutingAction == _ctx->MyActions[_ctx->k].nItem))
diff --git a/engines/tony/mpal/mpalutils.cpp b/engines/tony/mpal/mpalutils.cpp
index aba92a86cd..aa22456a4b 100644
--- a/engines/tony/mpal/mpalutils.cpp
+++ b/engines/tony/mpal/mpalutils.cpp
@@ -37,7 +37,7 @@ namespace MPAL {
* @param resId MPAL resource to open
*/
RMRes::RMRes(uint32 resID) {
- _h = _vm->_resUpdate.queryResource(resID);
+ _h = g_vm->_resUpdate.queryResource(resID);
if (_h == NULL)
_h = mpalQueryResource(resID);
if (_h != NULL)
diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp
index 7380b3a93a..781172df52 100644
--- a/engines/tony/sound.cpp
+++ b/engines/tony/sound.cpp
@@ -138,7 +138,7 @@ FPSfx::FPSfx(bool bSoundOn) {
_rewindableStream = 0;
_bPaused = false;
- _vm->_activeSfx.push_back(this);
+ g_vm->_activeSfx.push_back(this);
}
/**
@@ -154,7 +154,7 @@ FPSfx::~FPSfx() {
return;
g_system->getMixer()->stopHandle(_handle);
- _vm->_activeSfx.remove(this);
+ g_vm->_activeSfx.remove(this);
if (_loopStream)
delete _loopStream; // _rewindableStream is deleted by deleting _loopStream
@@ -403,7 +403,7 @@ void FPSfx::soundCheckProcess(CORO_PARAM, const void *param) {
for (;;) {
// Check each active sound
- for (_ctx->i = _vm->_activeSfx.begin(); _ctx->i != _vm->_activeSfx.end(); ++_ctx->i) {
+ for (_ctx->i = g_vm->_activeSfx.begin(); _ctx->i != g_vm->_activeSfx.end(); ++_ctx->i) {
FPSfx *sfx = *_ctx->i;
if (sfx->endOfBuffer())
CoroScheduler.setEvent(sfx->_hEndOfBuffer);
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index a44d9410f3..6100596b0e 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -35,11 +35,11 @@
namespace Tony {
-TonyEngine *_vm;
+TonyEngine *g_vm;
TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("tony") {
- _vm = this;
+ g_vm = this;
_loadSlotNumber = -1;
// Set the up the debugger
@@ -229,7 +229,7 @@ void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, b
if (!getIsDemo()) {
if (!_stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync))
- _vm->abortGame();
+ g_vm->abortGame();
} else {
_stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync);
}
@@ -241,7 +241,7 @@ void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, b
} else {
if (!getIsDemo()) {
if (!_stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync))
- _vm->abortGame();
+ g_vm->abortGame();
} else {
_stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync);
}
@@ -256,13 +256,13 @@ void TonyEngine::doNextMusic(CORO_PARAM, const void *param) {
Common::String fn;
CORO_END_CONTEXT(_ctx);
- FPStream **streams = _vm->_stream;
+ FPStream **streams = g_vm->_stream;
CORO_BEGIN_CODE(_ctx);
- if (!_vm->getIsDemo()) {
+ if (!g_vm->getIsDemo()) {
if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync))
- _vm->abortGame();
+ g_vm->abortGame();
} else {
streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync);
}
@@ -532,34 +532,34 @@ void TonyEngine::playProcess(CORO_PARAM, const void *param) {
// and kill the scheudler and all the processes, including this one
for (;;) {
// If a savegame needs to be loaded, then do so
- if (_vm->_loadSlotNumber != -1 && GLOBALS._gfxEngine != NULL) {
- _ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber);
+ if (g_vm->_loadSlotNumber != -1 && GLOBALS._gfxEngine != NULL) {
+ _ctx->fn = getSaveStateFileName(g_vm->_loadSlotNumber);
CORO_INVOKE_1(GLOBALS._gfxEngine->loadState, _ctx->fn);
- _vm->_loadSlotNumber = -1;
+ g_vm->_loadSlotNumber = -1;
}
// Wait for the next frame
CORO_INVOKE_1(CoroScheduler.sleep, 50);
// Call the engine to handle the next frame
- CORO_INVOKE_1(_vm->_theEngine.doFrame, _vm->_bDrawLocation);
+ CORO_INVOKE_1(g_vm->_theEngine.doFrame, g_vm->_bDrawLocation);
// Warns that a frame is finished
- CoroScheduler.pulseEvent(_vm->_hEndOfFrame);
+ CoroScheduler.pulseEvent(g_vm->_hEndOfFrame);
// Handle drawing the frame
- if (!_vm->_bPaused) {
- if (!_vm->_theEngine._bWiping)
- _vm->_window.getNewFrame(_vm->_theEngine, NULL);
+ if (!g_vm->_bPaused) {
+ if (!g_vm->_theEngine._bWiping)
+ g_vm->_window.getNewFrame(g_vm->_theEngine, NULL);
else
- _vm->_window.getNewFrame(_vm->_theEngine, &_vm->_theEngine._rcWipeEllipse);
+ g_vm->_window.getNewFrame(g_vm->_theEngine, &g_vm->_theEngine._rcWipeEllipse);
}
// Paint the frame onto the screen
- _vm->_window.repaint();
+ g_vm->_window.repaint();
// Signal the ScummVM debugger
- _vm->_debugger->onFrame();
+ g_vm->_debugger->onFrame();
}
CORO_END_CODE;
diff --git a/engines/tony/tony.h b/engines/tony/tony.h
index 94dc3de92d..18cddf3f2a 100644
--- a/engines/tony/tony.h
+++ b/engines/tony/tony.h
@@ -238,9 +238,9 @@ public:
};
// Global reference to the TonyEngine object
-extern TonyEngine *_vm;
+extern TonyEngine *g_vm;
-#define GLOBALS _vm->_globals
+#define GLOBALS g_vm->_globals
} // End of namespace Tony
diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp
index 74d9f20181..8593ece480 100644
--- a/engines/tony/tonychar.cpp
+++ b/engines/tony/tonychar.cpp
@@ -115,7 +115,7 @@ void RMTony::init() {
ds.close();
_body.setPattern(0);
- _nTimeLastStep = _vm->getTime();
+ _nTimeLastStep = g_vm->getTime();
}
@@ -137,7 +137,7 @@ void RMTony::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int curLoc) {
setSpeed(GLOBALS._nCfgTonySpeed);
// Runs the normal character movement
- _ctx->time = _vm->getTime();
+ _ctx->time = g_vm->getTime();
do {
_nTimeLastStep += (1000 / 40);
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
index 2d5954a74c..3806aa67c8 100644
--- a/engines/tony/window.cpp
+++ b/engines/tony/window.cpp
@@ -70,7 +70,7 @@ void RMWindow::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w,
if (GLOBALS._bCfgAnni30) {
if (!RMGfxTargetBuffer::_precalcTable) {
RMGfxTargetBuffer::createBWPrecalcTable();
- _vm->getEngine()->getPointer().updateCursor();
+ g_vm->getEngine()->getPointer().updateCursor();
}
Graphics::Surface *screen = g_system->lockScreen();
const uint16 *src = (const uint16 *)buf;
@@ -85,7 +85,7 @@ void RMWindow::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w,
} else {
if (RMGfxTargetBuffer::_precalcTable) {
RMGfxTargetBuffer::freeBWPrecalcTable();
- _vm->getEngine()->getPointer().updateCursor();
+ g_vm->getEngine()->getPointer().updateCursor();
}
g_system->copyRectToScreen(buf, pitch, x, y, w, h);
}
@@ -143,7 +143,7 @@ void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllip
// FIXME: The current dirty rect handling code has a minor issue with screen refresh in one
// scene in the introduction sequence as the scene changes. For now, we're working around the
// problem by explicitly having full screen refreshes on that scene
- bool fullRefresh = _vm->getEngine()->getCurrentLocation() == 98;
+ bool fullRefresh = g_vm->getEngine()->getCurrentLocation() == 98;
if (rcBoundEllipse != NULL) {
// Circular wipe effect