Skip to content

Commit

Permalink
TONY: Silent more CppCheck warnings, remove an unused global
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jun 15, 2012
1 parent 7951881 commit 7c605c5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
4 changes: 4 additions & 0 deletions engines/tony/gfxcore.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -672,6 +673,8 @@ RMGfxSourceBuffer8RLE::RMGfxSourceBuffer8RLE() {
_alphaBlendColor = -1;
_bNeedRLECompress = true;
_buf = NULL;

_alphaR = _alphaG = _alphaB = 0;
}

RMGfxSourceBuffer8RLE::~RMGfxSourceBuffer8RLE() {
Expand Down Expand Up @@ -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;
}


Expand Down
5 changes: 4 additions & 1 deletion engines/tony/globals.cpp
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion engines/tony/globals.h
Expand Up @@ -240,7 +240,6 @@ class Globals {
RMTony::TALKTYPE _nTonyNextTalkType;

RMPoint _startLocPos[256];
OSystem::MutexRef _cs[10];
uint32 _mut[10];

bool _bSkipIdle;
Expand Down
18 changes: 7 additions & 11 deletions engines/tony/inventory.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
16 changes: 16 additions & 0 deletions engines/tony/loc.cpp
Expand Up @@ -785,6 +785,7 @@ RMItem::RMItem() {
_nCurSprite = 0;

_bIsActive = false;
memset(_pal._data, 0, sizeof(_pal._data));

_hEndPattern = CoroScheduler.createEvent(false, false);
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -1681,6 +1689,8 @@ RMCharacter::RMCharacter() {
_bMovingWithoutMinpath = false;
_bDrawNow = false;
_bNeedToStop = false;

memset(_path, 0, sizeof(_path));

_pos.set(0, 0);
}
Expand Down Expand Up @@ -1748,6 +1758,7 @@ RMDataStream &operator>>(RMDataStream &ds, RMBox &box) {

RMBoxLoc::RMBoxLoc() {
_boxes = NULL;
_numbBox = 0;
}

RMBoxLoc::~RMBoxLoc() {
Expand Down Expand Up @@ -1936,6 +1947,8 @@ RMLocation::RMLocation() {
_nItems = 0;
_items = NULL;
_buf = NULL;
TEMPNumLoc = 0;
_cmode = CM_256;
}


Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 7c605c5

Please sign in to comment.