Skip to content

Commit

Permalink
TUCKER: Initialize some pointers with nullptr instead of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Mar 15, 2014
1 parent 0e48803 commit 661f041
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
8 changes: 4 additions & 4 deletions engines/tucker/resource.cpp
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down
7 changes: 3 additions & 4 deletions engines/tucker/sequences.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
24 changes: 12 additions & 12 deletions engines/tucker/tucker.cpp
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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));
Expand All @@ -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;
Expand Down

0 comments on commit 661f041

Please sign in to comment.