mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 08:53:51 +00:00
HOPKINS: Misc cleanup
This commit is contained in:
parent
0b16ea3f3b
commit
2ee8b1e342
@ -207,7 +207,7 @@ byte *Globals::allocMemory(int count) {
|
||||
}
|
||||
|
||||
byte *Globals::freeMemory(byte *p) {
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -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 +
|
||||
|
@ -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];
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user