diff options
Diffstat (limited to 'engines/wintermute/base')
64 files changed, 567 insertions, 567 deletions
diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp index e351792e61..c0459b0ce5 100644 --- a/engines/wintermute/base/base.cpp +++ b/engines/wintermute/base/base.cpp @@ -42,7 +42,7 @@ BaseClass::BaseClass(BaseGame *gameOwner) { ////////////////////////////////////////////////////////////////////////// BaseClass::BaseClass() { - _gameRef = NULL; + _gameRef = nullptr; _persistable = true; } @@ -111,8 +111,8 @@ bool BaseClass::parseEditorProperty(byte *buffer, bool complete) { buffer = params; } - char *propName = NULL; - char *propValue = NULL; + char *propName = nullptr; + char *propValue = nullptr; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -141,16 +141,16 @@ bool BaseClass::parseEditorProperty(byte *buffer, bool complete) { if (cmd == PARSERR_TOKENNOTFOUND) { delete[] propName; delete[] propValue; - propName = NULL; - propValue = NULL; + propName = nullptr; + propValue = nullptr; _gameRef->LOG(0, "Syntax error in EDITOR_PROPERTY definition"); return STATUS_FAILED; } - if (cmd == PARSERR_GENERIC || propName == NULL || propValue == NULL) { + if (cmd == PARSERR_GENERIC || propName == nullptr || propValue == nullptr) { delete[] propName; delete[] propValue; - propName = NULL; - propValue = NULL; + propName = nullptr; + propValue = nullptr; _gameRef->LOG(0, "Error loading EDITOR_PROPERTY definition"); return STATUS_FAILED; } @@ -160,8 +160,8 @@ bool BaseClass::parseEditorProperty(byte *buffer, bool complete) { delete[] propName; delete[] propValue; - propName = NULL; - propValue = NULL; + propName = nullptr; + propValue = nullptr; return STATUS_OK; } diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h index 24820c748a..7f2796c6e0 100644 --- a/engines/wintermute/base/base.h +++ b/engines/wintermute/base/base.h @@ -44,7 +44,7 @@ class BaseClass { public: bool _persistable; bool setEditorProp(const Common::String &propName, const Common::String &propValue); - Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = NULL); + Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = nullptr); BaseClass(TDynamicConstructor, TDynamicConstructor) {} bool parseEditorProperty(byte *buffer, bool complete = true); virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0); diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp index 4addf15be8..4c62cf9561 100644 --- a/engines/wintermute/base/base_active_rect.cpp +++ b/engines/wintermute/base/base_active_rect.cpp @@ -37,9 +37,9 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////// BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) { BasePlatform::setRectEmpty(&_rect); - _owner = NULL; - _frame = NULL; - _region = NULL; + _owner = nullptr; + _frame = nullptr; + _region = nullptr; _zoomX = 100; _zoomY = 100; _offsetX = _offsetY = 0; @@ -55,7 +55,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame _zoomX = zoomX; _zoomY = zoomY; _precise = precise; - _region = NULL; + _region = nullptr; _offsetX = _offsetY = 0; clipRect(); } @@ -69,7 +69,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion * _zoomX = 100; _zoomY = 100; _precise = true; - _frame = NULL; + _frame = nullptr; clipRect(); _offsetX = offsetX; _offsetY = offsetY; @@ -78,9 +78,9 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion * ////////////////////////////////////////////////////////////////////// BaseActiveRect::~BaseActiveRect() { - _owner = NULL; - _frame = NULL; - _region = NULL; + _owner = nullptr; + _frame = nullptr; + _region = nullptr; } diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h index fcd2619b03..7ef8374814 100644 --- a/engines/wintermute/base/base_active_rect.h +++ b/engines/wintermute/base/base_active_rect.h @@ -48,7 +48,7 @@ public: int _offsetX; int _offsetY; Rect32 _rect; - BaseActiveRect(BaseGame *inGameOwner = NULL); + BaseActiveRect(BaseGame *inGameOwner = nullptr); BaseActiveRect(BaseGame *inGameOwner, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX = 100, float zoomY = 100, bool precise = true); BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *region, int offsetX, int offsetY); virtual ~BaseActiveRect(); diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp index dc14a4e052..f684420b1e 100644 --- a/engines/wintermute/base/base_dynamic_buffer.cpp +++ b/engines/wintermute/base/base_dynamic_buffer.cpp @@ -33,7 +33,7 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BaseDynamicBuffer::BaseDynamicBuffer(BaseGame *inGame, uint32 initSize, uint32 growBy) { - _buffer = NULL; + _buffer = nullptr; _size = 0; _realSize = 0; @@ -56,7 +56,7 @@ void BaseDynamicBuffer::cleanup() { if (_buffer) { free(_buffer); } - _buffer = NULL; + _buffer = nullptr; _size = 0; _realSize = 0; _offset = 0; @@ -164,7 +164,7 @@ char *BaseDynamicBuffer::getString() { _offset += len; if (!strcmp(ret, "(null)")) { - return NULL; + return nullptr; } else { return ret; } diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index 8146d14beb..a13ca4d919 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -39,10 +39,10 @@ DECLARE_SINGLETON(Wintermute::BaseEngine); namespace Wintermute { BaseEngine::BaseEngine() { - _fileManager = NULL; - _gameRef = NULL; - _classReg = NULL; - _rnd = NULL; + _fileManager = nullptr; + _gameRef = nullptr; + _classReg = nullptr; + _rnd = nullptr; _gameId = ""; } diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index b726c0c66f..3815440bcc 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -84,32 +84,32 @@ bool BaseFileManager::cleanup() { ////////////////////////////////////////////////////////////////////// byte *BaseFileManager::readWholeFile(const Common::String &filename, uint32 *size, bool mustExist) { - byte *buffer = NULL; + byte *buffer = nullptr; Common::SeekableReadStream *file = openFile(filename); if (!file) { if (mustExist) { debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error opening file '%s'", filename.c_str()); } - return NULL; + return nullptr; } buffer = new byte[file->size() + 1]; - if (buffer == NULL) { + if (buffer == nullptr) { debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error allocating buffer for file '%s' (%d bytes)", filename.c_str(), file->size() + 1); closeFile(file); - return NULL; + return nullptr; } if (file->read(buffer, (uint32)file->size()) != (uint32)file->size()) { debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error reading file '%s'", filename.c_str()); closeFile(file); delete[] buffer; - return NULL; + return nullptr; }; buffer[file->size()] = '\0'; - if (size != NULL) { + if (size != nullptr) { *size = file->size(); } closeFile(file); @@ -228,7 +228,7 @@ bool BaseFileManager::registerPackage(Common::FSNode file, const Common::String Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &filename) { Common::String upcName = filename; upcName.toUppercase(); - Common::SeekableReadStream *file = NULL; + Common::SeekableReadStream *file = nullptr; char fileName[MAX_PATH_LENGTH]; strcpy(fileName, upcName.c_str()); @@ -240,7 +240,7 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f } Common::ArchiveMemberPtr entry = _packages.getMember(upcName); if (!entry) { - return NULL; + return nullptr; } file = entry->createReadStream(); return file; @@ -270,7 +270,7 @@ bool BaseFileManager::hasFile(const Common::String &filename) { ////////////////////////////////////////////////////////////////////////// Common::SeekableReadStream *BaseFileManager::openFile(const Common::String &filename, bool absPathWarning, bool keepTrackOf) { if (strcmp(filename.c_str(), "") == 0) { - return NULL; + return nullptr; } debugC(kWintermuteDebugFileAccess, "Open file %s", filename.c_str()); @@ -297,7 +297,7 @@ bool BaseFileManager::closeFile(Common::SeekableReadStream *File) { ////////////////////////////////////////////////////////////////////////// Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &filename) { - Common::SeekableReadStream *ret = NULL; + Common::SeekableReadStream *ret = nullptr; if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) { if (!BaseEngine::instance().getGameRef()) { @@ -327,14 +327,14 @@ Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &f } debugC(kWintermuteDebugFileAccess ,"BFileManager::OpenFileRaw - Failed to open %s", filename.c_str()); - return NULL; + return nullptr; } BaseFileManager *BaseFileManager::getEngineInstance() { if (BaseEngine::instance().getFileManager()) { return BaseEngine::instance().getFileManager(); } - return NULL; + return nullptr; } } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 70aff49bbb..e88b5e6af4 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -43,7 +43,7 @@ public: bool closeFile(Common::SeekableReadStream *File); bool hasFile(const Common::String &filename); Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true); - byte *readWholeFile(const Common::String &filename, uint32 *size = NULL, bool mustExist = true); + byte *readWholeFile(const Common::String &filename, uint32 *size = nullptr, bool mustExist = true); BaseFileManager(Common::Language lang); virtual ~BaseFileManager(); diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp index 7c64144480..8a190c729b 100644 --- a/engines/wintermute/base/base_frame.cpp +++ b/engines/wintermute/base/base_frame.cpp @@ -48,7 +48,7 @@ BaseFrame::BaseFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { _delay = 0; _moveX = _moveY = 0; - _sound = NULL; + _sound = nullptr; _killSound = false; _editorExpanded = false; @@ -59,7 +59,7 @@ BaseFrame::BaseFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { ////////////////////////////////////////////////////////////////////// BaseFrame::~BaseFrame() { delete _sound; - _sound = NULL; + _sound = nullptr; for (uint32 i = 0; i < _subframes.size(); i++) { delete _subframes[i]; @@ -68,7 +68,7 @@ BaseFrame::~BaseFrame() { for (uint32 i = 0; i < _applyEvent.size(); i++) { delete[] _applyEvent[i]; - _applyEvent[i] = NULL; + _applyEvent[i] = nullptr; } _applyEvent.clear(); } @@ -181,7 +181,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { bool mirrorX = false; bool mirrorY = false; BasePlatform::setRectEmpty(&rect); - char *surface_file = NULL; + char *surface_file = nullptr; while ((cmd = parser.getCommand((char **)&buffer, commands, ¶ms)) > 0) { switch (cmd) { @@ -260,7 +260,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { case TOKEN_SOUND: { if (_sound) { delete _sound; - _sound = NULL; + _sound = nullptr; } _sound = new BaseSound(_gameRef); if (!_sound || DID_FAIL(_sound->setSound(params, Audio::Mixer::kSFXSoundType, false))) { @@ -268,7 +268,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { _gameRef->LOG(0, "Error loading sound '%s'.", params); } delete _sound; - _sound = NULL; + _sound = nullptr; } } break; @@ -305,7 +305,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { BaseSubFrame *sub = new BaseSubFrame(_gameRef); - if (surface_file != NULL) { + if (surface_file != nullptr) { if (custoTrans) { sub->setSurface(surface_file, false, r, g, b, lifeTime, keepLoaded); } else { @@ -452,14 +452,14 @@ bool BaseFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStac stack->correctParams(1); ScValue *val = stack->pop(); delete _sound; - _sound = NULL; + _sound = nullptr; if (!val->isNULL()) { _sound = new BaseSound(_gameRef); if (!_sound || DID_FAIL(_sound->setSound(val->getString(), Audio::Mixer::kSFXSoundType, false))) { stack->pushBool(false); delete _sound; - _sound = NULL; + _sound = nullptr; } else { stack->pushBool(true); } @@ -516,13 +516,13 @@ bool BaseFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStac else if (strcmp(name, "AddSubframe") == 0) { stack->correctParams(1); ScValue *val = stack->pop(); - const char *filename = NULL; + const char *filename = nullptr; if (!val->isNULL()) { filename = val->getString(); } BaseSubFrame *sub = new BaseSubFrame(_gameRef); - if (filename != NULL) { + if (filename != nullptr) { sub->setSurface(filename); sub->setDefaultRect(); } @@ -543,13 +543,13 @@ bool BaseFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStac } ScValue *val = stack->pop(); - const char *filename = NULL; + const char *filename = nullptr; if (!val->isNULL()) { filename = val->getString(); } BaseSubFrame *sub = new BaseSubFrame(_gameRef); - if (filename != NULL) { + if (filename != nullptr) { sub->setSurface(filename); } diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h index 7c5d893e70..5ed0b92bba 100644 --- a/engines/wintermute/base/base_frame.h +++ b/engines/wintermute/base/base_frame.h @@ -51,7 +51,7 @@ public: int _moveX; uint32 _delay; BaseArray<BaseSubFrame *> _subframes; - bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool draw(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded); BaseFrame(BaseGame *inGame); diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 46acd8cd98..5ea50ee7f6 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -92,30 +92,30 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _interactive = true; _origInteractive = false; - _surfaceStorage = NULL; - _fontStorage = NULL; - _renderer = NULL; - _soundMgr = NULL; - _transMgr = NULL; - _scEngine = NULL; - _keyboardState = NULL; + _surfaceStorage = nullptr; + _fontStorage = nullptr; + _renderer = nullptr; + _soundMgr = nullptr; + _transMgr = nullptr; + _scEngine = nullptr; + _keyboardState = nullptr; - _mathClass = NULL; + _mathClass = nullptr; - _debugLogFile = NULL; + _debugLogFile = nullptr; _debugDebugMode = false; _debugShowFPS = false; - _systemFont = NULL; - _videoFont = NULL; + _systemFont = nullptr; + _videoFont = nullptr; - _videoPlayer = NULL; - _theoraPlayer = NULL; + _videoPlayer = nullptr; + _theoraPlayer = nullptr; - _mainObject = NULL; - _activeObject = NULL; + _mainObject = nullptr; + _activeObject = nullptr; - _fader = NULL; + _fader = nullptr; _offsetX = _offsetY = 0; _offsetPercentX = _offsetPercentY = 0.0f; @@ -135,12 +135,12 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _mousePos.x = _mousePos.y = 0; _mouseLeftDown = _mouseRightDown = _mouseMidlleDown = false; - _capturedObject = NULL; + _capturedObject = nullptr; // FPS counters _lastTime = _fpsTime = _deltaTime = _framesRendered = _fps = 0; - _cursorNoninteractive = NULL; + _cursorNoninteractive = nullptr; _useD3D = false; @@ -154,7 +154,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _settingsRequireSound = false; _settingsTLMode = 0; _settingsAllowWindowed = true; - _settingsGameFile = NULL; + _settingsGameFile = nullptr; _settingsAllowAdvanced = false; _settingsAllowAccessTab = true; _settingsAllowAboutTab = true; @@ -163,7 +163,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _editorForceScripts = false; _editorAlwaysRegister = false; - _focusedWindow = NULL; + _focusedWindow = nullptr; _loadInProgress = false; @@ -177,8 +177,8 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _editorMode = false; //_doNotExpandStrings = false; - _engineLogCallback = NULL; - _engineLogCallbackData = NULL; + _engineLogCallback = nullptr; + _engineLogCallbackData = nullptr; _smartCache = false; _surfaceGCCycleTime = 10000; @@ -199,7 +199,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _saveDirChecked = false; - _loadingIcon = NULL; + _loadingIcon = nullptr; _loadingIconX = _loadingIconY = 0; _loadingIconPersistent = false; @@ -209,7 +209,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _soundBufferSizeSec = 3; _suspendedRendering = false; - _lastCursor = NULL; + _lastCursor = nullptr; BasePlatform::setRectEmpty(&_mouseLockRect); @@ -217,7 +217,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _lastMiniUpdate = 0; _miniUpdateEnabled = false; - _cachedThumbnail = NULL; + _cachedThumbnail = nullptr; _autorunDisabled = false; @@ -273,23 +273,23 @@ BaseGame::~BaseGame() { delete _stringTable; delete _musicSystem; - _settingsGameFile = NULL; + _settingsGameFile = nullptr; - _cachedThumbnail = NULL; + _cachedThumbnail = nullptr; - _mathClass = NULL; + _mathClass = nullptr; - _transMgr = NULL; - _scEngine = NULL; - _fontStorage = NULL; - _surfaceStorage = NULL; - _videoPlayer = NULL; - _theoraPlayer = NULL; - _soundMgr = NULL; + _transMgr = nullptr; + _scEngine = nullptr; + _fontStorage = nullptr; + _surfaceStorage = nullptr; + _videoPlayer = nullptr; + _theoraPlayer = nullptr; + _soundMgr = nullptr; - _renderer = NULL; - _stringTable = NULL; - _musicSystem = NULL; + _renderer = nullptr; + _stringTable = nullptr; + _musicSystem = nullptr; DEBUG_DebugDisable(); debugC(kWintermuteDebugLog, "--- shutting down normally ---\n"); @@ -299,48 +299,48 @@ BaseGame::~BaseGame() { ////////////////////////////////////////////////////////////////////////// bool BaseGame::cleanup() { delete _loadingIcon; - _loadingIcon = NULL; + _loadingIcon = nullptr; - _engineLogCallback = NULL; - _engineLogCallbackData = NULL; + _engineLogCallback = nullptr; + _engineLogCallbackData = nullptr; _musicSystem->cleanup(); unregisterObject(_fader); - _fader = NULL; + _fader = nullptr; for (uint32 i = 0; i < _regObjects.size(); i++) { delete _regObjects[i]; - _regObjects[i] = NULL; + _regObjects[i] = nullptr; } _regObjects.clear(); _windows.clear(); // refs only - _focusedWindow = NULL; // ref only + _focusedWindow = nullptr; // ref only delete _cursorNoninteractive; delete _cursor; delete _activeCursor; - _cursorNoninteractive = NULL; - _cursor = NULL; - _activeCursor = NULL; + _cursorNoninteractive = nullptr; + _cursor = nullptr; + _activeCursor = nullptr; delete _scValue; delete _sFX; - _scValue = NULL; - _sFX = NULL; + _scValue = nullptr; + _sFX = nullptr; for (uint32 i = 0; i < _scripts.size(); i++) { - _scripts[i]->_owner = NULL; + _scripts[i]->_owner = nullptr; _scripts[i]->finish(); } _scripts.clear(); _fontStorage->removeFont(_systemFont); - _systemFont = NULL; + _systemFont = nullptr; _fontStorage->removeFont(_videoFont); - _videoFont = NULL; + _videoFont = nullptr; for (uint32 i = 0; i < _quickMessages.size(); i++) { delete _quickMessages[i]; @@ -350,17 +350,17 @@ bool BaseGame::cleanup() { _viewportStack.clear(); _viewportSP = -1; - setName(NULL); - setFilename(NULL); + setName(nullptr); + setFilename(nullptr); for (int i = 0; i < 7; i++) { delete[] _caption[i]; - _caption[i] = NULL; + _caption[i] = nullptr; } - _lastCursor = NULL; + _lastCursor = nullptr; delete _keyboardState; - _keyboardState = NULL; + _keyboardState = nullptr; return STATUS_OK; } @@ -371,47 +371,47 @@ bool BaseGame::initialize1() { bool loaded = false; // Not really a loop, but a goto-replacement. while (!loaded) { _surfaceStorage = new BaseSurfaceStorage(this); - if (_surfaceStorage == NULL) { + if (_surfaceStorage == nullptr) { break; } _fontStorage = new BaseFontStorage(this); - if (_fontStorage == NULL) { + if (_fontStorage == nullptr) { break; } _soundMgr = new BaseSoundMgr(this); - if (_soundMgr == NULL) { + if (_soundMgr == nullptr) { break; } _mathClass = makeSXMath(this); - if (_mathClass == NULL) { + if (_mathClass == nullptr) { break; } _scEngine = new ScEngine(this); - if (_scEngine == NULL) { + if (_scEngine == nullptr) { break; } _videoPlayer = new VideoPlayer(this); - if (_videoPlayer == NULL) { + if (_videoPlayer == nullptr) { break; } _transMgr = new BaseTransitionMgr(this); - if (_transMgr == NULL) { + if (_transMgr == nullptr) { break; } _keyboardState = new BaseKeyboardState(this); - if (_keyboardState == NULL) { + if (_keyboardState == nullptr) { break; } _fader = new BaseFader(this); - if (_fader == NULL) { + if (_fader == nullptr) { break; } registerObject(_fader); @@ -437,7 +437,7 @@ bool BaseGame::initialize1() { ////////////////////////////////////////////////////////////////////// bool BaseGame::initialize2() { // we know whether we are going to be accelerated _renderer = makeOSystemRenderer(this); - if (_renderer == NULL) { + if (_renderer == nullptr) { return STATUS_FAILED; } @@ -480,10 +480,10 @@ void BaseGame::DEBUG_DebugEnable(const char *filename) { ////////////////////////////////////////////////////////////////////// void BaseGame::DEBUG_DebugDisable() { - if (_debugLogFile != NULL) { + if (_debugLogFile != nullptr) { LOG(0, "********** DEBUG LOG CLOSED ********************************************"); //fclose((FILE *)_debugLogFile); - _debugLogFile = NULL; + _debugLogFile = nullptr; } _debugDebugMode = false; } @@ -538,7 +538,7 @@ bool BaseGame::initLoop() { _fontStorage->initLoop(); - //_activeObject = NULL; + //_activeObject = nullptr; // count FPS _deltaTime = _currentTime - _lastTime; @@ -567,7 +567,7 @@ bool BaseGame::initLoop() { getMousePos(&_mousePos); - _focusedWindow = NULL; + _focusedWindow = nullptr; for (int i = _windows.size() - 1; i >= 0; i--) { if (_windows[i]->_visible) { _focusedWindow = _windows[i]; @@ -605,10 +605,10 @@ void BaseGame::setOffset(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// void BaseGame::getOffset(int *offsetX, int *offsetY) { - if (offsetX != NULL) { + if (offsetX != nullptr) { *offsetX = _offsetX; } - if (offsetY != NULL) { + if (offsetY != nullptr) { *offsetY = _offsetY; } } @@ -617,7 +617,7 @@ void BaseGame::getOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// bool BaseGame::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "BaseGame::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -768,7 +768,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { if (_systemFont) { _fontStorage->removeFont(_systemFont); } - _systemFont = NULL; + _systemFont = nullptr; _systemFont = _gameRef->_fontStorage->addFont((char *)params); break; @@ -777,7 +777,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { if (_videoFont) { _fontStorage->removeFont(_videoFont); } - _videoFont = NULL; + _videoFont = nullptr; _videoFont = _gameRef->_fontStorage->addFont((char *)params); break; @@ -788,18 +788,18 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; - _cursor = NULL; + _cursor = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_ACTIVE_CURSOR: delete _activeCursor; - _activeCursor = NULL; + _activeCursor = nullptr; _activeCursor = new BaseSprite(_gameRef); if (!_activeCursor || DID_FAIL(_activeCursor->loadFile((char *)params))) { delete _activeCursor; - _activeCursor = NULL; + _activeCursor = nullptr; cmd = PARSERR_GENERIC; } break; @@ -809,7 +809,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { _cursorNoninteractive = new BaseSprite(_gameRef); if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile((char *)params))) { delete _cursorNoninteractive; - _cursorNoninteractive = NULL; + _cursorNoninteractive = nullptr; cmd = PARSERR_GENERIC; } break; @@ -1057,7 +1057,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->pushNative(win, true); } else { delete win; - win = NULL; + win = nullptr; stack->pushNULL(); } return STATUS_OK; @@ -1147,7 +1147,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack bool freezeMusic = stack->pop()->getBool(true); ScValue *valSub = stack->pop(); - const char *subtitleFile = valSub->isNULL() ? NULL : valSub->getString(); + const char *subtitleFile = valSub->isNULL() ? nullptr : valSub->getString(); if (type < (int)VID_PLAY_POS || type > (int)VID_PLAY_CENTER) { type = (int)VID_PLAY_STRETCH; @@ -1187,7 +1187,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack bool dropFrames = stack->pop()->getBool(true); ScValue *valSub = stack->pop(); - const char *subtitleFile = valSub->isNULL() ? NULL : valSub->getString(); + const char *subtitleFile = valSub->isNULL() ? nullptr : valSub->getString(); if (type < (int)VID_PLAY_POS || type > (int)VID_PLAY_CENTER) { type = (int)VID_PLAY_STRETCH; @@ -1206,7 +1206,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack } else { stack->pushBool(false); delete _theoraPlayer; - _theoraPlayer = NULL; + _theoraPlayer = nullptr; } return STATUS_OK; @@ -1471,7 +1471,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "RemoveActiveCursor") == 0) { stack->correctParams(0); delete _activeCursor; - _activeCursor = NULL; + _activeCursor = nullptr; stack->pushNULL(); return STATUS_OK; @@ -1724,7 +1724,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "RemoveWaitCursor") == 0) { stack->correctParams(0); delete _cursorNoninteractive; - _cursorNoninteractive = NULL; + _cursorNoninteractive = nullptr; stack->pushNULL(); @@ -1783,7 +1783,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _loadingIcon = new BaseSprite(this); if (!_loadingIcon || DID_FAIL(_loadingIcon->loadFile(filename))) { delete _loadingIcon; - _loadingIcon = NULL; + _loadingIcon = nullptr; } else { displayContent(false, true); _gameRef->_renderer->flip(); @@ -1800,7 +1800,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "HideLoadingIcon") == 0) { stack->correctParams(0); delete _loadingIcon; - _loadingIcon = NULL; + _loadingIcon = nullptr; stack->pushNULL(); return STATUS_OK; } @@ -1840,7 +1840,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _cachedThumbnail = new BaseSaveThumbHelper(this); if (DID_FAIL(_cachedThumbnail->storeThumbnail())) { delete _cachedThumbnail; - _cachedThumbnail = NULL; + _cachedThumbnail = nullptr; stack->pushBool(false); } else { stack->pushBool(true); @@ -1855,7 +1855,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "DeleteSaveThumbnail") == 0) { stack->correctParams(0); delete _cachedThumbnail; - _cachedThumbnail = NULL; + _cachedThumbnail = nullptr; stack->pushNULL(); return STATUS_OK; @@ -1894,7 +1894,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack } BaseFileManager::getEngineInstance()->closeFile(file); - file = NULL; + file = nullptr; } else { stack->pushNULL(); } @@ -2397,7 +2397,7 @@ bool BaseGame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "MainObject") == 0) { BaseScriptable *obj = value->getNative(); - if (obj == NULL || validObject((BaseObject *)obj)) { + if (obj == nullptr || validObject((BaseObject *)obj)) { _mainObject = (BaseObject *)obj; } return STATUS_OK; @@ -2633,7 +2633,7 @@ bool BaseGame::unregisterObject(BaseObject *object) { // get new focused window if (_focusedWindow == object) { - _focusedWindow = NULL; + _focusedWindow = nullptr; } break; @@ -2642,12 +2642,12 @@ bool BaseGame::unregisterObject(BaseObject *object) { // is it active object? if (_activeObject == object) { - _activeObject = NULL; + _activeObject = nullptr; } // is it main object? if (_mainObject == object) { - _mainObject = NULL; + _mainObject = nullptr; } // destroy object @@ -2673,7 +2673,7 @@ void BaseGame::invalidateValues(void *value, void *data) { if (!val->_persistent && ((BaseScriptable *)data)->_refCount == 1) { ((BaseScriptable *)data)->_refCount++; } - val->setNative(NULL); + val->setNative(nullptr); val->setNULL(); } } @@ -3036,8 +3036,8 @@ bool BaseGame::displayWindows(bool inGame) { bool res; // did we lose focus? focus topmost window - if (_focusedWindow == NULL || !_focusedWindow->_visible || _focusedWindow->_disable) { - _focusedWindow = NULL; + if (_focusedWindow == nullptr || !_focusedWindow->_visible || _focusedWindow->_disable) { + _focusedWindow = nullptr; for (int i = _windows.size() - 1; i >= 0; i--) { if (_windows[i]->_visible && !_windows[i]->_disable) { _focusedWindow = _windows[i]; @@ -3083,7 +3083,7 @@ bool BaseGame::loadSettings(const char *filename) { byte *origBuffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (origBuffer == NULL) { + if (origBuffer == nullptr) { _gameRef->LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename); return STATUS_FAILED; } @@ -3446,7 +3446,7 @@ void BaseGame::setWindowTitle() { bool BaseGame::setActiveObject(BaseObject *obj) { // not-active when game is frozen if (obj && !_gameRef->_interactive && !obj->_nonIntMouseEvents) { - obj = NULL; + obj = nullptr; } if (obj == _activeObject) { @@ -3501,7 +3501,7 @@ bool BaseGame::popViewport() { ////////////////////////////////////////////////////////////////////////// bool BaseGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { - if (rect == NULL) { + if (rect == nullptr) { return STATUS_FAILED; } else { if (_viewportSP >= 0) { @@ -3635,12 +3635,12 @@ bool BaseGame::restoreDeviceObjects() { ////////////////////////////////////////////////////////////////////////// bool BaseGame::setWaitCursor(const char *filename) { delete _cursorNoninteractive; - _cursorNoninteractive = NULL; + _cursorNoninteractive = nullptr; _cursorNoninteractive = new BaseSprite(_gameRef); if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile(filename))) { delete _cursorNoninteractive; - _cursorNoninteractive = NULL; + _cursorNoninteractive = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -3666,7 +3666,7 @@ bool BaseGame::stopVideo() { if (_theoraPlayer && _theoraPlayer->isPlaying()) { _theoraPlayer->stop(); delete _theoraPlayer; - _theoraPlayer = NULL; + _theoraPlayer = nullptr; } return STATUS_OK; } @@ -3717,12 +3717,12 @@ bool BaseGame::onMouseLeftDown() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("LeftClick"); } } - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _capturedObject = _activeObject; } _mouseLeftDown = true; @@ -3738,12 +3738,12 @@ bool BaseGame::onMouseLeftUp() { } BasePlatform::releaseCapture(); - _capturedObject = NULL; + _capturedObject = nullptr; _mouseLeftDown = false; bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftRelease")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("LeftRelease"); } } @@ -3762,7 +3762,7 @@ bool BaseGame::onMouseLeftDblClick() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftDoubleClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("LeftDoubleClick"); } } @@ -3781,7 +3781,7 @@ bool BaseGame::onMouseRightDblClick() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightDoubleClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("RightDoubleClick"); } } @@ -3796,7 +3796,7 @@ bool BaseGame::onMouseRightDown() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("RightClick"); } } @@ -3811,7 +3811,7 @@ bool BaseGame::onMouseRightUp() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("RightRelease"); } } @@ -3830,7 +3830,7 @@ bool BaseGame::onMouseMiddleDown() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("MiddleClick"); } } @@ -3845,7 +3845,7 @@ bool BaseGame::onMouseMiddleUp() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleRelease")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("MiddleRelease"); } } @@ -3907,7 +3907,7 @@ bool BaseGame::displayDebugInfo() { sprintf(str, "Timer: %d", _timer); _gameRef->_systemFont->drawText((byte *)str, 0, 130, _renderer->_width, TAL_RIGHT); - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _systemFont->drawText((const byte *)_activeObject->getName(), 0, 150, _renderer->_width, TAL_RIGHT); } diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index 75cf3fd832..a902727f5f 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -144,7 +144,7 @@ public: virtual ~BaseGame(); void DEBUG_DebugDisable(); - void DEBUG_DebugEnable(const char *filename = NULL); + void DEBUG_DebugEnable(const char *filename = nullptr); bool _debugDebugMode; void *_debugLogFile; @@ -236,8 +236,8 @@ public: void setInteractive(bool state); virtual bool windowLoadHook(UIWindow *win, char **buf, char **params); virtual bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name); - bool getCurrentViewportOffset(int *offsetX = NULL, int *offsetY = NULL); - bool getCurrentViewportRect(Rect32 *rect, bool *custom = NULL); + bool getCurrentViewportOffset(int *offsetX = nullptr, int *offsetY = nullptr); + bool getCurrentViewportRect(Rect32 *rect, bool *custom = nullptr); bool popViewport(); bool pushViewport(BaseViewport *Viewport); bool setActiveObject(BaseObject *Obj); @@ -287,7 +287,7 @@ private: uint32 _framesRendered; Common::String _gameId; - void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = NULL, void *data = NULL); + void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = nullptr, void *data = nullptr); ENGINE_LOG_CALLBACK _engineLogCallback; void *_engineLogCallbackData; diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp index 365fa6e212..8dff41d854 100644 --- a/engines/wintermute/base/base_game_music.cpp +++ b/engines/wintermute/base/base_game_music.cpp @@ -39,7 +39,7 @@ namespace Wintermute { BaseGameMusic::BaseGameMusic(BaseGame *gameRef) : _gameRef(gameRef) { for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) { - _music[i] = NULL; + _music[i] = nullptr; _musicStartTime[i] = 0; } @@ -54,7 +54,7 @@ BaseGameMusic::BaseGameMusic(BaseGame *gameRef) : _gameRef(gameRef) { void BaseGameMusic::cleanup() { for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) { delete _music[i]; - _music[i] = NULL; + _music[i] = nullptr; _musicStartTime[i] = 0; } } @@ -67,7 +67,7 @@ bool BaseGameMusic::playMusic(int channel, const char *filename, bool looping, u } delete _music[channel]; - _music[channel] = NULL; + _music[channel] = nullptr; _music[channel] = new BaseSound(_gameRef); if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { @@ -81,7 +81,7 @@ bool BaseGameMusic::playMusic(int channel, const char *filename, bool looping, u return _music[channel]->play(looping); } else { delete _music[channel]; - _music[channel] = NULL; + _music[channel] = nullptr; return STATUS_FAILED; } } @@ -97,7 +97,7 @@ bool BaseGameMusic::stopMusic(int channel) { if (_music[channel]) { _music[channel]->stop(); delete _music[channel]; - _music[channel] = NULL; + _music[channel] = nullptr; return STATUS_OK; } else { return STATUS_FAILED; @@ -494,7 +494,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this if (sound && DID_SUCCEED(sound->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { length = sound->getLength(); delete sound; - sound = NULL; + sound = nullptr; } stack->pushInt(length); return STATUS_OK; diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp index 915bf24d7f..f99ec2f5db 100644 --- a/engines/wintermute/base/base_named_object.cpp +++ b/engines/wintermute/base/base_named_object.cpp @@ -32,38 +32,38 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BaseNamedObject::BaseNamedObject(BaseGame *inGame) : BaseClass(inGame) { - _name = NULL; + _name = nullptr; } ////////////////////////////////////////////////////////////////////////// BaseNamedObject::BaseNamedObject() : BaseClass() { - _name = NULL; + _name = nullptr; } ////////////////////////////////////////////////////////////////////////// BaseNamedObject::BaseNamedObject(TDynamicConstructor, TDynamicConstructor) { - _name = NULL; + _name = nullptr; } ////////////////////////////////////////////////////////////////////////// BaseNamedObject::~BaseNamedObject(void) { delete[] _name; - _name = NULL; + _name = nullptr; } ////////////////////////////////////////////////////////////////////// void BaseNamedObject::setName(const char *name) { delete[] _name; - _name = NULL; + _name = nullptr; - if (name == NULL) { + if (name == nullptr) { return; } _name = new char [strlen(name) + 1]; - if (_name != NULL) { + if (_name != nullptr) { strcpy(_name, name); } } diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp index ab7d930202..898c0497a2 100644 --- a/engines/wintermute/base/base_object.cpp +++ b/engines/wintermute/base/base_object.cpp @@ -60,18 +60,18 @@ BaseObject::BaseObject(BaseGame *inGame) : BaseScriptHolder(inGame) { _ready = true; - _soundEvent = NULL; + _soundEvent = nullptr; _iD = _gameRef->getSequence(); BasePlatform::setRectEmpty(&_rect); _rectSet = false; - _cursor = NULL; - _activeCursor = NULL; + _cursor = nullptr; + _activeCursor = nullptr; _sharedCursors = false; - _sFX = NULL; + _sFX = nullptr; _sFXStart = 0; _sFXVolume = 100; _autoSoundPanning = true; @@ -86,7 +86,7 @@ BaseObject::BaseObject(BaseGame *inGame) : BaseScriptHolder(inGame) { _relativeRotate = 0.0f; for (int i = 0; i < 7; i++) { - _caption[i] = NULL; + _caption[i] = nullptr; } _saveState = true; @@ -109,25 +109,25 @@ BaseObject::~BaseObject() { ////////////////////////////////////////////////////////////////////////// bool BaseObject::cleanup() { if (_gameRef && _gameRef->_activeObject == this) { - _gameRef->_activeObject = NULL; + _gameRef->_activeObject = nullptr; } BaseScriptHolder::cleanup(); delete[] _soundEvent; - _soundEvent = NULL; + _soundEvent = nullptr; if (!_sharedCursors) { delete _cursor; delete _activeCursor; - _cursor = NULL; - _activeCursor = NULL; + _cursor = nullptr; + _activeCursor = nullptr; } delete _sFX; - _sFX = NULL; + _sFX = nullptr; for (int i = 0; i < 7; i++) { delete[] _caption[i]; - _caption[i] = NULL; + _caption[i] = nullptr; } _sFXType = SFX_NONE; @@ -160,7 +160,7 @@ const char *BaseObject::getCaption(int caseVal) { if (caseVal == 0) { caseVal = 1; } - if (caseVal < 1 || caseVal > 7 || _caption[caseVal - 1] == NULL) { + if (caseVal < 1 || caseVal > 7 || _caption[caseVal - 1] == nullptr) { return ""; } else { return _caption[caseVal - 1]; @@ -223,9 +223,9 @@ bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta stack->correctParams(0); if (!_sharedCursors) { delete _cursor; - _cursor = NULL; + _cursor = nullptr; } else { - _cursor = NULL; + _cursor = nullptr; } stack->pushNULL(); @@ -317,12 +317,12 @@ bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta ScValue *val3 = stack->pop(); if (val1->_type == VAL_BOOL) { - filename = NULL; + filename = nullptr; looping = val1->getBool(); loopStart = val2->getInt(); } else { if (val1->isNULL()) { - filename = NULL; + filename = nullptr; } else { filename = val1->getString(); } @@ -351,7 +351,7 @@ bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta ScValue *val2 = stack->pop(); if (val2->isNULL()) { - filename = NULL; + filename = nullptr; eventName = val1->getString(); } else { filename = val1->getString(); @@ -1010,14 +1010,14 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) { bool BaseObject::setCursor(const char *filename) { if (!_sharedCursors) { delete _cursor; - _cursor = NULL; + _cursor = nullptr; } _sharedCursors = false; _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile(filename))) { delete _cursor; - _cursor = NULL; + _cursor = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -1031,7 +1031,7 @@ bool BaseObject::setActiveCursor(const char *filename) { _activeCursor = new BaseSprite(_gameRef); if (!_activeCursor || DID_FAIL(_activeCursor->loadFile(filename))) { delete _activeCursor; - _activeCursor = NULL; + _activeCursor = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -1066,7 +1066,7 @@ bool BaseObject::handleMouseWheel(int delta) { ////////////////////////////////////////////////////////////////////////// bool BaseObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) { // just play loaded sound - if (filename == NULL && _sFX) { + if (filename == nullptr && _sFX) { if (_gameRef->_editorMode || _sFXStart) { _sFX->setVolumePercent(_sFXVolume); _sFX->setPositionTime(_sFXStart); @@ -1085,7 +1085,7 @@ bool BaseObject::playSFX(const char *filename, bool looping, bool playNow, const } } - if (filename == NULL) { + if (filename == nullptr) { return STATUS_FAILED; } @@ -1111,7 +1111,7 @@ bool BaseObject::playSFX(const char *filename, bool looping, bool playNow, const } } else { delete _sFX; - _sFX = NULL; + _sFX = nullptr; return STATUS_FAILED; } } @@ -1123,7 +1123,7 @@ bool BaseObject::stopSFX(bool deleteSound) { _sFX->stop(); if (deleteSound) { delete _sFX; - _sFX = NULL; + _sFX = nullptr; } return STATUS_OK; } else { @@ -1229,7 +1229,7 @@ bool BaseObject::isReady() { ////////////////////////////////////////////////////////////////////////// void BaseObject::setSoundEvent(const char *eventName) { delete[] _soundEvent; - _soundEvent = NULL; + _soundEvent = nullptr; if (eventName) { _soundEvent = new char[strlen(eventName) + 1]; if (_soundEvent) { diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp index 9a0e9e3ad9..7f18c1f0cf 100644 --- a/engines/wintermute/base/base_parser.cpp +++ b/engines/wintermute/base/base_parser.cpp @@ -51,7 +51,7 @@ BaseParser::BaseParser() { ////////////////////////////////////////////////////////////////////// BaseParser::~BaseParser() { - if (_whiteSpace != NULL) { + if (_whiteSpace != nullptr) { delete[] _whiteSpace; } } @@ -136,7 +136,7 @@ void BaseParser::skipCharacters(char **buf, const char *toSkip) { if (ch == '\n') { _parserLine++; } - if (strchr(toSkip, ch) == NULL) { + if (strchr(toSkip, ch) == nullptr) { return; } ++*buf; // skip this character @@ -250,10 +250,10 @@ Common::String BaseParser::getToken(char **buf) { *t++ = 0; } else if (*b == 0) { *buf = b; - return NULL; + return nullptr; } else { // Error. - return NULL; + return nullptr; } *buf = b; diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h index 76ca8ea856..87a936c624 100644 --- a/engines/wintermute/base/base_parser.h +++ b/engines/wintermute/base/base_parser.h @@ -70,7 +70,7 @@ public: virtual ~BaseParser(); private: char *getLastOffender(); - void skipToken(char **buf, char *tok, char *msg = NULL); + void skipToken(char **buf, char *tok, char *msg = nullptr); int getTokenInt(char **buf); float getTokenFloat(char **buf); Common::String getToken(char **buf); diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index accb0a8fd3..a800aac39f 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -56,31 +56,31 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool deleteSingleton) { _saving = false; -// _buffer = NULL; +// _buffer = nullptr; // _bufferSize = 0; _offset = 0; - _saveStream = NULL; - _loadStream = NULL; + _saveStream = nullptr; + _loadStream = nullptr; _deleteSingleton = deleteSingleton; if (BaseEngine::instance().getGameRef()) { _gameRef = BaseEngine::instance().getGameRef(); } else { - _gameRef = NULL; + _gameRef = nullptr; } - _richBuffer = NULL; + _richBuffer = nullptr; _richBufferSize = 0; - _scummVMThumbnailData = NULL; + _scummVMThumbnailData = nullptr; _scummVMThumbSize = 0; - _savedDescription = NULL; + _savedDescription = nullptr; // _savedTimestamp = 0; _savedVerMajor = _savedVerMinor = _savedVerBuild = 0; _savedExtMajor = _savedExtMinor = 0; _thumbnailDataSize = 0; - _thumbnailData = NULL; + _thumbnailData = nullptr; if (savePrefix) { _savePrefix = savePrefix; } else if (_gameRef) { @@ -94,7 +94,7 @@ BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool dele ////////////////////////////////////////////////////////////////////////// BasePersistenceManager::~BasePersistenceManager() { cleanup(); - if (_deleteSingleton && BaseEngine::instance().getGameRef() == NULL) + if (_deleteSingleton && BaseEngine::instance().getGameRef() == nullptr) BaseEngine::destroy(); } @@ -105,17 +105,17 @@ void BasePersistenceManager::cleanup() { if (_saving) free(_buffer); else delete[] _buffer; // allocated by file manager } - _buffer = NULL; + _buffer = nullptr; _bufferSize = 0;*/ _offset = 0; delete[] _richBuffer; - _richBuffer = NULL; + _richBuffer = nullptr; _richBufferSize = 0; delete[] _savedDescription; - _savedDescription = NULL; // ref to buffer + _savedDescription = nullptr; // ref to buffer // _savedTimestamp = 0; _savedVerMajor = _savedVerMinor = _savedVerBuild = 0; _savedExtMajor = _savedExtMinor = 0; @@ -123,19 +123,19 @@ void BasePersistenceManager::cleanup() { _thumbnailDataSize = 0; if (_thumbnailData) { delete[] _thumbnailData; - _thumbnailData = NULL; + _thumbnailData = nullptr; } _scummVMThumbSize = 0; if (_scummVMThumbnailData) { delete[] _scummVMThumbnailData; - _scummVMThumbnailData = NULL; + _scummVMThumbnailData = nullptr; } delete _loadStream; delete _saveStream; - _loadStream = NULL; - _saveStream = NULL; + _loadStream = nullptr; + _saveStream = nullptr; } Common::String BasePersistenceManager::getFilenameForSlot(int slot) const { @@ -156,7 +156,7 @@ void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &des desc.setWriteProtectedFlag(false); int thumbSize = 0; - byte *thumbData = NULL; + byte *thumbData = nullptr; if (_scummVMThumbSize > 0) { thumbSize = _scummVMThumbSize; thumbData = _scummVMThumbnailData; @@ -228,7 +228,7 @@ bool BasePersistenceManager::initSave(const char *desc) { _gameRef->_cachedThumbnail = new BaseSaveThumbHelper(_gameRef); if (DID_FAIL(_gameRef->_cachedThumbnail->storeThumbnail(true))) { delete _gameRef->_cachedThumbnail; - _gameRef->_cachedThumbnail = NULL; + _gameRef->_cachedThumbnail = nullptr; } } @@ -291,7 +291,7 @@ bool BasePersistenceManager::initSave(const char *desc) { // in any case, destroy the cached thumbnail once used delete _gameRef->_cachedThumbnail; - _gameRef->_cachedThumbnail = NULL; + _gameRef->_cachedThumbnail = nullptr; uint32 dataOffset = _offset + sizeof(uint32) + // data offset @@ -502,7 +502,7 @@ char *BasePersistenceManager::getString() { if (!strcmp(ret, "(null)")) { delete[] ret; - return NULL; + return nullptr; } else { return ret; } @@ -845,7 +845,7 @@ bool BasePersistenceManager::transfer(const char *name, void *val) { if (_saving) { SystemClassRegistry::getInstance()->getPointerID(*(void **)val, &classID, &instanceID); - if (*(void **)val != NULL && (classID == -1 || instanceID == -1)) { + if (*(void **)val != nullptr && (classID == -1 || instanceID == -1)) { debugC(kWintermuteDebugSaveGame, "Warning: invalid instance '%s'", name); } diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 0bc5975e51..a3a23f770a 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -103,7 +103,7 @@ bool BaseRegion::pointInRegion(int x, int y) { ////////////////////////////////////////////////////////////////////////// bool BaseRegion::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "BaseRegion::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -289,7 +289,7 @@ bool BaseRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta if (index >= 0 && index < (int32)_points.size()) { delete _points[index]; - _points[index] = NULL; + _points[index] = nullptr; _points.remove_at(index); createRegion(); diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h index 464f25be2f..6b7905fe53 100644 --- a/engines/wintermute/base/base_region.h +++ b/engines/wintermute/base/base_region.h @@ -51,7 +51,7 @@ public: bool loadBuffer(byte *buffer, bool complete = true); Rect32 _rect; BaseArray<BasePoint *> _points; - virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) { return saveAsText(buffer, indent, NULL); } + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) { return saveAsText(buffer, indent, nullptr); } virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride); // scripting interface diff --git a/engines/wintermute/base/base_save_thumb_helper.cpp b/engines/wintermute/base/base_save_thumb_helper.cpp index 3899ece59b..76d703a697 100644 --- a/engines/wintermute/base/base_save_thumb_helper.cpp +++ b/engines/wintermute/base/base_save_thumb_helper.cpp @@ -36,20 +36,20 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BaseSaveThumbHelper::BaseSaveThumbHelper(BaseGame *inGame) : BaseClass(inGame) { - _thumbnail = NULL; - _scummVMThumb = NULL; + _thumbnail = nullptr; + _scummVMThumb = nullptr; } ////////////////////////////////////////////////////////////////////////// BaseSaveThumbHelper::~BaseSaveThumbHelper(void) { delete _thumbnail; - _thumbnail = NULL; + _thumbnail = nullptr; delete _scummVMThumb; - _scummVMThumb = NULL; + _scummVMThumb = nullptr; } BaseImage *BaseSaveThumbHelper::storeThumb(bool doFlip, int width, int height) { - BaseImage *thumbnail = NULL; + BaseImage *thumbnail = nullptr; if (_gameRef->_thumbnailWidth > 0 && _gameRef->_thumbnailHeight > 0) { if (doFlip) { // when using opengl on windows it seems to be necessary to do this twice @@ -63,7 +63,7 @@ BaseImage *BaseSaveThumbHelper::storeThumb(bool doFlip, int width, int height) { BaseImage *screenshot = _gameRef->_renderer->takeScreenshot(); if (!screenshot) { - return NULL; + return nullptr; } // normal thumbnail @@ -74,7 +74,7 @@ BaseImage *BaseSaveThumbHelper::storeThumb(bool doFlip, int width, int height) { delete screenshot; - screenshot = NULL; + screenshot = nullptr; } return thumbnail; } @@ -82,7 +82,7 @@ BaseImage *BaseSaveThumbHelper::storeThumb(bool doFlip, int width, int height) { ////////////////////////////////////////////////////////////////////////// bool BaseSaveThumbHelper::storeThumbnail(bool doFlip) { delete _thumbnail; - _thumbnail = NULL; + _thumbnail = nullptr; if (_gameRef->_thumbnailWidth > 0 && _gameRef->_thumbnailHeight > 0) { @@ -98,7 +98,7 @@ bool BaseSaveThumbHelper::storeThumbnail(bool doFlip) { ////////////////////////////////////////////////////////////////////////// bool BaseSaveThumbHelper::storeScummVMThumbNail(bool doFlip) { delete _scummVMThumb; - _scummVMThumb = NULL; + _scummVMThumb = nullptr; _scummVMThumb = storeThumb(doFlip, kThumbnailWidth, kThumbnailHeight2); if (!_scummVMThumb) { diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp index abe5501b8d..d1a9d4aa46 100644 --- a/engines/wintermute/base/base_script_holder.cpp +++ b/engines/wintermute/base/base_script_holder.cpp @@ -43,7 +43,7 @@ BaseScriptHolder::BaseScriptHolder(BaseGame *inGame) : BaseScriptable(inGame) { setName("<unnamed>"); _freezable = true; - _filename = NULL; + _filename = nullptr; } @@ -56,11 +56,11 @@ BaseScriptHolder::~BaseScriptHolder() { ////////////////////////////////////////////////////////////////////////// bool BaseScriptHolder::cleanup() { delete[] _filename; - _filename = NULL; + _filename = nullptr; for (uint32 i = 0; i < _scripts.size(); i++) { _scripts[i]->finish(true); - _scripts[i]->_owner = NULL; + _scripts[i]->_owner = nullptr; } _scripts.clear(); @@ -69,15 +69,15 @@ bool BaseScriptHolder::cleanup() { ////////////////////////////////////////////////////////////////////// void BaseScriptHolder::setFilename(const char *filename) { - if (_filename != NULL) { + if (_filename != nullptr) { delete[] _filename; - _filename = NULL; + _filename = nullptr; } - if (filename == NULL) { + if (filename == nullptr) { return; } _filename = new char [strlen(filename) + 1]; - if (_filename != NULL) { + if (_filename != nullptr) { strcpy(_filename, filename); } } @@ -388,8 +388,8 @@ bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) { buffer = params; } - char *propName = NULL; - char *propValue = NULL; + char *propName = nullptr; + char *propValue = nullptr; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -418,16 +418,16 @@ bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) { if (cmd == PARSERR_TOKENNOTFOUND) { delete[] propName; delete[] propValue; - propName = NULL; - propValue = NULL; + propName = nullptr; + propValue = nullptr; _gameRef->LOG(0, "Syntax error in PROPERTY definition"); return STATUS_FAILED; } - if (cmd == PARSERR_GENERIC || propName == NULL || propValue == NULL) { + if (cmd == PARSERR_GENERIC || propName == nullptr || propValue == nullptr) { delete[] propName; delete[] propValue; - propName = NULL; - propValue = NULL; + propName = nullptr; + propValue = nullptr; _gameRef->LOG(0, "Error loading PROPERTY definition"); return STATUS_FAILED; } @@ -440,8 +440,8 @@ bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) { delete val; delete[] propName; delete[] propValue; - propName = NULL; - propValue = NULL; + propName = nullptr; + propValue = nullptr; return STATUS_OK; } @@ -474,7 +474,7 @@ ScScript *BaseScriptHolder::invokeMethodThread(const char *methodName) { } } } - return NULL; + return nullptr; } diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp index 8c5ef7e45a..7dbcd72200 100644 --- a/engines/wintermute/base/base_scriptable.cpp +++ b/engines/wintermute/base/base_scriptable.cpp @@ -39,14 +39,14 @@ BaseScriptable::BaseScriptable(BaseGame *inGame, bool noValue, bool persistable) _refCount = 0; if (noValue) { - _scValue = NULL; + _scValue = nullptr; } else { _scValue = new ScValue(_gameRef); } _persistable = persistable; - _scProp = NULL; + _scProp = nullptr; } @@ -55,8 +55,8 @@ BaseScriptable::~BaseScriptable() { //if (_refCount>0) _gameRef->LOG(0, "Warning: Destroying object, _refCount=%d", _refCount); delete _scValue; delete _scProp; - _scValue = NULL; - _scProp = NULL; + _scValue = nullptr; + _scProp = nullptr; } @@ -83,7 +83,7 @@ ScValue *BaseScriptable::scGetProperty(const Common::String &name) { if (_scProp) { return _scProp->getProp(name.c_str()); // TODO: Change to Common::String } else { - return NULL; + return nullptr; } } @@ -185,7 +185,7 @@ bool BaseScriptable::canHandleMethod(const char *eventMethod) const { ////////////////////////////////////////////////////////////////////////// ScScript *BaseScriptable::invokeMethodThread(const char *methodName) { - return NULL; + return nullptr; } } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp index 194bbc86f0..4f55e47c05 100644 --- a/engines/wintermute/base/base_sprite.cpp +++ b/engines/wintermute/base/base_sprite.cpp @@ -72,7 +72,7 @@ void BaseSprite::setDefaults() { _moveX = _moveY = 0; _editorMuted = false; - _editorBgFile = NULL; + _editorBgFile = nullptr; _editorBgOffsetX = _editorBgOffsetY = 0; _editorBgAlpha = 0xFF; _streamed = false; @@ -94,7 +94,7 @@ void BaseSprite::cleanup() { _frames.clear(); delete[] _editorBgFile; - _editorBgFile = NULL; + _editorBgFile = nullptr; setDefaults(); } @@ -141,7 +141,7 @@ bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteC } } else { BaseFileManager::getEngineInstance()->closeFile(file); - file = NULL; + file = nullptr; } bool ret = STATUS_FAILED; @@ -154,7 +154,7 @@ bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteC BaseFrame *frame = new BaseFrame(_gameRef); BaseSubFrame *subframe = new BaseSubFrame(_gameRef); subframe->setSurface(filename, true, 0, 0, 0, lifeTime, true); - if (subframe->_surface == NULL) { + if (subframe->_surface == nullptr) { _gameRef->LOG(0, "Error loading simple sprite '%s'", filename.c_str()); ret = STATUS_FAILED; delete frame; @@ -440,7 +440,7 @@ bool BaseSprite::display(int x, int y, BaseObject *registerVal, float zoomX, flo BaseSurface *BaseSprite::getSurface() { // only used for animated textures for 3D models if (_currentFrame < 0 || _currentFrame >= (int32)_frames.size()) { - return NULL; + return nullptr; } BaseFrame *frame = _frames[_currentFrame]; if (frame && frame->_subframes.size() > 0) { @@ -448,10 +448,10 @@ BaseSurface *BaseSprite::getSurface() { if (subframe) { return subframe->_surface; } else { - return NULL; + return nullptr; } } else { - return NULL; + return nullptr; } } @@ -611,13 +611,13 @@ bool BaseSprite::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta else if (strcmp(name, "AddFrame") == 0) { stack->correctParams(1); ScValue *val = stack->pop(); - const char *filename = NULL; + const char *filename = nullptr; if (!val->isNULL()) { filename = val->getString(); } BaseFrame *frame = new BaseFrame(_gameRef); - if (filename != NULL) { + if (filename != nullptr) { BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (DID_SUCCEED(sub->setSurface(filename))) { sub->setDefaultRect(); @@ -643,13 +643,13 @@ bool BaseSprite::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta } ScValue *val = stack->pop(); - const char *filename = NULL; + const char *filename = nullptr; if (!val->isNULL()) { filename = val->getString(); } BaseFrame *frame = new BaseFrame(_gameRef); - if (filename != NULL) { + if (filename != nullptr) { BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (DID_SUCCEED(sub->setSurface(filename))) { frame->_subframes.add(sub); @@ -740,7 +740,7 @@ ScValue *BaseSprite::scGetProperty(const Common::String &name) { // Owner (RO) ////////////////////////////////////////////////////////////////////////// else if (name == "Owner") { - if (_owner == NULL) { + if (_owner == nullptr) { _scValue->setNULL(); } else { _scValue->setNative(_owner, true); diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index 1d244c3a52..ac1a0e919b 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -47,18 +47,18 @@ public: bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); int _moveY; int _moveX; - bool display(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool getCurrentFrame(float zoomX = 100, float zoomY = 100); void reset(); bool isChanged(); bool isFinished(); bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - bool draw(int x, int y, BaseObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); + bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); bool _looping; int _currentFrame; - bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = NULL); - BaseSprite(BaseGame *inGame, BaseObject *owner = NULL); + bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr); + BaseSprite(BaseGame *inGame, BaseObject *owner = nullptr); virtual ~BaseSprite(); BaseArray<BaseFrame *> _frames; bool saveAsText(BaseDynamicBuffer *buffer, int indent); diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp index 2f890beea1..11ec7b094f 100644 --- a/engines/wintermute/base/base_string_table.cpp +++ b/engines/wintermute/base/base_string_table.cpp @@ -50,7 +50,7 @@ BaseStringTable::~BaseStringTable() { ////////////////////////////////////////////////////////////////////////// bool BaseStringTable::addString(const char *key, const char *val, bool reportDuplicities) { - if (key == NULL || val == NULL) { + if (key == nullptr || val == nullptr) { return STATUS_FAILED; } @@ -74,13 +74,13 @@ bool BaseStringTable::addString(const char *key, const char *val, bool reportDup ////////////////////////////////////////////////////////////////////////// char *BaseStringTable::getKey(const char *str) const { - if (str == NULL || str[0] != '/') { - return NULL; + if (str == nullptr || str[0] != '/') { + return nullptr; } const char *value = strchr(str + 1, '/'); - if (value == NULL) { - return NULL; + if (value == nullptr) { + return nullptr; } char *key = new char[value - str]; @@ -110,12 +110,12 @@ char *BaseStringTable::getKey(const char *str) const { ////////////////////////////////////////////////////////////////////////// void BaseStringTable::expand(char **str) const { - if (str == NULL || *str == NULL || *str[0] != '/') { + if (str == nullptr || *str == nullptr || *str[0] != '/') { return; } char *value = strchr(*str + 1, '/'); - if (value == NULL) { + if (value == nullptr) { return; } @@ -149,12 +149,12 @@ void BaseStringTable::expand(char **str) const { ////////////////////////////////////////////////////////////////////////// const char *BaseStringTable::expandStatic(const char *string) const { - if (string == NULL || string[0] == '\0' || string[0] != '/') { + if (string == nullptr || string[0] == '\0' || string[0] != '/') { return string; } const char *value = strchr(string + 1, '/'); - if (value == NULL) { + if (value == nullptr) { return string; } @@ -193,7 +193,7 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) { uint32 size; byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename, &size); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "BaseStringTable::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -222,12 +222,12 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) { char *line = new char[realLength + 1]; Common::strlcpy(line, (char *)&buffer[pos], realLength + 1); char *value = strchr(line, '\t'); - if (value == NULL) { + if (value == nullptr) { value = strchr(line, ' '); } if (line[0] != ';') { - if (value != NULL) { + if (value != nullptr) { value[0] = '\0'; value++; for (uint32 i = 0; i < strlen(value); i++) { diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 77cc522ae7..a06d7f50eb 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -44,7 +44,7 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false) ////////////////////////////////////////////////////////////////////////// BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { - _surface = NULL; + _surface = nullptr; _hotspotX = _hotspotY = 0; _alpha = 0xFFFFFFFF; _transparent = 0xFFFF00FF; @@ -54,7 +54,7 @@ BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { _editorSelected = false; - _surfaceFilename = NULL; + _surfaceFilename = nullptr; _cKDefault = true; _cKRed = _cKBlue = _cKGreen = 0; _lifeTime = -1; @@ -73,7 +73,7 @@ BaseSubFrame::~BaseSubFrame() { _gameRef->_surfaceStorage->removeSurface(_surface); } delete[] _surfaceFilename; - _surfaceFilename = NULL; + _surfaceFilename = nullptr; } @@ -118,10 +118,10 @@ bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { int ar = 255, ag = 255, ab = 255, alpha = 255; bool custoTrans = false; BasePlatform::setRectEmpty(&rect); - char *surfaceFile = NULL; + char *surfaceFile = nullptr; delete _surface; - _surface = NULL; + _surface = nullptr; while ((cmd = parser.getCommand((char **)&buffer, commands, ¶ms)) > 0) { switch (cmd) { @@ -184,7 +184,7 @@ bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { return STATUS_FAILED; } - if (surfaceFile != NULL) { + if (surfaceFile != nullptr) { if (custoTrans) { setSurface(surfaceFile, false, r, g, b, lifeTime, keepLoaded); } else { @@ -198,7 +198,7 @@ bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { } /* - if (_surface == NULL) + if (_surface == nullptr) { _gameRef->LOG(0, "Error parsing sub-frame. Image not set."); return STATUS_FAILED; @@ -236,7 +236,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl return STATUS_OK; } - if (registerOwner != NULL && !_decoration) { + if (registerOwner != nullptr && !_decoration) { if (zoomX == 100 && zoomY == 100) { _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise)); } else { @@ -426,7 +426,7 @@ bool BaseSubFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS _gameRef->_surfaceStorage->removeSurface(_surface); } delete[] _surfaceFilename; - _surfaceFilename = NULL; + _surfaceFilename = nullptr; stack->pushBool(true); } else { const char *filename = val->getString(); @@ -617,11 +617,11 @@ const char *BaseSubFrame::scToString() { bool BaseSubFrame::setSurface(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { if (_surface) { _gameRef->_surfaceStorage->removeSurface(_surface); - _surface = NULL; + _surface = nullptr; } delete[] _surfaceFilename; - _surfaceFilename = NULL; + _surfaceFilename = nullptr; _surface = _gameRef->_surfaceStorage->addSurface(filename, defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded); if (_surface) { @@ -645,7 +645,7 @@ bool BaseSubFrame::setSurface(const Common::String &filename, bool defaultCK, by ////////////////////////////////////////////////////////////////////////// bool BaseSubFrame::setSurfaceSimple() { if (!_surfaceFilename) { - _surface = NULL; + _surface = nullptr; return STATUS_OK; } _surface = _gameRef->_surfaceStorage->addSurface(_surfaceFilename, _cKDefault, _cKRed, _cKGreen, _cKBlue, _lifeTime, _keepLoaded); diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h index c173ae69d1..2888761bb3 100644 --- a/engines/wintermute/base/base_sub_frame.h +++ b/engines/wintermute/base/base_sub_frame.h @@ -52,7 +52,7 @@ public: BaseSubFrame(BaseGame *inGame); virtual ~BaseSubFrame(); bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded); - bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool draw(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); const char* getSurfaceFilename(); diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp index 2205e3e096..08d2d2f767 100644 --- a/engines/wintermute/base/base_surface_storage.cpp +++ b/engines/wintermute/base/base_surface_storage.cpp @@ -124,12 +124,12 @@ BaseSurface *BaseSurfaceStorage::addSurface(const Common::String &filename, bool surface = _gameRef->_renderer->createSurface(); if (!surface) { - return NULL; + return nullptr; } if (DID_FAIL(surface->create(filename, defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded))) { delete surface; - return NULL; + return nullptr; } else { surface->_referenceCount = 1; _surfaces.push_back(surface); diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index b3c2cfa6c3..5a488b707f 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -38,7 +38,7 @@ IMPLEMENT_PERSISTENT(BaseViewport, false) ////////////////////////////////////////////////////////////////////////// BaseViewport::BaseViewport(BaseGame *inGame) : BaseClass(inGame) { BasePlatform::setRectEmpty(&_rect); - _mainObject = NULL; + _mainObject = nullptr; _offsetX = _offsetY = 0; } diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h index 0182565a67..c69682da62 100644 --- a/engines/wintermute/base/base_viewport.h +++ b/engines/wintermute/base/base_viewport.h @@ -44,7 +44,7 @@ public: int _offsetY; int _offsetX; BaseObject *_mainObject; - BaseViewport(BaseGame *inGame = NULL); + BaseViewport(BaseGame *inGame = nullptr); virtual ~BaseViewport(); private: Rect32 _rect; diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 25be3dad2d..796531eb27 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -109,7 +109,7 @@ bool diskFileExists(const Common::String &filename) { Common::SeekableReadStream *openDiskFile(const Common::String &filename) { uint32 prefixSize = 0; - Common::SeekableReadStream *file = NULL; + Common::SeekableReadStream *file = nullptr; Common::String fixedFilename = filename; // Absolute path: TODO: Add specific fallbacks here. @@ -157,7 +157,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { if (!compBuffer) { error("Error allocating memory for compressed file '%s'", filename.c_str()); delete file; - return NULL; + return nullptr; } byte *data = new byte[uncompSize]; @@ -165,7 +165,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { error("Error allocating buffer for file '%s'", filename.c_str()); delete[] compBuffer; delete file; - return NULL; + return nullptr; } file->seek(dataOffset + prefixSize, SEEK_SET); file->read(compBuffer, compSize); @@ -174,7 +174,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { error("Error uncompressing file '%s'", filename.c_str()); delete[] compBuffer; delete file; - return NULL; + return nullptr; } delete[] compBuffer; @@ -188,7 +188,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { return file; } - return NULL; + return nullptr; } } // end of namespace Wintermute diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp index b9805d78dd..1968da6f47 100644 --- a/engines/wintermute/base/file/base_file_entry.cpp +++ b/engines/wintermute/base/file/base_file_entry.cpp @@ -37,7 +37,7 @@ namespace Wintermute { Common::SeekableReadStream *BaseFileEntry::createReadStream() const { Common::SeekableReadStream *file = _package->getFilePointer(); if (!file) { - return NULL; + return nullptr; } bool compressed = (_compressedLength != 0); @@ -55,7 +55,7 @@ Common::SeekableReadStream *BaseFileEntry::createReadStream() const { ////////////////////////////////////////////////////////////////////////// BaseFileEntry::BaseFileEntry() { - _package = NULL; + _package = nullptr; _length = _compressedLength = _offset = _flags = 0; _filename = ""; @@ -67,7 +67,7 @@ BaseFileEntry::BaseFileEntry() { ////////////////////////////////////////////////////////////////////////// BaseFileEntry::~BaseFileEntry() { - _package = NULL; // ref only + _package = nullptr; // ref only } } // end of namespace Wintermute diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index 51a1558a7c..4434ed3951 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -157,7 +157,7 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool pkg->_cd = stream->readByte(); pkg->_priority = hdr._priority; delete[] pkgName; - pkgName = NULL; + pkgName = nullptr; if (!hdr._masterIndex) { pkg->_cd = 0; // override CD to fixed disk @@ -186,7 +186,7 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool Common::String upcName = name; upcName.toUppercase(); delete[] name; - name = NULL; + name = nullptr; offset = stream->readUint32LE(); offset += absoluteOffset; @@ -270,7 +270,7 @@ Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common:: if (it != _files.end()) { return it->_value->createReadStream(); } - return NULL; + return nullptr; } } // end of namespace Wintermute diff --git a/engines/wintermute/base/file/base_resources.cpp b/engines/wintermute/base/file/base_resources.cpp index 0b32cb0c4f..088d1c8126 100644 --- a/engines/wintermute/base/file/base_resources.cpp +++ b/engines/wintermute/base/file/base_resources.cpp @@ -2813,7 +2813,7 @@ Common::SeekableReadStream *BaseResources::getFile(const Common::String &filenam } else if (scumm_stricmp(filename.c_str(), "syste_font.bmp") == 0) { return new Common::MemoryReadStream(systemfont, sizeof(invalid), DisposeAfterUse::NO); } - return NULL; + return nullptr; } bool BaseResources::hasFile(const Common::String &filename) { diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp index 94d3e5a94e..2c4ddf4875 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.cpp +++ b/engines/wintermute/base/file/base_save_thumb_file.cpp @@ -38,7 +38,7 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BaseSaveThumbFile::BaseSaveThumbFile() { - _data = NULL; + _data = nullptr; } @@ -99,7 +99,7 @@ bool BaseSaveThumbFile::open(const Common::String &filename) { ////////////////////////////////////////////////////////////////////////// bool BaseSaveThumbFile::close() { delete[] _data; - _data = NULL; + _data = nullptr; _pos = 0; _size = 0; diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp index 87dd3da5a3..e3c8827254 100644 --- a/engines/wintermute/base/font/base_font.cpp +++ b/engines/wintermute/base/font/base_font.cpp @@ -89,7 +89,7 @@ BaseFont *BaseFont::createFromFile(BaseGame *gameRef, const Common::String &file if (font) { if (DID_FAIL(font->loadFile(filename))) { delete font; - return NULL; + return nullptr; } } return font; @@ -98,7 +98,7 @@ BaseFont *BaseFont::createFromFile(BaseGame *gameRef, const Common::String &file if (font) { if (DID_FAIL(font->loadFile(filename))) { delete font; - return NULL; + return nullptr; } } return font; @@ -119,7 +119,7 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const Common::String &filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { return false; } diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index 55f46c476b..af66cbb89f 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -49,8 +49,8 @@ IMPLEMENT_PERSISTENT(BaseFontBitmap, false) ////////////////////////////////////////////////////////////////////// BaseFontBitmap::BaseFontBitmap(BaseGame *inGame) : BaseFont(inGame) { - _subframe = NULL; - _sprite = NULL; + _subframe = nullptr; + _sprite = nullptr; _widthsFrame = 0; memset(_widths, 0, NUM_CHARACTERS); _tileWidth = _tileHeight = _numColumns = 0; @@ -64,8 +64,8 @@ BaseFontBitmap::BaseFontBitmap(BaseGame *inGame) : BaseFont(inGame) { BaseFontBitmap::~BaseFontBitmap() { delete _subframe; delete _sprite; - _subframe = NULL; - _sprite = NULL; + _subframe = nullptr; + _sprite = nullptr; } @@ -112,7 +112,7 @@ int BaseFontBitmap::textHeightDraw(const byte *text, int x, int y, int width, TT return 0; } - if (text == NULL || text[0] == '\0') { + if (text == nullptr || text[0] == '\0') { return _tileHeight; } @@ -273,7 +273,7 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) { ////////////////////////////////////////////////////////////////////// bool BaseFontBitmap::loadFile(const Common::String &filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "BaseFontBitmap::LoadFile failed for file '%s'", filename.c_str()); return STATUS_FAILED; } @@ -347,8 +347,8 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) { int i; int r = 255, g = 255, b = 255; bool custoTrans = false; - char *surfaceFile = NULL; - char *spriteFile = NULL; + char *surfaceFile = nullptr; + char *spriteFile = nullptr; bool autoWidth = false; int spaceWidth = 0; @@ -428,16 +428,16 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) { return STATUS_FAILED; } - if (spriteFile != NULL) { + if (spriteFile != nullptr) { delete _sprite; _sprite = new BaseSprite(_gameRef, this); if (!_sprite || DID_FAIL(_sprite->loadFile(spriteFile))) { delete _sprite; - _sprite = NULL; + _sprite = nullptr; } } - if (surfaceFile != NULL && !_sprite) { + if (surfaceFile != nullptr && !_sprite) { _subframe = new BaseSubFrame(_gameRef); if (custoTrans) { _subframe->setSurface(surfaceFile, false, r, g, b); @@ -447,7 +447,7 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) { } - if (((_subframe == NULL || _subframe->_surface == NULL) && _sprite == NULL) || _numColumns == 0 || _tileWidth == 0 || _tileHeight == 0) { + if (((_subframe == nullptr || _subframe->_surface == nullptr) && _sprite == nullptr) || _numColumns == 0 || _tileWidth == 0 || _tileHeight == 0) { _gameRef->LOG(0, "Incomplete font definition"); return STATUS_FAILED; } @@ -530,7 +530,7 @@ int BaseFontBitmap::getCharWidth(byte index) { ////////////////////////////////////////////////////////////////////////// bool BaseFontBitmap::getWidths() { - BaseSurface *surf = NULL; + BaseSurface *surf = nullptr; if (_sprite) { if (_widthsFrame >= 0 && _widthsFrame < (int32)_sprite->_frames.size()) { @@ -539,7 +539,7 @@ bool BaseFontBitmap::getWidths() { } } } - if (surf == NULL && _subframe) { + if (surf == nullptr && _subframe) { surf = _subframe->_surface; } if (!surf || DID_FAIL(surf->startPixelOp())) { diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp index 8128ffe897..6a625f30ae 100644 --- a/engines/wintermute/base/font/base_font_storage.cpp +++ b/engines/wintermute/base/font/base_font_storage.cpp @@ -72,7 +72,7 @@ bool BaseFontStorage::initLoop() { ////////////////////////////////////////////////////////////////////////// BaseFont *BaseFontStorage::addFont(const Common::String &filename) { if (!filename.size()) { - return NULL; + return nullptr; } for (uint32 i = 0; i < _fonts.size(); i++) { @@ -84,11 +84,11 @@ BaseFont *BaseFontStorage::addFont(const Common::String &filename) { /* BaseFont* font = new BaseFont(_gameRef); - if (!font) return NULL; + if (!font) return nullptr; if (DID_FAIL(font->loadFile(filename))) { delete font; - return NULL; + return nullptr; } else { font->_refCount = 1; diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 83f0a35f53..7f1ff340d2 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -50,13 +50,13 @@ BaseFontTT::BaseFontTT(BaseGame *inGame) : BaseFont(inGame) { _fontHeight = 12; _isBold = _isItalic = _isUnderline = _isStriked = false; - _fontFile = NULL; - _font = NULL; - _fallbackFont = NULL; - _deletableFont = NULL; + _fontFile = nullptr; + _font = nullptr; + _fallbackFont = nullptr; + _deletableFont = nullptr; for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - _cachedTexts[i] = NULL; + _cachedTexts[i] = nullptr; } _lineHeight = 0; @@ -73,10 +73,10 @@ BaseFontTT::~BaseFontTT(void) { _layers.clear(); delete[] _fontFile; - _fontFile = NULL; + _fontFile = nullptr; delete _deletableFont; - _font = NULL; + _font = nullptr; } @@ -86,7 +86,7 @@ void BaseFontTT::clearCache() { if (_cachedTexts[i]) { delete _cachedTexts[i]; } - _cachedTexts[i] = NULL; + _cachedTexts[i] = nullptr; } } @@ -96,13 +96,13 @@ void BaseFontTT::initLoop() { if (_gameRef->_constrainedMemory) { // purge all cached images not used in the last frame for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - if (_cachedTexts[i] == NULL) { + if (_cachedTexts[i] == nullptr) { continue; } if (!_cachedTexts[i]->_marked) { delete _cachedTexts[i]; - _cachedTexts[i] = NULL; + _cachedTexts[i] = nullptr; } else { _cachedTexts[i]->_marked = false; } @@ -151,7 +151,7 @@ int BaseFontTT::getTextHeight(byte *text, int width) { ////////////////////////////////////////////////////////////////////////// void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) { - if (text == NULL || strcmp((const char *)text, "") == 0) { + if (text == nullptr || strcmp((const char *)text, "") == 0) { return; } @@ -176,11 +176,11 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign // find cached surface, if exists uint32 minUseTime = UINT_MAX; int minIndex = -1; - BaseSurface *surface = NULL; + BaseSurface *surface = nullptr; int textOffset = 0; for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - if (_cachedTexts[i] == NULL) { + if (_cachedTexts[i] == nullptr) { minUseTime = 0; minIndex = i; } else { @@ -205,7 +205,7 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign surface = renderTextToTexture(textStr, width, align, maxHeight, textOffset); if (surface) { // write surface to cache - if (_cachedTexts[minIndex] != NULL) { + if (_cachedTexts[minIndex] != nullptr) { delete _cachedTexts[minIndex]; } _cachedTexts[minIndex] = new BaseCachedTTFontText; @@ -255,7 +255,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, lines.pop_back(); } if (lines.size() == 0) { - return NULL; + return nullptr; } Graphics::TextAlign alignment = Graphics::kTextAlignInvalid; @@ -304,7 +304,7 @@ int BaseFontTT::getLetterHeight() { ////////////////////////////////////////////////////////////////////// bool BaseFontTT::loadFile(const Common::String &filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "BaseFontTT::LoadFile failed for file '%s'", filename.c_str()); return STATUS_FAILED; } @@ -422,7 +422,7 @@ bool BaseFontTT::loadBuffer(byte *buffer) { _layers.add(layer); } else { delete layer; - layer = NULL; + layer = nullptr; cmd = PARSERR_TOKENNOTFOUND; } } @@ -528,9 +528,9 @@ bool BaseFontTT::persist(BasePersistenceManager *persistMgr) { if (!persistMgr->getIsSaving()) { for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - _cachedTexts[i] = NULL; + _cachedTexts[i] = nullptr; } - _fallbackFont = _font = _deletableFont = NULL; + _fallbackFont = _font = _deletableFont = nullptr; } return STATUS_OK; @@ -561,7 +561,7 @@ bool BaseFontTT::initFont() { _deletableFont = Graphics::loadTTFFont(*file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72). _font = _deletableFont; BaseFileManager::getEngineInstance()->closeFile(file); - file = NULL; + file = nullptr; } // Fallback2: Try to find ScummModern.zip, and get the font from there: @@ -570,16 +570,16 @@ bool BaseFontTT::initFont() { if (themeFile) { Common::Archive *themeArchive = Common::makeZipArchive(themeFile); if (themeArchive->hasFile("FreeSans.ttf")) { - file = NULL; + file = nullptr; file = themeArchive->createReadStreamForMember("FreeSans.ttf"); _deletableFont = Graphics::loadTTFFont(*file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72). _font = _deletableFont; } // We're not using BaseFileManager, so clean up after ourselves: delete file; - file = NULL; + file = nullptr; delete themeArchive; - themeArchive = NULL; + themeArchive = nullptr; } } @@ -627,7 +627,7 @@ void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight TextLine *line = (*it); textWidth = MAX(textWidth, line->GetWidth()); delete line; - line = NULL; + line = nullptr; }*/ } diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h index 2b69d1655d..ba4aac9380 100644 --- a/engines/wintermute/base/font/base_font_truetype.h +++ b/engines/wintermute/base/font/base_font_truetype.h @@ -61,7 +61,7 @@ private: _text = ""; _width = _maxHeight = _maxLength = -1; _align = TAL_LEFT; - _surface = NULL; + _surface = nullptr; _textOffset = 0; _lastUsed = 0; _marked = false; diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp index 4b15d563ed..05037cd177 100644 --- a/engines/wintermute/base/gfx/base_image.cpp +++ b/engines/wintermute/base/gfx/base_image.cpp @@ -43,10 +43,10 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////// BaseImage::BaseImage() { _fileManager = BaseFileManager::getEngineInstance(); - _palette = NULL; - _surface = NULL; - _decoder = NULL; - _deletableSurface = NULL; + _palette = nullptr; + _surface = nullptr; + _decoder = nullptr; + _deletableSurface = nullptr; } @@ -118,7 +118,7 @@ bool BaseImage::resize(int newWidth, int newHeight) { if (_deletableSurface) { _deletableSurface->free(); delete _deletableSurface; - _deletableSurface = NULL; + _deletableSurface = nullptr; } _surface = _deletableSurface = temp.scale((uint16)newWidth, (uint16)newHeight); temp.free(); @@ -222,7 +222,7 @@ bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) { if (_deletableSurface) { _deletableSurface->free(); delete _deletableSurface; - _deletableSurface = NULL; + _deletableSurface = nullptr; } _surface = _deletableSurface = temp.scale((uint16)newWidth, (uint16)newHeight); return true; diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index e7ffc14c25..6c230d2411 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -56,7 +56,7 @@ BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) { _loadImageName = ""; _saveImageName = ""; - _saveLoadImage = NULL; + _saveLoadImage = nullptr; _loadInProgress = false; _hasDrawnSaveLoadImage = false; @@ -132,24 +132,24 @@ void BaseRenderer::initSaveLoad(bool isSaving, bool quickSave) { if (isSaving && !quickSave) { delete _saveLoadImage; - _saveLoadImage = NULL; + _saveLoadImage = nullptr; if (_saveImageName.size()) { _saveLoadImage = createSurface(); if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) { delete _saveLoadImage; - _saveLoadImage = NULL; + _saveLoadImage = nullptr; } } } else { delete _saveLoadImage; - _saveLoadImage = NULL; + _saveLoadImage = nullptr; if (_loadImageName.size()) { _saveLoadImage = createSurface(); if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) { delete _saveLoadImage; - _saveLoadImage = NULL; + _saveLoadImage = nullptr; } } _loadInProgress = true; @@ -162,7 +162,7 @@ void BaseRenderer::endSaveLoad() { _indicatorWidthDrawn = 0; delete _saveLoadImage; - _saveLoadImage = NULL; + _saveLoadImage = nullptr; } void BaseRenderer::persistSaveLoadImages(BasePersistenceManager *persistMgr) { @@ -214,7 +214,7 @@ BaseObject *BaseRenderer::getObjectAt(int x, int y) { } } - return (BaseObject *)NULL; + return (BaseObject *)nullptr; } @@ -317,7 +317,7 @@ bool BaseRenderer::clipCursor() { ////////////////////////////////////////////////////////////////////////// bool BaseRenderer::unclipCursor() { /* - if (!_windowed) ::ClipCursor(NULL); + if (!_windowed) ::ClipCursor(nullptr); */ return STATUS_OK; } diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index 796dee8cd1..9bc195f1e1 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -81,13 +81,13 @@ public: * @param g the green component to fade too. * @param b the blue component to fade too. * @param a the alpha component to fade too. - * @param rect the portion of the screen to fade (if NULL, the entire screen will be faded). + * @param rect the portion of the screen to fade (if nullptr, the entire screen will be faded). */ - virtual void fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect = NULL) = 0; + virtual void fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect = nullptr) = 0; virtual bool drawLine(int x1, int y1, int x2, int y2, uint32 color); // Unused outside indicator-display virtual bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1); // Unused outside indicator-display - BaseRenderer(BaseGame *inGame = NULL); + BaseRenderer(BaseGame *inGame = nullptr); virtual ~BaseRenderer(); virtual bool setProjection() { return STATUS_OK; @@ -101,7 +101,7 @@ public: * @param g the green component to fill with. * @param b the blue component to fill with. */ - virtual bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL) = 0; + virtual bool fill(byte r, byte g, byte b, Common::Rect *rect = nullptr) = 0; virtual void onWindowChange(); virtual bool initRenderer(int width, int height, bool windowed); /** diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index 012be95aac..1ada900161 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -63,7 +63,7 @@ public: return STATUS_FAILED; } virtual bool putPixel(int x, int y, byte r, byte g, byte b, int a = -1); - virtual bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = NULL); + virtual bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr); virtual bool comparePixel(int x, int y, byte r, byte g, byte b, int a = -1); virtual bool startPixelOp(); virtual bool endPixelOp(); diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 748affa13f..cec594535f 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -54,13 +54,13 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { _spriteBatch = false; _batchNum = 0; _skipThisFrame = false; - _previousTicket = NULL; + _previousTicket = nullptr; _borderLeft = _borderRight = _borderTop = _borderBottom = 0; _ratioX = _ratioY = 1.0f; setAlphaMod(255); setColorMod(255, 255, 255); - _dirtyRect = NULL; + _dirtyRect = nullptr; _disableDirtyRects = false; if (ConfMan.hasKey("dirty_rects")) { _disableDirtyRects = !ConfMan.getBool("dirty_rects"); @@ -169,7 +169,7 @@ bool BaseRenderOSystem::flip() { if (_skipThisFrame) { _skipThisFrame = false; delete _dirtyRect; - _dirtyRect = NULL; + _dirtyRect = nullptr; g_system->updateScreen(); _needsFlip = false; return true; @@ -196,7 +196,7 @@ bool BaseRenderOSystem::flip() { } // g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); delete _dirtyRect; - _dirtyRect = NULL; + _dirtyRect = nullptr; g_system->updateScreen(); _needsFlip = false; } @@ -297,7 +297,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S // Avoid calling end() and operator* every time, when potentially going through // LOTS of tickets. RenderQueueIterator endIterator = _renderQueue.end(); - RenderTicket *compareTicket = NULL; + RenderTicket *compareTicket = nullptr; for (it = _lastAddedTicket; it != endIterator; ++it) { compareTicket = *it; if (*(compareTicket) == compare && compareTicket->_isValid) { diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 5917551c64..cc2ed57f9b 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -47,10 +47,10 @@ public: bool initRenderer(int width, int height, bool windowed) override; bool flip() override; virtual bool indicatorFlip(); - bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL) override; + bool fill(byte r, byte g, byte b, Common::Rect *rect = nullptr) override; Graphics::PixelFormat getPixelFormat() const override; void fade(uint16 alpha) override; - void fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect = NULL) override; + void fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect = nullptr) override; bool drawLine(int x1, int y1, int x2, int y2, uint32 color) override; diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index e2bc3967e2..e00b347ecc 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -47,9 +47,9 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) { _surface = new Graphics::Surface(); - _alphaMask = NULL; + _alphaMask = nullptr; _hasAlpha = true; - _lockPixels = NULL; + _lockPixels = nullptr; _lockPitch = 0; _loaded = false; } @@ -59,11 +59,11 @@ BaseSurfaceOSystem::~BaseSurfaceOSystem() { if (_surface) { _surface->free(); delete _surface; - _surface = NULL; + _surface = nullptr; } delete[] _alphaMask; - _alphaMask = NULL; + _alphaMask = nullptr; _gameRef->addMem(-_width * _height * 4); BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer); @@ -177,7 +177,7 @@ void BaseSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) { return; // TODO: Reimplement this delete[] _alphaMask; - _alphaMask = NULL; + _alphaMask = nullptr; if (!surface) { return; } @@ -214,7 +214,7 @@ void BaseSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) { if (!hasTransparency) { delete[] _alphaMask; - _alphaMask = NULL; + _alphaMask = nullptr; } } @@ -293,7 +293,7 @@ bool BaseSurfaceOSystem::isTransparentAtLite(int x, int y) { ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::startPixelOp() { - //SDL_LockTexture(_texture, NULL, &_lockPixels, &_lockPitch); + //SDL_LockTexture(_texture, nullptr, &_lockPixels, &_lockPitch); // Any pixel-op makes the caching useless: BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer); renderer->invalidateTicketsFromSurface(this); diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 174f54e315..d253ddca4b 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -59,7 +59,7 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw( _surface = temp; } } else { - _surface = NULL; + _surface = nullptr; } } diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index e1bc659fdd..1026969055 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -88,7 +88,7 @@ PartEmitter::PartEmitter(BaseGame *inGame, BaseScriptHolder *owner) : BaseObject _useRegion = false; - _emitEvent = NULL; + _emitEvent = nullptr; _owner = owner; } @@ -112,7 +112,7 @@ PartEmitter::~PartEmitter(void) { _sprites.clear(); delete[] _emitEvent; - _emitEvent = NULL; + _emitEvent = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -325,7 +325,7 @@ bool PartEmitter::display(BaseRegion *region) { } for (uint32 i = 0; i < _particles.size(); i++) { - if (region != NULL && _useRegion) { + if (region != nullptr && _useRegion) { if (!region->pointInRegion((int)_particles[i]->_pos.x, (int)_particles[i]->_pos.y)) { continue; } @@ -402,7 +402,7 @@ bool PartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int ////////////////////////////////////////////////////////////////////////// PartForce *PartEmitter::addForceByName(const Common::String &name) { - PartForce *force = NULL; + PartForce *force = nullptr; for (uint32 i = 0; i < _forces.size(); i++) { if (scumm_stricmp(name.c_str(), _forces[i]->getName()) == 0) { @@ -1133,7 +1133,7 @@ bool PartEmitter::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "EmitEvent") == 0) { delete[] _emitEvent; - _emitEvent = NULL; + _emitEvent = nullptr; if (!value->isNULL()) { BaseUtils::setString(&_emitEvent, value->getString()); } diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp index c8cf3fcc10..f1aba114de 100644 --- a/engines/wintermute/base/particles/part_particle.cpp +++ b/engines/wintermute/base/particles/part_particle.cpp @@ -41,7 +41,7 @@ PartParticle::PartParticle(BaseGame *inGame) : BaseClass(inGame) { _posZ = 0.0f; _velocity = Vector2(0.0f, 0.0f); _scale = 100.0f; - _sprite = NULL; + _sprite = nullptr; _creationTime = 0; _lifeTime = 0; _isDead = true; @@ -65,7 +65,7 @@ PartParticle::PartParticle(BaseGame *inGame) : BaseClass(inGame) { ////////////////////////////////////////////////////////////////////////// PartParticle::~PartParticle(void) { delete _sprite; - _sprite = NULL; + _sprite = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -76,7 +76,7 @@ bool PartParticle::setSprite(const Common::String &filename) { } delete _sprite; - _sprite = NULL; + _sprite = nullptr; SystemClassRegistry::getInstance()->_disabled = true; _sprite = new BaseSprite(_gameRef, (BaseObject*)_gameRef); @@ -85,7 +85,7 @@ bool PartParticle::setSprite(const Common::String &filename) { return STATUS_OK; } else { delete _sprite; - _sprite = NULL; + _sprite = nullptr; SystemClassRegistry::getInstance()->_disabled = false; return STATUS_FAILED; } @@ -260,7 +260,7 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { setSprite(filename); SystemClassRegistry::getInstance()->_disabled = false; delete[] filename; - filename = NULL; + filename = nullptr; } return STATUS_OK; diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp index 12204e1b35..465684a7a3 100644 --- a/engines/wintermute/base/saveload.cpp +++ b/engines/wintermute/base/saveload.cpp @@ -78,7 +78,7 @@ bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) { //_gameRef->LOG(0, "Load end %d", BaseUtils::GetUsedMemMB()); // AdGame: if (DID_SUCCEED(ret)) { - SystemClassRegistry::getInstance()->enumInstances(SaveLoad::afterLoadRegion, "AdRegion", NULL); + SystemClassRegistry::getInstance()->enumInstances(SaveLoad::afterLoadRegion, "AdRegion", nullptr); } return ret; } @@ -114,13 +114,13 @@ bool SaveLoad::saveGame(int slot, const char *desc, bool quickSave, BaseGame *ga ////////////////////////////////////////////////////////////////////////// bool SaveLoad::initAfterLoad() { - SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "BaseRegion", NULL); - SystemClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "BaseSubFrame", NULL); - SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", NULL); - SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", NULL); - SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "BaseRegion", nullptr); + SystemClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "BaseSubFrame", nullptr); + SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", nullptr); + SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", nullptr); + SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", nullptr); // AdGame: - SystemClassRegistry::getInstance()->enumInstances(afterLoadScene, "AdScene", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadScene, "AdScene", nullptr); return STATUS_OK; } diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp index 9bb7fedf38..23c452b73c 100644 --- a/engines/wintermute/base/scriptables/script.cpp +++ b/engines/wintermute/base/scriptables/script.cpp @@ -39,58 +39,58 @@ IMPLEMENT_PERSISTENT(ScScript, false) ////////////////////////////////////////////////////////////////////////// ScScript::ScScript(BaseGame *inGame, ScEngine *engine) : BaseClass(inGame) { - _buffer = NULL; + _buffer = nullptr; _bufferSize = _iP = 0; - _scriptStream = NULL; - _filename = NULL; + _scriptStream = nullptr; + _filename = nullptr; _currentLine = 0; - _symbols = NULL; + _symbols = nullptr; _numSymbols = 0; _engine = engine; - _globals = NULL; + _globals = nullptr; - _scopeStack = NULL; - _callStack = NULL; - _thisStack = NULL; - _stack = NULL; + _scopeStack = nullptr; + _callStack = nullptr; + _thisStack = nullptr; + _stack = nullptr; - _operand = NULL; - _reg1 = NULL; + _operand = nullptr; + _reg1 = nullptr; - _functions = NULL; + _functions = nullptr; _numFunctions = 0; - _methods = NULL; + _methods = nullptr; _numMethods = 0; - _events = NULL; + _events = nullptr; _numEvents = 0; - _externals = NULL; + _externals = nullptr; _numExternals = 0; _state = SCRIPT_FINISHED; _origState = SCRIPT_FINISHED; - _waitObject = NULL; + _waitObject = nullptr; _waitTime = 0; _waitFrozen = false; - _waitScript = NULL; + _waitScript = nullptr; _timeSlice = 0; _thread = false; _methodThread = false; - _threadEvent = NULL; + _threadEvent = nullptr; _freezable = true; - _owner = NULL; + _owner = nullptr; _unbreakable = false; - _parentScript = NULL; + _parentScript = nullptr; _tracingMode = false; } @@ -242,7 +242,7 @@ bool ScScript::create(const char *filename, byte *buffer, uint32 size, BaseScrip _methodThread = false; delete[] _threadEvent; - _threadEvent = NULL; + _threadEvent = nullptr; _filename = new char[strlen(filename) + 1]; if (_filename) { @@ -383,52 +383,52 @@ void ScScript::cleanup() { if (_buffer) { delete[] _buffer; } - _buffer = NULL; + _buffer = nullptr; if (_filename) { delete[] _filename; } - _filename = NULL; + _filename = nullptr; if (_symbols) { delete[] _symbols; } - _symbols = NULL; + _symbols = nullptr; _numSymbols = 0; if (_globals && !_thread) { delete _globals; } - _globals = NULL; + _globals = nullptr; delete _scopeStack; - _scopeStack = NULL; + _scopeStack = nullptr; delete _callStack; - _callStack = NULL; + _callStack = nullptr; delete _thisStack; - _thisStack = NULL; + _thisStack = nullptr; delete _stack; - _stack = NULL; + _stack = nullptr; if (_functions) { delete[] _functions; } - _functions = NULL; + _functions = nullptr; _numFunctions = 0; if (_methods) { delete[] _methods; } - _methods = NULL; + _methods = nullptr; _numMethods = 0; if (_events) { delete[] _events; } - _events = NULL; + _events = nullptr; _numEvents = 0; @@ -440,25 +440,25 @@ void ScScript::cleanup() { } delete[] _externals; } - _externals = NULL; + _externals = nullptr; _numExternals = 0; delete _operand; delete _reg1; - _operand = NULL; - _reg1 = NULL; + _operand = nullptr; + _reg1 = nullptr; delete[] _threadEvent; - _threadEvent = NULL; + _threadEvent = nullptr; _state = SCRIPT_FINISHED; - _waitObject = NULL; + _waitObject = nullptr; _waitTime = 0; _waitFrozen = false; - _waitScript = NULL; + _waitScript = nullptr; - _parentScript = NULL; // ref only + _parentScript = nullptr; // ref only delete _scriptStream; } @@ -511,7 +511,7 @@ bool ScScript::executeInstruction() { bool ret = STATUS_OK; uint32 dw; - const char *str = NULL; + const char *str = nullptr; //ScValue* op = new ScValue(_gameRef); _operand->cleanup(); @@ -787,7 +787,7 @@ bool ScScript::executeInstruction() { ScValue *var = _stack->pop(); ScValue *val = _stack->pop(); - if (val == NULL) { + if (val == nullptr) { runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); var->setNULL(); } else { @@ -928,7 +928,7 @@ bool ScScript::executeInstruction() { case II_AND: op2 = _stack->pop(); op1 = _stack->pop(); - if (op1 == NULL || op2 == NULL) { + if (op1 == nullptr || op2 == nullptr) { runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); _operand->setBool(false); } else { @@ -940,7 +940,7 @@ bool ScScript::executeInstruction() { case II_OR: op2 = _stack->pop(); op1 = _stack->pop(); - if (op1 == NULL || op2 == NULL) { + if (op1 == nullptr || op2 == nullptr) { runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); _operand->setBool(false); } else { @@ -1120,7 +1120,7 @@ uint32 ScScript::getMethodPos(const Common::String &name) const { ////////////////////////////////////////////////////////////////////////// ScValue *ScScript::getVar(char *name) { - ScValue *ret = NULL; + ScValue *ret = nullptr; // scope locals if (_scopeStack->_sP >= 0) { @@ -1130,20 +1130,20 @@ ScValue *ScScript::getVar(char *name) { } // script globals - if (ret == NULL) { + if (ret == nullptr) { if (_globals->propExists(name)) { ret = _globals->getProp(name); } } // engine globals - if (ret == NULL) { + if (ret == nullptr) { if (_engine->_globals->propExists(name)) { ret = _engine->_globals->getProp(name); } } - if (ret == NULL) { + if (ret == nullptr) { //RuntimeError("Variable '%s' is inaccessible in the current block. Consider changing the script.", name); _gameRef->LOG(0, "Warning: variable '%s' is inaccessible in the current block. Consider changing the script (script:%s, line:%d)", name, _filename, _currentLine); ScValue *val = new ScValue(_gameRef); @@ -1263,8 +1263,8 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) { _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); initTables(); } else { - _buffer = NULL; - _scriptStream = NULL; + _buffer = nullptr; + _scriptStream = nullptr; } } @@ -1306,11 +1306,11 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unbreakable) { - //if (_state!=SCRIPT_PERSISTENT) return NULL; + //if (_state!=SCRIPT_PERSISTENT) return nullptr; uint32 pos = getEventPos(eventName); if (!pos) { - return NULL; + return nullptr; } ScScript *thread = new ScScript(_gameRef, _engine); @@ -1322,10 +1322,10 @@ ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unb return thread; } else { delete thread; - return NULL; + return nullptr; } } else { - return NULL; + return nullptr; } } @@ -1390,7 +1390,7 @@ ScScript::TExternalFunction *ScScript::getExternal(char *name) { return &_externals[i]; } } - return NULL; + return nullptr; } @@ -1446,7 +1446,7 @@ const char *ScScript::dbgGetFilename() { ////////////////////////////////////////////////////////////////////////// void ScScript::afterLoad() { - if (_buffer == NULL) { + if (_buffer == nullptr) { byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize); if (!buffer) { _gameRef->LOG(0, "Error reinitializing script '%s' after load. Script will be terminated.", _filename); diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp index e8be0f0bd5..d5c5797a39 100644 --- a/engines/wintermute/base/scriptables/script_engine.cpp +++ b/engines/wintermute/base/scriptables/script_engine.cpp @@ -69,10 +69,10 @@ ScEngine::ScEngine(BaseGame *inGame) : BaseClass(inGame) { // prepare script cache for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { - _cachedScripts[i] = NULL; + _cachedScripts[i] = nullptr; } - _currentScript = NULL; + _currentScript = nullptr; _isProfiling = false; _profilingStartTime = 0; @@ -105,11 +105,11 @@ bool ScEngine::cleanup() { _scripts.clear(); delete _globals; - _globals = NULL; + _globals = nullptr; emptyScriptCache(); - _currentScript = NULL; // ref only + _currentScript = nullptr; // ref only return STATUS_OK; } @@ -140,7 +140,7 @@ ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) { // get script from cache compBuffer = getCompiledScript(filename, &compSize); if (!compBuffer) { - return NULL; + return nullptr; } // add new script @@ -149,7 +149,7 @@ ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) { if (DID_FAIL(ret)) { _gameRef->LOG(ret, "Error running script '%s'...", filename); delete script; - return NULL; + return nullptr; } else { // publish the "self" pseudo-variable ScValue val(_gameRef); @@ -191,7 +191,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig byte *buffer = BaseEngine::instance().getFileManager()->readWholeFile(filename, &size); if (!buffer) { _gameRef->LOG(0, "ScEngine::GetCompiledScript - error opening script '%s'", filename); - return NULL; + return nullptr; } // needs to be compiled? @@ -202,14 +202,14 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig if (!_compilerAvailable) { _gameRef->LOG(0, "ScEngine::GetCompiledScript - script '%s' needs to be compiled but compiler is not available", filename); delete[] buffer; - return NULL; + return nullptr; } // This code will never be called, since _compilerAvailable is const false. // It's only here in the event someone would want to reinclude the compiler. error("Script needs compilation, ScummVM does not contain a WME compiler"); } - byte *ret = NULL; + byte *ret = nullptr; // add script to cache CScCachedScript *cachedScript = new CScCachedScript(filename, compBuffer, compSize); @@ -217,7 +217,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig int index = 0; uint32 minTime = g_system->getMillis(); for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { - if (_cachedScripts[i] == NULL) { + if (_cachedScripts[i] == nullptr) { index = i; break; } else if (_cachedScripts[i]->_timestamp <= minTime) { @@ -226,7 +226,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig } } - if (_cachedScripts[index] != NULL) { + if (_cachedScripts[index] != nullptr) { delete _cachedScripts[index]; } _cachedScripts[index] = cachedScript; @@ -296,7 +296,7 @@ bool ScEngine::tick() { if (!isValidScript(_scripts[i]->_waitScript) || _scripts[i]->_waitScript->_state == SCRIPT_ERROR) { // fake return value _scripts[i]->_stack->pushNULL(); - _scripts[i]->_waitScript = NULL; + _scripts[i]->_waitScript = nullptr; _scripts[i]->run(); } else { if (_scripts[i]->_waitScript->_state == SCRIPT_THREAD_FINISHED) { @@ -304,7 +304,7 @@ bool ScEngine::tick() { _scripts[i]->_stack->push(_scripts[i]->_waitScript->_stack->pop()); _scripts[i]->run(); _scripts[i]->_waitScript->finish(); - _scripts[i]->_waitScript = NULL; + _scripts[i]->_waitScript = nullptr; } } break; @@ -351,7 +351,7 @@ bool ScEngine::tick() { addScriptTime(_scripts[i]->_filename, g_system->getMillis() - startTime); } } - _currentScript = NULL; + _currentScript = nullptr; } removeFinishedScripts(); @@ -373,7 +373,7 @@ bool ScEngine::tickUnbreakable() { _scripts[i]->executeInstruction(); } _scripts[i]->finish(); - _currentScript = NULL; + _currentScript = nullptr; } removeFinishedScripts(); @@ -444,7 +444,7 @@ bool ScEngine::emptyScriptCache() { for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { if (_cachedScripts[i]) { delete _cachedScripts[i]; - _cachedScripts[i] = NULL; + _cachedScripts[i] = nullptr; } } return STATUS_OK; @@ -496,7 +496,7 @@ bool ScEngine::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// void ScEngine::editorCleanup() { for (uint32 i = 0; i < _scripts.size(); i++) { - if (_scripts[i]->_owner == NULL && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) { + if (_scripts[i]->_owner == nullptr && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) { delete _scripts[i]; _scripts.remove_at(i); i--; diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h index 1a023326eb..639875ffb6 100644 --- a/engines/wintermute/base/scriptables/script_engine.h +++ b/engines/wintermute/base/scriptables/script_engine.h @@ -96,10 +96,10 @@ public: byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false); DECLARE_PERSISTENT(ScEngine, BaseClass) bool cleanup(); - int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL); + int getNumScripts(int *running = nullptr, int *waiting = nullptr, int *persistent = nullptr); bool tick(); ScValue *_globals; - ScScript *runScript(const char *filename, BaseScriptHolder *owner = NULL); + ScScript *runScript(const char *filename, BaseScriptHolder *owner = nullptr); static const bool _compilerAvailable = false; ScEngine(BaseGame *inGame); diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp index 613cbd0758..892d0674ff 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.cpp +++ b/engines/wintermute/base/scriptables/script_ext_array.cpp @@ -69,7 +69,7 @@ SXArray::SXArray(BaseGame *inGame) : BaseScriptable(inGame) { ////////////////////////////////////////////////////////////////////////// SXArray::~SXArray() { delete _values; - _values = NULL; + _values = nullptr; } diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp index 08ecc8d7db..29e032a759 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.cpp +++ b/engines/wintermute/base/scriptables/script_ext_file.cpp @@ -52,13 +52,13 @@ SXFile::SXFile(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) { stack->correctParams(1); ScValue *val = stack->pop(); - _filename = NULL; + _filename = nullptr; if (!val->isNULL()) { BaseUtils::setString(&_filename, val->getString()); } - _readFile = NULL; - _writeFile = NULL; + _readFile = nullptr; + _writeFile = nullptr; _mode = 0; _textMode = false; @@ -73,7 +73,7 @@ SXFile::~SXFile() { ////////////////////////////////////////////////////////////////////////// void SXFile::cleanup() { delete[] _filename; - _filename = NULL; + _filename = nullptr; close(); } @@ -82,12 +82,12 @@ void SXFile::cleanup() { void SXFile::close() { if (_readFile) { BaseFileManager::getEngineInstance()->closeFile(_readFile); - _readFile = NULL; + _readFile = nullptr; } if (_writeFile) { _writeFile->finalize(); delete _writeFile; - _writeFile = NULL; + _writeFile = nullptr; } _mode = 0; _textMode = false; @@ -778,8 +778,8 @@ bool SXFile::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(pos)); // try to re-open file if needed - _writeFile = NULL; - _readFile = NULL; + _writeFile = nullptr; + _readFile = nullptr; if (_mode != 0) { // open for reading diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp index 42c5cfb20e..9de9905fea 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp @@ -44,7 +44,7 @@ BaseScriptable *makeSXMemBuffer(BaseGame *inGame, ScStack *stack) { ////////////////////////////////////////////////////////////////////////// SXMemBuffer::SXMemBuffer(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) { stack->correctParams(1); - _buffer = NULL; + _buffer = nullptr; _size = 0; int newSize = stack->pop()->getInt(); @@ -73,7 +73,7 @@ void SXMemBuffer::cleanup() { if (_size) { free(_buffer); } - _buffer = NULL; + _buffer = nullptr; _size = 0; } @@ -109,7 +109,7 @@ bool SXMemBuffer::resize(int newSize) { ////////////////////////////////////////////////////////////////////////// bool SXMemBuffer::checkBounds(ScScript *script, int start, int length) { - if (_buffer == NULL) { + if (_buffer == nullptr) { script->runtimeError("Cannot use Set/Get methods on an uninitialized memory buffer"); return false; } @@ -509,7 +509,7 @@ bool SXMemBuffer::persist(BasePersistenceManager *persistMgr) { _buffer = malloc(_size); persistMgr->getBytes((byte *)_buffer, _size); } else { - _buffer = NULL; + _buffer = nullptr; } } diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index 5f7da1c2dd..6b4a615509 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -45,7 +45,7 @@ BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack) { ////////////////////////////////////////////////////////////////////////// SXString::SXString(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) { - _string = NULL; + _string = nullptr; _capacity = 0; stack->correctParams(1); @@ -81,7 +81,7 @@ void SXString::setStringVal(const char *val) { if (len >= _capacity) { _capacity = len + 1; delete[] _string; - _string = NULL; + _string = nullptr; _string = new char[_capacity]; memset(_string, 0, _capacity); } @@ -331,7 +331,7 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack array->push(val); delete val; - val = NULL; + val = nullptr; } stack->pushNative(array, false); @@ -420,7 +420,7 @@ bool SXString::persist(BasePersistenceManager *persistMgr) { _string = new char[_capacity]; persistMgr->getBytes((byte *)_string, _capacity); } else { - _string = NULL; + _string = nullptr; } } diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp index 194c5f4f35..3239decae8 100644 --- a/engines/wintermute/base/scriptables/script_stack.cpp +++ b/engines/wintermute/base/scriptables/script_stack.cpp @@ -58,7 +58,7 @@ ScStack::~ScStack() { ScValue *ScStack::pop() { if (_sP < 0) { _gameRef->LOG(0, "Fatal: Stack underflow"); - return NULL; + return nullptr; } return _values[_sP--]; @@ -97,7 +97,7 @@ ScValue *ScStack::getPushValue() { ////////////////////////////////////////////////////////////////////////// ScValue *ScStack::getTop() { if (_sP < 0 || _sP >= (int32)_values.size()) { - return NULL; + return nullptr; } else { return _values[_sP]; } @@ -108,7 +108,7 @@ ScValue *ScStack::getTop() { ScValue *ScStack::getAt(int index) { index = _sP - index; if (index < 0 || index >= (int32)_values.size()) { - return NULL; + return nullptr; } else { return _values[index]; } diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp index ad8ab26e09..08b8ddd418 100644 --- a/engines/wintermute/base/scriptables/script_value.cpp +++ b/engines/wintermute/base/scriptables/script_value.cpp @@ -49,9 +49,9 @@ ScValue::ScValue(BaseGame *inGame) : BaseClass(inGame) { _valBool = false; _valInt = 0; _valFloat = 0.0f; - _valNative = NULL; - _valString = NULL; - _valRef = NULL; + _valNative = nullptr; + _valString = nullptr; + _valRef = nullptr; _persistent = false; _isConstVar = false; } @@ -64,9 +64,9 @@ ScValue::ScValue(BaseGame *inGame, bool val) : BaseClass(inGame) { _valInt = 0; _valFloat = 0.0f; - _valNative = NULL; - _valString = NULL; - _valRef = NULL; + _valNative = nullptr; + _valString = nullptr; + _valRef = nullptr; _persistent = false; _isConstVar = false; } @@ -79,9 +79,9 @@ ScValue::ScValue(BaseGame *inGame, int val) : BaseClass(inGame) { _valFloat = 0.0f; _valBool = false; - _valNative = NULL; - _valString = NULL; - _valRef = NULL; + _valNative = nullptr; + _valString = nullptr; + _valRef = nullptr; _persistent = false; _isConstVar = false; } @@ -94,9 +94,9 @@ ScValue::ScValue(BaseGame *inGame, double val) : BaseClass(inGame) { _valInt = 0; _valBool = false; - _valNative = NULL; - _valString = NULL; - _valRef = NULL; + _valNative = nullptr; + _valString = nullptr; + _valRef = nullptr; _persistent = false; _isConstVar = false; } @@ -105,14 +105,14 @@ ScValue::ScValue(BaseGame *inGame, double val) : BaseClass(inGame) { ////////////////////////////////////////////////////////////////////////// ScValue::ScValue(BaseGame *inGame, const char *val) : BaseClass(inGame) { _type = VAL_STRING; - _valString = NULL; + _valString = nullptr; setStringVal(val); _valBool = false; _valInt = 0; _valFloat = 0.0f; - _valNative = NULL; - _valRef = NULL; + _valNative = nullptr; + _valRef = nullptr; _persistent = false; _isConstVar = false; } @@ -131,7 +131,7 @@ void ScValue::cleanup(bool ignoreNatives) { _valNative->_refCount--; if (_valNative->_refCount <= 0) { delete _valNative; - _valNative = NULL; + _valNative = nullptr; } } } @@ -142,9 +142,9 @@ void ScValue::cleanup(bool ignoreNatives) { _valBool = false; _valInt = 0; _valFloat = 0.0f; - _valNative = NULL; - _valString = NULL; - _valRef = NULL; + _valNative = nullptr; + _valString = nullptr; + _valRef = nullptr; _persistent = false; _isConstVar = false; } @@ -176,13 +176,13 @@ ScValue *ScValue::getProp(const char *name) { return _gameRef->_scValue; } - ScValue *ret = NULL; + ScValue *ret = nullptr; if (_type == VAL_NATIVE && _valNative) { ret = _valNative->scGetProperty(name); } - if (ret == NULL) { + if (ret == nullptr) { _valIter = _valObject.find(name); if (_valIter != _valObject.end()) { ret = _valIter->_value; @@ -200,7 +200,7 @@ bool ScValue::deleteProp(const char *name) { _valIter = _valObject.find(name); if (_valIter != _valObject.end()) { delete _valIter->_value; - _valIter->_value = NULL; + _valIter->_value = nullptr; } return STATUS_OK; @@ -220,7 +220,7 @@ bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAs } if (DID_FAIL(ret)) { - ScValue *newVal = NULL; + ScValue *newVal = nullptr; _valIter = _valObject.find(name); if (_valIter != _valObject.end()) { @@ -244,7 +244,7 @@ bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAs _valIter = _valObject.find(Name); if (_valIter != _valObject.end()) { delete _valIter->_value; - _valIter->_value = NULL; + _valIter->_value = nullptr; } ScValue* val = new ScValue(_gameRef); val->Copy(Val, CopyWhole); @@ -451,11 +451,11 @@ void ScValue::setString(const Common::String &val) { void ScValue::setStringVal(const char *val) { if (_valString) { delete[] _valString; - _valString = NULL; + _valString = nullptr; } - if (val == NULL) { - _valString = NULL; + if (val == nullptr) { + _valString = nullptr; return; } @@ -479,7 +479,7 @@ void ScValue::setNULL() { delete _valNative; } } - _valNative = NULL; + _valNative = nullptr; deleteProps(); _type = VAL_NULL; @@ -493,7 +493,7 @@ void ScValue::setNative(BaseScriptable *val, bool persistent) { return; } - if (val == NULL) { + if (val == nullptr) { setNULL(); } else { if (_valNative && !_persistent) { @@ -502,7 +502,7 @@ void ScValue::setNative(BaseScriptable *val, bool persistent) { if (_valNative != val) { delete _valNative; } - _valNative = NULL; + _valNative = nullptr; } } @@ -693,7 +693,7 @@ BaseScriptable *ScValue::getNative() { if (_type == VAL_NATIVE) { return _valNative; } else { - return NULL; + return nullptr; } } @@ -714,7 +714,7 @@ void ScValue::copy(ScValue *orig, bool copyWhole) { if (_valNative != orig->_valNative) { delete _valNative; } - _valNative = NULL; + _valNative = nullptr; } } diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp index 00d07cd3c2..f246c03fe1 100644 --- a/engines/wintermute/base/sound/base_sound.cpp +++ b/engines/wintermute/base/sound/base_sound.cpp @@ -36,7 +36,7 @@ namespace Wintermute { IMPLEMENT_PERSISTENT(BaseSound, false) BaseSound::BaseSound(BaseGame *inGame) : BaseClass(inGame) { - _sound = NULL; + _sound = nullptr; _soundFilename = ""; _soundType = Audio::Mixer::kSFXSoundType; @@ -57,13 +57,13 @@ BaseSound::~BaseSound() { if (_sound) { _gameRef->_soundMgr->removeSound(_sound); } - _sound = NULL; + _sound = nullptr; } bool BaseSound::setSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) { if (_sound) { _gameRef->_soundMgr->removeSound(_sound); - _sound = NULL; + _sound = nullptr; } _soundFilename = Common::String(); // Set empty diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index d2b265a254..9c919abac6 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -49,13 +49,13 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame) : BaseClass(inGame) { - _stream = NULL; - _handle = NULL; -// _sync = NULL; + _stream = nullptr; + _handle = nullptr; +// _sync = nullptr; _streamed = false; _filename = ""; - _file = NULL; + _file = nullptr; _privateVolume = 255; _volume = 255; @@ -76,10 +76,10 @@ BaseSoundBuffer::~BaseSoundBuffer() { if (_handle) { g_system->getMixer()->stopHandle(*_handle); delete _handle; - _handle = NULL; + _handle = nullptr; } delete _stream; - _stream = NULL; + _stream = nullptr; } @@ -134,7 +134,7 @@ bool BaseSoundBuffer::play(bool looping, uint32 startSample) { if (_handle) { g_system->getMixer()->stopHandle(*_handle); delete _handle; - _handle = NULL; + _handle = nullptr; } // Store the loop-value for save-games. setLooping(looping); diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp index 7e4a70afb2..c6eb871a85 100644 --- a/engines/wintermute/base/sound/base_sound_manager.cpp +++ b/engines/wintermute/base/sound/base_sound_manager.cpp @@ -94,7 +94,7 @@ bool BaseSoundMgr::initialize() { ////////////////////////////////////////////////////////////////////////// BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) { if (!_soundAvailable) { - return NULL; + return nullptr; } BaseSoundBuffer *sound; @@ -114,7 +114,7 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M sound = new BaseSoundBuffer(_gameRef); if (!sound) { - return NULL; + return nullptr; } sound->setStreaming(streamed); @@ -125,7 +125,7 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M if (DID_FAIL(res)) { _gameRef->LOG(res, "Error loading sound '%s'", useFilename.c_str()); delete sound; - return NULL; + return nullptr; } // Make sure the master-volume is applied to the sound. @@ -136,7 +136,7 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M return sound; - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// |