From e280c833c7cc65c263b05532533e5e010a0236c3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 23:34:58 +0200 Subject: GNAP: Enforce the use of nullptr in function calls --- engines/gnap/gamesys.cpp | 8 ++++---- engines/gnap/gnap.cpp | 14 +++++++------- engines/gnap/scenes/arcade.cpp | 38 +++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index ecfa3c54ba..76f7fa44b3 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -857,7 +857,7 @@ void GameSys::drawSprites() { } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); - seqDrawSpriteFrame(spriteResource, gfxItem5->_currFrame, 0); + seqDrawSpriteFrame(spriteResource, gfxItem5->_currFrame, nullptr); _vm->_spriteCache->release(resourceId); } } @@ -1023,7 +1023,7 @@ void GameSys::fatUpdateFrame() { // NOTE Skipped avi code } } else { - Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, 0); + Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, nullptr); if (!animation) { gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; @@ -1178,7 +1178,7 @@ void GameSys::fatUpdateFrame() { Sequence *seqItem = &_fatSequenceItems[i]; if (((seqItem->_flags & 8) || (seqItem->_flags & 0x20)) && seqItem->_sequenceId2 != -1) { duration = 0; - if (((seqItem->_flags & 0x20) && seqLocateGfx(seqItem->_sequenceId2, seqItem->_id2, 0)) || + if (((seqItem->_flags & 0x20) && seqLocateGfx(seqItem->_sequenceId2, seqItem->_id2, nullptr)) || updateSequenceDuration(seqItem->_sequenceId2, seqItem->_id2, &duration)) { int index = -1; bool found = false; @@ -1229,7 +1229,7 @@ void GameSys::fatUpdateFrame() { for (uint i = 0; i < _seqItems.size(); ++i) { Sequence *seqItem = &_seqItems[i]; - if (seqLocateGfx(seqItem->_sequenceId, seqItem->_id, 0)) { + if (seqLocateGfx(seqItem->_sequenceId, seqItem->_id, nullptr)) { updateAnimationsStatus(seqItem->_sequenceId, seqItem->_id); if (seqItem->_flags & 2) { int gfxDuration; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index a061be068c..045ed4f9ef 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -358,10 +358,10 @@ void GnapEngine::updateCursorByHotspot() { char t[256]; sprintf(t, "hotspot = %2d", hotspotIndex); if (!_font) - _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); + _gameSys->fillSurface(nullptr, 10, 10, 80, 16, 0, 0, 0); else - _gameSys->fillSurface(0, 8, 9, _font->getStringWidth(t) + 10, _font->getFontHeight() + 2, 0, 0, 0); - _gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t); + _gameSys->fillSurface(nullptr, 8, 9, _font->getStringWidth(t) + 10, _font->getFontHeight() + 2, 0, 0, 0); + _gameSys->drawTextToSurface(nullptr, 10, 10, 255, 255, 255, t); } if (hotspotIndex < 0) @@ -906,15 +906,15 @@ void GnapEngine::updateIdleTimer() { void GnapEngine::screenEffect(int dir, byte r, byte g, byte b) { if (dir == 1) { for (int y = 300; y < 600; y += 50) { - _gameSys->fillSurface(0, 0, y, 800, 50, r, g, b); - _gameSys->fillSurface(0, 0, 549 - y + 1, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, y, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, 549 - y + 1, 800, 50, r, g, b); gameUpdateTick(); _system->delayMillis(50); } } else { for (int y = 0; y < 300; y += 50) { - _gameSys->fillSurface(0, 0, y, 800, 50, r, g, b); - _gameSys->fillSurface(0, 0, 549 - y + 1, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, y, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, 549 - y + 1, 800, 50, r, g, b); gameUpdateTick(); _system->delayMillis(50); } diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 5631c62ba9..80c7c656c6 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -248,7 +248,7 @@ void Scene49::updateObstacle(int id) { void Scene49::increaseScore(int amount) { if (_scoreBarPos + amount <= 556) { _scoreBarPos += amount; - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _scoreBarPos, 508, amount, 22, 255, 0, 0); } _scoreLevel = (_scoreBarPos + amount >= 556) ? 1 : 0; @@ -258,7 +258,7 @@ void Scene49::decreaseScore(int amount) { if (_scoreBarPos >= 226 && _scoreLevel == 0) { if (_scoreBarFlash) refreshScoreBar(); - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); + _vm->_gameSys->fillSurface(nullptr, _scoreBarPos, 508, amount, 22, 89, 0, 5); _scoreBarPos -= amount; _scoreLevel = 0; } @@ -266,9 +266,9 @@ void Scene49::decreaseScore(int amount) { void Scene49::refreshScoreBar() { if (_scoreBarFlash) - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 226, 508, 330, 22, 255, 0, 0); else - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); + _vm->_gameSys->fillSurface(nullptr, 226, 508, 330, 22, 89, 0, 5); _scoreBarFlash = !_scoreBarFlash; } @@ -630,8 +630,8 @@ void Scene50::initRound() { _vm->_timers[3] = getRightTongueActionTicks(); _vm->_timers[4] = 0; _vm->_timers[6] = 0; - _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); - _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 91, 73, 260, 30, 212, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 450, 73, 260, 30, 212, 0, 0); _timeRemaining = 40; drawCountdown(40); } @@ -652,8 +652,8 @@ bool Scene50::updateCountdown() { void Scene50::drawCountdown(int value) { char str[8]; sprintf(str, "%02d", value); - _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); - _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); + _vm->_gameSys->fillSurface(nullptr, 371, 505, 50, 27, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(nullptr, 381, 504, 255, 255, 255, str); } void Scene50::playTonguesIdle() { @@ -698,7 +698,7 @@ bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { if (newLeftBarPos < 0) newLeftBarPos = 0; _leftTongueEnergyBarPos = newLeftBarPos; - _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); } if (newRightBarPos != _rightTongueEnergyBarPos) { @@ -706,7 +706,7 @@ bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { newRightBarPos = 0; _rightTongueEnergyBarPos = newRightBarPos; if (newRightBarPos != 10) - _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); } if (newLeftBarPos * newRightBarPos > 0) @@ -2190,7 +2190,7 @@ void Scene52::updateAlienRow(int rowNum) { if (rowNum == 1) { for (int j = 0; j < 3; ++j) { if (_shieldSpriteIds[j] != -1) { - _vm->_gameSys->fillSurface(0, _shieldPosX[j], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _shieldPosX[j], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _shieldSpriteIds[j] = -1; } } @@ -2368,7 +2368,7 @@ int Scene52::alienCannonHitShield(int cannonNum) { if (_shieldSpriteIds[shieldNum] <= 21) { _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]); } else { - _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _shieldSpriteIds[shieldNum] = -1; } _vm->_gameSys->setAnimation(0, 0, cannonNum + 9); @@ -2412,7 +2412,7 @@ bool Scene52::shipCannonHitShield(int cannonNum) { if (_shieldSpriteIds[shieldNum] <= 21) { _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]); } else { - _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _shieldSpriteIds[shieldNum] = -1; } _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _shipCannonPosX - 18, _arcadeScreenBottom - 44); @@ -2588,9 +2588,9 @@ void Scene52::updateAlien(int rowNum) { void Scene52::loseShip() { --_shipsLeft; if (_shipsLeft == 2) { - _vm->_gameSys->fillSurface(0, 120, 140, _shipMidX, _shipMidY, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 120, 140, _shipMidX, _shipMidY, 0, 0, 0); } else if (_shipsLeft == 1) { - _vm->_gameSys->fillSurface(0, 120, 185, _shipMidX, _shipMidY, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 120, 185, _shipMidX, _shipMidY, 0, 0, 0); } } @@ -2614,8 +2614,8 @@ void Scene52::initAnims() { void Scene52::drawScore(int score) { char str[4]; sprintf(str, "%03d", score); - _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); - _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); + _vm->_gameSys->fillSurface(nullptr, 420, 80, 48, 30, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(nullptr, 420, 80, 255, 255, 255, str); } void Scene52::run() { @@ -2624,8 +2624,8 @@ void Scene52::run() { _vm->hideCursor(); _gameScore = 0; - _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); - _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); + _vm->_gameSys->drawTextToSurface(nullptr, 300, 80, 255, 255, 255, "SCORE"); + _vm->_gameSys->drawTextToSurface(nullptr, 468, 80, 255, 255, 255, "0"); drawScore(0); -- cgit v1.2.3