From 2b02a45ce16960644e1d5e297066f8040cd48cbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Jun 2012 22:02:31 +0200 Subject: TONY: Rename variables in globals.h --- engines/tony/custom.cpp | 574 +++++++++++++++++++++--------------------- engines/tony/gfxengine.cpp | 8 +- engines/tony/globals.cpp | 106 ++++---- engines/tony/globals.h | 114 ++++----- engines/tony/mpal/expr.cpp | 2 +- engines/tony/mpal/loadmpc.cpp | 195 +++++++------- engines/tony/mpal/mpal.cpp | 389 ++++++++++++++-------------- engines/tony/mpal/mpaldll.h | 10 +- engines/tony/tony.cpp | 14 +- 9 files changed, 707 insertions(+), 705 deletions(-) (limited to 'engines') diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp index 185fc64e94..2e408a01aa 100644 --- a/engines/tony/custom.cpp +++ b/engines/tony/custom.cpp @@ -109,7 +109,7 @@ const char *staccFileNames[] = { void ReapplyChangedHotspot(void) { int i; for (i = 0; i < GLOBALS._curChangedHotspot; i++) - GLOBALS.Loc->getItemFromCode(GLOBALS._changedHotspot[i]._dwCode)->changeHotspot(RMPoint(GLOBALS._changedHotspot[i]._nX, GLOBALS._changedHotspot[i]._nY)); + GLOBALS._loc->getItemFromCode(GLOBALS._changedHotspot[i]._dwCode)->changeHotspot(RMPoint(GLOBALS._changedHotspot[i]._nX, GLOBALS._changedHotspot[i]._nY)); } void SaveChangedHotspot(Common::OutSaveFile *f) { @@ -141,9 +141,9 @@ void LoadChangedHotspot(Common::InSaveFile *f) { */ void MCharResetCodes(void) { for (int i = 0; i < 10; i++) - GLOBALS._mCharacter[i]._item = GLOBALS.Loc->getItemFromCode(GLOBALS._mCharacter[i]._code); + GLOBALS._mCharacter[i]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[i]._code); for (int i = 0; i < 10; i++) - GLOBALS._character[i]._item = GLOBALS.Loc->getItemFromCode(GLOBALS._character[i]._code); + GLOBALS._character[i]._item = GLOBALS._loc->getItemFromCode(GLOBALS._character[i]._code); } void CharsSaveAll(Common::OutSaveFile *f) { @@ -168,19 +168,19 @@ void CharsLoadAll(Common::InSaveFile *f) { } DECLARE_CUSTOM_FUNCTION(FaceToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_STANDDOWN); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDDOWN); } DECLARE_CUSTOM_FUNCTION(BackToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_STANDUP); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDUP); } DECLARE_CUSTOM_FUNCTION(LeftToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_STANDLEFT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDLEFT); } DECLARE_CUSTOM_FUNCTION(RightToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_STANDRIGHT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDRIGHT); } @@ -195,7 +195,7 @@ DECLARE_CUSTOM_FUNCTION(MySleep)(CORO_PARAM, uint32 dwTime, uint32, uint32, uint CORO_BEGIN_CODE(_ctx); - if (!GLOBALS.bSkipIdle) + if (!GLOBALS._bSkipIdle) CORO_INVOKE_1(CoroScheduler.sleep, dwTime); CORO_END_CODE; @@ -209,23 +209,23 @@ DECLARE_CUSTOM_FUNCTION(SetAlwaysDisplay)(CORO_PARAM, uint32 val, uint32, uint32 DECLARE_CUSTOM_FUNCTION(SetPointer)(CORO_PARAM, uint32 dwPointer, uint32, uint32, uint32) { switch (dwPointer) { case 1: - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_FRECCIASU); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_FRECCIASU); break; case 2: - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_FRECCIAGIU); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_FRECCIAGIU); break; case 3: - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_FRECCIASINISTRA); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_FRECCIASINISTRA); break; case 4: - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_FRECCIADESTRA); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_FRECCIADESTRA); break; case 5: - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_FRECCIAMAPPA); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_FRECCIAMAPPA); break; default: - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_NONE); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_NONE); break; } } @@ -261,12 +261,12 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX _ctx->curOffset = 0; - if (GLOBALS.bSkipIdle) return; + if (GLOBALS._bSkipIdle) + return; _ctx->msg.load(dwMessage); - if (!_ctx->msg.isValid()) { + if (!_ctx->msg.isValid()) return; - } _ctx->curVoc = SearchVoiceHeader(0, dwMessage); _ctx->voice = NULL; @@ -284,16 +284,16 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX _ctx->voice->SetLoop(false); } - if (GLOBALS.nTonyNextTalkType != GLOBALS.Tony->TALK_NORMAL) { - CORO_INVOKE_1(GLOBALS.Tony->startTalk, GLOBALS.nTonyNextTalkType); + if (GLOBALS._nTonyNextTalkType != GLOBALS._tony->TALK_NORMAL) { + CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._nTonyNextTalkType); - if (!GLOBALS.bStaticTalk) - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + if (!GLOBALS._bStaticTalk) + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; } else { if (_ctx->msg.numPeriods() > 1) - CORO_INVOKE_1(GLOBALS.Tony->startTalk, GLOBALS.Tony->TALK_FIANCHI); + CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._tony->TALK_FIANCHI); else - CORO_INVOKE_1(GLOBALS.Tony->startTalk, GLOBALS.Tony->TALK_NORMAL); + CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._tony->TALK_NORMAL); } if (GLOBALS._curBackText) @@ -301,8 +301,8 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX GLOBALS._bTonyIsSpeaking = true; - for (_ctx->i = 0; _ctx->i < _ctx->msg.numPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) { - _ctx->text.setInput(GLOBALS.Input); + for (_ctx->i = 0; _ctx->i < _ctx->msg.numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) { + _ctx->text.setInput(GLOBALS._input); // Alignment _ctx->text.setAlignType(RMText::HCENTER, RMText::VBOTTOM); @@ -315,9 +315,9 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX // Set the position if (nX == 0 && nY == 0) - _ctx->text.setPosition(GLOBALS.Tony->position() - RMPoint(0, 130) - GLOBALS.Loc->scrollPosition()); + _ctx->text.setPosition(GLOBALS._tony->position() - RMPoint(0, 130) - GLOBALS._loc->scrollPosition()); else - _ctx->text.setPosition(RMPoint(nX, nY) - GLOBALS.Loc->scrollPosition()); + _ctx->text.setPosition(RMPoint(nX, nY) - GLOBALS._loc->scrollPosition()); // Handling for always display if (GLOBALS._bAlwaysDisplay) { @@ -345,7 +345,7 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX } // Wait for the end of the display - _ctx->text.setCustomSkipHandle(GLOBALS.hSkipIdle); + _ctx->text.setCustomSkipHandle(GLOBALS._hSkipIdle); CORO_INVOKE_0(_ctx->text.waitForEndDisplay); if (_ctx->curVoc) { @@ -359,13 +359,13 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX if (GLOBALS._curBackText) GLOBALS._curBackText->show(); - CORO_INVOKE_0(GLOBALS.Tony->endTalk); + CORO_INVOKE_0(GLOBALS._tony->endTalk); CORO_END_CODE; } DECLARE_CUSTOM_FUNCTION(ChangeBoxStatus)(CORO_PARAM, uint32 nLoc, uint32 nBox, uint32 nStatus, uint32) { - GLOBALS.Boxes->changeBoxStatus(nLoc, nBox, nStatus); + GLOBALS._boxes->changeBoxStatus(nLoc, nBox, nStatus); } @@ -380,7 +380,7 @@ DECLARE_CUSTOM_FUNCTION(CustLoadLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, ui GLOBALS._curChangedHotspot = 0; if (bUseStartPos != 0) - GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), GLOBALS.StartLocPos[nLoc]); + GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), GLOBALS._startLocPos[nLoc]); else GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), RMPoint(-1, -1)); @@ -407,18 +407,18 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32 _ctx->msg = new RMMessage(nMsg); - GLOBALS.SFM_nLoc = GLOBALS.Loc->TEMPGetNumLoc(); - GLOBALS.SFM_pt = GLOBALS.Tony->position(); + GLOBALS.SFM_nLoc = GLOBALS._loc->TEMPGetNumLoc(); + GLOBALS.SFM_pt = GLOBALS._tony->position(); - if (GLOBALS.bSkipIdle) + if (GLOBALS._bSkipIdle) return; CORO_INVOKE_2(GLOBALS.UnloadLocation, false, NULL); - GLOBALS.Tony->hide(); + GLOBALS._tony->hide(); GLOBALS.Unfreeze(); - for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) { - _ctx->text.setInput(GLOBALS.Input); + for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) { + _ctx->text.setInput(GLOBALS._input); // Alignment _ctx->text.setAlignType(RMText::HCENTER, RMText::VCENTER); @@ -446,7 +446,7 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32 GLOBALS.LinkGraphicTask(&_ctx->text); // Wait for the end of display - _ctx->text.setCustomSkipHandle(GLOBALS.hSkipIdle); + _ctx->text.setCustomSkipHandle(GLOBALS._hSkipIdle); CORO_INVOKE_0(_ctx->text.waitForEndDisplay); } @@ -474,7 +474,7 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgEnd)(CORO_PARAM, uint32 bNotEnableTony, GLOBALS.Freeze(); GLOBALS.LoadLocation(GLOBALS.SFM_nLoc, RMPoint(GLOBALS.SFM_pt.x, GLOBALS.SFM_pt.y), RMPoint(-1, -1)); if (!bNotEnableTony) - GLOBALS.Tony->show(); + GLOBALS._tony->show(); GLOBALS.Unfreeze(); MCharResetCodes(); @@ -531,7 +531,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint CORO_INVOKE_0(GLOBALS.WaitWipeEnd); } - if (GLOBALS.lastTappeto != GLOBALS.tappeti[nLoc]) { + if (GLOBALS._lastTappeto != GLOBALS._tappeti[nLoc]) { _vm->stopMusic(4); } @@ -540,14 +540,14 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint GLOBALS._curChangedHotspot = 0; if (bUseStartPos != 0) - GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), GLOBALS.StartLocPos[nLoc]); + GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), GLOBALS._startLocPos[nLoc]); else GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), RMPoint(-1, -1)); - if (GLOBALS.lastTappeto != GLOBALS.tappeti[nLoc]) { - GLOBALS.lastTappeto = GLOBALS.tappeti[nLoc]; - if (GLOBALS.lastTappeto != 0) - _vm->playMusic(4, tappetiFile[GLOBALS.lastTappeto], 0, true, 2000); + if (GLOBALS._lastTappeto != GLOBALS._tappeti[nLoc]) { + GLOBALS._lastTappeto = GLOBALS._tappeti[nLoc]; + if (GLOBALS._lastTappeto != 0) + _vm->playMusic(4, tappetiFile[GLOBALS._lastTappeto], 0, true, 2000); } if (!GLOBALS._bNoOcchioDiBue) { @@ -574,12 +574,12 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint } DECLARE_CUSTOM_FUNCTION(SetLocStartPosition)(CORO_PARAM, uint32 nLoc, uint32 lX, uint32 lY, uint32) { - GLOBALS.StartLocPos[nLoc].set(lX, lY); + GLOBALS._startLocPos[nLoc].set(lX, lY); } DECLARE_CUSTOM_FUNCTION(SaveTonyPosition)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS._saveTonyPos = GLOBALS.Tony->position(); - GLOBALS._saveTonyLoc = GLOBALS.Loc->TEMPGetNumLoc(); + GLOBALS._saveTonyPos = GLOBALS._tony->position(); + GLOBALS._saveTonyLoc = GLOBALS._loc->TEMPGetNumLoc(); } DECLARE_CUSTOM_FUNCTION(RestoreTonyPosition)(CORO_PARAM, uint32, uint32, uint32, uint32) { @@ -604,7 +604,7 @@ DECLARE_CUSTOM_FUNCTION(EnableInput)(CORO_PARAM, uint32, uint32, uint32, uint32) } DECLARE_CUSTOM_FUNCTION(StopTony)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.Tony->stopNoAction(coroParam); + GLOBALS._tony->stopNoAction(coroParam); } DECLARE_CUSTOM_FUNCTION(CustEnableGUI)(CORO_PARAM, uint32, uint32, uint32, uint32) { @@ -624,11 +624,11 @@ void TonyGenericTake1(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); GLOBALS.Freeze(); - GLOBALS.Tony->take(nDirection, 0); + GLOBALS._tony->take(nDirection, 0); GLOBALS.Unfreeze(); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); CORO_END_CODE; } @@ -640,14 +640,14 @@ void TonyGenericTake2(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); GLOBALS.Freeze(); - GLOBALS.Tony->take(nDirection, 1); + GLOBALS._tony->take(nDirection, 1); GLOBALS.Unfreeze(); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); GLOBALS.Freeze(); - GLOBALS.Tony->take(nDirection, 2); + GLOBALS._tony->take(nDirection, 2); GLOBALS.Unfreeze(); CORO_END_CODE; @@ -660,11 +660,11 @@ void TonyGenericPut1(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); GLOBALS.Freeze(); - GLOBALS.Tony->put(nDirection, 0); + GLOBALS._tony->put(nDirection, 0); GLOBALS.Unfreeze(); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); CORO_END_CODE; } @@ -676,14 +676,14 @@ void TonyGenericPut2(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); GLOBALS.Freeze(); - GLOBALS.Tony->put(nDirection, 1); + GLOBALS._tony->put(nDirection, 1); GLOBALS.Unfreeze(); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); GLOBALS.Freeze(); - GLOBALS.Tony->put(nDirection, 2); + GLOBALS._tony->put(nDirection, 2); GLOBALS.Unfreeze(); CORO_END_CODE; @@ -749,9 +749,9 @@ DECLARE_CUSTOM_FUNCTION(TonyPutDown2)(CORO_PARAM, uint32, uint32, uint32, uint32 DECLARE_CUSTOM_FUNCTION(TonyPerTerra)(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) { if (dwParte == 0) - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_PERTERRALEFT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_PERTERRALEFT); else - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_PERTERRARIGHT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_PERTERRARIGHT); } DECLARE_CUSTOM_FUNCTION(TonySiRialza)(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) { @@ -761,18 +761,18 @@ DECLARE_CUSTOM_FUNCTION(TonySiRialza)(CORO_PARAM, uint32 dwParte, uint32, uint32 CORO_BEGIN_CODE(_ctx); if (dwParte == 0) - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_SIRIALZALEFT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SIRIALZALEFT); else - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_SIRIALZARIGHT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SIRIALZARIGHT); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); CORO_END_CODE; } DECLARE_CUSTOM_FUNCTION(TonyPastorella)(CORO_PARAM, uint32 bIsPast, uint32, uint32, uint32) { - GLOBALS.Tony->setPastorella(bIsPast); + GLOBALS._tony->setPastorella(bIsPast); } DECLARE_CUSTOM_FUNCTION(TonyFischietto)(CORO_PARAM, uint32, uint32, uint32, uint32) { @@ -781,104 +781,104 @@ DECLARE_CUSTOM_FUNCTION(TonyFischietto)(CORO_PARAM, uint32, uint32, uint32, uint CORO_BEGIN_CODE(_ctx); - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_FISCHIETTORIGHT); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_FISCHIETTORIGHT); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_STANDRIGHT); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDRIGHT); CORO_END_CODE; } void TonySetNumTexts(uint32 dwText) { - GLOBALS.dwTonyNumTexts = dwText; - GLOBALS.bTonyInTexts = false; + GLOBALS._dwTonyNumTexts = dwText; + GLOBALS._bTonyInTexts = false; } DECLARE_CUSTOM_FUNCTION(TonyRide)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_RIDE; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_RIDE; } DECLARE_CUSTOM_FUNCTION(TonyRidacchia)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_RIDE2; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_RIDE2; } DECLARE_CUSTOM_FUNCTION(TonyFianchi)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_FIANCHI; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_FIANCHI; } DECLARE_CUSTOM_FUNCTION(TonyCanta)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CANTA; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CANTA; } DECLARE_CUSTOM_FUNCTION(TonySiIndica)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_SIINDICA; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SIINDICA; } DECLARE_CUSTOM_FUNCTION(TonySpaventatoConMani)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_SPAVENTATO; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SPAVENTATO; } DECLARE_CUSTOM_FUNCTION(TonySpaventatoSenzaMani)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_SPAVENTATO2; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SPAVENTATO2; } DECLARE_CUSTOM_FUNCTION(TonyConMartello)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONMARTELLO; - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_CONMARTELLO); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONMARTELLO; + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_CONMARTELLO); } DECLARE_CUSTOM_FUNCTION(TonyConBicchiere)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONBICCHIERE; - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_CONBICCHIERE); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONBICCHIERE; + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_CONBICCHIERE); } DECLARE_CUSTOM_FUNCTION(TonyConVerme)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONVERME; - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_CONVERME); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONVERME; + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_CONVERME); } DECLARE_CUSTOM_FUNCTION(TonyConCorda)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONCORDA; - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_CONCORDA); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONCORDA; + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_CONCORDA); } DECLARE_CUSTOM_FUNCTION(TonyConSegretaria)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONSEGRETARIA; - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_CONSEGRETARIA); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONSEGRETARIA; + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_CONSEGRETARIA); } DECLARE_CUSTOM_FUNCTION(TonyConConiglioANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONCONIGLIO; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONCONIGLIO; } DECLARE_CUSTOM_FUNCTION(TonyConRicettaANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONRICETTA; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONRICETTA; } DECLARE_CUSTOM_FUNCTION(TonyConCarteANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONCARTE; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONCARTE; } DECLARE_CUSTOM_FUNCTION(TonyConPupazzoANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONPUPAZZO; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONPUPAZZO; } DECLARE_CUSTOM_FUNCTION(TonyConPupazzoStart)(CORO_PARAM, uint32, uint32, uint32, uint32) { @@ -887,9 +887,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConPupazzoStart)(CORO_PARAM, uint32, uint32, uint32, CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONPUPAZZOSTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_CONPUPAZZOSTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONPUPAZZOSTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_CONPUPAZZOSTATIC); CORO_END_CODE; } @@ -900,9 +900,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConPupazzoEnd)(CORO_PARAM, uint32, uint32, uint32, u CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_CONPUPAZZOSTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_CONPUPAZZOSTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -913,9 +913,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConConiglioStart)(CORO_PARAM, uint32, uint32, uint32 CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONCONIGLIOSTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_CONCONIGLIOSTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONCONIGLIOSTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_CONCONIGLIOSTATIC); CORO_END_CODE; } @@ -926,9 +926,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConConiglioEnd)(CORO_PARAM, uint32, uint32, uint32, CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_CONCONIGLIOSTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_CONCONIGLIOSTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -939,9 +939,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConRicettaStart)(CORO_PARAM, uint32, uint32, uint32, CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONRICETTASTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_CONRICETTASTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONRICETTASTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_CONRICETTASTATIC); CORO_END_CODE; } @@ -952,9 +952,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConRicettaEnd)(CORO_PARAM, uint32, uint32, uint32, u CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_CONRICETTASTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_CONRICETTASTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -965,9 +965,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConCarteStart)(CORO_PARAM, uint32, uint32, uint32, u CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONCARTESTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_CONCARTESTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONCARTESTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_CONCARTESTATIC); CORO_END_CODE; } @@ -978,9 +978,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConCarteEnd)(CORO_PARAM, uint32, uint32, uint32, uin CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_CONCARTESTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_CONCARTESTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -991,9 +991,9 @@ DECLARE_CUSTOM_FUNCTION(TonyWithNotebookStart)(CORO_PARAM, uint32, uint32, uint3 CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_WITH_NOTEBOOK; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_WITH_NOTEBOOK); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITH_NOTEBOOK; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_WITH_NOTEBOOK); CORO_END_CODE; } @@ -1004,9 +1004,9 @@ DECLARE_CUSTOM_FUNCTION(TonyWithNotebookEnd)(CORO_PARAM, uint32, uint32, uint32, CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_WITH_NOTEBOOK); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_WITH_NOTEBOOK); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -1017,9 +1017,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConMegafonoStart)(CORO_PARAM, uint32, uint32, uint32 CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONMEGAFONOSTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_CONMEGAFONOSTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONMEGAFONOSTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_CONMEGAFONOSTATIC); CORO_END_CODE; } @@ -1030,9 +1030,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConMegafonoEnd)(CORO_PARAM, uint32, uint32, uint32, CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_CONMEGAFONOSTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_CONMEGAFONOSTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -1043,9 +1043,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConBarbaStart)(CORO_PARAM, uint32, uint32, uint32, u CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_CONBARBASTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_CONBARBASTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_CONBARBASTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_CONBARBASTATIC); CORO_END_CODE; } @@ -1056,9 +1056,9 @@ DECLARE_CUSTOM_FUNCTION(TonyConBarbaEnd)(CORO_PARAM, uint32, uint32, uint32, uin CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_CONBARBASTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_CONBARBASTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -1069,9 +1069,9 @@ DECLARE_CUSTOM_FUNCTION(TonySpaventatoStart)(CORO_PARAM, uint32, uint32, uint32, CORO_BEGIN_CODE(_ctx); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_SPAVENTATOSTATIC; - GLOBALS.bStaticTalk = true; - CORO_INVOKE_1(GLOBALS.Tony->startStatic, GLOBALS.Tony->TALK_SPAVENTATOSTATIC); + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SPAVENTATOSTATIC; + GLOBALS._bStaticTalk = true; + CORO_INVOKE_1(GLOBALS._tony->startStatic, GLOBALS._tony->TALK_SPAVENTATOSTATIC); CORO_END_CODE; } @@ -1082,9 +1082,9 @@ DECLARE_CUSTOM_FUNCTION(TonySpaventatoEnd)(CORO_PARAM, uint32, uint32, uint32, u CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->endStatic, GLOBALS.Tony->TALK_SPAVENTATOSTATIC); - GLOBALS.bStaticTalk = false; - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->endStatic, GLOBALS._tony->TALK_SPAVENTATOSTATIC); + GLOBALS._bStaticTalk = false; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; CORO_END_CODE; } @@ -1092,7 +1092,7 @@ DECLARE_CUSTOM_FUNCTION(TonySpaventatoEnd)(CORO_PARAM, uint32, uint32, uint32, u DECLARE_CUSTOM_FUNCTION(TonySchifato)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_SCHIFATO; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SCHIFATO; } DECLARE_CUSTOM_FUNCTION(TonySniffaLeft)(CORO_PARAM, uint32, uint32, uint32, uint32) { @@ -1101,8 +1101,8 @@ DECLARE_CUSTOM_FUNCTION(TonySniffaLeft)(CORO_PARAM, uint32, uint32, uint32, uint CORO_BEGIN_CODE(_ctx); - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_SNIFFA_LEFT); - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SNIFFA_LEFT); + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); CORO_INVOKE_4(LeftToMe, 0, 0, 0, 0); CORO_END_CODE; @@ -1114,8 +1114,8 @@ DECLARE_CUSTOM_FUNCTION(TonySniffaRight)(CORO_PARAM, uint32, uint32, uint32, uin CORO_BEGIN_CODE(_ctx); - GLOBALS.Tony->setPattern(GLOBALS.Tony->PAT_SNIFFA_RIGHT); - CORO_INVOKE_0(GLOBALS.Tony->waitForEndPattern); + GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SNIFFA_RIGHT); + CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); CORO_INVOKE_4(RightToMe, 0, 0, 0, 0); CORO_END_CODE; @@ -1123,48 +1123,48 @@ DECLARE_CUSTOM_FUNCTION(TonySniffaRight)(CORO_PARAM, uint32, uint32, uint32, uin DECLARE_CUSTOM_FUNCTION(TonyNaah)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { TonySetNumTexts(dwText); - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NAAH; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NAAH; } DECLARE_CUSTOM_FUNCTION(TonyMacbeth)(CORO_PARAM, uint32 nPos, uint32, uint32, uint32) { switch (nPos) { case 1: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH1; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH1; break; case 2: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH2; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH2; break; case 3: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH3; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH3; break; case 4: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH4; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH4; break; case 5: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH5; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH5; break; case 6: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH6; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH6; break; case 7: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH7; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH7; break; case 8: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH8; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH8; break; case 9: - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_MACBETH9; + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH9; break; } } DECLARE_CUSTOM_FUNCTION(EnableTony)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.Tony->show(); + GLOBALS._tony->show(); } DECLARE_CUSTOM_FUNCTION(DisableTony)(CORO_PARAM, uint32 bShowOmbra, uint32, uint32, uint32) { - GLOBALS.Tony->hide(bShowOmbra); + GLOBALS._tony->hide(bShowOmbra); } DECLARE_CUSTOM_FUNCTION(WaitForPatternEnd)(CORO_PARAM, uint32 nItem, uint32, uint32, uint32) { @@ -1174,17 +1174,17 @@ DECLARE_CUSTOM_FUNCTION(WaitForPatternEnd)(CORO_PARAM, uint32 nItem, uint32, uin CORO_BEGIN_CODE(_ctx); - _ctx->item = GLOBALS.Loc->getItemFromCode(nItem); + _ctx->item = GLOBALS._loc->getItemFromCode(nItem); - if (!GLOBALS.bSkipIdle && _ctx->item != NULL) - CORO_INVOKE_1(_ctx->item->waitForEndPattern, GLOBALS.hSkipIdle); + if (!GLOBALS._bSkipIdle && _ctx->item != NULL) + CORO_INVOKE_1(_ctx->item->waitForEndPattern, GLOBALS._hSkipIdle); CORO_END_CODE; } DECLARE_CUSTOM_FUNCTION(SetTonyPosition)(CORO_PARAM, uint32 nX, uint32 nY, uint32 nLoc, uint32) { - GLOBALS.Tony->setPosition(RMPoint(nX, nY), nLoc); + GLOBALS._tony->setPosition(RMPoint(nX, nY), nLoc); } DECLARE_CUSTOM_FUNCTION(MoveTonyAndWait)(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) { @@ -1193,16 +1193,16 @@ DECLARE_CUSTOM_FUNCTION(MoveTonyAndWait)(CORO_PARAM, uint32 nX, uint32 nY, uint3 CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_1(GLOBALS.Tony->move, RMPoint(nX, nY)); + CORO_INVOKE_1(GLOBALS._tony->move, RMPoint(nX, nY)); - if (!GLOBALS.bSkipIdle) - CORO_INVOKE_0(GLOBALS.Tony->waitForEndMovement); + if (!GLOBALS._bSkipIdle) + CORO_INVOKE_0(GLOBALS._tony->waitForEndMovement); CORO_END_CODE; } DECLARE_CUSTOM_FUNCTION(MoveTony)(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) { - GLOBALS.Tony->move(coroParam, RMPoint(nX, nY)); + GLOBALS._tony->move(coroParam, RMPoint(nX, nY)); } DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) { @@ -1217,9 +1217,9 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 _ctx->lx = (int32)nX; _ctx->ly = (int32)nY; - _ctx->pt = GLOBALS.Loc->scrollPosition(); + _ctx->pt = GLOBALS._loc->scrollPosition(); - while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS.bSkipIdle) { + while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS._bSkipIdle) { if (_ctx->lx > 0) { _ctx->lx -= (int32)sX; if (_ctx->lx < 0) _ctx->lx = 0; @@ -1243,8 +1243,8 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 CORO_INVOKE_0(GLOBALS.WaitFrame); GLOBALS.Freeze(); - GLOBALS.Loc->setScrollPosition(_ctx->pt); - GLOBALS.Tony->setScrollPosition(_ctx->pt); + GLOBALS._loc->setScrollPosition(_ctx->pt); + GLOBALS._tony->setScrollPosition(_ctx->pt); GLOBALS.Unfreeze(); } @@ -1276,7 +1276,7 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui _ctx->stepX = sX; _ctx->stepY = sY; - _ctx->startpt = GLOBALS.Loc->scrollPosition(); + _ctx->startpt = GLOBALS._loc->scrollPosition(); _ctx->dwStartTime = _vm->getTime(); @@ -1285,7 +1285,7 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui else _ctx->dwTotalTime = _ctx->dimy * (1000 / 35) / sY; - while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS.bSkipIdle) { + while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS._bSkipIdle) { _ctx->dwCurTime = _vm->getTime() - _ctx->dwStartTime; if (_ctx->dwCurTime > _ctx->dwTotalTime) break; @@ -1308,8 +1308,8 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui CORO_INVOKE_0(GLOBALS.WaitFrame); GLOBALS.Freeze(); - GLOBALS.Loc->setScrollPosition(_ctx->pt); - GLOBALS.Tony->setScrollPosition(_ctx->pt); + GLOBALS._loc->setScrollPosition(_ctx->pt); + GLOBALS._tony->setScrollPosition(_ctx->pt); GLOBALS.Unfreeze(); } @@ -1329,8 +1329,8 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui } GLOBALS.Freeze(); - GLOBALS.Loc->setScrollPosition(_ctx->pt); - GLOBALS.Tony->setScrollPosition(_ctx->pt); + GLOBALS._loc->setScrollPosition(_ctx->pt); + GLOBALS._tony->setScrollPosition(_ctx->pt); GLOBALS.Unfreeze(); CORO_END_CODE; @@ -1354,7 +1354,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(CORO_PARAM, uint32 dwCode, uint32 nX, uin GLOBALS._curChangedHotspot++; } - GLOBALS.Loc->getItemFromCode(dwCode)->changeHotspot(RMPoint(nX, nY)); + GLOBALS._loc->getItemFromCode(dwCode)->changeHotspot(RMPoint(nX, nY)); } @@ -1384,8 +1384,8 @@ DECLARE_CUSTOM_FUNCTION(TremaSchermo)(CORO_PARAM, uint32 nScosse, uint32, uint32 CORO_INVOKE_0(GLOBALS.WaitFrame); GLOBALS.Freeze(); - GLOBALS.Loc->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry)); - GLOBALS.Tony->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry)); + GLOBALS._loc->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry)); + GLOBALS._tony->setFixedScroll(RMPoint(1 * _ctx->dirx, 1 * _ctx->diry)); GLOBALS.Unfreeze(); _ctx->i = _vm->_randomSource.getRandomNumber(2); @@ -1397,8 +1397,8 @@ DECLARE_CUSTOM_FUNCTION(TremaSchermo)(CORO_PARAM, uint32 nScosse, uint32, uint32 } GLOBALS.Freeze(); - GLOBALS.Loc->setFixedScroll(RMPoint(0, 0)); - GLOBALS.Tony->setFixedScroll(RMPoint(0, 0)); + GLOBALS._loc->setFixedScroll(RMPoint(0, 0)); + GLOBALS._tony->setFixedScroll(RMPoint(0, 0)); GLOBALS.Unfreeze(); CORO_END_CODE; @@ -1413,7 +1413,7 @@ DECLARE_CUSTOM_FUNCTION(TremaSchermo)(CORO_PARAM, uint32 nScosse, uint32, uint32 DECLARE_CUSTOM_FUNCTION(CharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) { assert(nChar < 16); GLOBALS._character[nChar]._code = nCode; - GLOBALS._character[nChar]._item = GLOBALS.Loc->getItemFromCode(nCode); + GLOBALS._character[nChar]._item = GLOBALS._loc->getItemFromCode(nCode); GLOBALS._character[nChar]._r = 255; GLOBALS._character[nChar]._g = 255; GLOBALS._character[nChar]._b = 255; @@ -1461,7 +1461,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess _ctx->curOffset = 0; assert(nChar < 16); - _ctx->pt = GLOBALS._character[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->scrollPosition(); + _ctx->pt = GLOBALS._character[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition(); if (GLOBALS._character[nChar]._startTalkPattern != 0) { GLOBALS.Freeze(); @@ -1483,15 +1483,15 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess _ctx->curOffset = _ctx->curVoc->_offset; } - for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) { + for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) { if (bIsBack) { - GLOBALS._curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS.Loc); + GLOBALS._curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS._loc); if (GLOBALS._bTonyIsSpeaking) CORO_INVOKE_0(GLOBALS._curBackText->hide); } else _ctx->text = new RMTextDialog; - _ctx->text->setInput(GLOBALS.Input); + _ctx->text->setInput(GLOBALS._input); // Skipping _ctx->text->setSkipStatus(!bIsBack); @@ -1529,7 +1529,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess } // Wait for the end of display - _ctx->text->setCustomSkipHandle(GLOBALS.hSkipIdle); + _ctx->text->setCustomSkipHandle(GLOBALS._hSkipIdle); CORO_INVOKE_0(_ctx->text->waitForEndDisplay); if (_ctx->curVoc) { @@ -1559,15 +1559,15 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess } DECLARE_CUSTOM_FUNCTION(AddInventory)(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) { - GLOBALS.Inventory->addItem(dwCode); + GLOBALS._inventory->addItem(dwCode); } DECLARE_CUSTOM_FUNCTION(RemoveInventory)(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) { - GLOBALS.Inventory->removeItem(dwCode); + GLOBALS._inventory->removeItem(dwCode); } DECLARE_CUSTOM_FUNCTION(ChangeInventoryStatus)(CORO_PARAM, uint32 dwCode, uint32 dwStatus, uint32, uint32) { - GLOBALS.Inventory->changeItemStatus(dwCode, dwStatus); + GLOBALS._inventory->changeItemStatus(dwCode, dwStatus); } @@ -1581,7 +1581,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, ui if (nCode == 0) GLOBALS._mCharacter[nChar]._item = NULL; else - GLOBALS._mCharacter[nChar]._item = GLOBALS.Loc->getItemFromCode(nCode); + GLOBALS._mCharacter[nChar]._item = GLOBALS._loc->getItemFromCode(nCode); GLOBALS._mCharacter[nChar]._r = 255; GLOBALS._mCharacter[nChar]._g = 255; GLOBALS._mCharacter[nChar]._b = 255; @@ -1598,7 +1598,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, ui } DECLARE_CUSTOM_FUNCTION(MCharResetCode)(CORO_PARAM, uint32 nChar, uint32, uint32, uint32) { - GLOBALS._mCharacter[nChar]._item = GLOBALS.Loc->getItemFromCode(GLOBALS._mCharacter[nChar]._code); + GLOBALS._mCharacter[nChar]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[nChar]._code); } @@ -1670,7 +1670,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes // Calculates the position of the text according to the current frame if (GLOBALS._mCharacter[nChar]._x == -1) - _ctx->pt = GLOBALS._mCharacter[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->scrollPosition(); + _ctx->pt = GLOBALS._mCharacter[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition(); else _ctx->pt = RMPoint(GLOBALS._mCharacter[nChar]._x, GLOBALS._mCharacter[nChar]._y); @@ -1695,16 +1695,16 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes _ctx->curOffset = _ctx->curVoc->_offset; } - for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) { + for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) { // Create a different object depending on whether it's background or not if (bIsBack) { - GLOBALS._curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS.Loc); + GLOBALS._curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS._loc); if (GLOBALS._bTonyIsSpeaking) CORO_INVOKE_0(GLOBALS._curBackText->hide); } else _ctx->text = new RMTextDialog; - _ctx->text->setInput(GLOBALS.Input); + _ctx->text->setInput(GLOBALS._input); // Skipping _ctx->text->setSkipStatus(!bIsBack); @@ -1742,7 +1742,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes } // Wait for the end of display - _ctx->text->setCustomSkipHandle(GLOBALS.hSkipIdle); + _ctx->text->setCustomSkipHandle(GLOBALS._hSkipIdle); CORO_INVOKE_0(_ctx->text->waitForEndDisplay); if (_ctx->curVoc) { @@ -1810,30 +1810,30 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg if (nPers == 0) { _ctx->text = new RMTextDialog; _ctx->text->setColor(0, 255, 0); - _ctx->text->setPosition(GLOBALS.Tony->position() - RMPoint(0, 130) - GLOBALS.Loc->scrollPosition()); + _ctx->text->setPosition(GLOBALS._tony->position() - RMPoint(0, 130) - GLOBALS._loc->scrollPosition()); _ctx->text->writeText(_ctx->string, 0); - if (GLOBALS.dwTonyNumTexts > 0) { - if (!GLOBALS.bTonyInTexts) { - if (GLOBALS.nTonyNextTalkType != GLOBALS.Tony->TALK_NORMAL) { - CORO_INVOKE_1(GLOBALS.Tony->startTalk, GLOBALS.nTonyNextTalkType); - if (!GLOBALS.bStaticTalk) - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + if (GLOBALS._dwTonyNumTexts > 0) { + if (!GLOBALS._bTonyInTexts) { + if (GLOBALS._nTonyNextTalkType != GLOBALS._tony->TALK_NORMAL) { + CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._nTonyNextTalkType); + if (!GLOBALS._bStaticTalk) + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; } else - CORO_INVOKE_1(GLOBALS.Tony->startTalk, GLOBALS.Tony->TALK_NORMAL); + CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._tony->TALK_NORMAL); - GLOBALS.bTonyInTexts = true; + GLOBALS._bTonyInTexts = true; } - GLOBALS.dwTonyNumTexts--; + GLOBALS._dwTonyNumTexts--; } else { - CORO_INVOKE_1(GLOBALS.Tony->startTalk, GLOBALS.nTonyNextTalkType); - if (!GLOBALS.bStaticTalk) - GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NORMAL; + CORO_INVOKE_1(GLOBALS._tony->startTalk, GLOBALS._nTonyNextTalkType); + if (!GLOBALS._bStaticTalk) + GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_NORMAL; } } else if (!GLOBALS._isMChar[nPers]) { _ctx->text = new RMTextDialog; - _ctx->pt = GLOBALS._character[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->scrollPosition(); + _ctx->pt = GLOBALS._character[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition(); if (GLOBALS._character[nPers]._startTalkPattern != 0) { GLOBALS.Freeze(); @@ -1849,7 +1849,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg _ctx->text->setPosition(_ctx->pt); } else { if (GLOBALS._mCharacter[nPers]._x == -1) - _ctx->pt = GLOBALS._mCharacter[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->scrollPosition(); + _ctx->pt = GLOBALS._mCharacter[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition(); else _ctx->pt = RMPoint(GLOBALS._mCharacter[nPers]._x, GLOBALS._mCharacter[nPers]._y); @@ -1874,7 +1874,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg } if (GLOBALS._mCharacter[nPers]._bAlwaysBack) { - _ctx->text = GLOBALS._curBackText = new RMTextDialogScrolling(GLOBALS.Loc); + _ctx->text = GLOBALS._curBackText = new RMTextDialogScrolling(GLOBALS._loc); if (GLOBALS._bTonyIsSpeaking) CORO_INVOKE_0(GLOBALS._curBackText->hide); @@ -1888,8 +1888,8 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg _ctx->text->setPosition(_ctx->pt); } - if (!GLOBALS.bSkipIdle) { - _ctx->text->setInput(GLOBALS.Input); + if (!GLOBALS._bSkipIdle) { + _ctx->text->setInput(GLOBALS._input); if (GLOBALS._bAlwaysDisplay) { _ctx->text->setAlwaysDisplay(); _ctx->text->forceTime(); @@ -1903,7 +1903,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg } // Wait for the end of display - _ctx->text->setCustomSkipHandle(GLOBALS.hSkipIdle); + _ctx->text->setCustomSkipHandle(GLOBALS._hSkipIdle); CORO_INVOKE_0(_ctx->text->waitForEndDisplay); } @@ -1940,10 +1940,10 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg delete _ctx->text; } } else { - if ((GLOBALS.dwTonyNumTexts == 0 && GLOBALS.bTonyInTexts) || !GLOBALS.bTonyInTexts) { - CORO_INVOKE_0(GLOBALS.Tony->endTalk); - GLOBALS.dwTonyNumTexts = 0; - GLOBALS.bTonyInTexts = false; + if ((GLOBALS._dwTonyNumTexts == 0 && GLOBALS._bTonyInTexts) || !GLOBALS._bTonyInTexts) { + CORO_INVOKE_0(GLOBALS._tony->endTalk); + GLOBALS._dwTonyNumTexts = 0; + GLOBALS._bTonyInTexts = false; } delete _ctx->text; @@ -2009,13 +2009,13 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr CORO_INVOKE_0(_ctx->dc.show); // Draw the pointer - GLOBALS.Pointer->setSpecialPointer(GLOBALS.Pointer->PTR_NONE); + GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_NONE); mainShowMouse(); - while (!(GLOBALS.Input->mouseLeftClicked() && ((_ctx->sel = _ctx->dc.getSelection()) != -1))) { + while (!(GLOBALS._input->mouseLeftClicked() && ((_ctx->sel = _ctx->dc.getSelection()) != -1))) { CORO_INVOKE_0(GLOBALS.WaitFrame); GLOBALS.Freeze(); - CORO_INVOKE_1(_ctx->dc.doFrame, GLOBALS.Input->mousePos()); + CORO_INVOKE_1(_ctx->dc.doFrame, GLOBALS._input->mousePos()); GLOBALS.Unfreeze(); } @@ -2051,17 +2051,17 @@ DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, u // The event is operating as a mutex, so if the event is already set, wait until it's reset do { - CORO_INVOKE_3(CoroScheduler.waitForSingleObject, GLOBALS.mut[num], 0, &_ctx->expired); + CORO_INVOKE_3(CoroScheduler.waitForSingleObject, GLOBALS._mut[num], 0, &_ctx->expired); } while (!_ctx->expired); // Set the event to flag ownership - CoroScheduler.setEvent(GLOBALS.mut[num]); + CoroScheduler.setEvent(GLOBALS._mut[num]); CORO_END_CODE; } DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) { - CoroScheduler.resetEvent(GLOBALS.mut[num]); + CoroScheduler.resetEvent(GLOBALS._mut[num]); } /* @@ -2199,7 +2199,7 @@ DECLARE_CUSTOM_FUNCTION(PlaySonoriz)(CORO_PARAM, uint32 nMusic, uint32 nFX, uint GLOBALS._bFadeOutStop = true; } - GLOBALS.lastMusic = nMusic; + GLOBALS._lastMusic = nMusic; CustPlayMusic(GLOBALS._curSonoriz, musicFiles[nMusic].name, nFX, bNoLoop ? false : true, musicFiles[nMusic].sync); } @@ -2209,9 +2209,9 @@ DECLARE_CUSTOM_FUNCTION(PlayStacchetto)(CORO_PARAM, uint32 nMusic, uint32 nFX, u DECLARE_CUSTOM_FUNCTION(PlayItemSfx)(CORO_PARAM, uint32 nItem, uint32 nSFX, uint32, uint32) { if (nItem == 0) { - GLOBALS.Tony->playSfx(nSFX); + GLOBALS._tony->playSfx(nSFX); } else { - RMItem *item = GLOBALS.Loc->getItemFromCode(nItem); + RMItem *item = GLOBALS._loc->getItemFromCode(nItem); if (item) item->playSfx(nSFX); } @@ -2224,22 +2224,22 @@ void RestoreMusic(CORO_PARAM) { CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_4(PlaySonoriz, GLOBALS.lastMusic, 0, 0, 0); + CORO_INVOKE_4(PlaySonoriz, GLOBALS._lastMusic, 0, 0, 0); - if (GLOBALS.lastTappeto != 0) - CustPlayMusic(4, tappetiFile[GLOBALS.lastTappeto], 0, true); + if (GLOBALS._lastTappeto != 0) + CustPlayMusic(4, tappetiFile[GLOBALS._lastTappeto], 0, true); CORO_END_CODE; } void SaveMusic(Common::OutSaveFile *f) { - f->writeByte(GLOBALS.lastMusic); - f->writeByte(GLOBALS.lastTappeto); + f->writeByte(GLOBALS._lastMusic); + f->writeByte(GLOBALS._lastTappeto); } void LoadMusic(Common::InSaveFile *f) { - GLOBALS.lastMusic = f->readByte(); - GLOBALS.lastTappeto = f->readByte(); + GLOBALS._lastMusic = f->readByte(); + GLOBALS._lastTappeto = f->readByte(); } @@ -2273,13 +2273,13 @@ DECLARE_CUSTOM_FUNCTION(StacchettoFadeEnd)(CORO_PARAM, uint32 nStacc, uint32 bLo DECLARE_CUSTOM_FUNCTION(MustSkipIdleStart)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.bSkipIdle = true; - CoroScheduler.setEvent(GLOBALS.hSkipIdle); + GLOBALS._bSkipIdle = true; + CoroScheduler.setEvent(GLOBALS._hSkipIdle); } DECLARE_CUSTOM_FUNCTION(MustSkipIdleEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) { - GLOBALS.bSkipIdle = false; - CoroScheduler.resetEvent(GLOBALS.hSkipIdle); + GLOBALS._bSkipIdle = false; + CoroScheduler.resetEvent(GLOBALS._hSkipIdle); } DECLARE_CUSTOM_FUNCTION(PatIrqFreeze)(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) { @@ -2336,7 +2336,7 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3 _ctx->text = new RMTextDialog[_ctx->msg->numPeriods()]; for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods(); _ctx->i++) { - _ctx->text[_ctx->i].setInput(GLOBALS.Input); + _ctx->text[_ctx->i].setInput(GLOBALS._input); // Alignment if ((*_ctx->msg)[_ctx->i][0] == '@') { @@ -2366,7 +2366,7 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3 while (_ctx->startTime + dwTime * 1000 > _vm->getTime()) { CORO_INVOKE_0(GLOBALS.WaitFrame); - if (GLOBALS.Input->mouseLeftClicked() || GLOBALS.Input->mouseRightClicked()) + if (GLOBALS._input->mouseLeftClicked() || GLOBALS._input->mouseRightClicked()) break; if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB)) break; @@ -2537,12 +2537,12 @@ ASSIGN(201, MustSkipIdleEnd); END_CUSTOM_FUNCTION_MAP() void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input) { - GLOBALS.Tony = tony; - GLOBALS.Pointer = ptr; - GLOBALS.Boxes = box; - GLOBALS.Loc = loc; - GLOBALS.Inventory = inv; - GLOBALS.Input = input; + GLOBALS._tony = tony; + GLOBALS._pointer = ptr; + GLOBALS._boxes = box; + GLOBALS._loc = loc; + GLOBALS._inventory = inv; + GLOBALS._input = input; GLOBALS.LoadLocation = mainLoadLocation; GLOBALS.UnloadLocation = mainUnloadLocation; @@ -2562,47 +2562,47 @@ void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation int i; for (i = 0; i < 10; i++) - GLOBALS.mut[i] = CoroScheduler.createEvent(false, false); + GLOBALS._mut[i] = CoroScheduler.createEvent(false, false); for (i = 0; i < 200; i++) - GLOBALS.tappeti[i] = 0; - - GLOBALS.tappeti[6] = T_GRILLI; - GLOBALS.tappeti[7] = T_GRILLI; - GLOBALS.tappeti[8] = T_GRILLIOV; - GLOBALS.tappeti[10] = T_GRILLI; - GLOBALS.tappeti[12] = T_GRILLI; - GLOBALS.tappeti[13] = T_GRILLIOV; - GLOBALS.tappeti[15] = T_GRILLI; - GLOBALS.tappeti[16] = T_GRILLIVENTO; - GLOBALS.tappeti[18] = T_GRILLI; - GLOBALS.tappeti[19] = T_GRILLIVENTO; - GLOBALS.tappeti[20] = T_GRILLI; - GLOBALS.tappeti[23] = T_GRILLI; - GLOBALS.tappeti[26] = T_MAREMETA; - GLOBALS.tappeti[27] = T_GRILLI; - GLOBALS.tappeti[28] = T_GRILLIVENTO; - GLOBALS.tappeti[31] = T_GRILLI; - GLOBALS.tappeti[33] = T_MARE; - GLOBALS.tappeti[35] = T_MARE; - GLOBALS.tappeti[36] = T_GRILLI; - GLOBALS.tappeti[37] = T_GRILLI; - GLOBALS.tappeti[40] = T_GRILLI; - GLOBALS.tappeti[41] = T_GRILLI; - GLOBALS.tappeti[42] = T_GRILLI; - GLOBALS.tappeti[45] = T_GRILLI; - GLOBALS.tappeti[51] = T_GRILLI; - GLOBALS.tappeti[52] = T_GRILLIVENTO1; - GLOBALS.tappeti[53] = T_GRILLI; - GLOBALS.tappeti[54] = T_GRILLI; - GLOBALS.tappeti[57] = T_VENTO; - GLOBALS.tappeti[58] = T_VENTO; - GLOBALS.tappeti[60] = T_VENTO; + GLOBALS._tappeti[i] = 0; + + GLOBALS._tappeti[6] = T_GRILLI; + GLOBALS._tappeti[7] = T_GRILLI; + GLOBALS._tappeti[8] = T_GRILLIOV; + GLOBALS._tappeti[10] = T_GRILLI; + GLOBALS._tappeti[12] = T_GRILLI; + GLOBALS._tappeti[13] = T_GRILLIOV; + GLOBALS._tappeti[15] = T_GRILLI; + GLOBALS._tappeti[16] = T_GRILLIVENTO; + GLOBALS._tappeti[18] = T_GRILLI; + GLOBALS._tappeti[19] = T_GRILLIVENTO; + GLOBALS._tappeti[20] = T_GRILLI; + GLOBALS._tappeti[23] = T_GRILLI; + GLOBALS._tappeti[26] = T_MAREMETA; + GLOBALS._tappeti[27] = T_GRILLI; + GLOBALS._tappeti[28] = T_GRILLIVENTO; + GLOBALS._tappeti[31] = T_GRILLI; + GLOBALS._tappeti[33] = T_MARE; + GLOBALS._tappeti[35] = T_MARE; + GLOBALS._tappeti[36] = T_GRILLI; + GLOBALS._tappeti[37] = T_GRILLI; + GLOBALS._tappeti[40] = T_GRILLI; + GLOBALS._tappeti[41] = T_GRILLI; + GLOBALS._tappeti[42] = T_GRILLI; + GLOBALS._tappeti[45] = T_GRILLI; + GLOBALS._tappeti[51] = T_GRILLI; + GLOBALS._tappeti[52] = T_GRILLIVENTO1; + GLOBALS._tappeti[53] = T_GRILLI; + GLOBALS._tappeti[54] = T_GRILLI; + GLOBALS._tappeti[57] = T_VENTO; + GLOBALS._tappeti[58] = T_VENTO; + GLOBALS._tappeti[60] = T_VENTO; // Create an event for the idle skipping - GLOBALS.hSkipIdle = CoroScheduler.createEvent(true, false); + GLOBALS._hSkipIdle = CoroScheduler.createEvent(true, false); } } // end of namespace Tony diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 4bfdc1333f..e8f32edac7 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -359,10 +359,10 @@ void RMGfxEngine::initCustomDll(void) { void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { RMItem *item; - assert(GLOBALS.GfxEngine); + assert(GLOBALS._gfxEngine); - if (GLOBALS.GfxEngine->_bLocationLoaded) { - item = GLOBALS.GfxEngine->_loc.getItemFromCode(dwItem); + if (GLOBALS._gfxEngine->_bLocationLoaded) { + item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { if (GLOBALS._bPatIrqFreeze) @@ -497,7 +497,7 @@ void RMGfxEngine::init() { _csMainLoop = g_system->createMutex(); // Initialise the IRQ function for items for MPAL - GLOBALS.GfxEngine = this; + GLOBALS._gfxEngine = this; mpalInstallItemIrq(itemIrq); // Initialise the input diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp index 6f81e81a48..e676f33174 100644 --- a/engines/tony/globals.cpp +++ b/engines/tony/globals.cpp @@ -35,13 +35,13 @@ Globals::Globals() { _curBackText = NULL; _bTonyIsSpeaking = false; _curChangedHotspot = 0; - Tony = NULL; - Pointer = NULL; - Boxes = NULL; - Loc = NULL; - Inventory = NULL; - Input = NULL; - GfxEngine = NULL; + _tony = NULL; + _pointer = NULL; + _boxes = NULL; + _loc = NULL; + _inventory = NULL; + _input = NULL; + _gfxEngine = NULL; LoadLocation = NULL; UnloadLocation = NULL; LinkGraphicTask = NULL; @@ -56,9 +56,9 @@ Globals::Globals() { DisableGUI = NULL; SetPalesati = NULL; - dwTonyNumTexts = 0; - bTonyInTexts = false; - bStaticTalk = false; + _dwTonyNumTexts = 0; + _bTonyInTexts = false; + _bStaticTalk = false; _bPatIrqFreeze = false; _bCfgInvLocked = false; _bCfgInvNoScroll = false; @@ -86,52 +86,52 @@ Globals::Globals() { _bFadeOutStop = false; // OSystem::MutexRef vdb; - Common::fill(&mut[0], &mut[10], 0); - bSkipIdle = false; - hSkipIdle = 0; - lastMusic = 0; - lastTappeto = 0; - Common::fill(&tappeti[0], &tappeti[200], 0); + Common::fill(&_mut[0], &_mut[10], 0); + _bSkipIdle = false; + _hSkipIdle = 0; + _lastMusic = 0; + _lastTappeto = 0; + Common::fill(&_tappeti[0], &_tappeti[200], 0); SFM_nLoc = 0; // MPAL global variables - mpalError = 0; - lpiifCustom = NULL; - lplpFunctions = NULL; - lplpFunctionStrings = NULL; - nObjs = 0; - nVars = 0; - hVars = NULL; - lpmvVars = NULL; - nMsgs = 0; - hMsgs = NULL; - lpmmMsgs = NULL; - nDialogs = 0; - hDialogs = NULL; - lpmdDialogs = NULL; - nItems = 0; - hItems = NULL; - lpmiItems = NULL; - nLocations = 0; - hLocations = NULL; - lpmlLocations = NULL; - nScripts = 0; - hScripts = NULL; - lpmsScripts = NULL; - nResources = 0; - lpResources = NULL; - bExecutingAction = false; - bExecutingDialog = false; - Common::fill(&nPollingLocations[0], &nPollingLocations[MAXPOLLINGLOCATIONS], 0); - Common::fill(&hEndPollingLocations[0], &hEndPollingLocations[MAXPOLLINGLOCATIONS], 0); - Common::fill(&PollingThreads[0], &PollingThreads[MAXPOLLINGLOCATIONS], 0); - hAskChoice = 0; - hDoneChoice = 0; - nExecutingAction = 0; - nExecutingDialog = 0; - nExecutingChoice = 0; - nSelectedChoice = 0; - nTonyNextTalkType = RMTony::TALK_NORMAL; + _mpalError = 0; + _lpiifCustom = NULL; + _lplpFunctions = NULL; + _lplpFunctionStrings = NULL; + _nObjs = 0; + _nVars = 0; + _hVars = NULL; + _lpmvVars = NULL; + _nMsgs = 0; + _hMsgs = NULL; + _lpmmMsgs = NULL; + _nDialogs = 0; + _hDialogs = NULL; + _lpmdDialogs = NULL; + _nItems = 0; + _hItems = NULL; + _lpmiItems = NULL; + _nLocations = 0; + _hLocations = NULL; + _lpmlLocations = NULL; + _nScripts = 0; + _hScripts = NULL; + _lpmsScripts = NULL; + _nResources = 0; + _lpResources = NULL; + _bExecutingAction = false; + _bExecutingDialog = false; + Common::fill(&_nPollingLocations[0], &_nPollingLocations[MAXPOLLINGLOCATIONS], 0); + Common::fill(&_hEndPollingLocations[0], &_hEndPollingLocations[MAXPOLLINGLOCATIONS], 0); + Common::fill(&_pollingThreads[0], &_pollingThreads[MAXPOLLINGLOCATIONS], 0); + _hAskChoice = 0; + _hDoneChoice = 0; + _nExecutingAction = 0; + _nExecutingDialog = 0; + _nExecutingChoice = 0; + _nSelectedChoice = 0; + _nTonyNextTalkType = RMTony::TALK_NORMAL; _saveTonyLoc = 0; for (int i = 0; i < 16; ++i) diff --git a/engines/tony/globals.h b/engines/tony/globals.h index a675066bc1..e924678df0 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -151,9 +151,9 @@ struct ChangedHotspotStruct { * Description of a call to a custom function. */ typedef struct { - int nCf; + int _nCf; - int arg1, arg2, arg3, arg4; + int _arg1, _arg2, _arg3, _arg4; } CFCALL; typedef CFCALL *LPCFCALL; typedef LPCFCALL *LPLPCFCALL; @@ -212,13 +212,13 @@ public: int _curSonoriz; bool _bFadeOutStop; - RMTony *Tony; - RMPointer *Pointer; - RMGameBoxes *Boxes; - RMLocation *Loc; - RMInventory *Inventory; - RMInput *Input; - RMGfxEngine *GfxEngine; + RMTony *_tony; + RMPointer *_pointer; + RMGameBoxes *_boxes; + RMLocation *_loc; + RMInventory *_inventory; + RMInput *_input; + RMGfxEngine *_gfxEngine; uint32(*LoadLocation)(int, RMPoint, RMPoint start); void (*UnloadLocation)(CORO_PARAM, bool bDoOnExit, uint32 *result); @@ -234,21 +234,21 @@ public: void (*DisableGUI)(void); void (*SetPalesati)(bool bpal); - uint32 dwTonyNumTexts; - bool bTonyInTexts; - bool bStaticTalk; - RMTony::TALKTYPE nTonyNextTalkType; + uint32 _dwTonyNumTexts; + bool _bTonyInTexts; + bool _bStaticTalk; + RMTony::TALKTYPE _nTonyNextTalkType; - RMPoint StartLocPos[256]; - OSystem::MutexRef cs[10]; - uint32 mut[10]; + RMPoint _startLocPos[256]; + OSystem::MutexRef _cs[10]; + uint32 _mut[10]; - bool bSkipIdle; - uint32 hSkipIdle; + bool _bSkipIdle; + uint32 _hSkipIdle; - int lastMusic, lastTappeto; + int _lastMusic, _lastTappeto; - int tappeti[200]; + int _tappeti[200]; RMPoint SFM_pt; int SFM_nLoc; @@ -256,43 +256,43 @@ public: * @defgroup MPAL variables * */ - uint32 mpalError; - LPITEMIRQFUNCTION lpiifCustom; - LPLPCUSTOMFUNCTION lplpFunctions; - Common::String *lplpFunctionStrings; - uint16 nObjs; - uint16 nVars; - HGLOBAL hVars; - LPMPALVAR lpmvVars; - uint16 nMsgs; - HGLOBAL hMsgs; - LPMPALMSG lpmmMsgs; - uint16 nDialogs; - HGLOBAL hDialogs; - LPMPALDIALOG lpmdDialogs; - uint16 nItems; - HGLOBAL hItems; - LPMPALITEM lpmiItems; - uint16 nLocations; - HGLOBAL hLocations; - LPMPALLOCATION lpmlLocations; - uint16 nScripts; - HGLOBAL hScripts; - LPMPALSCRIPT lpmsScripts; - Common::File hMpr; - uint16 nResources; - uint32 *lpResources; - bool bExecutingAction; - bool bExecutingDialog; - uint32 nPollingLocations[MAXPOLLINGLOCATIONS]; - uint32 hEndPollingLocations[MAXPOLLINGLOCATIONS]; - uint32 PollingThreads[MAXPOLLINGLOCATIONS]; - uint32 hAskChoice; - uint32 hDoneChoice; - uint32 nExecutingAction; - uint32 nExecutingDialog; - uint32 nExecutingChoice; - uint32 nSelectedChoice; + uint32 _mpalError; + LPITEMIRQFUNCTION _lpiifCustom; + LPLPCUSTOMFUNCTION _lplpFunctions; + Common::String *_lplpFunctionStrings; + uint16 _nObjs; + uint16 _nVars; + HGLOBAL _hVars; + LPMPALVAR _lpmvVars; + uint16 _nMsgs; + HGLOBAL _hMsgs; + LPMPALMSG _lpmmMsgs; + uint16 _nDialogs; + HGLOBAL _hDialogs; + LPMPALDIALOG _lpmdDialogs; + uint16 _nItems; + HGLOBAL _hItems; + LPMPALITEM _lpmiItems; + uint16 _nLocations; + HGLOBAL _hLocations; + LPMPALLOCATION _lpmlLocations; + uint16 _nScripts; + HGLOBAL _hScripts; + LPMPALSCRIPT _lpmsScripts; + Common::File _hMpr; + uint16 _nResources; + uint32 *_lpResources; + bool _bExecutingAction; + bool _bExecutingDialog; + uint32 _nPollingLocations[MAXPOLLINGLOCATIONS]; + uint32 _hEndPollingLocations[MAXPOLLINGLOCATIONS]; + uint32 _pollingThreads[MAXPOLLINGLOCATIONS]; + uint32 _hAskChoice; + uint32 _hDoneChoice; + uint32 _nExecutingAction; + uint32 _nExecutingDialog; + uint32 _nExecutingChoice; + uint32 _nSelectedChoice; }; } // End of namespace Tony diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp index a9d48e2016..516da98bb1 100644 --- a/engines/tony/mpal/expr.cpp +++ b/engines/tony/mpal/expr.cpp @@ -171,7 +171,7 @@ static int Compute(int a, int b, byte symbol) { case OP_OR: return a || b; default: - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; break; } diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 1f610a8d2c..6ed4545d67 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -84,15 +84,15 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) { lpBuf++; switch (lpmsScript->_command[curCmd].type) { case 1: - lpmsScript->_command[curCmd].nCf = READ_LE_UINT16(lpBuf); + lpmsScript->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf); lpBuf += 2; - lpmsScript->_command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf); + lpmsScript->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmsScript->_command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf); + lpmsScript->_command[curCmd]._arg2 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmsScript->_command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf); + lpmsScript->_command[curCmd]._arg3 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmsScript->_command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf); + lpmsScript->_command[curCmd]._arg4 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; break; @@ -197,15 +197,15 @@ static const byte *parseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) { switch (lpmdDialog->_command[curCmd].type) { // Call custom function case 1: - lpmdDialog->_command[curCmd].nCf = READ_LE_UINT16(lpBuf); + lpmdDialog->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf); lpBuf += 2; - lpmdDialog->_command[curCmd].arg1 = READ_LE_UINT32(lpBuf); + lpmdDialog->_command[curCmd]._arg1 = READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmdDialog->_command[curCmd].arg2 = READ_LE_UINT32(lpBuf); + lpmdDialog->_command[curCmd]._arg2 = READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmdDialog->_command[curCmd].arg3 = READ_LE_UINT32(lpBuf); + lpmdDialog->_command[curCmd]._arg3 = READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmdDialog->_command[curCmd].arg4 = READ_LE_UINT32(lpBuf); + lpmdDialog->_command[curCmd]._arg4 = READ_LE_UINT32(lpBuf); lpBuf += 4; break; @@ -398,15 +398,15 @@ static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { lpBuf++; switch (lpmiItem->_command[curCmd].type) { case 1: // Call custom function - lpmiItem->_command[curCmd].nCf = READ_LE_UINT16(lpBuf); + lpmiItem->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf); lpBuf += 2; - lpmiItem->_command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf); + lpmiItem->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmiItem->_command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf); + lpmiItem->_command[curCmd]._arg2 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmiItem->_command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf); + lpmiItem->_command[curCmd]._arg3 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; - lpmiItem->_command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf); + lpmiItem->_command[curCmd]._arg4 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; break; @@ -535,58 +535,58 @@ bool ParseMpc(const byte *lpBuf) { return false; lpBuf += 4; - GLOBALS.nVars = READ_LE_UINT16(lpBuf); + GLOBALS._nVars = READ_LE_UINT16(lpBuf); lpBuf += 2; - GLOBALS.hVars = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS.nVars); - if (GLOBALS.hVars == NULL) + GLOBALS._hVars = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS._nVars); + if (GLOBALS._hVars == NULL) return false; - GLOBALS.lpmvVars = (LPMPALVAR)globalLock(GLOBALS.hVars); + GLOBALS._lpmvVars = (LPMPALVAR)globalLock(GLOBALS._hVars); - for (i = 0; i < GLOBALS.nVars; i++) { + for (i = 0; i < GLOBALS._nVars; i++) { wLen = *(const byte *)lpBuf; lpBuf++; - copyMemory(GLOBALS.lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32)); + copyMemory(GLOBALS._lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32)); lpBuf += wLen; - GLOBALS.lpmvVars->dwVal = READ_LE_UINT32(lpBuf); + GLOBALS._lpmvVars->dwVal = READ_LE_UINT32(lpBuf); lpBuf += 4; lpBuf++; // Salta 'ext' - GLOBALS.lpmvVars++; + GLOBALS._lpmvVars++; } - globalUnlock(GLOBALS.hVars); + globalUnlock(GLOBALS._hVars); /* 2. Messages */ if (lpBuf[0] != 'M' || lpBuf[1] != 'S' || lpBuf[2] != 'G' || lpBuf[3] != 'S') return false; lpBuf += 4; - GLOBALS.nMsgs = READ_LE_UINT16(lpBuf); + GLOBALS._nMsgs = READ_LE_UINT16(lpBuf); lpBuf += 2; #ifdef NEED_LOCK_MSGS - GLOBALS.hMsgs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS.nMsgs); - if (GLOBALS.hMsgs == NULL) + GLOBALS._hMsgs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS._nMsgs); + if (GLOBALS._hMsgs == NULL) return false; - GLOBALS.lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs); + GLOBALS._lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS._hMsgs); #else - GLOBALS.lpmmMsgs=(LPMPALMSG)GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT,sizeof(MPALMSG)*(uint32)GLOBALS.nMsgs); - if (GLOBALS.lpmmMsgs==NULL) + GLOBALS._lpmmMsgs=(LPMPALMSG)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS._nMsgs); + if (GLOBALS._lpmmMsgs==NULL) return false; #endif - for (i = 0; i < GLOBALS.nMsgs; i++) { - GLOBALS.lpmmMsgs->wNum = READ_LE_UINT16(lpBuf); + for (i = 0; i < GLOBALS._nMsgs; i++) { + GLOBALS._lpmmMsgs->_wNum = READ_LE_UINT16(lpBuf); lpBuf += 2; for (j = 0; lpBuf[j] != 0;) j += lpBuf[j] + 1; - GLOBALS.lpmmMsgs->hText = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1); - lpTemp2 = lpTemp = (byte *)globalLock(GLOBALS.lpmmMsgs->hText); + GLOBALS._lpmmMsgs->_hText = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1); + lpTemp2 = lpTemp = (byte *)globalLock(GLOBALS._lpmmMsgs->_hText); for (j = 0; lpBuf[j] != 0;) { copyMemory(lpTemp, &lpBuf[j + 1], lpBuf[j]); @@ -598,12 +598,12 @@ bool ParseMpc(const byte *lpBuf) { lpBuf += j + 1; *lpTemp = '\0'; - globalUnlock(GLOBALS.lpmmMsgs->hText); - GLOBALS.lpmmMsgs++; + globalUnlock(GLOBALS._lpmmMsgs->_hText); + GLOBALS._lpmmMsgs++; } #ifdef NEED_LOCK_MSGS - globalUnlock(GLOBALS.hMsgs); + globalUnlock(GLOBALS._hMsgs); #endif /* 3. Objects */ @@ -611,86 +611,89 @@ bool ParseMpc(const byte *lpBuf) { return false; lpBuf += 4; - GLOBALS.nObjs = READ_LE_UINT16(lpBuf); + GLOBALS._nObjs = READ_LE_UINT16(lpBuf); lpBuf += 2; // Check out the dialogs - GLOBALS.nDialogs = 0; - GLOBALS.hDialogs = GLOBALS.lpmdDialogs = NULL; + GLOBALS._nDialogs = 0; + GLOBALS._hDialogs = GLOBALS._lpmdDialogs = NULL; if (*((const byte *)lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Dialog", 6) == 0) { - GLOBALS.nDialogs = READ_LE_UINT16(lpBuf); lpBuf += 2; + GLOBALS._nDialogs = READ_LE_UINT16(lpBuf); + lpBuf += 2; - GLOBALS.hDialogs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nDialogs * sizeof(MPALDIALOG)); - if (GLOBALS.hDialogs == NULL) + GLOBALS._hDialogs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nDialogs * sizeof(MPALDIALOG)); + if (GLOBALS._hDialogs == NULL) return false; - GLOBALS.lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs); + GLOBALS._lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS._hDialogs); - for (i = 0;i < GLOBALS.nDialogs; i++) - if ((lpBuf = parseDialog(lpBuf + 7, &GLOBALS.lpmdDialogs[i])) == NULL) + for (i = 0;i < GLOBALS._nDialogs; i++) + if ((lpBuf = parseDialog(lpBuf + 7, &GLOBALS._lpmdDialogs[i])) == NULL) return false; - globalUnlock(GLOBALS.hDialogs); + globalUnlock(GLOBALS._hDialogs); } // Check the items - GLOBALS.nItems = 0; - GLOBALS.hItems = GLOBALS.lpmiItems = NULL; - if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4)==0) { - GLOBALS.nItems = READ_LE_UINT16(lpBuf); + GLOBALS._nItems = 0; + GLOBALS._hItems = GLOBALS._lpmiItems = NULL; + if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4) == 0) { + GLOBALS._nItems = READ_LE_UINT16(lpBuf); lpBuf += 2; // Allocate memory and read them in - GLOBALS.hItems = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nItems * sizeof(MPALITEM)); - if (GLOBALS.hItems == NULL) + GLOBALS._hItems = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nItems * sizeof(MPALITEM)); + if (GLOBALS._hItems == NULL) return false; - GLOBALS.lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems); + GLOBALS._lpmiItems = (LPMPALITEM)globalLock(GLOBALS._hItems); - for (i = 0; i < GLOBALS.nItems; i++) - if ((lpBuf = parseItem(lpBuf + 5, &GLOBALS.lpmiItems[i])) == NULL) + for (i = 0; i < GLOBALS._nItems; i++) { + if ((lpBuf = parseItem(lpBuf + 5, &GLOBALS._lpmiItems[i])) == NULL) return false; + } - globalUnlock(GLOBALS.hItems); + globalUnlock(GLOBALS._hItems); } // Check the locations - GLOBALS.nLocations = 0; - GLOBALS.hLocations = GLOBALS.lpmlLocations = NULL; + GLOBALS._nLocations = 0; + GLOBALS._hLocations = GLOBALS._lpmlLocations = NULL; if (*(lpBuf + 2) == 8 && strncmp((const char *)lpBuf + 3, "Location", 8) == 0) { - GLOBALS.nLocations = READ_LE_UINT16(lpBuf); + GLOBALS._nLocations = READ_LE_UINT16(lpBuf); lpBuf += 2; // Allocate memory and read them in - GLOBALS.hLocations = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nLocations*sizeof(MPALLOCATION)); - if (GLOBALS.hLocations == NULL) + GLOBALS._hLocations = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nLocations * sizeof(MPALLOCATION)); + if (GLOBALS._hLocations == NULL) return false; - GLOBALS.lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS.hLocations); + GLOBALS._lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS._hLocations); - for (i = 0; i < GLOBALS.nLocations; i++) - if ((lpBuf = ParseLocation(lpBuf + 9, &GLOBALS.lpmlLocations[i])) == NULL) + for (i = 0; i < GLOBALS._nLocations; i++) { + if ((lpBuf = ParseLocation(lpBuf + 9, &GLOBALS._lpmlLocations[i])) == NULL) return false; + } - globalUnlock(GLOBALS.hLocations); + globalUnlock(GLOBALS._hLocations); } // Check the scripts - GLOBALS.nScripts = 0; - GLOBALS.hScripts = GLOBALS.lpmsScripts = NULL; + GLOBALS._nScripts = 0; + GLOBALS._hScripts = GLOBALS._lpmsScripts = NULL; if (*(lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Script", 6) == 0) { - GLOBALS.nScripts = READ_LE_UINT16(lpBuf); + GLOBALS._nScripts = READ_LE_UINT16(lpBuf); lpBuf += 2; // Allocate memory - GLOBALS.hScripts = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nScripts * sizeof(MPALSCRIPT)); - if (GLOBALS.hScripts == NULL) + GLOBALS._hScripts = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nScripts * sizeof(MPALSCRIPT)); + if (GLOBALS._hScripts == NULL) return false; - GLOBALS.lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts); + GLOBALS._lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS._hScripts); - for (i = 0; i < GLOBALS.nScripts; i++) { - if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS.lpmsScripts[i])) == NULL) + for (i = 0; i < GLOBALS._nScripts; i++) { + if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS._lpmsScripts[i])) == NULL) return false; // Sort the various moments of the script @@ -702,7 +705,7 @@ bool ParseMpc(const byte *lpBuf) { //); } - globalUnlock(GLOBALS.hScripts); + globalUnlock(GLOBALS._hScripts); } if (lpBuf[0] != 'E' || lpBuf[1] != 'N' || lpBuf[2] != 'D' || lpBuf[3] != '0') @@ -745,51 +748,51 @@ void FreeMpc() { int i; // Free variables - globalFree(GLOBALS.hVars); + globalFree(GLOBALS._hVars); // Free messages - LPMPALMSG lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs); - for (i = 0; i < GLOBALS.nMsgs; i++, ++lpmmMsgs) - globalFree(lpmmMsgs->hText); + LPMPALMSG lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS._hMsgs); + for (i = 0; i < GLOBALS._nMsgs; i++, ++lpmmMsgs) + globalFree(lpmmMsgs->_hText); - globalUnlock(GLOBALS.hMsgs); - globalFree(GLOBALS.hMsgs); + globalUnlock(GLOBALS._hMsgs); + globalFree(GLOBALS._hMsgs); // Free objects - if (GLOBALS.hDialogs) { - LPMPALDIALOG lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs); + if (GLOBALS._hDialogs) { + LPMPALDIALOG lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS._hDialogs); - for (i = 0; i < GLOBALS.nDialogs; i++, ++lpmdDialogs) + for (i = 0; i < GLOBALS._nDialogs; i++, ++lpmdDialogs) freeDialog(lpmdDialogs); - globalFree(GLOBALS.hDialogs); + globalFree(GLOBALS._hDialogs); } // Free items - if (GLOBALS.hItems) { - LPMPALITEM lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems); + if (GLOBALS._hItems) { + LPMPALITEM lpmiItems = (LPMPALITEM)globalLock(GLOBALS._hItems); - for (i = 0; i < GLOBALS.nItems; ++i, ++lpmiItems) + for (i = 0; i < GLOBALS._nItems; ++i, ++lpmiItems) freeItem(lpmiItems); - globalUnlock(GLOBALS.hItems); - globalFree(GLOBALS.hItems); + globalUnlock(GLOBALS._hItems); + globalFree(GLOBALS._hItems); } // Free the locations - if (GLOBALS.hLocations) { - globalFree(GLOBALS.hLocations); + if (GLOBALS._hLocations) { + globalFree(GLOBALS._hLocations); } // Free the scripts - if (GLOBALS.hScripts) { - LPMPALSCRIPT lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts); + if (GLOBALS._hScripts) { + LPMPALSCRIPT lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS._hScripts); - for (i = 0; i < GLOBALS.nScripts; ++i, ++lpmsScripts) { + for (i = 0; i < GLOBALS._nScripts; ++i, ++lpmsScripts) { FreeScript(lpmsScripts); } - globalUnlock(GLOBALS.hScripts); + globalUnlock(GLOBALS._hScripts); } } diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 5a4310c15b..162ba4c776 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -60,24 +60,22 @@ const char *mpalCopyright = * Locks the variables for access */ void lockVar(void) { - GLOBALS.lpmvVars = (LPMPALVAR)globalLock(GLOBALS.hVars); + GLOBALS._lpmvVars = (LPMPALVAR)globalLock(GLOBALS._hVars); } - /** * Unlocks variables after use */ void unlockVar(void) { - globalUnlock(GLOBALS.hVars); + globalUnlock(GLOBALS._hVars); } - /** * Locks the messages for access */ static void LockMsg(void) { #ifdef NEED_LOCK_MSGS - GLOBALS.lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs); + GLOBALS._lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS._hMsgs); #endif } @@ -87,7 +85,7 @@ static void LockMsg(void) { */ static void UnlockMsg(void) { #ifdef NEED_LOCK_MSGS - globalUnlock(GLOBALS.hMsgs); + globalUnlock(GLOBALS._hMsgs); #endif } @@ -96,7 +94,7 @@ static void UnlockMsg(void) { * Locks the dialogs for access */ static void lockDialogs(void) { - GLOBALS.lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs); + GLOBALS._lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS._hDialogs); } @@ -104,7 +102,7 @@ static void lockDialogs(void) { * Unlocks the dialogs after use */ static void unlockDialogs(void) { - globalUnlock(GLOBALS.hDialogs); + globalUnlock(GLOBALS._hDialogs); } @@ -112,7 +110,7 @@ static void unlockDialogs(void) { * Locks the location data structures for access */ static void lockLocations(void) { - GLOBALS.lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS.hLocations); + GLOBALS._lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS._hLocations); } @@ -120,7 +118,7 @@ static void lockLocations(void) { * Unlocks the location structures after use */ static void unlockLocations(void) { - globalUnlock(GLOBALS.hLocations); + globalUnlock(GLOBALS._hLocations); } @@ -128,7 +126,7 @@ static void unlockLocations(void) { * Locks the items structures for use */ static void lockItems(void) { - GLOBALS.lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems); + GLOBALS._lpmiItems = (LPMPALITEM)globalLock(GLOBALS._hItems); } @@ -136,7 +134,7 @@ static void lockItems(void) { * Unlocks the items structures after use */ static void unlockItems(void) { - globalUnlock(GLOBALS.hItems); + globalUnlock(GLOBALS._hItems); } @@ -144,7 +142,7 @@ static void unlockItems(void) { * Locks the script data structures for use */ static void LockScripts(void) { - GLOBALS.lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts); + GLOBALS._lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS._hScripts); } @@ -152,7 +150,7 @@ static void LockScripts(void) { * Unlocks the script data structures after use */ static void unlockScripts(void) { - globalUnlock(GLOBALS.hScripts); + globalUnlock(GLOBALS._hScripts); } @@ -167,13 +165,13 @@ static void unlockScripts(void) { */ int32 varGetValue(const char *lpszVarName) { int i; - LPMPALVAR v=GLOBALS.lpmvVars; + LPMPALVAR v = GLOBALS._lpmvVars; - for (i = 0; i < GLOBALS.nVars; v++, i++) + for (i = 0; i < GLOBALS._nVars; v++, i++) if (strcmp(lpszVarName, v->lpszVarName) == 0) return v->dwVal; - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; return 0; } @@ -185,24 +183,24 @@ int32 varGetValue(const char *lpszVarName) { */ void varSetValue(const char *lpszVarName, int32 val) { uint i; - LPMPALVAR v = GLOBALS.lpmvVars; + LPMPALVAR v = GLOBALS._lpmvVars; - for (i = 0; i < GLOBALS.nVars; v++, i++) + for (i = 0; i < GLOBALS._nVars; v++, i++) if (strcmp(lpszVarName, v->lpszVarName) == 0) { v->dwVal = val; - if (GLOBALS.lpiifCustom != NULL && strncmp(v->lpszVarName, "Pattern.", 8) == 0) { + if (GLOBALS._lpiifCustom != NULL && strncmp(v->lpszVarName, "Pattern.", 8) == 0) { i = 0; sscanf(v->lpszVarName, "Pattern.%u", &i); - GLOBALS.lpiifCustom(i, val, -1); - } else if (GLOBALS.lpiifCustom != NULL && strncmp(v->lpszVarName, "Status.", 7) == 0) { + GLOBALS._lpiifCustom(i, val, -1); + } else if (GLOBALS._lpiifCustom != NULL && strncmp(v->lpszVarName, "Status.", 7) == 0) { i = 0; sscanf(v->lpszVarName,"Status.%u", &i); - GLOBALS.lpiifCustom(i, -1, val); + GLOBALS._lpiifCustom(i, -1, val); } return; } - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; return; } @@ -217,9 +215,9 @@ void varSetValue(const char *lpszVarName, int32 val) { */ static int locGetOrderFromNum(uint32 nLoc) { int i; - LPMPALLOCATION loc = GLOBALS.lpmlLocations; + LPMPALLOCATION loc = GLOBALS._lpmlLocations; - for (i = 0; i < GLOBALS.nLocations; i++, loc++) + for (i = 0; i < GLOBALS._nLocations; i++, loc++) if (loc->nObj == nLoc) return i; @@ -236,10 +234,10 @@ static int locGetOrderFromNum(uint32 nLoc) { */ static int msgGetOrderFromNum(uint32 nMsg) { int i; - LPMPALMSG msg = GLOBALS.lpmmMsgs; + LPMPALMSG msg = GLOBALS._lpmmMsgs; - for (i = 0; i < GLOBALS.nMsgs; i++, msg++) - if (msg->wNum == nMsg) + for (i = 0; i < GLOBALS._nMsgs; i++, msg++) + if (msg->_wNum == nMsg) return i; return -1; @@ -254,9 +252,9 @@ static int msgGetOrderFromNum(uint32 nMsg) { */ static int itemGetOrderFromNum(uint32 nItem) { int i; - LPMPALITEM item = GLOBALS.lpmiItems; + LPMPALITEM item = GLOBALS._lpmiItems; - for (i = 0; i < GLOBALS.nItems; i++, item++) + for (i = 0; i < GLOBALS._nItems; i++, item++) if (item->nObj == nItem) return i; @@ -273,9 +271,9 @@ static int itemGetOrderFromNum(uint32 nItem) { */ static int scriptGetOrderFromNum(uint32 nScript) { int i; - LPMPALSCRIPT script = GLOBALS.lpmsScripts; + LPMPALSCRIPT script = GLOBALS._lpmsScripts; - for (i = 0; i < GLOBALS.nScripts; i++, script++) + for (i = 0; i < GLOBALS._nScripts; i++, script++) if (script->nObj == nScript) return i; @@ -292,9 +290,9 @@ static int scriptGetOrderFromNum(uint32 nScript) { */ static int dialogGetOrderFromNum(uint32 nDialog) { int i; - LPMPALDIALOG dialog = GLOBALS.lpmdDialogs; + LPMPALDIALOG dialog = GLOBALS._lpmdDialogs; - for (i = 0; i < GLOBALS.nDialogs; i++, dialog++) + for (i = 0; i < GLOBALS._nDialogs; i++, dialog++) if (dialog->nObj == nDialog) return i; @@ -316,7 +314,7 @@ static char *DuplicateMessage(uint32 nMsgOrd) { if (nMsgOrd == (uint32)-1) return NULL; - origmsg = (const char *)globalLock(GLOBALS.lpmmMsgs[nMsgOrd].hText); + origmsg = (const char *)globalLock(GLOBALS._lpmmMsgs[nMsgOrd]._hText); j = 0; while (origmsg[j] != '\0' || origmsg[j + 1] != '\0') @@ -328,7 +326,7 @@ static char *DuplicateMessage(uint32 nMsgOrd) { return NULL; copyMemory(clonemsg, origmsg, j); - globalUnlock(GLOBALS.lpmmMsgs[nMsgOrd].hText); + globalUnlock(GLOBALS._lpmmMsgs[nMsgOrd]._hText); return clonemsg; } @@ -344,7 +342,7 @@ static char *DuplicateMessage(uint32 nMsgOrd) { static char *duplicateDialogPeriod(uint32 nPeriod) { const char *origmsg; char *clonemsg; - LPMPALDIALOG dialog = GLOBALS.lpmdDialogs + GLOBALS.nExecutingDialog; + LPMPALDIALOG dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog; int i, j; for (j = 0; dialog->_periods[j] != NULL; j++) @@ -385,28 +383,28 @@ HGLOBAL resLoad(uint32 dwId) { uint32 nSizeComp, nSizeDecomp; byte *temp, *buf; - for (i = 0; i < GLOBALS.nResources; i++) - if (GLOBALS.lpResources[i * 2] == dwId) { - GLOBALS.hMpr.seek(GLOBALS.lpResources[i * 2 + 1]); - nBytesRead = GLOBALS.hMpr.read(head, 4); + for (i = 0; i < GLOBALS._nResources; i++) + if (GLOBALS._lpResources[i * 2] == dwId) { + GLOBALS._hMpr.seek(GLOBALS._lpResources[i * 2 + 1]); + nBytesRead = GLOBALS._hMpr.read(head, 4); if (nBytesRead != 4) return NULL; if (head[0] != 'R' || head[1] != 'E' || head[2] != 'S' || head[3] != 'D') return NULL; - nSizeDecomp = GLOBALS.hMpr.readUint32LE(); - if (GLOBALS.hMpr.err()) + nSizeDecomp = GLOBALS._hMpr.readUint32LE(); + if (GLOBALS._hMpr.err()) return NULL; - nSizeComp = GLOBALS.hMpr.readUint32LE(); - if (GLOBALS.hMpr.err()) + nSizeComp = GLOBALS._hMpr.readUint32LE(); + if (GLOBALS._hMpr.err()) return NULL; h = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, nSizeDecomp + (nSizeDecomp / 1024) * 16); buf = (byte *)globalLock(h); temp = (byte *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT,nSizeComp); - nBytesRead = GLOBALS.hMpr.read(temp, nSizeComp); + nBytesRead = GLOBALS._hMpr.read(temp, nSizeComp); if (nBytesRead != nSizeComp) return NULL; @@ -425,7 +423,7 @@ HGLOBAL resLoad(uint32 dwId) { static uint32 *getSelectList(uint32 i) { uint32 *sl; int j, k, num; - LPMPALDIALOG dialog = GLOBALS.lpmdDialogs+GLOBALS.nExecutingDialog; + LPMPALDIALOG dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog; /* Count how many are active selects */ num = 0; @@ -454,10 +452,10 @@ static uint32 *getSelectList(uint32 i) { static uint32 *GetItemList(uint32 nLoc) { uint32 *il; uint32 num,i,j; - LPMPALVAR v = GLOBALS.lpmvVars; + LPMPALVAR v = GLOBALS._lpmvVars; num = 0; - for (i = 0; i < GLOBALS.nVars; i++, v++) { + for (i = 0; i < GLOBALS._nVars; i++, v++) { if (strncmp(v->lpszVarName,"Location",8) == 0 && v->dwVal == nLoc) num++; } @@ -466,9 +464,9 @@ static uint32 *GetItemList(uint32 nLoc) { if (il == NULL) return NULL; - v = GLOBALS.lpmvVars; + v = GLOBALS._lpmvVars; j = 0; - for (i = 0; i < GLOBALS.nVars; i++, v++) { + for (i = 0; i < GLOBALS._nVars; i++, v++) { if (strncmp(v->lpszVarName, "Location", 8) == 0 && v->dwVal == nLoc) { sscanf(v->lpszVarName, "Location.%u", &il[j]); j++; @@ -480,7 +478,7 @@ static uint32 *GetItemList(uint32 nLoc) { } static LPITEM getItemData(uint32 nOrdItem) { - LPMPALITEM curitem = GLOBALS.lpmiItems+nOrdItem; + LPMPALITEM curitem = GLOBALS._lpmiItems + nOrdItem; LPITEM ret; HGLOBAL hDat; char *dat; @@ -592,7 +590,7 @@ void CustomThread(CORO_PARAM, const void *param) { _ctx->p = *(LPCFCALL *)param; - CORO_INVOKE_4(GLOBALS.lplpFunctions[_ctx->p->nCf], _ctx->p->arg1, _ctx->p->arg2, _ctx->p->arg3, _ctx->p->arg4); + CORO_INVOKE_4(GLOBALS._lplpFunctions[_ctx->p->_nCf], _ctx->p->_arg1, _ctx->p->_arg2, _ctx->p->_arg3, _ctx->p->_arg4); globalFree(_ctx->p); @@ -645,21 +643,21 @@ void ScriptThread(CORO_PARAM, const void *param) { if (s->_command[_ctx->k].type == 1) { _ctx->p = (LPCFCALL)globalAlloc(GMEM_FIXED, sizeof(CFCALL)); if (_ctx->p == NULL) { - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; CORO_KILL_SELF(); return; } - _ctx->p->nCf=s->_command[_ctx->k].nCf; - _ctx->p->arg1=s->_command[_ctx->k].arg1; - _ctx->p->arg2=s->_command[_ctx->k].arg2; - _ctx->p->arg3=s->_command[_ctx->k].arg3; - _ctx->p->arg4=s->_command[_ctx->k].arg4; + _ctx->p->_nCf = s->_command[_ctx->k]._nCf; + _ctx->p->_arg1 = s->_command[_ctx->k]._arg1; + _ctx->p->_arg2 = s->_command[_ctx->k]._arg2; + _ctx->p->_arg3 = s->_command[_ctx->k]._arg3; + _ctx->p->_arg4 = s->_command[_ctx->k]._arg4; // !!! New process management if ((cfHandles[_ctx->numHandles++] = CoroScheduler.createProcess(CustomThread, &_ctx->p, sizeof(LPCFCALL))) == 0) { - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; CORO_KILL_SELF(); return; @@ -673,7 +671,7 @@ void ScriptThread(CORO_PARAM, const void *param) { unlockVar(); } else { - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; globalFree(s); CORO_KILL_SELF(); @@ -707,23 +705,23 @@ void ActionThread(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); - GLOBALS.mpalError = 0; + GLOBALS._mpalError = 0; for (_ctx->j = 0; _ctx->j < item->Action[item->dwRes].nCmds; _ctx->j++) { _ctx->k = item->Action[item->dwRes].CmdNum[_ctx->j]; if (item->_command[_ctx->k].type == 1) { // Custom function debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d Call=%s params=%d,%d,%d,%d", - CoroScheduler.getCurrentPID(), GLOBALS.lplpFunctionStrings[item->_command[_ctx->k].nCf].c_str(), - item->_command[_ctx->k].arg1, item->_command[_ctx->k].arg2, - item->_command[_ctx->k].arg3, item->_command[_ctx->k].arg4 + CoroScheduler.getCurrentPID(), GLOBALS._lplpFunctionStrings[item->_command[_ctx->k]._nCf].c_str(), + item->_command[_ctx->k]._arg1, item->_command[_ctx->k]._arg2, + item->_command[_ctx->k]._arg3, item->_command[_ctx->k]._arg4 ); - CORO_INVOKE_4(GLOBALS.lplpFunctions[item->_command[_ctx->k].nCf], - item->_command[_ctx->k].arg1, - item->_command[_ctx->k].arg2, - item->_command[_ctx->k].arg3, - item->_command[_ctx->k].arg4 + CORO_INVOKE_4(GLOBALS._lplpFunctions[item->_command[_ctx->k]._nCf], + item->_command[_ctx->k]._arg1, + item->_command[_ctx->k]._arg2, + item->_command[_ctx->k]._arg3, + item->_command[_ctx->k]._arg4 ); } else if (item->_command[_ctx->k].type == 2) { @@ -736,7 +734,7 @@ void ActionThread(CORO_PARAM, const void *param) { unlockVar(); } else { - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; break; } } @@ -765,7 +763,7 @@ void ShutUpActionThread(CORO_PARAM, const void *param) { CORO_INVOKE_2(CoroScheduler.waitForSingleObject, pid, CORO_INFINITE); - GLOBALS.bExecutingAction = false; + GLOBALS._bExecutingAction = false; if (_vm->_initialLoadSlotNumber != -1) { _ctx->slotNumber = _vm->_initialLoadSlotNumber; @@ -825,7 +823,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); /* To begin with, we need to request the item list from the location */ - _ctx->il = mpalQueryItemList(GLOBALS.nPollingLocations[id]); + _ctx->il = mpalQueryItemList(GLOBALS._nPollingLocations[id]); /* Count the items */ for (_ctx->numitems = 0; _ctx->il[_ctx->numitems] != 0; _ctx->numitems++) @@ -840,7 +838,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { if (_ctx->ord == -1) continue; - _ctx->curItem = GLOBALS.lpmiItems + _ctx->ord; + _ctx->curItem = GLOBALS._lpmiItems + _ctx->ord; _ctx->k = 0; for (_ctx->j = 0; _ctx->j < _ctx->curItem->nActions; _ctx->j++) @@ -889,9 +887,9 @@ void LocationPollThread(CORO_PARAM, const void *param) { if (_ctx->il[_ctx->i] == 0) continue; - _ctx->curItem = GLOBALS.lpmiItems + itemGetOrderFromNum(_ctx->il[_ctx->i]); + _ctx->curItem = GLOBALS._lpmiItems + itemGetOrderFromNum(_ctx->il[_ctx->i]); - for (_ctx->j = 0; _ctx->j < _ctx->curItem->nActions; _ctx->j++) + for (_ctx->j = 0; _ctx->j < _ctx->curItem->nActions; _ctx->j++) { if (_ctx->curItem->Action[_ctx->j].num == 0xFF) { _ctx->MyActions[_ctx->k].nItem = _ctx->il[_ctx->i]; _ctx->MyActions[_ctx->k].nAction = _ctx->j; @@ -906,6 +904,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { _ctx->MyActions[_ctx->k].dwLastTime = _vm->getTime(); _ctx->k++; } + } } unlockItems(); @@ -929,7 +928,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { _ctx->dwSleepTime = MIN(_ctx->dwSleepTime, _ctx->MyActions[_ctx->k].dwLastTime + _ctx->MyActions[_ctx->k].wTime - _ctx->curTime); /* We fall alseep, but always checking that the event is set when prompted for closure */ - CORO_INVOKE_3(CoroScheduler.waitForSingleObject, GLOBALS.hEndPollingLocations[id], _ctx->dwSleepTime, &_ctx->expired); + CORO_INVOKE_3(CoroScheduler.waitForSingleObject, GLOBALS._hEndPollingLocations[id], _ctx->dwSleepTime, &_ctx->expired); //if (_ctx->k == WAIT_OBJECT_0) if (!_ctx->expired) @@ -955,7 +954,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { byte randomVal = (byte)_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)) + if ((GLOBALS._bExecutingAction) && (GLOBALS._nExecutingAction == _ctx->MyActions[_ctx->k].nItem)) continue; /* Check to see if there already another idle funning running on the item */ @@ -968,7 +967,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { /* Ok, we are the only ones :) */ lockItems(); - _ctx->curItem=GLOBALS.lpmiItems+itemGetOrderFromNum(_ctx->MyActions[_ctx->k].nItem); + _ctx->curItem = GLOBALS._lpmiItems + itemGetOrderFromNum(_ctx->MyActions[_ctx->k].nItem); /* Check if there is a WhenExecute expression */ _ctx->j=_ctx->MyActions[_ctx->k].nAction; @@ -1021,7 +1020,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { // Set idle skip on - CORO_INVOKE_4(GLOBALS.lplpFunctions[200], 0, 0, 0, 0); + CORO_INVOKE_4(GLOBALS._lplpFunctions[200], 0, 0, 0, 0); for (_ctx->i = 0; _ctx->i < _ctx->nRealItems; _ctx->i++) if (_ctx->MyThreads[_ctx->i].nItem != 0) { @@ -1036,7 +1035,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { } // Set idle skip off - CORO_INVOKE_4(GLOBALS.lplpFunctions[201], 0, 0, 0, 0); + CORO_INVOKE_4(GLOBALS._lplpFunctions[201], 0, 0, 0, 0); /* We're finished */ globalDestroy(_ctx->MyThreads); @@ -1067,11 +1066,11 @@ void ShutUpDialogThread(CORO_PARAM, const void *param) { CORO_INVOKE_2(CoroScheduler.waitForSingleObject, pid, CORO_INFINITE); - GLOBALS.bExecutingDialog = false; - GLOBALS.nExecutingDialog = 0; - GLOBALS.nExecutingChoice = 0; + GLOBALS._bExecutingDialog = false; + GLOBALS._nExecutingDialog = 0; + GLOBALS._nExecutingChoice = 0; - CoroScheduler.setEvent(GLOBALS.hAskChoice); + CoroScheduler.setEvent(GLOBALS._hAskChoice); CORO_KILL_SELF(); @@ -1100,7 +1099,7 @@ void GroupThread(CORO_PARAM, const void *param) { lockDialogs(); // Find the pointer to the current _ctx->dialog - _ctx->dialog = GLOBALS.lpmdDialogs + GLOBALS.nExecutingDialog; + _ctx->dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog; // Search inside the group requesting the _ctx->dialog for (_ctx->i = 0; _ctx->dialog->_group[_ctx->i].num != 0; _ctx->i++) { @@ -1112,11 +1111,11 @@ void GroupThread(CORO_PARAM, const void *param) { _ctx->type = _ctx->dialog->_command[_ctx->k].type; if (_ctx->type == 1) { // Call custom function - CORO_INVOKE_4(GLOBALS.lplpFunctions[_ctx->dialog->_command[_ctx->k].nCf], - _ctx->dialog->_command[_ctx->k].arg1, - _ctx->dialog->_command[_ctx->k].arg2, - _ctx->dialog->_command[_ctx->k].arg3, - _ctx->dialog->_command[_ctx->k].arg4 + CORO_INVOKE_4(GLOBALS._lplpFunctions[_ctx->dialog->_command[_ctx->k]._nCf], + _ctx->dialog->_command[_ctx->k]._arg1, + _ctx->dialog->_command[_ctx->k]._arg2, + _ctx->dialog->_command[_ctx->k]._arg3, + _ctx->dialog->_command[_ctx->k]._arg4 ); } else if (_ctx->type == 2) { @@ -1130,7 +1129,7 @@ void GroupThread(CORO_PARAM, const void *param) { CORO_INVOKE_1(doChoice, (uint32)_ctx->dialog->_command[_ctx->k].nChoice); } else { - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; unlockDialogs(); CORO_KILL_SELF(); @@ -1147,7 +1146,7 @@ void GroupThread(CORO_PARAM, const void *param) { } /* If we are here, it means that we have not found the requested group */ - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; unlockDialogs(); CORO_KILL_SELF(); @@ -1174,7 +1173,7 @@ void doChoice(CORO_PARAM, uint32 nChoice) { lockDialogs(); /* Get a pointer to the current dialog */ - _ctx->dialog = GLOBALS.lpmdDialogs + GLOBALS.nExecutingDialog; + _ctx->dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog; /* Search the choice between those required in the dialog */ for (_ctx->i = 0; _ctx->dialog->_choice[_ctx->i].nChoice != 0; _ctx->i++) @@ -1184,7 +1183,7 @@ void doChoice(CORO_PARAM, uint32 nChoice) { /* If nothing has been found, exit with an error */ if (_ctx->dialog->_choice[_ctx->i].nChoice == 0) { /* If we're here, we did not find the required choice */ - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; unlockDialogs(); CORO_KILL_SELF(); @@ -1192,10 +1191,10 @@ void doChoice(CORO_PARAM, uint32 nChoice) { } /* We've found the requested choice. Remember what in global variables */ - GLOBALS.nExecutingChoice = _ctx->i; + GLOBALS._nExecutingChoice = _ctx->i; while (1) { - GLOBALS.nExecutingChoice = _ctx->i; + GLOBALS._nExecutingChoice = _ctx->i; _ctx->k = 0; /* Calculate the expression of each selection, to see if they're active or inactive */ @@ -1216,13 +1215,13 @@ void doChoice(CORO_PARAM, uint32 nChoice) { } /* There are choices available to the user, so wait for them to make one */ - CoroScheduler.resetEvent(GLOBALS.hDoneChoice); - CoroScheduler.setEvent(GLOBALS.hAskChoice); - CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS.hDoneChoice, CORO_INFINITE); + CoroScheduler.resetEvent(GLOBALS._hDoneChoice); + CoroScheduler.setEvent(GLOBALS._hAskChoice); + CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._hDoneChoice, CORO_INFINITE); /* Now that the choice has been made, we can run the groups associated with the choice tbontbtitq */ - _ctx->j = GLOBALS.nSelectedChoice; + _ctx->j = GLOBALS._nSelectedChoice; for (_ctx->k = 0; _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].wPlayGroup[_ctx->k] != 0; _ctx->k++) { _ctx->nGroup = _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].wPlayGroup[_ctx->k]; CORO_INVOKE_1(GroupThread, &_ctx->nGroup); @@ -1266,7 +1265,7 @@ void doChoice(CORO_PARAM, uint32 nChoice) { * by calling LockItem(). */ static uint32 doAction(uint32 nAction, uint32 ordItem, uint32 dwParam) { - LPMPALITEM item = GLOBALS.lpmiItems; + LPMPALITEM item = GLOBALS._lpmiItems; int i; LPMPALITEM newitem; uint32 h; @@ -1311,8 +1310,8 @@ static uint32 doAction(uint32 nAction, uint32 ordItem, uint32 dwParam) { if (CoroScheduler.createProcess(ShutUpActionThread, &h, sizeof(uint32)) == CORO_INVALID_PID_VALUE) return CORO_INVALID_PID_VALUE; - GLOBALS.nExecutingAction = item->nObj; - GLOBALS.bExecutingAction = true; + GLOBALS._nExecutingAction = item->nObj; + GLOBALS._bExecutingAction = true; return h; } @@ -1335,13 +1334,13 @@ static uint32 doDialog(uint32 nDlgOrd, uint32 nGroup) { uint32 h; // Store the running dialog in a global variable - GLOBALS.nExecutingDialog = nDlgOrd; + GLOBALS._nExecutingDialog = nDlgOrd; // Enables the flag to indicate that there is' a running dialogue - GLOBALS.bExecutingDialog = true; + GLOBALS._bExecutingDialog = true; - CoroScheduler.resetEvent(GLOBALS.hAskChoice); - CoroScheduler.resetEvent(GLOBALS.hDoneChoice); + CoroScheduler.resetEvent(GLOBALS._hAskChoice); + CoroScheduler.resetEvent(GLOBALS._hDoneChoice); // Create a thread that performs the dialogue group @@ -1369,7 +1368,7 @@ static uint32 doDialog(uint32 nDlgOrd, uint32 nGroup) { * @returns True if everything is OK, false on failure */ bool doSelection(uint32 i, uint32 dwData) { - LPMPALDIALOG dialog = GLOBALS.lpmdDialogs+GLOBALS.nExecutingDialog; + LPMPALDIALOG dialog = GLOBALS._lpmdDialogs + GLOBALS._nExecutingDialog; int j; for (j = 0; dialog->_choice[i]._select[j].dwData != 0; j++) @@ -1379,8 +1378,8 @@ bool doSelection(uint32 i, uint32 dwData) { if (dialog->_choice[i]._select[j].dwData == 0) return false; - GLOBALS.nSelectedChoice = j; - CoroScheduler.setEvent(GLOBALS.hDoneChoice); + GLOBALS._nSelectedChoice = j; + CoroScheduler.setEvent(GLOBALS._hDoneChoice); return true; } @@ -1411,8 +1410,8 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, //printf("Dialog: %lu\n", sizeof(MPALDIALOG)); /* Save the array of custom functions */ - GLOBALS.lplpFunctions = lplpcfArray; - GLOBALS.lplpFunctionStrings = lpcfStrings; + GLOBALS._lplpFunctions = lplpcfArray; + GLOBALS._lplpFunctionStrings = lpcfStrings; /* OPen the MPC file for reading */ if (!hMpc.open(lpszMpcFileName)) @@ -1489,61 +1488,61 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, */ /* Open the MPR file */ - if (!GLOBALS.hMpr.open(lpszMprFileName)) + if (!GLOBALS._hMpr.open(lpszMprFileName)) return false; /* Seek to the end of the file to read overall information */ - GLOBALS.hMpr.seek(-12, SEEK_END); + GLOBALS._hMpr.seek(-12, SEEK_END); - dwSizeComp = GLOBALS.hMpr.readUint32LE(); - if (GLOBALS.hMpr.err()) + dwSizeComp = GLOBALS._hMpr.readUint32LE(); + if (GLOBALS._hMpr.err()) return false; - GLOBALS.nResources = GLOBALS.hMpr.readUint32LE(); - if (GLOBALS.hMpr.err()) + GLOBALS._nResources = GLOBALS._hMpr.readUint32LE(); + if (GLOBALS._hMpr.err()) return false; - nBytesRead = GLOBALS.hMpr.read(buf, 4); - if (GLOBALS.hMpr.err()) + nBytesRead = GLOBALS._hMpr.read(buf, 4); + if (GLOBALS._hMpr.err()) return false; if (buf[0] !='E' || buf[1] != 'N' || buf[2] != 'D' || buf[3] != '0') return false; /* Move to the start of the resources header */ - GLOBALS.hMpr.seek(-(12 + (int)dwSizeComp), SEEK_END); + GLOBALS._hMpr.seek(-(12 + (int)dwSizeComp), SEEK_END); - GLOBALS.lpResources = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, GLOBALS.nResources * 8); - if (GLOBALS.lpResources == NULL) + GLOBALS._lpResources = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, GLOBALS._nResources * 8); + if (GLOBALS._lpResources == NULL) return false; cmpbuf = (byte *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, dwSizeComp); if (cmpbuf == NULL) return false; - nBytesRead = GLOBALS.hMpr.read(cmpbuf, dwSizeComp); + nBytesRead = GLOBALS._hMpr.read(cmpbuf, dwSizeComp); if (nBytesRead != dwSizeComp) return false; - lzo1x_decompress((const byte *)cmpbuf, dwSizeComp, (byte *)GLOBALS.lpResources, (uint32 *)&nBytesRead); - if (nBytesRead != (uint32)GLOBALS.nResources * 8) + lzo1x_decompress((const byte *)cmpbuf, dwSizeComp, (byte *)GLOBALS._lpResources, (uint32 *)&nBytesRead); + if (nBytesRead != (uint32)GLOBALS._nResources * 8) return false; globalDestroy(cmpbuf); /* Reset back to the start of the file, leaving it open */ - GLOBALS.hMpr.seek(0, SEEK_SET); + GLOBALS._hMpr.seek(0, SEEK_SET); /* There is no action or dialog running by default */ - GLOBALS.bExecutingAction = false; - GLOBALS.bExecutingDialog = false; + GLOBALS._bExecutingAction = false; + GLOBALS._bExecutingDialog = false; /* There's no polling location */ - Common::fill(GLOBALS.nPollingLocations, GLOBALS.nPollingLocations + MAXPOLLINGLOCATIONS, 0); + Common::fill(GLOBALS._nPollingLocations, GLOBALS._nPollingLocations + MAXPOLLINGLOCATIONS, 0); /* Create the event that will be used to co-ordinate making choices and choices finishing */ - GLOBALS.hAskChoice = CoroScheduler.createEvent(true, false); - GLOBALS.hDoneChoice = CoroScheduler.createEvent(true, false); + GLOBALS._hAskChoice = CoroScheduler.createEvent(true, false); + GLOBALS._hDoneChoice = CoroScheduler.createEvent(true, false); return true; } @@ -1553,7 +1552,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, */ void mpalFree() { // Free the resource list - globalDestroy(GLOBALS.lpResources); + globalDestroy(GLOBALS._lpResources); } /** @@ -1574,7 +1573,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { va_list v; va_start(v, wQueryType); - GLOBALS.mpalError = OK; + GLOBALS._mpalError = OK; if (wQueryType == MPQ_VERSION) { @@ -1616,13 +1615,13 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { y = GETARG(uint32); if (x != -1) { if (y == MPQ_X) - dwRet = GLOBALS.lpmlLocations[x].dwXlen; + dwRet = GLOBALS._lpmlLocations[x].dwXlen; else if (y == MPQ_Y) - dwRet = GLOBALS.lpmlLocations[x].dwYlen; + dwRet = GLOBALS._lpmlLocations[x].dwYlen; else - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; } else - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; unlockLocations(); @@ -1677,7 +1676,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { else { lockItems(); y = itemGetOrderFromNum(x); - copyMemory(n, (char *)(GLOBALS.lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); + copyMemory(n, (char *)(GLOBALS._lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); unlockItems(); } @@ -1725,7 +1724,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { dwRet = doAction(x, y, GETARG(uint32)); } else { dwRet = CORO_INVALID_PID_VALUE; - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; } unlockVar(); @@ -1735,7 +1734,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { /* * int mpalQuery(MPQ_DO_DIALOG, uint32 nDialog, uint32 nGroup); */ - if (!GLOBALS.bExecutingDialog) { + if (!GLOBALS._bExecutingDialog) { lockDialogs(); x = dialogGetOrderFromNum(GETARG(uint32)); @@ -1747,7 +1746,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { /* * DEFAULT -> ERROR */ - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; } va_end(v); @@ -1771,7 +1770,7 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) { va_start(v, wQueryType); void *hRet = NULL; - GLOBALS.mpalError = OK; + GLOBALS._mpalError = OK; if (wQueryType == MPQ_VERSION) { /* @@ -1811,7 +1810,7 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) { */ lockLocations(); x = locGetOrderFromNum(GETARG(uint32)); - hRet = resLoad(GLOBALS.lpmlLocations[x].dwPicRes); + hRet = resLoad(GLOBALS._lpmlLocations[x].dwPicRes); unlockLocations(); } else if (wQueryType == MPQ_RESOURCE) { @@ -1855,7 +1854,7 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) { else { lockItems(); y = itemGetOrderFromNum(x); - copyMemory(n, (char *)(GLOBALS.lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); + copyMemory(n, (char *)(GLOBALS._lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); unlockItems(); } @@ -1905,7 +1904,7 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) { /* * DEFAULT -> ERROR */ - GLOBALS.mpalError = 1; + GLOBALS._mpalError = 1; } va_end(v); @@ -1936,12 +1935,12 @@ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...) { /* * void mpalQuery(MPQ_DIALOG_WAITFORCHOICE); */ - CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS.hAskChoice, CORO_INFINITE); + CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._hAskChoice, CORO_INFINITE); - CoroScheduler.resetEvent(GLOBALS.hAskChoice); + CoroScheduler.resetEvent(GLOBALS._hAskChoice); - if (GLOBALS.bExecutingDialog) - *dwRet = (uint32)GLOBALS.nExecutingChoice; + if (GLOBALS._bExecutingDialog) + *dwRet = (uint32)GLOBALS._nExecutingChoice; else *dwRet = (uint32)((int)-1); } else { @@ -1960,7 +1959,7 @@ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...) { * @returns Error code */ uint32 mpalGetError(void) { - return GLOBALS.mpalError; + return GLOBALS._mpalError; } @@ -1980,7 +1979,7 @@ bool mpalExecuteScript(int nScript) { if (s == NULL) return false; - copyMemory(s, GLOBALS.lpmsScripts + n, sizeof(MPALSCRIPT)); + copyMemory(s, GLOBALS._lpmsScripts + n, sizeof(MPALSCRIPT)); unlockScripts(); // !!! New process management @@ -1998,7 +1997,7 @@ bool mpalExecuteScript(int nScript) { * @param lpiifCustom Custom function to install */ void mpalInstallItemIrq(LPITEMIRQFUNCTION lpiifCus) { - GLOBALS.lpiifCustom = lpiifCus; + GLOBALS._lpiifCustom = lpiifCus; } @@ -2015,16 +2014,16 @@ bool mpalStartIdlePoll(int nLoc) { uint32 i; for (i = 0; i < MAXPOLLINGLOCATIONS; i++) - if (GLOBALS.nPollingLocations[i] == (uint32)nLoc) + if (GLOBALS._nPollingLocations[i] == (uint32)nLoc) return false; for (i = 0; i < MAXPOLLINGLOCATIONS; i++) { - if (GLOBALS.nPollingLocations[i] == 0) { - GLOBALS.nPollingLocations[i] = nLoc; + if (GLOBALS._nPollingLocations[i] == 0) { + GLOBALS._nPollingLocations[i] = nLoc; - GLOBALS.hEndPollingLocations[i] = CoroScheduler.createEvent(true, false); + GLOBALS._hEndPollingLocations[i] = CoroScheduler.createEvent(true, false); // !!! New process management - if ((GLOBALS.PollingThreads[i] = CoroScheduler.createProcess(LocationPollThread, &i, sizeof(uint32))) == CORO_INVALID_PID_VALUE) + if ((GLOBALS._pollingThreads[i] = CoroScheduler.createProcess(LocationPollThread, &i, sizeof(uint32))) == CORO_INVALID_PID_VALUE) // if ((GLOBALS.hEndPollingLocations[i] = (void*)_beginthread(LocationPollThread, 10240,(void *)i))= = (void*)-1) return false; @@ -2051,13 +2050,13 @@ void mpalEndIdlePoll(CORO_PARAM, int nLoc, bool *result) { CORO_BEGIN_CODE(_ctx); for (_ctx->i = 0; _ctx->i < MAXPOLLINGLOCATIONS; _ctx->i++) { - if (GLOBALS.nPollingLocations[_ctx->i] == (uint32)nLoc) { - CoroScheduler.setEvent(GLOBALS.hEndPollingLocations[_ctx->i]); + if (GLOBALS._nPollingLocations[_ctx->i] == (uint32)nLoc) { + CoroScheduler.setEvent(GLOBALS._hEndPollingLocations[_ctx->i]); - CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS.PollingThreads[_ctx->i], CORO_INFINITE); + CORO_INVOKE_2(CoroScheduler.waitForSingleObject, GLOBALS._pollingThreads[_ctx->i], CORO_INFINITE); - CoroScheduler.closeEvent(GLOBALS.hEndPollingLocations[_ctx->i]); - GLOBALS.nPollingLocations[_ctx->i] = 0; + CoroScheduler.closeEvent(GLOBALS._hEndPollingLocations[_ctx->i]); + GLOBALS._nPollingLocations[_ctx->i] = 0; if (result) *result = true; @@ -2078,7 +2077,7 @@ void mpalEndIdlePoll(CORO_PARAM, int nLoc, bool *result) { * @returns Length in bytes */ int mpalGetSaveStateSize(void) { - return GLOBALS.nVars * sizeof(MPALVAR) + 4; + return GLOBALS._nVars * sizeof(MPALVAR) + 4; } @@ -2090,8 +2089,8 @@ int mpalGetSaveStateSize(void) { */ void mpalSaveState(byte *buf) { lockVar(); - WRITE_LE_UINT32(buf, GLOBALS.nVars); - copyMemory(buf + 4, (byte *)GLOBALS.lpmvVars, GLOBALS.nVars * sizeof(MPALVAR)); + WRITE_LE_UINT32(buf, GLOBALS._nVars); + copyMemory(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MPALVAR)); unlockVar(); } @@ -2104,16 +2103,16 @@ void mpalSaveState(byte *buf) { */ int mpalLoadState(byte *buf) { // We must destroy and recreate all the variables - globalFree(GLOBALS.hVars); + globalFree(GLOBALS._hVars); - GLOBALS.nVars = READ_LE_UINT32(buf); + GLOBALS._nVars = READ_LE_UINT32(buf); - GLOBALS.hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS.nVars * sizeof(MPALVAR)); + GLOBALS._hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS._nVars * sizeof(MPALVAR)); lockVar(); - copyMemory((byte *)GLOBALS.lpmvVars, buf + 4, GLOBALS.nVars * sizeof(MPALVAR)); + copyMemory((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MPALVAR)); unlockVar(); - return GLOBALS.nVars * sizeof(MPALVAR) + 4; + return GLOBALS._nVars * sizeof(MPALVAR) + 4; } bool bDontOutput; @@ -2264,8 +2263,8 @@ void mpalDumpMessages(void) { f = g_system->getSavefileManager()->openForSaving("Messages.htm"); f->writeString("\n\n\n"); - for (i = 0; i < GLOBALS.nMsgs; i++) { - lpMessage = (char *)globalLock(GLOBALS.lpmmMsgs[i].hText); + for (i = 0; i < GLOBALS._nMsgs; i++) { + lpMessage = (char *)globalLock(GLOBALS._lpmmMsgs[i]._hText); if (*lpMessage != '\0') { // bernie: debug /*if (GLOBALS.lpmmMsgs[i].wNum == 1950) { @@ -2275,7 +2274,7 @@ void mpalDumpMessages(void) { nPeriods = 1; p = lpPeriods[0] = lpMessage; - outputStartMsgComment(GLOBALS.lpmmMsgs[i].wNum, f); + outputStartMsgComment(GLOBALS._lpmmMsgs[i]._wNum, f); while (1) { // Find the end of the current period @@ -2294,9 +2293,9 @@ void mpalDumpMessages(void) { // Now make a loop over all the periods for (j = 0; j < nPeriods; j++) { if (nPeriods == 1) - sprintf(fname, "000-%05d.WAV", GLOBALS.lpmmMsgs[i].wNum); + sprintf(fname, "000-%05d.WAV", GLOBALS._lpmmMsgs[i]._wNum); else - sprintf(fname, "000-%05d-%02d.WAV", GLOBALS.lpmmMsgs[i].wNum,j); + sprintf(fname, "000-%05d-%02d.WAV", GLOBALS._lpmmMsgs[i]._wNum,j); strcpy(frase, lpPeriods[j]); @@ -2318,9 +2317,9 @@ void mpalDumpMessages(void) { } } - OutputEndMsgComment(GLOBALS.lpmmMsgs[i].wNum, f); + OutputEndMsgComment(GLOBALS._lpmmMsgs[i]._wNum, f); - globalUnlock(GLOBALS.lpmmMsgs[i].hText); + globalUnlock(GLOBALS._lpmmMsgs[i]._hText); } } @@ -2357,13 +2356,13 @@ void mpalDumpOthers(void) { f->writeString("\n\n"); - for (i = 0; i < GLOBALS.nMsgs; i++) { - lpMessage = (char *)globalLock(GLOBALS.lpmmMsgs[i].hText); + for (i = 0; i < GLOBALS._nMsgs; i++) { + lpMessage = (char *)globalLock(GLOBALS._lpmmMsgs[i]._hText); if (*lpMessage != '\0') { nPeriods = 1; p = lpPeriods[0] = lpMessage; - if (OutputStartOther(GLOBALS.lpmmMsgs[i].wNum, f)) { + if (OutputStartOther(GLOBALS._lpmmMsgs[i]._wNum, f)) { while (1) { // Find the end of the current period while (*p != '\0') @@ -2381,9 +2380,9 @@ void mpalDumpOthers(void) { // Now loop over all the periods for (j = 0; j < nPeriods; j++) { if (nPeriods == 1) - sprintf(fname, "000-%05d.WAV", GLOBALS.lpmmMsgs[i].wNum); + sprintf(fname, "000-%05d.WAV", GLOBALS._lpmmMsgs[i]._wNum); else - sprintf(fname, "000-%05d-%02d.WAV", GLOBALS.lpmmMsgs[i].wNum,j); + sprintf(fname, "000-%05d-%02d.WAV", GLOBALS._lpmmMsgs[i]._wNum,j); strcpy(frase,lpPeriods[j]); @@ -2406,9 +2405,9 @@ void mpalDumpOthers(void) { } } - outputEndOther(GLOBALS.lpmmMsgs[i].wNum, f); + outputEndOther(GLOBALS._lpmmMsgs[i]._wNum, f); - globalUnlock(GLOBALS.lpmmMsgs[i].hText); + globalUnlock(GLOBALS._lpmmMsgs[i]._hText); } } @@ -2833,7 +2832,7 @@ void mpalDumpDialog(LPMPALDIALOG dlg) { for (c = 0; c_group[g].nCmds; c++) { curCmd = &dlg->_command[dlg->_group[g].CmdNum[c]]; - if (curCmd->type == 1 && curCmd->nCf == 71) { + if (curCmd->type == 1 && curCmd->_nCf == 71) { bAtLeastOne = true; break; } @@ -2849,15 +2848,15 @@ void mpalDumpDialog(LPMPALDIALOG dlg) { curCmd = &dlg->_command[dlg->_group[g].CmdNum[c]]; // If it's a custom function, call SendDialogMessage(nPers, nMsg) - if (curCmd->type == 1 && curCmd->nCf == 71) { - sprintf(fname, "%03d-%05d.WAV", dlg->nObj, curCmd->arg2); + if (curCmd->type == 1 && curCmd->_nCf == 71) { + sprintf(fname, "%03d-%05d.WAV", dlg->nObj, curCmd->_arg2); for (j = 0; dlg->_periods[j] != NULL; j++) - if (dlg->_periodNums[j] == curCmd->arg2) + if (dlg->_periodNums[j] == curCmd->_arg2) break; if (dlg->_periods[j] == NULL) - warning("ERROR: Dialog %d, Period %d not found!", (int)dlg->nObj, (int)curCmd->arg2); + warning("ERROR: Dialog %d, Period %d not found!", (int)dlg->nObj, (int)curCmd->_arg2); else { frase = (char *)globalLock(dlg->_periods[j]); strcpy(copia, frase); @@ -2876,7 +2875,7 @@ void mpalDumpDialog(LPMPALDIALOG dlg) { f->writeString("\t\n"); f->writeString(Common::String::format("\t\t\n", fname)); f->writeString(Common::String::format("\t\t\n", - getPersonName(dlg->nObj, curCmd->arg1))); + getPersonName(dlg->nObj, curCmd->_arg1))); f->writeString(Common::String::format("\t\t\n",copia)); f->writeString("\t\n"); //fprintf(f, "(%s) <%s> %s\n", fname, GetPersonName(dlg->nObj, curCmd->arg1), copia); @@ -2899,8 +2898,8 @@ void mpalDumpDialogs(void) { lockDialogs(); - for (i = 0; i < GLOBALS.nDialogs; i++) - mpalDumpDialog(&GLOBALS.lpmdDialogs[i]); + for (i = 0; i < GLOBALS._nDialogs; i++) + mpalDumpDialog(&GLOBALS._lpmdDialogs[i]); unlockDialogs(); } diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h index e331335315..952a0957c5 100644 --- a/engines/tony/mpal/mpaldll.h +++ b/engines/tony/mpal/mpaldll.h @@ -89,8 +89,8 @@ typedef LPMPALVAR *LPLPMPALVAR; * MPAL Messages */ struct MPALMSG { - HGLOBAL hText; // Handle to the message text - uint16 wNum; // Message number + HGLOBAL _hText; // Handle to the message text + uint16 _wNum; // Message number } PACKED_STRUCT; typedef MPALMSG *LPMPALMSG; typedef LPMPALMSG *LPLPMPALMSG; @@ -124,17 +124,17 @@ struct command { byte type; // Type of control union { - int32 nCf; // Custom function call [#1] + int32 _nCf; // Custom function call [#1] char *lpszVarName; // Variable name [#2] int32 nChoice; // Number of choice you make [#3] }; union { - int32 arg1; // Argument for custom function [#1] + int32 _arg1; // Argument for custom function [#1] HGLOBAL expr; // Expression to assign to a variable [#2] }; - int32 arg2, arg3, arg4; // Arguments for custom function [#1] + int32 _arg2, _arg3, _arg4; // Arguments for custom function [#1] } PACKED_STRUCT; diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 0c0bcf331a..2b9d8fbc20 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -517,9 +517,9 @@ 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) { + if (_vm->_loadSlotNumber != -1 && GLOBALS._gfxEngine != NULL) { _ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber); - CORO_INVOKE_1(GLOBALS.GfxEngine->loadState, _ctx->fn); + CORO_INVOKE_1(GLOBALS._gfxEngine->loadState, _ctx->fn); _vm->_loadSlotNumber = -1; } @@ -605,10 +605,10 @@ uint32 TonyEngine::getTime() { } bool TonyEngine::canLoadGameStateCurrently() { - return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave(); + return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave(); } bool TonyEngine::canSaveGameStateCurrently() { - return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave(); + return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave(); } Common::Error TonyEngine::loadGameState(int slot) { @@ -617,13 +617,13 @@ Common::Error TonyEngine::loadGameState(int slot) { } Common::Error TonyEngine::saveGameState(int slot, const Common::String &desc) { - if (!GLOBALS.GfxEngine) + if (!GLOBALS._gfxEngine) return Common::kUnknownError; RMSnapshot s; - s.grabScreenshot(*GLOBALS.GfxEngine, 4, _curThumbnail); + s.grabScreenshot(*GLOBALS._gfxEngine, 4, _curThumbnail); - GLOBALS.GfxEngine->saveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc); + GLOBALS._gfxEngine->saveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc); return Common::kNoError; } -- cgit v1.2.3
%s %s %s