Permalink
Browse files

BLADERUNNER: Removed unnecessary debugging code

  • Loading branch information...
peterkohaut committed Feb 7, 2019
1 parent 66dc8af commit a0e9b09cd9b9be59dcf4c90df152fba8b55390cd
@@ -70,7 +70,7 @@ void ActorClues::acquire(int clueId, bool flag2, int fromActorId) {
_clues[clueIndex].flags = (_clues[clueIndex].flags & ~0x02) | ((flag2 << 1) & 0x02);
_clues[clueIndex].fromActorId = fromActorId;

debug("Actor acquired clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId);
// debug("Actor acquired clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId);
}

void ActorClues::lose(int clueId) {
@@ -83,11 +83,7 @@ bool ActorClues::isAcquired(int clueId) const {
if (clueIndex == -1) {
return false;
}
// #if BLADERUNNER_DEBUG_GAME
// return true;
// #else
return _clues[clueIndex].flags & 0x01;
// #endif
}

int ActorClues::getWeight(int clueId) const {
@@ -335,8 +331,6 @@ int ActorClues::findClueIndex(int clueId) const {
void ActorClues::add(int actorId, int clueId, int weight, bool acquired, bool unknownFlag, int fromActorId) {
assert(_count < _maxCount);

//debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_crimesDatabase->getClueText(clueId), fromActorId);

_clues[_count].clueId = clueId;
_clues[_count].weight = weight;

@@ -353,9 +347,9 @@ bool ActorClues::exists(int clueId) const {
}

void ActorClues::remove(int index) {
if (_vm->_crimesDatabase) {
debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index].clueId));
}
// if (_vm->_crimesDatabase) {
// debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index].clueId));
// }

_clues[index].clueId = -1;
_clues[index].weight = 0;
@@ -364,12 +364,12 @@ bool ActorWalk::addNearActors(int skipActorId) {
bool added = false;
int setId = _vm->_scene->getSetId();
for (int i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) {
// TODO: remove null check after implemetantion of all actors
if (_vm->_actors[i] != nullptr
&& _vm->_actors[skipActorId] != nullptr
&& _vm->_actors[i]->getSetId() == setId
&& i != skipActorId) {
assert(_vm->_actors[i] != nullptr);

if (_vm->_actors[skipActorId] != nullptr
&& _vm->_actors[i]->getSetId() == setId
&& i != skipActorId
) {
if (_nearActors.contains(i)) {
_nearActors.setVal(i, false);
} else if (_vm->_actors[skipActorId]->distanceFromActor(i) <= 48.0f) {
@@ -385,8 +385,9 @@ void ActorWalk::obstaclesAddNearActors(int actorId) const {
Vector3 position = _vm->_actors[actorId]->getPosition();
for (Common::HashMap<int, bool>::const_iterator it = _nearActors.begin(); it != _nearActors.end(); ++it) {
Actor *otherActor = _vm->_actors[it->_key];
// TODO: remove null check after implemetantion of all actors
if (otherActor == nullptr || otherActor->isRetired()) {
assert(otherActor != nullptr);

if ( otherActor->isRetired()) {
continue;
}
Vector3 otherPosition = otherActor->getPosition();
@@ -55,10 +55,6 @@ bool MIXArchive::open(const Common::String &filename) {
_entries[i].offset = _fd.readUint32LE();
_entries[i].length = _fd.readUint32LE();

#if BLADERUNNER_DEBUG_CONSOLE
debug("%08x %-12d %-12d", _entries[i].hash, _entries[i].offset, _entries[i].length);
#endif

// Verify that the entries are sorted by id. Note that id is signed.
if (i > 0) {
assert(_entries[i].hash > _entries[i - 1].hash);
@@ -278,8 +278,6 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
actualVolume = _sfxVolume * volume / 100;
}

// debug("PlayStream: %s", name.c_str());

int channel = _vm->_audioMixer->play(
Audio::Mixer::kPlainSoundType,
audioStream,
@@ -294,13 +294,7 @@ Common::Error BladeRunnerEngine::run() {
return Common::Error(Common::kUnknownError, "Failed to initialize resources");
}



#if BLADERUNNER_DEBUG_GAME
{
#else
if (warnUserAboutUnsupportedGame()) {
#endif
if (hasSavegames) {
_kia->_forceOpen = true;
_kia->open(kKIASectionLoad);
@@ -1299,8 +1293,6 @@ void BladeRunnerEngine::handleMouseAction(int x, int y, bool mainButton, bool bu
}

void BladeRunnerEngine::handleMouseClickExit(int exitId, int x, int y, bool buttonDown) {
debug("clicked on exit %d %d %d", exitId, x, y);

if (_isWalkingInterruptible && exitId != _walkingToExitId) {
_isWalkingInterruptible = false;
_interruptWalking = true;
@@ -1333,8 +1325,6 @@ void BladeRunnerEngine::handleMouseClickExit(int exitId, int x, int y, bool butt
}

void BladeRunnerEngine::handleMouseClickRegion(int regionId, int x, int y, bool buttonDown) {
debug("clicked on region %d %d %d", regionId, x, y);

if (_isWalkingInterruptible && regionId != _walkingToRegionId) {
_isWalkingInterruptible = false;
_interruptWalking = true;
@@ -1368,7 +1358,6 @@ void BladeRunnerEngine::handleMouseClickRegion(int regionId, int x, int y, bool

void BladeRunnerEngine::handleMouseClick3DObject(int objectId, bool buttonDown, bool isClickable, bool isTarget) {
const Common::String &objectName = _scene->objectGetName(objectId);
debug("Clicked on object %s", objectName.c_str());

if (_isWalkingInterruptible && objectId != _walkingToObjectId) {
_isWalkingInterruptible = false;
@@ -1423,8 +1412,6 @@ void BladeRunnerEngine::handleMouseClick3DObject(int objectId, bool buttonDown,
}

void BladeRunnerEngine::handleMouseClickEmpty(int x, int y, Vector3 &scenePosition, bool buttonDown) {
debug("Clicked on nothing %f, %f, %f", scenePosition.x, scenePosition.y, scenePosition.z);

if (_isWalkingInterruptible) {
_isWalkingInterruptible = false;
_interruptWalking = true;
@@ -1503,8 +1490,6 @@ void BladeRunnerEngine::handleMouseClickEmpty(int x, int y, Vector3 &scenePositi
}

void BladeRunnerEngine::handleMouseClickItem(int itemId, bool buttonDown) {
debug("Clicked on item %d", itemId);

if (_isWalkingInterruptible && itemId != _walkingToItemId) {
_isWalkingInterruptible = false;
_interruptWalking = true;
@@ -1559,8 +1544,6 @@ void BladeRunnerEngine::handleMouseClickItem(int itemId, bool buttonDown) {
}

void BladeRunnerEngine::handleMouseClickActor(int actorId, bool mainButton, bool buttonDown, Vector3 &scenePosition, int x, int y) {
debug("Clicked on actor %d", actorId);

if (_isWalkingInterruptible && actorId != _walkingToActorId) {
_isWalkingInterruptible = false;
_interruptWalking = true;
@@ -1699,7 +1682,7 @@ bool BladeRunnerEngine::closeArchive(const Common::String &name) {
}
}

debug("closeArchive: Archive %s not open.", name.c_str());
warning("closeArchive: Archive %s not open.", name.c_str());
return false;
}

@@ -1733,10 +1716,8 @@ Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::S
continue;
}

if (false) {
debug("getResource: Searching archive %s for %s.", _archives[i].getName().c_str(), name.c_str());
}

// debug("getResource: Searching archive %s for %s.", _archives[i].getName().c_str(), name.c_str());

Common::SeekableReadStream *stream = _archives[i].createReadStreamForMember(name);
if (stream) {
return stream;
@@ -1755,7 +1736,6 @@ void BladeRunnerEngine::playerLosesControl() {
if (++_playerLosesControlCounter == 1) {
_mouse->disable();
}
// debug("Player Lost Control (%d)", _playerLosesControlCounter);
}

void BladeRunnerEngine::playerGainsControl() {
@@ -1766,8 +1746,6 @@ void BladeRunnerEngine::playerGainsControl() {
if (_playerLosesControlCounter > 0)
--_playerLosesControlCounter;

// debug("Player Gained Control (%d)", _playerLosesControlCounter);

if (_playerLosesControlCounter == 0) {
_mouse->enable();
}
@@ -35,9 +35,8 @@

#include "graphics/surface.h"

//TODO: remove these when game is playable
//TODO: change this to debugflag
#define BLADERUNNER_DEBUG_CONSOLE 0
#define BLADERUNNER_DEBUG_GAME 0

namespace Common {
struct Event;
@@ -105,11 +104,7 @@ class ZBuffer;

class BladeRunnerEngine : public Engine {
public:
#if BLADERUNNER_DEBUG_GAME
static const int kArchiveCount = 100;
#else
static const int kArchiveCount = 11; // +1 to original value (10) to accommodate for SUBTITLES.MIX resource
#endif
static const int kActorCount = 100;
static const int kActorVoiceOver = kActorCount - 1;

@@ -44,19 +44,6 @@ bool Chapters::enterChapter(int chapter) {
if (!_vm->openArchive(Common::String::format("OUTTAKE%d.MIX", id)))
return false;

#if BLADERUNNER_DEBUG_GAME
_vm->openArchive("OUTTAKE1.MIX");
_vm->openArchive("OUTTAKE2.MIX");
_vm->openArchive("OUTTAKE3.MIX");
_vm->openArchive("OUTTAKE4.MIX");
_vm->openArchive("VQA1.MIX");
_vm->openArchive("VQA2.MIX");
_vm->openArchive("VQA3.MIX");
_vm->openArchive("1.TLK");
_vm->openArchive("2.TLK");
_vm->openArchive("3.TLK");
#endif

_chapter = chapter;
_hasOpenResources = true;
return true;
@@ -76,7 +76,6 @@ bool DialogueMenu::show() {
}

bool DialogueMenu::showAt(int x, int y) {
debug("DialogueMenu::showAt %d %d %d", _isVisible, x, y);
if (_isVisible) {
return false;
}
@@ -253,7 +252,7 @@ int DialogueMenu::queryInput() {
}
}

debug("DM Query Input: %d %s", answer, _items[_selectedItemIndex].text.c_str());
// debug("DM Query Input: %d %s", answer, _items[_selectedItemIndex].text.c_str());

return answer;
}
@@ -382,7 +381,6 @@ void DialogueMenu::calculatePosition(int unusedX, int unusedY) {
_screenY = CLIP(_screenY, 0, 480 - h);

_fadeInItemIndex = 0;
debug("calculatePosition: %d %d %d %d %d", _screenX, _screenY, _centerX, _centerY, _maxItemWidth);
}

void DialogueMenu::mouseUp() {
@@ -454,7 +452,6 @@ void DialogueMenu::load(SaveFileReadStream &f) {
_neverRepeatValues[_neverRepeatListSize] = answer[i];
_neverRepeatWasSelected[_neverRepeatListSize] = value;
++_neverRepeatListSize;
debug("- %i, %i", answer[i], value);
}
}
#else
@@ -48,7 +48,7 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh

Common::ScopedPtr<Common::SeekableReadStream> stream(_vm->getResourceStream(fileName));
if (!stream) {
debug("Font::open failed to open '%s'", fileName.c_str());
warning("Font::open failed to open '%s'", fileName.c_str());
return false;
}

@@ -58,7 +58,7 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh
_dataSize = stream->readUint32LE();
_data = new uint16[_dataSize];
if (!_data) {
debug("Font::open failed to allocate font buffer");
warning("Font::open failed to allocate font buffer");
return false;
}

@@ -52,20 +52,12 @@ void GameFlags::setFlagCount(int count) {
}

void GameFlags::set(int flag) {
#if BLADERUNNER_DEBUG_CONSOLE
debug("GameFlags::set(%d)", flag);
#endif

assert(flag >= 0 && flag <= _flagCount);

_flags[flag / 32] |= (1 << (flag % 32));
}

void GameFlags::reset(int flag) {
#if BLADERUNNER_DEBUG_CONSOLE
debug("GameFlags::reset(%d)", flag);
#endif

assert(flag >= 0 && flag <= _flagCount);

_flags[flag / 32] &= ~(1 << (flag % 32));
@@ -40,7 +40,7 @@ Image::~Image() {
bool Image::open(const Common::String &name) {
Common::SeekableReadStream *stream = _vm->getResourceStream(name);
if (!stream) {
debug("Image::open failed to open '%s'\n", name.c_str());
warning("Image::open failed to open '%s'\n", name.c_str());
return false;
}

@@ -61,7 +61,7 @@ bool Image::open(const Common::String &name) {
assert(data);

if (strcmp(tag, "LZO") == 0) {
debug("LZO");
warning("LZO image decompression is not implemented");
} else if (strcmp(tag, "LCW") == 0) {
decompress_lcw(buf, bufSize, (uint8 *)data, dataSize);
}
@@ -81,7 +81,6 @@ int Regions::getRegionAtXY(int x, int y) const {

// Common::Rect::contains is exclusive of right and bottom but
// Blade Runner wants inclusive, so we adjust the edges.
// TODO: Roll our own rect class?
Common::Rect r = _regions[i].rectangle;
r.right++;
r.bottom++;
@@ -47,13 +47,6 @@ enum kRC01Regions {
};

void SceneScriptRC01::InitializeScene() {
#if BLADERUNNER_DEBUG_GAME
//TODO: not part of game, remove
Game_Flag_Set(kFlagIntroPlayed); // force skip intro
Game_Flag_Set(kFlagRC02toRC01); // no landing
// Set_Enter(kSetPS10_PS11_PS12_PS13, 73);
#endif

if (!Game_Flag_Query(kFlagIntroPlayed)) {
Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
@@ -222,7 +222,7 @@ void SceneScriptRC03::SceneFrameAdvanced(int frame) {
void SceneScriptRC03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
}

void SceneScriptRC03::sub_402834() {
void SceneScriptRC03::talkWithSteele() {
Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
Actor_Says(kActorSteele, 1820, 3);
Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
@@ -284,7 +284,7 @@ void SceneScriptRC03::PlayerWalkedIn() {
} else {
Actor_Set_At_Waypoint(kActorSteele, 203, 0);
}
sub_402834();
talkWithSteele();
Async_Actor_Walk_To_Waypoint(kActorSteele, 174, 0, 0);
Actor_Set_Goal_Number(kActorIzo, 200);
Player_Gains_Control();
@@ -416,7 +416,7 @@ DECLARE_SCRIPT(RC02)
END_SCRIPT

DECLARE_SCRIPT(RC03)
void sub_402834();
void talkWithSteele();
END_SCRIPT

DECLARE_SCRIPT(RC04)
Oops, something went wrong.

0 comments on commit a0e9b09

Please sign in to comment.