From 7c605c5f69e350e87801912babdf5b3cd65024d3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Jun 2012 08:23:06 +0200 Subject: [PATCH] TONY: Silent more CppCheck warnings, remove an unused global --- engines/tony/gfxcore.cpp | 4 ++++ engines/tony/globals.cpp | 5 ++++- engines/tony/globals.h | 1 - engines/tony/inventory.cpp | 18 +++++++----------- engines/tony/loc.cpp | 16 ++++++++++++++++ 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 37fc9479122b..2f38f5d05d74 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -548,6 +548,7 @@ void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit RMGfxSourceBuffer8::RMGfxSourceBuffer8(int dimx, int dimy, bool bUseDDraw) : RMGfxBuffer(dimx, dimy, 8, bUseDDraw) { setPriority(0); + _bTrasp0 = false; } RMGfxSourceBuffer8::RMGfxSourceBuffer8(bool bTrasp0) { @@ -672,6 +673,8 @@ RMGfxSourceBuffer8RLE::RMGfxSourceBuffer8RLE() { _alphaBlendColor = -1; _bNeedRLECompress = true; _buf = NULL; + + _alphaR = _alphaG = _alphaB = 0; } RMGfxSourceBuffer8RLE::~RMGfxSourceBuffer8RLE() { @@ -1879,6 +1882,7 @@ void RMGfxSourceBuffer16::prepareImage(void) { RMGfxSourceBuffer16::RMGfxSourceBuffer16(int dimx, int dimy, bool bUseDDraw) : RMGfxBuffer(dimx, dimy, 16, bUseDDraw) { setPriority(0); + _bTrasp0 = false; } diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp index e3d36db11b37..45ab5f87225e 100644 --- a/engines/tony/globals.cpp +++ b/engines/tony/globals.cpp @@ -134,8 +134,11 @@ Globals::Globals() { _nTonyNextTalkType = RMTony::TALK_NORMAL; _saveTonyLoc = 0; - for (int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) { Common::fill((byte *)&_character[i], (byte *)&_character[i] + sizeof(CharacterStruct), 0); + _isMChar[i] = false; + } + for (int i = 0; i < 10; ++i) Common::fill((byte *)&_mCharacter[i], (byte *)&_mCharacter[i] + sizeof(MCharacterStruct), 0); for (int i = 0; i < 256; ++i) diff --git a/engines/tony/globals.h b/engines/tony/globals.h index 24825588e15e..2301e621aa1b 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -240,7 +240,6 @@ class Globals { RMTony::TALKTYPE _nTonyNextTalkType; RMPoint _startLocPos[256]; - OSystem::MutexRef _cs[10]; uint32 _mut[10]; bool _bSkipIdle; diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp index 4109e5f37112..4d824bb10ae2 100644 --- a/engines/tony/inventory.cpp +++ b/engines/tony/inventory.cpp @@ -391,13 +391,11 @@ bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) { } void RMInventory::rightClick(const RMPoint &mpos) { - int n; - assert(checkPointInside(mpos)); if (_state == OPENED && !_bCombining) { // Open the context interface - n = mpos._x / 64; + int n = mpos._x / 64; if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0) { _state = SELECTING; @@ -456,13 +454,13 @@ bool RMInventory::rightRelease(const RMPoint &mpos, RMTonyAction &curAction) { if (_state == SELECTING) { _state = OPENED; - if (_miniAction == 1) { // Esamina + if (_miniAction == 1) { // Examine curAction = TA_EXAMINE; return true; - } else if (_miniAction == 2) { // Parla + } else if (_miniAction == 2) { // Talk curAction = TA_TALK; return true; - } else if (_miniAction == 3) { // Usa + } else if (_miniAction == 3) { // Use curAction = TA_USE; return true; } @@ -474,7 +472,6 @@ bool RMInventory::rightRelease(const RMPoint &mpos, RMTonyAction &curAction) { #define INVSPEED 20 void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen) { - int i; bool bNeedRedraw = false; if (_state != CLOSED) { @@ -484,9 +481,10 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo // DoFrame makes all the objects currently in the inventory be displayed // @@@ Maybe we should do all takeable objects? Please does not help - for (i = 0; i < _nInv; i++) + for (int i = 0; i < _nInv; i++) { if (_items[_inv[i]]._icon.doFrame(this, false) && (i >= _curPos && i <= _curPos + 7)) bNeedRedraw = true; + } if ((_state == CLOSING || _state == OPENING || _state == OPENED) && checkPointInside(mpos)) { if (mpos._x > RM_SX - 64) { @@ -672,11 +670,9 @@ bool RMInventory::itemInFocus(const RMPoint &mpt) { } RMItem *RMInventory::whichItemIsIn(const RMPoint &mpt) { - int n; - if (_state == OPENED) { if (checkPointInside(mpt)) { - n = mpt._x / 64; + int n = mpt._x / 64; if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0 && (!_bCombining || _inv[n - 1 + _curPos] != _nCombine)) return &_items[_inv[n - 1 + _curPos]]._icon; } diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index 0b8398c54134..42c96076f9ce 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -785,6 +785,7 @@ RMItem::RMItem() { _nCurSprite = 0; _bIsActive = false; + memset(_pal._data, 0, sizeof(_pal._data)); _hEndPattern = CoroScheduler.createEvent(false, false); } @@ -841,6 +842,13 @@ void RMItem::pauseSound(bool bPause) { RMWipe::RMWipe() { _hUnregistered = CoroScheduler.createEvent(false, false); _hEndOfFade = CoroScheduler.createEvent(false, false); + + _bMustRegister = false; + _bUnregister = false; + _bEndFade = false; + _bFading = false; + _nFadeStep = 0; + } RMWipe::~RMWipe() { @@ -1681,6 +1689,8 @@ RMCharacter::RMCharacter() { _bMovingWithoutMinpath = false; _bDrawNow = false; _bNeedToStop = false; + + memset(_path, 0, sizeof(_path)); _pos.set(0, 0); } @@ -1748,6 +1758,7 @@ RMDataStream &operator>>(RMDataStream &ds, RMBox &box) { RMBoxLoc::RMBoxLoc() { _boxes = NULL; + _numbBox = 0; } RMBoxLoc::~RMBoxLoc() { @@ -1936,6 +1947,8 @@ RMLocation::RMLocation() { _nItems = 0; _items = NULL; _buf = NULL; + TEMPNumLoc = 0; + _cmode = CM_256; } @@ -2292,6 +2305,9 @@ RMMessage::RMMessage(uint32 dwId) { RMMessage::RMMessage() { _lpMessage = NULL; + _nPeriods = 0; + for (int i = 0; i < 256; i++) + _lpPeriods[i] = 0; } RMMessage::~RMMessage() {