diff options
author | Strangerke | 2013-04-04 07:54:45 +0200 |
---|---|---|
committer | Strangerke | 2013-04-05 07:54:54 +0200 |
commit | e79a51c20894a74ac6ed8914daccfeedbfb28849 (patch) | |
tree | f0a0e45d524453fced8d2bf48ac64d3545a08c5e /engines | |
parent | f9247f0bce0a6a6f658ddd6fe7b034f3855ffa77 (diff) | |
download | scummvm-rg350-e79a51c20894a74ac6ed8914daccfeedbfb28849.tar.gz scummvm-rg350-e79a51c20894a74ac6ed8914daccfeedbfb28849.tar.bz2 scummvm-rg350-e79a51c20894a74ac6ed8914daccfeedbfb28849.zip |
HOPKINS: Remove g_PTRNUL
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/anim.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/computer.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/dialogs.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/files.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/font.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 32 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 3 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 16 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 76 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 110 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 36 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 20 |
15 files changed, 168 insertions, 177 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 37eb4adc73..24b4c4e5d6 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -531,7 +531,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) innerLoopCond = true; if (bufSize < curBufferPos) { _animBqe[animIndex]._enabledFl = false; - _animBqe[animIndex]._data = g_PTRNUL; + _animBqe[animIndex]._data = NULL; return; } ++curBufferPos; @@ -817,12 +817,12 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u void AnimationManager::initAnimBqe() { for (int idx = 0; idx < 35; ++idx) { - _animBqe[idx]._data = g_PTRNUL; + _animBqe[idx]._data = NULL; _animBqe[idx]._enabledFl = false; } for (int idx = 0; idx < 8; ++idx) { - Bank[idx]._data = g_PTRNUL; + Bank[idx]._data = NULL; Bank[idx]._loadedFl = false; Bank[idx]._filename = ""; Bank[idx]._fileHeader = 0; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index fea8ba9b58..09ce5080b8 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -44,9 +44,9 @@ ComputerManager::ComputerManager(HopkinsEngine *vm) { memset(_menuText[i]._line, 0, 90); } Common::fill(&_inputBuf[0], &_inputBuf[200], '\0'); - _breakoutSpr = g_PTRNUL; + _breakoutSpr = NULL; _textColor = 0; - _breakoutLevel = (int16 *)g_PTRNUL; + _breakoutLevel = (int16 *)NULL; _breakoutBrickNbr = 0; _breakoutScore = 0; _breakoutLives = 0; @@ -536,9 +536,9 @@ void ComputerManager::displayGamesSubMenu() { _vm->_globals->_speed = 1; _vm->_eventsManager->changeMouseCursor(0); - _breakoutSpr = g_PTRNUL; + _breakoutSpr = NULL; _vm->_eventsManager->_breakoutFl = true; - _breakoutLevel = (int16 *)g_PTRNUL; + _breakoutLevel = (int16 *)NULL; _breakoutBrickNbr = 0; _breakoutScore = 0; _breakoutLives = 5; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index d756f0db6f..caffed67eb 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -44,9 +44,9 @@ DialogsManager::DialogsManager(HopkinsEngine *vm) { _removeInventFl = false; _inventX = _inventY = 0; _inventWidth = _inventHeight = 0; - _inventWin1 = g_PTRNUL; - _inventBuf2 = g_PTRNUL; - _inventoryIcons = g_PTRNUL; + _inventWin1 = NULL; + _inventBuf2 = NULL; + _inventoryIcons = NULL; } DialogsManager::~DialogsManager() { @@ -56,8 +56,8 @@ DialogsManager::~DialogsManager() { } void DialogsManager::clearAll() { - _inventWin1 = g_PTRNUL; - _inventBuf2 = g_PTRNUL; + _inventWin1 = NULL; + _inventBuf2 = NULL; } void DialogsManager::loadIcons() { @@ -341,7 +341,7 @@ void DialogsManager::showInventory() { _vm->_eventsManager->getMouseY(); _vm->_eventsManager->refreshScreenAndEvents(); } - _inventWin1 = g_PTRNUL; + _inventWin1 = NULL; bool loopFl; do { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 8ff91ea02a..21578b02a0 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -44,14 +44,14 @@ EventsManager::EventsManager(HopkinsEngine *vm) { _mouseSpriteId = 0; _curMouseButton = 0; _mouseButton = 0; - _mouseCursor = g_PTRNUL; + _mouseCursor = NULL; _gameCounter = 0; _rateCounter = 0; _escKeyFl = false; _gameKey = KEY_NONE; _mouseCursorId = 0; _oldIconId = 0; - _objectBuf = g_PTRNUL; + _objectBuf = NULL; Common::fill(&_keyState[0], &_keyState[256], false); _priorCounterTime = 0; diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 3f7c4e48dd..2390ebbdf8 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -239,7 +239,7 @@ byte *FileManager::searchCat(const Common::String &file, CatMode mode, bool &fil f.seek(_catalogPos); byte *catData = _vm->_globals->allocMemory(_catalogSize); - if (catData == g_PTRNUL) + if (catData == NULL) error("CHARGE_FICHIER"); readStream(f, catData, _catalogSize); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index e25c11d70e..3277ebb8c2 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -59,7 +59,7 @@ void FontManager::loadZoneText() { } void FontManager::clearAll() { - _font = g_PTRNUL; + _font = NULL; _fontFixedHeight = 0; _fontFixedWidth = 0; @@ -82,8 +82,8 @@ void FontManager::clearAll() { for (int idx = 0; idx < 4048; idx++) _index[idx] = 0; - _tempText = g_PTRNUL; - _zoneText = g_PTRNUL; + _tempText = NULL; + _zoneText = NULL; _boxWidth = 240; } @@ -214,7 +214,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in f.seek(_index[messageId]); _tempText = _vm->_globals->allocMemory(2058); - if (_tempText == g_PTRNUL) + if (_tempText == NULL) error("Error allocating text"); Common::fill(&_tempText[0], &_tempText[2058], 0); @@ -358,7 +358,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (textType == 1 || textType == 3 || textType == 5 || textType == 6) { int size = saveHeight * saveWidth; byte *ptrd = _vm->_globals->allocMemory(size); - if (ptrd == g_PTRNUL) + if (ptrd == NULL) error("Cutting a block for text box (%d)", size); _vm->_graphicsManager->copySurfaceRect(_vm->_graphicsManager->_frontBuffer, ptrd, posX, posY, saveWidth, saveHeight); @@ -389,7 +389,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._textBlock = _vm->_globals->freeMemory(_text[idx]._textBlock); int blockSize = blockHeight * blockWidth; byte *ptre = _vm->_globals->allocMemory(blockSize + 20); - if (ptre == g_PTRNUL) + if (ptre == NULL) error("Cutting a block for text box (%d)", blockSize); _text[idx]._textBlock = ptre; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index c9bd925cae..c6dbb2d372 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -32,10 +32,6 @@ namespace Hopkins { -// Global null pointer. This is needed by the engine to recognise NULL pointers, since -// there are places that differentiate between it and a 0 'error' value -byte *g_PTRNUL; - // Default data for the Hopkins array const int HOPKINS_PERSO_0[] = { @@ -65,10 +61,6 @@ const int HOPKINS_PERSO_2[] = { Globals::Globals(HopkinsEngine *vm) { _vm = vm; - // Set up the special g_PTRNUL variable - g_PTRNUL = (byte *)malloc(16); - strcpy((char *)g_PTRNUL, "POINTERNULL"); - // Initialize array properties for (int i = 0; i < 500; ++i) _spriteSize[i] = 0; @@ -113,11 +105,11 @@ Globals::Globals(HopkinsEngine *vm) { _oceanDirection = DIR_NONE; // Initialize pointers - _levelSpriteBuf = g_PTRNUL; - _saveData = (Savegame *)g_PTRNUL; - _answerBuffer = g_PTRNUL; - _characterSpriteBuf = g_PTRNUL; - _optionDialogSpr = g_PTRNUL; + _levelSpriteBuf = NULL; + _saveData = (Savegame *)NULL; + _answerBuffer = NULL; + _characterSpriteBuf = NULL; + _optionDialogSpr = NULL; // Reset flags _censorshipFl = false; @@ -136,7 +128,7 @@ Globals::~Globals() { freeMemory((byte *)_saveData); freeMemory(_answerBuffer); freeMemory(_characterSpriteBuf); - free(g_PTRNUL); + free(NULL); } void Globals::setConfig() { @@ -178,9 +170,9 @@ void Globals::setConfig() { void Globals::clearAll() { _vm->_fontManager->clearAll(); _vm->_dialogsManager->clearAll(); - _answerBuffer = g_PTRNUL; - _levelSpriteBuf = g_PTRNUL; - _saveData = (Savegame *)g_PTRNUL; + _answerBuffer = NULL; + _levelSpriteBuf = NULL; + _saveData = (Savegame *)NULL; _vm->_objectsManager->_curObjectIndex = 0; _vm->_linesManager->clearAll(); @@ -210,14 +202,14 @@ void Globals::loadCharacterData() { byte *Globals::allocMemory(int count) { byte *result = (byte *)malloc(count); if (!result) - result = g_PTRNUL; + result = NULL; return result; } byte *Globals::freeMemory(byte *p) { - if (p != g_PTRNUL) + if (p != NULL) free(p); - return g_PTRNUL; + return NULL; } } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 71bc3f0ab4..62cc5bb9e0 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -220,9 +220,6 @@ public: int _curRoomNum; }; -// Global null pointer -extern byte *g_PTRNUL; - } // End of namespace Hopkins #endif /* HOPKINS_GLOBALS_H */ diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a903462ecb..7a965146e7 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -42,17 +42,17 @@ GraphicsManager::GraphicsManager(HopkinsEngine *vm) { _initGraphicsFl = false; _screenWidth = _screenHeight = 0; _screenLineSize = 0; - PAL_PIXELS = g_PTRNUL; + PAL_PIXELS = NULL; _lineNbr = 0; _videoPtr = NULL; _scrollOffset = 0; _scrollPosX = 0; _largeScreenFl = false; _oldScrollPosX = 0; - _backBuffer = g_PTRNUL; - _frontBuffer = g_PTRNUL; - _screenBuffer = g_PTRNUL; - _backupScreen = g_PTRNUL; + _backBuffer = NULL; + _frontBuffer = NULL; + _screenBuffer = NULL; + _backupScreen = NULL; _showDirtyRects = false; _lineNbr2 = 0; @@ -1840,7 +1840,7 @@ void GraphicsManager::drawVerticalLine(byte *surface, int xp, int yp, int height */ void GraphicsManager::backupScreen() { // Allocate a new data block for the screen, if necessary - if (_vm->_graphicsManager->_backupScreen == g_PTRNUL) + if (_vm->_graphicsManager->_backupScreen == NULL) _vm->_graphicsManager->_backupScreen = _vm->_globals->allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); // Backup the screen @@ -1852,13 +1852,13 @@ void GraphicsManager::backupScreen() { * Restore a previously backed up screen */ void GraphicsManager::restoreScreen() { - assert(_vm->_graphicsManager->_backupScreen != g_PTRNUL); + assert(_vm->_graphicsManager->_backupScreen != NULL); // Restore the screen and free the buffer Common::copy(_vm->_graphicsManager->_backupScreen, _vm->_graphicsManager->_backupScreen + SCREEN_WIDTH * 2 * SCREEN_HEIGHT, _vm->_graphicsManager->_backBuffer); _vm->_globals->freeMemory(_vm->_graphicsManager->_backupScreen); - _backupScreen = g_PTRNUL; + _backupScreen = NULL; } } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 66e01b0f9c..e60efdcc25 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1193,7 +1193,7 @@ bool HopkinsEngine::runFull() { _objectsManager->_forestFl = true; Common::String im = Common::String::format("IM%d", _globals->_exitId); _soundManager->playSound(13); - if (_objectsManager->_forestSprite == g_PTRNUL) { + if (_objectsManager->_forestSprite == NULL) { _objectsManager->_forestSprite = _objectsManager->loadSprite("HOPDEG.SPR"); _soundManager->loadSample(1, "SOUND41.WAV"); } @@ -2097,7 +2097,7 @@ void HopkinsEngine::playEnding() { _globals->_cityMapEnabledFl = false; _globals->_eventMode = EVENTMODE_IGNORE; _soundManager->playSound(26); - _linesManager->_route = (RouteItem *)g_PTRNUL; + _linesManager->_route = (RouteItem *)NULL; _globals->_freezeCharacterFl = true; _globals->_exitId = 0; _soundManager->loadSample(1, "SOUND90.WAV"); @@ -2830,7 +2830,7 @@ void HopkinsEngine::handleOceanMaze(int16 curExitId, Common::String backgroundFi _graphicsManager->SETCOLOR3(251, 100, 100, 100); _graphicsManager->SETCOLOR3(254, 0, 0, 0); _objectsManager->animateSprite(0); - _linesManager->_route = (RouteItem *)g_PTRNUL; + _linesManager->_route = (RouteItem *)NULL; _eventsManager->mouseOn(); _eventsManager->changeMouseCursor(4); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index d74bc8f3a0..16a0a9c029 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -67,13 +67,13 @@ LinesManager::LinesManager(HopkinsEngine *vm) { _lastLine = 0; _maxLineIdx = 0; _pathFindingMaxDepth = 0; - _testRoute0 = (RouteItem *)g_PTRNUL; - _testRoute1 = (RouteItem *)g_PTRNUL; - _testRoute2 = (RouteItem *)g_PTRNUL; - _lineBuf = (int16 *)g_PTRNUL; - _route = (RouteItem *)g_PTRNUL; + _testRoute0 = (RouteItem *)NULL; + _testRoute1 = (RouteItem *)NULL; + _testRoute2 = (RouteItem *)NULL; + _lineBuf = (int16 *)NULL; + _route = (RouteItem *)NULL; _currentSegmentId = 0; - _largeBuf = g_PTRNUL; + _largeBuf = NULL; _zoneSkipCount = 0; _hotspotTextColor = 0; _forceHideText = false; @@ -89,11 +89,11 @@ LinesManager::LinesManager(HopkinsEngine *vm) { LinesManager::~LinesManager() { _vm->_globals->freeMemory(_largeBuf); - if (_testRoute0 != (RouteItem *)g_PTRNUL) + if (_testRoute0 != (RouteItem *)NULL) delete[] _testRoute0; - if (_testRoute1 != (RouteItem *)g_PTRNUL) + if (_testRoute1 != (RouteItem *)NULL) delete[] _testRoute1; - if (_testRoute2 != (RouteItem *)g_PTRNUL) + if (_testRoute2 != (RouteItem *)NULL) 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 != (int16 *)g_PTRNUL); + assert(zoneData != (int16 *)NULL); _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 != g_PTRNUL); + assert (zoneData != NULL); Common::fill(zoneData, zoneData + 4 * maxDist + 8, 0); _lineItem[lineIdx]._lineData = (int16 *)zoneData; @@ -379,7 +379,7 @@ bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *fo for (int curLineIdx = startLineIdx; curLineIdx <= endLineIdx; curLineIdx++) { lineData = _lineItem[curLineIdx]._lineData; - if (lineData == (int16 *)g_PTRNUL) + if (lineData == (int16 *)NULL) continue; bool collisionFl = true; @@ -443,6 +443,8 @@ void LinesManager::initRoute() { error("ERROR - LAST LINE NOT FOUND"); int16 *nextLineData = _lineItem[lineIdx + 1]._lineData; + if (!nextLineData) + break; if (nextLineData[0] != curLineX && nextLineData[1] != curLineY) break; ++lineIdx; @@ -791,14 +793,14 @@ int LinesManager::computeRouteIdx(int lineIdx, int dataIdx, int fromX, int fromY int endLineIdx = 2 * _lineItem[startLineIdx - 1]._lineDataEndIdx; int16 *lineData = _lineItem[startLineIdx - 1]._lineData; - if (lineData == (int16 *)g_PTRNUL) + if (lineData == (int16 *)NULL) break; while (lineData[endLineIdx - 2] != lineX || lineY != lineData[endLineIdx - 1]) { --curLineIdx; if (_lastLine - 1 != curLineIdx) { endLineIdx = 2 * _lineItem[curLineIdx]._lineDataEndIdx; lineData = _lineItem[curLineIdx]._lineData; - if (lineData != (int16 *)g_PTRNUL) + if (lineData != (int16 *)NULL) continue; } loopCond = true; @@ -822,7 +824,7 @@ int LinesManager::computeRouteIdx(int lineIdx, int dataIdx, int fromX, int fromY int curLineIdx = endLineIdx + 1; int nextLineDataEndIdx = 2 * _lineItem[curLineIdx]._lineDataEndIdx; int16 *lineData = _lineItem[curLineIdx]._lineData; - if (lineData == (int16 *)g_PTRNUL) + if (lineData == (int16 *)NULL) break; for (;;) { curLineDataEndIdx = nextLineDataEndIdx; @@ -833,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 != (int16 *)g_PTRNUL) + if (lineData != (int16 *)NULL) continue; } loopCond = true; @@ -893,7 +895,7 @@ int LinesManager::computeRouteIdx(int lineIdx, int dataIdx, int fromX, int fromY int minLineY = 0; for (int i = startLineIdx; i <= endLineIdx; ++i) { int16 *lineData = _lineItem[i]._lineData; - if (lineData == (int16 *)g_PTRNUL) + if (lineData == (int16 *)NULL) error("error in genial routine"); if (i == startLineIdx) { minLineY = MIN(lineData[1], lineData[2 * _lineItem[i]._lineDataEndIdx - 1]); @@ -1094,13 +1096,13 @@ RouteItem *LinesManager::findRoute(int fromX, int fromY, int destX, int destY) { if (!_vm->_globals->_checkDistanceFl) { if (abs(fromX - _oldRouteFromX) <= 4 && abs(fromY - _oldRouteFromY) <= 4 && abs(_oldRouteDestX - destX) <= 4 && abs(_oldRouteDestY - clipDestY) <= 4) - return (RouteItem *)g_PTRNUL; + return (RouteItem *)NULL; if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4) - return (RouteItem *)g_PTRNUL; + return (RouteItem *)NULL; if (_oldZoneNum > 0 && _vm->_objectsManager->_zoneNum > 0 && _oldZoneNum == _vm->_objectsManager->_zoneNum) - return (RouteItem *)g_PTRNUL; + return (RouteItem *)NULL; } _vm->_globals->_checkDistanceFl = false; _oldZoneNum = _vm->_objectsManager->_zoneNum; @@ -1120,7 +1122,7 @@ RouteItem *LinesManager::findRoute(int fromX, int fromY, int destX, int destY) { clipDestY = _vm->_globals->_characterMaxPosY; if (abs(fromX - clipDestX) <= 3 && abs(fromY - clipDestY) <= 3) - return (RouteItem *)g_PTRNUL; + return (RouteItem *)NULL; for (int i = 0; i <= 8; ++i) { collLineIdxArr[i] = -1; @@ -1199,7 +1201,7 @@ RouteItem *LinesManager::findRoute(int fromX, int fromY, int destX, int destY) { if (collLineIdxArr[DIR_LEFT] < 0) deltaArr[DIR_LEFT] = INVALID_LINE_VALUE; if (collLineIdxArr[DIR_UP] == -1 && collLineIdxArr[DIR_RIGHT] == -1 && collLineIdxArr[DIR_DOWN] == -1 && collLineIdxArr[DIR_LEFT] == -1) - return (RouteItem *)g_PTRNUL; + return (RouteItem *)NULL; if (collLineIdxArr[DIR_DOWN] != -1 && deltaArr[DIR_UP] >= deltaArr[DIR_DOWN] && deltaArr[DIR_RIGHT] >= deltaArr[DIR_DOWN] && deltaArr[DIR_LEFT] >= deltaArr[DIR_DOWN]) { curLineIdx = collLineIdxArr[DIR_DOWN]; @@ -2155,7 +2157,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { _bestRoute[superRouteIdx].invalidate(); result = &_bestRoute[0]; } else { - result = (RouteItem *)g_PTRNUL; + result = (RouteItem *)NULL; } return result; } @@ -2645,7 +2647,7 @@ int LinesManager::checkCollision(int xp, int yp) { do { LigneZoneItem *curZoneLine = &_zoneLine[curZoneLineIdx]; int16 *dataP = curZoneLine->_zoneData; - if (dataP != (int16 *)g_PTRNUL) { + if (dataP != (int16 *)NULL) { int count = curZoneLine->_count; int startX = dataP[0]; int startY = dataP[1]; @@ -2691,7 +2693,7 @@ void LinesManager::initSquareZones() { for (int idx = 0; idx < MAX_LINES; ++idx) { int16 *dataP = _zoneLine[idx]._zoneData; - if (dataP == (int16 *)g_PTRNUL) + if (dataP == (int16 *)NULL) continue; SquareZoneItem *curZone = &_squareZone[_zoneLine[idx]._bobZoneIdx]; @@ -2725,22 +2727,22 @@ void LinesManager::clearAll() { _zone[idx]._spriteIndex = 0; } - _testRoute0 = (RouteItem *)g_PTRNUL; - _testRoute1 = (RouteItem *)g_PTRNUL; - _testRoute2 = (RouteItem *)g_PTRNUL; - _lineBuf = (int16 *)g_PTRNUL; - _route = (RouteItem *)g_PTRNUL; + _testRoute0 = (RouteItem *)NULL; + _testRoute1 = (RouteItem *)NULL; + _testRoute2 = (RouteItem *)NULL; + _lineBuf = (int16 *)NULL; + _route = (RouteItem *)NULL; for (int idx = 0; idx < MAX_LINES; ++idx) { _lineItem[idx]._lineDataEndIdx = 0; _lineItem[idx]._direction = DIR_NONE; _lineItem[idx]._directionRouteInc = DIR_NONE; _lineItem[idx]._directionRouteDec = DIR_NONE; - _lineItem[idx]._lineData = (int16 *)g_PTRNUL; + _lineItem[idx]._lineData = (int16 *)NULL; _zoneLine[idx]._count = 0; _zoneLine[idx]._bobZoneIdx = 0; - _zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; + _zoneLine[idx]._zoneData = (int16 *)NULL; } for (int idx = 0; idx < 100; ++idx) @@ -2750,11 +2752,11 @@ void LinesManager::clearAll() { _testRoute1 = new RouteItem[8334]; _testRoute2 = new RouteItem[8334]; if (!_testRoute0) - _testRoute0 = (RouteItem*)g_PTRNUL; + _testRoute0 = (RouteItem*)NULL; if (!_testRoute1) - _testRoute1 = (RouteItem*)g_PTRNUL; + _testRoute1 = (RouteItem*)NULL; if (!_testRoute2) - _testRoute2 = (RouteItem*)g_PTRNUL; + _testRoute2 = (RouteItem*)NULL; _largeBuf = _vm->_globals->allocMemory(10000); _lineBuf = (int16 *)(_largeBuf); @@ -2780,7 +2782,7 @@ void LinesManager::resetLines() { for (int idx = 0; idx < MAX_LINES; ++idx) { removeLine(idx); _lineItem[idx]._lineDataEndIdx = 0; - _lineItem[idx]._lineData = (int16 *)g_PTRNUL; + _lineItem[idx]._lineData = (int16 *)NULL; } } @@ -2845,7 +2847,7 @@ void LinesManager::checkZone() { if (_zoneSkipCount <= 1) return; - if (_vm->_globals->_freezeCharacterFl || (_route == (RouteItem *)g_PTRNUL) || _zoneSkipCount > 4) { + if (_vm->_globals->_freezeCharacterFl || (_route == (RouteItem *)NULL) || _zoneSkipCount > 4) { _zoneSkipCount = 0; int zoneId; if (_oldMouseX != mouseX || _oldMouseY != oldMouseY) { diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 6a5cbd2421..8a4c9c466c 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -44,7 +44,7 @@ MenuManager::MenuManager(HopkinsEngine *vm) { } int MenuManager::menu() { - byte *spriteData = g_PTRNUL; + byte *spriteData = NULL; MenuSelection menuIndex; Common::Point mousePos; signed int result; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6e6d539ea2..5b9c84fe24 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -60,7 +60,7 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) { Common::fill((byte *)&_hidingItem[i], (byte *)&_hidingItem[i] + sizeof(HidingItem), 0); for (int i = 0; i < 6; ++i) - _hidingItemData[i] = g_PTRNUL; + _hidingItemData[i] = NULL; for (int i = 0; i < 6; ++i) Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0); @@ -78,10 +78,10 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) { _oldInventoryPosX = _oldInventoryPosY = 0; _oldCharacterPosX = _oldCharacterPosY = 0; _eraseVisibleCounter = 0; - _saveLoadSprite = g_PTRNUL; - _saveLoadSprite2 = g_PTRNUL; - _spritePtr = g_PTRNUL; - _oldSpriteData = g_PTRNUL; + _saveLoadSprite = NULL; + _saveLoadSprite2 = NULL; + _spritePtr = NULL; + _oldSpriteData = NULL; _saveLoadFl = false; _visibleFl = false; _zoneNum = 0; @@ -101,10 +101,10 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) { _curObjectIndex = 0; _forestFl = false; _mapCarPosX = _mapCarPosY = 0; - _forestSprite = g_PTRNUL; - _gestureBuf = g_PTRNUL; + _forestSprite = NULL; + _gestureBuf = NULL; _curGestureFile = 0; - _headSprites = g_PTRNUL; + _headSprites = NULL; _homeRateCounter = 0; _lastDirection = DIR_NONE; _oldDirection = DIR_NONE; @@ -112,7 +112,7 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) { _objectWidth = _objectHeight = 0; _hidingActiveFl = false; _curObjectFileNum = 0; - _objectDataBuf = g_PTRNUL; + _objectDataBuf = NULL; _charactersEnabledFl = false; _refreshBobMode10Fl = false; } @@ -170,7 +170,7 @@ void ObjectsManager::resetHidingItems() { for (int idx = 0; idx <= 20; ++idx) { HidingItem *hid = &_hidingItem[idx]; - hid->_spriteData = g_PTRNUL; + hid->_spriteData = NULL; hid->_x = 0; hid->_y = 0; hid->_spriteIndex = 0; @@ -193,7 +193,7 @@ void ObjectsManager::changeObject(int objIndex) { } byte *ObjectsManager::loadObjectFromFile(int objIndex, bool mode) { - byte *dataP = g_PTRNUL; + byte *dataP = NULL; int objectFileNum = _objectAuthIcons[objIndex]._objectFileNum; int idx = _objectAuthIcons[objIndex]._idx; @@ -201,7 +201,7 @@ byte *ObjectsManager::loadObjectFromFile(int objIndex, bool mode) { ++idx; if (objectFileNum != _curObjectFileNum) { - if (_objectDataBuf != g_PTRNUL) + if (_objectDataBuf != NULL) removeObjectDataBuf(); if (objectFileNum == 1) { _objectDataBuf = loadSprite("OBJET1.SPR"); @@ -219,7 +219,7 @@ byte *ObjectsManager::loadObjectFromFile(int objIndex, bool mode) { dataP = _vm->_eventsManager->_objectBuf; } else { dataP = _vm->_globals->allocMemory(height * width); - if (dataP == g_PTRNUL) + if (dataP == NULL) error("CAPTURE_OBJET"); capture_mem_sprite(_objectDataBuf, dataP, idx); @@ -572,7 +572,7 @@ void ObjectsManager::resetBob(int idx) { ListeItem &item = Liste2[idx]; bob._bobMode = 0; - bob._spriteData = g_PTRNUL; + bob._spriteData = NULL; bob._xp = 0; bob._yp = 0; bob._frameIndex = 0; @@ -580,7 +580,7 @@ void ObjectsManager::resetBob(int idx) { bob._moveChange1 = 0; bob._moveChange2 = 0; bob._disabledAnimationFl = false; - bob._animData = g_PTRNUL; + bob._animData = NULL; bob._bobMode10 = false; bob._bobModeChange = 0; bob._modeChangeCtr = 0; @@ -1000,7 +1000,7 @@ void ObjectsManager::displayBobAnim() { continue; _bob[idx]._bobMode10 = false; - if (_bob[idx]._animData == g_PTRNUL || _bob[idx]._disabledAnimationFl || _bob[idx]._modeChangeCtr == 0 || _bob[idx]._modeChangeCtr < -1) { + if (_bob[idx]._animData == NULL || _bob[idx]._disabledAnimationFl || _bob[idx]._modeChangeCtr == 0 || _bob[idx]._modeChangeCtr < -1) { if (_bob[idx]._bobModeChange == 1 || _bob[idx]._bobModeChange == 2) _bob[idx]._bobMode10 = true; continue; @@ -1155,14 +1155,14 @@ void ObjectsManager::displayVBob() { vbob->_surface = _vm->_globals->freeMemory(vbob->_surface); vbob->_displayMode = 0; - vbob->_spriteData = g_PTRNUL; + vbob->_spriteData = NULL; vbob->_xp = 0; vbob->_yp = 0; vbob->_oldX = 0; vbob->_oldY = 0; vbob->_frameIndex = 0; vbob->_oldFrameIndex = 0; - vbob->_oldSpriteData = g_PTRNUL; + vbob->_oldSpriteData = NULL; } if (vbob->_displayMode == 3) { @@ -1240,7 +1240,7 @@ int ObjectsManager::getSpriteY(int idx) { */ void ObjectsManager::clearSprite() { for (int idx = 0; idx < MAX_SPRITE; idx++) { - _sprite[idx]._spriteData = g_PTRNUL; + _sprite[idx]._spriteData = NULL; _sprite[idx]._animationType = 0; } @@ -1327,7 +1327,7 @@ void ObjectsManager::setFlipSprite(int idx, bool flipFl) { } void ObjectsManager::GOHOME() { - if (_vm->_linesManager->_route == (RouteItem *)g_PTRNUL) + if (_vm->_linesManager->_route == (RouteItem *)NULL) return; if (_homeRateCounter > 1) { @@ -1364,11 +1364,11 @@ void ObjectsManager::GOHOME() { zoneId = _vm->_globals->_saveData->_data[svLastZoneNum]; else zoneId = _zoneNum; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; computeAndSetSpriteSize(); setFlipSprite(0, false); _homeRateCounter = 0; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _oldDirection = DIR_NONE; if (zoneId > 0) { if (_vm->_linesManager->_zone[zoneId]._destX && _vm->_linesManager->_zone[zoneId]._destY && _vm->_linesManager->_zone[zoneId]._destY != 31) { @@ -1584,7 +1584,7 @@ void ObjectsManager::GOHOME() { zoneId = _zoneNum; setSpriteIndex(0, _oldDirection + 59); _vm->_globals->_actionDirection = DIR_NONE; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; computeAndSetSpriteSize(); setFlipSprite(0, false); _homeRateCounter = 0; @@ -1644,7 +1644,7 @@ void ObjectsManager::GOHOME() { } void ObjectsManager::GOHOME2() { - if (_vm->_linesManager->_route == (RouteItem *)g_PTRNUL) + if (_vm->_linesManager->_route == (RouteItem *)NULL) return; int realSpeed = 2; @@ -1707,7 +1707,7 @@ void ObjectsManager::GOHOME2() { break; } - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; } /** @@ -1795,7 +1795,7 @@ void ObjectsManager::handleCityMap() { _vm->_globals->_cityMapEnabledFl = true; _vm->_graphicsManager->_noFadingFl = false; _vm->_globals->_freezeCharacterFl = false; - _spritePtr = g_PTRNUL; + _spritePtr = NULL; _vm->_globals->_exitId = 0; _vm->_globals->_checkDistanceFl = true; _vm->_soundManager->playSound(31); @@ -1824,7 +1824,7 @@ void ObjectsManager::handleCityMap() { _vm->_graphicsManager->scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager->_scrollOffset = getSpriteX(0) - 320; animateSprite(0); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_graphicsManager->SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager->SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager->SETCOLOR3(251, 100, 100, 100); @@ -1866,7 +1866,7 @@ void ObjectsManager::handleCityMap() { _vm->_linesManager->checkZone(); GOHOME2(); - if (_vm->_linesManager->_route == (RouteItem *)g_PTRNUL && _vm->_globals->_actionMoveTo) + if (_vm->_linesManager->_route == (RouteItem *)NULL && _vm->_globals->_actionMoveTo) PARADISE(); _vm->_eventsManager->refreshScreenAndEvents(); @@ -1960,25 +1960,25 @@ void ObjectsManager::handleLeftButton() { } _vm->_globals->_actionMoveTo = false; RouteItem *oldRoute = _vm->_linesManager->_route; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; if (_forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) { - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; setSpriteIndex(0, _oldDirectionSpriteIdx); _vm->_globals->_actionDirection = DIR_NONE; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; computeAndSetSpriteSize(); setFlipSprite(0, false); _homeRateCounter = 0; _oldDirection = DIR_NONE; } else { _vm->_linesManager->_route = _vm->_linesManager->findRoute(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); - if (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL) + if (_vm->_linesManager->_route != (RouteItem *)NULL) _vm->_linesManager->optimizeRoute(_vm->_linesManager->_route); _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); _homeRateCounter = 0; - if (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager->_route) { + if (_vm->_linesManager->_route != (RouteItem *)NULL || 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 != (RouteItem *)g_PTRNUL) + if (_vm->_linesManager->_route != (RouteItem *)NULL) _vm->_linesManager->optimizeRoute(_vm->_linesManager->_route); _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); _homeRateCounter = 0; - if (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager->_route) + if (_vm->_linesManager->_route != (RouteItem *)NULL || oldRoute == _vm->_linesManager->_route) _oldDirection = DIR_NONE; else _vm->_linesManager->_route = oldRoute; @@ -2020,7 +2020,7 @@ void ObjectsManager::handleLeftButton() { && _curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager->_mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; getSpriteX(0); getSpriteY(0); } @@ -2137,7 +2137,7 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _vm->_linesManager->resetLinesNumb(); _vm->_linesManager->resetLastLine(); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_globals->_answerBuffer = _vm->_globals->freeMemory(_vm->_globals->_answerBuffer); _vm->_globals->_levelSpriteBuf = _vm->_globals->freeMemory(_vm->_globals->_levelSpriteBuf); _vm->_eventsManager->_startPos.x = 0; @@ -2147,7 +2147,7 @@ void ObjectsManager::clearScreen() { _vm->_globals->_actionMoveTo = false; _forceZoneFl = true; _changeVerbFl = false; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _oldDirection = DIR_NONE; _vm->_graphicsManager->resetDirtyRects(); } @@ -2164,7 +2164,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_graphicsManager->copySurface(_vm->_graphicsManager->_backBuffer, 532, 25, 65, 40, _vm->_graphicsManager->_frontBuffer, 532, 25); _vm->_graphicsManager->addDirtyRect(532, 25, 597, 65); _vm->_globals->_checkDistanceFl = true; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals->_saveData->_realHopkins._location == _vm->_globals->_screenId) { @@ -2606,7 +2606,7 @@ void ObjectsManager::loadObjectIniFile() { data = _vm->_fileManager->searchCat(file, RES_INI, fileFoundFl); if (!fileFoundFl) { data = _vm->_fileManager->loadFile(file); - if (data == g_PTRNUL) + if (data == NULL) error("INI file %s not found", file.c_str()); } @@ -3111,7 +3111,7 @@ void ObjectsManager::loadLinkFile(const Common::String &file, bool skipDetails) nbytes = f.size(); ptr = _vm->_globals->allocMemory(nbytes); - if (ptr == g_PTRNUL) + if (ptr == NULL) error("INILINK"); _vm->_fileManager->readStream(f, ptr, nbytes); f.close(); @@ -3725,7 +3725,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals->_cityMapEnabledFl = false; _vm->_globals->_eventMode = EVENTMODE_IGNORE; _vm->_soundManager->playSound(soundNum); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_globals->_freezeCharacterFl = true; _vm->_globals->_exitId = 0; if (!backgroundFile.empty()) @@ -3745,7 +3745,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->_globals->_screenId == 61) { addStaticSprite(_vm->_globals->_characterSpriteBuf, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; computeAndSetSpriteSize(); } _vm->_graphicsManager->SETCOLOR3(252, 100, 100, 100); @@ -3763,13 +3763,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _oldCharacterPosX = getSpriteX(0); _oldDirection = DIR_NONE; _homeRateCounter = 0; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(getSpriteX(0), getSpriteY(0), 330, 345); _vm->_globals->_checkDistanceFl = true; do { GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); setSpriteIndex(0, 64); } do { @@ -3871,7 +3871,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm computeAndSetSpriteSize(); animateSprite(0); enableHidingBehavior(); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; computeAndSetSpriteSize(); sceneSpecialIni(); _vm->_eventsManager->_mouseSpriteId = 4; @@ -3902,7 +3902,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm int yp = _vm->_eventsManager->getMouseY(); if ((xCheck == xp) && (yCheck == yp)) { - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; PARADISE(); if (_vm->_globals->_exitId) breakFlag = true; @@ -3918,8 +3918,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!_vm->_globals->_exitId) { _vm->_dialogsManager->testDialogOpening(); _vm->_linesManager->checkZone(); - if (_vm->_linesManager->_route == (RouteItem *)g_PTRNUL - || (GOHOME(), _vm->_linesManager->_route == (RouteItem *)g_PTRNUL)) { + if (_vm->_linesManager->_route == (RouteItem *)NULL + || (GOHOME(), _vm->_linesManager->_route == (RouteItem *)NULL)) { if (_vm->_globals->_actionMoveTo) PARADISE(); } @@ -3979,7 +3979,7 @@ void ObjectsManager::loadHidingItems(const Common::String &file) { _hidingItem[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1); _hidingItem[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2); _hidingItem[i]._yOffset = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4); - if (spriteData == g_PTRNUL) { + if (spriteData == NULL) { _hidingItem[i]._useCount = 0; } else { _hidingItem[i]._spriteData = spriteData; @@ -4002,9 +4002,9 @@ void ObjectsManager::initVBob() { VBob[idx]._xp = 0; VBob[idx]._yp = 0; VBob[idx]._frameIndex = 0; - VBob[idx]._surface = g_PTRNUL; - VBob[idx]._spriteData = g_PTRNUL; - VBob[idx]._oldSpriteData = g_PTRNUL; + VBob[idx]._surface = NULL; + VBob[idx]._spriteData = NULL; + VBob[idx]._oldSpriteData = NULL; } } @@ -4015,8 +4015,8 @@ void ObjectsManager::clearVBob() { VBob[idx]._yp = 0; VBob[idx]._frameIndex = 0; VBob[idx]._surface = _vm->_globals->freeMemory(VBob[idx]._surface); - VBob[idx]._spriteData = g_PTRNUL; - VBob[idx]._oldSpriteData = g_PTRNUL; + VBob[idx]._spriteData = NULL; + VBob[idx]._oldSpriteData = NULL; } } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d100403490..c6046c6a2b 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -759,7 +759,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 46: { _vm->_globals->_checkDistanceFl = true; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 564, 420); _vm->_objectsManager->_zoneNum = -1; do { @@ -768,7 +768,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->removeSprite(0); _vm->_globals->_checkDistanceFl = true; _vm->_soundManager->loadSample(1, "SOUND44.WAV"); @@ -984,7 +984,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0); _vm->_objectsManager->resetOldDirection(); _vm->_objectsManager->resetHomeRateCounter(); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 445, 332); _vm->_globals->_checkDistanceFl = true; do { @@ -993,7 +993,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->removeSprite(0); _vm->_objectsManager->setBobAnimation(7); _vm->_objectsManager->setBobAnimDataIdx(7, 0); @@ -1100,7 +1100,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0); _vm->_objectsManager->resetOldDirection(); _vm->_objectsManager->resetHomeRateCounter(); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 119, 268); _vm->_globals->_checkDistanceFl = true; do { @@ -1109,7 +1109,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->removeSprite(0); _vm->_objectsManager->setBobAnimation(11); _vm->_objectsManager->setBobAnimation(8); @@ -1415,7 +1415,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0); _vm->_objectsManager->resetOldDirection(); _vm->_objectsManager->resetHomeRateCounter(); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; switch (_vm->_globals->_saveData->_data[svField253]) { case 1: _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 201, 294); @@ -1435,7 +1435,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->removeSprite(0); _vm->_objectsManager->setSpriteIndex(0, 60); _vm->_soundManager->loadSample(1, "SOUND63.WAV"); @@ -1663,7 +1663,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->resetOldDirection(); _vm->_objectsManager->resetHomeRateCounter(); _vm->_globals->_checkDistanceFl = true; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 361, 325); _vm->_globals->_checkDistanceFl = true; _vm->_objectsManager->_zoneNum = -1; @@ -1673,7 +1673,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_globals->_exitId = 59; break; } @@ -1691,7 +1691,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->resetOldDirection(); _vm->_objectsManager->resetHomeRateCounter(); _vm->_globals->_checkDistanceFl = true; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 361, 325); _vm->_globals->_checkDistanceFl = true; _vm->_objectsManager->_zoneNum = -1; @@ -1701,7 +1701,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_globals->_exitId = 59; break; } @@ -1878,7 +1878,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->_specialSoundNum = 0; } _vm->_globals->_checkDistanceFl = true; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 330, 418); _vm->_globals->_checkDistanceFl = true; _vm->_objectsManager->_zoneNum = 0; @@ -1888,7 +1888,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->setSpriteIndex(0, 64); _vm->_globals->_exitId = _vm->_globals->_saveData->_data[svField401]; _vm->_globals->_disableInventFl = false; @@ -1908,7 +1908,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager->refreshScreenAndEvents(); } while (_vm->_objectsManager->getBobAnimDataIdx(1) != 9); _vm->_objectsManager->stopBobAnimation(1); - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_globals->_checkDistanceFl = true; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 330, 314); _vm->_objectsManager->_zoneNum = 0; @@ -1919,7 +1919,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->setSpriteIndex(0, 64); _vm->_objectsManager->setBobAnimation(2); _vm->_soundManager->playSoundFile("SOUND66.WAV"); @@ -1999,7 +1999,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->resetOldDirection(); _vm->_objectsManager->resetHomeRateCounter(); _vm->_globals->_checkDistanceFl = true; - _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; + _vm->_linesManager->_route = (RouteItem *)NULL; _vm->_linesManager->_route = _vm->_linesManager->findRoute(_vm->_objectsManager->getSpriteX(0), _vm->_objectsManager->getSpriteY(0), 488, 280); _vm->_globals->_checkDistanceFl = true; do { @@ -2008,7 +2008,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->GOHOME(); _vm->_eventsManager->refreshScreenAndEvents(); - } while (_vm->_linesManager->_route != (RouteItem *)g_PTRNUL); + } while (_vm->_linesManager->_route != (RouteItem *)NULL); _vm->_objectsManager->removeSprite(0); bool playFl = false; _vm->_objectsManager->setBobAnimation(7); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 819f6bc467..2b0e00392a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -37,10 +37,10 @@ namespace Hopkins { TalkManager::TalkManager(HopkinsEngine *vm) { _vm = vm; - _characterBuffer = g_PTRNUL; - _characterPalette = g_PTRNUL; - _characterSprite = g_PTRNUL; - _characterAnim = g_PTRNUL; + _characterBuffer = NULL; + _characterPalette = NULL; + _characterSprite = NULL; + _characterAnim = NULL; _characterSize = 0; _dialogueMesgId1 = _dialogueMesgId2 = _dialogueMesgId3 = _dialogueMesgId4 = 0; _paletteBufferIdx = 0; @@ -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 != g_PTRNUL); + assert(decryptBuf != NULL); f.read(decryptBuf, 2048); f.close(); @@ -713,7 +713,7 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, loopCond = true; if (bufIndx > bufferSize) { _vm->_animationManager->_animBqe[idx]._enabledFl = false; - _vm->_animationManager->_animBqe[idx]._data = g_PTRNUL; + _vm->_animationManager->_animBqe[idx]._data = NULL; return false; } ++bufIndx; @@ -762,11 +762,11 @@ void TalkManager::handleAnswer(int zone, int verb) { byte verbObj = verb; bool outerLoopFl; - byte *ptr = g_PTRNUL; + byte *ptr = NULL; do { outerLoopFl = false; bool tagFound = false; - if (_vm->_globals->_answerBuffer == g_PTRNUL) + if (_vm->_globals->_answerBuffer == NULL) return; byte *curAnswerBuf = _vm->_globals->_answerBuffer; @@ -786,7 +786,7 @@ void TalkManager::handleAnswer(int zone, int verb) { // 'COD' tag found curAnswerBuf += 5; ptr = _vm->_globals->allocMemory(620); - assert(ptr != g_PTRNUL); + assert(ptr != NULL); memset(ptr, 0, 620); uint16 curAnswerIdx = 0; int idx = 0; @@ -1009,7 +1009,7 @@ void TalkManager::animateObject(const Common::String &filename) { searchCharacterPalette(_paletteBufferIdx, true); startCharacterAnim0(_paletteBufferIdx, false); byte *oldAnswerBufferPtr = _vm->_globals->_answerBuffer; - _vm->_globals->_answerBuffer = g_PTRNUL; + _vm->_globals->_answerBuffer = NULL; _vm->_globals->_freezeCharacterFl = true; _vm->_objectsManager->loadLinkFile(screenFilename); _vm->_objectsManager->_charactersEnabledFl = true; |