diff options
Diffstat (limited to 'engines/bladerunner')
-rw-r--r-- | engines/bladerunner/audio_cache.cpp | 5 | ||||
-rw-r--r-- | engines/bladerunner/audio_cache.h | 7 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 247 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.h | 1 | ||||
-rw-r--r-- | engines/bladerunner/fog.cpp | 7 | ||||
-rw-r--r-- | engines/bladerunner/game_constants.h | 45 | ||||
-rw-r--r-- | engines/bladerunner/lights.cpp | 4 | ||||
-rw-r--r-- | engines/bladerunner/music.cpp | 11 | ||||
-rw-r--r-- | engines/bladerunner/savefile.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/script/ai/izo.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/script/ai/mccoy.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/script/police_maze.cpp | 23 | ||||
-rw-r--r-- | engines/bladerunner/script/police_maze.h | 1 | ||||
-rw-r--r-- | engines/bladerunner/script/scene/rc03.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/script/scene_script.cpp | 1 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.cpp | 6 | ||||
-rw-r--r-- | engines/bladerunner/zbuffer.cpp | 26 | ||||
-rw-r--r-- | engines/bladerunner/zbuffer.h | 1 |
18 files changed, 210 insertions, 183 deletions
diff --git a/engines/bladerunner/audio_cache.cpp b/engines/bladerunner/audio_cache.cpp index 734eeae4c7..5725560bef 100644 --- a/engines/bladerunner/audio_cache.cpp +++ b/engines/bladerunner/audio_cache.cpp @@ -22,12 +22,11 @@ #include "bladerunner/audio_cache.h" -#include "bladerunner/bladerunner.h" +#include "common/stream.h" namespace BladeRunner { -AudioCache::AudioCache(BladeRunnerEngine *vm) : - _vm(vm), +AudioCache::AudioCache() : _totalSize(0), _maxSize(2457600), _accessCounter(0) {} diff --git a/engines/bladerunner/audio_cache.h b/engines/bladerunner/audio_cache.h index 8357689174..4b20791add 100644 --- a/engines/bladerunner/audio_cache.h +++ b/engines/bladerunner/audio_cache.h @@ -28,9 +28,6 @@ namespace BladeRunner { -class BladeRunnerEngine; -class AudioCache; - /* * This is a poor imitation of Bladerunner's resource cache */ @@ -43,8 +40,6 @@ class AudioCache { uint32 size; }; - BladeRunnerEngine *_vm; - Common::Mutex _mutex; Common::Array<cacheItem> _cacheItems; @@ -53,7 +48,7 @@ class AudioCache { uint32 _accessCounter; public: - AudioCache(BladeRunnerEngine *vm); + AudioCache(); ~AudioCache(); bool canAllocate(uint32 size) const; diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 035ab22340..04af9a147a 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -350,8 +350,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { // outtake player was initialized here in the original game - but this is done bit differently - _policeMaze = new PoliceMaze(this); - _obstacles = new Obstacles(this); _sceneScript = new SceneScript(this); @@ -360,24 +358,20 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { // This is the original startup in the game - bool r; - _surfaceFront.create(640, 480, createRGB555()); _surfaceBack.create(640, 480, createRGB555()); - _surface4.create(640, 480, createRGB555()); _time = new Time(this); // Try to load the SUBTITLES.MIX first, before Startup.MIX // allows overriding any identically named resources (such as the original font files and as a bonus also the TRE files for the UI and dialogue menu) _subtitles = new Subtitles(this); - r = openArchive("SUBTITLES.MIX"); + bool r = openArchive("SUBTITLES.MIX"); if (!r) { _subtitles->setSubtitlesSystemInactive(true); // no subtitles support } _subtitles->init(); - r = openArchive("STARTUP.MIX"); if (!r) return false; @@ -391,8 +385,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { return false; } - _audioCache = new AudioCache(this); - if (hasSavegames) { if (!loadSplash()) { return false; @@ -427,6 +419,8 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { _items = new Items(this); + _audioCache = new AudioCache(); + _audioMixer = new AudioMixer(this); _audioPlayer = new AudioPlayer(this); @@ -462,7 +456,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { assert(actorCount < kActorCount); for (int i = 0; i != actorCount; ++i) { _actors[i] = new Actor(this, i); - _actors[i]->setup(i); } _actors[kActorVoiceOver] = new Actor(this, kActorVoiceOver); _playerActor = _actors[_gameInfo->getPlayerId()]; @@ -529,7 +522,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { _vk = new VK(this); _mouse = new Mouse(this); - // _mouse->setCursorPosition(320, 240); _mouse->setCursor(0); _sliceAnimations = new SliceAnimations(this); @@ -595,69 +587,121 @@ void BladeRunnerEngine::shutdown() { // BLADE.INI as updated here + delete _aiScripts; + _aiScripts = nullptr; + + delete _scene; + _scene = nullptr; + + delete _crimesDatabase; + _crimesDatabase = nullptr; + + delete _sliceRenderer; + _sliceRenderer = nullptr; + + delete _sliceAnimations; + _sliceAnimations = nullptr; + + delete _mouse; + _mouse = nullptr; + delete _vk; _vk = nullptr; delete _esper; _esper = nullptr; - delete _mouse; - _mouse = nullptr; - + /// todo for (uint i = 0; i != _shapes.size(); ++i) { delete _shapes[i]; } _shapes.clear(); - delete _scene; - _scene = nullptr; - - if (_chapters) { - if (_chapters->hasOpenResources()) - _chapters->closeResources(); - delete _chapters; - _chapters = nullptr; + if (_mainFont) { + _mainFont->close(); + delete _mainFont; + _mainFont = nullptr; } - delete _crimesDatabase; - _crimesDatabase = nullptr; + delete _scores; + _scores = nullptr; - delete _sliceRenderer; - _sliceRenderer = nullptr; + delete _elevator; + _elevator = nullptr; - delete _sliceAnimations; - _sliceAnimations = nullptr; + delete _spinner; + _spinner = nullptr; - delete _textActorNames; - _textActorNames = nullptr; + delete _kia; + _kia = nullptr; - delete _textCrimes; - _textCrimes = nullptr; + delete _suspectsDatabase; + _suspectsDatabase = nullptr; - delete _textClueTypes; - _textClueTypes = nullptr; + delete _dialogueMenu; + _dialogueMenu = nullptr; - delete _textKIA; - _textKIA = nullptr; + delete _textOptions; + _textOptions = nullptr; + + delete _textVK; + _textVK = nullptr; delete _textSpinnerDestinations; _textSpinnerDestinations = nullptr; - delete _textVK; - _textVK = nullptr; + delete _textKIA; + _textKIA = nullptr; - delete _textOptions; - _textOptions = nullptr; + delete _textClueTypes; + _textClueTypes = nullptr; - delete _dialogueMenu; - _dialogueMenu = nullptr; + delete _textCrimes; + _textCrimes = nullptr; - delete _ambientSounds; - _ambientSounds = nullptr; + delete _textActorNames; + _textActorNames = nullptr; + + delete _policeMaze; + _policeMaze = nullptr; + + _playerActor = nullptr; + delete _actors[kActorVoiceOver]; + _actors[kActorVoiceOver] = nullptr; + int actorCount = (int)_gameInfo->getActorCount(); + for (int i = 0; i < actorCount; ++i) { + delete _actors[i]; + _actors[i] = nullptr; + } + + delete _zbuffer; + _zbuffer = nullptr; delete _overlays; _overlays = nullptr; + if (isArchiveOpen("SPCHSFX.TLK")) { + closeArchive("SPCHSFX.TLK"); + } + + if (isArchiveOpen("SFX.MIX")) { + closeArchive("SFX.MIX"); + } + + if (isArchiveOpen("MUSIC.MIX")) { + closeArchive("MUSIC.MIX"); + } + + if (_chapters) { + if (_chapters->hasOpenResources()) + _chapters->closeResources(); + delete _chapters; + _chapters = nullptr; + } + + delete _ambientSounds; + _ambientSounds = nullptr; + delete _audioSpeech; _audioSpeech = nullptr; @@ -673,132 +717,81 @@ void BladeRunnerEngine::shutdown() { delete _audioCache; _audioCache = nullptr; - if (isArchiveOpen("MUSIC.MIX")) { - closeArchive("MUSIC.MIX"); - } - - if (isArchiveOpen("SFX.MIX")) { - closeArchive("SFX.MIX"); - } - - if (isArchiveOpen("SPCHSFX.TLK")) { - closeArchive("SPCHSFX.TLK"); - } - - if (_mainFont) { - _mainFont->close(); - delete _mainFont; - _mainFont = nullptr; - } - - if (isArchiveOpen("SUBTITLES.MIX")) { - closeArchive("SUBTITLES.MIX"); - } - if (_subtitles) { - delete _subtitles; - _subtitles = nullptr; - } - delete _items; _items = nullptr; delete _gameFlags; _gameFlags = nullptr; - delete _view; - _view = nullptr; - delete _sceneObjects; _sceneObjects = nullptr; - delete _cosTable1024; - delete _sinTable1024; + delete _view; + _view = nullptr; - delete _aiScripts; - _aiScripts = nullptr; + delete _sinTable1024; + _sinTable1024 = nullptr; + delete _cosTable1024; + _cosTable1024 = nullptr; delete[] _gameVars; _gameVars = nullptr; + delete _combat; + _combat = nullptr; + delete _waypoints; _waypoints = nullptr; - delete _scores; - _scores = nullptr; - - delete _endCredits; - _endCredits = nullptr; - - delete _elevator; - _elevator = nullptr; - - delete _spinner; - _spinner = nullptr; - - delete _kia; - _kia = nullptr; - - delete _suspectsDatabase; - _suspectsDatabase = nullptr; - - int actorCount = (int)_gameInfo->getActorCount(); - for (int i = 0; i != actorCount; ++i) { - delete _actors[i]; - _actors[i] = nullptr; - } - delete _actors[kActorVoiceOver]; - _actors[kActorVoiceOver] = nullptr; - - _playerActor = nullptr; - delete _gameInfo; _gameInfo = nullptr; - _surface4.free(); - _surfaceBack.free(); - _surfaceFront.free(); - if (isArchiveOpen("STARTUP.MIX")) { closeArchive("STARTUP.MIX"); } + if (isArchiveOpen("SUBTITLES.MIX")) { + closeArchive("SUBTITLES.MIX"); + } + if (_subtitles) { + delete _subtitles; + _subtitles = nullptr; + } + delete _time; _time = nullptr; + _surfaceBack.free(); + _surfaceFront.free(); + // These are static objects in original game delete _debugger; _debugger = nullptr; - delete _zbuffer; - _zbuffer = nullptr; + delete _sceneScript; + _sceneScript = nullptr; + + delete _obstacles; + _obstacles = nullptr; + + delete _lights; + _lights = nullptr; delete _itemPickup; _itemPickup = nullptr; - delete _policeMaze; - _policeMaze = nullptr; - - delete _obstacles; - _obstacles = nullptr; + delete _settings; + _settings = nullptr; delete _actorDialogueQueue; _actorDialogueQueue = nullptr; - delete _combat; - _combat = nullptr; + delete _endCredits; + _endCredits = nullptr; delete _screenEffects; _screenEffects = nullptr; - - delete _lights; - _lights = nullptr; - - delete _settings; - _settings = nullptr; - - delete _sceneScript; - _sceneScript = nullptr; } bool BladeRunnerEngine::loadSplash() { diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index deaf4fa462..35e0a3f538 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -173,7 +173,6 @@ public: Graphics::Surface _surfaceFront; Graphics::Surface _surfaceBack; - Graphics::Surface _surface4; ZBuffer *_zbuffer; diff --git a/engines/bladerunner/fog.cpp b/engines/bladerunner/fog.cpp index dac7f29679..edebc9412f 100644 --- a/engines/bladerunner/fog.cpp +++ b/engines/bladerunner/fog.cpp @@ -47,6 +47,9 @@ Fog::Fog() { } Fog::~Fog() { + if (_animationData != nullptr) { + delete[] _animationData; + } } int Fog::readCommon(Common::ReadStream *stream) { @@ -64,6 +67,10 @@ int Fog::readCommon(Common::ReadStream *stream) { void Fog::readAnimationData(Common::ReadStream *stream, int size) { _animatedParameters = stream->readUint32LE(); + if (_animationData != nullptr) { + delete[] _animationData; + } + int floatCount = size / 4; _animationData = new float[floatCount]; for (int i = 0; i < floatCount; i++) { diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index 7778d5350b..e2196588f9 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -1270,10 +1270,19 @@ enum AnimationModes { kAnimationModeCombatAttack = 6, kAnimationModeCombatWalk = 7, kAnimationModeCombatRun = 8, - // 12 - 19 various talk modes + // 9 - 19 various talk modes + kAnimationModeDodge = 20, kAnimationModeHit = 21, kAnimationModeCombatHit = 22, - // 23 - give / take away + // 23 give / take away + // 24 - 25 not used + // 26 ??? + // 27 - 28 not used + // 29 stand up + // 30 - 37 not used + // 38 ??? + // 39 not used + // 40 mccoy throws body kAnimationModeSpinnerGetIn = 41, kAnimationModeSpinnerGetOut = 42, // 43 - taking photo/using cellphone @@ -1283,12 +1292,42 @@ enum AnimationModes { kAnimationModeCombatWalkDown = 47, kAnimationModeDie = 48, kAnimationModeCombatDie = 49, + // 50 luther, tyrellguard ??? + // 51 steele, maggie ??? kAnimationModeFeeding = 52, - kAnimationModeSit = 53, + kAnimationModeSit = 53, // more like sitting than sitting down + // 54 clovis, maggie ??? + // 55 transient, tyrellguard, maggie + // 56 maggie ??? + // 57 maggie ??? + // 58 - 60 not used + // 61 guzza ??? + // 62 sadik ??? + // 63 sadik ??? kAnimationModeClimbUp = 64, kAnimationModeClimbDown = 65, kAnimationModeCombatClimbUp = 66, kAnimationModeCombatClimbDown = 67 + // 68 mccoy getting kicked + // 69 not used + // 70 dektora ??? + // 71 dektora ??? + // 72 desk clerk, leon ??? + // 73 earlyq ??? + // 74 earlyq ??? + // 75 mccoy drinking ??? + // 76 earlyq ??? + // 77 not used + // 78 hanoi ??? + // 79 dektora ??? + // 80 gordo ??? + // 81 - 82 not used + // 83 gordo ??? + // 84 gordo ??? + // 85 mccoy, earlyq - sitdown + // 86 - 87 not used + // 88 ??? + // 89 homeless ??? }; enum SceneLoopMode { diff --git a/engines/bladerunner/lights.cpp b/engines/bladerunner/lights.cpp index ccb339c4a8..eb11a3b03d 100644 --- a/engines/bladerunner/lights.cpp +++ b/engines/bladerunner/lights.cpp @@ -31,7 +31,6 @@ Lights::Lights(BladeRunnerEngine *vm) { _ambientLightColor.g = 0.0; _ambientLightColor.b = 0.0; - _lights.clear(); _frame = 0; } @@ -83,8 +82,9 @@ void Lights::removeAnimated() { void Lights::readVqa(Common::ReadStream *stream) { removeAnimated(); - if (stream->eos()) + if (stream->eos()) { return; + } int frameCount = stream->readUint32LE(); int count = stream->readUint32LE(); diff --git a/engines/bladerunner/music.cpp b/engines/bladerunner/music.cpp index 42c0b62759..a29b981f12 100644 --- a/engines/bladerunner/music.cpp +++ b/engines/bladerunner/music.cpp @@ -99,7 +99,7 @@ bool Music::play(const Common::String &trackName, int volume, int pan, int timeF if (_channel < 0) { delete _stream; _stream = nullptr; - delete _data; + delete[] _data; _data = nullptr; return false; @@ -248,7 +248,7 @@ void Music::ended() { _isPlaying = false; _channel = -1; - delete _data; + delete[] _data; _data = nullptr; _vm->getTimerManager()->installTimerProc(timerCallbackNext, 100 * 1000, this, "BladeRunnerMusicNextTimer"); @@ -293,12 +293,17 @@ void Music::timerCallbackNext(void *refCon) { byte *Music::getData(const Common::String &name) { // NOTE: This is not part original game, loading data is done in the mixer and its using buffering to limit memory usage Common::SeekableReadStream *stream = _vm->getResourceStream(name); + if (stream == nullptr) { return nullptr; } + uint32 size = stream->size(); - byte *data = (byte *)malloc(size); + byte *data = new byte[size]; stream->read(data, size); + + delete stream; + return data; } diff --git a/engines/bladerunner/savefile.cpp b/engines/bladerunner/savefile.cpp index 929bd8b008..62bcdb2f17 100644 --- a/engines/bladerunner/savefile.cpp +++ b/engines/bladerunner/savefile.cpp @@ -127,7 +127,7 @@ bool SaveFileManager::readHeader(Common::SeekableReadStream &in, SaveFileHeader s.skip(4); //skip size; - void *thumbnailData = new byte[kThumbnailSize]; // freed by ScummVM's smartptr + void *thumbnailData = malloc(kThumbnailSize); // freed by ScummVM's smartptr s.read(thumbnailData, kThumbnailSize); // TODO: cleanup - remove magic constants diff --git a/engines/bladerunner/script/ai/izo.cpp b/engines/bladerunner/script/ai/izo.cpp index 78c6f4f03d..9e48995816 100644 --- a/engines/bladerunner/script/ai/izo.cpp +++ b/engines/bladerunner/script/ai/izo.cpp @@ -558,7 +558,7 @@ bool AIScriptIzo::UpdateAnimation(int *animation, int *frame) { if (Actor_Query_Goal_Number(kActorIzo) == kGoalIzoWaitingAtRC03 && _animationFrame == 6 ) { - Actor_Change_Animation_Mode(kActorMcCoy, 20); + Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDodge); } Actor_Query_Goal_Number(kActorIzo); if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp index 6dd8c90eb1..b5ba45429e 100644 --- a/engines/bladerunner/script/ai/mccoy.cpp +++ b/engines/bladerunner/script/ai/mccoy.cpp @@ -1593,7 +1593,7 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) { } break; - case 20: + case kAnimationModeDodge: dodge(); break; diff --git a/engines/bladerunner/script/police_maze.cpp b/engines/bladerunner/script/police_maze.cpp index b7b627fd63..c45826fc8e 100644 --- a/engines/bladerunner/script/police_maze.cpp +++ b/engines/bladerunner/script/police_maze.cpp @@ -34,7 +34,12 @@ namespace BladeRunner { PoliceMaze::PoliceMaze(BladeRunnerEngine *vm) : ScriptBase(vm) { - reset(); + _isPaused = false; + _isActive = false; + _isEnding = false; + + _pm_var1 = 0; + _pm_var2 = 0; for (int i = 0; i < kNumMazeTracks; i++) { _tracks[i] = new PoliceMazeTargetTrack(vm); @@ -44,22 +49,8 @@ PoliceMaze::PoliceMaze(BladeRunnerEngine *vm) : ScriptBase(vm) { PoliceMaze::~PoliceMaze() { for (int i = 0; i < kNumMazeTracks; i++) { delete _tracks[i]; + _tracks[i] = nullptr; } - - reset(); -} - -void PoliceMaze::reset() { - _isPaused = false; - _isActive = false; - _isEnding = false; - - for (int i = 0; i < kNumMazeTracks; i++) { - _tracks[i] = 0; - } - - _pm_var1 = 0; - _pm_var2 = 0; } void PoliceMaze::clear(bool isLoadingGame) { diff --git a/engines/bladerunner/script/police_maze.h b/engines/bladerunner/script/police_maze.h index 725fbd4319..9e79497040 100644 --- a/engines/bladerunner/script/police_maze.h +++ b/engines/bladerunner/script/police_maze.h @@ -92,7 +92,6 @@ public: ~PoliceMaze(); void tick(); - void reset(); void clear(bool isLoadingGame); void setPauseState(bool state); void activate(); diff --git a/engines/bladerunner/script/scene/rc03.cpp b/engines/bladerunner/script/scene/rc03.cpp index a8696c75ea..fd18b8a460 100644 --- a/engines/bladerunner/script/scene/rc03.cpp +++ b/engines/bladerunner/script/scene/rc03.cpp @@ -258,7 +258,7 @@ void SceneScriptRC03::PlayerWalkedIn() { if (Game_Flag_Query(kFlagIzoIsReplicant) ) { Actor_Set_Goal_Number(kActorSteele, kGoalSteeleApprehendIzo); } - Actor_Change_Animation_Mode(kActorMcCoy, 20); + Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDodge); Loop_Actor_Walk_To_XYZ(kActorIzo, 180.0f, -4.0f, 184.0f, 0, false, false, 0); Actor_Change_Animation_Mode(kActorIzo, 6); if (!Game_Flag_Query(kFlagIzoIsReplicant)) { diff --git a/engines/bladerunner/script/scene_script.cpp b/engines/bladerunner/script/scene_script.cpp index 7c890d6538..c4a5a1bc3f 100644 --- a/engines/bladerunner/script/scene_script.cpp +++ b/engines/bladerunner/script/scene_script.cpp @@ -35,6 +35,7 @@ SceneScript::~SceneScript() { bool SceneScript::open(const Common::String &name) { delete _currentScript; + _currentScript = nullptr; if (name == "AR01") { _currentScript = new SceneScriptAR01(_vm); return true; } if (name == "AR02") { _currentScript = new SceneScriptAR02(_vm); return true; } diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index 42aaf3c409..c889890276 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -110,6 +110,10 @@ KIA::KIA(BladeRunnerEngine *vm) { } KIA::~KIA() { + if (isOpen()) { + unload(); + } + _thumbnail.free(); delete _crimesSection; delete _suspectsSection; @@ -150,7 +154,7 @@ void KIA::open(KIASections sectionId) { return; } - if (!sectionId) { + if (sectionId == kKIASectionNone) { unload(); return; } diff --git a/engines/bladerunner/zbuffer.cpp b/engines/bladerunner/zbuffer.cpp index 044992670b..21fa6c5da1 100644 --- a/engines/bladerunner/zbuffer.cpp +++ b/engines/bladerunner/zbuffer.cpp @@ -24,6 +24,8 @@ #include "bladerunner/decompress_lzo.h" +#include "common/debug.h" + namespace BladeRunner { void ZBufferDirtyRects::reset() { @@ -70,13 +72,18 @@ bool ZBufferDirtyRects::popRect(Common::Rect *rect) { } ZBuffer::ZBuffer() { - reset(); + _zbuf1 = nullptr; + _zbuf2 = nullptr; + _dirtyRects = new ZBufferDirtyRects(); + _width = 0; + _height = 0; + enable(); } ZBuffer::~ZBuffer() { - delete _dirtyRects; - delete[] _zbuf1; delete[] _zbuf2; + delete[] _zbuf1; + delete _dirtyRects; } void ZBuffer::init(int width, int height) { @@ -85,8 +92,6 @@ void ZBuffer::init(int width, int height) { _zbuf1 = new uint16[width * height]; _zbuf2 = new uint16[width * height]; - - _dirtyRects = new ZBufferDirtyRects(); } static int decodePartialZBuffer(const uint8 *src, uint16 *curZBUF, uint32 srcLen) { @@ -167,22 +172,13 @@ uint16 ZBuffer::getZValue(int x, int y) const { assert(x >= 0 && x < _width); assert(y >= 0 && y < _height); - if (!_zbuf2) { + if (_zbuf2 == nullptr) { return 0; } return _zbuf2[y * _width + x]; } -void ZBuffer::reset() { - _zbuf1 = nullptr; - _zbuf2 = nullptr; - _dirtyRects = nullptr; - _width = 0; - _height = 0; - enable(); -} - void ZBuffer::blit(Common::Rect rect) { int line_width = rect.width(); diff --git a/engines/bladerunner/zbuffer.h b/engines/bladerunner/zbuffer.h index edb1822c6d..b8296ce1f6 100644 --- a/engines/bladerunner/zbuffer.h +++ b/engines/bladerunner/zbuffer.h @@ -69,7 +69,6 @@ public: uint16 getZValue(int x, int y) const; private: - void reset(); void blit(Common::Rect rect); public: |