diff options
author | Strangerke | 2013-04-05 01:43:10 +0200 |
---|---|---|
committer | Strangerke | 2013-04-05 07:54:56 +0200 |
commit | 2ee8b1e342eca39602b2e5fc8cbdb9f505d49bcb (patch) | |
tree | 363ddc84c1ea62b76afc532a0759902fd62dadb2 /engines | |
parent | 0b16ea3f3b21012d4a5c9dcf857827e35038fe16 (diff) | |
download | scummvm-rg350-2ee8b1e342eca39602b2e5fc8cbdb9f505d49bcb.tar.gz scummvm-rg350-2ee8b1e342eca39602b2e5fc8cbdb9f505d49bcb.tar.bz2 scummvm-rg350-2ee8b1e342eca39602b2e5fc8cbdb9f505d49bcb.zip |
HOPKINS: Misc cleanup
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/globals.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 16 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 18 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 6 |
6 files changed, 24 insertions, 24 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 83cfa44106..ede4a1eb26 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -207,7 +207,7 @@ byte *Globals::allocMemory(int count) { } byte *Globals::freeMemory(byte *p) { - if (p != NULL) + if (p) free(p); return NULL; } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7a965146e7..59adc0e9fc 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1238,7 +1238,7 @@ void GraphicsManager::restoreSurfaceRect(byte *destSurface, const byte *src, int /** * Compute the value of a parameter plus a given percentage */ -int GraphicsManager::zoomIn(int val, int percentage ) { +int GraphicsManager::zoomIn(int val, int percentage) { if (val) val += percentage * (long int)val / 100; @@ -1852,7 +1852,7 @@ void GraphicsManager::backupScreen() { * Restore a previously backed up screen */ void GraphicsManager::restoreScreen() { - assert(_vm->_graphicsManager->_backupScreen != NULL); + assert(_vm->_graphicsManager->_backupScreen); // Restore the screen and free the buffer Common::copy(_vm->_graphicsManager->_backupScreen, _vm->_graphicsManager->_backupScreen + diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index e5d8ffae0f..38d7448bc2 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -89,11 +89,11 @@ LinesManager::LinesManager(HopkinsEngine *vm) { LinesManager::~LinesManager() { _vm->_globals->freeMemory(_largeBuf); - if (_testRoute0 != NULL) + if (_testRoute0) delete[] _testRoute0; - if (_testRoute1 != NULL) + if (_testRoute1) delete[] _testRoute1; - if (_testRoute2 != NULL) + if (_testRoute2) delete[] _testRoute2; } @@ -220,7 +220,7 @@ void LinesManager::addZoneLine(int idx, int fromX, int fromY, int destX, int des maxDist += distX; zoneData = (int16 *)_vm->_globals->allocMemory(2 * sizeof(int16) * maxDist + (4 * sizeof(int16))); - assert(zoneData != NULL); + assert(zoneData); _zoneLine[idx]._zoneData = zoneData; @@ -265,7 +265,7 @@ void LinesManager::addLine(int lineIdx, Directions direction, int fromX, int fro maxDist = distX; byte *zoneData = _vm->_globals->allocMemory(4 * maxDist + 8); - assert (zoneData != NULL); + assert (zoneData); Common::fill(zoneData, zoneData + 4 * maxDist + 8, 0); _lineItem[lineIdx]._lineData = (int16 *)zoneData; @@ -800,7 +800,7 @@ int LinesManager::computeRouteIdx(int lineIdx, int dataIdx, int fromX, int fromY if (_lastLine - 1 != curLineIdx) { endLineIdx = 2 * _lineItem[curLineIdx]._lineDataEndIdx; lineData = _lineItem[curLineIdx]._lineData; - if (lineData != NULL) + if (lineData) continue; } loopCond = true; @@ -835,7 +835,7 @@ int LinesManager::computeRouteIdx(int lineIdx, int dataIdx, int fromX, int fromY if (curLineIdx != _linesNumb + 1) { nextLineDataEndIdx = 2 * _lineItem[curLineIdx]._lineDataEndIdx; lineData = _lineItem[curLineIdx]._lineData; - if (lineData != NULL) + if (lineData) continue; } loopCond = true; @@ -2649,7 +2649,7 @@ int LinesManager::checkCollision(int xp, int yp) { do { LigneZoneItem *curZoneLine = &_zoneLine[curZoneLineIdx]; int16 *dataP = curZoneLine->_zoneData; - if (dataP != NULL) { + if (dataP) { int count = curZoneLine->_count; int startX = dataP[0]; int startY = dataP[1]; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 28d6f16a54..c92fcbe9bf 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -201,7 +201,7 @@ byte *ObjectsManager::loadObjectFromFile(int objIndex, bool mode) { ++idx; if (objectFileNum != _curObjectFileNum) { - if (_objectDataBuf != NULL) + if (_objectDataBuf) removeObjectDataBuf(); if (objectFileNum == 1) { _objectDataBuf = loadSprite("OBJET1.SPR"); @@ -1024,7 +1024,7 @@ void ObjectsManager::displayBobAnim() { _bob[idx]._xp = READ_LE_INT16(dataPtr + 2 * dataIdx); if (_lockedAnims[idx]._enableFl) _bob[idx]._xp = _lockedAnims[idx]._posX; - if ( _charactersEnabledFl && idx > 20 ) + if ( _charactersEnabledFl && idx > 20) _bob[idx]._xp += _vm->_eventsManager->_startPos.x; _bob[idx]._yp = READ_LE_INT16(dataPtr + 2 * dataIdx + 2); @@ -1610,8 +1610,8 @@ void ObjectsManager::GOHOME() { if (_oldDirection != newDirection) break; if ((newDirection == DIR_RIGHT && newPosX >= oldPosX) || (_oldDirection == DIR_LEFT && newPosX <= oldPosX) || - (_oldDirection == DIR_UP && newPosY <= oldPosY) || (_oldDirection == DIR_DOWN && newPosY >= oldPosY) || - (_oldDirection == DIR_UP_RIGHT && newPosX >= oldPosX) || (_oldDirection == DIR_UP_LEFT && newPosX <= oldPosX) || + (_oldDirection == DIR_UP && newPosY <= oldPosY) || (_oldDirection == DIR_DOWN && newPosY >= oldPosY) || + (_oldDirection == DIR_UP_RIGHT && newPosX >= oldPosX) || (_oldDirection == DIR_UP_LEFT && newPosX <= oldPosX) || (_oldDirection == DIR_DOWN_RIGHT && newPosX >= oldPosX) || (_oldDirection == DIR_DOWN_LEFT && newPosX <= oldPosX)) loopCond = true; } while (!loopCond); @@ -1973,12 +1973,12 @@ void ObjectsManager::handleLeftButton() { _oldDirection = DIR_NONE; } else { _vm->_linesManager->_route = _vm->_linesManager->findRoute(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); - if (_vm->_linesManager->_route != NULL) + if (_vm->_linesManager->_route) _vm->_linesManager->optimizeRoute(_vm->_linesManager->_route); _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); _homeRateCounter = 0; - if (_vm->_linesManager->_route != NULL || oldRoute == _vm->_linesManager->_route) { + if (_vm->_linesManager->_route || oldRoute == _vm->_linesManager->_route) { _oldDirection = DIR_NONE; } else { _vm->_linesManager->_route = oldRoute; @@ -1987,12 +1987,12 @@ void ObjectsManager::handleLeftButton() { } else { if (!_vm->_globals->_freezeCharacterFl && !_vm->_globals->_cityMapEnabledFl) { _vm->_linesManager->_route = _vm->_linesManager->findRoute(getSpriteX(0), getSpriteY(0), destX, destY); - if (_vm->_linesManager->_route != NULL) + if (_vm->_linesManager->_route) _vm->_linesManager->optimizeRoute(_vm->_linesManager->_route); _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); _homeRateCounter = 0; - if (_vm->_linesManager->_route != NULL || oldRoute == _vm->_linesManager->_route) + if (_vm->_linesManager->_route || oldRoute == _vm->_linesManager->_route) _oldDirection = DIR_NONE; else _vm->_linesManager->_route = oldRoute; @@ -3769,7 +3769,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo do { GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != NULL); + } while (_vm->_linesManager->_route); setSpriteIndex(0, 64); } do { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e192516707..909f563a3c 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -728,7 +728,7 @@ void SoundManager::playSample(int wavIndex, int voiceMode) { bool SoundManager::checkVoiceStatus(int voiceIndex) { if (_voice[voiceIndex]._status) { int wavIndex = _voice[voiceIndex]._wavIndex; - if (_sWav[wavIndex]._audioStream != NULL && _sWav[wavIndex]._audioStream->endOfStream()) + if (_sWav[wavIndex]._audioStream && _sWav[wavIndex]._audioStream->endOfStream()) stopVoice(voiceIndex); } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2b0e00392a..7e665915d7 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -528,7 +528,7 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) { f.seek(indexData[idx]); byte *decryptBuf = _vm->_globals->allocMemory(2058); - assert(decryptBuf != NULL); + assert(decryptBuf); f.read(decryptBuf, 2048); f.close(); @@ -553,7 +553,7 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) { // Separate strings for (int i = 0; i < 2048; i++) { - if ( decryptBuf[i] == 10 || decryptBuf[i] == 13 ) + if ( decryptBuf[i] == 10 || decryptBuf[i] == 13) decryptBuf[i] = 0; } @@ -786,7 +786,7 @@ void TalkManager::handleAnswer(int zone, int verb) { // 'COD' tag found curAnswerBuf += 5; ptr = _vm->_globals->allocMemory(620); - assert(ptr != NULL); + assert(ptr); memset(ptr, 0, 620); uint16 curAnswerIdx = 0; int idx = 0; |