From b01482bddb6d8f0b0be4dd46ee7c9e4141908673 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 23:05:41 +1000 Subject: TONY: Further globals added to Globals class --- engines/tony/font.cpp | 13 +++++-------- engines/tony/font.h | 2 +- engines/tony/globals.cpp | 1 + engines/tony/input.cpp | 5 ++--- engines/tony/loc.cpp | 2 +- engines/tony/sound.cpp | 8 ++++---- engines/tony/tony.cpp | 4 ++++ engines/tony/tonychar.cpp | 4 ++++ engines/tony/tonychar.h | 1 + engines/tony/window.cpp | 1 - 10 files changed, 23 insertions(+), 18 deletions(-) diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp index dee3c3228a..8957c09a87 100644 --- a/engines/tony/font.cpp +++ b/engines/tony/font.cpp @@ -1816,9 +1816,12 @@ void RMFontObj::Init(void) { \****************************************************************************/ RMFontColor *RMText::m_fonts[4] = { NULL, NULL, NULL, NULL }; -OSystem::MutexRef RMText::m_cs; RMGfxClearTask RMText::m_clear; +void RMText::InitStatics() { + Common::fill(&m_fonts[0], &m_fonts[4], (RMFontColor *)NULL); +} + RMText::RMText() { // Colore di default: bianco m_r = m_g = m_b = 255; @@ -1843,8 +1846,6 @@ void RMText::Unload() { delete m_fonts[2]; delete m_fonts[3]; m_fonts[0] = m_fonts[1] = m_fonts[2] = m_fonts[3] = 0; - - g_system->unlockMutex(m_cs); } } @@ -1866,13 +1867,9 @@ void RMText::WriteText(const RMString &text, int nFont, int *time) { m_fonts[1] = new RMFontObj; m_fonts[1]->Init(); m_fonts[2] = new RMFontMacc; m_fonts[2]->Init(); m_fonts[3] = new RMFontCredits; m_fonts[3]->Init(); - - m_cs = g_system->createMutex(); } - g_system->lockMutex(m_cs); - WriteText(text,m_fonts[nFont],time); - g_system->unlockMutex(m_cs); + WriteText(text, m_fonts[nFont], time); } diff --git a/engines/tony/font.h b/engines/tony/font.h index a63c90638d..36fdc9baed 100644 --- a/engines/tony/font.h +++ b/engines/tony/font.h @@ -188,7 +188,6 @@ class RMText : public RMGfxWoodyBuffer { private: static RMFontColor *m_fonts[4]; static RMGfxClearTask m_clear; - static OSystem::MutexRef m_cs; int maxLineLength; public: @@ -216,6 +215,7 @@ protected: public: RMText(); virtual ~RMText(); + static void InitStatics(); static void Unload(); // Setta il tipo di allineamento diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp index c39ba215b4..9bc9ea5d7c 100644 --- a/engines/tony/globals.cpp +++ b/engines/tony/globals.cpp @@ -88,6 +88,7 @@ Globals::Globals() { lastTappeto = 0; Common::fill(&tappeti[0], &tappeti[200], 0); SFM_nLoc = 0; + vdb = NULL; } } // End of namespace Tony diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp index fcd56b5989..f29d4ddc8e 100644 --- a/engines/tony/input.cpp +++ b/engines/tony/input.cpp @@ -49,8 +49,6 @@ namespace Tony { -#define DIRELEASE(x) if (x) { (x)->Release(); (x)=NULL; } - RMInput::RMInput() { // Setup mouse fields _clampMouse = false; @@ -128,7 +126,8 @@ bool RMInput::MouseRight() { } /** - * Return true if a key has been pressed */ + * Return true if a key has been pressed + */ bool RMInput::GetAsyncKeyState(Common::KeyCode kc) { // The act of testing for a particular key automatically clears the state, to prevent // the same key being registered in multiple different frames diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index 306322f2ad..70e800a5d4 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -864,7 +864,7 @@ RMItem::~RMItem() { CoroScheduler.closeEvent(m_hEndPattern); } -//FIXME: Pass uint32 directly for hCustomSkip + void RMItem::WaitForEndPattern(CORO_PARAM, uint32 hCustomSkip) { CORO_BEGIN_CONTEXT; uint32 h[2]; diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index 53d3b962d2..61d225b88b 100644 --- a/engines/tony/sound.cpp +++ b/engines/tony/sound.cpp @@ -113,8 +113,8 @@ public: class CODECADPCM : public CODECRAW { protected: byte *lpTemp; - static int indexTable[16]; - static int stepSizeTable[89]; + static const int indexTable[16]; + static const int stepSizeTable[89]; public: CODECADPCM(bool bLoop = true, byte *lpTempBuffer = NULL); @@ -298,12 +298,12 @@ uint32 CODECRAW::Decompress(Common::File &fp, void *buf, uint32 dwSize) { * Metodi per CODECADPCM \****************************************************************************/ -int CODECADPCM::indexTable[16] = { +const int CODECADPCM::indexTable[16] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8, }; -int CODECADPCM::stepSizeTable[89] = { +const int CODECADPCM::stepSizeTable[89] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 1b4a11df0c..aa110ce008 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -77,6 +77,10 @@ Common::ErrorCode TonyEngine::Init() { m_bDrawLocation = true; m_startTime = g_system->getMillis(); + // Init static class fields + RMText::InitStatics(); + RMTony::InitStatics(); + // Reset the scheduler CoroScheduler.reset(); diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp index 072e822c36..7430ca89ae 100644 --- a/engines/tony/tonychar.cpp +++ b/engines/tony/tonychar.cpp @@ -59,6 +59,10 @@ namespace Tony { bool RMTony::m_bAction = false; +void RMTony::InitStatics() { + m_bAction = false; +} + RMTony::RMTony() { m_bShow = false; m_bShowOmbra = false; diff --git a/engines/tony/tonychar.h b/engines/tony/tonychar.h index ee6d518f4b..27d62d9d57 100644 --- a/engines/tony/tonychar.h +++ b/engines/tony/tonychar.h @@ -378,6 +378,7 @@ public: // per farlo rialzare, altrimenti private }; public: + static void InitStatics(); RMTony(); // Inizializza Tony diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index f997b8c53d..18e6901547 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -53,7 +53,6 @@ namespace Tony { -#define DDRELEASE(x) if (x) { (x)->Release(); (x)=NULL; } /****************************************************************************\ * RMWindow Methods -- cgit v1.2.3