diff options
-rw-r--r-- | engines/tony/gfxengine.cpp | 19 | ||||
-rw-r--r-- | engines/tony/globals.cpp | 1 | ||||
-rw-r--r-- | engines/tony/globals.h | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 4a0fdc0795..a2b58f660e 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -361,28 +361,21 @@ void RMGfxEngine::InitCustomDll(void) { SetupGlobalVars(&m_tony, &m_point, &_vm->_theBoxes, &m_loc, &m_inv, &m_input); } -// FIXME: Casting nPattern from int to RMGfxEngine * void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { - static RMGfxEngine *This = NULL; RMItem *item; + assert(GLOBALS.GfxEngine); - // Inizializzazione! - if ((int)dwItem == -1) { - This = (RMGfxEngine*)nPattern; - return; - } - - if (This->m_bLocationLoaded) { - item=This->m_loc.GetItemFromCode(dwItem); + if (GLOBALS.GfxEngine->m_bLocationLoaded) { + item = GLOBALS.GfxEngine->m_loc.GetItemFromCode(dwItem); if (item != NULL) { - if (nPattern!=-1) { + if (nPattern != -1) { if (GLOBALS.bPatIrqFreeze) MainFreeze(); item->SetPattern(nPattern,true); if (GLOBALS.bPatIrqFreeze) MainUnfreeze(); } - if (nStatus!=-1) + if (nStatus != -1) item->SetStatus(nStatus); } } @@ -597,7 +590,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { csMainLoop = g_system->createMutex(); // Inizializza la funzione di IRQ di Item per l'MPAL - ItemIrq((uint32)-1, (uint32)this, 0); + GLOBALS.GfxEngine = this; mpalInstallItemIrq(ItemIrq); // Inizializza DirectInput diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp index 0ce99f88e7..867d48e0fa 100644 --- a/engines/tony/globals.cpp +++ b/engines/tony/globals.cpp @@ -40,6 +40,7 @@ Globals::Globals() { Loc = NULL; Inventory = NULL; Input = NULL; + GfxEngine = NULL; LoadLocation = NULL; UnloadLocation = NULL; LinkGraphicTask = NULL; diff --git a/engines/tony/globals.h b/engines/tony/globals.h index 1a11a871d0..72faa6a6c5 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -25,6 +25,7 @@ #include "common/savefile.h" #include "tony/adv.h" +#include "tony/gfxengine.h" #include "tony/input.h" #include "tony/inventory.h" #include "tony/loc.h" @@ -216,6 +217,7 @@ public: RMLocation *Loc; RMInventory *Inventory; RMInput *Input; + RMGfxEngine *GfxEngine; uint32 (*LoadLocation)(int, RMPoint, RMPoint start); void (*UnloadLocation)(CORO_PARAM, bool bDoOnExit, uint32 *result); |