From 661f0414726240cd3c6aae24eb431a231bcccf0d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Mar 2014 12:02:44 +0100 Subject: TUCKER: Initialize some pointers with nullptr instead of 0 --- engines/tucker/resource.cpp | 8 ++++---- engines/tucker/sequences.cpp | 7 +++---- engines/tucker/tucker.cpp | 24 ++++++++++++------------ 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'engines') diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index dfb5c9ba21..31a34cd5f5 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -819,9 +819,9 @@ void TuckerEngine::loadSprA02_01() { void TuckerEngine::unloadSprA02_01() { for (int i = 1; i < kSprA02TableSize; ++i) { free(_sprA02Table[i]); - _sprA02Table[i] = 0; + _sprA02Table[i] = nullptr; } - _sprA02Table[0] = 0; + _sprA02Table[0] = nullptr; } void TuckerEngine::loadSprC02_01() { @@ -843,9 +843,9 @@ void TuckerEngine::loadSprC02_01() { void TuckerEngine::unloadSprC02_01() { for (int i = 1; i < kSprC02TableSize; ++i) { free(_sprC02Table[i]); - _sprC02Table[i] = 0; + _sprC02Table[i] = nullptr; } - _sprC02Table[0] = 0; + _sprC02Table[0] = nullptr; } void TuckerEngine::loadFx() { diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 74a2e9a461..b82bb9ca5c 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -487,11 +487,11 @@ AnimationSequencePlayer::AnimationSequencePlayer(OSystem *system, Audio::Mixer * memset(_animationPalette, 0, sizeof(_animationPalette)); _soundSeqDataCount = 0; _soundSeqDataIndex = 0; - _soundSeqData = 0; + _soundSeqData = nullptr; _offscreenBuffer = (uint8 *)malloc(kScreenWidth * kScreenHeight); _updateScreenWidth = 0; _updateScreenPicture = false; - _picBufPtr = _pic2BufPtr = 0; + _picBufPtr = _pic2BufPtr = nullptr; _changeToNextSequence = false; _updateFunc = nullptr; @@ -731,9 +731,8 @@ void AnimationSequencePlayer::fadeOutPalette() { void AnimationSequencePlayer::unloadAnimation() { _mixer->stopAll(); free(_picBufPtr); - _picBufPtr = 0; free(_pic2BufPtr); - _pic2BufPtr = 0; + _picBufPtr = _pic2BufPtr = nullptr; } uint8 *AnimationSequencePlayer::loadPicture(const char *fileName) { diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 68ffe5e5e5..ae8a39cedf 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -86,17 +86,17 @@ void TuckerEngine::allocateBuffers() { _charsetGfxBuf = (uint8 *)calloc(1, 22400); _cursorGfxBuf = (uint8 *)calloc(1, 256 * 7); _infoBarBuf = (uint8 *)calloc(1, 1000); - _charNameBuf = 0; - _bgTextBuf = 0; - _objTxtBuf = 0; + _charNameBuf = nullptr; + _bgTextBuf = nullptr; + _objTxtBuf = nullptr; _panelObjectsGfxBuf = (uint8 *)calloc(1, 20000); - _data5Buf = 0; + _data5Buf = nullptr; _data3GfxBuf = (uint8 *)calloc(1, 250000); _quadBackgroundGfxBuf = (uint8 *)calloc(1, 320 * 140 * 4); _locationBackgroundMaskBuf = (uint8 *)calloc(1, 640 * 140); - _csDataBuf = 0; + _csDataBuf = nullptr; _spritesGfxBuf = (uint8 *)calloc(1, 160000); - _ptTextBuf = 0; + _ptTextBuf = nullptr; memset(_charWidthTable, 0, sizeof(_charWidthTable)); } @@ -226,7 +226,7 @@ void TuckerEngine::resetVariables() { _selectedCharacterNum = 0; _actionObj1Type = _actionObj2Type = 0; _actionObj1Num = _actionObj2Num = 0; - _actionRequiresTwoObjects = 0; + _actionRequiresTwoObjects = false; _actionVerbLocked = 0; _actionPosX = 0; _actionPosY = 0; @@ -250,7 +250,7 @@ void TuckerEngine::resetVariables() { _nextTableToLoadIndex = 0; memset(_nextTableToLoadTable, 0, sizeof(_nextTableToLoadTable)); _soundInstructionIndex = 0; - _tableInstructionsPtr = 0; + _tableInstructionsPtr = nullptr; memset(_tableInstructionObj1Table, 0, sizeof(_tableInstructionObj1Table)); memset(_tableInstructionObj2Table, 0, sizeof(_tableInstructionObj2Table)); _tableInstructionFlag = 0; @@ -269,7 +269,7 @@ void TuckerEngine::resetVariables() { _skipCurrentCharacterDraw = false; _yPosCurrent = 131; _xPosCurrent = 160; - _characterSpeechDataPtr = 0; + _characterSpeechDataPtr = nullptr; _ptTextOffset = 0; memset(_characterAnimationsTable, 0, sizeof(_characterAnimationsTable)); memset(_characterStateTable, 0, sizeof(_characterStateTable)); @@ -296,12 +296,12 @@ void TuckerEngine::resetVariables() { _updateSpriteFlag2 = false; _mirroredDrawing = 0; - _loadLocBufPtr = 0; - _backgroundSpriteDataPtr = 0; + _loadLocBufPtr = nullptr; + _backgroundSpriteDataPtr = nullptr; _locationHeight = 0; _scrollOffset = 0; _currentGfxBackgroundCounter = 0; - _currentGfxBackground = 0; + _currentGfxBackground = nullptr; _fadePaletteCounter = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); _fullRedraw = false; -- cgit v1.2.3