[Scummvm-git-logs] scummvm master -> 172653b08da9edf14b1539358290739dd384c1f1

antoniou79 noreply at scummvm.org
Wed May 10 20:06:56 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3f3b744aeb TOON: Fix overreading Picture data
172653b08d TOON: Use nullptr instead of NULL


Commit: 3f3b744aeb75f441f1f7ee3b1e3293f2aa7ba6da
    https://github.com/scummvm/scummvm/commit/3f3b744aeb75f441f1f7ee3b1e3293f2aa7ba6da
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-05-10T23:03:18+03:00

Commit Message:
TOON: Fix overreading Picture data

Problematic method was Animation::drawFrameWithMaskAndScale() with mask (Picture) pointer accessing beyond the data size

Caught on Android 13, reported on the forums here: https://forums.scummvm.org/viewtopic.php?p=98340#p98340
Also moved shadow animation check to loadAnimation (rather that doing it each time within drawFrameWithMaskAndScale()

Changed paths:
    engines/toon/anim.cpp
    engines/toon/anim.h
    engines/toon/tools.cpp


diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 8e21fff036c..92df787829f 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -42,6 +42,8 @@ bool Animation::loadAnimation(const Common::String &file) {
 
 	Common::strlcpy(_name, file.c_str(), sizeof(_name));
 
+	_shadowFlag = Common::String(_name).contains("SHADOW");
+
 	uint32 headerSize = READ_LE_UINT32(fileData + 16);
 	uint32 uncompressedBytes = READ_LE_UINT32(fileData + 20);
 	uint32 compressedBytes = READ_LE_UINT32(fileData + 24);
@@ -93,16 +95,22 @@ bool Animation::loadAnimation(const Common::String &file) {
 			_frames[e]._y2 = READ_LE_UINT32(data + 28);
 
 			uint8 *imageData = data + headerSize;
+			uint32 decompressedLZSSDataSize = 0;
+			_frames[e]._dataSize = 0;
 			if (oldRef != -1 || decompressedSize == 0) {
 				_frames[e]._ref = oldRef;
-				_frames[e]._data = 0;
+				_frames[e]._data = nullptr;
+				_frames[e]._dataSize = 0;
 			} else {
 				_frames[e]._ref = -1;
 				_frames[e]._data = new uint8[decompressedSize];
 				if (compressedSize < decompressedSize) {
-					decompressLZSS(imageData, _frames[e]._data, decompressedSize);
+					decompressedLZSSDataSize = decompressLZSS(imageData, _frames[e]._data, decompressedSize);
+//					assert(decompressedSize == decompressedLZSSDataSize);
+					_frames[e]._dataSize = decompressedLZSSDataSize;
 				} else {
 					memcpy(_frames[e]._data, imageData, compressedSize);
+					_frames[e]._dataSize = compressedSize;
 				}
 			}
 
@@ -116,9 +124,11 @@ bool Animation::loadAnimation(const Common::String &file) {
 }
 
 Animation::Animation(ToonEngine *vm) : _vm(vm) {
-	_palette = NULL;
+	_palette = nullptr;
 	_numFrames = 0;
-	_frames = NULL;
+	_frames = nullptr;
+	memset(_name, 0, sizeof(_name));
+	_shadowFlag = false;
 
 	_x1 = _y1 = _x2 = _y2 = 0;
 	_fps = 0;
@@ -216,13 +226,16 @@ void Animation::drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16
 }
 
 void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale) {
-	debugC(5, kDebugAnim, "drawFrameWithMaskAndScale(surface, %d, %d, %d, %d, mask, %d)", frame, xx, yy, zz, scale);
+	debugC(5, kDebugAnim, "drawFrameWithMaskAndScale(surface, %d, %d, %d, %d, mask, %d, %s)", frame, xx, yy, zz, scale, _name);
+//	assert(frame < _numFrames && frame >= 0);
 
+	// TODO Why do we go to int16 here from int32?
 	int16 dataFrame = frame;
 
 	if (_frames[frame]._ref != -1)
 		dataFrame = _frames[frame]._ref;
 
+//	assert(dataFrame < _numFrames && dataFrame >= 0);
 	int16 rectX = _frames[frame]._x2 - _frames[frame]._x1;
 	int16 rectY = _frames[frame]._y2 - _frames[frame]._y1;
 
@@ -239,30 +252,36 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram
 	_vm->addDirtyRect(xx1, yy1, xx2, yy2);
 
 	int32 destPitch = surface.pitch;
+//	assert(mask != nullptr);
 	int32 destPitchMask = mask->getWidth();
+//	assert(_frames[dataFrame]._data != nullptr);
 	uint8 *c = _frames[dataFrame]._data;
 	uint8 *curRow = (uint8 *)surface.getPixels();
+//	assert(mask->getDataPtr() != nullptr);
 	uint8 *curRowMask = mask->getDataPtr();
+	const uint32 maskDataSize = mask->getWidth() * mask->getHeight();
 
-	bool shadowFlag = Common::String(_name).contains("SHADOW");
-
-	for (int16 y = yy1; y < yy2; y++) {
-		for (int16 x = xx1; x < xx2; x++) {
+	for (int16 y = yy1; y < yy2; ++y) {
+		for (int16 x = xx1; x < xx2; ++x) {
 			if (x < 0 || x >= 1280 || y < 0 || y >= 400)
 				continue;
 
 			uint8 *cur = curRow + x + y * destPitch;
-			uint8 *curMask = curRowMask + x + y * destPitchMask;
+			uint32 nextMaskPos = x + y * destPitchMask;
 
 			// find the good c
 			int16 xs = (x - xx1) * 1024 / scale;
 			int16 ys = (y - yy1) * 1024 / scale;
-			uint8 *cc = &c[ys * w + xs];
-			if (*cc && ((*curMask) >= zz)) {
-				if (shadowFlag)
+			// TODO Maybe check if we overread c here
+//			assert(ys * w + xs >= 0 && ys * w + xs <  _frames[dataFrame]._dataSize)
+			uint8 cc = c[ys * w + xs];
+
+			if (cc && nextMaskPos < maskDataSize && (*(curRowMask + nextMaskPos)) >= zz) {
+				if (_shadowFlag) {
 					*cur = _vm->getShadowLUT()[*cur];
-				else
-					*cur = *cc;
+				} else {
+					*cur = cc;
+				}
 			}
 		}
 	}
@@ -456,7 +475,7 @@ AnimationInstance::AnimationInstance(ToonEngine *vm, AnimationInstanceType type)
 }
 
 void AnimationInstance::render() {
-	debugC(5, kDebugAnim, "render()");
+	debugC(5, kDebugAnim, "AnimationInstance::render()");
 	if (_visible && _animation) {
 		int32 frame = _currentFrame;
 		if (frame < 0)
@@ -757,7 +776,7 @@ void AnimationManager::update(int32 timeIncrement) {
 }
 
 void AnimationManager::render() {
-	debugC(5, kDebugAnim, "render()");
+	debugC(5, kDebugAnim, "AnimationManager::render()");
 	for (uint32 i = 0; i < _instances.size(); i++) {
 		if (_instances[i]->getVisible())
 			_instances[i]->render();
diff --git a/engines/toon/anim.h b/engines/toon/anim.h
index e9ac7564d56..426a0ec95e0 100644
--- a/engines/toon/anim.h
+++ b/engines/toon/anim.h
@@ -41,6 +41,7 @@ struct AnimationFrame {
 	int16 _y2;
 	int32 _ref;
 	uint8 *_data;
+	uint32 _dataSize;
 };
 
 class Animation {
@@ -58,6 +59,7 @@ public:
 	uint8 *_palette;
 	int32 _paletteEntries;
 	char _name[32];
+	bool _shadowFlag;
 
 	bool loadAnimation(const Common::String &file);
 	void drawFrame(Graphics::Surface &surface, int32 frame, int16 x, int16 y);
@@ -65,7 +67,7 @@ public:
 	void drawFrameOnPicture(int32 frame, int16 x, int16 y);
 	void drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask);
 	void drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale);
-	void drawStrip(int32 offset = 0);
+//	void drawStrip(int32 offset = 0);
 	void applyPalette(int32 offset, int32 srcOffset, int32 numEntries);
 	Common::Rect getFrameRect(int32 frame);
 	int16 getFrameWidth(int32 frame);
diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp
index 61b30114c6a..fe8632d6c1f 100644
--- a/engines/toon/tools.cpp
+++ b/engines/toon/tools.cpp
@@ -65,6 +65,11 @@ uint32 decompressLZSS(byte *src, byte *dst, int dstsize) {
 			bitbuf >>= 1;
 		}
 	}
+
+	if (len == -1 && dstsize == 0) {
+		return (dstp - dst);
+	}
+
 	len += dstsize;
 	if (len < 0)
 		return 0;


Commit: 172653b08da9edf14b1539358290739dd384c1f1
    https://github.com/scummvm/scummvm/commit/172653b08da9edf14b1539358290739dd384c1f1
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-05-10T23:03:18+03:00

Commit Message:
TOON: Use nullptr instead of NULL

Also add some initializations for member and local variables

Changed paths:
    engines/toon/audio.cpp
    engines/toon/character.cpp
    engines/toon/font.cpp
    engines/toon/font.h
    engines/toon/hotspot.cpp
    engines/toon/path.cpp
    engines/toon/picture.cpp
    engines/toon/script.cpp
    engines/toon/script_func.cpp
    engines/toon/text.cpp
    engines/toon/toon.cpp


diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 0ed17241ddf..1ffa994f008 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -30,10 +30,10 @@ namespace Toon {
 
 AudioManager::AudioManager(ToonEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
 	for (int32 i = 0; i < 16; i++)
-		_channels[i] = NULL;
+		_channels[i] = nullptr;
 
 	for (int32 i = 0; i < 4; i++)
-		_audioPacks[i] = NULL;
+		_audioPacks[i] = nullptr;
 
 	for (int32 i = 0; i < 4; i++) {
 		_ambientSFXs[i]._delay = 0;
@@ -79,7 +79,7 @@ void AudioManager::removeInstance(AudioStreamInstance *inst) {
 
 	for (int32 i = 0; i < 16; i++) {
 		if (inst == _channels[i])
-			_channels[i] = NULL;
+			_channels[i] = nullptr;
 	}
 }
 
@@ -202,7 +202,7 @@ void AudioManager::stopCurrentVoice() {
 
 void AudioManager::closeAudioPack(int32 id) {
 	delete _audioPacks[id];
-	_audioPacks[id] = NULL;
+	_audioPacks[id] = nullptr;
 }
 
 bool AudioManager::loadAudioPack(int32 id, const Common::String &indexFile, const Common::String &packFile) {
@@ -240,11 +240,11 @@ void AudioManager::stopMusic(bool fade) {
 
 AudioStreamInstance::AudioStreamInstance(AudioManager *man, Audio::Mixer *mixer, Common::SeekableReadStream *stream , bool looping, bool deleteFileStreamAtEnd) {
 	_compBufferSize = 0;
-	_buffer = NULL;
+	_buffer = nullptr;
 	_bufferSize = 0;
 	_bufferMaxSize = 0;
 	_mixer = mixer;
-	_compBuffer = NULL;
+	_compBuffer = nullptr;
 	_bufferOffset = 0;
 	_lastSample = 0;
 	_lastStepIndex = 0;
@@ -488,8 +488,8 @@ void AudioStreamInstance::setVolume(int32 volume) {
 }
 
 AudioStreamPackage::AudioStreamPackage(ToonEngine *vm) : _vm(vm) {
-	_indexBuffer = NULL;
-	_file = NULL;
+	_indexBuffer = nullptr;
+	_file = nullptr;
 }
 
 AudioStreamPackage::~AudioStreamPackage() {
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 284145b8ea3..ae33fba4f1e 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -30,8 +30,8 @@
 namespace Toon {
 
 Character::Character(ToonEngine *vm) : _vm(vm) {
-	_animationInstance = NULL;
-	_shadowAnimationInstance = NULL;
+	_animationInstance = nullptr;
+	_shadowAnimationInstance = nullptr;
 	_x = 0;
 	_y = 0;
 	_z = 0;
@@ -39,11 +39,11 @@ Character::Character(ToonEngine *vm) : _vm(vm) {
 	_finalY = 0;
 	_sceneAnimationId = -1;
 
-	_walkAnim = NULL;
-	_idleAnim = NULL;
-	_talkAnim = NULL;
-	_shadowAnim = NULL;
-	_specialAnim = NULL;
+	_walkAnim = nullptr;
+	_idleAnim = nullptr;
+	_talkAnim = nullptr;
+	_shadowAnim = nullptr;
+	_specialAnim = nullptr;
 
 	_facing = 0;
 	_flags = 0;
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index 40977ff8d0b..97bab432812 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -210,10 +210,13 @@ void FontRenderer::renderMultiLineText(int16 x, int16 y, const Common::String &o
 	// divide the text in several lines
 	// based on number of characters or size of lines.
 	byte text[1024];
+	memset(text, 0, 1024);
 	Common::strlcpy((char *)text, origText.c_str(), 1024);
 
 	byte *lines[16];
+	memset(lines, 0, 16 * sizeof(byte *));
 	int32 lineSize[16];
+	memset(lineSize, 0, 16 * sizeof(int32));
 	int32 numLines = 0;
 
 	byte *it = text;
diff --git a/engines/toon/font.h b/engines/toon/font.h
index f82fffdbd86..d423edd13a1 100644
--- a/engines/toon/font.h
+++ b/engines/toon/font.h
@@ -52,6 +52,12 @@ struct GlyphDimensions {
 	uint8 width;
 	uint8 heightOffset; // # lines from top
 	uint8 height;
+
+	GlyphDimensions() {
+		width = 0;
+		heightOffset = 0;
+		height = 0;
+	}
 };
 
 // The font format used by the English demo.
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 32a9b9b9c79..a1b194dcf6b 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -27,7 +27,7 @@
 namespace Toon {
 
 Hotspots::Hotspots(ToonEngine *vm) : _vm(vm) {
-	_items = NULL;
+	_items = nullptr;
 	_numItems = 0;
 }
 
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index c8d1d1cdc89..9f391ac3c5a 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -28,11 +28,12 @@ namespace Toon {
 PathFindingHeap::PathFindingHeap() {
 	_count = 0;
 	_size = 0;
-	_data = NULL;
+	_data = nullptr;
 }
 
 PathFindingHeap::~PathFindingHeap() {
 	free(_data);
+	_data = nullptr;
 }
 
 void PathFindingHeap::init(int32 size) {
@@ -41,7 +42,11 @@ void PathFindingHeap::init(int32 size) {
 
 	free(_data);
 	_data = (HeapDataGrid *)malloc(sizeof(HeapDataGrid) * _size);
-	memset(_data, 0, sizeof(HeapDataGrid) * _size);
+	if (_data != nullptr) {
+		memset(_data, 0, sizeof(HeapDataGrid) * _size);
+	} else {
+		error("Could not allocate PathFindingHeap size: %d", _size);
+	}
 	_count = 0;
 }
 
@@ -49,7 +54,7 @@ void PathFindingHeap::unload() {
 	_count = 0;
 	_size = 0;
 	free(_data);
-	_data = NULL;
+	_data = nullptr;
 }
 
 void PathFindingHeap::clear() {
@@ -68,7 +73,7 @@ void PathFindingHeap::push(int16 x, int16 y, uint16 weight) {
 		HeapDataGrid *newData;
 
 		newData = (HeapDataGrid *)realloc(_data, sizeof(HeapDataGrid) * newSize);
-		if (newData == NULL) {
+		if (newData == nullptr) {
 			warning("Aborting attempt to push onto PathFindingHeap at maximum size: %d", _count);
 			return;
 		}
@@ -145,11 +150,11 @@ void PathFindingHeap::pop(int16 *x, int16 *y, uint16 *weight) {
 	}
 }
 
-PathFinding::PathFinding() {
+PathFinding::PathFinding() : _blockingRects{{0}} {
 	_width = 0;
 	_height = 0;
 	_heap = new PathFindingHeap();
-	_sq = NULL;
+	_sq = nullptr;
 	_numBlockingRects = 0;
 
 	_currentMask = nullptr;
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 6638aaf4454..26c964150f4 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -62,7 +62,7 @@ bool Picture::loadPicture(const Common::String &file) {
 			memcpy(_palette, _data + dstsize - (dstsize & 0x7ff), _paletteEntries * 3);
 			_vm->fixPaletteEntries(_palette, _paletteEntries);
 		} else {
-			_palette = NULL;
+			_palette = nullptr;
 		}
 		return true;
 	}
@@ -77,7 +77,7 @@ bool Picture::loadPicture(const Common::String &file) {
 			memcpy(_palette, fileData + 16, _paletteEntries * 3);
 			_vm->fixPaletteEntries(_palette, _paletteEntries);
 		} else {
-			_palette = NULL;
+			_palette = nullptr;
 		}
 
 		// size can only be 640x400 or 1280x400
@@ -136,8 +136,8 @@ bool Picture::loadPicture(const Common::String &file) {
 }
 
 Picture::Picture(ToonEngine *vm) : _vm(vm) {
-	_data = NULL;
-	_palette = NULL;
+	_data = nullptr;
+	_palette = nullptr;
 
 	_width = 0;
 	_height = 0;
@@ -153,7 +153,7 @@ Picture::~Picture() {
 void Picture::setupPalette() {
 	debugC(1, kDebugPicture, "setupPalette()");
 
-	if (_palette != NULL) {
+	if (_palette != nullptr) {
 		if (_useFullPalette)
 			_vm->setPaletteEntries(_palette, 0, 256);
 		else
diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp
index 4068e3b751f..01cb1848a77 100644
--- a/engines/toon/script.cpp
+++ b/engines/toon/script.cpp
@@ -146,13 +146,13 @@ void EMCInterpreter::unload(EMCData *data) {
 		return;
 
 	delete[] data->text;
-	data->text = NULL;
+	data->text = nullptr;
 
 	delete[] data->ordr;
-	data->ordr = NULL;
+	data->ordr = nullptr;
 
 	delete[] data->data;
-	 data->data = NULL;
+	data->data = nullptr;
 }
 
 void EMCInterpreter::init(EMCState *scriptStat, const EMCData *data) {
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index ba17b668e53..8feddf248ed 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -1186,17 +1186,17 @@ int32 ScriptFunc::sys_Cmd_Remove_Scene_Anim(EMCState *state) {
 	sceneAnim->_active = false;
 	_vm->getAnimationManager()->removeInstance(sceneAnim->_animInstance);
 	delete sceneAnim->_animation;
-	sceneAnim->_animation = NULL;
+	sceneAnim->_animation = nullptr;
 
 	// see if one character shares this instance
 	for (int32 c = 0; c < 32; c++) {
 		if (_vm->getCharacter(c) && _vm->getCharacter(c)->getAnimationInstance() == sceneAnim->_originalAnimInstance) {
-			_vm->getCharacter(c)->setAnimationInstance(NULL);
+			_vm->getCharacter(c)->setAnimationInstance(nullptr);
 		}
 	}
 	delete sceneAnim->_originalAnimInstance;
-	sceneAnim->_originalAnimInstance = NULL;
-	sceneAnim->_animInstance = NULL;
+	sceneAnim->_originalAnimInstance = nullptr;
+	sceneAnim->_animInstance = nullptr;
 	return 0;
 }
 
diff --git a/engines/toon/text.cpp b/engines/toon/text.cpp
index 18065950036..9472af6c23c 100644
--- a/engines/toon/text.cpp
+++ b/engines/toon/text.cpp
@@ -27,7 +27,7 @@ namespace Toon {
 
 TextResource::TextResource(ToonEngine *vm) : _vm(vm) {
 	_numTexts = 0;
-	_textData = NULL;
+	_textData = nullptr;
 }
 
 TextResource::~TextResource(void) {
@@ -84,7 +84,7 @@ char *TextResource::getText(int32 offset) {
 		}
 	}
 	if (found < 0)
-		return NULL;
+		return nullptr;
 
 	int32 realOffset = READ_LE_UINT16((uint16 *)_textData + 1 + _numTexts + found);
 	return (char *)_textData + realOffset;
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 8bc5fa2fad6..43d01070998 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -113,7 +113,7 @@ void ToonEngine::init() {
 	resources()->openPackage("SUBTITLES.PAK");
 
 	for (int32 i = 0; i < 32; i++)
-		_characters[i] = NULL;
+		_characters[i] = nullptr;
 
 	_characters[0] = new CharacterDrew(this);
 	_characters[1] = new CharacterFlux(this);
@@ -1546,72 +1546,72 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
 	: Engine(syst), _gameDescription(gameDescription),
 	_language(gameDescription->language), _rnd("toon") {
 	_tickLength = 16;
-	_currentPicture = NULL;
-	_inventoryPicture = NULL;
-	_currentMask = NULL;
+	_currentPicture = nullptr;
+	_inventoryPicture = nullptr;
+	_currentMask = nullptr;
 	_showConversationText = true;
 	_textSpeed = 60;
 	_useAlternativeFont = false;
 	_isDemo = _gameDescription->flags & ADGF_DEMO;
 	_isEnglishDemo = _isDemo && _gameDescription->language == Common::EN_ANY;
 
-	_resources = NULL;
-	_animationManager = NULL;
-	_moviePlayer = NULL;
-	_mainSurface = NULL;
+	_resources = nullptr;
+	_animationManager = nullptr;
+	_moviePlayer = nullptr;
+	_mainSurface = nullptr;
 
-	_finalPalette = NULL;
-	_backupPalette = NULL;
-	_additionalPalette1 = NULL;
-	_additionalPalette2 = NULL;
+	_finalPalette = nullptr;
+	_backupPalette = nullptr;
+	_additionalPalette1 = nullptr;
+	_additionalPalette2 = nullptr;
 	_additionalPalette2Present = false;
-	_cutawayPalette = NULL;
-	_universalPalette = NULL;
-	_fluxPalette = NULL;
+	_cutawayPalette = nullptr;
+	_universalPalette = nullptr;
+	_fluxPalette = nullptr;
 
-	_roomScaleData = NULL;
-	_shadowLUT = NULL;
+	_roomScaleData = nullptr;
+	_shadowLUT = nullptr;
 
-	_conversationData = NULL;
+	_conversationData = nullptr;
 
-	_fontRenderer = NULL;
-	_fontToon = NULL;
-	_fontEZ = NULL;
-	_hotspots = NULL;
-	_genericTexts = NULL;
-	_roomTexts = NULL;
-	_script_func = NULL;
-	_script = NULL;
+	_fontRenderer = nullptr;
+	_fontToon = nullptr;
+	_fontEZ = nullptr;
+	_hotspots = nullptr;
+	_genericTexts = nullptr;
+	_roomTexts = nullptr;
+	_script_func = nullptr;
+	_script = nullptr;
 
 	_mouseX = 0;
 	_mouseY = 0;
 	_mouseButton = 0;
 	_lastMouseButton = 0;
 
-	_saveBufferStream = NULL;
+	_saveBufferStream = nullptr;
 
-	_pathFinding = NULL;
+	_pathFinding = nullptr;
 	setDebugger(new ToonConsole(this));
 
-	_cursorAnimation = NULL;
-	_cursorAnimationInstance = NULL;
-	_dialogIcons = NULL;
-	_inventoryIcons = NULL;
-	_inventoryIconSlots = NULL;
-	_genericTexts = NULL;
-	_audioManager = NULL;
-	_gameState = NULL;
+	_cursorAnimation = nullptr;
+	_cursorAnimationInstance = nullptr;
+	_dialogIcons = nullptr;
+	_inventoryIcons = nullptr;
+	_inventoryIconSlots = nullptr;
+	_genericTexts = nullptr;
+	_audioManager = nullptr;
+	_gameState = nullptr;
 
-	_locationDirNotVisited = NULL;
-	_locationDirVisited = NULL;
-	_specialInfoLine = NULL;
+	_locationDirNotVisited = nullptr;
+	_locationDirVisited = nullptr;
+	_specialInfoLine = nullptr;
 
 	for (int i = 0; i < 64; i++) {
 		_sceneAnimations[i]._active = false;
 	}
 
 	for (int i = 0; i < 32; i++) {
-		_characters[i] = NULL;
+		_characters[i] = nullptr;
 	}
 
 	memset(&_scriptData, 0, sizeof(EMCData));
@@ -2471,14 +2471,14 @@ void ToonEngine::exitScene() {
 			// see if one character shares this instance
 			for (int32 c = 0; c < 32; c++) {
 				if (_characters[c] && _characters[c]->getAnimationInstance() == _sceneAnimations[i]._animInstance) {
-					_characters[c]->setAnimationInstance(NULL);
+					_characters[c]->setAnimationInstance(nullptr);
 				}
 			}
 
 			delete _sceneAnimations[i]._originalAnimInstance;
-			_sceneAnimations[i]._animInstance = NULL;
-			_sceneAnimations[i]._animation = NULL;
-			_sceneAnimations[i]._originalAnimInstance = NULL;
+			_sceneAnimations[i]._animInstance = nullptr;
+			_sceneAnimations[i]._animation = nullptr;
+			_sceneAnimations[i]._originalAnimInstance = nullptr;
 		}
 	}
 	for (int32 i = 0; i < 64; i++) {
@@ -2602,7 +2602,7 @@ void ToonEngine::setFont(bool alternative) {
 
 void ToonEngine::drawInfoLine() {
 	if (_currentHotspotItem != 0 && !_gameState->_mouseHidden && !_gameState->_inConversation) {
-		const char *infoTool = NULL;
+		const char *infoTool = nullptr;
 		if (_currentHotspotItem >= 0 && _currentHotspotItem < 2000) {
 			infoTool = _roomTexts->getText(_currentHotspotItem);
 		} else if (_currentHotspotItem <= -1) {
@@ -5616,8 +5616,8 @@ void SceneAnimation::load(ToonEngine *vm, Common::ReadStream *stream) {
 		//vm->getAnimationManager()->addInstance(_animInstance);
 		_originalAnimInstance = _animInstance;
 	} else {
-		_animInstance = NULL;
-		_originalAnimInstance = NULL;
+		_animInstance = nullptr;
+		_originalAnimInstance = nullptr;
 	}
 
 	// load animation if any




More information about the Scummvm-git-logs mailing list