From 980dc4a456f55a8b6526d2bc6f7694a0b2d666b3 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 26 Jan 2013 18:06:42 +0100 Subject: WINTERMUTE: Replace all NULLs with nullptr. --- engines/wintermute/ad/ad_actor.cpp | 116 +++++------ engines/wintermute/ad/ad_actor.h | 2 +- engines/wintermute/ad/ad_entity.cpp | 64 +++--- engines/wintermute/ad/ad_game.cpp | 156 +++++++------- engines/wintermute/ad/ad_inventory.cpp | 12 +- engines/wintermute/ad/ad_inventory.h | 2 +- engines/wintermute/ad/ad_inventory_box.cpp | 12 +- engines/wintermute/ad/ad_item.cpp | 38 ++-- engines/wintermute/ad/ad_layer.cpp | 16 +- engines/wintermute/ad/ad_node_state.cpp | 24 +-- engines/wintermute/ad/ad_object.cpp | 90 ++++---- engines/wintermute/ad/ad_object.h | 2 +- engines/wintermute/ad/ad_path.cpp | 6 +- engines/wintermute/ad/ad_path_point.cpp | 6 +- engines/wintermute/ad/ad_region.cpp | 2 +- engines/wintermute/ad/ad_response.cpp | 24 +-- engines/wintermute/ad/ad_response_box.cpp | 54 ++--- engines/wintermute/ad/ad_response_context.cpp | 6 +- engines/wintermute/ad/ad_rot_level.cpp | 2 +- engines/wintermute/ad/ad_scale_level.cpp | 2 +- engines/wintermute/ad/ad_scene.cpp | 112 +++++----- engines/wintermute/ad/ad_scene.h | 20 +- engines/wintermute/ad/ad_scene_node.cpp | 8 +- engines/wintermute/ad/ad_scene_state.cpp | 6 +- engines/wintermute/ad/ad_sentence.cpp | 56 ++--- engines/wintermute/ad/ad_sprite_set.cpp | 34 +-- engines/wintermute/ad/ad_sprite_set.h | 2 +- engines/wintermute/ad/ad_talk_def.cpp | 32 +-- engines/wintermute/ad/ad_talk_holder.cpp | 20 +- engines/wintermute/ad/ad_talk_node.cpp | 32 +-- engines/wintermute/ad/ad_waypoint_group.cpp | 2 +- engines/wintermute/base/base.cpp | 20 +- engines/wintermute/base/base.h | 2 +- engines/wintermute/base/base_active_rect.cpp | 16 +- engines/wintermute/base/base_active_rect.h | 2 +- engines/wintermute/base/base_dynamic_buffer.cpp | 6 +- engines/wintermute/base/base_engine.cpp | 8 +- engines/wintermute/base/base_file_manager.cpp | 24 +-- engines/wintermute/base/base_file_manager.h | 2 +- engines/wintermute/base/base_frame.cpp | 26 +-- engines/wintermute/base/base_frame.h | 2 +- engines/wintermute/base/base_game.cpp | 230 ++++++++++----------- engines/wintermute/base/base_game.h | 8 +- engines/wintermute/base/base_game_music.cpp | 12 +- engines/wintermute/base/base_named_object.cpp | 14 +- engines/wintermute/base/base_object.cpp | 50 ++--- engines/wintermute/base/base_parser.cpp | 8 +- engines/wintermute/base/base_parser.h | 2 +- .../wintermute/base/base_persistence_manager.cpp | 42 ++-- engines/wintermute/base/base_region.cpp | 4 +- engines/wintermute/base/base_region.h | 2 +- engines/wintermute/base/base_save_thumb_helper.cpp | 18 +- engines/wintermute/base/base_script_holder.cpp | 34 +-- engines/wintermute/base/base_scriptable.cpp | 12 +- engines/wintermute/base/base_sprite.cpp | 24 +-- engines/wintermute/base/base_sprite.h | 8 +- engines/wintermute/base/base_string_table.cpp | 24 +-- engines/wintermute/base/base_sub_frame.cpp | 24 +-- engines/wintermute/base/base_sub_frame.h | 2 +- engines/wintermute/base/base_surface_storage.cpp | 4 +- engines/wintermute/base/base_viewport.cpp | 2 +- engines/wintermute/base/base_viewport.h | 2 +- engines/wintermute/base/file/base_disk_file.cpp | 10 +- engines/wintermute/base/file/base_file_entry.cpp | 6 +- engines/wintermute/base/file/base_package.cpp | 6 +- engines/wintermute/base/file/base_resources.cpp | 2 +- .../wintermute/base/file/base_save_thumb_file.cpp | 4 +- engines/wintermute/base/font/base_font.cpp | 6 +- engines/wintermute/base/font/base_font_bitmap.cpp | 28 +-- engines/wintermute/base/font/base_font_storage.cpp | 6 +- .../wintermute/base/font/base_font_truetype.cpp | 48 ++--- engines/wintermute/base/font/base_font_truetype.h | 2 +- engines/wintermute/base/gfx/base_image.cpp | 12 +- engines/wintermute/base/gfx/base_renderer.cpp | 16 +- engines/wintermute/base/gfx/base_renderer.h | 8 +- engines/wintermute/base/gfx/base_surface.h | 2 +- .../base/gfx/osystem/base_render_osystem.cpp | 10 +- .../base/gfx/osystem/base_render_osystem.h | 4 +- .../base/gfx/osystem/base_surface_osystem.cpp | 14 +- .../wintermute/base/gfx/osystem/render_ticket.cpp | 2 +- engines/wintermute/base/particles/part_emitter.cpp | 10 +- .../wintermute/base/particles/part_particle.cpp | 10 +- engines/wintermute/base/saveload.cpp | 14 +- engines/wintermute/base/scriptables/script.cpp | 110 +++++----- .../wintermute/base/scriptables/script_engine.cpp | 34 +-- .../wintermute/base/scriptables/script_engine.h | 4 +- .../base/scriptables/script_ext_array.cpp | 2 +- .../base/scriptables/script_ext_file.cpp | 16 +- .../base/scriptables/script_ext_mem_buffer.cpp | 8 +- .../base/scriptables/script_ext_string.cpp | 8 +- .../wintermute/base/scriptables/script_stack.cpp | 6 +- .../wintermute/base/scriptables/script_value.cpp | 64 +++--- engines/wintermute/base/sound/base_sound.cpp | 6 +- .../wintermute/base/sound/base_sound_buffer.cpp | 14 +- .../wintermute/base/sound/base_sound_manager.cpp | 8 +- .../wintermute/graphics/transparent_surface.cpp | 8 +- engines/wintermute/graphics/transparent_surface.h | 2 +- engines/wintermute/platform_osystem.cpp | 10 +- engines/wintermute/system/sys_class.cpp | 4 +- engines/wintermute/system/sys_class_registry.cpp | 6 +- engines/wintermute/ui/ui_button.cpp | 66 +++--- engines/wintermute/ui/ui_button.h | 2 +- engines/wintermute/ui/ui_edit.cpp | 16 +- engines/wintermute/ui/ui_entity.cpp | 8 +- engines/wintermute/ui/ui_object.cpp | 26 +-- engines/wintermute/ui/ui_object.h | 2 +- engines/wintermute/ui/ui_text.cpp | 10 +- engines/wintermute/ui/ui_text.h | 2 +- engines/wintermute/ui/ui_tiled_image.cpp | 8 +- engines/wintermute/ui/ui_tiled_image.h | 2 +- engines/wintermute/ui/ui_window.cpp | 48 ++--- engines/wintermute/utils/string_util.cpp | 2 +- engines/wintermute/utils/utils.cpp | 4 +- engines/wintermute/video/video_player.cpp | 2 +- engines/wintermute/video/video_player.h | 2 +- engines/wintermute/video/video_theora_player.cpp | 22 +- engines/wintermute/video/video_theora_player.h | 2 +- engines/wintermute/wintermute.cpp | 16 +- 118 files changed, 1182 insertions(+), 1182 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index 74fb4a5ae2..1346a090f6 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.cpp @@ -57,15 +57,15 @@ AdActor::AdActor(BaseGame *inGame) : AdTalkHolder(inGame) { _type = OBJECT_ACTOR; _dir = DI_LEFT; - _walkSprite = NULL; - _standSprite = NULL; - _turnLeftSprite = NULL; - _turnRightSprite = NULL; + _walkSprite = nullptr; + _standSprite = nullptr; + _turnLeftSprite = nullptr; + _turnRightSprite = nullptr; _targetPoint = new BasePoint; _afterWalkDir = DI_NONE; - _animSprite2 = NULL; + _animSprite2 = nullptr; setDefaultAnimNames(); } @@ -84,19 +84,19 @@ bool AdActor::setDefaultAnimNames() { AdActor::~AdActor() { delete _path; delete _targetPoint; - _path = NULL; - _targetPoint = NULL; + _path = nullptr; + _targetPoint = nullptr; delete _walkSprite; delete _standSprite; delete _turnLeftSprite; delete _turnRightSprite; - _walkSprite = NULL; - _standSprite = NULL; - _turnLeftSprite = NULL; - _turnRightSprite = NULL; + _walkSprite = nullptr; + _standSprite = nullptr; + _turnLeftSprite = nullptr; + _turnRightSprite = nullptr; - _animSprite2 = NULL; // ref only + _animSprite2 = nullptr; // ref only for (uint32 i = 0; i < _talkSprites.size(); i++) { delete _talkSprites[i]; @@ -110,7 +110,7 @@ AdActor::~AdActor() { for (uint32 i = 0; i < _anims.size(); i++) { delete _anims[i]; - _anims[i] = NULL; + _anims[i] = nullptr; } _anims.clear(); @@ -120,7 +120,7 @@ AdActor::~AdActor() { ////////////////////////////////////////////////////////////////////////// bool AdActor::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdActor::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -232,7 +232,7 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { } AdGame *adGame = (AdGame *)_gameRef; - AdSpriteSet *spr = NULL; + AdSpriteSet *spr = nullptr; int ar = 0, ag = 0, ab = 0, alpha = 0; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -287,7 +287,7 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_WALK: delete _walkSprite; - _walkSprite = NULL; + _walkSprite = nullptr; spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texWalkLifeTime, CACHE_HALF))) { cmd = PARSERR_GENERIC; @@ -316,7 +316,7 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_STAND: delete _standSprite; - _standSprite = NULL; + _standSprite = nullptr; spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texStandLifeTime))) { cmd = PARSERR_GENERIC; @@ -327,7 +327,7 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_TURN_LEFT: delete _turnLeftSprite; - _turnLeftSprite = NULL; + _turnLeftSprite = nullptr; spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true))) { cmd = PARSERR_GENERIC; @@ -338,7 +338,7 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_TURN_RIGHT: delete _turnRightSprite; - _turnRightSprite = NULL; + _turnRightSprite = nullptr; spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true))) { cmd = PARSERR_GENERIC; @@ -356,7 +356,7 @@ bool AdActor::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; @@ -392,15 +392,15 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_BLOCKED_REGION: { delete _blockRegion; delete _currentBlockRegion; - _blockRegion = NULL; - _currentBlockRegion = NULL; + _blockRegion = nullptr; + _currentBlockRegion = nullptr; BaseRegion *rgn = new BaseRegion(_gameRef); BaseRegion *crgn = new BaseRegion(_gameRef); if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) { delete _blockRegion; delete _currentBlockRegion; - _blockRegion = NULL; - _currentBlockRegion = NULL; + _blockRegion = nullptr; + _currentBlockRegion = nullptr; cmd = PARSERR_GENERIC; } else { _blockRegion = rgn; @@ -413,15 +413,15 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_WAYPOINTS: { delete _wptGroup; delete _currentWptGroup; - _wptGroup = NULL; - _currentWptGroup = NULL; + _wptGroup = nullptr; + _currentWptGroup = nullptr; AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef); AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef); if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) { delete _wptGroup; delete _currentWptGroup; - _wptGroup = NULL; - _currentWptGroup = NULL; + _wptGroup = nullptr; + _currentWptGroup = nullptr; cmd = PARSERR_GENERIC; } else { _wptGroup = wpt; @@ -502,7 +502,7 @@ void AdActor::turnTo(TDirection dir) { _targetDir = dir; _state = delta < 0 ? STATE_TURNING_LEFT : STATE_TURNING_RIGHT; - _tempSprite2 = NULL; + _tempSprite2 = nullptr; } @@ -566,7 +566,7 @@ bool AdActor::display() { _currentSprite->display(_posX, _posY, - reg ? _registerAlias : NULL, + reg ? _registerAlias : nullptr, scaleX, scaleY, alpha, @@ -589,26 +589,26 @@ bool AdActor::display() { ////////////////////////////////////////////////////////////////////////// bool AdActor::update() { - _currentSprite = NULL; + _currentSprite = nullptr; if (_state == STATE_READY) { if (_animSprite) { delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; } if (_animSprite2) { - _animSprite2 = NULL; + _animSprite2 = nullptr; } } // finished playing animation? - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) { + if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->isFinished()) { _state = _nextState; _nextState = STATE_READY; _currentSprite = _animSprite; } - if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != NULL && _animSprite2->isFinished()) { + if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != nullptr && _animSprite2->isFinished()) { _state = _nextState; _nextState = STATE_READY; _currentSprite = _animSprite2; @@ -649,7 +649,7 @@ bool AdActor::update() { ////////////////////////////////////////////////////////////////////////// case STATE_TURNING_LEFT: - if (_tempSprite2 == NULL || _tempSprite2->isFinished()) { + if (_tempSprite2 == nullptr || _tempSprite2->isFinished()) { if (_dir > 0) { _dir = (TDirection)(_dir - 1); } else { @@ -657,7 +657,7 @@ bool AdActor::update() { } if (_dir == _targetDir) { - _tempSprite2 = NULL; + _tempSprite2 = nullptr; _state = _nextState; _nextState = STATE_READY; } else { @@ -686,7 +686,7 @@ bool AdActor::update() { ////////////////////////////////////////////////////////////////////////// case STATE_TURNING_RIGHT: - if (_tempSprite2 == NULL || _tempSprite2->isFinished()) { + if (_tempSprite2 == nullptr || _tempSprite2->isFinished()) { _dir = (TDirection)(_dir + 1); if ((int)_dir >= (int)NUM_DIRECTIONS) { @@ -694,7 +694,7 @@ bool AdActor::update() { } if (_dir == _targetDir) { - _tempSprite2 = NULL; + _tempSprite2 = nullptr; _state = _nextState; _nextState = STATE_READY; } else { @@ -753,10 +753,10 @@ bool AdActor::update() { } bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime); - if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { + if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { if (timeIsUp) { _sentence->finish(); - _tempSprite2 = NULL; + _tempSprite2 = nullptr; _state = _nextState; _nextState = STATE_READY; } else { @@ -821,7 +821,7 @@ bool AdActor::update() { void AdActor::followPath() { // skip current position _path->getFirst(); - while (_path->getCurrent() != NULL) { + while (_path->getCurrent() != nullptr) { if (_path->getCurrent()->x != _posX || _path->getCurrent()->y != _posY) { break; } @@ -829,7 +829,7 @@ void AdActor::followPath() { } // are there points to follow? - if (_path->getCurrent() != NULL) { + if (_path->getCurrent() != nullptr) { _state = STATE_FOLLOWING_PATH; initLine(BasePoint(_posX, _posY), *_path->getCurrent()); } else { @@ -896,7 +896,7 @@ void AdActor::getNextStep() { if (_pFCount == 0) { - if (_path->getNext() == NULL) { + if (_path->getNext() == nullptr) { _posX = _targetPoint->x; _posY = _targetPoint->y; @@ -1040,17 +1040,17 @@ bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, if (scumm_stricmp(_anims[i]->getName(), animName) == 0) { // invalidate sprites in use if (_anims[i]->containsSprite(_tempSprite2)) { - _tempSprite2 = NULL; + _tempSprite2 = nullptr; } if (_anims[i]->containsSprite(_currentSprite)) { - _currentSprite = NULL; + _currentSprite = nullptr; } if (_anims[i]->containsSprite(_animSprite2)) { - _animSprite2 = NULL; + _animSprite2 = nullptr; } delete _anims[i]; - _anims[i] = NULL; + _anims[i] = nullptr; _anims.remove_at(i); i--; found = true; @@ -1066,7 +1066,7 @@ bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, else if (strcmp(name, "HasAnim") == 0) { stack->correctParams(1); const char *animName = stack->pop()->getString(); - stack->pushBool(getAnimByName(animName) != NULL); + stack->pushBool(getAnimByName(animName) != nullptr); return STATUS_OK; } else { return AdTalkHolder::scCallMethod(script, stack, thisStack, name); @@ -1231,7 +1231,7 @@ BaseSprite *AdActor::getTalkStance(const char *stance) { if (DID_FAIL(res)) { _gameRef->LOG(res, "AdActor::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", getName(), _forcedTalkAnimName); delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; } else { return _animSprite; } @@ -1244,7 +1244,7 @@ BaseSprite *AdActor::getTalkStance(const char *stance) { } // new way - BaseSprite *ret = NULL; + BaseSprite *ret = nullptr; // do we have an animation with this name? AdSpriteSet *anim = getAnimByName(stance); @@ -1280,9 +1280,9 @@ BaseSprite *AdActor::getTalkStance(const char *stance) { ////////////////////////////////////////////////////////////////////////// BaseSprite *AdActor::getTalkStanceOld(const char *stance) { - BaseSprite *ret = NULL; + BaseSprite *ret = nullptr; - if (stance != NULL) { + if (stance != nullptr) { // search special stances for (uint32 i = 0; i < _talkSpritesEx.size(); i++) { if (scumm_stricmp(_talkSpritesEx[i]->getName(), stance) == 0) { @@ -1290,7 +1290,7 @@ BaseSprite *AdActor::getTalkStanceOld(const char *stance) { break; } } - if (ret == NULL) { + if (ret == nullptr) { // search generic stances for (uint32 i = 0; i < _talkSprites.size(); i++) { if (scumm_stricmp(_talkSprites[i]->getName(), stance) == 0) { @@ -1302,7 +1302,7 @@ BaseSprite *AdActor::getTalkStanceOld(const char *stance) { } // not a valid stance? get a random one - if (ret == NULL) { + if (ret == nullptr) { if (_talkSprites.size() < 1) { ret = _standSprite->getSprite(_dir); } else { @@ -1378,7 +1378,7 @@ TDirection AdActor::angleToDirection(int angle) { ////////////////////////////////////////////////////////////////////////// int AdActor::getHeight() { // if no current sprite is set, set some - if (_currentSprite == NULL) { + if (_currentSprite == nullptr) { if (_standSprite) { _currentSprite = _standSprite->getSprite(_dir); } else { @@ -1400,7 +1400,7 @@ AdSpriteSet *AdActor::getAnimByName(const Common::String &animName) { return _anims[i]; } } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -1411,7 +1411,7 @@ bool AdActor::mergeAnims(const char *animsFilename) { byte *fileBuffer = BaseFileManager::getEngineInstance()->readWholeFile(animsFilename); - if (fileBuffer == NULL) { + if (fileBuffer == nullptr) { _gameRef->LOG(0, "AdActor::MergeAnims failed for file '%s'", animsFilename); return STATUS_FAILED; } diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h index 543c9d063a..bcec9db319 100644 --- a/engines/wintermute/ad/ad_actor.h +++ b/engines/wintermute/ad/ad_actor.h @@ -54,7 +54,7 @@ public: virtual bool update(); virtual bool display(); virtual void turnTo(TDirection dir); - AdActor(BaseGame *inGame/*=NULL*/); + AdActor(BaseGame *inGame/*=nullptr*/); virtual ~AdActor(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index 2c331de964..259b68f291 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -61,13 +61,13 @@ IMPLEMENT_PERSISTENT(AdEntity, false) AdEntity::AdEntity(BaseGame *inGame) : AdTalkHolder(inGame) { _type = OBJECT_ENTITY; _subtype = ENTITY_NORMAL; - _region = NULL; - _item = NULL; + _region = nullptr; + _item = nullptr; _walkToX = _walkToY = 0; _walkToDir = DI_NONE; - _theora = NULL; + _theora = nullptr; } @@ -76,10 +76,10 @@ AdEntity::~AdEntity() { _gameRef->unregisterObject(_region); delete _theora; - _theora = NULL; + _theora = nullptr; delete[] _item; - _item = NULL; + _item = nullptr; } int32 AdEntity::getWalkToX() const { @@ -101,7 +101,7 @@ const char *AdEntity::getItemName() const { ////////////////////////////////////////////////////////////////////////// bool AdEntity::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdEntity::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -225,7 +225,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) { } AdGame *adGame = (AdGame *)_gameRef; - BaseSprite *spr = NULL; + BaseSprite *spr = nullptr; int ar = 0, ag = 0, ab = 0, alpha = 0; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -245,7 +245,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_SPRITE: { delete _sprite; - _sprite = NULL; + _sprite = nullptr; spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile((char *)params))) { cmd = PARSERR_GENERIC; @@ -335,7 +335,7 @@ bool AdEntity::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; @@ -348,7 +348,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) { if (_region) { _gameRef->unregisterObject(_region); } - _region = NULL; + _region = nullptr; BaseRegion *rgn = new BaseRegion(_gameRef); if (!rgn || DID_FAIL(rgn->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; @@ -361,16 +361,16 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_BLOCKED_REGION: { delete _blockRegion; - _blockRegion = NULL; + _blockRegion = nullptr; delete _currentBlockRegion; - _currentBlockRegion = NULL; + _currentBlockRegion = nullptr; BaseRegion *rgn = new BaseRegion(_gameRef); BaseRegion *crgn = new BaseRegion(_gameRef); if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) { delete _blockRegion; - _blockRegion = NULL; + _blockRegion = nullptr; delete _currentBlockRegion; - _currentBlockRegion = NULL; + _currentBlockRegion = nullptr; cmd = PARSERR_GENERIC; } else { _blockRegion = rgn; @@ -382,16 +382,16 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_WAYPOINTS: { delete _wptGroup; - _wptGroup = NULL; + _wptGroup = nullptr; delete _currentWptGroup; - _currentWptGroup = NULL; + _currentWptGroup = nullptr; AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef); AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef); if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) { delete _wptGroup; - _wptGroup = NULL; + _wptGroup = nullptr; delete _currentWptGroup; - _currentWptGroup = NULL; + _currentWptGroup = nullptr; cmd = PARSERR_GENERIC; } else { _wptGroup = wpt; @@ -408,7 +408,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_SUBTYPE: { if (scumm_stricmp((char *)params, "sound") == 0) { delete _sprite; - _sprite = NULL; + _sprite = nullptr; if (_gameRef->_editorMode) { spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile("entity_sound.sprite"))) { @@ -565,7 +565,7 @@ bool AdEntity::display() { } else if (_currentSprite) { _currentSprite->display(_posX, _posY, - (reg || _editorAlwaysRegister) ? _registerAlias : NULL, + (reg || _editorAlwaysRegister) ? _registerAlias : nullptr, scaleX, scaleY, alpha, @@ -585,15 +585,15 @@ bool AdEntity::display() { ////////////////////////////////////////////////////////////////////////// bool AdEntity::update() { - _currentSprite = NULL; + _currentSprite = nullptr; if (_state == STATE_READY && _animSprite) { delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; } // finished playing animation? - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) { + if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->isFinished()) { _state = STATE_READY; _currentSprite = _animSprite; } @@ -628,10 +628,10 @@ bool AdEntity::update() { } bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime); - if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { + if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { if (timeIsUp) { _sentence->finish(); - _tempSprite2 = NULL; + _tempSprite2 = nullptr; _state = STATE_READY; } else { _tempSprite2 = getTalkStance(_sentence->getNextStance()); @@ -673,7 +673,7 @@ bool AdEntity::update() { if (_theora->isFinished()) { _theora->stop(); delete _theora; - _theora = NULL; + _theora = nullptr; } } @@ -737,7 +737,7 @@ bool AdEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack if (_theora) { _theora->stop(); delete _theora; - _theora = NULL; + _theora = nullptr; stack->pushBool(true); } else { stack->pushBool(false); @@ -830,7 +830,7 @@ bool AdEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->correctParams(0); if (_region) { _gameRef->unregisterObject(_region); - _region = NULL; + _region = nullptr; stack->pushBool(true); } else { stack->pushBool(false); @@ -1071,7 +1071,7 @@ int AdEntity::getHeight() { if (_region && !_sprite) { return _region->_rect.bottom - _region->_rect.top; } else { - if (_currentSprite == NULL) { + if (_currentSprite == nullptr) { _currentSprite = _sprite; } return AdObject::getHeight(); @@ -1117,15 +1117,15 @@ void AdEntity::setItem(const char *itemName) { ////////////////////////////////////////////////////////////////////////// bool AdEntity::setSprite(const char *filename) { if (_currentSprite == _sprite) { - _currentSprite = NULL; + _currentSprite = nullptr; } delete _sprite; - _sprite = NULL; + _sprite = nullptr; BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { delete _sprite; - _sprite = NULL; + _sprite = nullptr; return STATUS_FAILED; } else { _sprite = spr; diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index 1fd776e386..b9775ba7d1 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -69,22 +69,22 @@ IMPLEMENT_PERSISTENT(AdGame, true) ////////////////////////////////////////////////////////////////////////// AdGame::AdGame(const Common::String &gameId) : BaseGame(gameId) { - _responseBox = NULL; - _inventoryBox = NULL; + _responseBox = nullptr; + _inventoryBox = nullptr; _scene = new AdScene(_gameRef); _scene->setName(""); registerObject(_scene); - _prevSceneName = NULL; - _prevSceneFilename = NULL; - _scheduledScene = NULL; + _prevSceneName = nullptr; + _prevSceneFilename = nullptr; + _scheduledScene = nullptr; _scheduledFadeIn = false; _stateEx = GAME_NORMAL; - _selectedItem = NULL; + _selectedItem = nullptr; _texItemLifeTime = 10000; @@ -94,17 +94,17 @@ AdGame::AdGame(const Common::String &gameId) : BaseGame(gameId) { _talkSkipButton = TALK_SKIP_LEFT; - _sceneViewport = NULL; + _sceneViewport = nullptr; _initialScene = true; - _debugStartupScene = NULL; - _startupScene = NULL; + _debugStartupScene = nullptr; + _startupScene = nullptr; _invObject = new AdObject(this); _inventoryOwner = _invObject; _tempDisableSaveState = false; - _itemsFile = NULL; + _itemsFile = nullptr; _smartItemCursor = false; @@ -122,7 +122,7 @@ AdGame::~AdGame() { bool AdGame::cleanup() { for (uint32 i = 0; i < _objects.size(); i++) { unregisterObject(_objects[i]); - _objects[i] = NULL; + _objects[i] = nullptr; } _objects.clear(); @@ -139,7 +139,7 @@ bool AdGame::cleanup() { unregisterObject(_scene); - _scene = NULL; + _scene = nullptr; // remove items for (uint32 i = 0; i < _items.size(); i++) { @@ -150,7 +150,7 @@ bool AdGame::cleanup() { // clear remaining inventories delete _invObject; - _invObject = NULL; + _invObject = nullptr; for (uint32 i = 0; i < _inventories.size(); i++) { delete _inventories[i]; @@ -160,12 +160,12 @@ bool AdGame::cleanup() { if (_responseBox) { _gameRef->unregisterObject(_responseBox); - _responseBox = NULL; + _responseBox = nullptr; } if (_inventoryBox) { _gameRef->unregisterObject(_inventoryBox); - _inventoryBox = NULL; + _inventoryBox = nullptr; } delete[] _prevSceneName; @@ -173,15 +173,15 @@ bool AdGame::cleanup() { delete[] _scheduledScene; delete[] _debugStartupScene; delete[] _itemsFile; - _prevSceneName = NULL; - _prevSceneFilename = NULL; - _scheduledScene = NULL; - _debugStartupScene = NULL; - _startupScene = NULL; - _itemsFile = NULL; + _prevSceneName = nullptr; + _prevSceneFilename = nullptr; + _scheduledScene = nullptr; + _debugStartupScene = nullptr; + _startupScene = nullptr; + _itemsFile = nullptr; delete _sceneViewport; - _sceneViewport = NULL; + _sceneViewport = nullptr; for (uint32 i = 0; i < _sceneStates.size(); i++) { delete _sceneStates[i]; @@ -207,9 +207,9 @@ bool AdGame::initLoop() { if (_scheduledScene && _transMgr->isReady()) { changeScene(_scheduledScene, _scheduledFadeIn); delete[] _scheduledScene; - _scheduledScene = NULL; + _scheduledScene = nullptr; - _gameRef->_activeObject = NULL; + _gameRef->_activeObject = nullptr; } @@ -258,7 +258,7 @@ bool AdGame::removeObject(AdObject *object) { ////////////////////////////////////////////////////////////////////////// bool AdGame::changeScene(const char *filename, bool fadeIn) { - if (_scene == NULL) { + if (_scene == nullptr) { _scene = new AdScene(_gameRef); registerObject(_scene); } else { @@ -297,7 +297,7 @@ bool AdGame::changeScene(const char *filename, bool fadeIn) { // invalidate references to the original scene for (uint32 i = 0; i < _objects.size(); i++) { _objects[i]->invalidateCurrRegions(); - _objects[i]->_stickRegion = NULL; + _objects[i]->_stickRegion = nullptr; } _scene->loadState(); @@ -385,7 +385,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->pushNative(act, true); } else { delete act; - act = NULL; + act = nullptr; stack->pushNULL(); } return STATUS_OK; @@ -402,7 +402,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->pushNative(ent, true); } else { delete ent; - ent = NULL; + ent = nullptr; stack->pushNULL(); } return STATUS_OK; @@ -463,7 +463,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->correctParams(1); ScValue *val = stack->pop(); - AdItem *item = NULL; + AdItem *item = nullptr; if (val->isNative()) { item = (AdItem *)val->getNative(); } else { @@ -485,7 +485,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->correctParams(1); ScValue *val = stack->pop(); - AdItem *item = NULL; + AdItem *item = nullptr; if (val->isInt()) { int index = val->getInt(); if (index >= 0 && index < (int32)_items.size()) { @@ -639,7 +639,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, branchName = val->getString(); } - startDlgBranch(branchName.c_str(), script->_filename == NULL ? "" : script->_filename, script->_threadEvent == NULL ? "" : script->_threadEvent); + startDlgBranch(branchName.c_str(), script->_filename == nullptr ? "" : script->_filename, script->_threadEvent == nullptr ? "" : script->_threadEvent); stack->pushNULL(); return STATUS_OK; @@ -651,12 +651,12 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, else if (strcmp(name, "EndDlgBranch") == 0) { stack->correctParams(1); - const char *branchName = NULL; + const char *branchName = nullptr; ScValue *val = stack->pop(); if (!val->isNULL()) { branchName = val->getString(); } - endDlgBranch(branchName, script->_filename == NULL ? "" : script->_filename, script->_threadEvent == NULL ? "" : script->_threadEvent); + endDlgBranch(branchName, script->_filename == nullptr ? "" : script->_filename, script->_threadEvent == nullptr ? "" : script->_threadEvent); stack->pushNULL(); @@ -777,7 +777,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->pushBool(true); } else { delete _responseBox; - _responseBox = NULL; + _responseBox = nullptr; stack->pushBool(false); } return STATUS_OK; @@ -797,7 +797,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->pushBool(true); } else { delete _inventoryBox; - _inventoryBox = NULL; + _inventoryBox = nullptr; stack->pushBool(false); } return STATUS_OK; @@ -1036,7 +1036,7 @@ ScValue *AdGame::scGetProperty(const Common::String &name) { // ChangingScene ////////////////////////////////////////////////////////////////////////// else if (name == "ChangingScene") { - _scValue->setBool(_scheduledScene != NULL); + _scValue->setBool(_scheduledScene != nullptr); return _scValue; } @@ -1066,10 +1066,10 @@ bool AdGame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "SelectedItem") == 0) { if (value->isNULL()) { - _selectedItem = NULL; + _selectedItem = nullptr; } else { if (value->isNative()) { - _selectedItem = NULL; + _selectedItem = nullptr; for (uint32 i = 0; i < _items.size(); i++) { if (_items[i] == value->getNative()) { _selectedItem = (AdItem *)value->getNative(); @@ -1158,9 +1158,9 @@ bool AdGame::scSetProperty(const char *name, ScValue *value) { // StartupScene ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "StartupScene") == 0) { - if (value == NULL) { + if (value == nullptr) { delete[] _startupScene; - _startupScene = NULL; + _startupScene = nullptr; } else { BaseUtils::setString(&_startupScene, value->getString()); } @@ -1242,7 +1242,7 @@ bool AdGame::showCursor() { ////////////////////////////////////////////////////////////////////////// bool AdGame::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdGame::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -1316,7 +1316,7 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) { registerObject(_responseBox); } else { delete _responseBox; - _responseBox = NULL; + _responseBox = nullptr; cmd = PARSERR_GENERIC; } break; @@ -1328,7 +1328,7 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) { registerObject(_inventoryBox); } else { delete _inventoryBox; - _inventoryBox = NULL; + _inventoryBox = nullptr; cmd = PARSERR_GENERIC; } break; @@ -1338,7 +1338,7 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) { BaseUtils::setString(&_itemsFile, (char *)params2); if (DID_FAIL(loadItemsFile(_itemsFile))) { delete[] _itemsFile; - _itemsFile = NULL; + _itemsFile = nullptr; cmd = PARSERR_GENERIC; } break; @@ -1456,7 +1456,7 @@ bool AdGame::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// void AdGame::setPrevSceneName(const char *name) { delete[] _prevSceneName; - _prevSceneName = NULL; + _prevSceneName = nullptr; if (name) { _prevSceneName = new char[strlen(name) + 1]; if (_prevSceneName) { @@ -1469,7 +1469,7 @@ void AdGame::setPrevSceneName(const char *name) { ////////////////////////////////////////////////////////////////////////// void AdGame::setPrevSceneFilename(const char *name) { delete[] _prevSceneFilename; - _prevSceneFilename = NULL; + _prevSceneFilename = nullptr; if (name) { _prevSceneFilename = new char[strlen(name) + 1]; if (_prevSceneFilename) { @@ -1482,7 +1482,7 @@ void AdGame::setPrevSceneFilename(const char *name) { ////////////////////////////////////////////////////////////////////////// bool AdGame::scheduleChangeScene(const char *filename, bool fadeIn) { delete[] _scheduledScene; - _scheduledScene = NULL; + _scheduledScene = nullptr; if (_scene && !_scene->_initialized) { return changeScene(filename, fadeIn); @@ -1515,7 +1515,7 @@ bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *ex ////////////////////////////////////////////////////////////////////////// bool AdGame::loadItemsFile(const char *filename, bool merge) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdGame::LoadItemsFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -1567,7 +1567,7 @@ bool AdGame::loadItemsBuffer(byte *buffer, bool merge) { addItem(item); } else { delete item; - item = NULL; + item = nullptr; cmd = PARSERR_GENERIC; } } @@ -1615,7 +1615,7 @@ AdSceneState *AdGame::getSceneState(const char *filename, bool saving) { return ret; } else { delete[] filenameCor; - return NULL; + return nullptr; } } @@ -1635,7 +1635,7 @@ bool AdGame::windowLoadHook(UIWindow *win, char **buffer, char **params) { UIEntity *ent = new UIEntity(_gameRef); if (!ent || DID_FAIL(ent->loadBuffer((byte *)*params, false))) { delete ent; - ent = NULL; + ent = nullptr; cmd = PARSERR_GENERIC; } else { ent->_parent = win; @@ -1689,12 +1689,12 @@ bool AdGame::startDlgBranch(const char *branchName, const char *scriptName, cons ////////////////////////////////////////////////////////////////////////// bool AdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { - char *name = NULL; + char *name = nullptr; bool deleteName = false; - if (branchName == NULL && _dlgPendingBranches.size() > 0) { + if (branchName == nullptr && _dlgPendingBranches.size() > 0) { name = _dlgPendingBranches[_dlgPendingBranches.size() - 1]; } else { - if (branchName != NULL) { + if (branchName != nullptr) { name = new char[strlen(branchName) + 1 + strlen(scriptName) + 1 + strlen(eventName) + 1]; if (name) { sprintf(name, "%s.%s.%s", branchName, scriptName, eventName); @@ -1703,7 +1703,7 @@ bool AdGame::endDlgBranch(const char *branchName, const char *scriptName, const } } - if (name == NULL) { + if (name == nullptr) { return STATUS_OK; } @@ -1719,7 +1719,7 @@ bool AdGame::endDlgBranch(const char *branchName, const char *scriptName, const for (uint32 i = startIndex; i < _dlgPendingBranches.size(); i++) { //ClearBranchResponses(_dlgPendingBranches[i]); delete[] _dlgPendingBranches[i]; - _dlgPendingBranches[i] = NULL; + _dlgPendingBranches[i] = nullptr; } _dlgPendingBranches.remove_at(startIndex, _dlgPendingBranches.size() - startIndex); } @@ -1760,7 +1760,7 @@ bool AdGame::addBranchResponse(int id) { } AdResponseContext *r = new AdResponseContext(_gameRef); r->_id = id; - r->setContext(_dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL); + r->setContext(_dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr); _responsesBranch.add(r); return STATUS_OK; } @@ -1768,10 +1768,10 @@ bool AdGame::addBranchResponse(int id) { ////////////////////////////////////////////////////////////////////////// bool AdGame::branchResponseUsed(int id) { - char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL; + char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr; for (uint32 i = 0; i < _responsesBranch.size(); i++) { if (_responsesBranch[i]->_id == id) { - if ((context == NULL && _responsesBranch[i]->_context == NULL) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) { + if ((context == nullptr && _responsesBranch[i]->_context == nullptr) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) { return true; } } @@ -1787,7 +1787,7 @@ bool AdGame::addGameResponse(int id) { } AdResponseContext *r = new AdResponseContext(_gameRef); r->_id = id; - r->setContext(_dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL); + r->setContext(_dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr); _responsesGame.add(r); return STATUS_OK; } @@ -1795,11 +1795,11 @@ bool AdGame::addGameResponse(int id) { ////////////////////////////////////////////////////////////////////////// bool AdGame::gameResponseUsed(int id) { - char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL; + char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr; for (uint32 i = 0; i < _responsesGame.size(); i++) { AdResponseContext *respContext = _responsesGame[i]; if (respContext->_id == id) { - if ((context == NULL && respContext->_context == NULL) || ((context != NULL && respContext->_context != NULL) && scumm_stricmp(context, respContext->_context) == 0)) { + if ((context == nullptr && respContext->_context == nullptr) || ((context != nullptr && respContext->_context != nullptr) && scumm_stricmp(context, respContext->_context) == 0)) { return true; } } @@ -1810,11 +1810,11 @@ bool AdGame::gameResponseUsed(int id) { ////////////////////////////////////////////////////////////////////////// bool AdGame::resetResponse(int id) { - char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : NULL; + char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr; for (uint32 i = 0; i < _responsesGame.size(); i++) { if (_responsesGame[i]->_id == id) { - if ((context == NULL && _responsesGame[i]->_context == NULL) || scumm_stricmp(context, _responsesGame[i]->_context) == 0) { + if ((context == nullptr && _responsesGame[i]->_context == nullptr) || scumm_stricmp(context, _responsesGame[i]->_context) == 0) { delete _responsesGame[i]; _responsesGame.remove_at(i); break; @@ -1824,7 +1824,7 @@ bool AdGame::resetResponse(int id) { for (uint32 i = 0; i < _responsesBranch.size(); i++) { if (_responsesBranch[i]->_id == id) { - if ((context == NULL && _responsesBranch[i]->_context == NULL) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) { + if ((context == nullptr && _responsesBranch[i]->_context == nullptr) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) { delete _responsesBranch[i]; _responsesBranch.remove_at(i); break; @@ -1863,7 +1863,7 @@ bool AdGame::displayContent(bool doUpdate, bool displayAll) { } if (_theoraPlayer->isFinished()) { delete _theoraPlayer; - _theoraPlayer = NULL; + _theoraPlayer = nullptr; } } else { @@ -1912,7 +1912,7 @@ bool AdGame::displayContent(bool doUpdate, bool displayAll) { _loadingIcon->display(_loadingIconX, _loadingIconY); if (!_loadingIconPersistent) { delete _loadingIcon; - _loadingIcon = NULL; + _loadingIcon = nullptr; } } @@ -1965,7 +1965,7 @@ AdItem *AdGame::getItemByName(const char *name) { return _items[i]; } } - return NULL; + return nullptr; } @@ -2026,7 +2026,7 @@ bool AdGame::deleteItem(AdItem *item) { } if (_selectedItem == item) { - _selectedItem = NULL; + _selectedItem = nullptr; } _scene->handleItemAssociations(item->getName(), false); @@ -2115,7 +2115,7 @@ char *AdGame::findSpeechFile(char *stringID) { } } delete[] ret; - return NULL; + return nullptr; } @@ -2145,14 +2145,14 @@ bool AdGame::onMouseLeftDown() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("LeftClick"); } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) { _scene->applyEvent("LeftClick"); } } - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _gameRef->_capturedObject = _gameRef->_activeObject; } _mouseLeftDown = true; @@ -2168,12 +2168,12 @@ bool AdGame::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"); } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) { _scene->applyEvent("LeftRelease"); @@ -2198,7 +2198,7 @@ bool AdGame::onMouseLeftDblClick() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftDoubleClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("LeftDoubleClick"); } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) { _scene->applyEvent("LeftDoubleClick"); @@ -2229,7 +2229,7 @@ bool AdGame::onMouseRightDown() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("RightClick"); } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) { _scene->applyEvent("RightClick"); @@ -2246,7 +2246,7 @@ bool AdGame::onMouseRightUp() { bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease")); if (!handled) { - if (_activeObject != NULL) { + if (_activeObject != nullptr) { _activeObject->applyEvent("RightRelease"); } else if (_state == GAME_RUNNING && _scene && _scene->pointInViewport(_mousePos.x, _mousePos.y)) { _scene->applyEvent("RightRelease"); @@ -2272,7 +2272,7 @@ bool AdGame::displayDebugInfo() { ////////////////////////////////////////////////////////////////////////// bool AdGame::onScriptShutdown(ScScript *script) { if (_responseBox && _responseBox->_waitingScript == script) { - _responseBox->_waitingScript = NULL; + _responseBox->_waitingScript = nullptr; } return STATUS_OK; diff --git a/engines/wintermute/ad/ad_inventory.cpp b/engines/wintermute/ad/ad_inventory.cpp index 72f8fa0fb4..e9b6e56f16 100644 --- a/engines/wintermute/ad/ad_inventory.cpp +++ b/engines/wintermute/ad/ad_inventory.cpp @@ -50,12 +50,12 @@ AdInventory::~AdInventory() { ////////////////////////////////////////////////////////////////////////// bool AdInventory::insertItem(const char *name, const char *insertAfter) { - if (name == NULL) { + if (name == nullptr) { return STATUS_FAILED; } AdItem *item = ((AdGame *)_gameRef)->getItemByName(name); - if (item == NULL) { + if (item == nullptr) { return STATUS_FAILED; } @@ -84,14 +84,14 @@ bool AdInventory::insertItem(const char *name, const char *insertAfter) { ////////////////////////////////////////////////////////////////////////// bool AdInventory::removeItem(const char *name) { - if (name == NULL) { + if (name == nullptr) { return STATUS_FAILED; } for (uint32 i = 0; i < _takenItems.size(); i++) { if (scumm_stricmp(_takenItems[i]->getName(), name) == 0) { if (((AdGame *)_gameRef)->_selectedItem == _takenItems[i]) { - ((AdGame *)_gameRef)->_selectedItem = NULL; + ((AdGame *)_gameRef)->_selectedItem = nullptr; } _takenItems.remove_at(i); return STATUS_OK; @@ -105,14 +105,14 @@ bool AdInventory::removeItem(const char *name) { ////////////////////////////////////////////////////////////////////////// bool AdInventory::removeItem(AdItem *item) { - if (item == NULL) { + if (item == nullptr) { return STATUS_FAILED; } for (uint32 i = 0; i < _takenItems.size(); i++) { if (_takenItems[i] == item) { if (((AdGame *)_gameRef)->_selectedItem == _takenItems[i]) { - ((AdGame *)_gameRef)->_selectedItem = NULL; + ((AdGame *)_gameRef)->_selectedItem = nullptr; } _takenItems.remove_at(i); return STATUS_OK; diff --git a/engines/wintermute/ad/ad_inventory.h b/engines/wintermute/ad/ad_inventory.h index 4017d914bc..f226a65612 100644 --- a/engines/wintermute/ad/ad_inventory.h +++ b/engines/wintermute/ad/ad_inventory.h @@ -40,7 +40,7 @@ public: DECLARE_PERSISTENT(AdInventory, BaseObject) bool removeItem(const char *name); bool removeItem(AdItem *Item); - bool insertItem(const char *name, const char *insertAfter = NULL); + bool insertItem(const char *name, const char *insertAfter = nullptr); AdInventory(BaseGame *inGame); virtual ~AdInventory(); BaseArray _takenItems; diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index 7ae8ff8d69..194d975155 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -54,8 +54,8 @@ AdInventoryBox::AdInventoryBox(BaseGame *inGame) : BaseObject(inGame) { _itemWidth = _itemHeight = 50; _scrollBy = 1; - _window = NULL; - _closeButton = NULL; + _window = nullptr; + _closeButton = nullptr; _hideSelected = false; @@ -67,10 +67,10 @@ AdInventoryBox::AdInventoryBox(BaseGame *inGame) : BaseObject(inGame) { ////////////////////////////////////////////////////////////////////////// AdInventoryBox::~AdInventoryBox() { _gameRef->unregisterObject(_window); - _window = NULL; + _window = nullptr; delete _closeButton; - _closeButton = NULL; + _closeButton = nullptr; } @@ -166,7 +166,7 @@ bool AdInventoryBox::display() { ////////////////////////////////////////////////////////////////////////// bool AdInventoryBox::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdInventoryBox::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -256,7 +256,7 @@ bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) { _window = new UIWindow(_gameRef); if (!_window || DID_FAIL(_window->loadBuffer(params, false))) { delete _window; - _window = NULL; + _window = nullptr; cmd = PARSERR_GENERIC; } else { _gameRef->registerObject(_window); diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp index 427b1c7db4..1bd7692820 100644 --- a/engines/wintermute/ad/ad_item.cpp +++ b/engines/wintermute/ad/ad_item.cpp @@ -49,8 +49,8 @@ IMPLEMENT_PERSISTENT(AdItem, false) ////////////////////////////////////////////////////////////////////////// AdItem::AdItem(BaseGame *inGame) : AdTalkHolder(inGame) { - _spriteHover = NULL; - _cursorNormal = _cursorHover = NULL; + _spriteHover = nullptr; + _cursorNormal = _cursorHover = nullptr; _cursorCombined = true; _inInventory = false; @@ -60,7 +60,7 @@ AdItem::AdItem(BaseGame *inGame) : AdTalkHolder(inGame) { _amountOffsetX = 0; _amountOffsetY = 0; _amountAlign = TAL_RIGHT; - _amountString = NULL; + _amountString = nullptr; _state = STATE_READY; @@ -73,19 +73,19 @@ AdItem::~AdItem() { delete _spriteHover; delete _cursorNormal; delete _cursorHover; - _spriteHover = NULL; - _cursorNormal = NULL; - _cursorHover = NULL; + _spriteHover = nullptr; + _cursorNormal = nullptr; + _cursorHover = nullptr; delete[] _amountString; - _amountString = NULL; + _amountString = nullptr; } ////////////////////////////////////////////////////////////////////////// bool AdItem::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdItem::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -272,7 +272,7 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) { _cursorNormal = new BaseSprite(_gameRef); if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) { delete _cursorNormal; - _cursorNormal = NULL; + _cursorNormal = nullptr; cmd = PARSERR_GENERIC; } break; @@ -282,7 +282,7 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) { _cursorHover = new BaseSprite(_gameRef); if (!_cursorHover || DID_FAIL(_cursorHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) { delete _cursorHover; - _cursorHover = NULL; + _cursorHover = nullptr; cmd = PARSERR_GENERIC; } break; @@ -332,15 +332,15 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// bool AdItem::update() { - _currentSprite = NULL; + _currentSprite = nullptr; if (_state == STATE_READY && _animSprite) { delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; } // finished playing animation? - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) { + if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->isFinished()) { _state = STATE_READY; _currentSprite = _animSprite; } @@ -379,10 +379,10 @@ bool AdItem::update() { } bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime); - if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { + if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { if (timeIsUp) { _sentence->finish(); - _tempSprite2 = NULL; + _tempSprite2 = nullptr; _state = STATE_READY; } else { _tempSprite2 = getTalkStance(_sentence->getNextStance()); @@ -469,7 +469,7 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *filename = stack->pop()->getString(); delete _spriteHover; - _spriteHover = NULL; + _spriteHover = nullptr; BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); @@ -520,7 +520,7 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *filename = stack->pop()->getString(); delete _cursorNormal; - _cursorNormal = NULL; + _cursorNormal = nullptr; BaseSprite *spr = new BaseSprite(_gameRef); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); @@ -569,7 +569,7 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *filename = stack->pop()->getString(); delete _cursorHover; - _cursorHover = NULL; + _cursorHover = nullptr; BaseSprite *spr = new BaseSprite(_gameRef); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); @@ -753,7 +753,7 @@ bool AdItem::scSetProperty(const char *name, ScValue *value) { else if (strcmp(name, "AmountString") == 0) { if (value->isNULL()) { delete[] _amountString; - _amountString = NULL; + _amountString = nullptr; } else { BaseUtils::setString(&_amountString, value->getString()); } diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp index 209c12b7a2..7bf79e4ae5 100644 --- a/engines/wintermute/ad/ad_layer.cpp +++ b/engines/wintermute/ad/ad_layer.cpp @@ -63,7 +63,7 @@ AdLayer::~AdLayer() { ////////////////////////////////////////////////////////////////////////// bool AdLayer::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdLayer::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -174,8 +174,8 @@ bool AdLayer::loadBuffer(byte *buffer, bool complete) { cmd = PARSERR_GENERIC; delete region; delete node; - region = NULL; - node = NULL; + region = nullptr; + node = nullptr; } else { node->setRegion(region); _nodes.add(node); @@ -193,8 +193,8 @@ bool AdLayer::loadBuffer(byte *buffer, bool complete) { cmd = PARSERR_GENERIC; delete entity; delete node; - entity = NULL; - node = NULL; + entity = nullptr; + node = nullptr; } else { node->setEntity(entity); _nodes.add(node); @@ -339,7 +339,7 @@ bool AdLayer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->correctParams(1); ScValue *val = stack->pop(); - AdSceneNode *toDelete = NULL; + AdSceneNode *toDelete = nullptr; if (val->isNative()) { BaseScriptable *temp = val->getNative(); for (uint32 i = 0; i < _nodes.size(); i++) { @@ -354,7 +354,7 @@ bool AdLayer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, toDelete = _nodes[index]; } } - if (toDelete == NULL) { + if (toDelete == nullptr) { stack->pushBool(false); return STATUS_OK; } @@ -362,7 +362,7 @@ bool AdLayer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, for (uint32 i = 0; i < _nodes.size(); i++) { if (_nodes[i] == toDelete) { delete _nodes[i]; - _nodes[i] = NULL; + _nodes[i] = nullptr; _nodes.remove_at(i); break; } diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp index 493156c750..34e220569f 100644 --- a/engines/wintermute/ad/ad_node_state.cpp +++ b/engines/wintermute/ad/ad_node_state.cpp @@ -42,14 +42,14 @@ IMPLEMENT_PERSISTENT(AdNodeState, false) ////////////////////////////////////////////////////////////////////////// AdNodeState::AdNodeState(BaseGame *inGame) : BaseClass(inGame) { - _name = NULL; + _name = nullptr; _active = false; for (int i = 0; i < 7; i++) { - _caption[i] = NULL; + _caption[i] = nullptr; } _alphaColor = 0; - _filename = NULL; - _cursor = NULL; + _filename = nullptr; + _cursor = nullptr; } @@ -58,12 +58,12 @@ AdNodeState::~AdNodeState() { delete[] _name; delete[] _filename; delete[] _cursor; - _name = NULL; - _filename = NULL; - _cursor = NULL; + _name = nullptr; + _filename = nullptr; + _cursor = nullptr; for (int i = 0; i < 7; i++) { delete[] _caption[i]; - _caption[i] = NULL; + _caption[i] = nullptr; } } @@ -71,7 +71,7 @@ AdNodeState::~AdNodeState() { ////////////////////////////////////////////////////////////////////////// void AdNodeState::setName(const char *name) { delete[] _name; - _name = NULL; + _name = nullptr; BaseUtils::setString(&_name, name); } @@ -79,7 +79,7 @@ void AdNodeState::setName(const char *name) { ////////////////////////////////////////////////////////////////////////// void AdNodeState::setFilename(const char *filename) { delete[] _filename; - _filename = NULL; + _filename = nullptr; BaseUtils::setString(&_filename, filename); } @@ -87,7 +87,7 @@ void AdNodeState::setFilename(const char *filename) { ////////////////////////////////////////////////////////////////////////// void AdNodeState::setCursor(const char *filename) { delete[] _cursor; - _cursor = NULL; + _cursor = nullptr; BaseUtils::setString(&_cursor, filename); } @@ -132,7 +132,7 @@ const char *AdNodeState::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]; diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index fc107b62c6..2dddc6f5fc 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_object.cpp @@ -65,27 +65,27 @@ AdObject::AdObject(BaseGame *inGame) : BaseObject(inGame) { _active = true; _drawn = false; - _currentSprite = NULL; - _animSprite = NULL; - _tempSprite2 = NULL; + _currentSprite = nullptr; + _animSprite = nullptr; + _tempSprite2 = nullptr; - _font = NULL; + _font = nullptr; - _sentence = NULL; + _sentence = nullptr; - _forcedTalkAnimName = NULL; + _forcedTalkAnimName = nullptr; _forcedTalkAnimUsed = false; - _blockRegion = NULL; - _wptGroup = NULL; + _blockRegion = nullptr; + _wptGroup = nullptr; - _currentBlockRegion = NULL; - _currentWptGroup = NULL; + _currentBlockRegion = nullptr; + _currentWptGroup = nullptr; _ignoreItems = false; _sceneIndependent = false; - _stickRegion = NULL; + _stickRegion = nullptr; _subtitlesModRelative = true; _subtitlesModX = 0; @@ -93,13 +93,13 @@ AdObject::AdObject(BaseGame *inGame) : BaseObject(inGame) { _subtitlesWidth = 0; _subtitlesModXCenter = true; - _inventory = NULL; + _inventory = nullptr; for (int i = 0; i < MAX_NUM_REGIONS; i++) { - _currentRegions[i] = NULL; + _currentRegions[i] = nullptr; } - _partEmitter = NULL; + _partEmitter = nullptr; _partFollowParent = false; _partOffsetX = _partOffsetY = 0; @@ -109,26 +109,26 @@ AdObject::AdObject(BaseGame *inGame) : BaseObject(inGame) { ////////////////////////////////////////////////////////////////////////// AdObject::~AdObject() { - _currentSprite = NULL; // reference only, don't delete + _currentSprite = nullptr; // reference only, don't delete delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; delete _sentence; - _sentence = NULL; + _sentence = nullptr; delete[] _forcedTalkAnimName; - _forcedTalkAnimName = NULL; + _forcedTalkAnimName = nullptr; delete _blockRegion; - _blockRegion = NULL; + _blockRegion = nullptr; delete _wptGroup; - _wptGroup = NULL; + _wptGroup = nullptr; delete _currentBlockRegion; - _currentBlockRegion = NULL; + _currentBlockRegion = nullptr; delete _currentWptGroup; - _currentWptGroup = NULL; + _currentWptGroup = nullptr; - _tempSprite2 = NULL; // reference only - _stickRegion = NULL; + _tempSprite2 = nullptr; // reference only + _stickRegion = nullptr; if (_font) { _gameRef->_fontStorage->removeFont(_font); @@ -136,7 +136,7 @@ AdObject::~AdObject() { if (_inventory) { ((AdGame *)_gameRef)->unregisterInventory(_inventory); - _inventory = NULL; + _inventory = nullptr; } if (_partEmitter) { @@ -159,7 +159,7 @@ AdObject::~AdObject() { ////////////////////////////////////////////////////////////////////////// bool AdObject::playAnim(const char *filename) { delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; _animSprite = new BaseSprite(_gameRef, this); if (!_animSprite) { _gameRef->LOG(0, "AdObject::PlayAnim: error creating temp sprite (object:\"%s\" sprite:\"%s\")", getName(), filename); @@ -169,7 +169,7 @@ bool AdObject::playAnim(const char *filename) { if (DID_FAIL(res)) { _gameRef->LOG(res, "AdObject::PlayAnim: error loading temp sprite (object:\"%s\" sprite:\"%s\")", getName(), filename); delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; return res; } _state = STATE_PLAYING_ANIM; @@ -274,7 +274,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack int duration = stack->pop()->getInt(); ScValue *valStances = stack->pop(); - const char *stances = valStances->isNULL() ? NULL : valStances->getString(); + const char *stances = valStances->isNULL() ? nullptr : valStances->getString(); int align = 0; ScValue *val = stack->pop(); @@ -286,7 +286,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack align = MIN(MAX(0, align), NUM_TEXT_ALIGN - 1); - const char *sound = soundVal->isNULL() ? NULL : soundVal->getString(); + const char *sound = soundVal->isNULL() ? nullptr : soundVal->getString(); talk(text, sound, duration, stances, (TTextAlign)align); if (strcmp(name, "TalkAsync") != 0) { @@ -309,7 +309,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack uint32 i; ScValue *val = stack->pop(); if (val->isNULL() || !main) { - _stickRegion = NULL; + _stickRegion = nullptr; regFound = true; } else if (val->isString()) { const char *regionName = val->getString(); @@ -334,7 +334,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack } if (!regFound) { - _stickRegion = NULL; + _stickRegion = nullptr; } stack->pushBool(regFound); return STATUS_OK; @@ -385,7 +385,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack if (!val->isNULL()) { const char *itemName = val->getString(); val = stack->pop(); - const char *insertAfter = val->isNULL() ? NULL : val->getString(); + const char *insertAfter = val->isNULL() ? nullptr : val->getString(); if (DID_FAIL(_inventory->insertItem(itemName, insertAfter))) { script->runtimeError("Cannot add item '%s' to inventory", itemName); } else { @@ -512,7 +512,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->correctParams(0); if (_partEmitter) { _gameRef->unregisterObject(_partEmitter); - _partEmitter = NULL; + _partEmitter = nullptr; } stack->pushNULL(); @@ -533,7 +533,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack AdEntity *ent = new AdEntity(_gameRef); if (DID_FAIL(res = ent->loadFile(filename))) { delete ent; - ent = NULL; + ent = nullptr; script->runtimeError("AddAttachment() failed loading entity '%s'", filename); stack->pushBool(false); } else { @@ -611,7 +611,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->correctParams(1); ScValue *val = stack->pop(); - AdObject *ret = NULL; + AdObject *ret = nullptr; if (val->isInt()) { int index = val->getInt(); int currIndex = 0; @@ -645,7 +645,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack } } - if (ret != NULL) { + if (ret != nullptr) { stack->pushNative(ret, true); } else { stack->pushNULL(); @@ -851,9 +851,9 @@ bool AdObject::setFont(const char *filename) { } if (filename) { _font = _gameRef->_fontStorage->addFont(filename); - return _font == NULL ? STATUS_FAILED : STATUS_OK; + return _font == nullptr ? STATUS_FAILED : STATUS_OK; } else { - _font = NULL; + _font = nullptr; return STATUS_OK; } } @@ -893,12 +893,12 @@ void AdObject::talk(const char *text, const char *sound, uint32 duration, const if (_forcedTalkAnimName && _forcedTalkAnimUsed) { delete[] _forcedTalkAnimName; - _forcedTalkAnimName = NULL; + _forcedTalkAnimName = nullptr; _forcedTalkAnimUsed = false; } delete(_sentence->_sound); - _sentence->_sound = NULL; + _sentence->_sound = nullptr; _sentence->setText(text); _gameRef->_stringTable->expand(&_sentence->_text); @@ -907,7 +907,7 @@ void AdObject::talk(const char *text, const char *sound, uint32 duration, const _sentence->_align = Align; _sentence->_startTime = _gameRef->_timer; _sentence->_currentStance = -1; - _sentence->_font = _font == NULL ? _gameRef->_systemFont : _font; + _sentence->_font = _font == nullptr ? _gameRef->_systemFont : _font; _sentence->_freezable = _freezable; // try to locate speech file automatically @@ -1012,9 +1012,9 @@ void AdObject::talk(const char *text, const char *sound, uint32 duration, const ////////////////////////////////////////////////////////////////////////// bool AdObject::reset() { - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL) { + if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr) { delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; } else if (_state == STATE_TALKING && _sentence) { _sentence->finish(); } @@ -1157,7 +1157,7 @@ bool AdObject::afterMove() { bool regFound = false; for (int j = 0; j < MAX_NUM_REGIONS; j++) { if (_currentRegions[j] == newRegions[i]) { - _currentRegions[j] = NULL; + _currentRegions[j] = nullptr; regFound = true; break; } @@ -1180,7 +1180,7 @@ bool AdObject::afterMove() { ////////////////////////////////////////////////////////////////////////// bool AdObject::invalidateCurrRegions() { for (int i = 0; i < MAX_NUM_REGIONS; i++) { - _currentRegions[i] = NULL; + _currentRegions[i] = nullptr; } return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h index 2a437c7e09..39480e3446 100644 --- a/engines/wintermute/ad/ad_object.h +++ b/engines/wintermute/ad/ad_object.h @@ -60,7 +60,7 @@ public: virtual bool updateSounds(); bool reset(); DECLARE_PERSISTENT(AdObject, BaseObject) - virtual void talk(const char *text, const char *sound = NULL, uint32 duration = 0, const char *stances = NULL, TTextAlign align = TAL_CENTER); + virtual void talk(const char *text, const char *sound = nullptr, uint32 duration = 0, const char *stances = nullptr, TTextAlign align = TAL_CENTER); virtual int getHeight(); bool setFont(const char *filename); diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp index c931213456..afdd29828c 100644 --- a/engines/wintermute/ad/ad_path.cpp +++ b/engines/wintermute/ad/ad_path.cpp @@ -64,7 +64,7 @@ BasePoint *AdPath::getFirst() { _currIndex = 0; return _points[_currIndex]; } else { - return NULL; + return nullptr; } } @@ -75,7 +75,7 @@ BasePoint *AdPath::getNext() { if (_currIndex < (int32)_points.size()) { return _points[_currIndex]; } else { - return NULL; + return nullptr; } } @@ -85,7 +85,7 @@ BasePoint *AdPath::getCurrent() { if (_currIndex >= 0 && _currIndex < (int32)_points.size()) { return _points[_currIndex]; } else { - return NULL; + return nullptr; } } diff --git a/engines/wintermute/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp index a36648eb69..f3ccd264b1 100644 --- a/engines/wintermute/ad/ad_path_point.cpp +++ b/engines/wintermute/ad/ad_path_point.cpp @@ -39,7 +39,7 @@ AdPathPoint::AdPathPoint() { _distance = 0; _marked = false; - _origin = NULL; + _origin = nullptr; } @@ -50,13 +50,13 @@ AdPathPoint::AdPathPoint(int initX, int initY, int initDistance) { _distance = initDistance; _marked = false; - _origin = NULL; + _origin = nullptr; } ////////////////////////////////////////////////////////////////////////// AdPathPoint::~AdPathPoint() { - _origin = NULL; + _origin = nullptr; } diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index daf0c89606..acd5f13397 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -70,7 +70,7 @@ bool AdRegion::hasDecoration() const { ////////////////////////////////////////////////////////////////////////// bool AdRegion::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdRegion::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index a2225f2632..e4993b9ad4 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.cpp @@ -38,10 +38,10 @@ IMPLEMENT_PERSISTENT(AdResponse, false) ////////////////////////////////////////////////////////////////////////// AdResponse::AdResponse(BaseGame *inGame) : BaseObject(inGame) { - _text = NULL; - _textOrig = NULL; - _icon = _iconHover = _iconPressed = NULL; - _font = NULL; + _text = nullptr; + _textOrig = nullptr; + _icon = _iconHover = _iconPressed = nullptr; + _font = nullptr; _iD = 0; _responseType = RESPONSE_ALWAYS; } @@ -54,11 +54,11 @@ AdResponse::~AdResponse() { delete _icon; delete _iconHover; delete _iconPressed; - _text = NULL; - _textOrig = NULL; - _icon = NULL; - _iconHover = NULL; - _iconPressed = NULL; + _text = nullptr; + _textOrig = nullptr; + _icon = nullptr; + _iconHover = nullptr; + _iconPressed = nullptr; if (_font) { _gameRef->_fontStorage->removeFont(_font); } @@ -79,7 +79,7 @@ bool AdResponse::setIcon(const char *filename) { if (!_icon || DID_FAIL(_icon->loadFile(filename))) { _gameRef->LOG(0, "AdResponse::setIcon failed for file '%s'", filename); delete _icon; - _icon = NULL; + _icon = nullptr; return STATUS_FAILED; } return STATUS_OK; @@ -105,7 +105,7 @@ bool AdResponse::setIconHover(const char *filename) { if (!_iconHover || DID_FAIL(_iconHover->loadFile(filename))) { _gameRef->LOG(0, "AdResponse::setIconHover failed for file '%s'", filename); delete _iconHover; - _iconHover = NULL; + _iconHover = nullptr; return STATUS_FAILED; } return STATUS_OK; @@ -119,7 +119,7 @@ bool AdResponse::setIconPressed(const char *filename) { if (!_iconPressed || DID_FAIL(_iconPressed->loadFile(filename))) { _gameRef->LOG(0, "AdResponse::setIconPressed failed for file '%s'", filename); delete _iconPressed; - _iconPressed = NULL; + _iconPressed = nullptr; return STATUS_FAILED; } return STATUS_OK; diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index 45fd33d222..c889f56c22 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -52,9 +52,9 @@ IMPLEMENT_PERSISTENT(AdResponseBox, false) ////////////////////////////////////////////////////////////////////////// AdResponseBox::AdResponseBox(BaseGame *inGame) : BaseObject(inGame) { - _font = _fontHover = NULL; + _font = _fontHover = nullptr; - _window = NULL; + _window = nullptr; _shieldWindow = new UIWindow(_gameRef); _horizontal = false; @@ -62,9 +62,9 @@ AdResponseBox::AdResponseBox(BaseGame *inGame) : BaseObject(inGame) { _scrollOffset = 0; _spacing = 0; - _waitingScript = NULL; - _lastResponseText = NULL; - _lastResponseTextOrig = NULL; + _waitingScript = nullptr; + _lastResponseText = nullptr; + _lastResponseTextOrig = nullptr; _verticalAlign = VAL_BOTTOM; _align = TAL_LEFT; @@ -75,13 +75,13 @@ AdResponseBox::AdResponseBox(BaseGame *inGame) : BaseObject(inGame) { AdResponseBox::~AdResponseBox() { delete _window; - _window = NULL; + _window = nullptr; delete _shieldWindow; - _shieldWindow = NULL; + _shieldWindow = nullptr; delete[] _lastResponseText; - _lastResponseText = NULL; + _lastResponseText = nullptr; delete[] _lastResponseTextOrig; - _lastResponseTextOrig = NULL; + _lastResponseTextOrig = nullptr; if (_font) { _gameRef->_fontStorage->removeFont(_font); @@ -93,7 +93,7 @@ AdResponseBox::~AdResponseBox() { clearResponses(); clearButtons(); - _waitingScript = NULL; + _waitingScript = nullptr; } uint32 AdResponseBox::getNumResponses() const { @@ -121,11 +121,11 @@ void AdResponseBox::clearButtons() { ////////////////////////////////////////////////////////////////////////// bool AdResponseBox::invalidateButtons() { for (uint32 i = 0; i < _respButtons.size(); i++) { - _respButtons[i]->_image = NULL; - _respButtons[i]->_cursor = NULL; - _respButtons[i]->_font = NULL; - _respButtons[i]->_fontHover = NULL; - _respButtons[i]->_fontPress = NULL; + _respButtons[i]->_image = nullptr; + _respButtons[i]->_cursor = nullptr; + _respButtons[i]->_font = nullptr; + _respButtons[i]->_fontHover = nullptr; + _respButtons[i]->_fontPress = nullptr; _respButtons[i]->setText(""); } return STATUS_OK; @@ -163,8 +163,8 @@ bool AdResponseBox::createButtons() { // textual else { btn->setText(_responses[i]->_text); - btn->_font = (_font == NULL) ? _gameRef->_systemFont : _font; - btn->_fontHover = (_fontHover == NULL) ? _gameRef->_systemFont : _fontHover; + btn->_font = (_font == nullptr) ? _gameRef->_systemFont : _font; + btn->_fontHover = (_fontHover == nullptr) ? _gameRef->_systemFont : _fontHover; btn->_fontPress = btn->_fontHover; btn->_align = _align; @@ -210,7 +210,7 @@ bool AdResponseBox::createButtons() { ////////////////////////////////////////////////////////////////////////// bool AdResponseBox::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdResponseBox::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -287,7 +287,7 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) { _window = new UIWindow(_gameRef); if (!_window || DID_FAIL(_window->loadBuffer(params, false))) { delete _window; - _window = NULL; + _window = nullptr; cmd = PARSERR_GENERIC; } else if (_shieldWindow) { _shieldWindow->_parent = _window; @@ -355,7 +355,7 @@ bool AdResponseBox::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; @@ -551,7 +551,7 @@ bool AdResponseBox::listen(BaseScriptHolder *param1, uint32 param2) { _waitingScript->_stack->pushInt(_responses[param2]->_iD); } handleResponse(_responses[param2]); - _waitingScript = NULL; + _waitingScript = nullptr; _gameRef->_state = GAME_RUNNING; ((AdGame *)_gameRef)->_stateEx = GAME_NORMAL; _ready = true; @@ -683,9 +683,9 @@ BaseObject *AdResponseBox::getNextAccessObject(BaseObject *currObject) { getObjects(objects, true); if (objects.size() == 0) { - return NULL; + return nullptr; } else { - if (currObject != NULL) { + if (currObject != nullptr) { for (uint32 i = 0; i < objects.size(); i++) { if (objects[i] == currObject) { if (i < objects.size() - 1) { @@ -698,7 +698,7 @@ BaseObject *AdResponseBox::getNextAccessObject(BaseObject *currObject) { } return objects[0]; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -707,9 +707,9 @@ BaseObject *AdResponseBox::getPrevAccessObject(BaseObject *currObject) { getObjects(objects, true); if (objects.size() == 0) { - return NULL; + return nullptr; } else { - if (currObject != NULL) { + if (currObject != nullptr) { for (int i = objects.size() - 1; i >= 0; i--) { if (objects[i] == currObject) { if (i > 0) { @@ -722,7 +722,7 @@ BaseObject *AdResponseBox::getPrevAccessObject(BaseObject *currObject) { } return objects[objects.size() - 1]; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/ad/ad_response_context.cpp b/engines/wintermute/ad/ad_response_context.cpp index ebfa03feea..d87651c178 100644 --- a/engines/wintermute/ad/ad_response_context.cpp +++ b/engines/wintermute/ad/ad_response_context.cpp @@ -36,14 +36,14 @@ IMPLEMENT_PERSISTENT(AdResponseContext, false) ////////////////////////////////////////////////////////////////////////// AdResponseContext::AdResponseContext(BaseGame *inGame) : BaseClass(inGame) { _id = 0; - _context = NULL; + _context = nullptr; } ////////////////////////////////////////////////////////////////////////// AdResponseContext::~AdResponseContext() { delete[] _context; - _context = NULL; + _context = nullptr; } @@ -59,7 +59,7 @@ bool AdResponseContext::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// void AdResponseContext::setContext(const char *context) { delete[] _context; - _context = NULL; + _context = nullptr; if (context) { _context = new char [strlen(context) + 1]; if (_context) { diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index fb9a4a47b9..4d7f27aec7 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.cpp @@ -54,7 +54,7 @@ AdRotLevel::~AdRotLevel() { ////////////////////////////////////////////////////////////////////////// bool AdRotLevel::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdRotLevel::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index cfec8d7cb9..e80f38bd0f 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.cpp @@ -55,7 +55,7 @@ float AdScaleLevel::getScale() const { ////////////////////////////////////////////////////////////////////////// bool AdScaleLevel::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdScaleLevel::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index ccdaaf36b8..f0e26e7e37 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -77,7 +77,7 @@ AdScene::~AdScene() { cleanup(); _gameRef->unregisterObject(_fader); delete _pfTarget; - _pfTarget = NULL; + _pfTarget = nullptr; } @@ -85,9 +85,9 @@ AdScene::~AdScene() { void AdScene::setDefaults() { _initialized = false; _pfReady = true; - _pfTargetPath = NULL; - _pfRequester = NULL; - _mainLayer = NULL; + _pfTargetPath = nullptr; + _pfRequester = nullptr; + _mainLayer = nullptr; _pfPointsNum = 0; _persistentState = false; @@ -127,12 +127,12 @@ void AdScene::setDefaults() { _editorShowEntities = true; _editorShowScale = true; - _shieldWindow = NULL; + _shieldWindow = nullptr; _fader = new BaseFader(_gameRef); _gameRef->registerObject(_fader); - _viewport = NULL; + _viewport = nullptr; } @@ -140,13 +140,13 @@ void AdScene::setDefaults() { void AdScene::cleanup() { BaseObject::cleanup(); - _mainLayer = NULL; // reference only + _mainLayer = nullptr; // reference only delete _shieldWindow; - _shieldWindow = NULL; + _shieldWindow = nullptr; _gameRef->unregisterObject(_fader); - _fader = NULL; + _fader = nullptr; for (uint32 i = 0; i < _layers.size(); i++) { _gameRef->unregisterObject(_layers[i]); @@ -182,7 +182,7 @@ void AdScene::cleanup() { _objects.clear(); delete _viewport; - _viewport = NULL; + _viewport = nullptr; setDefaults(); } @@ -473,7 +473,7 @@ void AdScene::pathFinderStep() { int i; // get lowest unmarked int lowestDist = INT_MAX; - AdPathPoint *lowestPt = NULL; + AdPathPoint *lowestPt = nullptr; for (i = 0; i < _pfPointsNum; i++) if (!_pfPath[i]->_marked && _pfPath[i]->_distance < lowestDist) { @@ -481,7 +481,7 @@ void AdScene::pathFinderStep() { lowestPt = _pfPath[i]; } - if (lowestPt == NULL) { // no path -> terminate PathFinder + if (lowestPt == nullptr) { // no path -> terminate PathFinder _pfReady = true; _pfTargetPath->setReady(true); return; @@ -491,7 +491,7 @@ void AdScene::pathFinderStep() { // target point marked, generate path and terminate if (lowestPt->x == _pfTarget->x && lowestPt->y == _pfTarget->y) { - while (lowestPt != NULL) { + while (lowestPt != nullptr) { _pfTargetPath->_points.insert_at(0, new BasePoint(lowestPt->x, lowestPt->y)); lowestPt = lowestPt->_origin; } @@ -539,7 +539,7 @@ bool AdScene::initLoop() { ////////////////////////////////////////////////////////////////////////// bool AdScene::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdScene::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -680,7 +680,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) { if (!layer || DID_FAIL(layer->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete layer; - layer = NULL; + layer = nullptr; } else { _gameRef->registerObject(layer); _layers.add(layer); @@ -698,7 +698,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) { if (!wpt || DID_FAIL(wpt->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete wpt; - wpt = NULL; + wpt = nullptr; } else { _gameRef->registerObject(wpt); _waypointGroups.add(wpt); @@ -711,7 +711,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) { if (!sl || DID_FAIL(sl->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete sl; - sl = NULL; + sl = nullptr; } else { _gameRef->registerObject(sl); _scaleLevels.add(sl); @@ -724,7 +724,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) { if (!rl || DID_FAIL(rl->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete rl; - rl = NULL; + rl = nullptr; } else { _gameRef->registerObject(rl); _rotLevels.add(rl); @@ -737,7 +737,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) { if (!entity || DID_FAIL(entity->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete entity; - entity = NULL; + entity = nullptr; } else { addObject(entity); } @@ -749,7 +749,7 @@ bool AdScene::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; @@ -884,7 +884,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) { return STATUS_FAILED; } - if (_mainLayer == NULL) { + if (_mainLayer == nullptr) { _gameRef->LOG(0, "Warning: scene '%s' has no main layer.", getFilename()); } @@ -923,7 +923,7 @@ bool AdScene::traverseNodes(bool doUpdate) { // *** adjust scroll offset if (doUpdate) { /* - if (_autoScroll && _gameRef->_mainObject != NULL) + if (_autoScroll && _gameRef->_mainObject != nullptr) { ScrollToObject(_gameRef->_mainObject); } @@ -1138,7 +1138,7 @@ bool AdScene::updateFreeObjects() { } - if (_autoScroll && _gameRef->_mainObject != NULL) { + if (_autoScroll && _gameRef->_mainObject != nullptr) { scrollToObject(_gameRef->_mainObject); } @@ -1156,7 +1156,7 @@ bool AdScene::displayRegionContent(AdRegion *region, bool display3DOnly) { // global objects for (uint32 i = 0; i < adGame->_objects.size(); i++) { obj = adGame->_objects[i]; - if (obj->_active && !obj->_drawn && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) { + if (obj->_active && !obj->_drawn && (obj->_stickRegion == region || region == nullptr || (obj->_stickRegion == nullptr && region->pointInRegion(obj->_posX, obj->_posY)))) { objects.push_back(obj); } } @@ -1164,7 +1164,7 @@ bool AdScene::displayRegionContent(AdRegion *region, bool display3DOnly) { // scene objects for (uint32 i = 0; i < _objects.size(); i++) { obj = _objects[i]; - if (obj->_active && !obj->_editorOnly && !obj->_drawn && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) { + if (obj->_active && !obj->_editorOnly && !obj->_drawn && (obj->_stickRegion == region || region == nullptr || (obj->_stickRegion == nullptr && region->pointInRegion(obj->_posX, obj->_posY)))) { objects.push_back(obj); } } @@ -1191,7 +1191,7 @@ bool AdScene::displayRegionContent(AdRegion *region, bool display3DOnly) { // display design only objects if (!display3DOnly) { - if (_gameRef->_editorMode && region == NULL) { + if (_gameRef->_editorMode && region == nullptr) { for (uint32 i = 0; i < _objects.size(); i++) { if (_objects[i]->_active && _objects[i]->_editorOnly) { _objects[i]->display(); @@ -1220,12 +1220,12 @@ bool AdScene::displayRegionContentOld(AdRegion *region) { // display all objects in region sorted by _posY do { - obj = NULL; + obj = nullptr; int minY = INT_MAX; // global objects for (uint32 i = 0; i < adGame->_objects.size(); i++) { - if (adGame->_objects[i]->_active && !adGame->_objects[i]->_drawn && adGame->_objects[i]->_posY < minY && (adGame->_objects[i]->_stickRegion == region || region == NULL || (adGame->_objects[i]->_stickRegion == NULL && region->pointInRegion(adGame->_objects[i]->_posX, adGame->_objects[i]->_posY)))) { + if (adGame->_objects[i]->_active && !adGame->_objects[i]->_drawn && adGame->_objects[i]->_posY < minY && (adGame->_objects[i]->_stickRegion == region || region == nullptr || (adGame->_objects[i]->_stickRegion == nullptr && region->pointInRegion(adGame->_objects[i]->_posX, adGame->_objects[i]->_posY)))) { obj = adGame->_objects[i]; minY = adGame->_objects[i]->_posY; } @@ -1233,14 +1233,14 @@ bool AdScene::displayRegionContentOld(AdRegion *region) { // scene objects for (uint32 i = 0; i < _objects.size(); i++) { - if (_objects[i]->_active && !_objects[i]->_editorOnly && !_objects[i]->_drawn && _objects[i]->_posY < minY && (_objects[i]->_stickRegion == region || region == NULL || (_objects[i]->_stickRegion == NULL && region->pointInRegion(_objects[i]->_posX, _objects[i]->_posY)))) { + if (_objects[i]->_active && !_objects[i]->_editorOnly && !_objects[i]->_drawn && _objects[i]->_posY < minY && (_objects[i]->_stickRegion == region || region == nullptr || (_objects[i]->_stickRegion == nullptr && region->pointInRegion(_objects[i]->_posX, _objects[i]->_posY)))) { obj = _objects[i]; minY = _objects[i]->_posY; } } - if (obj != NULL) { + if (obj != nullptr) { _gameRef->_renderer->setup2D(); if (_gameRef->_editorMode || !obj->_editorOnly) { @@ -1248,11 +1248,11 @@ bool AdScene::displayRegionContentOld(AdRegion *region) { } obj->_drawn = true; } - } while (obj != NULL); + } while (obj != nullptr); // design only objects - if (_gameRef->_editorMode && region == NULL) { + if (_gameRef->_editorMode && region == nullptr) { for (uint32 i = 0; i < _objects.size(); i++) { if (_objects[i]->_active && _objects[i]->_editorOnly) { _objects[i]->display(); @@ -1346,7 +1346,7 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->pushNative(act, true); } else { delete act; - act = NULL; + act = nullptr; stack->pushNULL(); } return STATUS_OK; @@ -1363,7 +1363,7 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->pushNative(ent, true); } else { delete ent; - ent = NULL; + ent = nullptr; stack->pushNULL(); } return STATUS_OK; @@ -1504,7 +1504,7 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->correctParams(1); ScValue *val = stack->pop(); - AdObject *ret = NULL; + AdObject *ret = nullptr; if (val->isInt()) { int index = val->getInt(); if (index >= 0 && index < (int32)_objects.size()) { @@ -1772,7 +1772,7 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, stack->correctParams(1); ScValue *val = stack->pop(); - AdLayer *toDelete = NULL; + AdLayer *toDelete = nullptr; if (val->isNative()) { BaseScriptable *temp = val->getNative(); for (uint32 i = 0; i < _layers.size(); i++) { @@ -1787,7 +1787,7 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, toDelete = _layers[index]; } } - if (toDelete == NULL) { + if (toDelete == nullptr) { stack->pushBool(false); return STATUS_OK; } @@ -2268,8 +2268,8 @@ bool AdScene::sortRotLevels() { ////////////////////////////////////////////////////////////////////////// float AdScene::getScaleAt(int Y) { - AdScaleLevel *prev = NULL; - AdScaleLevel *next = NULL; + AdScaleLevel *prev = nullptr; + AdScaleLevel *next = nullptr; for (uint32 i = 0; i < _scaleLevels.size(); i++) { /* AdScaleLevel *xxx = _scaleLevels[i];*/ @@ -2282,7 +2282,7 @@ float AdScene::getScaleAt(int Y) { } } - if (prev == NULL || next == NULL) { + if (prev == nullptr || next == nullptr) { return 100; } @@ -2514,7 +2514,7 @@ void AdScene::pfPointsAdd(int x, int y, int distance) { _pfPath[_pfPointsNum]->y = y; _pfPath[_pfPointsNum]->_distance = distance; _pfPath[_pfPointsNum]->_marked = false; - _pfPath[_pfPointsNum]->_origin = NULL; + _pfPath[_pfPointsNum]->_origin = nullptr; } _pfPointsNum++; @@ -2617,7 +2617,7 @@ void AdScene::setOffset(int offsetLeft, int offsetTop) { ////////////////////////////////////////////////////////////////////////// BaseObject *AdScene::getNodeByName(const char *name) { - BaseObject *ret = NULL; + BaseObject *ret = nullptr; // dependent objects for (uint32 i = 0; i < _layers.size(); i++) { @@ -2634,7 +2634,7 @@ BaseObject *AdScene::getNodeByName(const char *name) { ret = node->_region; break; default: - ret = NULL; + ret = nullptr; } return ret; } @@ -2655,7 +2655,7 @@ BaseObject *AdScene::getNodeByName(const char *name) { } } - return NULL; + return nullptr; } @@ -2755,8 +2755,8 @@ bool AdScene::persistState(bool saving) { ////////////////////////////////////////////////////////////////////////// float AdScene::getRotationAt(int x, int y) { - AdRotLevel *prev = NULL; - AdRotLevel *next = NULL; + AdRotLevel *prev = nullptr; + AdRotLevel *next = nullptr; for (uint32 i = 0; i < _rotLevels.size(); i++) { /* AdRotLevel *xxx = _rotLevels[i]; @@ -2769,7 +2769,7 @@ float AdScene::getRotationAt(int x, int y) { } } - if (prev == NULL || next == NULL) { + if (prev == nullptr || next == nullptr) { return 0; } @@ -2827,7 +2827,7 @@ bool AdScene::getRegionsAt(int x, int y, AdRegion **regionList, int numRegions) } } for (int i = numUsed; i < numRegions; i++) { - regionList[i] = NULL; + regionList[i] = nullptr; } return STATUS_OK; @@ -2845,9 +2845,9 @@ BaseObject *AdScene::getNextAccessObject(BaseObject *currObject) { getSceneObjects(objects, true); if (objects.size() == 0) { - return NULL; + return nullptr; } else { - if (currObject != NULL) { + if (currObject != nullptr) { for (uint32 i = 0; i < objects.size(); i++) { if (objects[i] == currObject) { if (i < objects.size() - 1) { @@ -2860,7 +2860,7 @@ BaseObject *AdScene::getNextAccessObject(BaseObject *currObject) { } return objects[0]; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -2869,9 +2869,9 @@ BaseObject *AdScene::getPrevAccessObject(BaseObject *currObject) { getSceneObjects(objects, true); if (objects.size() == 0) { - return NULL; + return nullptr; } else { - if (currObject != NULL) { + if (currObject != nullptr) { for (int i = objects.size() - 1; i >= 0; i--) { if (objects[i] == currObject) { if (i > 0) { @@ -2884,7 +2884,7 @@ BaseObject *AdScene::getPrevAccessObject(BaseObject *currObject) { } return objects[objects.size() - 1]; } - return NULL; + return nullptr; } @@ -2962,7 +2962,7 @@ bool AdScene::getRegionObjects(AdRegion *region, BaseArray &objects, // global objects for (uint32 i = 0; i < adGame->_objects.size(); i++) { obj = adGame->_objects[i]; - if (obj->_active && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) { + if (obj->_active && (obj->_stickRegion == region || region == nullptr || (obj->_stickRegion == nullptr && region->pointInRegion(obj->_posX, obj->_posY)))) { if (interactiveOnly && !obj->_registrable) { continue; } @@ -2974,7 +2974,7 @@ bool AdScene::getRegionObjects(AdRegion *region, BaseArray &objects, // scene objects for (uint32 i = 0; i < _objects.size(); i++) { obj = _objects[i]; - if (obj->_active && !obj->_editorOnly && (obj->_stickRegion == region || region == NULL || (obj->_stickRegion == NULL && region->pointInRegion(obj->_posX, obj->_posY)))) { + if (obj->_active && !obj->_editorOnly && (obj->_stickRegion == region || region == nullptr || (obj->_stickRegion == nullptr && region->pointInRegion(obj->_posX, obj->_posY)))) { if (interactiveOnly && !obj->_registrable) { continue; } diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h index 230cb77f5b..9cc8135889 100644 --- a/engines/wintermute/ad/ad_scene.h +++ b/engines/wintermute/ad/ad_scene.h @@ -67,19 +67,19 @@ public: bool pointInViewport(int x, int y); int getOffsetTop(); int getOffsetLeft(); - bool getViewportSize(int *width = NULL, int *height = NULL); - bool getViewportOffset(int *offsetX = NULL, int *offsetY = NULL); + bool getViewportSize(int *width = nullptr, int *height = nullptr); + bool getViewportOffset(int *offsetX = nullptr, int *offsetY = nullptr); BaseViewport *_viewport; BaseFader *_fader; int _pfPointsNum; void pfPointsAdd(int x, int y, int distance); void pfPointsStart(); bool _initialized; - bool correctTargetPoint(int startX, int startY, int *x, int *y, bool checkFreeObjects = false, BaseObject *requester = NULL); + bool correctTargetPoint(int startX, int startY, int *x, int *y, bool checkFreeObjects = false, BaseObject *requester = nullptr); bool correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, BaseObject *requester); DECLARE_PERSISTENT(AdScene, BaseObject) - bool displayRegionContent(AdRegion *region = NULL, bool display3DOnly = false); - bool displayRegionContentOld(AdRegion *region = NULL); + bool displayRegionContent(AdRegion *region = nullptr, bool display3DOnly = false); + bool displayRegionContentOld(AdRegion *region = nullptr); static bool compareObjs(const AdObject *obj1, const AdObject *obj2); bool updateFreeObjects(); @@ -113,11 +113,11 @@ public: uint32 _pfMaxTime; bool initLoop(); void pathFinderStep(); - bool isBlockedAt(int x, int y, bool checkFreeObjects = false, BaseObject *requester = NULL); - bool isWalkableAt(int x, int y, bool checkFreeObjects = false, BaseObject *requester = NULL); + bool isBlockedAt(int x, int y, bool checkFreeObjects = false, BaseObject *requester = nullptr); + bool isWalkableAt(int x, int y, bool checkFreeObjects = false, BaseObject *requester = nullptr); AdLayer *_mainLayer; float getZoomAt(int x, int y); - bool getPath(BasePoint source, BasePoint target, AdPath *path, BaseObject *requester = NULL); + bool getPath(BasePoint source, BasePoint target, AdPath *path, BaseObject *requester = nullptr); AdScene(BaseGame *inGame); virtual ~AdScene(); BaseArray _layers; @@ -153,7 +153,7 @@ public: BaseArray _rotLevels; virtual bool restoreDeviceObjects(); - int getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester = NULL); + int getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester = nullptr); // scripting interface virtual ScValue *scGetProperty(const Common::String &name); @@ -164,7 +164,7 @@ public: private: bool persistState(bool saving = true); - void pfAddWaypointGroup(AdWaypointGroup *Wpt, BaseObject *requester = NULL); + void pfAddWaypointGroup(AdWaypointGroup *Wpt, BaseObject *requester = nullptr); bool _pfReady; BasePoint *_pfTarget; AdPath *_pfTargetPath; diff --git a/engines/wintermute/ad/ad_scene_node.cpp b/engines/wintermute/ad/ad_scene_node.cpp index d0202236fd..f84e9212e5 100644 --- a/engines/wintermute/ad/ad_scene_node.cpp +++ b/engines/wintermute/ad/ad_scene_node.cpp @@ -36,18 +36,18 @@ IMPLEMENT_PERSISTENT(AdSceneNode, false) ////////////////////////////////////////////////////////////////////////// AdSceneNode::AdSceneNode(BaseGame *inGame) : BaseObject(inGame) { _type = OBJECT_NONE; - _region = NULL; - _entity = NULL; + _region = nullptr; + _entity = nullptr; } ////////////////////////////////////////////////////////////////////////// AdSceneNode::~AdSceneNode() { _gameRef->unregisterObject(_region); - _region = NULL; + _region = nullptr; _gameRef->unregisterObject(_entity); - _entity = NULL; + _entity = nullptr; } diff --git a/engines/wintermute/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp index e6dd08a5fe..8e022ab115 100644 --- a/engines/wintermute/ad/ad_scene_state.cpp +++ b/engines/wintermute/ad/ad_scene_state.cpp @@ -38,14 +38,14 @@ IMPLEMENT_PERSISTENT(AdSceneState, false) ////////////////////////////////////////////////////////////////////////// AdSceneState::AdSceneState(BaseGame *inGame) : BaseClass(inGame) { - _filename = NULL; + _filename = nullptr; } ////////////////////////////////////////////////////////////////////////// AdSceneState::~AdSceneState() { delete[] _filename; - _filename = NULL; + _filename = nullptr; for (uint32 i = 0; i < _nodeStates.size(); i++) { delete _nodeStates[i]; @@ -91,7 +91,7 @@ AdNodeState *AdSceneState::getNodeState(const char *name, bool saving) { return ret; } else { - return NULL; + return nullptr; } } diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index cfe4191b07..47b22a1ab3 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.cpp @@ -45,27 +45,27 @@ IMPLEMENT_PERSISTENT(AdSentence, false) ////////////////////////////////////////////////////////////////////////// AdSentence::AdSentence(BaseGame *inGame) : BaseClass(inGame) { - _text = NULL; - _stances = NULL; - _tempStance = NULL; + _text = nullptr; + _stances = nullptr; + _tempStance = nullptr; _duration = 0; _startTime = 0; _currentStance = 0; - _font = NULL; + _font = nullptr; _pos.x = _pos.y = 0; _width = _gameRef->_renderer->_width; _align = (TTextAlign)TAL_CENTER; - _sound = NULL; + _sound = nullptr; _soundStarted = false; - _talkDef = NULL; - _currentSprite = NULL; - _currentSkelAnim = NULL; + _talkDef = nullptr; + _currentSprite = nullptr; + _currentSkelAnim = nullptr; _fixedPos = false; _freezable = true; } @@ -78,15 +78,15 @@ AdSentence::~AdSentence() { delete[] _stances; delete[] _tempStance; delete _talkDef; - _sound = NULL; - _text = NULL; - _stances = NULL; - _tempStance = NULL; - _talkDef = NULL; - - _currentSprite = NULL; // ref only - _currentSkelAnim = NULL; - _font = NULL; // ref only + _sound = nullptr; + _text = nullptr; + _stances = nullptr; + _tempStance = nullptr; + _talkDef = nullptr; + + _currentSprite = nullptr; // ref only + _currentSkelAnim = nullptr; + _font = nullptr; // ref only } @@ -113,7 +113,7 @@ void AdSentence::setStances(const char *stances) { strcpy(_stances, stances); } } else { - _stances = NULL; + _stances = nullptr; } } @@ -133,14 +133,14 @@ char *AdSentence::getNextStance() { ////////////////////////////////////////////////////////////////////////// char *AdSentence::getStance(int stance) { - if (_stances == NULL) { - return NULL; + if (_stances == nullptr) { + return nullptr; } if (_tempStance) { delete[] _tempStance; } - _tempStance = NULL; + _tempStance = nullptr; char *start; char *curr; @@ -150,7 +150,7 @@ char *AdSentence::getStance(int stance) { start = _stances; } else { pos = 0; - start = NULL; + start = nullptr; curr = _stances; while (pos < stance) { if (*curr == '\0') { @@ -166,8 +166,8 @@ char *AdSentence::getStance(int stance) { } } - if (start == NULL) { - return NULL; + if (start == nullptr) { + return nullptr; } while (*start == ' ' && *start != ',' && *start != '\0') { @@ -274,8 +274,8 @@ bool AdSentence::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// bool AdSentence::setupTalkFile(const char *soundFilename) { delete _talkDef; - _talkDef = NULL; - _currentSprite = NULL; + _talkDef = nullptr; + _currentSprite = nullptr; if (!soundFilename) { return STATUS_OK; @@ -294,7 +294,7 @@ bool AdSentence::setupTalkFile(const char *soundFilename) { _talkDef = new AdTalkDef(_gameRef); if (!_talkDef || DID_FAIL(_talkDef->loadFile(talkDefFileName.c_str()))) { delete _talkDef; - _talkDef = NULL; + _talkDef = nullptr; return STATUS_FAILED; } //_gameRef->LOG(0, "Using .talk file: %s", TalkDefFile); @@ -345,7 +345,7 @@ bool AdSentence::update(TDirection dir) { } _currentSprite = newSprite; } else { - _currentSprite = NULL; + _currentSprite = nullptr; } } diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp index 345b483a8f..ffa7bb2530 100644 --- a/engines/wintermute/ad/ad_sprite_set.cpp +++ b/engines/wintermute/ad/ad_sprite_set.cpp @@ -42,7 +42,7 @@ AdSpriteSet::AdSpriteSet(BaseGame *inGame, BaseObject *owner) : BaseObject(inGam _owner = owner; for (int i = 0; i < NUM_DIRECTIONS; i++) { - _sprites[i] = NULL; + _sprites[i] = nullptr; } } @@ -51,17 +51,17 @@ AdSpriteSet::AdSpriteSet(BaseGame *inGame, BaseObject *owner) : BaseObject(inGam AdSpriteSet::~AdSpriteSet() { for (int i = 0; i < NUM_DIRECTIONS; i++) { delete _sprites[i]; - _sprites[i] = NULL; + _sprites[i] = nullptr; } - _owner = NULL; + _owner = nullptr; } ////////////////////////////////////////////////////////////////////////// bool AdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdSpriteSet::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -121,7 +121,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC buffer = params; } - BaseSprite *spr = NULL; + BaseSprite *spr = nullptr; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: @@ -136,7 +136,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_LEFT: delete _sprites[DI_LEFT]; - _sprites[DI_LEFT] = NULL; + _sprites[DI_LEFT] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -147,7 +147,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_RIGHT: delete _sprites[DI_RIGHT]; - _sprites[DI_RIGHT] = NULL; + _sprites[DI_RIGHT] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -158,7 +158,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_UP: delete _sprites[DI_UP]; - _sprites[DI_UP] = NULL; + _sprites[DI_UP] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -169,7 +169,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_DOWN: delete _sprites[DI_DOWN]; - _sprites[DI_DOWN] = NULL; + _sprites[DI_DOWN] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -180,7 +180,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_UP_LEFT: delete _sprites[DI_UPLEFT]; - _sprites[DI_UPLEFT] = NULL; + _sprites[DI_UPLEFT] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -191,7 +191,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_UP_RIGHT: delete _sprites[DI_UPRIGHT]; - _sprites[DI_UPRIGHT] = NULL; + _sprites[DI_UPRIGHT] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -202,7 +202,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_DOWN_LEFT: delete _sprites[DI_DOWNLEFT]; - _sprites[DI_DOWNLEFT] = NULL; + _sprites[DI_DOWNLEFT] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -213,7 +213,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC case TOKEN_DOWN_RIGHT: delete _sprites[DI_DOWNRIGHT]; - _sprites[DI_DOWNRIGHT] = NULL; + _sprites[DI_DOWNRIGHT] = nullptr; spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) { cmd = PARSERR_GENERIC; @@ -268,12 +268,12 @@ BaseSprite *AdSpriteSet::getSprite(TDirection direction) { dir = NUM_DIRECTIONS - 1; } - BaseSprite *ret = NULL; + BaseSprite *ret = nullptr; // find nearest set sprite int numSteps = 0; for (int i = dir; i >= 0; i--) { - if (_sprites[i] != NULL) { + if (_sprites[i] != nullptr) { ret = _sprites[i]; numSteps = dir - i; break; @@ -281,8 +281,8 @@ BaseSprite *AdSpriteSet::getSprite(TDirection direction) { } for (int i = dir; i < NUM_DIRECTIONS; i++) { - if (_sprites[i] != NULL) { - if (ret == NULL || numSteps > i - dir) { + if (_sprites[i] != nullptr) { + if (ret == nullptr || numSteps > i - dir) { return _sprites[i]; } else { return ret; diff --git a/engines/wintermute/ad/ad_sprite_set.h b/engines/wintermute/ad/ad_sprite_set.h index ba5da0ff2e..3960b5dcc7 100644 --- a/engines/wintermute/ad/ad_sprite_set.h +++ b/engines/wintermute/ad/ad_sprite_set.h @@ -41,7 +41,7 @@ public: BaseSprite *getSprite(TDirection direction); DECLARE_PERSISTENT(AdSpriteSet, BaseObject) BaseObject *_owner; - AdSpriteSet(BaseGame *inGame, BaseObject *owner = NULL); + AdSpriteSet(BaseGame *inGame, BaseObject *owner = nullptr); virtual ~AdSpriteSet(); bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp index a85cd7f986..4ad5d2ccc6 100644 --- a/engines/wintermute/ad/ad_talk_def.cpp +++ b/engines/wintermute/ad/ad_talk_def.cpp @@ -42,11 +42,11 @@ IMPLEMENT_PERSISTENT(AdTalkDef, false) ////////////////////////////////////////////////////////////////////////// AdTalkDef::AdTalkDef(BaseGame *inGame) : BaseObject(inGame) { - _defaultSpriteFilename = NULL; - _defaultSprite = NULL; + _defaultSpriteFilename = nullptr; + _defaultSprite = nullptr; - _defaultSpriteSetFilename = NULL; - _defaultSpriteSet = NULL; + _defaultSpriteSetFilename = nullptr; + _defaultSpriteSet = nullptr; } @@ -59,20 +59,20 @@ AdTalkDef::~AdTalkDef() { delete[] _defaultSpriteFilename; delete _defaultSprite; - _defaultSpriteFilename = NULL; - _defaultSprite = NULL; + _defaultSpriteFilename = nullptr; + _defaultSprite = nullptr; delete[] _defaultSpriteSetFilename; delete _defaultSpriteSet; - _defaultSpriteSetFilename = NULL; - _defaultSpriteSet = NULL; + _defaultSpriteSetFilename = nullptr; + _defaultSpriteSet = nullptr; } ////////////////////////////////////////////////////////////////////////// bool AdTalkDef::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdTalkDef::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -138,7 +138,7 @@ bool AdTalkDef::loadBuffer(byte *buffer, bool complete) { _nodes.add(node); } else { delete node; - node = NULL; + node = nullptr; cmd = PARSERR_GENERIC; } } @@ -157,7 +157,7 @@ bool AdTalkDef::loadBuffer(byte *buffer, bool complete) { _defaultSpriteSet = new AdSpriteSet(_gameRef); if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadBuffer(params, false))) { delete _defaultSpriteSet; - _defaultSpriteSet = NULL; + _defaultSpriteSet = nullptr; cmd = PARSERR_GENERIC; } } @@ -181,8 +181,8 @@ bool AdTalkDef::loadBuffer(byte *buffer, bool complete) { delete _defaultSprite; delete _defaultSpriteSet; - _defaultSprite = NULL; - _defaultSpriteSet = NULL; + _defaultSprite = nullptr; + _defaultSpriteSet = nullptr; if (_defaultSpriteFilename) { _defaultSprite = new BaseSprite(_gameRef); @@ -250,7 +250,7 @@ bool AdTalkDef::loadDefaultSprite() { _defaultSprite = new BaseSprite(_gameRef); if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) { delete _defaultSprite; - _defaultSprite = NULL; + _defaultSprite = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -259,7 +259,7 @@ bool AdTalkDef::loadDefaultSprite() { _defaultSpriteSet = new AdSpriteSet(_gameRef); if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) { delete _defaultSpriteSet; - _defaultSpriteSet = NULL; + _defaultSpriteSet = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -278,7 +278,7 @@ BaseSprite *AdTalkDef::getDefaultSprite(TDirection dir) { } else if (_defaultSpriteSet) { return _defaultSpriteSet->getSprite(dir); } else { - return NULL; + return nullptr; } } diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp index 937a4b333d..ed2333a345 100644 --- a/engines/wintermute/ad/ad_talk_holder.cpp +++ b/engines/wintermute/ad/ad_talk_holder.cpp @@ -43,14 +43,14 @@ IMPLEMENT_PERSISTENT(AdTalkHolder, false) ////////////////////////////////////////////////////////////////////////// AdTalkHolder::AdTalkHolder(BaseGame *inGame) : AdObject(inGame) { - _sprite = NULL; + _sprite = nullptr; } ////////////////////////////////////////////////////////////////////////// AdTalkHolder::~AdTalkHolder() { delete _sprite; - _sprite = NULL; + _sprite = nullptr; for (uint32 i = 0; i < _talkSprites.size(); i++) { delete _talkSprites[i]; @@ -65,7 +65,7 @@ AdTalkHolder::~AdTalkHolder() { ////////////////////////////////////////////////////////////////////////// BaseSprite *AdTalkHolder::getTalkStance(const char *stance) { - BaseSprite *ret = NULL; + BaseSprite *ret = nullptr; // forced stance? @@ -78,7 +78,7 @@ BaseSprite *AdTalkHolder::getTalkStance(const char *stance) { if (DID_FAIL(res)) { _gameRef->LOG(res, "AdTalkHolder::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", getName(), _forcedTalkAnimName); delete _animSprite; - _animSprite = NULL; + _animSprite = nullptr; } else { return _animSprite; } @@ -86,7 +86,7 @@ BaseSprite *AdTalkHolder::getTalkStance(const char *stance) { } - if (stance != NULL) { + if (stance != nullptr) { // search special talk stances for (uint32 i = 0; i < _talkSpritesEx.size(); i++) { if (scumm_stricmp(_talkSpritesEx[i]->getName(), stance) == 0) { @@ -94,7 +94,7 @@ BaseSprite *AdTalkHolder::getTalkStance(const char *stance) { break; } } - if (ret == NULL) { + if (ret == nullptr) { // serach generic talk stances for (uint32 i = 0; i < _talkSprites.size(); i++) { if (scumm_stricmp(_talkSprites[i]->getName(), stance) == 0) { @@ -106,7 +106,7 @@ BaseSprite *AdTalkHolder::getTalkStance(const char *stance) { } // not a valid stance? get a random one - if (ret == NULL) { + if (ret == nullptr) { if (_talkSprites.size() < 1) { ret = _sprite; } else { @@ -138,12 +138,12 @@ bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS } delete _sprite; - _sprite = NULL; + _sprite = nullptr; if (val->isNULL()) { - _sprite = NULL; + _sprite = nullptr; if (setCurrent) { - _currentSprite = NULL; + _currentSprite = nullptr; } stack->pushBool(true); } else { diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp index c909ee27ff..2e0985ed99 100644 --- a/engines/wintermute/ad/ad_talk_node.cpp +++ b/engines/wintermute/ad/ad_talk_node.cpp @@ -39,11 +39,11 @@ IMPLEMENT_PERSISTENT(AdTalkNode, false) ////////////////////////////////////////////////////////////////////////// AdTalkNode::AdTalkNode(BaseGame *inGame) : BaseClass(inGame) { - _sprite = NULL; - _spriteFilename = NULL; - _spriteSet = NULL; - _spriteSetFilename = NULL; - _comment = NULL; + _sprite = nullptr; + _spriteFilename = nullptr; + _spriteSet = nullptr; + _spriteSetFilename = nullptr; + _comment = nullptr; _startTime = _endTime = 0; _playToEnd = false; @@ -58,11 +58,11 @@ AdTalkNode::~AdTalkNode() { delete[] _spriteSetFilename; delete _spriteSet; delete _comment; - _spriteFilename = NULL; - _sprite = NULL; - _spriteSetFilename = NULL; - _spriteSet = NULL; - _comment = NULL; + _spriteFilename = nullptr; + _sprite = nullptr; + _spriteSetFilename = nullptr; + _spriteSet = nullptr; + _comment = nullptr; } @@ -123,7 +123,7 @@ bool AdTalkNode::loadBuffer(byte *buffer, bool complete) { _spriteSet = new AdSpriteSet(_gameRef); if (!_spriteSet || DID_FAIL(_spriteSet->loadBuffer(params, false))) { delete _spriteSet; - _spriteSet = NULL; + _spriteSet = nullptr; cmd = PARSERR_GENERIC; } } @@ -240,7 +240,7 @@ bool AdTalkNode::loadSprite() { _sprite = new BaseSprite(_gameRef); if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) { delete _sprite; - _sprite = NULL; + _sprite = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -249,7 +249,7 @@ bool AdTalkNode::loadSprite() { _spriteSet = new AdSpriteSet(_gameRef); if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename))) { delete _spriteSet; - _spriteSet = NULL; + _spriteSet = nullptr; return STATUS_FAILED; } else { return STATUS_OK; @@ -264,9 +264,9 @@ bool AdTalkNode::loadSprite() { bool AdTalkNode::isInTimeInterval(uint32 time, TDirection dir) { if (time >= _startTime) { if (_playToEnd) { - if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->isFinished() == false)) { + if ((_spriteFilename && _sprite == nullptr) || (_sprite && _sprite->isFinished() == false)) { return true; - } else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->isFinished() == false)) { + } else if ((_spriteSetFilename && _spriteSet == nullptr) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->isFinished() == false)) { return true; } else { return false; @@ -288,7 +288,7 @@ BaseSprite *AdTalkNode::getSprite(TDirection dir) { } else if (_spriteSet) { return _spriteSet->getSprite(dir); } else { - return NULL; + return nullptr; } } diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index 81493ce769..96dece34b8 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.cpp @@ -67,7 +67,7 @@ void AdWaypointGroup::cleanup() { ////////////////////////////////////////////////////////////////////////// bool AdWaypointGroup::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "AdWaypointGroup::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } 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 _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 _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(""); _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 _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(_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(_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; } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 0f2279c40e..11aeb26821 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -29,11 +29,11 @@ namespace Wintermute { -byte *TransparentSurface::_lookup = NULL; +byte *TransparentSurface::_lookup = nullptr; void TransparentSurface::destroyLookup() { delete[] _lookup; - _lookup = NULL; + _lookup = nullptr; } TransparentSurface::TransparentSurface() : Surface(), _enableAlphaBlit(true) {} @@ -219,8 +219,8 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p #endif Graphics::Surface *img; - Graphics::Surface *imgScaled = NULL; - byte *savedPixels = NULL; + Graphics::Surface *imgScaled = nullptr; + byte *savedPixels = nullptr; if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = srcImage.scale(width, height); diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 8b00dccbd9..dc079a1fbc 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -98,7 +98,7 @@ struct TransparentSurface : public Graphics::Surface { Common::Rect blit(Graphics::Surface &target, int posX = 0, int posY = 0, int flipping = FLIP_NONE, - Common::Rect *pPartRect = NULL, + Common::Rect *pPartRect = nullptr, uint color = BS_ARGB(255, 255, 255, 255), int width = -1, int height = -1); void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index f13bdd2a3c..362c0da624 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -36,8 +36,8 @@ namespace Wintermute { -BaseGame *BasePlatform::_gameRef = NULL; -WintermuteEngine *BasePlatform::_engineRef = NULL; +BaseGame *BasePlatform::_gameRef = nullptr; +WintermuteEngine *BasePlatform::_engineRef = nullptr; #define CLASS_NAME "GF_FRAME" int BasePlatform::initialize(WintermuteEngine *engineRef, BaseGame *inGame, int argc, char *argv[]) { @@ -47,8 +47,8 @@ int BasePlatform::initialize(WintermuteEngine *engineRef, BaseGame *inGame, int } void BasePlatform::deinit() { - _gameRef = NULL; - _engineRef = NULL; + _gameRef = nullptr; + _engineRef = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -247,7 +247,7 @@ bool BasePlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2 ////////////////////////////////////////////////////////////////////////// bool BasePlatform::copyRect(Rect32 *lprcDst, Rect32 *lprcSrc) { - if (lprcDst == NULL || lprcSrc == NULL) { + if (lprcDst == nullptr || lprcSrc == nullptr) { return false; } diff --git a/engines/wintermute/system/sys_class.cpp b/engines/wintermute/system/sys_class.cpp index 06b36b84de..cda58bbb48 100644 --- a/engines/wintermute/system/sys_class.cpp +++ b/engines/wintermute/system/sys_class.cpp @@ -41,7 +41,7 @@ SystemClass::SystemClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD _build = build; _load = load; - _next = NULL; + _next = nullptr; _savedID = -1; _persistent = persistentClass; _numInst = 0; @@ -119,7 +119,7 @@ void *SystemClass::idToPointer(int savedID) { return (it->_value)->getInstance(); } } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index 7c1911c2bf..3e2b8665ee 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -115,7 +115,7 @@ bool SystemClassRegistry::registerInstance(const char *className, void *instance } SystemInstance *inst = (*mapIt)._value->addInstance(instance, _count++); - return (inst != NULL); + return (inst != nullptr); } ////////////////////////////////////////////////////////////////////////// @@ -152,7 +152,7 @@ bool SystemClassRegistry::unregisterInstance(const char *className, void *instan ////////////////////////////////////////////////////////////////////////// bool SystemClassRegistry::getPointerID(void *pointer, int *classID, int *instanceID) { - if (pointer == NULL) { + if (pointer == nullptr) { return true; } @@ -173,7 +173,7 @@ bool SystemClassRegistry::getPointerID(void *pointer, int *classID, int *instanc void *SystemClassRegistry::idToPointer(int classID, int instanceID) { SavedInstanceMap::iterator it = _savedInstanceMap.find(instanceID); if (it == _savedInstanceMap.end()) { - return NULL; + return nullptr; } else { return (*it)._value->getInstance(); } diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 7967d566f9..2c356b2b7e 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -48,11 +48,11 @@ IMPLEMENT_PERSISTENT(UIButton, false) ////////////////////////////////////////////////////////////////////////// UIButton::UIButton(BaseGame *inGame) : UIObject(inGame) { - _backPress = _backHover = _backDisable = _backFocus = NULL; + _backPress = _backHover = _backDisable = _backFocus = nullptr; - _fontHover = _fontPress = _fontDisable = _fontFocus = NULL; + _fontHover = _fontPress = _fontDisable = _fontFocus = nullptr; - _imageDisable = _imagePress = _imageHover = _imageFocus = NULL; + _imageDisable = _imagePress = _imageHover = _imageFocus = nullptr; _align = TAL_CENTER; @@ -104,7 +104,7 @@ UIButton::~UIButton() { ////////////////////////////////////////////////////////////////////////// bool UIButton::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "UIButton::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -235,7 +235,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; - _back = NULL; + _back = nullptr; cmd = PARSERR_GENERIC; } break; @@ -245,7 +245,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _backHover = new UITiledImage(_gameRef); if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) { delete _backHover; - _backHover = NULL; + _backHover = nullptr; cmd = PARSERR_GENERIC; } break; @@ -255,7 +255,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _backPress = new UITiledImage(_gameRef); if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) { delete _backPress; - _backPress = NULL; + _backPress = nullptr; cmd = PARSERR_GENERIC; } break; @@ -265,7 +265,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _backDisable = new UITiledImage(_gameRef); if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) { delete _backDisable; - _backDisable = NULL; + _backDisable = nullptr; cmd = PARSERR_GENERIC; } break; @@ -275,7 +275,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _backFocus = new UITiledImage(_gameRef); if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) { delete _backFocus; - _backFocus = NULL; + _backFocus = nullptr; cmd = PARSERR_GENERIC; } break; @@ -285,7 +285,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; - _image = NULL; + _image = nullptr; cmd = PARSERR_GENERIC; } break; @@ -295,7 +295,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _imageHover = new BaseSprite(_gameRef); if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) { delete _imageHover; - _imageHover = NULL; + _imageHover = nullptr; cmd = PARSERR_GENERIC; } break; @@ -305,7 +305,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _imagePress = new BaseSprite(_gameRef); if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) { delete _imagePress; - _imagePress = NULL; + _imagePress = nullptr; cmd = PARSERR_GENERIC; } break; @@ -315,7 +315,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _imageDisable = new BaseSprite(_gameRef); if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) { delete _imageDisable; - _imageDisable = NULL; + _imageDisable = nullptr; cmd = PARSERR_GENERIC; } break; @@ -325,7 +325,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) { _imageFocus = new BaseSprite(_gameRef); if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) { delete _imageFocus; - _imageFocus = NULL; + _imageFocus = nullptr; cmd = PARSERR_GENERIC; } break; @@ -416,7 +416,7 @@ bool UIButton::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; @@ -592,7 +592,7 @@ bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) { void UIButton::correctSize() { Rect32 rect; - BaseSprite *img = NULL; + BaseSprite *img = nullptr; if (_image) { img = _image; } else if (_imageDisable) { @@ -650,8 +650,8 @@ bool UIButton::display(int offsetX, int offsetY) { return STATUS_OK; } - UITiledImage *back = NULL; - BaseSprite *image = NULL; + UITiledImage *back = nullptr; + BaseSprite *image = nullptr; BaseFont *font = 0; //RECT rect; @@ -734,9 +734,9 @@ bool UIButton::display(int offsetX, int offsetY) { if (back) { back->display(offsetX + _posX, offsetY + _posY, _width, _height); } - //if (image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), NULL); + //if (image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), nullptr); if (image) { - image->draw(imageX + ((_press || _oneTimePress) && back ? 1 : 0), imageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL); + image->draw(imageX + ((_press || _oneTimePress) && back ? 1 : 0), imageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : nullptr); } if (font && _text) { @@ -745,7 +745,7 @@ bool UIButton::display(int offsetX, int offsetY) { } if (!_pixelPerfect || !_image) { - _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false)); + _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, nullptr, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false)); } // reset unused sprites @@ -800,11 +800,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _gameRef->_fontStorage->removeFont(_fontDisable); } if (val->isNULL()) { - _fontDisable = NULL; + _fontDisable = nullptr; stack->pushBool(true); } else { _fontDisable = _gameRef->_fontStorage->addFont(val->getString()); - stack->pushBool(_fontDisable != NULL); + stack->pushBool(_fontDisable != nullptr); } return STATUS_OK; } @@ -820,11 +820,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _gameRef->_fontStorage->removeFont(_fontHover); } if (val->isNULL()) { - _fontHover = NULL; + _fontHover = nullptr; stack->pushBool(true); } else { _fontHover = _gameRef->_fontStorage->addFont(val->getString()); - stack->pushBool(_fontHover != NULL); + stack->pushBool(_fontHover != nullptr); } return STATUS_OK; } @@ -840,11 +840,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _gameRef->_fontStorage->removeFont(_fontPress); } if (val->isNULL()) { - _fontPress = NULL; + _fontPress = nullptr; stack->pushBool(true); } else { _fontPress = _gameRef->_fontStorage->addFont(val->getString()); - stack->pushBool(_fontPress != NULL); + stack->pushBool(_fontPress != nullptr); } return STATUS_OK; } @@ -860,11 +860,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _gameRef->_fontStorage->removeFont(_fontFocus); } if (val->isNULL()) { - _fontFocus = NULL; + _fontFocus = nullptr; stack->pushBool(true); } else { _fontFocus = _gameRef->_fontStorage->addFont(val->getString()); - stack->pushBool(_fontFocus != NULL); + stack->pushBool(_fontFocus != nullptr); } return STATUS_OK; } @@ -880,7 +880,7 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack const char *filename = stack->pop()->getString(); if (!_imageDisable || DID_FAIL(_imageDisable->loadFile(filename))) { delete _imageDisable; - _imageDisable = NULL; + _imageDisable = nullptr; stack->pushBool(false); } else { stack->pushBool(true); @@ -929,7 +929,7 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack const char *filename = stack->pop()->getString(); if (!_imageHover || DID_FAIL(_imageHover->loadFile(filename))) { delete _imageHover; - _imageHover = NULL; + _imageHover = nullptr; stack->pushBool(false); } else { stack->pushBool(true); @@ -977,7 +977,7 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack const char *filename = stack->pop()->getString(); if (!_imagePress || DID_FAIL(_imagePress->loadFile(filename))) { delete _imagePress; - _imagePress = NULL; + _imagePress = nullptr; stack->pushBool(false); } else { stack->pushBool(true); @@ -1025,7 +1025,7 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack const char *filename = stack->pop()->getString(); if (!_imageFocus || DID_FAIL(_imageFocus->loadFile(filename))) { delete _imageFocus; - _imageFocus = NULL; + _imageFocus = nullptr; stack->pushBool(false); } else { stack->pushBool(true); diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index 93333a2534..fea264976f 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -62,7 +62,7 @@ public: UITiledImage *_backHover; UITiledImage *_backDisable; UITiledImage *_backFocus; - UIButton(BaseGame *inGame = NULL); + UIButton(BaseGame *inGame = nullptr); virtual ~UIButton(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index bad77db748..7728272ccd 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -56,12 +56,12 @@ IMPLEMENT_PERSISTENT(UIEdit, false) UIEdit::UIEdit(BaseGame *inGame) : UIObject(inGame) { _type = UI_EDIT; - _fontSelected = NULL; + _fontSelected = nullptr; _selStart = _selEnd = 10000; _scrollOffset = 0; - _cursorChar = NULL; + _cursorChar = nullptr; setCursorChar("|"); _cursorBlinkRate = 600; @@ -88,14 +88,14 @@ UIEdit::~UIEdit() { } delete[] _cursorChar; - _cursorChar = NULL; + _cursorChar = nullptr; } ////////////////////////////////////////////////////////////////////////// bool UIEdit::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "UIEdit::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -194,7 +194,7 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) { _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; - _back = NULL; + _back = nullptr; cmd = PARSERR_GENERIC; } break; @@ -204,7 +204,7 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) { _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; - _image = NULL; + _image = nullptr; cmd = PARSERR_GENERIC; } break; @@ -263,7 +263,7 @@ bool UIEdit::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; @@ -388,7 +388,7 @@ bool UIEdit::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, _gameRef->_fontStorage->removeFont(_fontSelected); } _fontSelected = _gameRef->_fontStorage->addFont(stack->pop()->getString()); - stack->pushBool(_fontSelected != NULL); + stack->pushBool(_fontSelected != nullptr); return STATUS_OK; } else { diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index 1cb4e0926b..00d442e895 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -43,7 +43,7 @@ IMPLEMENT_PERSISTENT(UIEntity, false) ////////////////////////////////////////////////////////////////////////// UIEntity::UIEntity(BaseGame *inGame) : UIObject(inGame) { _type = UI_CUSTOM; - _entity = NULL; + _entity = nullptr; } @@ -52,14 +52,14 @@ UIEntity::~UIEntity() { if (_entity) { _gameRef->unregisterObject(_entity); } - _entity = NULL; + _entity = nullptr; } ////////////////////////////////////////////////////////////////////////// bool UIEntity::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "UIEntity::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -223,7 +223,7 @@ bool UIEntity::setEntity(const char *filename) { _entity = new AdEntity(_gameRef); if (!_entity || DID_FAIL(_entity->loadFile(filename))) { delete _entity; - _entity = NULL; + _entity = nullptr; return STATUS_FAILED; } else { _entity->_nonIntMouseEvents = true; diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 8e5bae993c..9dea3dadf9 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -43,27 +43,27 @@ IMPLEMENT_PERSISTENT(UIObject, false) ////////////////////////////////////////////////////////////////////////// UIObject::UIObject(BaseGame *inGame) : BaseObject(inGame) { - _back = NULL; - _image = NULL; - _font = NULL; - _text = NULL; + _back = nullptr; + _image = nullptr; + _font = nullptr; + _text = nullptr; _sharedFonts = _sharedImages = false; _width = _height = 0; - _listenerObject = NULL; - _listenerParamObject = NULL; + _listenerObject = nullptr; + _listenerParamObject = nullptr; _listenerParamDWORD = 0; _disable = false; _visible = true; _type = UI_UNKNOWN; - _parent = NULL; + _parent = nullptr; _parentNotify = false; - _focusedWidget = NULL; + _focusedWidget = nullptr; _canFocus = false; _nonIntMouseEvents = true; @@ -91,7 +91,7 @@ UIObject::~UIObject() { delete[] _text; } - _focusedWidget = NULL; // ref only + _focusedWidget = nullptr; // ref only } @@ -168,11 +168,11 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _gameRef->_fontStorage->removeFont(_font); } if (val->isNULL()) { - _font = NULL; + _font = nullptr; stack->pushBool(true); } else { _font = _gameRef->_fontStorage->addFont(val->getString()); - stack->pushBool(_font != NULL); + stack->pushBool(_font != nullptr); } return STATUS_OK; } @@ -187,7 +187,7 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack /* const char *filename = */ val->getString(); delete _image; - _image = NULL; + _image = nullptr; if (val->isNULL()) { stack->pushBool(true); return STATUS_OK; @@ -196,7 +196,7 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile(val->getString()))) { delete _image; - _image = NULL; + _image = nullptr; stack->pushBool(false); } else { stack->pushBool(true); diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index ec2ea33de1..c77acfef41 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -60,7 +60,7 @@ public: bool _visible; UITiledImage *_back; bool _disable; - UIObject(BaseGame *inGame = NULL); + UIObject(BaseGame *inGame = nullptr); virtual ~UIObject(); int _width; int _height; diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 2c10f176c7..5a1bffcdc0 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -76,7 +76,7 @@ bool UIText::display(int offsetX, int offsetY) { _back->display(offsetX + _posX, offsetY + _posY, _width, _height); } if (_image) { - _image->draw(offsetX + _posX, offsetY + _posY, NULL); + _image->draw(offsetX + _posX, offsetY + _posY, nullptr); } if (font && _text) { @@ -104,7 +104,7 @@ bool UIText::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// bool UIText::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "UIText::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -203,7 +203,7 @@ bool UIText::loadBuffer(byte *buffer, bool complete) { _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; - _back = NULL; + _back = nullptr; cmd = PARSERR_GENERIC; } break; @@ -213,7 +213,7 @@ bool UIText::loadBuffer(byte *buffer, bool complete) { _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; - _image = NULL; + _image = nullptr; cmd = PARSERR_GENERIC; } break; @@ -274,7 +274,7 @@ bool UIText::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; diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index da4d113500..11dcdb166d 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -40,7 +40,7 @@ private: public: virtual bool display(int offsetX, int offsetY); DECLARE_PERSISTENT(UIText, UIObject) - UIText(BaseGame *inGame = NULL); + UIText(BaseGame *inGame = nullptr); virtual ~UIText(); TTextAlign _textAlign; TVerticalAlign _verticalAlign; diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index 03fef5ca05..be9f87cf58 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -42,7 +42,7 @@ IMPLEMENT_PERSISTENT(UITiledImage, false) ////////////////////////////////////////////////////////////////////////// UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) { - _image = NULL; + _image = nullptr; BasePlatform::setRectEmpty(&_upLeft); BasePlatform::setRectEmpty(&_upMiddle); @@ -59,7 +59,7 @@ UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) { ////////////////////////////////////////////////////////////////////////// UITiledImage::~UITiledImage() { delete _image; - _image = NULL; + _image = nullptr; } @@ -120,7 +120,7 @@ bool UITiledImage::display(int x, int y, int width, int height) { ////////////////////////////////////////////////////////////////////////// bool UITiledImage::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "UITiledImage::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -205,7 +205,7 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) { _image = new BaseSubFrame(_gameRef); if (!_image || DID_FAIL(_image->setSurface((char *)params))) { delete _image; - _image = NULL; + _image = nullptr; cmd = PARSERR_GENERIC; } break; diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index edea84f346..ded7a285dd 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_image.h @@ -44,7 +44,7 @@ public: virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); bool display(int x, int y, int width, int height); - UITiledImage(BaseGame *inGame = NULL); + UITiledImage(BaseGame *inGame = nullptr); virtual ~UITiledImage(); private: BaseSubFrame *_image; diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index e73bab9859..39bc1bdcfe 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -59,9 +59,9 @@ UIWindow::UIWindow(BaseGame *inGame) : UIObject(inGame) { _titleAlign = TAL_LEFT; _transparent = false; - _backInactive = NULL; - _fontInactive = NULL; - _imageInactive = NULL; + _backInactive = nullptr; + _fontInactive = nullptr; + _imageInactive = nullptr; _type = UI_WINDOW; _canFocus = true; @@ -70,8 +70,8 @@ UIWindow::UIWindow(BaseGame *inGame) : UIObject(inGame) { _dragFrom.x = _dragFrom.y = 0; _mode = WINDOW_NORMAL; - _shieldWindow = NULL; - _shieldButton = NULL; + _shieldWindow = nullptr; + _shieldButton = nullptr; _fadeColor = 0x00000000; _fadeBackground = false; @@ -81,7 +81,7 @@ UIWindow::UIWindow(BaseGame *inGame) : UIObject(inGame) { _inGame = false; _clipContents = false; - _viewport = NULL; + _viewport = nullptr; _pauseMusic = true; } @@ -99,9 +99,9 @@ void UIWindow::cleanup() { delete _shieldWindow; delete _shieldButton; delete _viewport; - _shieldWindow = NULL; - _shieldButton = NULL; - _viewport = NULL; + _shieldWindow = nullptr; + _shieldButton = nullptr; + _viewport = nullptr; delete _backInactive; if (!_sharedFonts && _fontInactive) { @@ -210,7 +210,7 @@ bool UIWindow::display(int offsetX, int offsetY) { back->display(_posX + offsetX, _posY + offsetY, _width, _height); } if (image) { - image->draw(_posX + offsetX, _posY + offsetY, _transparent ? NULL : this); + image->draw(_posX + offsetX, _posY + offsetY, _transparent ? nullptr : this); } if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) { @@ -240,7 +240,7 @@ bool UIWindow::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// bool UIWindow::loadFile(const char *filename) { byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); - if (buffer == NULL) { + if (buffer == nullptr) { _gameRef->LOG(0, "UIWindow::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -374,7 +374,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; - _back = NULL; + _back = nullptr; cmd = PARSERR_GENERIC; } break; @@ -384,7 +384,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { _backInactive = new UITiledImage(_gameRef); if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) { delete _backInactive; - _backInactive = NULL; + _backInactive = nullptr; cmd = PARSERR_GENERIC; } break; @@ -394,7 +394,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; - _image = NULL; + _image = nullptr; cmd = PARSERR_GENERIC; } break; @@ -404,7 +404,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { _imageInactive = new BaseSprite(_gameRef); if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) { delete _imageInactive; - _imageInactive = NULL; + _imageInactive = nullptr; cmd = PARSERR_GENERIC; } break; @@ -473,7 +473,7 @@ bool UIWindow::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; @@ -482,7 +482,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { UIButton *btn = new UIButton(_gameRef); if (!btn || DID_FAIL(btn->loadBuffer(params, false))) { delete btn; - btn = NULL; + btn = nullptr; cmd = PARSERR_GENERIC; } else { btn->_parent = this; @@ -495,7 +495,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { UIText *text = new UIText(_gameRef); if (!text || DID_FAIL(text->loadBuffer(params, false))) { delete text; - text = NULL; + text = nullptr; cmd = PARSERR_GENERIC; } else { text->_parent = this; @@ -508,7 +508,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { UIEdit *edit = new UIEdit(_gameRef); if (!edit || DID_FAIL(edit->loadBuffer(params, false))) { delete edit; - edit = NULL; + edit = nullptr; cmd = PARSERR_GENERIC; } else { edit->_parent = this; @@ -521,7 +521,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { UIWindow *win = new UIWindow(_gameRef); if (!win || DID_FAIL(win->loadBuffer(params, false))) { delete win; - win = NULL; + win = nullptr; cmd = PARSERR_GENERIC; } else { win->_parent = this; @@ -616,7 +616,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { _fadeColor = BYTETORGBA(fadeR, fadeG, fadeB, fadeA); } - _focusedWidget = NULL; + _focusedWidget = nullptr; return STATUS_OK; } @@ -795,7 +795,7 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack _gameRef->_fontStorage->removeFont(_fontInactive); } _fontInactive = _gameRef->_fontStorage->addFont(stack->pop()->getString()); - stack->pushBool(_fontInactive != NULL); + stack->pushBool(_fontInactive != nullptr); return STATUS_OK; } @@ -811,7 +811,7 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack const char *filename = stack->pop()->getString(); if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(filename))) { delete _imageInactive; - _imageInactive = NULL; + _imageInactive = nullptr; stack->pushBool(false); } else { stack->pushBool(true); @@ -1294,7 +1294,7 @@ bool UIWindow::moveFocus(bool forward) { } } if (!found) { - _focusedWidget = NULL; + _focusedWidget = nullptr; } if (!_focusedWidget) { diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index a1053bbef6..9fffad85cd 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.cpp @@ -205,7 +205,7 @@ bool StringUtil::isUtf8BOM(const byte *buffer, uint32 bufferSize) { ////////////////////////////////////////////////////////////////////////// int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t startFrom) { const char *index = strstr(str.c_str(), toFind.c_str()); - if (index == NULL) { + if (index == nullptr) { return -1; } else { return index - str.c_str(); diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp index 824b16ccdb..6e0d69edbe 100644 --- a/engines/wintermute/utils/utils.cpp +++ b/engines/wintermute/utils/utils.cpp @@ -96,7 +96,7 @@ char *BaseUtils::setString(char **string, const char *value) { char *BaseUtils::strEntry(int entry, const char *str, const char delim) { int numEntries = 0; - const char *start = NULL; + const char *start = nullptr; int len = 0; for (uint32 i = 0; i <= strlen(str); i++) { @@ -117,7 +117,7 @@ char *BaseUtils::strEntry(int entry, const char *str, const char delim) { } } } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/video/video_player.cpp b/engines/wintermute/video/video_player.cpp index 2577b8aedc..42857b5c1b 100644 --- a/engines/wintermute/video/video_player.cpp +++ b/engines/wintermute/video/video_player.cpp @@ -50,7 +50,7 @@ bool VideoPlayer::setDefaults() { _playPosX = _playPosY = 0; _playZoom = 0.0f; - _filename = NULL; + _filename = nullptr; _slowRendering = false; diff --git a/engines/wintermute/video/video_player.h b/engines/wintermute/video/video_player.h index d5466da679..a49e910b0c 100644 --- a/engines/wintermute/video/video_player.h +++ b/engines/wintermute/video/video_player.h @@ -58,7 +58,7 @@ public: bool _playing; bool display(); bool update(); - bool initialize(const char *inFilename, const char *subtitleFile = NULL); + bool initialize(const char *inFilename, const char *subtitleFile = nullptr); bool cleanup(); VideoPlayer(BaseGame *inGame); virtual ~VideoPlayer(); diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index d14c807e11..1f6842c416 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -51,7 +51,7 @@ VideoTheoraPlayer::VideoTheoraPlayer(BaseGame *inGame) : BaseClass(inGame) { ////////////////////////////////////////////////////////////////////////// void VideoTheoraPlayer::SetDefaults() { - _file = NULL; + _file = nullptr; _filename = ""; _startTime = 0; _looping = false; @@ -68,8 +68,8 @@ void VideoTheoraPlayer::SetDefaults() { _playbackStarted = false; _dontDropFrames = false; - _texture = NULL; - _alphaImage = NULL; + _texture = nullptr; + _alphaImage = nullptr; _alphaFilename = ""; _frameRendered = false; @@ -84,10 +84,10 @@ void VideoTheoraPlayer::SetDefaults() { _savedState = THEORA_STATE_NONE; _savedPos = 0; _volume = 100; - _theoraDecoder = NULL; + _theoraDecoder = nullptr; // TODO: Add subtitles-support - //_subtitler = NULL; + //_subtitler = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -100,7 +100,7 @@ VideoTheoraPlayer::~VideoTheoraPlayer(void) { void VideoTheoraPlayer::cleanup() { if (_file) { BaseFileManager::getEngineInstance()->closeFile(_file); - _file = NULL; + _file = nullptr; } _surface.free(); @@ -108,11 +108,11 @@ void VideoTheoraPlayer::cleanup() { _theoraDecoder->close(); } delete _theoraDecoder; - _theoraDecoder = NULL; + _theoraDecoder = nullptr; delete _alphaImage; - _alphaImage = NULL; + _alphaImage = nullptr; delete _texture; - _texture = NULL; + _texture = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -157,7 +157,7 @@ bool VideoTheoraPlayer::resetStream() { _theoraDecoder->close(); } delete _theoraDecoder; - _theoraDecoder = NULL; + _theoraDecoder = nullptr; _file = BaseFileManager::getEngineInstance()->openFile(_filename, true, false); if (!_file) { @@ -419,7 +419,7 @@ bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) { _alphaImage = new BaseImage(); if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { delete _alphaImage; - _alphaImage = NULL; + _alphaImage = nullptr; _alphaFilename = ""; return STATUS_FAILED; } diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index 593c1b9666..7a6742271c 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.h @@ -62,7 +62,7 @@ public: //CVidSubtitler *_subtitler; // control methods - bool initialize(const Common::String &filename, const Common::String &subtitleFile = NULL); + bool initialize(const Common::String &filename, const Common::String &subtitleFile = nullptr); bool initializeSimple(); bool update(); bool play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1); diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 426080d693..f33452d11c 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -49,7 +49,7 @@ namespace Wintermute { // This might not be the prettiest solution WintermuteEngine::WintermuteEngine() : Engine(g_system) { _game = new AdGame(""); - _debugger = NULL; + _debugger = nullptr; _trigDebug = false; } @@ -74,8 +74,8 @@ WintermuteEngine::WintermuteEngine(OSystem *syst, const ADGameDescription *desc) DebugMan.addDebugChannel(kWintermuteDebugAudio, "audio", "audio-playback-related issues"); DebugMan.addDebugChannel(kWintermuteDebugGeneral, "general", "various issues not covered by any of the above"); - _game = NULL; - _debugger = NULL; + _game = nullptr; + _debugger = nullptr; _trigDebug = false; } @@ -174,7 +174,7 @@ int WintermuteEngine::init() { if (DID_FAIL(_game->loadSettings("startup.settings"))) { _game->LOG(0, "Error loading game settings."); delete _game; - _game = NULL; + _game = nullptr; warning("Some of the essential files are missing. Please reinstall."); return 2; @@ -190,7 +190,7 @@ int WintermuteEngine::init() { _game->LOG(ret, "Error initializing renderer. Exiting."); delete _game; - _game = NULL; + _game = nullptr; return 3; } @@ -209,7 +209,7 @@ int WintermuteEngine::init() { if (DID_FAIL(_game->loadFile(_game->_settingsGameFile ? _game->_settingsGameFile : "default.game"))) { _game->LOG(ret, "Error loading game file. Exiting."); delete _game; - _game = NULL; + _game = nullptr; return false; } @@ -278,7 +278,7 @@ int WintermuteEngine::messageLoop() { if (_game) { delete _game; - _game = NULL; + _game = nullptr; } return 0; } @@ -309,7 +309,7 @@ bool WintermuteEngine::canLoadGameStateCurrently() { bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String &name, Common::String &caption) { bool retVal = false; caption = name = "(invalid)"; - Common::SeekableReadStream *stream = NULL; + Common::SeekableReadStream *stream = nullptr; // Quick-fix, instead of possibly breaking the persistence-system, let's just roll with it BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG); fileMan->registerPackages(fslist); -- cgit v1.2.3