diff options
author | D G Turner | 2012-07-07 17:04:42 +0100 |
---|---|---|
committer | D G Turner | 2012-07-07 17:04:42 +0100 |
commit | 62c4c0922556a0ac95a60b760d2c49d3f186f85f (patch) | |
tree | db387bf820d662f2d342ec15c0952624b16ecf8b /engines | |
parent | a77a81da5160a8257d1596d11b27c8677b2350ef (diff) | |
download | scummvm-rg350-62c4c0922556a0ac95a60b760d2c49d3f186f85f.tar.gz scummvm-rg350-62c4c0922556a0ac95a60b760d2c49d3f186f85f.tar.bz2 scummvm-rg350-62c4c0922556a0ac95a60b760d2c49d3f186f85f.zip |
TEENAGENT: Enable commented out debug statements.
Commented out code is not good practice. Will change these statements
to using debugflags instead in a future commit.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/teenagent/animation.cpp | 18 | ||||
-rw-r--r-- | engines/teenagent/callbacks.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/dialog.cpp | 89 | ||||
-rw-r--r-- | engines/teenagent/font.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/inventory.cpp | 10 | ||||
-rw-r--r-- | engines/teenagent/music.cpp | 12 | ||||
-rw-r--r-- | engines/teenagent/objects.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/pack.cpp | 8 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 20 | ||||
-rw-r--r-- | engines/teenagent/surface.cpp | 6 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 10 |
11 files changed, 87 insertions, 96 deletions
diff --git a/engines/teenagent/animation.cpp b/engines/teenagent/animation.cpp index 56107b67ca..943458c1c2 100644 --- a/engines/teenagent/animation.cpp +++ b/engines/teenagent/animation.cpp @@ -52,7 +52,7 @@ Surface *Animation::currentFrame(int dt) { if (data != NULL) { uint32 frame = 3 * index; - //debug(0, "%u/%u", index, data_size / 3); + debug(0, "%u/%u", index, data_size / 3); index += dt; if (!loop && index >= data_size / 3) { @@ -73,7 +73,7 @@ Surface *Animation::currentFrame(int dt) { y = r->y = pos / 320; } } else { - //debug(0, "index %u", index); + debug(0, "index %u", index); r = frames + index; index += dt; index %= frames_count; @@ -107,7 +107,7 @@ void Animation::free() { } void Animation::load(Common::SeekableReadStream &s, Type type) { - //fixme: do not reload the same animation each time + //FIXME: do not reload the same animation each time free(); if (s.size() <= 1) { @@ -115,7 +115,7 @@ void Animation::load(Common::SeekableReadStream &s, Type type) { return; } - //uint16 pos = 0; + uint16 pos = 0; int off = 0; switch (type) { case kTypeLan: @@ -141,8 +141,8 @@ void Animation::load(Common::SeekableReadStream &s, Type type) { frames = new Surface[frames_count]; s.skip(frames_count * 2 - 2); //sizes - /*pos = */s.readUint16LE(); - //debug(0, "pos?: %04x", pos); + pos = s.readUint16LE(); + debug(0, "pos?: %04x", pos); for (uint16 i = 0; i < frames_count; ++i) { frames[i].load(s, Surface::kTypeLan); @@ -167,7 +167,7 @@ void Animation::load(Common::SeekableReadStream &s, Type type) { frames_count = data[idx]; data[idx + 1] = 0; data[idx + 2] = 0; - //debug(0, "frame #%u", data[idx]); + debug(0, "frame #%u", data[idx]); } frames = new Surface[frames_count]; @@ -184,11 +184,11 @@ void Animation::load(Common::SeekableReadStream &s, Type type) { uint16 offset[255]; for (byte i = 0; i < frames_count; ++i) { offset[i] = s.readUint16LE(); - //debug(0, "%u: %04x", i, offset[i]); + debug(0, "%u: %04x", i, offset[i]); } frames = new Surface[frames_count]; for (uint16 i = 0; i < frames_count; ++i) { - //debug(0, "%04x", offset[i]); + debug(0, "%04x", offset[i]); s.seek(offset[i] + off); frames[i].load(s, Surface::kTypeOns); } diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index a3e215fc7f..da0b9848f7 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -36,7 +36,7 @@ namespace TeenAgent { void TeenAgentEngine::rejectMessage() { //random reject message: uint i = _rnd.getRandomNumber(3); - //debug(0, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i))); + debug(0, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i))); displayMessage(res->dseg.get_word(0x339e + 2 * i)); } @@ -54,7 +54,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { uint16 msg = READ_LE_UINT16(code + 1); uint16 func = 6 + addr + READ_LE_UINT16(code + 4); debug(0, "call %04x", func); - //debug(0, "trivial callback, showing message %s", (const char *)res->dseg.ptr(addr)); + debug(0, "trivial callback, showing message %s", (const char *)res->dseg.ptr(addr)); switch (func) { case 0xa055: displayMessage(msg); diff --git a/engines/teenagent/dialog.cpp b/engines/teenagent/dialog.cpp index 29d8b62cff..69521158f8 100644 --- a/engines/teenagent/dialog.cpp +++ b/engines/teenagent/dialog.cpp @@ -33,88 +33,79 @@ void Dialog::show(TeenAgentEngine *vm, Scene *scene, uint16 addr, uint16 animati byte color = color1; if (animation1 != 0) { - SceneEvent e(SceneEvent::kPlayAnimation); - e.animation = animation1; - e.slot = 0xc0 | slot1; //looped, paused - scene->push(e); + SceneEvent e1(SceneEvent::kPlayAnimation); + e1.animation = animation1; + e1.slot = 0xc0 | slot1; //looped, paused + scene->push(e1); } if (animation2 != 0) { - SceneEvent e(SceneEvent::kPlayAnimation); - e.animation = animation2; - e.slot = 0xc0 | slot2; //looped, paused - scene->push(e); + SceneEvent e2(SceneEvent::kPlayAnimation); + e2.animation = animation2; + e2.slot = 0xc0 | slot2; //looped, paused + scene->push(e2); } while (n < 4) { byte c = vm->res->eseg.get_byte(addr++); - //debug(0, "%02x: %c", c, c > 0x20? c: '.'); + debug(0, "%02x: %c", c, c > 0x20? c: '.'); switch (c) { case 0: ++n; switch (n) { case 1: - //debug(0, "new line\n"); + debug(0, "new line\n"); if (!message.empty()) message += '\n'; break; case 2: - //debug(0, "displaymessage %s", message.c_str()); + debug(0, "displaymessage %s", message.c_str()); if (color == color2) { //pause animation in other slot - { - SceneEvent e(SceneEvent::kPauseAnimation); - e.slot = 0x80 | slot1; - scene->push(e); - } - { - SceneEvent e(SceneEvent::kPlayAnimation); - e.animation = animation2; - e.slot = 0x80 | slot2; - scene->push(e); - } + SceneEvent e1(SceneEvent::kPauseAnimation); + e1.slot = 0x80 | slot1; + scene->push(e1); + + SceneEvent e2(SceneEvent::kPlayAnimation); + e2.animation = animation2; + e2.slot = 0x80 | slot2; + scene->push(e2); } else if (color == color1) { //pause animation in other slot - { - SceneEvent e(SceneEvent::kPauseAnimation); - e.slot = 0x80 | slot2; - scene->push(e); - } - { - SceneEvent e(SceneEvent::kPlayAnimation); - e.animation = animation1; - e.slot = 0x80 | slot1; - scene->push(e); - } - } + SceneEvent e2(SceneEvent::kPauseAnimation); + e2.slot = 0x80 | slot2; + scene->push(e2); - { - message.trim(); - if (message.empty()) - break; + SceneEvent e1(SceneEvent::kPlayAnimation); + e1.animation = animation1; + e1.slot = 0x80 | slot1; + scene->push(e1); + } - SceneEvent e(SceneEvent::kMessage); - e.message = message; - e.color = color; + message.trim(); + if (!message.empty()) { + SceneEvent em(SceneEvent::kMessage); + em.message = message; + em.color = color; if (color == color1) - e.slot = slot1; + em.slot = slot1; if (color == color2) - e.slot = slot2; - scene->push(e); + em.slot = slot2; + scene->push(em); message.clear(); } break; case 3: - color = color == color1 ? color2 : color1; - //debug(0, "changing color to %02x", color); + color = (color == color1) ? color2 : color1; + debug(0, "changing color to %02x", color); break; } break; case 0xff: { - //fixme : wait for the next cycle of the animation + //FIXME : wait for the next cycle of the animation } break; @@ -124,8 +115,8 @@ void Dialog::show(TeenAgentEngine *vm, Scene *scene, uint16 addr, uint16 animati } } - SceneEvent e(SceneEvent::kClearAnimations); - scene->push(e); + SceneEvent ec(SceneEvent::kClearAnimations); + scene->push(ec); } uint16 Dialog::pop(TeenAgentEngine *vm, Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2) { diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp index f7558b60f2..a56a72f021 100644 --- a/engines/teenagent/font.cpp +++ b/engines/teenagent/font.cpp @@ -68,7 +68,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color) i0 = -y; y = 0; } - //debug(0, "char %c, width: %dx%d", c, w, h); + debug(0, "char %c, width: %dx%d", c, w, h); glyph += 2; glyph += i0 * w + j0; byte *dst = (byte *)surface->getBasePtr(x, y); @@ -109,7 +109,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, const Common::String do { j = find_in_str(str, '\n', i); Common::String line(str.c_str() + i, j - i); - //debug(0, "line: %s", line.c_str()); + debug(0, "line: %s", line.c_str()); if (y + (int)height >= 0) { uint w = render(NULL, 0, 0, line, false); diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index 8673a94ad7..dc7c6e563f 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -344,6 +344,7 @@ void Inventory::Item::render(Inventory *inventory, uint item_id, Graphics::Surfa void Inventory::render(Graphics::Surface *surface, int delta) { if (!_active) return; + debug(0, "Inventory::render()"); _background.render(surface); @@ -351,11 +352,10 @@ void Inventory::render(Graphics::Surface *surface, int delta) { for (int x = 0; x < 6; x++) { int idx = x + 6 * y; byte item = _inventory[idx]; - if (item == 0) - continue; - - //debug(0, "%d,%d -> %u", x0, y0, item); - _graphics[idx].render(this, item, surface, delta); + if (item != 0) { + debug(0, "\t(x, y): %d,%d -> item: %u", x, y, item); + _graphics[idx].render(this, item, surface, delta); + } } } } diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp index bbfcab19b2..bb314afdba 100644 --- a/engines/teenagent/music.cpp +++ b/engines/teenagent/music.cpp @@ -89,11 +89,11 @@ bool MusicPlayer::load(int id) { _rows.push_back(row); } else if ((cmd & 0xF0) == 0x50) { byte sample = stream->readByte(); - //debug(1, "%02x: set sample %02x", cmd, sample); + debug(1, "%02x: set sample %02x", cmd, sample); row.channels[(cmd & 0x0F) - 1].sample = sample; } else if ((cmd & 0xF0) == 0x40) { byte vol = stream->readByte(); - //debug(1, "%02x: set volume %02x -> %02x", cmd, row.channels[(cmd & 0x0F) - 1].volume, vol); + debug(1, "%02x: set volume %02x -> %02x", cmd, row.channels[(cmd & 0x0F) - 1].volume, vol); //channel volume 0x40 * music volume 0x40 mixed with high bytes row.channels[(cmd & 0x0F) - 1].volume = vol * 16; } else { @@ -124,13 +124,13 @@ void MusicPlayer::interrupt() { for (int chn = 0; chn < 3; ++chn) { setChannelVolume(chn, row->channels[chn].volume); - //debug(0, "row->channels[%d].volume = %d", chn, row->channels[chn].volume); + debug(0, "row->channels[%d].volume = %d", chn, row->channels[chn].volume); byte sample = (row->channels[chn].sample); if (row->channels[chn].note != 0 && sample != 0) { - //debug(0, "row->channels[%d].note = %d", chn, row->channels[chn].note); - //debug(0, "row->channels[%d].sample = %d", chn, row->channels[chn].sample); + debug(0, "row->channels[%d].note = %d", chn, row->channels[chn].note); + debug(0, "row->channels[%d].sample = %d", chn, row->channels[chn].sample); byte note = row->channels[chn].note; if (_samples[sample].size == 0) { @@ -143,7 +143,7 @@ void MusicPlayer::interrupt() { } } - //debug(0, "------------------------------------------------"); + debug(0, "------------------------------------------------"); ++_currRow; } diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index 748f342d54..7b0f8c7ec5 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -101,7 +101,7 @@ Common::String Object::parse_description(const char *name) { while (*desc != 1 && *desc != 0) { Common::String line; while (*desc != 1 && *desc != 0) { - //debug(0, "%02x ", *desc); + debug(0, "%02x ", *desc); line += *desc++; } diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp index 5302e2eceb..202bdf7db0 100644 --- a/engines/teenagent/pack.cpp +++ b/engines/teenagent/pack.cpp @@ -65,14 +65,14 @@ uint32 FilePack::read(uint32 id, byte *dst, uint32 size) const { file.seek(offsets[id - 1]); uint32 rsize = offsets[id] - offsets[id - 1]; uint32 r = file.read(dst, MIN(rsize, size)); - //debug(0, "read(%u, %u) = %u", id, size, r); + debug(0, "read(%u, %u) = %u", id, size, r); return r; } Common::SeekableReadStream *FilePack::getStream(uint32 id) const { if (id < 1 || id > _fileCount) return NULL; - //debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]); + debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]); return new Common::SeekableSubReadStream(&file, offsets[id - 1], offsets[id]); } @@ -124,14 +124,14 @@ uint32 TransientFilePack::read(uint32 id, byte *dst, uint32 size) const { uint32 rsize = offsets[id] - offsets[id - 1]; uint32 r = file.read(dst, MIN(rsize, size)); file.close(); - //debug(0, "read(%u, %u) = %u", id, size, r); + debug(0, "read(%u, %u) = %u", id, size, r); return r; } Common::SeekableReadStream *TransientFilePack::getStream(uint32 id) const { if (id < 1 || id > _fileCount) return NULL; - //debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]); + debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]); Common::File file; if (!file.open(_filename)) return NULL; diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 7e1c4fd471..8e4d1389f1 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -310,7 +310,7 @@ void Scene::loadOns() { debug(0, "loading ons animation"); uint16 addr = _vm->res->dseg.get_word(0xb4f5 + (_id - 1) * 2); - //debug(0, "ons index: %04x", addr); + debug(0, "ons index: %04x", addr); ons_count = 0; byte b; @@ -457,7 +457,7 @@ byte Scene::peekFlagEvent(uint16 addr) const { } void Scene::push(const SceneEvent &event) { - //debug(0, "push"); + debug(0, "push"); //event.dump(); if (event.type == SceneEvent::kWalk && !events.empty()) { SceneEvent &prev = events.back(); @@ -549,9 +549,9 @@ int Scene::lookupZoom(uint y) const { for (byte *zoom_table = _vm->res->dseg.ptr(_vm->res->dseg.get_word(0x70f4 + (_id - 1) * 2)); zoom_table[0] != 0xff && zoom_table[1] != 0xff; zoom_table += 2) { - //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); + debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); if (y <= zoom_table[0]) { - //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); + debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); return 256u * (100 - zoom_table[1]) / 100; } } @@ -814,7 +814,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { bool visible = true; if (message_first_frame != 0 && message_animation != NULL) { int index = message_animation->currentIndex() + 1; - //debug(0, "message: %s first: %u index: %u", message.c_str(), message_first_frame, index); + debug(0, "message: %s first: %u index: %u", message.c_str(), message_first_frame, index); if (index < message_first_frame) visible = false; if (index > message_last_frame) { @@ -835,7 +835,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { _vm->inventory->activate(false); _vm->processCallback(callback); } - //debug(0, "callback timer = %u", callback_timer); + debug(0, "callback timer = %u", callback_timer); } //if (!current_event.empty()) @@ -901,7 +901,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { bool Scene::processEventQueue() { while (!events.empty() && current_event.empty()) { - //debug(0, "processing next event"); + debug(0, "processing next event"); current_event = events.front(); events.pop_front(); switch (current_event.type) { @@ -1162,7 +1162,7 @@ bool Scene::processEventQueue() { } void Scene::setPalette(unsigned mul) { - //debug(0, "setPalette(%u)", mul); + debug(0, "setPalette(%u)", mul); byte p[3 * 256]; for (int i = 0; i < 3 * 256; ++i) { @@ -1224,13 +1224,13 @@ uint Scene::messageDuration(const Common::String &str) { uint delay_delta = 1 + (255 - speed) * 99 / 255; uint delay = 60 + (total_width * delay_delta) / 8; - //debug(0, "delay = %u, delta: %u", delay, delay_delta); + debug(0, "delay = %u, delta: %u", delay, delay_delta); return delay * 10; } void Scene::displayMessage(const Common::String &str, byte color, const Common::Point &pos) { //assert(!str.empty()); - //debug(0, "displayMessage: %s", str.c_str()); + debug(0, "displayMessage: %s", str.c_str()); message = str; message_pos = (pos.x | pos.y) ? pos : messagePosition(str, position); message_color = color; diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp index 63312990ee..45049ab076 100644 --- a/engines/teenagent/surface.cpp +++ b/engines/teenagent/surface.cpp @@ -34,7 +34,7 @@ Surface::~Surface() { } void Surface::load(Common::SeekableReadStream &stream, Type type) { - //debug(0, "load()"); + debug(0, "load()"); free(); x = y = 0; @@ -48,7 +48,7 @@ void Surface::load(Common::SeekableReadStream &stream, Type type) { y = pos / 320; } - //debug(0, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y); + debug(0, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y); if (stream.eos() || w_ == 0) return; @@ -57,7 +57,7 @@ void Surface::load(Common::SeekableReadStream &stream, Type type) { return; } - //debug(0, "creating surface %ux%u -> %u,%u", w_, h_, x, y); + debug(0, "creating surface %ux%u -> %u,%u", w_, h_, x, y); create(w_, h_, Graphics::PixelFormat::createFormatCLUT8()); stream.read(pixels, w_ * h_); diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index e9629e445d..db3b730d41 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -571,7 +571,7 @@ Common::Error TeenAgentEngine::run() { if ((!scene_busy && inventory->processEvent(event)) || scene->processEvent(event)) continue; - //debug(0, "event"); + debug(0, "event"); switch (event.type) { case Common::EVENT_KEYDOWN: if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) || @@ -590,8 +590,8 @@ Common::Error TeenAgentEngine::run() { examine(event.mouse, current_object); break; case Common::EVENT_RBUTTONDOWN: - //if (current_object) - // debug(0, "%d, %s", current_object->id, current_object->name.c_str()); + if (current_object) + debug(0, "%d, %s", current_object->id, current_object->name.c_str()); if (scene->getId() < 0) break; @@ -799,7 +799,7 @@ void TeenAgentEngine::displayCredits() { ++lines; event.dst.x = (320 - res->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2; event.timer = 11 * lines - event.dst.y + 22; - //debug(0, "credits = %s", event.message.c_str()); + debug(0, "credits = %s", event.message.c_str()); scene->push(event); } @@ -1020,7 +1020,7 @@ void TeenAgentEngine::playSoundNow(byte id) { byte *data = (byte *)malloc(size); res->sam_sam.read(id, data, size); - //debug(0, "playing %u samples...", size); + debug(0, "playing %u samples...", size); Audio::AudioStream *stream = Audio::makeRawStream(data, size, 11025, 0); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream); //dispose is YES by default |