From 3c986af9ce531f4d9cab889b196991be14cb88f6 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Tue, 28 Aug 2012 22:10:10 +0200 Subject: [PATCH] TONY: Remove unnecessary mainloop mutex. Also, all the related freeze functions/members. --- engines/tony/adv.h | 2 -- engines/tony/custom.cpp | 56 ++------------------------------------ engines/tony/font.cpp | 4 --- engines/tony/game.cpp | 8 ------ engines/tony/gfxengine.cpp | 26 ------------------ engines/tony/gfxengine.h | 5 ---- engines/tony/globals.cpp | 3 -- engines/tony/globals.h | 3 -- engines/tony/tony.cpp | 2 -- engines/tony/tonychar.cpp | 34 ----------------------- 10 files changed, 2 insertions(+), 141 deletions(-) diff --git a/engines/tony/adv.h b/engines/tony/adv.h index fe1dd32eae7c..8e497bc1f27b 100644 --- a/engines/tony/adv.h +++ b/engines/tony/adv.h @@ -67,8 +67,6 @@ enum RMTonyAction { uint32 mainLoadLocation(int nLoc, RMPoint pt, RMPoint start); void mainUnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result); void mainLinkGraphicTask(RMGfxTask *task); -void mainFreeze(); -void mainUnfreeze(); void mainWaitFrame(CORO_PARAM); void mainShowMouse(); void mainHideMouse(); diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp index c73c7dec36e0..593d27655d7c 100644 --- a/engines/tony/custom.cpp +++ b/engines/tony/custom.cpp @@ -374,15 +374,12 @@ DECLARE_CUSTOM_FUNCTION(CustLoadLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, ui CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); - GLOBALS._curChangedHotspot = 0; if (bUseStartPos != 0) GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), GLOBALS._startLocPos[nLoc]); else GLOBALS.LoadLocation(nLoc, RMPoint(tX, tY), RMPoint(-1, -1)); - GLOBALS.Unfreeze(); _ctx->h = mpalQueryDoAction(0, nLoc, 0); // On Enter? @@ -413,7 +410,6 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32 CORO_INVOKE_2(GLOBALS.UnloadLocation, false, NULL); GLOBALS._tony->hide(); - GLOBALS.Unfreeze(); for (_ctx->i = 0; _ctx->i < _ctx->msg->numPeriods() && !GLOBALS._bSkipIdle; _ctx->i++) { _ctx->text.setInput(GLOBALS._input); @@ -474,11 +470,9 @@ DECLARE_CUSTOM_FUNCTION(ClearScreen)(CORO_PARAM, uint32, uint32, uint32, uint32) } DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgEnd)(CORO_PARAM, uint32 bNotEnableTony, uint32, uint32, uint32) { - GLOBALS.Freeze(); GLOBALS.LoadLocation(GLOBALS._fullScreenMessageLoc, RMPoint(GLOBALS._fullScreenMessagePt._x, GLOBALS._fullScreenMessagePt._y), RMPoint(-1, -1)); if (!bNotEnableTony) GLOBALS._tony->show(); - GLOBALS.Unfreeze(); MCharResetCodes(); ReapplyChangedHotspot(); @@ -514,9 +508,8 @@ DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint3 g_vm->stopMusic(4); - // On exit, unload and unfreeze + // On exit, unload CORO_INVOKE_2(GLOBALS.UnloadLocation, true, NULL); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -557,9 +550,6 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint GLOBALS.InitWipe(2); } - GLOBALS.Unfreeze(); - - _ctx->h = mpalQueryDoAction(0, nLoc, 0); if (!GLOBALS._bNoBullsEye) { @@ -626,9 +616,7 @@ void TonyGenericTake1(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); GLOBALS._tony->take(nDirection, 0); - GLOBALS.Unfreeze(); if (!GLOBALS._bSkipIdle) CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); @@ -642,16 +630,12 @@ void TonyGenericTake2(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); GLOBALS._tony->take(nDirection, 1); - GLOBALS.Unfreeze(); if (!GLOBALS._bSkipIdle) CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); - GLOBALS.Freeze(); GLOBALS._tony->take(nDirection, 2); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -662,9 +646,7 @@ void TonyGenericPut1(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); GLOBALS._tony->put(nDirection, 0); - GLOBALS.Unfreeze(); if (!GLOBALS._bSkipIdle) CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); @@ -678,16 +660,12 @@ void TonyGenericPut2(CORO_PARAM, uint32 nDirection) { CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); GLOBALS._tony->put(nDirection, 1); - GLOBALS.Unfreeze(); if (!GLOBALS._bSkipIdle) CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern); - GLOBALS.Freeze(); GLOBALS._tony->put(nDirection, 2); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -1250,10 +1228,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.Unfreeze(); } CORO_END_CODE; @@ -1315,10 +1291,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.Unfreeze(); } @@ -1336,10 +1310,8 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui _ctx->pt._y = _ctx->startpt._y - _ctx->dimy; } - GLOBALS.Freeze(); GLOBALS._loc->setScrollPosition(_ctx->pt); GLOBALS._tony->setScrollPosition(_ctx->pt); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -1392,10 +1364,8 @@ DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32, while (g_vm->getTime() < _ctx->curTime + nScosse) { 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.Unfreeze(); _ctx->i = g_vm->_randomSource.getRandomNumber(2); @@ -1405,10 +1375,8 @@ DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32, _ctx->diry = -_ctx->diry; } - GLOBALS.Freeze(); GLOBALS._loc->setFixedScroll(RMPoint(0, 0)); GLOBALS._tony->setFixedScroll(RMPoint(0, 0)); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -1471,16 +1439,12 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess _ctx->pt = GLOBALS._character[nChar]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition(); if (GLOBALS._character[nChar]._startTalkPattern != 0) { - GLOBALS.Freeze(); GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._startTalkPattern); - GLOBALS.Unfreeze(); CORO_INVOKE_0(GLOBALS._character[nChar]._item->waitForEndPattern); } - GLOBALS.Freeze(); GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._talkPattern); - GLOBALS.Unfreeze(); _ctx->curVoc = SearchVoiceHeader(0, dwMessage); _ctx->voice = NULL; @@ -1551,15 +1515,11 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess } if (GLOBALS._character[nChar]._endTalkPattern != 0) { - GLOBALS.Freeze(); GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._endTalkPattern); - GLOBALS.Unfreeze(); CORO_INVOKE_0(GLOBALS._character[nChar]._item->waitForEndPattern); } - GLOBALS.Freeze(); GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._standPattern); - GLOBALS.Unfreeze(); delete _ctx->msg; CORO_END_CODE; @@ -1845,9 +1805,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg _ctx->pt = GLOBALS._character[nPers]._item->calculatePos() - RMPoint(-60, 20) - GLOBALS._loc->scrollPosition(); if (GLOBALS._character[nPers]._startTalkPattern != 0) { - GLOBALS.Freeze(); GLOBALS._character[nPers]._item->setPattern(GLOBALS._character[nPers]._startTalkPattern); - GLOBALS.Unfreeze(); CORO_INVOKE_0(GLOBALS._character[nPers]._item->waitForEndPattern); } @@ -1925,9 +1883,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg if (nPers != 0) { if (!GLOBALS._isMChar[nPers]) { if (GLOBALS._character[nPers]._endTalkPattern != 0) { - GLOBALS.Freeze(); GLOBALS._character[nPers]._item->setPattern(GLOBALS._character[nPers]._endTalkPattern); - GLOBALS.Unfreeze(); CORO_INVOKE_0(GLOBALS._character[nPers]._item->waitForEndPattern); } @@ -2023,9 +1979,7 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr 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()); - GLOBALS.Unfreeze(); } // Hide the pointer @@ -2298,7 +2252,7 @@ DECLARE_CUSTOM_FUNCTION(MustSkipIdleEnd)(CORO_PARAM, uint32, uint32, uint32, uin } DECLARE_CUSTOM_FUNCTION(PatIrqFreeze)(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) { - GLOBALS._bPatIrqFreeze = bStatus; + // Unused in ScummVM. } DECLARE_CUSTOM_FUNCTION(OpenInitLoadMenu)(CORO_PARAM, uint32, uint32, uint32, uint32) { @@ -2307,9 +2261,7 @@ DECLARE_CUSTOM_FUNCTION(OpenInitLoadMenu)(CORO_PARAM, uint32, uint32, uint32, ui CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); CORO_INVOKE_0(g_vm->openInitLoadMenu); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -2320,9 +2272,7 @@ DECLARE_CUSTOM_FUNCTION(OpenInitOptions)(CORO_PARAM, uint32, uint32, uint32, uin CORO_BEGIN_CODE(_ctx); - GLOBALS.Freeze(); CORO_INVOKE_0(g_vm->openInitOptions); - GLOBALS.Unfreeze(); CORO_END_CODE; } @@ -2575,8 +2525,6 @@ void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation GLOBALS.LoadLocation = mainLoadLocation; GLOBALS.UnloadLocation = mainUnloadLocation; GLOBALS.LinkGraphicTask = mainLinkGraphicTask; - GLOBALS.Freeze = mainFreeze; - GLOBALS.Unfreeze = mainUnfreeze; GLOBALS.WaitFrame = mainWaitFrame; GLOBALS.PlayMusic = mainPlayMusic; GLOBALS.InitWipe = mainInitWipe; diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp index 41dfa1f7bfc4..ece418d9a82f 100644 --- a/engines/tony/font.cpp +++ b/engines/tony/font.cpp @@ -1072,10 +1072,8 @@ void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) { _ctx->elaps = 0; while (_ctx->elaps < 700) { CORO_INVOKE_0(mainWaitFrame); - mainFreeze(); _ctx->elaps = g_vm->getTime() - _ctx->starttime; _ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * _ctx->elaps) / 100; - mainUnfreeze(); } _ptDrawPos._y = _ctx->destpt._y; @@ -1116,10 +1114,8 @@ void RMDialogChoice::hide(CORO_PARAM) { _ctx->elaps = 0; while (_ctx->elaps < 700) { CORO_INVOKE_0(mainWaitFrame); - mainFreeze(); _ctx->elaps = g_vm->getTime() - _ctx->starttime; _ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100; - mainUnfreeze(); } } diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index e832b9687e63..1958adfaa0c8 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -59,14 +59,6 @@ void mainLinkGraphicTask(RMGfxTask *task) { g_vm->getEngine()->linkGraphicTask(task); } -void mainFreeze() { - g_vm->getEngine()->freeze(); -} - -void mainUnfreeze() { - g_vm->getEngine()->unfreeze(); -} - void mainWaitFrame(CORO_PARAM) { CoroScheduler.waitForSingleObject(coroParam, g_vm->_hEndOfFrame, CORO_INFINITE); } diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index e8a5df29e9aa..da8218fa996a 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -65,7 +65,6 @@ RMGfxEngine::RMGfxEngine() { _bigBuf.offsetY(RM_SKIPY); _bigBuf.setTrackDirtyRects(true); - _csMainLoop = NULL; _nCurLoc = 0; _curAction = TA_GOTO; _curActionObj = 0; @@ -86,7 +85,6 @@ RMGfxEngine::RMGfxEngine() { RMGfxEngine::~RMGfxEngine() { // Close the buffer _bigBuf.destroy(); - g_system->deleteMutex(_csMainLoop); } void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { @@ -144,8 +142,6 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { CORO_BEGIN_CODE(_ctx); - g_system->lockMutex(_csMainLoop); - // Poll of input devices _input.poll(); @@ -350,8 +346,6 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { } } - g_system->unlockMutex(_csMainLoop); - CORO_END_CODE; } @@ -367,11 +361,7 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { - if (GLOBALS._bPatIrqFreeze) - mainFreeze(); item->setPattern(nPattern, true); - if (GLOBALS._bPatIrqFreeze) - mainUnfreeze(); } if (nStatus != -1) item->setStatus(nStatus); @@ -454,8 +444,6 @@ void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE); } - mainFreeze(); - _bLocationLoaded = false; _bigBuf.clearOT(); @@ -482,8 +470,6 @@ void RMGfxEngine::init() { g_vm->_window.getNewFrame(*this, NULL); g_vm->_window.repaint(); - GLOBALS._bPatIrqFreeze = true; - // Activate GUI _bGUIOption = true; _bGUIInterface = true; @@ -496,9 +482,6 @@ void RMGfxEngine::init() { _bWiping = false; _hWipeEvent = CoroScheduler.createEvent(false, false); - // Create the freeze event - _csMainLoop = g_system->createMutex(); - // Initialize the IRQ function for items for MPAL GLOBALS._gfxEngine = this; mpalInstallItemIrq(itemIrq); @@ -549,14 +532,6 @@ void RMGfxEngine::disableMouse() { _bAlwaysDrawMouse = false; } -void RMGfxEngine::freeze() { - g_system->lockMutex(_csMainLoop); -} - -void RMGfxEngine::unfreeze() { - g_system->unlockMutex(_csMainLoop); -} - void CharsSaveAll(Common::OutSaveFile *f); void CharsLoadAll(Common::InSaveFile *f); void MCharResetCodes(); @@ -812,7 +787,6 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { CORO_INVOKE_2(unloadLocation, false, NULL); loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); _tony.setPattern(RMTony::PAT_STANDRIGHT); - mainUnfreeze(); // On older versions, need to an enter action if (_ctx->ver < 5) diff --git a/engines/tony/gfxengine.h b/engines/tony/gfxengine.h index 7206496aaa7b..2e22e1ca620d 100644 --- a/engines/tony/gfxengine.h +++ b/engines/tony/gfxengine.h @@ -63,7 +63,6 @@ class RMGfxEngine { int _nCurLoc; RMTonyAction _curAction; int _curActionObj; - OSystem::MutexRef _csMainLoop; int _nWipeType; uint32 _hWipeEvent; @@ -126,10 +125,6 @@ class RMGfxEngine { void unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result); int getCurrentLocation() const { return _nCurLoc; } - // Freeze and unfreeze - void freeze(); - void unfreeze(); - // State management void saveState(const Common::String &fn, byte *curThumb, const Common::String &name); void loadState(CORO_PARAM, const Common::String &fn); diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp index dd35d8c5ec38..50ae2e529a6e 100644 --- a/engines/tony/globals.cpp +++ b/engines/tony/globals.cpp @@ -44,8 +44,6 @@ Globals::Globals() { LoadLocation = NULL; UnloadLocation = NULL; LinkGraphicTask = NULL; - Freeze = NULL; - Unfreeze = NULL; WaitFrame = NULL; PlayMusic = NULL; WaitWipeEnd = NULL; @@ -58,7 +56,6 @@ Globals::Globals() { _dwTonyNumTexts = 0; _bTonyInTexts = false; _bStaticTalk = false; - _bPatIrqFreeze = false; _bAlwaysDisplay = false; _bIdleExited = false; _bSkipSfxNoLoop = false; diff --git a/engines/tony/globals.h b/engines/tony/globals.h index 483ced181708..19276237c2a7 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -191,7 +191,6 @@ class Globals { RMTextDialog *_curBackText; bool _bTonyIsSpeaking; int _curChangedHotspot; - bool _bPatIrqFreeze; bool _bCfgInvLocked; bool _bCfgInvNoScroll; bool _bCfgTimerizedText; @@ -227,8 +226,6 @@ class Globals { uint32(*LoadLocation)(int, RMPoint, RMPoint start); void (*UnloadLocation)(CORO_PARAM, bool bDoOnExit, uint32 *result); void (*LinkGraphicTask)(RMGfxTask *task); - void (*Freeze)(); - void (*Unfreeze)(); void (*WaitFrame)(CORO_PARAM); void (*PlayMusic)(int nChannel, const char *fileName, int nFX, bool bLoop, int nSync); void (*WaitWipeEnd)(CORO_PARAM); diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 05c195f8ba4f..18eccf461598 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -556,10 +556,8 @@ void TonyEngine::autoSave(CORO_PARAM) { grabThumbnail(); CORO_INVOKE_0(mainWaitFrame); CORO_INVOKE_0(mainWaitFrame); - mainFreeze(); _ctx->buf = getSaveStateFileName(0); _theEngine.saveState(_ctx->buf, (byte *)_curThumbnail, "Autosave"); - mainUnfreeze(); CORO_END_CODE; } diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp index 9caa10bd4672..c80203fae2ea 100644 --- a/engines/tony/tonychar.cpp +++ b/engines/tony/tonychar.cpp @@ -589,7 +589,6 @@ bool RMTony::startTalkCalculate(CharacterTalkType nTalkType, int &headStartPat, if (_bShepherdess) { // Talking whilst a shepherdess - mainFreeze(); switch (_talkDirection) { case UP: setPattern(PAT_PAST_TALKUP); @@ -607,7 +606,6 @@ bool RMTony::startTalkCalculate(CharacterTalkType nTalkType, int &headStartPat, setPattern(PAT_PAST_TALKRIGHT); break; } - mainUnfreeze(); return false; } @@ -1118,10 +1116,8 @@ void RMTony::startTalk(CORO_PARAM, CharacterTalkType nTalkType) { // Perform the set pattern if (_ctx->headStartPat != 0 || _ctx->bodyStartPat != 0) { - mainFreeze(); setPattern(_ctx->headStartPat); _body.setPattern(_ctx->bodyStartPat); - mainUnfreeze(); if (_ctx->bodyStartPat != 0) CORO_INVOKE_0(_body.waitForEndPattern); @@ -1129,11 +1125,9 @@ void RMTony::startTalk(CORO_PARAM, CharacterTalkType nTalkType) { CORO_INVOKE_0(waitForEndPattern); } - mainFreeze(); setPattern(_ctx->headLoopPat); if (_ctx->bodyLoopPat) _body.setPattern(_ctx->bodyLoopPat); - mainUnfreeze(); CORO_END_CODE; } @@ -1166,9 +1160,7 @@ bool RMTony::endTalkCalculate(int &headStandPat, int &headEndPat, int &bodyEndPa } if (_bShepherdess) { - mainFreeze(); setPattern(finalPat); - mainUnfreeze(); _bIsTalking = false; return false; } @@ -1437,7 +1429,6 @@ void RMTony::endTalk(CORO_PARAM) { // Handles the end of an animated and static, leaving everything unchanged if (_bIsStaticTalk) { if (_nTalkType == TALK_WITHBEARDSTATIC) { - mainFreeze(); setPattern(0); if (_talkDirection == UP || _talkDirection == LEFT) { _body.setPattern(BPAT_WITHBEARDLEFT_STATIC); @@ -1446,11 +1437,8 @@ void RMTony::endTalk(CORO_PARAM) { _body.setPattern(BPAT_WITHBEARDRIGHT_STATIC); _nBodyOffset.set(-26, -14); } - mainUnfreeze(); } else { - mainFreeze(); setPattern(_ctx->headStandPat); - mainUnfreeze(); CORO_INVOKE_0(_body.waitForEndPattern); } @@ -1461,36 +1449,26 @@ void RMTony::endTalk(CORO_PARAM) { // Set the pattern if (_ctx->headEndPat != 0 && _ctx->bodyEndPat != 0) { - mainFreeze(); setPattern(_ctx->headEndPat); - mainUnfreeze(); CORO_INVOKE_0(_body.waitForEndPattern); - mainFreeze(); _body.setPattern(_ctx->bodyEndPat); - mainUnfreeze(); CORO_INVOKE_0(waitForEndPattern); CORO_INVOKE_0(_body.waitForEndPattern); } else if (_ctx->bodyEndPat != 0) { - mainFreeze(); setPattern(_ctx->headStandPat); - mainUnfreeze(); CORO_INVOKE_0(_body.waitForEndPattern); - mainFreeze(); _body.setPattern(_ctx->bodyEndPat); - mainUnfreeze(); CORO_INVOKE_0(_body.waitForEndPattern); } else if (_ctx->headEndPat != 0) { CORO_INVOKE_0(_body.waitForEndPattern); - mainFreeze(); setPattern(_ctx->headEndPat); - mainUnfreeze(); CORO_INVOKE_0(waitForEndPattern); } else { @@ -1498,10 +1476,8 @@ void RMTony::endTalk(CORO_PARAM) { } if (_ctx->finalPat != 0) { - mainFreeze(); _body.setPattern(0); setPattern(_ctx->finalPat); - mainUnfreeze(); } _bIsTalking = false; @@ -1733,19 +1709,15 @@ void RMTony::startStatic(CORO_PARAM, CharacterTalkType nTalk) { // e vai con i pattern _bIsStaticTalk = true; - mainFreeze(); setPattern(_ctx->headPat); _body.setPattern(_ctx->bodyStartPat); - mainUnfreeze(); CORO_INVOKE_0(_body.waitForEndPattern); CORO_INVOKE_0(waitForEndPattern); - mainFreeze(); if (_ctx->headLoopPat != -1) setPattern(_ctx->headLoopPat); _body.setPattern(_ctx->bodyLoopPat); - mainUnfreeze(); CORO_END_CODE; } @@ -1902,24 +1874,18 @@ void RMTony::endStatic(CORO_PARAM, CharacterTalkType nTalk) { endStaticCalculate(nTalk, _ctx->bodyEndPat, _ctx->finalPat, _ctx->headEndPat); if (_ctx->headEndPat != 0) { - mainFreeze(); setPattern(_ctx->headEndPat); - mainUnfreeze(); CORO_INVOKE_0(waitForEndPattern); } else { // Play please - mainFreeze(); _body.setPattern(_ctx->bodyEndPat); - mainUnfreeze(); CORO_INVOKE_0(_body.waitForEndPattern); } - mainFreeze(); setPattern(_ctx->finalPat); _body.setPattern(0); - mainUnfreeze(); _bIsStaticTalk = false;